Category Archives: Mac

Successful connection to voip.ms using Objective-C

Alright… Been procrastinating again.  But tonight I successfully extracted my Call Detail Records (CDR) from voip.ms using an Objective-C program.  Voip.ms expose a REST/JSON API that makes it possible to do a lot of things, and I’m hoping to create an app to control many features of my account without having to log in to the web site.

The Apple documentation is a bit blurry when you’re just beginning with the Cocoa API, so I had to hunt down a few examples and work from that.  The good news is that nothing did what I wanted, so I had to fiddle quite a bit to get things to work.  Hopefully by the end of the weekend I’ll know what I’m doing well enough that I’ll be able to write a post here about it. Voip.ms provide samples in PHP and .NET, would be nice to have a ready-made Objective-C demo for those who want to get working right away… Stay tuned.  For now, my back needs a break, and I hear Netflix calling…

Slowly getting to know Objective-C

So these past few weeks I’ve been toying a little bit with Objective-C and Cocoa using a couple of books from Apress: Learn Objective-C on the Mac: For OS X and iOS and Learn Cocoa on the Mac. Both are very good at introducing the subjects, not going too deep but generally deep enough to get a good understanding of the basics.  I did get tired of toying with the example projects, so after much procrastination, I started doing things on my own.

I figured I’d start by trying to access data stored in the MySQL database I use for my web site,. I’ve been using a crappy MS-Access interface for nearly 12 years and I’d like to retire that thing. So I went out looking for an Objective-C interface to MySQL. No such luck – none is offered by the MySQL group at Oracle. I didn’t find a couple of open source projects meant to fill the gap, but they were pretty old and abandoned. So I set out to do it the hard way: I download the MySQL C API. After all, you can do C in Objective C.

So yeah… My first Objective-C experience (doing a project of my own) is starting as “plain old C”.  I hadn’t done any C in 8 years, and that was for a very small program on Windows.  Things are slowly getting back to me, but want it or not, it does make you appreciate what frameworks such as .NET do for you.  So far I’ve managed to call three stored procedures for adding, updating and retrieving bands from the database.  Which reminds that I need to delete as well. *sigh*  I’m not crazy about stored procedures, but for what I’m setting out to do, it’s going to be easier than writing the SQL directly in the C code – less housekeeping with the strings.

Back to Objective-C – that is some weird-looking language at times, but after and writing some of it, it’s looking less alien.  Even though Apple have added a lot of features over the years, it does show its age here and there – lack of namespaces, the relatively ambiguous status of private methods being two.  But throw in Cocoa and things already get more modern.  That’s a pretty cool framework that I can’t wait to start using for real (once I’m done with the database code). Would be nice if Core Data supported MySQL though. (Hint, hint…)

I also got an idea for an iPad app, but I can’t do everything at once… 🙂

That’s all for now…

8 months into the Mac world

Well, I had been meaning to post more periodic updates of my journey into the world of Macs, but I didn’t. No good excuse. 😉

It’s been… interesting.  There is quite a bit of getting used to, interface-wise.  OS X has a clean interface, but it is showing its age here and there.  They could borrow a few things from the Windows world.  Just think of having to reach for the mouse when a dialog pops up because there is no keyboard shortcuts on the stupid buttons!  This one is a major pet peeve.  But it hasn’t killed me yet.

As mentioned in my previous post, I decided to get a Mac to explore a new programming platform.  Well, that hasn’t really happened yet.  Or has it?  OK so I haven’t done actual Objective-C programming to create native OS X or iOS applications, but I’ve used a few built-in goodies to automate a lot of tasks on this machine – laborious, repetitive stuff that I had been doing manually for years.  AppleScript, while verbose and a little on the wild side, is great for automatic Mac applications (especially when the applications have explicit support for it).  And since it’s really UNIX running behind the pretty interface, languages like awk as well as UNIX shell scripting are readily available.  I’ve used a mix of some four different languages to automate time-wasting and error-prone manual tasks related to the maintenance of my web site, The Metal Crypt. It took a while to get things the way I wanted, but now the daily update process is almost pain-free.  The next step will be to replace the crappy Microsoft Access interface (for maintaining the site’s MySQL database) I put together in an evening over 10 years ago.  That was a temporary thing until I got around to writing something more permanent.  Ooops…

Did I say Microsoft Access?  Yep.  I’m running a number of Windows applications in a Windows 7 virtual machine using Parallels virtualization software. It does a pretty good job of integrating the two operating systems, especially with a “Coherence mode” that displays Windows applications alongside Mac ones on the OS X desktop.  That works relatively well, though some applications don’t always react so well in that mode.  Other than that I’m running software with a decent Mac equivalent, like Quicken, Catraxx, AssetCat, BookCat, CatVids, Visual Studio, Mp3Tag, MediaMonkey and the Windows Home Server console for managing my WHS-based NAS.  I even went nuts a little bit one day and created an Ubuntu virtual machine, so I was running three operating systems at the same time.  Unfortunately the Linux Coherence mode is not up to par with the Windows one yet, but hopefully Parallels are working on that…

Overall, I’m liking the experience.  The machine and operating system are not as perfect as the Apple zealots scream on every rooftop (I’ve had more OS crashes or hangs than I ever did with Vista and Windows 7 combined over a period of more than 5 years).  But there’s a lot of stuff to like, and it’s fun overall.  Did I mention monitor quality?  The iMac’s built-in 27″ monitor is excellent, and so is the additional 27″ Thunderbolt display.  I’ve got quite a bit of stuff available simultaneously on all that screen real estate.  Maybe too much, now than I think about it…

Now, with an unexpected move last fall and then a lot of overtime last winter, as mentioned earlier I never got around to doing some “real” programming on this puppy.  I just added a few Xcode components to get ready to roll, and spent some time swearing because the damn thing has somewhat weird support for source control (actually, I’m still swearing since I have yet to get it to play with Subversion).  Little things.  Now it’s time to dig deeper in Josh Smith‘s book iOS Programming for .NET Developers.  After all, that’s what kind of triggered this Mac adventure in the first place…

Flirting With the Other Side…

A couple of weeks ago I got a crazy idea: Buying a Mac.  Well, the idea started with an interest in learning another platform and also taking a shot at iOS development.  I had been juggling with the idea for a while, and the last straw was when Josh Smith released his new book iOS Programming for .NET Developers. More on that once I’ve actually read it (I’ve only read the sample so far).

So this past week the iMac got here and I installed it last night. Talk about foreign land. Still getting a hang of all the differences (lots of keyboard keys react differently from Windows, for example) and of course the way you interact with OS X is at times very much different from how we do things in Windows. After upgrading to the new OS X “Mountain Lion”, I am now installing various applications and configuring the OS, slowly but surely. Last night and this morning I was freaking out, but I’m slowly getting used to it. Oh and that 27″ monitor looks like it wants to swallow me whole… Bottom line, this is a very nice and elegant machine, and having had to unplug the PC tower to move it elsewhere, I certainly appreciate how little cabling is necessary – an all-in-one computer does have its advantages.

The iMac is really a fancy PC, so once I got the basics up and running I’ll be installing Windows 7 on it as well.

More later…