Simulate memory warnings on the iPhone

When debugging on the simulator you can simulate a memory warning in your code by using the Simulate Memory Warning option in the Hardware menu. But on the device it isn’t so easy, but it’s really important to have thoroughly tested your application in the presence of memory warnings.

What I do is add some code to my App Delegate to periodically send a memory warning automatically. Usually every 5 seconds, or quicker.

- (BOOL)application:(UIApplication *)pApplication didFinishLaunchingWithOptions:(NSDictionary *)pLaunchOptions {
...
    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(simulateMemoryWarning) userInfo:nil repeats:YES];
...
}

- (void)simulateMemoryWarning {
    [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification object:[UIApplication sharedApplication] userInfo:nil];
}

I suggest surrounding the timer scheduling with an #if DEBUG or similar (assuming you have DEBUG=1 configured in your debug builds) so you don’t accidentally leave this in for a release build!

This was posted 1 year ago. It has 0 notes.

Warnings for API calls that won’t work in iOS 3

When you build for iOS 4 you don’t get warnings for API calls that don’t exist in iOS 3 so it can be hard to see when it’s going to crash.

In order to get warnings for that usage you can edit /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/AvailabilityInternal.h, you have to update that URL for the appropriate SDK version, and this is only for the simulator.

First change the ownership or write permissions so you can edit it. Then edit the file.

Find this line:

#define __AVAILABILITY_INTERNAL_WEAK_IMPORT        __attribute__((weak_import))

and change it to:

#define __AVAILABILITY_INTERNAL_WEAK_IMPORT        __attribute__((weak_import,deprecated))

When you compile you’ll now get deprecation warnings for all API usage that won’t work in iOS 3.

This was posted 1 year ago. It has 0 notes.

Chicken Palomino

My oldest and only recipe. First devised 11th December 2002.

Ingredients

  • Chicken thighs
  • 2 onions
  • 3 bay leaves
  • 3 cloves
  • 2 star anise
  • 3 green cardamons
  • 1 cinnamon stick
  • Tumeric
  • Coriander
  • Red wine
  • Kalamata olives
  • Red chilli
  • Tin of whole peeled tomotoes
  • 6 mushrooms
  • Sea salt
  • Basmati rice

Method

Defrost chicken thighs.

Fry 2 onions in olive oil. Add 3 bay leaves, 3 cloves, 2 star anise, 3 green cardamons, 1 cinnamon stick. Fry for 5 minutes.

Add 3/4 tsp tumeric, 1 tsp coriander. Fry until golden brown.

Add red wine so it’s not too dry. Add 13 pipped kalamata olives.

Cut chicken thighs into 0.75cm slices and add. Add 1 tsp red chilli.

Stir quite a bit. Consider preparing the rice. Add a little more red wine.

Add 1 tin of whole peeled tomatoes.

Add 6 sliced mushrooms.

Put on the rice - best cooked with 1/2 tsp of tumeric.

Put a lid on and cook on medium for 10 minutes. Add 2 tsp sea salt.

Remove the lid, stir, and leave cooking with the lid off to boil off liquid to taste.

This was posted 1 year ago. It has 0 notes.

iMovie won’t start and uses 100% CPU

After using the Migration Assistant to move onto my new Mac my iMovie wouldn’t start. Clicking the icon made it bounce then it would stop and appear to not be running, but was actually running and consuming 100% CPU. To fix I removed Perian, ran iMovie, then reinstalled Perian - something must have become busted up in the migration. I’ve also read reports of other people having problems with other Quicktime plugins - so investigate removing them if you have problems. Remember there is /Library/QuickTime and ~/Library/QuickTime/ to look in.

This was posted 1 year ago. It has 0 notes.

Installing Dimdim on Debian Lenny

I found these instructions for installing DimDim on Debian Lenny. They’re pretty good: http://niteshrijal.com.np/installing-dimdim-in-debian-lenny-stable/

However, there appear to be existing packages for some of the Python modules that are installed from source, so perhaps try those first. Also when setting permissions, look out for the commands to set permissions on your /usr/bin and /usr/lib and /usr/local/share directories; those are a bit wide-reaching for me! When installing swftools I suggest putting them into the /usr/local hierarchy rather than /usr. Make sure you have the psmisc package installed to get killall, which is used by StopDimdim.sh

This was posted 1 year ago. It has 0 notes.

Slow networking to host computer from Debian in Microsoft Virtual PC

After installing Debian Lenny in Microsoft Virtual PC I tried to copy files from my Windows desktop to the virtual PC by SCP/SFTP and by mounting the drive using Samba. The copy speeds were very slow and errors showed up on eth0 when running ifconfig.

This appears to be a problem when sharing the network adapter between the virtual machine and real machine. Accessing network resources on a different machine are not slow.

I couldn’t get any other network adapter configuration (in the virtual machine settings) to work, maybe because of firewalling on Windows 7.

This was posted 1 year ago. It has 0 notes.

Installing Debian Lenny on Windows Virtual PC

Create a new Virtual Machine, put the Debian Lenny CD in the drive, boot the machine. It should boot from the CD. At the Install prompt press TAB to edit the Install command.

Just before the vga= argument add a noreplace-paravirt argument, then change vga=normal to vga=791. Then press Enter to boot.

I got these instructions from http://wiki.debian.org/MicrosoftVirtualPc2007/lenny

You’ll need to make the same change to the grub configuration / launch string after installation. Press ‘e’ to edit the boot command, edit the kernel boot and add those options, then press ‘b’ to boot. That will get you to the first boot, then edit /boot/grub/menu.lst and add those options to the kopt= line, remember you don’t have to uncomment that line! Then run update-grub to update grub and reboot to check your work.

This was posted 1 year ago. It has 0 notes.
dvint1:

OMG! Just saw my app appear in the latest Apple iPhone ad. woot!!

dvint1:

OMG! Just saw my app appear in the latest Apple iPhone ad. woot!!

This was posted 2 years ago. It has 0 notes. .
sneak:

Those guys.

The fun never ends when you’re cuddling a friend.

sneak:

Those guys.

The fun never ends when you’re cuddling a friend.

This was posted 2 years ago. It has 0 notes. .

Charles v3.5.1 released

Happy New Year everyone! A small bug fix release for Charles, tidying up two bugs that were discovered in the 3.5 release. These include a fault in the Repeat Advanced tool, where it would fail after a number of requests, and a fault in the Auto Save tool where it wouldn’t save the “Enable on startup” setting. Download Charles 3.5.1

This was posted 2 years ago. It has 6 notes.