How To Install iOS Simulator 4.2 In Xcode 4.3.1

Recently released Apple iOS SDK 5.1 only includes iOS Simulators starting from version 4.3. However, ensuring your application works on iOS 4.2 might be a good idea, because this is the latest version officially available for iPhone 3G and iPod Touch 2G. It is probably fine to drop iOS 3.x support already (and, thus, original iPhone and iPod Touch 1st generation devices). At least many people suggest you do. But it might be little bit early to abandon iOS 4.2.

Unfortunately, Apple won't agree. Latest iOS SDK 5.1 doesn't have iOS Simulator 4.2 support and to make things even worse requires you to upgrade to Lion 10.7.3. Which in turn makes it difficult to install older SDKs. Though this may be possible, but I prefer no to mess things up by having a multiple versons of Xcode and iOS SDK around. There is a better solution. It is possible to add iOS Simulator 4.2 support to Xcode 4.3.1.

First, you need to find and download older SDK disk image: xcode_3.2.6_and_ios_sdk_4.3.dmg. Apple might still have it somewhere inside Member Area. If not it can be simply found with your favorite search engine. Actually, you only need file called iPhoneSimulatorSDK4_2.pkg. I had a luck finding it directly, so had no need to download the whole dmg. I am not giving any direct links here, since this might be illegal :) So if you downloaded the whole dmg, mount it. iPhoneSimulatorSDK4_2.pkg is inside the invisible Packages folder.

Now you need to install this package, but into some temporary folder. Double-click it and on destination disk screen click the disk. This will reveal the «Select folder...» button. Wait for installation to complete.

Now quit Xcode if you are running it. Then go to %Your Temporary Dir%/Platforms/iPhoneSimulator.platform/Developer/SDKs, and locate a folder named iPhoneSimulator4.2.sdk. Now open Xcode application bundle (it should be /Applications) and move iPhoneSimulator4.2.sdk to /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs. Now you may delete the temporary folder.

Restart Xcode and if your project supports 4.2 (i.e. it has Deployment Target lower or equal to iOS 4.2) you may run it on iOS Simulator 4.2.

Credits:

  1. http://stackoverflow.com/questions/9342701/xcode-4-3-and-iphone-simulator-4-2
  2. http://apple.stackexchange.com/questions/31412/how-can-i-install-iphone-simulator-4-2-on-xcode-4-2

RIP Dennis Ritchie


I have just happened to know about Dennis Ritchie's death. He was scientist and programmer. His work was the basis for the modern informational technologies world. IPhones and Androids, Mac OS X and Windows — this is a far incomplete list of things he contributed either directly or indirectly. Though he died on October 9th news of his death passed by me until today. It was drowned in a stream of sorrow for another deceased IT person Steve Jobs. I feel this is deeply unfair. The world has chosen to send their grief to pompous businessman who earned his billions on the work of modest scientists like Ritchie was. I choose to grieve about the former. Rest in piece, mister Dennis Ritchie.

How to disassemble Logitech Deluxe 250

logitech_deluxe_250_disassemble_hint
In case you need to disassemble Logitech Deluxe 250 PS/2 keyboard for some reason, that's what you need to know (same applies to 350 model and probably some other vintage Logitech keyboards). Besides the large number of screws on the back, which are pretty simple to find and untwist, there are another 4 of them. Two screws are located under the small rubber legs on the back. You need to remove them legs accurately and, yes, you will need to use glue to put them back. Two more screws are located under the keyboard buttons: one is somewhere around the Caps Lock and another one is under the Numpad «+» key. To remove the button, simply put the screwdriver under one and gently press until button is unhooked from the board.

I have published this simple hint like year ago in the Russian part of my blog and still I see a lot of people finding it useful. Let's see whether it helps someone outside RUnet :)

Bash-fu. Amount of virtual memory allocated by the process

I was needed a way to get amount of virtual memory currently used by the process. Came up with this solution (parsing from ps aux):

MEMORY_USED=`ps aux | awk -v pid="$PID" '{ if ($2 == pid) print $5 }'`

PID is the process identifier.

Home, End, Page Up and Page Down in Terminal.app

Currently I am doing a lot of iPhone development. That`s the reason for using Mac OS X a lot. Just found a fix to annoying Terminal application issue. By default Home, End, Page Up and Page Down are working completely wrong there. It is not that hard to google a fine solution. For instance, I found one here. However, it was not great still, 'cause Home and End still failed under some circumstances. Fixed these with info in someone's suggestion, so it is even works in vim.

So, you just need to go to «Keyboard» tab in app preferences. Find keys in long list there and change values to “send string to terminal:” with these strings:

Home \033[7~
End \033[4~
Page Up \033[5~
Page Down \033[6~

Suddenly, it works.

Geographical News 2012

Euro 2012 logo was revealed recently.

euro2012_logoLooks nice. Agree to Aleksey, it is much better the «Zochi2014dotru».

Also, see a funny presentation video. There is a map shown for couple of seconds with sign in place of Belorussia, which reads «Baltic Sea». Like this:

Continue reading

MySQL C++ Connector Fail

In current project I need to connect to MySQL DB from C++ code. MySQL developers provide different connectors for varios languages, including C++ one. It seemed like a good alternative to libmysqlclient, which was hard for direct usage.

That proved to be a bad idea. Random crashes of the most annoying type: caused by corrupted memory. I spent several hours trying to figure out where the problem was with no success. At this point I started to suspect problems in C++ connector. However, decided that bugs of such kind were unprobable in official library. Because they happen on rather simple test case. I decided to take a break at that point and first complete some essential functionality (deadlines, you know). So I did.

On the second stage of hunting down the bug I armed with hardware watchpoints and memory allocation utilities. More hours of debugging and I was sure about MySQL connector problem. Googling revealed the message on MySQL mailing list. Message poster lurked into the connector sources (that was I was going to do) and found serious memory allocation problems there. If you are interested in details, follow the link above.

So, I had the code harshly rewritten to work with libmysqlclient and was happy, since everything had worked fine.

Conclusion:

  1. Do not use MySQL C++ Connector. That`s a weird poorly maintained project.
  2. Never trust 3rd party code, even if it seems to come from reliable source.

UPD. BTW, there is also mysql++. Had no chance to try out, but looks good.