dannygreg.com

my personal and professional home on the web

About

developer, musician, actor, blogger, podcaster, mac user and teenager. this is my personal blog and central location for all i do.

When you are coding there are a lot of things you type over and over again - (void)awakeFromNib springs to mind as well as a few others. I am a great fan of doing as little typing as possible, I would like to be able to say that this is because it allows me to focus on the purpose of the code I am writing, but really it is just plain laziness. What?! I’m a teenager!

So I am a big fan of auto-complete in Xcode. I am also a big fan of the macros in TextMate, but I would rather have the auto-complete. So I turned to TextExpander, something I have been using for a while to relieve me of some of my typing duties.

What I came up with is a set of TextExpander snippets that are in their infancy but that I have been using for a week and am loving. For someone who has never coded 9-5, 5 days a week before, these are really helping ease me into it! (I of course have coded for that length of time, just more in the 7pm - 4am category).

I would love to see some other developers add to the list but here is what I have so far:

  • All my headers. (These will not be in the download for obvious reasons :-))
  • NSLocalizedString
  • NSLog
  • @selector
  • dealloc
  • init
  • property syntax’s
  • awakeFromNib
  • IBAction

    These are not just those words, oh no. These are full methods and statements that make use of TextExpander’s wonderful ability to position the cursor where you like once it has expanded. For example when I type “iinit” the following appears:

    - (id)init
    {
    if (![super init])
    return nil;

    %|

    return self;
    }

    (That has probably come out horribly on wherever you are reading this but theres not much I can do about that right now). Where the “%|” is, is where the cursor is positioned. So after typing “iinit” I am all set to write my initialisation code.

    Why the two “i”s? Simply to avoid that expanding every time I want to use an init method! Its a well known TextExpander technique.

    A neat trick is that I have different variations for my NSLocalizedString that pastes the contents of the clipboard into the the relevant slot. So if I have been given a localizable.strings to deploy I just copy which string I need and type “lllocal” (two “l”s and it doesn’t paste the clipboard, just moves the cursor). TextExpander does its magic and a lot of effort is saved. I do a similar thing with time stamps in my headers.

    This has only been a week of me really thinking about this so I have no doubt the collection will grow but I really want to see some suggestions for different snippets. I don’t usually get many comments from you developers out there but consider this a call to arms! What would you like to see in the snippets set.

    I have uploaded the set of snippets and it is a freely available to download, use and edit as you wish. To install open up the TextExpander preference pane, choose the “+” drop down and select “New Group from File…”. Then simply choose the .textexpander file you downloaded.

    I hope this is as much use to you lot out there as it is to me and please let me know all the obvious snippets I’ve missed!

  • Cornerstone Review

    July 6th, 2008

    app.pngIt has been a while since my last review for The Mac Review Cast as I have been busy settling in at Realmac. However, these 2 different pursuits of mine came together nicely in the form of a review for the new Subversion client Cornerstone.

    If you are a developer you should be using some form of SCM system, whether it helps you collaborate as a team or acts as an easy-reference backup it is simply a must have. In fact I was on the Mac Developer Roundtable discussing this back on Episode 7.

    There are a lot of choices out there but the most common nowadays is Subversion (although distributed systems such as GIT are coming on strong, especially in the mac community but that again is a completely different segment in and of itself). Most SCM systems, including Subversion, are command line applications, which is mainly due to their complexity but if you were born into the computing world with a GUI in front of you, like me, this can be somewhat hard to swallow.

    So a number of developers have created UI front ends to various systems although up until now there has been a distinct lack of them on the mac. For SVN in particular, all we had was SvnX and ZigVersion and neither of these were very good. Over a year ago a company named “Sofa” announced that it would release a product called Versions, it got pushed further and further back until they recently posted a beta. Just as Versions was beginning to generate some hype Zennaware released Cornerstone 1.0. No hype, no beta just a straight release.

    It blew Versions out of the water and is a fantastic example of how you can have as much hype around your app as you like but at the end of the day its having the best product that really matters.
    For a start Cornerstone comes with Subversion baked into the application package. Why is this great? Well if you are running Tiger (Cornerstone runs on OS X 10.4 and up) this means you don’t have to install Subversion separately which can be a complete pain. As SVN comes with Leopard this is not an issue on 10.5 systems.

    The real force of this application is found in its UI, which considering all it is is a front end for an existing system is pretty essential. UIs can be notoriously hard to write for SCM systems due to their complex nature but Cornerstone really cracks it by presenting your Repository and Working Copy information in clean and powerful ways.

    For a start it has the sidebar and toolbar look that we all know and love from iTunes and the Finder. Although I think in this case the toolbar icons don’t really suit there purpose. There is also no commit toolbar item on the toolbar which I thought was an odd choice but a quick toolbar customisation later and it was there.

    There is also the addition of an iTunes-esque “LCD” display to the toolbar. I have heard some negative reaction to this from other developers but for me its brilliant. Most SVN clients, including Versions, present work being done by the system on a sheet window so you can’t do anything else while it is happening. This display not only means you have one dynamic place to look to find all of your progress related output but you can keep working on other repositories or working copies while the back end does the work. Simply brilliant.

    There are tons of options on menus and contextual menus including the ability to right-click a file and set it to be ignored. I have been feature requesting this in pretty much every SVN client I have tried and I almost cried out with joy when I found it. Which brings me to my next point. Everything was where I expected it to be. It is hard to describe any particular examples other than that above, but the interface was so well designed that I found everything without having to refer to any documentation or digging through the application. If I needed a task doing I guessed where to find the tool and it was there. Flawless interface design.

    Another great little feature is the addition of some quick filters as well as a filter box on the top of the list view, a great way to quickly see the changes you are dealing with. Then with the hit of button up-slides a section showing the changes between your local file and the latest revision in the repository, complete with syntax colouring and FileMerge-like comparison tools. Not to mention that then with the hit of one keyboard shortcut you can commit just those changes or the ones selected this makes for a seriously quick workflow.

    The next major addition to the app is the timeline view. This is a graphical way to visualise the history of your repository. It is hard to describe on an audio review but each check-in, branch, merge etc is visually represented. You can select one of these points and pull up an inspector which can tell you the location of the file; the check-in message; the author of the change; the action and whatever other changes that were made in that event. Also, selecting 2 of the events allows you to bring up the same changes inspector as in the working copy for quick comparison of your changes during a specific check-in. This is simply an inspired way to browse the history of a repository.

    Cornerstone is available for $59 for a single user, 5 and 10 user packs are also available for $259 and $449 respectively. For me this is the only front end for Subversion that I have seen that not only does a decent job of slapping a UI on the front of Subversion but even improves the feature set. If you are using SVN then this is a must-buy. If you are using a different SCM system I would even suggest moving to SVN just for Cornerstone. It has changed the way I deal with SVN, for the better and for good.

    We Are Realmac Software

    June 30th, 2008
    2625441766_ddf0ed6084_o.jpg

    Today was my first day at Realmac and the new office. Wow! 2 words: “sofa” and “Wii”. I could perhaps extend that set with “beer fridge” but it doesn’t quite have the ring to it. Pictures will be up when its all finished and looking smart (I don’t think my desk will ever be free of note-paper however).

    To commemorate the occasion we had a team photo and I couldn’t help feel a bit of a twinge as Dan tweeted “We are Realmac Software” and linked the Flickr page. Not only is it cool to be part of such an incredible team but its fantastic to have a job where I look forward to going to work in the morning.

    I have many people to thank but I think Chris and Nik need a public mention, without either of them I’m fairly sure I wouldn’t be in the privileged position I am now.

    As for what happens in the office, I’m afraid you won’t find any of those details here, for Realmac info the best channels are the company blogs (somehow I have gotten away with no blog writing duties :D).

    There are big things to come from this small, but growing, company and hopefully I can play a part.

    I don’t often simply link posts but Scot Stevenson just wrote a superb piece over at theocacao entitled Thinking Like a Cocoa Programmer.

    It is one of the best posts I have read on the subject and if you are just getting into cocoa then this would be a great read.

    New iPhone

    June 10th, 2008
    hero20080609-2420-w.png

    Am I buying one? Yes.

    What size? 16 GB.

    Why 16? Because I’m going to need the space for apps, games, music etc etc.

    What Colour? White.

    Why? Because they fixed every complaint I had about the device except the lack of flash and copy and paste.

    Will we see an iPhone app from you/Realmac? Yes.

    YourDay 1.1

    June 5th, 2008

    I have been using an updated version of YourDay for quite a while and I thought I had better pass it on to you guys.

    So what’s new? Well not much in terms of functionality, the big deal is I stripped it from 1.1MB down to 144KB. I achieved this by simply by ditching the terrible HUD control framework and rolling my own HUD table view subclass. Sadly lacking in alternating rows but that will come. As a happy side-effect it is also slightly more efficient in terms of memory usage.

    You can download the new version here as well as the updated source code, I will open up the source repository at some stage, but not yet :-) .

    I will also get on and make a permanent YourDay page on the site at some point. At any rate, enjoy the new version!

    Yes Its Realmac Software

    May 28th, 2008

    Lil Danny avatar.png
    Well I guess the cat is pretty much out of the bag at this point, if it was ever in one. After I wrote my previous blog post things moved on rather quickly for me and the result is that I am now employed (haven’t signed the contract yet but I was offered a position that I accepted) by Realmac Software, makers of the awesome RapidWeaver web creation tool.

    For me this is a full time job, I start work officially on the 30th of June but I will be dropping down to the office occasionally and doing bits of work from home before then. So no more “I might do it for a year and then university”, uni is now off the cards and to be honest I couldn’t be happier.

    Faced with the possibility of spending 3 or 4 years learning Java I would much rather spend my time with Cocoa and working with the great team at Realmac.

    I have joined at a fairly strange time, as I write this there is just over 19 hours to go before RapidWeaver 4.0 is shipped and I am proud to say that I have contributed to the release… even if it is 2 lines of code!

    My position is “Cocoa Junior” (beautifully portrayed by my incredible avatar) and that’s fairly descriptive. I will be working on RapidWeaver (amongst other things) but certainly on no lead role, I expect I will learn a lot from the likes of Dan and Andre and I’m fairly sure they are going to be sick of me in a few weeks time. Finding your way around the RapidWeaver source code if you are brand new to it is an interesting experience!

    So I guess the question to answer is what happens to BitClamp and Latitude, as well as blogging for MacApper, podcasting for the Mac Review Cast etc. The short answer is I don’t know. At this point in time I intend to keep developing BitClamp but that may change when I settle into my role at Realmac. For now, at least, things will stay as they are. With the exception of my role at MacApper where I will probably resign I don’t blog there enough to deserve a spot.

    So thats it pretty much, off into the big wide world ‘n’ all that, well not really until June 30th but hey! I’m sure you will be seeing plenty more of me here in any case!

    O.k. so its been quiet around these few parts, and on the MacReviewCast and on the BitClamp side of things bar some minor updates and I think the time has come for you all to actually know what the hell is going on.

    For a start, I have been busy with Latitude and supposedly my A-level exams although I think it is no secret that I hardly care about my college education at this point. If you follow my twitter stream you will notice I am frequently in Xcode during physics lessons. I am not saying this is a good thing, it is definitely the opposite, but I unfortunately now have interests in completely different areas to those that I am studying. If I was doing a computer science degree at uni I am sure it would be a different story.

    So what am I going to do when I leave college on the 20th June. Well my answer a couple of months ago would have been something along the lines of “start an indie mac company, freelance a bit.. maybe… learn more VB.NET and hope for a windows job?….hope the band gets signed……grow my hair?”. But even I know that isn’t really the best thing to be counting on.

    Lucky for me that all changed on a chance meeting (thank God twitter exists) a few weeks ago.

    From the 30th June I start a 2 week trial with a well known mac software company, no names yet as I believe it would be seriously unfair to mention all that before my trial is (successfully) completed, do I want to tell you? Hell yes, but its not fair on them.

    If the 2 weeks goes well then I will be working there for a year before I go to university….. if I decide to try and get in to university that is. The experience would be unbelievable and a great addition to my CV. Not to mention its a company that I have looked up to for a long time (no its not Apple don’t be silly).

    I am ridiculously excited about this, its got to the extent that I’m wishing my A-levels to be over just so I can start work (I swear thats wrong somewhere along the lines) and if the phone calls are anything to go by what I am working on will be a lot of fun. The idea of spending office hours doing what I love is something I try not to think about too much in case I completely balls up the trial or something!

    So what happens to my other projects? Well they will continue. If anything their pace will be accelerated due to the amount of time I am spending programming. However, I do anticipate times when development will simply stall as I am busy at work.

    I don’t want to get ahead of myself… 2 weeks trial first… but man am I excited :D.

    In Leopard we saw a massive (and welcome on my part) change in the standard developer tools shipping with OS X. One of the additions to the IB libraries was that of the black, translucent “HUD” window.

    “At last!” we all cried, no more faking the window type that we had all been dying to use since Apple started using them in their pro apps. However, for some reason NSButton didn’t have a “HUD” appearance, neither did any of the standard AppKit controls. So if we wanted to use the new HUD panel we would have to use standard Aqua controls…. great, thanks Apple.

    Now this is old news but it has new relevance for myself in Latitude and YourDay (which btw I have updated and have created a page for on the site). Up until now I haven’t really needed the HUD window, I mean its neat but I’ve never really required it.

    I had seen that there was an open source black control set created by the guys who wrote Shiira. Great, I’m sorted….. right?…. not a chance.

    For a start controls don’t look right for my money, and then it just fails to draw correctly. I had to resort copying and pasting images from the framework into the project and naming them the same thing for the framework to even realise they existed.

    Now some of this may be leopard related as it was clearly designed to work with its own custom panel type as opposed to the new HUD window, but it is infuriating none the less.

    The obvious argument is “its open source, fix it yourself!!”, which is true and if/when I get the time, I may well have a dig around and see what I can come up with, but all of this shouldn’t be necessary. Apple clearly has subsets of the AppKit controls designed for the HUD window, what have they got against giving it to us?!

    This is not just a frustrated winge (I’m coding now) but I am genuinely curious. I feel slightly out of the loop since I stopped following mailing lists due to the amount of effort it took to keep up, so I was wondering if anyone actually new why on earth we haven’t been given these new toys to play with?

    Just a heads up that I appeared on the latest Mac Developer Roundtable.

    The topic for the discussion was Source Code Management and I have to admit it was a fairly eye-opening discussion. I discovered several different SCM systems as I pretty much represented the “SVN and SVN only” crowd.

    We also discussed WWDC briefly and of course our developer picks. I picked DMG Packager as an app I have been using for a while and has been immensely useful for me.

    These are great fun and superbly hosted by Scotty. If you are a mac developer on any level I thoroughly recommend taking a listen.