Screen capture on the Mac

4
Aug
0

Found this great tip of the week

Okay, you probably already know the ol’ Command-Shift-3 shortcut for taking a screen capture of your entire screen, and you may even know about Command-Shift-4, which gives you a crosshair cursor so you can choose which area of the screen you want to capture. But perhaps the coolest, most-secret hidden capture shortcut is Control-Command-Shift-3 (or 4), which, instead of creating a file on your desktop, copies the capture into your Clipboard memory, so you can paste it where you want.

[Post to Twitter] Tweet This Post 

Filed under: Mac

3.1 SDK Available

1
Jul
0

Apple have said:

” iPhone SDK 3.1 beta and iPhone OS 3.1 beta are now posted to the iPhone Dev Center. These versions are for development and testing only and should be installed on devices dedicated to iPhone OS 3.1 beta software development. Please read the iPhone OS Pre-Install Advisory and the iPhone SDK 3.1 beta release notes before downloading and installing.
Use the Apple Bug Reporter if you discover compatibility or functionality issues while testing with the iPhone OS 3.1 beta release.

[Post to Twitter] Tweet This Post 

Square brackets

28
Jun
0

While typing calls against an object, don’t bother entering the opening “[”, when you type the closing one Xcode automatically inserts it for you :)

[Post to Twitter] Tweet This Post 

Filed under: XCode

Diary Of A Code Fiend - Day 2 & 3 - Nitty Gritty

19
Jun
0

Well, iam now over half-way through the “Learning Objective-C” book from Apress. Might i add, im loving Objective-C! It is an elegant language (if not hard to grasp at first), and makes learning it a pleasure!.

Anyway, what have i learnt. Well, alot of the OOP theory i already knew, and to be fair most OOP is the same through languages (that support OOP!). Now what does Objective-C offer from an OOP point-of-view:

*Inheritance - NOT Multiple Inheritance
*Composition
*Polymorphism
*Indirection

Now before i move on, some people have asked me “What is Composition?”. I have been aware of this through C++, but you may already be aware of it without knowing it! The .NET Framework uses it extensively.
Composition is where you create a class with pointer references to other class objects as instance variables. You are composing objects of other objects, and not ANSI standard (int, float, char). For e.g.:


@interface ipcCar : NSObject
{
ipcEngine *Engine;
ipcTire *Tire1;
ipcTire *Tire2;
ipcTire *Tire3;
ipcTire *Tire4;
}
@end // ipcCar

Composition CAN be used with inheritance, as you can see from above. So, composition is nice! So, did you know it already? See programming isnt hard! In addition to Composition, i can learnt some more about Xcode, which is good IDE to get to grips with.

Now any one who knows me, knows that i like to know what is happening under the hood of these framework classes im using. Microsoft’s .NET Framework has revolutionized how we code. It has given us an extensive range of classes to use; inherit and mould, given us easy reflection runtime functionality curtsy of Just-In-TIme compiler and CLR (Or MS take CLI). But what did we do before .NET? Programmers had to UNDERSTAND how code works and WHY. Yes .NET lets us make quick; robust programs, but it takes away the knowing why we are doing things. Take for e.g. the MFC (Microsoft Foundation Class) used by C++. Before .NET you had to draw your windows for your GUI yourself; understand windows messaging queues and how your app talked to Windows OS itself, and even alittle Driver knowledge thrown in. Being a .NET programmer (most of them anyway), this knowledge is lost. The CLR copes with this for you, and thus we create the “Lazy Programmer”.

Sorry for going on about M$ .NET, we are an Apple iPhone developer after all. So why have i ranted. Well, Apple quite rightly have put restrictions on the amount of memory we use and how quickly our Apps close when the OS asks it to (incoming phone call for e.g.). Now the Lazy Programmer paradigm doesnt work with iPhone development. Memory Management is crucial, and Cocoa deals with memory differently, and we as programmers HAVE TO UNDERSTAND HOW it works, otherwise bugs and leaked memory will occur and your program will fail Apples stringent tests.

So how does Cocoa handle memory. Well the NSObject class (which ALL your classes will be related to, like in .NET ALL your classes will have a relationship to Object), has some nifty stuff. Each time you instantiate an object using new, alloc or copy methods, Cocoa sets something called retain counter to 1 (integer). You have the following class methods to interrogate this counter:


- (id) retain; //increase retain count by 1
- (void) release; //decrease retain count by 1
-(unsigned) retainCount //returns the current value of retain count

When the retain count is 0, Cocoa will call the method dealloc and destroy the object and free the memory. Now there is a class NSAutoReleasePool (subclass of NSMutableArray) that handles releasing of memory cleanly for you. Now Apple suggests you use the retain and release methods instead of this, and over the weekend, im going to give some tips on how to do this, explaining on how to use correctly.

Also remember at the moment you cannot use the garbage collection now available, so we now need to be Smart Programmers and not Lazy! Until then, happy coding.

[Post to Twitter] Tweet This Post 

Quick Tip: Xcode __MyCompanyName__

18
Jun
0

Have you noticed in Xcode when you create a new Objective-C source file in Xcode you have a comment block that includes:

//Copyright 2009 __MyCompanyName__. All rights reserved.

Annoying that Xcode doesnt have some user interface to change the company name! There is away of changing this:

1) Start up the program Terminal Utilities/Terminal

2) Enter the following BUT change iPhoneCodeMasters to your company name ofchoice:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions ‘{”ORGANISATIONNAME” = “iPhoneCodeMasters”;}’

3) Press enter

4) Shut down and restart Xcode.

WOLA! YourCompanyName added!

[Post to Twitter] Tweet This Post 

Filed under: XCode

COMING SOON - NEW IPHONE APPLICATION

17
Jun
1

MORE DETAILS TO FOLLOW!

logo1

[Post to Twitter] Tweet This Post 

Filed under: News

Diary Of A Code Fiend - Day 1 - Confusion Sets In…..

17
Jun
0

Over the coming days i will be writing daily posts updating you all on my journey to becoming an iPhone Developer. Now, i have started at the logical point in my view, Learning Objective-C. I have purchased myself a copy of “Learning Objective-C on the Mac” by Apress and will be slugging through the chapters, the finishing point culminating in an (hopefully), successful iPhone App. I have my first App drawn up, but more on that on another day.

So, Objective-C (ObjC). Being from a C++ background, this language is both easy to grasp, but a strange new world (but exciting). The book i have purchased is easy to read but explains in chunks what is going on behind the scenes. ObjC is an extension of C itself with more C++ style OOP structure to it. So far so good i hear you say. Well, it does get alittle confusing as you start  delving a little deeper into the language. Take for example square brackets []. In other programming languages, these are used to to help you declare an array of an object or reference it by its index, for e.g.:

char myString[100]

myString[i].Write()

myString[strlen(myString) - 1] = ‘\n’

This functionality still exists with ObjC, BUT the famous brackets are now used for other functionality, i.e. sending messages and calling functions. Now this is where my C++ brain got (and still is alittle) wracked. In C++ you would call a function (or method in ObjC) like:

countString(myString);

or

stripString(myString,”.”);

or

YesNo = primeNumber(myNumber);

Now you can still achieve this in ObjC for normal functions/methods. It is when you start dealing with struct & class that things get alittle peculiar. In C++ you have private and public data types (or variables) associated with your class. In ObjC you dont, but you still have methods to access and populate them.

myBox = new Cbox();   //C++ instantiation of a new object - memory allocated via constructor

myBox = [Cbox new];  //ObjC instantiation of a new object - memory allocated via message new

Then you could have a function to set colour:

myBox.SetColour(Red);  //C++

[myBox SetColour: Red]; //ObjC

This is where the confusion sets in and you need to train your brain syn-tactically(see what ive done there!), in the ObjC way. I have only touched on the surface if ObjC, but it is a wonderful language to start learning. I havent posted much yet, because im only on Chapter 5, but tomorrows post should be alot more jampacked with tips. Later on in the month, i will also give some tips and advice on XCode, Apples excellent take on an IDE (Visual Studio watch out). Apple have also created Cocoa, the Mac/Iphone Framework using ObjC, and again, i hope to explore this in more detail.

 

Until tomorrow :)

[Post to Twitter] Tweet This Post 

WWDC 09 Day 4 Complete

12
Jun
0

Another fact filled day, loads of good stuff on View Controllers, including covering the new ones, such as Media Picker.

Another fantastic lunchtime presentation about the restoration of original moon images taken by NASA in the 60s.

The day ended with the developers bash, where CAKE played.

[Post to Twitter] Tweet This Post 

Filed under: WWDC 09

WWDC 09 Day 3 Over

11
Jun
0

Today has been a day filled with Open GL ES, it showed that with the correct techniques the iPhone is capable of some pretty impressive graphics and with the 3G S it only gets better.

There was a fantastic lunchtime session by the CTO of Smule, creators of Ocarina, which certainly proved that there is a massive market out there waiting to purchases apps. The important thing is making your apps interesting, human friendly and create a feeling of community.

[Post to Twitter] Tweet This Post 

Filed under: WWDC 09

WWDC 09 Day Two

10
Jun
0

The iPhone sessions were very popular, especially the gaming ones in the morning and afternoon. These 2 sessions covered 6 main areas but in very brief detail. Most interesting was Peer-To-Peer, which opens up a lot of potentials for games development and if you connect via Bluetooth all of the connection management is handled for you.

Attended the Audio processing session after the games development, the presentation was pretty boring, but there were a few snippets in there.

The final session attended was Core Data for the iPhone, this was very well presented and covered a lot of ground in the short session. If you need persistent data then Core Data does the job for you and even has some good features specifically for the iPhone to keep memory usage to a minimum

[Post to Twitter] Tweet This Post 

Filed under: WWDC 09

Tweet This Post links powered by Tweet This v1.3.9, a WordPress plugin for Twitter.