Saturday, December 23, 2006

What will be coming up next year in Cocoa Samurai

Well everybody it’s the holidays and I hope your all doing OK. I just wanted to wish you all well and let you all know what’s coming up. It seems this blog as been doing extraordinarily well from the statistics I’ve seen on Google Analytics. But I hope starting in January I can make it do even better. When I first started this blog it was really just something for me and a few of my friends around here mainly in AmesMUG (Ames Mac Users Group) but then It started getting picked up by a few other people... then came Scott Stevenson and CocoaDevCentral. That completely changed my audience overnight. Certainly the new Cocoa Blogs page lists this as a Cocoa Blog focused on beginners and certainly from the articles i’ve done I don’t fault Scott for coming to that conclusion. When I started writing this blog I had the intention of writing a few things at first that simply spelled out how to do some things I had wanted to know when learning Cocoa. Things like the pragma mark I actually learned by digging through Adium source code, other things I had to dig through pages and pages of material to find it. This blog was to end that. You wanna know how to do gradient backgrounds? Here's how you do it simple and easy, save you the time and effort of digging up pages and pages of stuff to maybe find nothing or find it after a much longer time. I wanted to save developers the time and trouble and spill it out in an easy to follow format. However that will begin to change in January. I will begin to do some intermediate to advanced articles as I can and instead focus on general Cocoa Development and likely Core Data. The reason I haven’t done any as of yet is (1) I’ve been focusing a lot of time on learning new things by reading the Documentation and by experimenting like crazy more than any other time as a developer (2) Im a Student still and I have an Open Source project AssignmentTracker X that I take seriously and another one I plan on starting soon. This project demands that I sacrifice a lot of my free time outside school and work to maintain it decently because I genuinely care about it (I use it myself) and I view it as a big part of my resume when I begin to apply anywhere for a job and as of yet I haven’t gotten that much done on the latest incarnation of it right now (3) My tech support job working with Windows 98 POS (Point of Sale) Registers and Linux this fall has been more demanding than previously before (hey some things got easier, but still theres no patch for human stupidity) seriously though it's not that bad a gig... better than my job before that... Wendys...mmm guess what I did there (4) As of late i’ve been doing a ton of time preparing to go to school full time, where before I was going part time and working a ton. (5) In depth articles take time to write and i’ve been interrupted by all the above items I hope that in January i’ll be able to arrange my schedule as such that I can have some dedicated blocks of time to work on my Open Source project and writing articles for Cocoa Samurai. For now my tech support will be a BIG drain on me which is why I haven’t done much for December and why Im not planning on doing any more articles for December. I simply need dedicated blocks of time to really get stuff done and having the phone interrupt every 5-10-15 minutes at work or when im at my apartment on pager is just annoying. Plus Im sure all you are either busy with finals or traveling around or preparing to travel regardless of where you are in life. Now don’t think that the nice simple articles will vanish overnight because they won’t, but I hope to make this blog more appealing to all ranges of Cocoa Developers which is what I’ve intended from the beginning. Lastly Happy Holidays everybody!!! I hope you all get what you want for Christmas or whatever you celebrate. Im just hoping to get that DS Lite and Brain Age :) And maybe the next article you read will have been written on a Core 2 Duo MacBook Pro (finally making the intel switch) instead of my current 1.25Ghz Powerbook G4 with 512MB ram :) Yes that’s how bad im off right now, on the other hand i’ve gotten good at optimizing my apps and finding what speeds up all the apps im using ( I just wish NeoOffice wasn’t so RAM hungry.) We’ll see what happens... have a great time everybody and a happy new year!

Thursday, December 14, 2006

[Alert] MacHeist Bundle!!! (Updated)

If you'll forgive me for not posting something totally mac development related... I just thought since there was a Digg article earlier trying to rally people to this that I should do something and try and get the word out even further if I can Were just past the halfway point in the MacHeist Bundle sale if I heard correctly and NewsFire has been unlocked as we reached $50,000 donated to charity. Still many people are evidently holding out on waiting till TextMate is unlocked. Well people if you hold out it won't be unlocked! At the rate things are going I fear we'll be just under the $100,000 needed to unlock TextMate. It's not everyday you get insanely great Mac software for next to nothing and can donate money to charity all at the same time. Even if you don't want some of the software you can still give it to someone if you want. Personally myself I don't plan on giving up Vienna as I like having an Open Source RSS reader so at some point I will probably give NewsFire to someone. If you don't know what TextMate is you can go here or here and find out or download a demo. I've been testing it and I love it, even if it probably won't replace Xcode for most of my serious coding work, but I've been finding for XHTML, PHP, and the small C examples I do in my books it's a sweet tool to have. A bit of a misconception is that if you buy now you won't get TextMate, Im telling you if you buy now and MacHeist gets to $100,000 then you will be given it afterwards. Yes sometime soon i'll get my newsfire license even though I bought the bundle on the first day before NewsFire was unlocked (hey for Delicious Library, Disco and Rapidweaver alone it was more than worth the $49.) Spread the word or if you were thinking of getting it just get it now I promise you won't be disappointed. You'll even discover some great new stuff and feel good donating some money to worthy causes. I had never tried Pangea Arcade before I got this and normally I probably wouldn't have bought it, and yet it's sucked up a big chunk of my time for the last few nights playing a couple of the games. Chances are you'll probably find a app you didn't think would be worth it but now like. Much respect to all those involved in MacHeist! It seems like the rate of sales today is increasing slightly, but I know we can keep it up people! [Update] As I discuss in the comments I didn't mean to seem like im putting TextMate down which im certainly not, I really like the app and Im using it more and more lately as I get the time to use it. However for my inital tests with Xcode projects im finding it hard to use TextMate interchangeably with Xcode and Objective-C. I'd be happy to discuss the specifics later, however my job has me swamped right now so this will have to wait until next week.

Friday, December 08, 2006

[Tip] When you must be precise be mach precise

Just thought i'd post a playful little tidbit. One of the things you should be as a programmer is playful and experimental. And todays tip I originally learned from Aaron Hillegass (yes the guy who write Cocoa Programming for Mac OS X) at the Student WWDC 06 Session, though you can find it documented on Apples site easily. One of the things I do is play around with parts of a language i don't normally use to see what it's usefull for and sometimes test what benifets (if any) there are to it. One of the things I try to do from time to time is evaluate the speed of particular language features or methods in my apps. Probably the most accurate way to do this is to dig into the kernel and take time measurements in nanoseconds and that's what this simple little app does

#include < stdio.h> #include < stdarg.h> #include < mach/mach.h> #include < mach/mach_time.h> #include < unistd.h> int main() { uint64_t start = mach_absolute_time(); //you can do whatever you want between this... int i; for(i = 0; i < 2000; i++) { int l = 233 << 1; printf("\n\n%i\n\n",l); } //and here where we take the 2nd time measurement... uint64_t end = mach_absolute_time(); uint64_t elapsed = end - start; mach_timebase_info_data_t info; mach_timebase_info(&info); uint64_t nanoSeconds = elapsed * info.numer / info.denom; printf ("elapsed time was %lld nanoseconds\n", nanoSeconds); return 0; }
in this case there isn't anything really important going in in this little test example, but you get the point of what benifets this can hold for you if you use it right.

Wednesday, December 06, 2006

Does Apple have a Grand Cocoa Strategy?

Well this week I’m a bit under the weather, but definitely getting better and still managing to get some coding done so I thought I’d indulge you with this bit of commentary that's been on my mind for a while. Before I do so I want you to know that Im working on a small something that mostly beginner Cocoa programmers may find very useful, though veterans may find it useful as well. I was amazed as I searched in Google to see if someone had already done this project and I couldn’t find one result that matched this. Then I searched Yahoo! just to make sure... nothing. Anyway I’ll reveal this once it’s done so keep tuned. The Cocoa Strategy One thing Im surprised i’ve never heard anybody discuss, or at least never seen it discussed anywhere (feel free to correct me if I’m wrong) is the strategy Apple has for the Cocoa (and related) Frameworks. For me learning Cocoa on Mac OS X 10.0.4 (on my first Mac a 733Mhz Quicksilver PowerMac G4) through 10.2 you got mostly a sense of... well this could be a great kit, it definitely has potential, but mostly you got the feeling that things were being fixed and brought up to standards. It wasn’t till Panther ( Mac OS X 10.3) that I saw something in the SDK that made me really say wow (after everything you already saw wow at when being introduced to Cocoa.) That was Cocoa Bindings, it was like Apple saying “hey you remember writting all that code just to display data in a NSTableView? Forget it! Just bind it!” At the time I was hugely impressed by this because this was a totally different style of programming. I had never conceived of not programmatically setting the data in a table. At first it feels like setting up some sort of intricate laser setup using precision angles with mirrors and saying “just trust me if you set this up like so it’ll connect.” So now we have Cocoa Bindings. “Great!” you say. Then 10.4 Tiger came out and so did Core Data. More than this Core Data felt like a perfect extension of Cocoa Bindings. In bindings you got a huge reduction in code by letting Apple manage all this for you on the back end and all you had to do was make your Instance Classes Key-Value Coding/Observing ( KVC/KVO ) Compliant which was (and still really is unless you’ve become really lazy after Core Data) nothing hard to do at all. In Core Data you got data persistence, database-like querying and the ability to save data in 3 different formats with barely any effort. When Tiger came out I thought to myself “Wow is this a grand strategy Apple has? Or are they just following up on the next logical step to make Cocoa better?” Looking at this you could easily make arguments one way or another. Wikipedia makes a comparsion of Core Data against an earlier NeXT Product called Enterprise Objects Framework. Now I’ve never used EOF, nor have I used WebObjects (which you use with EOF), but it does seem from the description that EOF and Core Data are definitely different in design, though somewhat similar in some of their functionality. Could you say that Apple had a goal of one day of brining the functionality that now is Core Data to the Cocoa Framework? Maybe. This technology has obviously stuck around for years and years so Apple, or at least some part of Apple, has believed in it. However even if you think they really wanted this, surely there must be a grand strategy for Cocoa? If you think this, then Leopard surely must put it to the test. We’ve put in a system (Bindings) to make some tasks which required a decent amount of code easy, then we put in a system to add data persistence and some SQL-like queries amongst other things. So what could be the next logical step? Now because I went to WWDC 06 this gets slightly fuzzy in what I can and can’t tell you so I shall err on the side of caution when speaking of Leopard improvements. However I can say in this context that I didn’t see anything that spoke to me (strongly at least) that this is the next logical addtion to Core Data. There were some brand spanking new classes that were very impressive and used Cocoa Bindings (obviously.) The thing that spoke to me the most was the vastly improved Developer tools like Interface Builder (especially), Xcode and Xray. These new tools are practically like having a new framework which makes you vastly more productive. So im curious what everybody thinks. Do you think Apple has somewhat of a grand strategy in mind for Cocoa? Or do you think Apple is more short sighted in this respect of just performing a great analysis of the framework after each Mac OS X release and giving the developers what they are trying to reach for? More or less what do you think should be included in Cocoa for Mac OS X 10.6? One interesting trend I see repeating itself over and over is that of Apple coming up with some great custom control (usually used in iLife) and then Cocoa developers working on their own custom implementation of that control, then Apple releases it officially in the next SDK for Mac OS X. I wonder how long that will continue?

 
...