Copyright © 2012 Code Mox. All Rights Reserved. Snowblind by Themes by bavotasan.com. Powered by WordPress.
Few days ago I had a Twitter API talk. You can download the slides from this presentation in pdf. I’m waiting for some comments.
Slides:
Twitter API Presentation
Don’t you think that this is irritating that you can’t decide whether to put you Mac to sleep or to hibernate it – save memory state to disk. There are two options available in Mac OS X:
- Sleep – turns your machine off – however in fact this is “suspend to ram” so that means that your computer still needs power source to keep all the data in memory. Battery will eventually run out and then magically the system is writing content of ram to the hard drive – “suspend to disk”. But in this case if you don’t have a power adapter or a spare battery you cannot use your laptop.
- Shutdown – really turns your machine off – you loose all the content of ram
I would prefer to control what should happen in the “Sleep” case. By default it should behave as I described but additionally I would like to initiate “suspend to disk” anytime I want. In that case I could “eat cake and have cake” – the application state would be saved and the battery will not get empty.
The fact is that it is possible to do the on demand hibernation of you system. The solution is described below:
There are few modes of “Sleep”. You can find out which one is currently selected by executing following command in the terminal:
pmset -g | grep hibernate
On my MacBook Pro the result is:
hibernatemode 3hibernatefile /var/vm/sleepimage
The interesting part is this number after hibernatemode, in this case 3.
0 – Legacy sleep mode. Everything saved to ram (suspend to ram).
1 – Suspend to disk.
3 – Default. Suspend to ram, and when the battery runs out – suspend to disk.
5 – Like 1 but applicable only for modern Mac that uses Secure virtual memory.
7 – Like 3 but applicable only for modern Mac that uses Secure virtual memory.
So when I want to have on demand hibernation I should choose option 5 as my Mac is using Secure virtual memory.
I go to terminal and execute:
sudo pmset -a hibernatemode 5
Now if I choose “Sleep” in Mac OS it will do suspend to disk. To go back to the original settings just type:
sudo pmset -a hibernatemode 3
In fact this is not really as I wanted to have it work, I don’t want to change this setting every time I want to do the full hibernation with suspend to disk.
I found a useful tool Hibernation Tool for Mac OS (applescript) that allows me to perform hibernation without changing any settings. It is just doing what I wanted. Maybe in the next Mac OS X version there could be three options: Sleep, Hibernate and Shutdown. Let’s see.
Continue Reading »
I ‘m looking for some iPhone development information on the net.
First web site I’ve visited was of course Apple’s iPhone Dev Centre – Apple Developer Connection. That’s the place where you can find ‘Getting started documents’, programming guides and of course iPhone SDK 3.1.2.
Then I came across the blog entry regarding the useful iPhone dev resources: 43-iphone-development-resources. The post has been published in June 2009, but most of the information is up to date. You can find there links to the tutorials, some books reviews, forums and blogs. It’s enough to get you start coding.

Right now I’m reading iPhone development introduction book: Beginning iPhone Development: Exploring the iPhone SDK. The book really suits me: I read a chapter then go to Xcode and try everything by myself. It mostly covers iPhone UI development techniques and Cocoa Touch programming.
For someone who is new to Objective-C language I recommend Programming in Objective-C 2.0 (2nd Edition) by Stephen Kochan which provides the new programmer a complete, step-by-step introduction.
Continue Reading »
A week ago I’ve started to look for some introduction to the Objective-C language. Next year I’m planning to participate in an iPhone application project with Cocoa Touch. It’s high time to prepare for that…
I’ve decided that I need to buy a Mac box to start playing around Xcode and InterfaceBuilder IDE. I bought a used Mac Book Pro and I must say I really like it a lot.
Next step is to learn the basics of the Objective-C. I went through the pdf documents from Apple site. The language looks really terrible at first glance for someone who used to be doing C# development for the last 7 years. But I guess I just need some time to adjust.
Continue Reading »
