Search Results

Search found 48 results on 2 pages for 'garry harthill'.

Page 2/2 | < Previous Page | 1 2 

  • Altering ManagedObjects In NSArray

    - by Garry
    I have an entity called 'Job' with two boolean attributes named 'completed' and 'logged'. I am trying to retrieve all completed jobs that have not been logged at app start-up and change them to logged. I'm able to get all the completed but unlogged jobs with this fetchRequest: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(completed == %@ && logged == %@)", [NSNumber numberWithBool:YES], [NSNumber numberWithBool:NO]]; I'm then assigning this predicate to a fetchRequest and calling the [managedObjectContext executeFetchRequest:fetchRequest] method to get an array of all Job entities that meet this criteria. This seems to work fine and is returning the correct number of jobs. What I've been trying to do is loop through the NSArray returned, set the logged attribute to YES and then save. This seems to complete and doesn't return any errors but the changes are not persisted when the application quits. Where am I going wrong? [fetchRequest setPredicate:predicate]; NSError error; NSArray jobsToLog = [managedObjectContext executeFetchRequest:fetchRequest error:&error]; if ([jobsToLog count] > 0) { for (int i = 0; i < [jobsToLog count] - 1; i++) { [[jobsToLog objectAtIndex:i] setLogged:[NSNumber numberWithBool:YES]]; // Commit the changes made to disk error = nil; if (![managedObjectContext save:&error]) { // An error occurred } } } Thanks in anticipation,

    Read the article

  • Manipulating a NSTextField via AppleScript

    - by Garry
    A little side project I'm working on is a digital life assistant, much like project JARVIS. What I'm trying to do is speak to my mac, have my words translated to text and then have the text interpreted by my program. Currently, my app is very simple, consisting of a single window containing a single wrapped NSTextView. Using MacSpeech Dictate, When I say the custom command "Jeeves", MacSpeech ensures that my app is frontmost, highlights any text in the TextField and clears it, then presses the Return key to trigger the textDidEndEditing method of NSTextField. This is done via Applescript. MacSpeech then switches to dictation mode and the next sentence I say will appear in the NSTextField. What I can't figure out is how to signify that I have finished saying a command to my program. I could simply say another keyword like "execute" or something similar that would send an AppleScript return keystroke to my app (thereby triggering the textDidEndEditing event) but this is cumbersome. Is there a notification that happens when text is pasted into a NSTextField? Would a timer work that would fire after maybe three seconds once my program becomes frontmost (three seconds should be sufficient for me to say a command)? Thanks,

    Read the article

  • Specific Strings And NSScanner

    - by Garry
    I need to determine whether a string (sourceString) contains another string (queryString) and if it does, at what offset. I'm guessing that NSScanner might do the trick but I don't fully understand the documentation. Let's say sourceString = @"What's the weather in London today?" If I set queryString to equal @"What's the weather", I'd like a method that would determine that, in this case, YES (sourceString does contain queryString) and the offset is 0 (i.e. at the start of sourceString). Any suggestions?

    Read the article

  • Receiving Text From Another Application

    - by Garry
    Hi, I'm building some home automation software with Cocoa/Objective-C. The main application will have a minimal GUI and will most likely be represented by a status bar icon only. I'm using proprietary speech-to-text software (MacSpeech Dictate) that takes my voice command and converts it to plain text. I then need to send this plain text to my app for parsing. Is there a way to send a string to a Cocoa application? Could AppleScript achieve this? How would I make the NSString string in my app "available" to receive the passed string? For reasons that are beyond the scope of this question - it is not possible to dictate the command directly into my app. Many thanks in advance,

    Read the article

  • Showing solution path in VS2008 window name

    - by Garry Shutler
    Is there a way to display the path of the solution in the Visual Studio window's name? By default it displays (SolutionName) - Microsoft Visual Studio, I would like it to instead show something like (SolutionName) - (PathToSolution) - Microsoft Visual Studio. The reason behind this is I can have multiple versions of a project checked out at a time (staging and trunk for example) and I'd like a quick way of checking without going through prompts etc.

    Read the article

  • Removing Objects From NSMutableArray

    - by Garry
    Hi, I have a NSMutableArray that contains all the calendars on my system (as CalCalendar objects): NSMutableArray *calendars = [[CalCalendarStore defaultCalendarStore] calendars]; I want to remove from calendars any CalCalendar objects whose title does not include the string @"work". I've tried this: for (CalCalendar *cal in calendars) { // Look to see if this calendar's title contains "work". If not - remove it if ([[cal title] rangeOfString:@"work"].location == NSNotFound) { [calendars removeObject:cal]; } } The console is complaining that: *** Collection <NSCFArray: 0x11660ccb0> was mutated while being enumerated. And things go bad. Obviously it would seem you can't do what I want to do this way so can anyone suggest the best way to go about it? Thanks,

    Read the article

  • memset on array of structures in C++

    - by garry
    I have another memset question. It appears as if the code I am editing may have some issues (or it's not done the same way in different files) A::LRM las[9]; //A and LRM are both structures with BOOLS and INTS memset(&las, 0, sizeof(las)); typedef Sec SecArray[16]; SecArray rad_array; memset(rad_array, 0, sizeof(SecArray)); The second example appears to be correct because rad_array is the same as the first position in the array. Then the sizeof(SecArray)) would make sense. The first one doesn't seem correct to me. All structs are just BOOLs and INTS nothing dynamic in them. My understanding from my other post about memset was that it followed this format. memset("pointer to object", "what to set it to", "size of object") Can anyone tell me what exactly is going on here if I am incorrect with my theory.

    Read the article

  • Getting a particular menu item from MainMenu

    - by Garry
    I have a nib (winA.xib) that contains a window. My app delegate contains an NSWindowController subclass called WinAController. WinAController has a property (NSMenu *mainMenu) that I want to point to the MainMenu. I have set it after I instantiate WinAController with this code: WinAController = [[WinAController alloc] initWithWindowNibName:@"WinA"]; WinAController.mainMenu = [NSApp mainMenu]; I have a menu item underneath the "Window" top-level menu item on MainMenu that invokes the [WinAController showWindow] method and displays WinA. I want to toggle the on/off state of this menu item depending on whether WinA is visible or not. WinAController also has another property (NSMenuItem *myMenuItem). How can I get a reference to a sub menu of the "Window" top-level menu item. The title of sub menu item I want to get is "Command". I have tried this: if (mainMenu != nil) { myMenuItem = [mainMenu itemAtIndex:[mainMenu indexOfItemWithTitle:@"Command"]]; } But it doesn't seem to work. Where am I going wrong? Thanks,

    Read the article

  • Using memset on structures in C++

    - by garry
    Hey guys. I am working on fixing older code for my job. It is currently written in C++. They converted static allocation to dynamic but didn't edit the memsets/memcmp/memcpy. This is my first programming internship so bare with my newbe-like question. The following code is in C, but I want to have it in C++ ( I read that malloc isn't good practice in C++). I have two scenarios: First, we have f created. Then you use &f in order to fill with zero. The second is a pointer *pf. I'm not sure how to set pf to all 0's like the previous example in C++. Could you just do pf = new foo instead of malloc and then call memset(pf, 0, sizeof(foo))? struct foo { ... } f; memset( &f, 0, sizeof(f) ); //or struct foo { ... } *pf; pf = (struct foo*) malloc( sizeof(*pf) ); memset( pf, 0, sizeof(*pf) );

    Read the article

  • Aligning textboxes via HTML

    - by Garry
    Here is my code: Classroom name: <input type="text" name="txtClassroomName" size="20"><br> School name: <input type="text" name="txtSchoolName" size="20"><br> School contact email address: <input type="text" name="txtSchoolEmail" size="20"><br> School address: <input type="text" name="txtSchoolAddress" size="20"><br> School telephone number: <input type="text" name="txtTelephoneNumber" size="20"><br> As you can probably guess, this code displays some text and then has some textboxes after this text. My question is this: I am wanting to align all the texboxes so that they are aligned. I have added spaces after the text, yet the textboxes just appear straight after the text, ignoring the spaces that I entered. What is the best, most effective way to do this? Maybe a table? thanks

    Read the article

  • Putting methods in separate files

    - by Garry
    I have a class (MyClass) with a lot of methods. Consequently, the .m file has become quite difficult to read. I'm relatively new to Objective-C (having come from REALbasic) and I was wondering if it's possible to put some of the methods in MyClass into different files and then include them in the class. How would I go about this in Xcode?

    Read the article

  • Capitalization of Person names in programming

    - by Albert
    Hey all, Is anyone aware of some code/rules on how to capitalize the names of people correctly? John Smith Johan van Rensburg Derrick von Gogh Ruby de La Fuente Peter Maclaurin Garry McDonald (these may not be correct, just some sample names and how the capitalization could be/work) This seems like a losing battle... If anyone has some code or rules on when and how to capitalize names, let me know :) Cheers, Albert

    Read the article

  • Which programming language should i choose? (much more info inside) [closed]

    - by Andreas
    I am not completely sure if this is the right place to put this question, but since it's the programming thread I guessed that there's many experienced programmers here. :) Ok, hello! My name is Andreas and I am a 16 years old guy from Norway. For some time now I've wanted to learn a programming language. Six months ago I started learning C++, but quit withing a week due to lack of motivation. The same thing happend only 2 months ago when I tried to learn Lua. I wanted to program mods to the game Garry's mod, and was really motivated. Then I stopped playing the game, and the programming stopped with it. Today though I am ready again. The only difference is that I am not completely sure what I want to do with the language. I only want to create something, and I miss the progress of failing and enduring hard work until I finally solve the problem I've worked on for hours. What I am trying to say is; Is there any program out there that allows me, a complete noob (I didn't learn that much in a week, so I like to call myself a beginner), to create apps, mods or something similar but at the same time being qualified as a first time language? I was thinking of Java, because Android, Minecraft and many other applications and games use it. But I've heard that it is going to be replaced by a program called HTML 5 (whatever that is), is this true? I certainly don't want to spend many hours of my life on something that is useless in a year or two. Hopefully I didn't make this too complicated. I know that it is hard to recommend something when I don't have a goal, but I really don't know what to say. Have a good day kind folks! - Andreas EDIT:* I did not know that this was an off topic question, really sorry!

    Read the article

  • Is it possible to generate Events and Hooks in Lua for any game without built-in support?

    - by pr0tocol
    Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls? The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game. Brief examples: Events: - An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something). Hooks: - An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer. I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts. Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

    Read the article

  • This Week in Geek History: Gmail Goes Public, Deep Blue Wins at Chess, and the Birth of Thomas Edison

    - by Jason Fitzpatrick
    Every week we bring you a snapshot of the week in Geek History. This week we’re taking a peek at the public release of Gmail, the first time a computer won against a chess champion, and the birth of prolific inventor Thomas Edison. Gmail Goes Public It’s hard to believe that Gmail has only been around for seven years and that for the first three years of its life it was invite only. In 2007 Gmail dropped the invite only requirement (although they would hold onto the “beta” tag for another two years) and opened its doors for anyone to grab a username @gmail. For what seemed like an entire epoch in internet history Gmail had the slickest web-based email around with constant innovations and features rolling out from Gmail Labs. Only in the last year or so have major overhauls at competitors like Hotmail and Yahoo! Mail brought other services up to speed. Can’t stand reading a Week in Geek History entry without a random fact? Here you go: gmail.com was originally owned by the Garfield franchise and ran a service that delivered Garfield comics to your email inbox. No, we’re not kidding. Deep Blue Proves Itself a Chess Master Deep Blue was a super computer constructed by IBM with the sole purpose of winning chess matches. In 2011 with the all seeing eye of Google and the amazing computational abilities of engines like Wolfram Alpha we simply take powerful computers immersed in our daily lives for granted. The 1996 match against reigning world chest champion Garry Kasparov where in Deep Blue held its own, but ultimately lost, in a  4-2 match shook a lot of people up. What did it mean if something that was considered such an elegant and quintessentially human endeavor such as chess was so easy for a machine? A series of upgrades helped Deep Blue outright win a match against Kasparov in 1997 (seen in the photo above). After the win Deep Blue was retired and disassembled. Parts of Deep Blue are housed in the National Museum of History and the Computer History Museum. Birth of Thomas Edison Thomas Alva Edison was one of the most prolific inventors in history and holds an astounding 1,093 US Patents. He is responsible for outright inventing or greatly refining major innovations in the history of world culture including the phonograph, the movie camera, the carbon microphone used in nearly every telephone well into the 1980s, batteries for electric cars (a notion we’d take over a century to take seriously), voting machines, and of course his enormous contribution to electric distribution systems. Despite the role of scientist and inventor being largely unglamorous, Thomas Edison and his tumultuous relationship with fellow inventor Nikola Tesla have been fodder for everything from books, to comics, to movies, and video games. Other Notable Moments from This Week in Geek History Although we only shine the spotlight on three interesting facts a week in our Geek History column, that doesn’t mean we don’t have space to highlight a few more in passing. This week in Geek History: 1971 – Apollo 14 returns to Earth after third Lunar mission. 1974 – Birth of Robot Chicken creator Seth Green. 1986 – Death of Dune creator Frank Herbert. Goodnight Dune. 1997 – Simpsons becomes longest running animated show on television. Have an interesting bit of geek trivia to share? Shoot us an email to [email protected] with “history” in the subject line and we’ll be sure to add it to our list of trivia. Latest Features How-To Geek ETC Here’s a Super Simple Trick to Defeating Fake Anti-Virus Malware How to Change the Default Application for Android Tasks Stop Believing TV’s Lies: The Real Truth About "Enhancing" Images The How-To Geek Valentine’s Day Gift Guide Inspire Geek Love with These Hilarious Geek Valentines RGB? CMYK? Alpha? What Are Image Channels and What Do They Mean? Clean Up Google Calendar’s Interface in Chrome and Iron The Rise and Fall of Kramerica? [Seinfeld Video] GNOME Shell 3 Live CDs for OpenSUSE and Fedora Available for Testing Picplz Offers Special FX, Sharing, and Backup of Your Smartphone Pics BUILD! An Epic LEGO Stop Motion Film [VIDEO] The Lingering Glow of Sunset over a Winter Landscape Wallpaper

    Read the article

  • Spatial Rotation in Gmod Expression2.

    - by Fascia
    I'm using expression2 to program behavior in Garry's mod (http://wiki.garrysmod.com/?title=Wire_Expression2) Okay so, to set the precedent. In Gmod I have a block and I am at a complete loss of how to get it to rotate around the 3 up, down and right vectors (Which are local. ie; if I pitch it 45 degrees the forward vector is 0.707, 0.707, 0). Essentially, From the 3 vectors I'd like to be able to get local Pitch/Roll/Yaw. By Local Pitch Roll Yaw I mean that they are completely independent of one another allowing true 3d rotation. So for example; if I place my craft so its nose is parallel to the floor the X,Y,Z would be 0,0,0. If I turn it parallel to the floor (World and Local Yaw) 90 degrees it's now 0, 0, 90. If I then pitch it (World Roll, Local Pitch) it 180 degrees it's now 180, 0, 90. I've already explored quaternions however I don't believe I should post my code here as I think I was re-inventing the wheel. I know I didn't explain that well but I believe the problem is pretty generic. Any help anyone could offer is greatly appreciated. Oh, I'd like to avoid gimblelock too. Essentially calculating the rotation around each of the crafts up/forward/right vectors using the up/forward/right vectors. To simply the question a generic implementation rather than one specific to Gmod is absolutely fine.

    Read the article

  • What Language Feature Can You Just Not Live Without?

    - by akdom
    I always miss python's built-in doc strings when working in other languages. I know this may seem odd, but it allows me to cut down significantly on excess comments while still providing a clean description of my code and any interfaces therein. What Language Feature Can You Just Not Live Without? If someone were building a new language and they asked you what one feature they absolutely must include, what would it be? This is getting kind of long, so I figured I'd do my best to summarize: Paraphrased to be language agnostic. If you know of a language which uses something mentioned, please at it in the parenthesis to the right of the feature. And if you have a better format for this list, by all means try it out (if it doesn't seem to work, I'll just roll back). Regular Expressions ~ torial (Perl) Garbage Collection ~ SaaS Developer (Python, Perl, Ruby, Java, .NET) Anonymous Functions ~ Vinko Vrsalovic (Lisp, Python) Arithmetic Operators ~ Jeremy Ross (Python, Perl, Ruby, Java, C#, Visual Basic, C, C++, Pascal, Smalltalk, etc.) Exception Handling ~ torial (Python, Java, .NET) Pass By Reference ~ Chris (Python) Unified String Format WalloWizard (C#) Generics ~ torial (Python, Java, C#) Integrated Query Equivalent to LINQ ~ Vyrotek (C#) Namespacing ~ Garry Shutler () Short Circuit Logic ~ Adam Bellaire ()

    Read the article

  • Checking if a console application is still running using the Process class

    - by Ced
    I'm making an application that will monitor the state of another process and restart it when it stops responding, exits, or throws an error. However, I'm having trouble to make it reliably check if the process (Being a C++ Console window) has stopped responding. My code looks like this: public void monitorserver() { while (true) { server.StartInfo = new ProcessStartInfo(textbox_srcdsexe.Text, startstring); server.Start(); log("server started"); log("Monitor started."); while (server.Responding) { if (server.HasExited) { log("server exitted, Restarting."); break; } log("server is running: " + server.Responding.ToString()); Thread.Sleep(1000); } log("Server stopped responding, terminating.."); try { server.Kill(); } catch (Exception) { } } } The application I'm monitoring is Valve's Source Dedicated Server, running Garry's Mod, and I'm over stressing the physics engine to simulate it stopping responding. However, this never triggers the process class recognizing it as 'stopped responding'. I know there are ways to directly query the source server using their own protocol, but i'd like to keep it simple and universal (So that i can maybe use it for different applications in the future). Any help appreciated

    Read the article

< Previous Page | 1 2