Search Results

Search found 3380 results on 136 pages for 'tim b james'.

Page 111/136 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • Could random.randint(1,10) ever return 11?

    - by Tim Pietzcker
    When researching for this question and reading the sourcecode in random.py, I started wondering whether randrange and randint really behave as "advertised". I am very much inclined to believe so, but the way I read it, randrange is essentially implemented as start + int(random.random()*(stop-start)) (assuming integer values for start and stop), so randrange(1, 10) should return a random number between 1 and 9. randint(start, stop) is calling randrange(start, stop+1), thereby returning a number between 1 and 10. My question is now: If random() were ever to return 1.0, then randint(1,10) would return 11, wouldn't it?

    Read the article

  • Referencing an array to a pointer

    - by james
    I want to refer a pointer to an array by another pointer. Example: void exp() { double var[2]; exp1(&var[0]); printf("\n varvalue is %lf\n",var[0]); } void exp1(double *var) { //updating the value *var[0]=4.0; exp2(&var[0]); } void exp2(double *var) { *var[0]=7.0; } This should update the value as 7.0(the last update).I am getting an array like invalid argument type of unary(*) . How can i correct this?where i am going wrong here?

    Read the article

  • C vs C++ function questions

    - by james
    I am learning C, and after starting out learning C++ as my first compiled language, I decided to "go back to basics" and learn C. There are two questions that I have concerning the ways each language deals with functions. Firstly, why does C "not care" about the scope that functions are defined in, whereas C++ does? For example, int main() { donothing(); return 0; } void donothing() { } the above will not compile in a C++ compiler, whereas it will compile in a C compiler. Why is this? Isn't C++ mostly just an extension on C, and should be mostly "backward compatible"? Secondly, the book that I found (Link to pdf) does not seem to state a return type for the main function. I check around and found other books and websites and these also commonly do not specify return types for the main function. If I try to compile a program that does not specify a return type for main, it compiles fine (although with some warnings) in a C compiler, but it doesn't compile in a C++ compiler. Again, why is that? Is it better style to always specify the return type as an integer rather than leaving it out? Thanks for any help, and just as a side note, if anyone can suggest a better book that I should buy that would be great!

    Read the article

  • Netbeans IDE tutorials

    - by James P.
    I mostly use Eclipse but have mentionned Netbeans on my cv. Are there any good concise and up-to-date tutorials apart from the official ones that could bring me up to speed on how to use the IDE efficiently (shortcuts, debugging, views ...)? This excludes programming tutorials as I don't really need them unless there's a special manipulation involved.

    Read the article

  • MATLAB: How do I get 3D coordiantes from a user-click?

    - by Tim
    I'm using Matlab to create a small chess game for one of my courses this semester. The thing I'm having trouble with is having the user be able to select one of the chess pieces. To simplify things, I'm making it so that the user selects a piece by clicking on the square that the chess piece resides on rather than clicking the piece itself (which I assume would be much more difficult). I know how to get the x and y coordinates of the view-port, but how do I transform these coordinates into 3-space coordinates? I know that there are multiple x,y,z coordinates associated with each view-port coordinate, but I'm only interested in the x,y,z coordinate where z = 0 (since the board itself is in the x,y plane that intersects the z axis where z = 0). Thanks!

    Read the article

  • does jQuery UI have a way to achieve this Flash button's functionality?

    - by Tim
    There's a button in Flash which looks something like a jQuery SplitButton. The Flash button consists of two parts, the text and the icon. [text portion] [v] I have used it to display string search operators for the user: equals, starts with, ends with, contains. In Flash, when the icon is clicked, the text-area drops down a list of choices; it would look like this: [ ] [v] equals starts with ends with contains And when the user makes a choice from the list, the choice is displayed in the text area of the button and the list rolls up. [ starts with ] [v] I'm trying to convert my Flash app and am hoping to come up with a counterpart to this functionality. For space considerations on the form, a radio-button-group would be less than ideal. That's the major virtue of this Flash button -- it's very economical in its use of screen real-estate. Thanks for any answers/suggestions.

    Read the article

  • How to get the ID of the last insert.

    - by James Jeffery
    I have an application and around 20 accounts are created per minute (on average). I need to implement a new feature which requires the ID of the last insert. I am using PDO. The question is, lets say 5 users create accounts at exactly the same time. Will it return the ID from the database for that users profile that was just created, or will it return the last insert? If you get what I mean.

    Read the article

  • RESTful web service, PUTting an unnamed resource?

    - by James L
    I have a back-end service that creates unique identifiers for resources. The general idea is that resources are saved and versioned, so you can perform: GET http://service/sales/targets/7818181919/latest or GET http://service/sales/targets/7818181919/4 for version 4, and so on. My question is about the most correct way to upload these resources in the first place. How about: PUT http://service/sales/targets/ returning 303 See other /service/sales/targets/ It seems a little wrong as you should PUT and GET from exactly the same place using a resource-oriented interface, but I can't think of a better option. Any ideas?

    Read the article

  • Using Large Arrays in VB.NET

    - by Tim
    I want to extract large amounts of data from Excel, manipulate it and put it back. I have found the best way to do this is to extract the data from an Excel Range in to a large array, change the contents on the array and write it back to the Excel Range. I am now rewriting the application using VB.NET 2008/2010 and wish to take advantage of any new features. Currently I have to loop through the contents of the array to find elements with certain values; also sorting large arrays is cumbersome. I am looking to use the new features, including LINQ to manipulate the data in my array. Does anybody have any advice on the easiest ways to filter / query, sort etc. data in a large array. Also what are the reasonable limits to the size of the array? ~Many Thanks

    Read the article

  • Perl Term::ReadKey don't wait for newline

    - by tim
    In a perl script, I'm trying to accept input without blocking and without echoing the characters entered (The script is producing output and I want to have 'hotkeys' to alter its behaviour). I got as far as using use Term::ReadKey; ReadMode( "cbreak", STDIN ); if($input = ReadKey($pause_time, STDIN)){ #process input } But once the user types anything then the script stops until a newline is entered. I'd like the input to be processed per-character, without waiting for a newline.

    Read the article

  • Visual Studio Property Page Inherit Macros From Other Projects

    - by James
    So I am having a very difficult time finding a solution to this problem. Is there any way that I can inherit macros from another project. For example, for the post build I would like to use the macro for the RemoteMachine address that is located in one project in all the other projects. I was thinking something like (ProjectContainingMacro.$RemoteMachine) ... does anyone have any suggestions?

    Read the article

  • Reference an object, based on a variable with it's name in it

    - by James G
    I'm looking for a way to reference an object, based on a variable with it's name in it. I know I can do this for properties and sub properties: var req = {body: {jobID: 12}}; console.log(req.body.jobID); //12 var subProperty = "jobID"; console.log(req.body[subProperty ]); //12 var property = "body"; console.log(req[property][subProperty]); //12 is it possible for the object itself? var req = {body: {jobID: 12}}; var object = "req"; var property = "body"; var subProperty = "jobID"; console.log([object][property][subProperty]); //12 or console.log(this[object][property][subProperty]); //12 Note: I'm doing this in node.js not a browser. Here is an exert from the function: if(action.render){ res.render(action.render,renderData); }else if(action.redirect){ if(action.redirect.args){ var args = action.redirect.args; res.redirect(action.redirect.path+req[args[0]][args[1]]); }else{ res.redirect(action.redirect.path); } } I could work around it by changing it to this, but I was looking for something more dynamic. if(action.render){ res.render(action.render,renderData); }else if(action.redirect){ if(action.redirect.args){ var args = action.redirect.args; if(args[0]==="req"){ res.redirect(action.redirect.path+req[args[1]][args[2]]); }else if(args[0]==="rows"){ rows.redirect(action.redirect.path+rows[args[1]][args[2]]); } }else{ res.redirect(action.redirect.path); } }

    Read the article

  • char pointer array in c#

    - by james
    consider the following c++ code #include "stdafx.h" #include<iostream> using namespace std; void ping(int,char* d[]); void ping(int a,char *b[]) { int size; size=sizeof(b)/sizeof(int); // total size of array/size of array data type //cout<<size; for(int i=0;i<=size;i++) cout<<"ping "<<a<<b[i]<<endl; } int _tmain(int argc, _TCHAR* argv[]) { void (*funcptr)(int,char* d[]); char* c[]={"a","b"}; funcptr= ping; funcptr(10,c); return 0; } how can i implement the same in c#.. m new to c#. how can i have char pointer array in c#?

    Read the article

  • How does one get access to the Flash object's vars in IE?

    - by Tim
    Is there a way in IE Browsers to access the Flash object? In this case it is made with mootools swiff. It´s working fine in all other browsers, because they can wrap this object correctly. But it does not work in IE. Here is the script: var swfObj = $('mbImage').getElement('object'); swfObj.get('data'); <--- Thats not working in IE

    Read the article

  • validates_associated not honoring :if

    - by James Ferguson
    I'm totally blocked on this. See this pastie for sample code: http://pastie.org/990040 The first test will fail. The user model validates an associated address model, but is only supposed to do it if a flag is true. In practice it does it all the time. What is going on?

    Read the article

  • Database tables with dynamic information

    - by Tim Fennis
    I've googled this and found that it's almost impossible to create a database with dynamic collumns. I'll explain my problem first. I am making a webshop for a customer. It has multiple computer products for sale. CPU's HDD's RAM ect. All these products have different properties, a CPU has an FSB, RAM has a CAS latency. But this is very inconvenient because my orders table needs foreign keys to different tables which is impossible. An other option is to store all the product specific information in a varchar or blob field and let PHP figure it out. The problem with this solution is that the website needs a PC builder. A step-by-step guide to building your PC. So for instance if a customer decides he wants a new "i7 920" or whatever i want to be able to sellect all motherboards for socket 1366, which is impossible because all the data is stored in one field. I know it's possible to select all motherboards form the DB and let PHP figure out which ones are for socket 1366 but i was wondering, is there a better solution?

    Read the article

  • Javascript to change image form submit button src not working.

    - by james
    I'm trying to change the src of an image form submit button using an onclick, but it doesn't seem to be working correctly. Am I missing something? <input class="submit_image" id="my_form_button" onclick="$('my_form_button').src='/images/buttons/submitting.gif'" src="/images/buttons/submit.gif" type="image" /> I've also tried using the same JS on the form tag using onsubmit with no luck.

    Read the article

  • Commiting broken code to the repository for the purpose of backing it up

    - by Tim Merrifield
    I was just talking to another developer (more senior than I) and trying to convince him that we should implement continuous integration via Cruise Control. He told me that this will not work because he commits code that does not compile to the repository all the time for the purposes of backing it up. And that automated builds notifying us of failures would be just noise. Committing garbage to the repo sounds bad to me. But I was at a loss of words and didn't know what to say. What is the alternative? What's the best practice for backing up your code on another machine without adding a bunch of pointless revisions? BTW, our version control system is SVN and that probably won't change any time soon.

    Read the article

  • Memory interleaving

    - by Tim Green
    Hello, I have this question that has me rather confused. Suppose that a 1G x 32-bit main memory is built using 256M x 4-bit RAM chips and that this memory is byte-addressable. I have deduced that one would require 4*1G = 2^2*2*30 = 2^32 - so 32 bits to address the full memory. My problem now comes with, say, if you had memory (byte) address "14", determine which memory module this would go into. (There would have to be 8 chips per module to make the 32-bit wide memory, and 4 modules overall giving 32 chips in total. Modules are numbered from 0). In high-order interleave, it appears trivial that it's the first (0) memory module given a lot of the first few bits are 0. However, low-order interleave has me stumped. I can't figure out (for sure) how many bits are used to determine a memory module (possibly 2, given there are 4 in total?). The given solution is Module 3. This is not homework in the same sense so I will not be tagging it as such.

    Read the article

  • Anyone plotting SO via code_swarm?

    - by Tim Post
    Is anyone working on something to render individual questions, or SO as a whole with codeswarm? If so, can you post a link to your work that transforms SO questions into revisions that codeswarm can understand (i.e. svn?) It would be really, really cool to see SO played (as a whole) via codeswarm, so I hope to not only ask if anyone is working it, but see if anyone is interested in trying to accomplish it. Augmenting that, will database dumps be made available? EDIT: Database dumps have since been made available :) Enough with user voice, is anyone doing it? If so, what VCS did you mock?

    Read the article

  • Set AUTO_INCREMENT value programmatically

    - by Tim
    So this works... ALTER TABLE variation AUTO_INCREMENT = 10; But I want to do this; ALTER TABLE variation AUTO_INCREMENT = (SELECT MAX(id)+1 FROM old_db.varaition); but that doesnt work, and neither does; SELECT MAX(id)+1 INTO @old_auto_inc FROM old_db.variation ALTER TABLE variation AUTO_INCREMENT = @old_auto_inc; So does anyone know how to do this? ( I'm trying to ensure that AUTO_INCREMENT keys dont collide between an old and a new site and need to do this automatically. So I can just run a script when the new db goes live )

    Read the article

  • How do I add animation to an iPhone app?

    - by james p
    So I came from a Flash background where I can animate in timeline. I've completed the Beginning iPhone Development book and just realized that I still don't know how to get an animation in. I'm guessing I need to import png sequences? Can anyone point me to an appropriate place to learn more about this topic? I want to make a game and my game objects need to animate. Thanks in advance!!

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >