2 Nov 2008

The good and bad of the internet

One of the big things that has changed since I last programmed is the Internet.

The ability to log on and find some discussion or code fragments that do what you are trying to do,
or to answer the questions you are trying to answer is fantastic.

At the moment I am trying to get the blog writing app to write out resized images - I don't want to
draw them on screen only load them and save them again.

Now this requires me to use the class NSImage - one that is not in the foundation set of classes, but
in the appkit - now as I am building a command line utility when I used NSImage it failed with a
linker failure - something I have not seen before in Xcode.

So after several hours of struggling I posted a question on Mac Forums and when I got up this morning there
was a response that gave me the clue I was looking for ...

macforums

wonderful.

On the other hand there is a real danger that you start picking up code from other people and you don't really deeply know what you are doing -

Here for example I found someone who had the problems I had this morning - failing to resize an NSImage and then getting crashes

Great the answer is good and works for me -

cocoabuilder


But I don't really (deeply) know what he is doing. Sure at some superficial level it is clear he is drawing the old bitmap onto a new bitmap of the
right size but I have not put those lines of code together and read the manual on each of them so I am in danger of kidding myself
I know what I am doing!

Anyway here is my finished code for a command line utility to resize a jpeg image file.

blah


click here to return to the blog