Search Results

Search found 311 results on 13 pages for 'shawn mclean'.

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

  • Inherited varibles are not reading correctly when using bitwise comparisons

    - by Shawn B
    Hey, I have a few classes set up for a game, with XMapObject as the base, and XEntity, XEnviron, and XItem inheriting it. MapObjects have a number of flags, one of them being MAPOBJECT_SOLID. My problem is, that XEntity is the only class that correctly detects MAPOBJECT_SOLID. Both Items are Environs are always considered solid by the game, regardless of the flag's state. What is important, is that Environs and Item should almost never be solid. Here are the relevent code samples: XMapObject: class XMapObject : public XObject { public: Uint8 MapObjectType,Location[2],MapObjectFlags; XMapObject *NextMapObject,*PrevMapObject; XMapObject(); void CreateMapObject(Uint8 MapObjectType); void SpawnMapObject(Uint8 MapObjectLocation[2]); void RemoveMapObject(); void DeleteMapObject(); void MapObjectSetLocation(Uint8 Y,Uint8 X); void MapObjectMapLink(); void MapObjectMapUnlink(); }; XEntity: class XEntity : public XMapObject { public: Uint8 Health,EntityFlags; float Speed,Time; XEntity *NextEntity,*PrevEntity; XItem *IventoryList; XEntity(); void CreateEntity(Uint8 EntityType,Uint8 EntityLocation[2]); void DeleteEntity(); void EntityLink(); void EntityUnlink(); Uint8 MoveEntity(Uint8 YOffset,Uint8 XOffset); }; XEnviron: class XEnviron : public XMapObject { public: Uint8 Effect,TimeOut; void CreateEnviron(Uint8 Type,Uint8 Y,Uint8 X,Uint8 TimeOut); }; XItem: class XItem : public XMapObject { public: void CreateItem(Uint8 Type,Uint8 Y,Uint8 X); }; And lastly, the entity move code. Only entities are capable of moving themselves. Uint8 XEntity::MoveEntity(Uint8 YOffset,Uint8 XOffset) { Uint8 NewY = Location[0] + YOffset, NewX = Location[1] + XOffset; if((NewY >= 0 && NewY < MAPY) && (NewX >= 0 && NewX < MAPX)) { XTile *Tile = GetTile(NewY,NewX); if(Tile->MapList != NULL) { XMapObject *MapObject = Tile->MapList; while(MapObject != NULL) { if(MapObject->MapObjectFlags & MAPOBJECT_SOLID) { printf("solid\n"); return 0; } MapObject = MapObject->NextMapObject; } } if(Tile->Flags & TILE_SOLID && EntityFlags & ENTITY_CLIPPING) { return 0; } this->MapObjectSetLocation(NewY,NewX); return 1; } return 0; } What is wierd, is that the bitwise operator always returns true when the MapObject is an Environ or an Item, but it works correctly for Entities. For debug I am using the printf "Solid", and also a printf containing the value of the flag for both Environs and Items. Any help is greatly appreciated, as this is a major bug for the small game I am working on.

    Read the article

  • Extending Jquery validate to show/hide div or clear div after validate is ran

    - by Shawn
    Right now i have all of my errors outputting to a div. Id like to catch the validate event and clear the div right before its ran of my old errors. Then id like to show/hide that div based on if it has any labels in it that were auto generated by the jquery validation plugin. I can do everything but figure out how to extend the event, run the stuff i need to, then call the validate function. Thanks!

    Read the article

  • Which offer to pick?

    - by Shawn
    OK. This is kinda silly, but I'd really like to hear what you guys say. Here is the thing: I used to be an php developer and started looking for jobs 3 weeks ago and now I got 2 offers at hand. If I took the first one what I do would be 100% in PHP - simply dev works on a ecommerce project. If I go with the second one, the projects would be in python which I didn't have too much experiences on and is kinda exited about the new stuff I'm going to learn. But wait, the first offer gives more money(1k plus) and that's why I'm still hesitating and troubling you guys.) If you were me, which one would you pick? I know there could be other factors to be considered like 'which position is closer to your home so you could take good care of your dog', well let's forget about those things for now.

    Read the article

  • How can I reprogram a USB "easy button"?

    - by Shawn Simon
    I have a USB "easy button"- is a USB cable attached to a large button. It appears as a keyboard to the computer. When I push the button, it sends the keys Start+R and then quickly types in a pre-configured URL. I am fairly certain that the company that produces these buttons sets the URL via some sort of software over USB. How could I reprogram the button myself? What sort of software would I need? Here is a link to the website: http://www.usbsmartbuttons.com/

    Read the article

  • Free POP3 .NET library?

    - by Shawn Simon
    Looking for a POP3 Client for .NET that basically just lets me log into a server and grab all the emails out, and maybe send some. I grabbed Indy.Sockets off of CodePlex and got it running but its throwing errors trying to decode the mail headers. Really anything is fine if it works.

    Read the article

  • Show NotifyIcon Context Menu and Control Its Position?

    - by Shawn O'Hern
    I'm trying to show a context menu when I left-click a NotifyIcon. Just calling NotifyIcon.ContextMenuStrip.Show() doesn't work very well. A solution has been posted here before that calls a secret method using Reflection: Dim mi As System.Reflection.MethodInfo = GetType(NotifyIcon).GetMethod("ShowContextMenu", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic) mi.Invoke(Icon, Nothing) This works great, except that I also need to control where the menu is shown. I want to wait for the SystemInformation.DoubleClickTime to elapse between receiving the NotifyIcon.MouseUp event and displaying the menu, so that I can handle single-clicks and double-clicks separately. But invoking the ShowContextMenu method displays the menu at the current mouse position when ShowContextMenu is called, not when the icon was actually clicked. Which means that if the mouse moved during the DoubleClickTime, the menu will be displayed in a different part of the screen. So if I can control where the menu is shown, I can just save the mouse coordinates when I receive the MouseUp event, and then I can ensure that the menu is displayed near the icon. Is there a way to do this? Thanks in advance.

    Read the article

  • Inherited variables are not reading correctly when using bitwise comparisons

    - by Shawn B
    Hey, I have a few classes set up for a game, with XMapObject as the base, and XEntity, XEnviron, and XItem inheriting it. MapObjects have a number of flags, one of them being MAPOBJECT_SOLID. My problem is that XEntity is the only class that correctly detects MAPOBJECT_SOLID. Both Items are Environs are always considered solid by the game, regardless of the flag's state. What is important is that Environs and Item should almost never be solid. Here are the relevent code samples: XMapObject: class XMapObject : public XObject { public: Uint8 MapObjectType,Location[2],MapObjectFlags; XMapObject *NextMapObject,*PrevMapObject; XMapObject(); void CreateMapObject(Uint8 MapObjectType); void SpawnMapObject(Uint8 MapObjectLocation[2]); void RemoveMapObject(); void DeleteMapObject(); void MapObjectSetLocation(Uint8 Y,Uint8 X); void MapObjectMapLink(); void MapObjectMapUnlink(); }; XEntity: class XEntity : public XMapObject { public: Uint8 Health,EntityFlags; float Speed,Time; XEntity *NextEntity,*PrevEntity; XItem *IventoryList; XEntity(); void CreateEntity(Uint8 EntityType,Uint8 EntityLocation[2]); void DeleteEntity(); void EntityLink(); void EntityUnlink(); Uint8 MoveEntity(Uint8 YOffset,Uint8 XOffset); }; XEnviron: class XEnviron : public XMapObject { public: Uint8 Effect,TimeOut; void CreateEnviron(Uint8 Type,Uint8 Y,Uint8 X,Uint8 TimeOut); }; XItem: class XItem : public XMapObject { public: void CreateItem(Uint8 Type,Uint8 Y,Uint8 X); }; And lastly, the entity move code. Only entities are capable of moving themselves. Uint8 XEntity::MoveEntity(Uint8 YOffset,Uint8 XOffset) { Uint8 NewY = Location[0] + YOffset, NewX = Location[1] + XOffset; if((NewY >= 0 && NewY < MAPY) && (NewX >= 0 && NewX < MAPX)) { XTile *Tile = GetTile(NewY,NewX); if(Tile->MapList != NULL) { XMapObject *MapObject = Tile->MapList; while(MapObject != NULL) { if(MapObject->MapObjectFlags & MAPOBJECT_SOLID) { printf("solid\n"); return 0; } MapObject = MapObject->NextMapObject; } } if(Tile->Flags & TILE_SOLID && EntityFlags & ENTITY_CLIPPING) { return 0; } this->MapObjectSetLocation(NewY,NewX); return 1; } return 0; } What is wierd, is that the bitwise operator always returns true when the MapObject is an Environ or an Item, but it works correctly for Entities. For debug I am using the printf "Solid", and also a printf containing the value of the flag for both Environs and Items. Any help is greatly appreciated, as this is a major bug for the small game I am working on.

    Read the article

  • C program runs in Cygwin but not Linux (Malloc)

    - by Shawn
    I have a heap allocation error that I cant spot in my code that is picked up on vanguard/gdb on Linux but runs perfectly on a Windows cygwin environment. I understand that Linux could be tighter with its heap allocation than Windows but I would really like to have a response that discovers the issue/possible fix. I'm also aware that I shouldn't typecast malloc in C but it's a force of habit and doesn't change my problem from happening. My program actually compiles without error on both Linux & Windows but when I run it in Linux I get a scary looking result: malloc.c:3074: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)-bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) = (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)-size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed. Aborted Attached snippet from my code that is being pointed to as the error for review: /* Main */ int main(int argc, char * argv[]) { FILE *pFile; unsigned char *buffer; long int lSize; pFile = fopen ( argv[1] , "r" ); if (pFile==NULL) {fputs ("File error on arg[1]",stderr); return 1;} fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); buffer = (char*) malloc(sizeof(char) * lSize+1); if (buffer == NULL) {fputs ("Memory error",stderr); return 2;} bitpair * ppairs = (bitpair *) malloc(sizeof(bitpair) * (lSize+1)); //line 51 below calcpair(ppairs, (lSize+1)); /* irrelevant stuff */ fclose(pFile); free(buffer); free(ppairs); } typedef struct { long unsigned int a; //not actual variable names... Yes I need them to be long unsigned long unsigned int b; long unsigned int c; long unsigned int d; long unsigned int e; } bitpair; void calcpair(bitpair * ppairs, long int bits); void calcPairs(bitpair * ppairs, long int bits) { long int i, top, bot, var_1, var_2; int count = 0; for(i = 0; i < cs; i++) { top = 0; ppairs[top].e = 1; do { bot = count; count++; } while(ppairs[bot].e != 0); ppairs[bot].e = 1; var_1 = bot; var_2 = top; calcpair * bp = &ppairs[var_2]; bp->a = var_2; bp->b = var_1; bp->c = i; bp = &ppairs[var_1]; bp->a = var_2; bp->b = var_1; bp->c = i; } return; } gdb reports: free(): invalid pointer: 0x0000000000603290 * valgrind reports the following message 5 times before exiting due to "VALGRIND INTERNAL ERROR" signal 11 (SIGSEGV): Invalid read of size 8 ==2727== at 0x401043: calcPairs (in /home/user/Documents/5-3/ubuntu test/main) ==2727== by 0x400C9A: main (main.c:51) ==2727== Address 0x5a607a0 is not stack'd, malloc'd or (recently) free'd

    Read the article

  • Cloud computing?

    - by Shawn H
    I'm an analyst and intermediate programmer working for a consulting company. Sometimes we are doing some intensive computing in Excel which can be frustrating because we have slow computers. My company does not have enough money to buy everyone new computers right now. Is there a cloud computing service that allows me to login to a high performance virtual computer from remote desktop? We are not that technical so preferrably the computer is running Windows and I can run Excel and other applications from this computer. Thanks

    Read the article

  • How does one convert from a Java resultset to ColdFusion query in Railo?

    - by Shawn Grigson
    The following works fine in CFMX 7 and CF8, and I'd assume CF9 as well: <!--- 'conn' is a JDBC connection ---> <cfset stat = conn.createStatement() /> <cfset rs = stat.executeQuery(trim(arguments.sql)) /> <!--- convert this Java resultset to a CF query recordset ---> <cfset queryTable = CreateObject("java", "coldfusion.sql.QueryTable")> <cfset queryTable.init(rs) > <cfset query = queryTable.FirstTable() /> This creates a statement using a JDBC driver, executes a query against it, putting it into a java resultset, and then coldfusion.sql.QueryTable is instantiated, passed the Java resulset object, and then queryTable.FirstTable() is called, which returns an actual coldfusion resultset (for cfloop and the like). The problem comes with a difference in Railo's implementation. Running this code in Railo returns the following error: No matching Constructor for coldfusion.sql.QueryTable(org.sqlite.RS) found. I've dumped the Railo java object, and don't see init() among the methods. Am I missing something simple? I'd love to get this working in Railo as well. Please note: I am doing a DSN-less connection to a SQLite db. I understand how to set up a CF datasource. My only hiccup at this point is doing the translation from a Java result set to a Railo query.

    Read the article

  • Is this code thread safe?

    - by Shawn Simon
    ''' <summary> ''' Returns true if a submission by the same IP address has not been submitted in the past n minutes. ''' </summary> Protected Function EnforceMinTimeBetweenSubmissions() As Boolean Dim minTimeBetweenRequestsMinutes As Integer = 0 Dim configuredTime = ConfigurationManager.AppSettings("MinTimeBetweenSchedulingRequestsMinutes") If String.IsNullOrEmpty(configuredTime) Then Return True If (Not Integer.TryParse(configuredTime, minTimeBetweenRequestsMinutes)) _ OrElse minTimeBetweenRequestsMinutes > 1440 _ OrElse minTimeBetweenRequestsMinutes < 0 Then Throw New ApplicationException("Invalid configuration setting for AppSetting 'MinTimeBetweenSchedulingRequestsMinutes'") End If If minTimeBetweenRequestsMinutes = 0 Then Return True End If If Cache("submitted-requests") Is Nothing Then Cache("submitted-requests") = New Dictionary(Of String, Date) End If ' Remove old requests. Dim submittedRequests As Dictionary(Of String, Date) = CType(Cache("submitted-requests"), Dictionary(Of String, Date)) Dim itemsToRemove = submittedRequests.Where(Function(s) s.Value < Now).Select(Function(s) s.Key).ToList For Each key As String In itemsToRemove submittedRequests.Remove(key) Next If submittedRequests.ContainsKey(Request.UserHostAddress) Then ' User has submitted a request in the past n minutes. Return False Else submittedRequests.Add(Request.UserHostAddress, Now.AddMinutes(minTimeBetweenRequestsMinutes)) End If Return True End Function

    Read the article

  • url rewrite & redirect question

    - by Shawn
    Say currently I have url like : http://mydomain.com/showpost.php?p=123 Now I want to make it prettier : http://mydomain.com/123/post-title I'm using apache rewrite which grabs segment '123' and put the url back to http://mydomain.com/showpost.php?p=123 OK. Here is the problem. I want to redirect the original non-pretty urls which were indexed by Google to the pretty versions, I want this because I heard that Google may punish me if he sees multiple urls pointing to identical content. So I need to redirect /showpost.php?p=123 to /123/post-title This I have to do in my php code coz there's no way Apache to be able to figure out the 'post-title', but if I put the redirect code in php code, then it will be a infinite loop, such as : Request : /showpost.php?p=123 redirected to : /123/post-title rewritten to: /showpost.php?p=123 redirected again to : /123/post-title ... So on and so forth. Sorry I should Google the solution first but I really don't know how to describe my situation in English to make Google return reasonable results. Please help me. Thanks.

    Read the article

  • Flex DownloadProgressBar preloader override

    - by Shawn Simon
    I'm watching this video, which is pretty good http://www.gotoandlearn.com/play?id=108 It shows how to inherit from DownloadProgressBar to create a customer preloader for your flex app. The DownloadProgressBar class has an overridable getter for the property 'preloader.' Isn't this poor design? What does a property called preloader have anything to do with a class for a DownloadProgressBar?

    Read the article

  • AS3 httpservice - pass arguments to event handlers by reference

    - by Shawn Simon
    I have this code: var service:HTTPService = new HTTPService(); if (search.Location && search.Location.length > 0 && chkLocalSearch.selected) { service.url = 'http://ajax.googleapis.com/ajax/services/search/local'; service.request.q = search.Keyword; service.request.near = search.Location; } else { service.url = 'http://ajax.googleapis.com/ajax/services/search/web'; service.request.q = search.Keyword + " " + search.Location; } service.request.v = '1.0'; service.resultFormat = 'text'; service.addEventListener(ResultEvent.RESULT, onServerResponse); service.send(); I want to pass the search object to the result method (onServerResponse) but if I do it in a closure it gets passed by value. Is there anyway to do it by reference without searching through my array of search objects for the value returned in the result? Sorry, this is simple but it's been a long day...

    Read the article

  • Converting a pointer for a base class into an inherited class

    - by Shawn B
    Hey, I'm working on a small roguelike game, and for any object/"thing" that is not a part of the map is based off an XEntity class. There are several classes that depend on it, such as XPlayer, XItem, and XMonster. My problem is, that I want to convert a pointer from XEntity to XItem when I know that an object is in item. The sample code I am using to pick up an item is this, it is when a different entity picks up an item it is standing over. void XEntity::PickupItem() { XEntity *Ent = MapList; // Start of a linked list while(true) { if(Ent == NULL) { break; } if(Ent->Flags & ENT_ITEM) { Ent->RemoveEntity(); // Unlink from the map's linked list XItem *Item = Ent // Problem is here, type-safety // Code to link into inventory is here break; } Ent = Ent->MapList; } } My first thought was to create a method in XEntity that returns itself as an XItem pointer, but it creates circular dependencies that are unresolvable. I'm pretty stumped about this one. Any help is greatly appreciated.

    Read the article

  • Encrypting Files with AES, Encrypting Key with RSA - Am I on the right track?

    - by Shawn Steward
    Overview: I'm trying to design an application that will encrypt files to safely send through the mail. I'm planning on using AES/RijndaelManaged encryption from .Net to encrypt the files initially, using a randomly generated key using RNGCryptoServiceProvider. I'm then encrypting this random AES key with a RSA Public key. The receiver of the data is the only one with the RSA Private key to decrypt it. My question: Is this the proper way to do something like this? If so, is it safe to send this RSA-Encrypted key with the data since it requires the private key to decrypt? Also - when having the end user generate their Public/Private key pair, what is the best way to save the Private key? I do not want it to be only accessible from one machine, so I am trying to avoid using the user's key store. But MSDN says it is not safe to save the key to a file, so how else can you accomplish this?

    Read the article

  • GD! Converting a png image to jpeg and making the alpha by default white and not black.

    - by Shawn
    I tried something like this but it just makes the background of the image white, not necessarily the alpha of the image. I wanted to just upload everything as jpg's so if i could somehow "flatten" a png image with some transparently to default it to just be white so i can use it as a jpg instead. Appreciate any help. Thanks. $old = imagecreatefrompng($upload); $background = imagecolorallocate($old,255,255,255); imagefill($old, 0, 0, $background); imagealphablending($old, false); imagesavealpha($old, true);

    Read the article

  • IntelliJ bad plugin how to start

    - by Shawn
    Hi I have just started using IntelliJ again and have version 9. I just installed the Mecurial plugin and now the ide won't start anymore. Has an error of Fatal error initializing class com.intellij.openapi.actionSystem.ActionManager: java.lang.VerifyError: class com.dcx.hg.MercurialVcs overrides final method getName.()Ljava/lang/String; I now know that I should be using the plugin hg4idea Is there a way I can remove this plugin so I can start the ide, I am sure there must be.. Thanks in advance.

    Read the article

  • Creating a framework for ASP.NET web forms similar to Flex states.

    - by Shawn Simon
    I really enjoy the flex states framework. You define a few states for your control, and then can set child controls to only appear in certain states. Check out this code: <s:states> <s:State name="signin"/> <s:State name="register"/> </s:states> <mx:FormItem label="Last name:" includeIn="register" id="lastNameItem" alpha="0.0"> <s:TextInput id="lastName" width="220"/> </mx:FormItem> Now the last name form will only appear in the register screen. This would be really useful I think in .NET where you use the page for views like update / insert. I was considering extending the Page element to have a states property using extension methods, and adding the include in to controls. This way I could auto-hide controls based on the current view at render time. What is even cooler in Flex, is that you can use different handlers / properties based on the current state. <s:Button label="Sign in" label.register="Register" id="loginButton" enabled="true" click.signin="signin()" click.register="register()"/> I'm sure there's a way I could implement something similar to this as well. Do you think this is a good idea? Or does it just add a level of abstraction to framework that already has a poor separation of concerns?

    Read the article

  • How can I exclude pages created from a specific template from the CQ5 dispatcher cache?

    - by Shawn
    I have a specific Adobe CQ5 (5.5) content template that authors will use to create pages. I want to exclude any page that is created from this template from the dispatcher cache. As I understand it currently, the only way I know to prevent caching is to configure dispatcher.any to not cache a particular URL. But in this case, the URL isn't known until a web author uses the template to create a page. I don't want to have to go back and modify dispatcher.any every time a page is created--or at least I want to automate this if there is no other way. I am using IIS for the dispatcher. The reason I don't want to cache the pages is because the underlying JSPs that render the content for these pages produce dynamic content, and the pages don't use querystrings and won't carry authentication headers. The pages will be created in unpredictable directories, so I don't know the URL pattern ahead of time. How can I configure things so that any page that is created from a certain template will be automatically excluded from the dispatcher cache? It seems like CQ ought to have some mechanism to respect HTTP response/caching headers. If the HTTP response headers specify that the response shouldn't be cached, it seems like the dispatcher shouldn't cache it--regardless of what dispatcher.any says. This is the CQ5 documentation I have been referencing.

    Read the article

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