NSTreeController and Core Data, Sorted.

May 13, 2008

Having recently taken the plunge into Core Data I decided it was time to rip out all the model code from my current application and replace it with a Core Data version. After about a day I had my app up and running again but with one huge problem, the content of my NSOutlineView always appeared in a random order. Such is the problem with Core Data that NSManagedObjects store their to-many relationships in an NSSet, not an NSArray, which is unordered. So when your NSTreeController tries to display its data it appears in a random order.

This is not nice, imagine if the playlists in your iTunes library always changed their order? It gets even worse if your user wants to use drag and drop. In this case they decide the order, and they’d probably want it to stay that way.

Read the rest of this entry »


I’m on the Mac Developer Network!

April 22, 2008

I recently did a post on NSViewController with Cathy Shive, and I realised today that the post was link to on the MacDevNet (Thanks Scotty!). I’m actually feeling like a developer for once.

Welcome all, nice to see you. Sit down, have a cup of coffee (espresso is served here), and I’ll write some more in a bit.


Using NSTreeController

April 6, 2008

A common UI concept in Mac development is that of the source list, which everybody knows from iTunes, iPhoto, etc. To do this, NSTreeController can come in particular handy, although it can come with a bit of a headache as the API is somewhat lacking and a proper model is essential to making this easy to use.  I’m going to go over the solution that’s worked for me.
Read the rest of this entry »


How to Install MCNP4C2 on Mac OS X 10.5.1

January 13, 2008

Well if you’ve already read my post on installing MCNP on OS 10.4.10 then you mostly know what to do when installing on Leopard! Its nearly identical but with Apple migrating the X11 system they use to the one from X.org the X-window library that MCNP looks for is now a different name so the install fails and tells you it can’t find X11.

Some things are easier though, as X11 is installed by default you no longer have to install it from the Leopard DVD (unless you’ve selected not in install it in a custom installation of Leopard, in which case you probably know that you’ve done it).

Well when you’re at the stage that you’ve run the ./install linux mcnp command and have set the system option to Linux then you have to change the X11 path to the defaults except for the library name. This is now libx11la.lib then the rest f the install will run smoothly.

The new X11 in Leopard is buggy and the windows take an age to draw bit that’s going to be fixed soon. It all works fine its just the geometry plotting that is a bit slow, although this can be sped up if you switch to another app with a window that covers the X11 window during drawing (for example, iTunes), then switch back to find the window is completely drawn.


How-to: Install MCNP4C2 on Mac OS X 10.4.10 (Intel)

October 8, 2007

MCNP (Monte Carlo N-Particle) is a transport code that is used throughout the physics community to model how particles interact as they travel through a system. The code is quite old, and therefore requires tweaking to get it running on newer systems like Mac OS X 10.4.10. There are programs and compilers it needs to use when installing that aren’t included in Mac OS X anymore due to their age, and a few that are on the Mac OS X CD that came with your computer, but aren’t installed by default. The first things we need are:

A FORTRAN-77 compiler and a ‘C’ compiler of the same version.
The ‘fsplit’ program.
X11 installed.
The XCode tools.
Read the rest of this entry »


How-to series

October 8, 2007

The next few posts I think will be a little more obscure than the others.  As a scientist, I frequently have to work out how to install random science-y programs on my computer, and how to do the odd geeky thing.

 Occasionally I get asked how to do these things, and the things I need to do are frequently undocumented, or badly documented at best.  I hope someof you find these things useful.  If not, at least they’ll exist for when someone asks me how.


Potter Puppet Pals

September 3, 2007

Hi guys! I haven’t posted for a long time, been quite busy with being important.  I do however have to help in promoting this:  


Longest…Post…Ever!

June 27, 2007

For the few of you who read this regularly, I’m sorry I haven’t updated my blog for a while.  I’ve found some things I’d like to blog about, but have had both zero time and little internet access.

Since May I’ve been swamped with working for my MSc exams, the closer they got the more stressed I became and couldn’t bring myself to be remotely creative!  They finished in early June, and went surprisingly well considering the sheer volume of information I had to remember.  I clearly recall getting to the final exam, sitting down, and being so tired that I had to force myself to begin answering questions.  Normally I feel the fear in exams and start writing immediately, but this was utter exhaustion.  I get the results sometime this week hopefully, but I’m not the sort that agonises over the wait.

After the exams I went off to Paris for a couple of days to see my girlfriend, which was ace.  I actually managed to relax there.  Then came back and moved to Swansea to start working on my research project.  This was where more stress hit me.  If you ever need to get information from Swansea University, don’t count on it being true, or them helping you one bit.  As I’m a postgrad, I asked if they would give me accommodation for a couple of months whilst I settle in and find a place.  The response was, “Yeah, sure.  That’s no problem, we have spaces now.”  This was at at the start of the week before I moved, whilst I was in Paris.  It got to the end of the week, they’d had my application form, so I called them when I got back to England: they hadn’t sorted a room as there were no spaces, even though most of the students had moved out.  They were thoroughly unhelpful to me, leaving me up the creek without a paddle.

I then went to stay with my best friend in Cardiff, hoping to find a place in Swansea over the weekend and move in.  Having no car, an knowing hat the transport system in Wales leaves much to be desired, this was going to me no mean feat.  Thankfully on the Sunday I found a place, although I wasn’t quite sure about the landlord, I was desperate.  So I moved in on the Monday after work, dragging my suitcase over the majority of Wales.

The landlord turned out to be a dodgy piece of work (always trust your instincts!); wanting a huge cash deposit so he could fix the lock on the front door, which he hadn’t told me about.  So I moved out during the Tuesday when my boss gave me the time off, and moved into a B&B on the beachfront.  I recommend the Oyster Hotel if you’re ever in Swansea they have lovely ensuite rooms for £20-25 per night, great service and breakfast is included.

I finally found a place on the Thursday, and then had to rent a car to go back home and pick up all my stuff, including my new MacBook Pro (hmm.. Apple’s built in spell-checker doesn’t recognise ‘MacBook’) that had arrived during the week, I’m typing on it now ;)   That cost enough, but it’s a good job I paid £30 extra for zero excess, else I would’ve had to pay £500 for the alloy wheel I scratched on a curb.  Should have taken a photo of it to post here, but just imagine a brand-new Corsa with a busted rim :)

I think the internet will be connected in the house when I get back from work; if you’re reading this then it has been!  We’re having a 20mb line put in so I think video -chatting on Skype with my girlfriend will work fine, don’t you?

The best part of all this was when the Hospital Accommodation office rang me during the week.  I don’t think I said why this all happened in the first place?  They said their staff housing was full.  I got a mid-week answer machine message, “When are you going to pick up your room keys?”.  Love the NHS, they had a room reserved for me for ages, but told me nothing about it.

So what have I learnt from this?

  • Never trust Swansea University
  • Pack light when you have nowhere to live
  • If you landlord sounds a bit off, run
  • As long as you have your phone and you wallet you can cope with anything
  • Always pay extra when you hire a car
  • I want a Corsa, but would probably scratch the wheels when driving off the forecourt
  • I love my Mac

Oh, and the research project is going really well.  Once I know what I’m doing I’ll put something up about it.


Norton Antivirus Crashes China

May 19, 2007

Most of you reading this may not believe me, but I thought I’d have to do some journalism and report something that’s been omitted from Western news sites.

China Has Been Oddly Silent
I was on the phone to my Chinese girlfriend yesterday (she lives with her mother in Paris), who told me that her father had called from Beijing to explain why her Mother’s computer in Paris had crashed. It turns out that an update to Norton Antivirus managed to wipe key system files from all Windows computers in Chinese! This has affected about 80% of the computers in China, and was only recoverable by those with a Windows install disk, which is not many due to the amount of computers bought with and OEM version of Windows.

He father also said that the disaster had caused a wave of suicides amongst businessmen, reported all over the Chinese news agencies, presumably resulting from a loss of money in stocks.

I still haven’t been able to find anything about this on Google, and her they can’t check the Chinese sites on her mother’s computer as they don’t have a Windows disk to reinstall the system, her own Windows computer cannot be used to type in Chinese.


Cornholio

April 25, 2007

I can hear him now:

I am Cornholio!

I found this on the interestingness page on Flickr, it seems that I’m not the only one who loves this shot. You can click the image to go to the original.