Daily Archives

Articles indexed Monday April 26 2010

Page 12/110 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Fragment Shader Eye-Space unscaled depth coordinate

    - by Ben Jones
    I'm trying to use the unscaled (true distance from the front clipping plane) distance to objects in my scene in a GLSL fragment shader. The gl_FragCoord.z value is smaller than I expect. In my vertex shader, I just use ftransform() to set gl_Position. I'm seeing values between 2 and 3 when I expect them to be between 15 and 20. How can I get the real eye-space depth? Thanks!

    Read the article

  • Sum in array with match value

    - by user325504
    Dear all, I would like to do a simple sum per salesid in php - mysql after cross calculation between date (2 table) to get the real time commission, all the value already come out correctly but I got problem with final sum per sales id. salesid-commission aa0001 - 1000 bb0001 - 500 aa0001 - 200 bb0001 - 50 I already try with few sample in this web but still cannot meet the correct result. I cannot do the sum in mysql because of some reason (need calculation with other table) the result will be: aa0001 - 1200 bb0001 - 550 I aprreciated for any help to complated the test. Thank you so much.

    Read the article

  • Why doesn't Linux use the hardware context switch via the TSS?

    - by smwikipedia
    Hi guys! I read the following statement: The x86 architecture includes a specific segment type called the Task State Segment (TSS), to store hardware contexts. Although Linux doesn't use hardware context switches, it is nonetheless forced to set up a TSS for each distinct CPU in the system. I am wondering: Why doesn't Linux use the hardware support for context switch? Isn't the hardware approach much faster than the software approach? Is there any OS which does take advantage of the hardware context switch? Does windows use it? At last and as usual, thanks for your patience and reply.

    Read the article

  • Java appliction design question

    - by ring bearer
    Hi I have a hobby project, which is basically to maintain 'todo' tasks in the way I like. One task can be described as: public class TodoItem { private String subject; private Date dueBy; private Date startBy; private Priority priority; private String category; private Status status; private String notes; } as you can imagine I would have 1000 todo items at a given time. What is the best strategy to store a todo item? (currently on an XML file) such that all the items are loaded quickly up on app start up(the application shows kind of a dashboard of all the items at start up) What is the best way to design its back-end so that it can be ported to android/or a J2ME based phone Currently this is done using java swing. What should be the concerns so that it works efficiently on a device where memory is limited? Thanks!

    Read the article

  • Constraint Validation

    - by tanuja
    I am using javax.validation.Validator and relevant classes for annotation based validation. Configuration<?> configuration = Validation.byDefaultProvider().configure(); ValidatorFactory factory = configuration.buildValidatorFactory(); Validator validator = factory.getValidator(); Set<ConstraintViolation<ValidatableObject>> constraintViolations = validator.validate(o); for (ConstraintViolation<ValidatableObject> value : constraintViolations) { List< Class< ? extends ConstraintValidator< ? extends Annotation,?>>> list = value.getConstraintDescriptor().getConstraintValidatorClasses(); } I get a compilation error stating: Type mismatch: cannot convert from List< Class< ? extends ConstraintValidator< capture#4-of ?,? to List< Class< ? extends ConstraintValidator< ? extends Annotation,? What am I missing?

    Read the article

  • How do I dynamically name objects in Java?

    - by hatboysam
    Let's say I needed to make a series of String[] objects. I know that if i wanted to make a string array called "test" to hold 3 Strings I could do String[] test = new String[3]; But let's say I needed to make a series of these arrays and I wanted them to be named, 1,2, 3, 4, 5... etc. For however many I needed and I didn't know how many I'd need. How do I achieve a similar effect to this: for (int k=0; k=5; k++){ String[] k = new String[3]; } Which would created 5 string arrays named 1 through 5. Basically I want to be able to create array objects with a name detemined by some other function. Why can't I seem to do this? Am I just being stupid?

    Read the article

  • Is there a method in Java that allows me to replace all HTML special characters into their encoded e

    - by Siracuse
    I have a textfile which my Java program is modifying and putting into an HTML file for display. However, this textfile contains lots of HTML unsafe characters such as "<" and the "" which would need to be encoded into & gt; (sans space) and & lt;. Is there some library method I can use to sanatize my text document to replace all these HTML special characters with their safe encoded equivelants?

    Read the article

  • How does one pre-populate a Python Formish form?

    - by Jace
    How does one pre-populate a Formish form? The obvious method as per the documentation doesn't seem right. Using one of the provided examples: import formish, schemaish structure = schemaish.Structure() structure.add( 'a', schemaish.String() ) structure.add( 'b', schemaish.Integer() ) schema = schemaish.Structure() schema.add( 'myStruct', structure ) form = formish.Form(schema, 'form') If we pass this a valid request object: form.validate(request) The output is a structure like this: {'myStruct': {'a': 'value', 'b': 0 }} However, pre-populating the form using defaults requires this: form.defaults = {'myStruct.a': 'value', 'myStruct.b': 0} The dottedish package has a DottedDict object that can convert a nested dict to a dotted dict, but this asymmetry doesn't seem right. Is there a better way to do this?

    Read the article

  • python multithread "maximum recursion depth exceed"

    - by user293487
    I use Python multithread to realize Quicksort. Quicksort is implement in a function. It is a recursive function. Each thread calls Quicksort to sort the array it has. Each thread has its own array that stores the numbers needs to be sorted. If the array size is smaller (<10,000). It runs ok. However, if the array size is larger, it shows the "maximum recursion depth exceed". So, I use setrecursionlimit () function to reset the recursion depth to 1500. But the program crash directly...

    Read the article

  • Haml formatting

    - by mathee
    I'm new to haml, so I'm still trying to figure out the formatting. I have an index.haml file with the following code. %h1 Welcome to Solidarity Hello, = @profile.first_name ! It renders like this: Welcome to SolidarityHello, user ! Here's the page source: <h1> Welcome to Solidarity </h1> Hello, frances ! It has a space between @profile.first_name and the exclamation mark. Why is that? And, how do I fix it?

    Read the article

  • Image drawing library for Haskell?

    - by absz
    I'm working on a Haskell program for playing spatial games: I have a graph of a bunch of "individuals" playing the Prisoner's Dilemma, but only with their immediate neighbors, and copying the strategies of the people who do best. I've reached a point where I need to draw an image of the world, and this is where I've hit problems. Two of the possible geometries are easy: if people have four or eight neighbors each, then I represent each one as a filled square (with color corresponding to strategy) and tile the plane with these. However, I also have a situation where people have six neighbors (hexagons) or three neighbors (triangles). My question, then, is: what's a good Haskell library for creating images and drawing shapes on them? I'd prefer that it create PNGs, but I'm not incredibly picky. I was originally using Graphics.GD, but it only exports bindings to functions for drawing points, lines, arcs, ellipses, and non-rotated rectangles, which is not sufficient for my purposes (unless I want to draw hexagons pixel by pixel*). I looked into using foreign import, but it's proving a bit of a hassle (partly because the polygon-drawing function requires an array of gdPoint structs), and given that my requirements may grow, it would be nice to use an in-Haskell solution and not have to muck about with the FFI (though if push comes to shove, I'm willing to do that). Any suggestions? * That is also an option, actually; any tips on how to do that would also be appreciated, though I think a library would be easier.

    Read the article

  • windows service log on as user a/c on different PC on same workgroup

    - by maruti
    trying to run a service (logon as admin@PC2) from PC1, when both are in work-group fails. why could this happen? OS is win-2003 and please let me know if any windows remote services have to be turned on or firewall configuration? does having PC's on same workgroup help? let me clarify the question: I am unable to see other computers from "Services Logon Tab select User" Object types available are only "users, built in security principals" Location is only local computer. But this is available from mmc console..add snap in how can this be available on services control panel?

    Read the article

  • Adventures in Drupal multisite config with mod_rewrite and clean urls

    - by moexu
    The university where I work is planning to offer Drupal hosting to staff/faculty who want a Drupal site. We've set up Drupal multisite with clean urls and it's mostly working except for some weird redirects. If you have two sites where one is a substring of the other then you'll randomly be redirected to the other site. I tracked the problem to how mod_rewrite does path matching, so with a config file like this: RewriteCond %{REQUEST_URI} ^/drupal RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /drupal/index.php?q=$1 [last,qsappend] RewriteCond %{REQUEST_URI} ^/drupaltest RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /drupaltest/index.php?q=$1 [last,qsappend] /drupaltest will match the /drupal line and all of the links on the /drupaltest page will be rewritten to point to /drupal. If you put the end of string character ($) at the end of each rewrite condition then it will always match on the correct site and the links will always be rewritten correctly. That breaks down as soon as a user logs in though because the query string is appended to the url so just the base url will no longer match. You can also fix the problem by ordering the sites in the config file so that the smallest substring will always be last. I suggested storing all of the sites in a table and then querying, sorting, and rewriting the config file every time a Drupal site is requested so that we could guarantee the order. The system administrator thought that was kludgy and didn't address the root problem. Disabling clean urls should also fix the problem but the users really want them so I'd prefer to keep them if possible. I think we could also fix it by using an .htaccess file in each site to handle the clean url rewriting but that also seems suboptimal since it will generate a higher load on the server and the server is intended to host the majority of the university's external facing web content. Is there some magic I can do with mod_rewrite to get it to work? Would another solution be better? Am I doing something the wrong way to begin with?

    Read the article

  • Adding EXIF Lens data for manual lens (e.g "Lens Baby")

    - by dbr
    I have a Lens Baby Composer, which is an entirely mechanical lens (no electronics in it), so the camera body cannot determine what lens is attached.. So obviously the metadata does not contain the lens info.. Is there any way to manually set this metadata, so the photos don't show up as "Unknown Lens"? It's a Canon 5D Mark II (so the native files are .cr2), and I convert them to DNG with Lightroom

    Read the article

  • How can I keep the code formated as original source when I paste them to vim?

    - by SpawnST
    When I copy some code from webpages and paste it to VIM,I find it becomes a mess style like a ladder as follows xxxxxx xxxxxx xxxxxx xxxxxxxxxx Since it messed so regularly so I think maybe there's something wrong with my .vimrc which is as below: set number set nocompatible set nowritebackup set noswapfile syntax on filetype indent on filetype plugin on filetype on set background=light set autoindent set smartindent set tabstop=4 set shiftwidth=4 set showmatch set guioptions=T set fileencodings=utf-8,prc set ruler set incsearch map gs :%s set t_Co=256 :colorscheme evening filetype plugin indent on Usually I write python in VIM.And help would be appreciated.

    Read the article

  • Virtualbox and Serial Port permissions

    - by Pandincus
    I have a Windows XP Pro SP3 host machine running a Windows XP Pro SP3 guest machine. The host machine has one serial port, COM1, that I need to use in the guest machine. When I add the serial port to the guest machine and try to start it, I get the following error: Failed to start the virtual machine xxx Cannot open host device 'COM1' for read/write access. Check the permissions of that device (VERR_ACCESS_DENIED). Unknown error creating VM (VERR_ACCESS_DENIED). What are some of the things that might be causing this problem? How can I check "permissions" on a serial port?

    Read the article

  • Java application design question

    - by ring bearer
    I have a hobby project, which is basically to maintain 'todo' tasks in the way I like. One task can be described as: public class TodoItem { private String subject; private Date dueBy; private Date startBy; private Priority priority; private String category; private Status status; private String notes; } As you can imagine I would have 1000s of todo items at a given time. What is the best strategy to store a todo item? (currently on an XML file) such that all the items are loaded quickly up on app start up(the application shows kind of a dashboard of all the items at start up)? What is the best way to design its back-end so that it can be ported to Android/or a J2ME based phone? Currently this is done using Java Swing. What should I concentrate on so that it works efficiently on a device where memory is limited? The application throws open a form to enter new todo task. For now, I would like to save the newly added task to my-todos.xml once the user presses "save" button. What are the common ways to append such a change to an existing XML file?(note that I don't want to read the whole file again and then persist)

    Read the article

  • UIImages not displaying in TableView on iPhone, but working in Simulator

    - by Graeme
    Hi, I have a UITable View that displays an image in the left hand side of the table cell, and it works fine in the simulator. Only problem is, once I ran it on my device no images appear. It's just a blank white space. Have checked that images are added to resource folder for build (which they are) and that capitals etc. match (which they do). Any ideas? Thanks. Code to display images: cell.imageView.layer.masksToBounds = YES; cell.imageView.layer.cornerRadius = 5.0; UIImage *image = [UIImage imageNamed:[[dog types] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];; if ( image ) { cell.imageView.image = [image imageScaledToSize:CGSizeMake(50, 50)]; }

    Read the article

  • ASP NET MVC Error In Funcion

    - by rah.deex
    hello it's me again... thx b4 to experts who have provided solutions to my question.. now i've got some trouble again, would you please halp me... this is my code (i've got this sample from the internet n i try to modify it) :) private void FillGridData() { //IQueryable<SVC> query = _customerService.GetQueryable(); _dataContext = new dbServiceModelDataContext(); var query = from m in _dataContext.SVCs select m; query = AddQuerySearchCriteria(query, _grid.SearchForm); int totalRows = query.Count(); _grid.Pager.Init(totalRows); if (totalRows == 0) { _grid.Data = new List<SVC>(); return; } query = AddQuerySorting(query, _grid.Sorter); query = AddQueryPaging(query, _grid.Pager); List<SVC> customers = query.ToList(); //***ERROR IN HERE***// _grid.Data = customers; } the error says "Cannot order by type 'System.Object'.", what is the matter? do you have solution for me, please...

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >