Tuesday, January 17, 2012
Git and Dropbox
I've been using git along with Dropbox for a little while and think it is a pretty awesome way to setup a code repository.
This is usually how I end up doing. Create a new project happily coding along and then it occurs to me I should probably start versioning this little gem. Which is very easy to do with git simply "git init" and you're done.
So that is all find and good but then I start to get nervous... what if my hard drive crashes... how can I keep this repository save and sound?
Again git has a very easy to use command that if you put it in your dropbox folder you have a code repository that easy to manage and access!
Here is the command for git:
git clone --bare /gitrepo/gitproject.git
I get tired of having to type git push /gitrepo/gitproject.git whenever I want to push code out into the safe region of Dropbox so I usually end up writing a simple little script that looks like this:
#!/bin/sh
git push /gitrepo/gitproject.git
obviously pull is just as easy....
Enjoy!
-A
Monday, January 09, 2012
Making Xcode less difficult
- In the bottom left corner of the view is a plus sign click on it to add a new breakpoint. You will be asked to add an "Exception Breakpoint" or a "Symbolic Breakpoint" choose symbolic.
- After selecting "Symbolic Breakpoint" a popover window will open fill it in as follows:
- Symbol: objc_exception_throw
- Module: libobjc.A.dylib
- Follow those same steps again to add a new symbolic breakpoint as follows:
- Symbol: -[NSException raise]
- Module: CoreFoundation
- To make the breakpoints global right click (command click - double finger tab - whatever) the break points to move them to the User context
Tuesday, February 15, 2011
Objective C can really stink
Let me preface this by saying I am not a very good Objective C programmer. I come from a strong background in Java and enjoy Objective C becuase it's a new technology (for me) and it solves problems different from Java... well at least the API backed by Cocoa Touch solves them in a different way.
Coming from Java I will tell you this - Exception handling in Objective C is horrible! I've spent all morning dinking around trying to get a table view to display. I've been doing Objective C for 2 years now (not exclusively - but I'm not a complete newbie) so to be having problems with something this basic is pretty frustrating.
The problem really starts with me becoming more familiar with the language. As comfort levels increase I begin exploring how to solve things in slightly different ways... This is what happened today. I'm using a NavigationController to pop on a series of views (successfully until this morning).
I have this little block of boiler plate I toss around to pop a view on the NavController that looks like this:
NewViewController *vc = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
NSArray *items = [NSArray arrayWithObjects:@"Item 1", @"Item 2", @"Item 3", nil];
[vc setItems:items];
[vc setTitle:@"Items"];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
[items release];
Here is the logic behind the code -
- Create a new view controller
- Create a new list to slam into the table view for the view controller and pop it in
- Set the items array into the view controller
- push the view controller into the navigation controller
- releace the memory for the view controller as it is now owned by the navigation controller
- and release the array since it is now owned by the view controller
Even now just looking at the code I just figured out what the problem is - I'm not actually creating a new instance of the items array. So by releasing it - my new view controller crashes because it's retain call got mistakenly released by someone else.
Simple problem - no big deal at all. My frustration really is that the app just crashes without any type of error at all... just a *blip* application died... Occasionally it would spit out this error:
Program received signal: “EXC_BAD_ACCESS”.
Which is not helpful at all - basically that means we accessed memory that we shouldn't have.
I agree whole heartedly that this is not a problem with Objective C - it all comes from my ignorance and lack of experience - however, it is still very frustrating.
-A




