Search Results

Search found 2162 results on 87 pages for 'jason moore'.

Page 7/87 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Javascript: Collision detection

    - by jack moore
    Hello, could someone please help me to understand how collision detection works in JS? I can't use jQuery or gameQuery - already using prototype - so, I'm looking for something very simple. Not asking for complete solution, just point me to the right direction. Let's say there's: <div id="ball"></div> and <div id="someobject0"></div> Now the ball is moving (any direction). "Someobject"(0-X) is already pre-defined and there's 20-60 of them randomly positioned like this: #someobject {position: absolute; top: RNDpx; left: RNDpx;} I can create an array with "someobject(X)" positions and test collision while the "ball" is moving... Something like: for(var c=0; c<objposArray.length; c++){ ........ and code to check ball's current position vs all objects one by one.... } But I guess this would be a "noob" solution and it looks pretty slow. Is there anything better?

    Read the article

  • Any good SASS parser for PHP?

    - by Andrew Moore
    I'm currently using a modified CSS Cacheer as an alternative but its syntax is somewhat vague and adoption is, well, abysmally low... Documentation is hard to come by as well. I'm looking to switch to SASS as it has a bigger user base than CSS Cacheer and better documentation. I am aware of phpHaml but it doesn't have support for SASS yet. Any recommendation on a SASS parser for PHP? Preferably it should support SassScript.

    Read the article

  • How do I force Eclipse to rebuild if files in another project change (any change)?

    - by James Moore
    I've got an Eclipse (Galileo) project (called ProguardBuilder) that runs Proguard over a set of class files in other projects and produces a jar file. I'd like to have the ProguardBuilder project get rebuilt any time any class file in the other projects changes. AutoBuild doesn't do that; presumably it's smart enough to recognize and ignore any changes that don't affect anything externally visible. My problem is that I don't care whether or not the change is visible, since I need to completely rebuild ProguardBuilder any time the class files it depends on change at all. How do I tell Eclipse to do this sort of rebuild?

    Read the article

  • What could make GetCursorPos return incorrect coordinates of {0,0} ?

    - by Dave Moore
    We are seeing bad behavior in an application when it runs on Server 2008 (not R2). This is a WinForms application, and Control.MousePosition is returning {0,0} no matter where the mouse is on the screen... Control.MousePosition just makes a P/Invoke call to Win32 api GetCursorPos(). There is a control in our library that calls SetWindowsHookEx to hook WH_CALLWNDPROCRET for our entire process. I'm suspicious of this code, but tracing statements show that we're getting in + out of that hook cleanly. What else should I be looking for? Thanks, Dave

    Read the article

  • Is there a C# (.net) library similar to GNU readline?

    - by paul.moore.name
    I'm considering writing a console application in C# and I want to incorporate history, completion and command line editing features something like GNU readline (but not necessarily as extensive as that!) Is there an existing library for .net which provides this type of functionality? I guess one option would be to use interop services to call GNU readline. But is there a native option? Paul.

    Read the article

  • How do chains work in Rainbow tables?

    - by James Moore
    Hello, I was wondering if should one could explain in detail how chains work in rainbow tables as though you would a complete novice but with relevance to programming. I understand that a chain is 16 bytes long. 8 bytes mark the starting point and 8 mark the end. I also understand that in the filename we have the chain length i.e. 2400. Which means that between our starting point and end point in just 16 bytes we have 2400 possible clear texts? What? How does that work? in those 16 bytes how do i get my 2400 hashes and clear texts or am i miss understanding this? Your help is greatly appreciated. Thanks P.s. I have read the related papers and googled this topic a fair bit. I think im just missing something important to make these gears turn.

    Read the article

  • Which of these is better practice?

    - by Fletcher Moore
    You have a sequence of functions to execute. Case A: They do not depend on each other. Which of these is better? function main() { a(); b(); c(); } or function main() { a(); } function a() { ... b(); } function b() { ... c(); } Case B: They do depend on successful completion of the previous. function main() { if (a()) if (b()) c(); } or function main() { if (!a()) return false; if (!b()) return false; c(); } or function main() { a(); } function a() { ... // maybe return false b(); } funtion b() { ... // maybe return false c(); } Better, of course, means more maintainable and easier to follow.

    Read the article

  • Creating a ListView using Category View

    - by Andrew Moore
    I currently have an application which uses a regular ListView with groups to show a bunch of modules. I would like to use a Category view. Category view is the new view introduced in Windows Vista for the Control Panel: Is there a third party control or a way (via API) to create a ListView which mimics the behavior of the Windows 7 Control Panel? Categories with icons and action links. Separate events for Category Click and Action Click. One or two column layout Separators between action links or lines

    Read the article

  • Resizing image to fit its container

    - by jack moore
    #foo {width: 300px; height: 400px; overflow: hidden;} <div id="foo"></div> this.someimage = randomImageUrl; $("foo").innerHTML = "<img src='"+this.someimage+"' class='fooimage' />"; Now, the picture could be 200x200 or 1100x400 ... it's totally random. I can just stretch it (or reduce its size) by using: .fooimage {width: 300px; height: 400px;} $("foo").innerHTML = "<img src='"+this.someimage+"' class='fooimage' />"; Or I could test its size: imgHeight = newImg.height; imgWidth = newImg.width; ... and maybe something like this: if(imgHeight >400){ $("foo").innerHTML = "<img src='"+this.someimage+"' height='400' />"; } and browsers will do the rest. But there must be something better. Any ideas? Thanks! :)

    Read the article

  • SDL_ttf and Numbers (int)

    - by jack moore
    int score = 0; char* fixedscore=(char*)score; . . . imgTxt = TTF_RenderText_Solid( font, fixedscore, fColor ); ^^ This doesn't work - looks like fixedscore is empty or doesn't exists. int score = 0; char* fixedscore=(char*)score; . . . imgTxt = TTF_RenderText_Solid( font, "Works fine", fColor ); ^^ Works fine, but... I guess converting int to char* doesn't really work. So how do you print scores in SDL? Oh and one more thing: why is the text so ugly? Any help would be appreciated. Thanks.

    Read the article

  • What is the cleanest way to use anonymous functions?

    - by Fletcher Moore
    I've started to use Javascript a lot more, and as a result I am writing things complex enough that organization is becoming a concern. However, this question applies to any language that allows you to nest functions. Essentially, when should you use an anonymous function over a named global or inner function? At first I thought it was the coolest feature ever, but I think I am going overboard. Here's an example I wrote recently, ommiting all the variable delcarations and conditionals so that you can see the structure. function printStream() { return fold(function (elem, acc) { ... var comments = (function () { return fold(function (comment, out) { ... return out + ...; }, '', elem.comments); return acc + ... + comments; }, '', data.stream); } I realized though (I think) there's some kind of beauty in being so compact, it is probably isn't a good idea to do this in the same way you wouldn't want a ton of code in a double for loop.

    Read the article

  • JAVA Inheritance Generics and Casting.

    - by James Moore
    Hello, I have two classes which both extends Example. public class ClassA extends Example { public ClassA() { super("a", "class"); } .... } public class ClassB extends Example { public ClassB() { super("b", "class"); } .... } public class Example () { public String get(String x, String y) { return "Hello"; } } So thats all very well. So suppose we have another class called ExampleManager. With example manager I want to use a generic type and consequently return that generic type. e.g. public class ExampleManager<T extends Example> { public T getExample() { return new T("example","example"); // So what exactly goes here? } } So where I am returning my generic type how do i get this to actually work correctly and cast Example as either classA or classB? Many Thanks

    Read the article

  • c windows connect() fails. error 10049

    - by Joshua Moore
    The following two pieces of code compile, but I get a connect() failed error on the client side. (compiled with MinGW). Client Code: // thanks to cs.baylor.edu/~donahoo/practical/CSockets/code/TCPEchoClientWS.c #include <stdio.h> #include <winsock.h> #include <stdlib.h> #define RCVBUFSIZE 32 // size of receive buffer void DieWithError(char *errorMessage); int main(int argc, char* argv[]) { int sock; struct sockaddr_in echoServAddr; unsigned short echoServPort; char *servIP; char *echoString; char echoBuffer[RCVBUFSIZE]; int echoStringLen; int bytesRcvd, totalBytesRcvd; WSAData wsaData; if((argc < 3) || (argc > 4)){ fprintf(stderr, "Usage: %s <Sever IP> <Echo Word> [<Echo Port>]\n", argv[0]); exit(1); } if (argc==4) echoServPort = atoi(argv[3]); // use given port if any else echoServPort = 7; // echo is well-known port for echo service if(WSAStartup(MAKEWORD(2, 0), &wsaData) != 0){ // load winsock 2.0 dll fprintf(stderr, "WSAStartup() failed"); exit(1); } // create reliable, stream socket using tcp if((sock=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithError("socket() failed"); // construct the server address structure memset(&echoServAddr, 0, sizeof(echoServAddr)); echoServAddr.sin_family = AF_INET; echoServAddr.sin_addr.s_addr = inet_addr(servIP); // server IP address echoServAddr.sin_port = htons(echoServPort); // establish connection to the echo server if(connect(sock, (struct sockaddr*)&echoServAddr, sizeof(echoServAddr)) < 0) DieWithError("connect() failed"); echoStringLen = strlen(echoString); // determine input length // send the string, includeing the null terminator to the server if(send(sock, echoString, echoStringLen, 0)!= echoStringLen) DieWithError("send() sent a different number of bytes than expected"); totalBytesRcvd = 0; printf("Received: "); // setup to print the echoed string while(totalBytesRcvd < echoStringLen){ // receive up to the buffer size (minus 1 to leave space for a null terminator) bytes from the sender if(bytesRcvd = recv(sock, echoBuffer, RCVBUFSIZE-1, 0) <= 0) DieWithError("recv() failed or connection closed prematurely"); totalBytesRcvd += bytesRcvd; // keep tally of total bytes echoBuffer[bytesRcvd] = '\0'; printf("%s", echoBuffer); // print the echo buffer } printf("\n"); closesocket(sock); WSACleanup(); exit(0); } void DieWithError(char *errorMessage) { fprintf(stderr, "%s: %d\n", errorMessage, WSAGetLastError()); exit(1); } Server Code: // thanks cs.baylor.edu/~donahoo/practical/CSockets/code/TCPEchoServerWS.c #include <stdio.h> #include <winsock.h> #include <stdlib.h> #define MAXPENDING 5 // maximum outstanding connection requests #define RCVBUFSIZE 1000 void DieWithError(char *errorMessage); void HandleTCPClient(int clntSocket); // tcp client handling function int main(int argc, char **argv) { int serverSock; int clientSock; struct sockaddr_in echoServerAddr; struct sockaddr_in echoClientAddr; unsigned short echoServerPort; int clientLen; // length of client address data structure WSAData wsaData; if (argc!=2){ fprintf(stderr, "Usage: %s <Server Port>\n", argv[0]); exit(1); } echoServerPort = atoi(argv[1]); if(WSAStartup(MAKEWORD(2, 0), &wsaData)!=0){ fprintf(stderr, "WSAStartup() failed"); exit(1); } // create socket for incoming connections if((serverSock=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))<0) DieWithError("socket() failed"); // construct local address structure memset(&echoServerAddr, 0, sizeof(echoServerAddr)); echoServerAddr.sin_family = AF_INET; echoServerAddr.sin_addr.s_addr = htonl(INADDR_ANY); // any incoming interface echoServerAddr.sin_port = htons(echoServerPort); // local port // bind to the local address if(bind(serverSock, (struct sockaddr*)&echoServerAddr, sizeof(echoServerAddr) )<0) DieWithError("bind() failed"); // mark the socket so it will listen for incoming connections if(listen(serverSock, MAXPENDING)<0) DieWithError("listen() failed"); for (;;){ // run forever // set the size of the in-out parameter clientLen = sizeof(echoClientAddr); // wait for a client to connect if((clientSock = accept(serverSock, (struct sockaddr*)&echoClientAddr, &clientLen)) < 0) DieWithError("accept() failed"); // clientSock is connected to a client printf("Handling client %s\n", inet_ntoa(echoClientAddr.sin_addr)); HandleTCPClient(clientSock); } // NOT REACHED } void DieWithError(char *errorMessage) { fprintf(stderr, "%s: %d\n", errorMessage, WSAGetLastError()); exit(1); } void HandleTCPClient(int clientSocket) { char echoBuffer[RCVBUFSIZE]; // buffer for echostring int recvMsgSize; // size of received message // receive message from client if((recvMsgSize = recv(clientSocket, echoBuffer, RCVBUFSIZE, 0) <0)) DieWithError("recv() failed"); // send received string and receive again until end of transmission while(recvMsgSize > 0){ // echo message back to client if(send(clientSocket, echoBuffer, recvMsgSize, 0)!=recvMsgSize) DieWithError("send() failed"); // see if there's more data to receive if((recvMsgSize = recv(clientSocket, echoBuffer, RCVBUFSIZE, 0)) <0) DieWithError("recv() failed"); } closesocket(clientSocket); // close client socket } How can I fix this?

    Read the article

  • Creating a ListView using Category (Control Panel-Like) View

    - by Andrew Moore
    I currently have an application which uses a regular ListView with groups to show a bunch of modules. I would like to use a Category view. Category view is the new view introduced in Windows Vista for the Control Panel: Is there a third party control or a way (via API) to create a ListView which mimics the behavior of the Windows 7 Control Panel? Categories with icons and action links. Separate events for Category Click and Action Click. One or two column layout Separators between action links or lines

    Read the article

  • Why does Javascript's OR return a value other than true/false?

    - by Fletcher Moore
    I saw this construction in order to get the browser viewport width: function () { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; } I understand the browser quirks involved. What I don't understand is why || returns the value. So I tried this alert(undefined || 0 || 3); and sure enough, it alerts 3. I find this bizarre, because I expect true or false. Could anyone explain what's going on?

    Read the article

  • are fixtures loaded when using the sql dump to create a test database

    - by Josh Moore
    Because of some non standard table creation options I am forced to use the sql dump instead of the standard schema.rb (i.e. I have uncommented this line in the environment.rb config.active_record.schema_format = :sql). I have noticed that when I use the sql dump that my fixtures do not seem to be loaded into the database. Some data is loaded into it but, I am not sure where it is coming from. Is this normal? and if it is normal can anybody tell me where this other data is coming from?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >