So… overclocking.

My main system is a Q6600 with 4GB of 400Mhz DDR2 (e.g. 800Mhz). This is slightly overclocked to 2.64Ghz (lit. 2637.7Mhz) and 439.6Mhz for the RAM. It used to be higher but I think I burnt out the ram and this new batch doesn’t seem to like it. I did some benchmarks originally against fallout 3 and to be honest there wasn’t really anything in it, but it was stable so I left it.

Now… graphics. That runs at:

Core : 750Mhz
Memory : 900Mhz

It’s a 4870, a vapor if I remember correctly. So benchmark time, fallout 3 at:

1280×800
4xAA
8xAF
Everything else high.
View Distance and LOD Maxed.
VSync On
HDR On

Hard to say as there is no benchmark but a wander around outside megaton dropped to 45 approaching the front door from the back, most of the time it was a solid 60.

Core : 801Mhz
Memory : 950Mhz

Again hard to say but in the same perimeter walk it sat at 64-65. Although the frame rate plummeted the same amount when pulling around to the front of megaton where there is quite a sizable vista to draw. I’ll try some HL2 benchmarks at silly settings or something at some point.

Posted in Miscellany | Tagged , | Comments Off on So… overclocking.

iPad grouped tableview bug.

I can’t take any credit for the solution, which is from here:

http://stackoverflow.com/questions/2688007/uitableview-backgroundcolor-always-gray-on-ipad

That was annoying as the colour would set fine on the iPhone and the code was identical. It was the final thing that was making the app look a bit shitty, now it just looks mostly shitty, on the ipad.

Posted in Photography | Comments Off on iPad grouped tableview bug.

At last… combining the two approaches worked.

I had a problem originally getting things to work with a split screen view on the iPad. The main reason was due to the fact that I was porting over code and didn’t quite know yet how it would all work with the new sizes. I had massive problems getting the recipe view to work properly in the main display of the split screen controller. Eventually I gave up on trying to do it using interface builder and coding the view by hand using setFrame to place my components in the correct locations.

This worked fine and allowed steady progress at the expense of having the views orientate and resize properly. Now I have the code working I’ve found that cutting out the manual stuff and going back redoing it in interface builder means it works properly all the way. Originally I was just greeted with a black screen. In the future I think I’ll bear this process in mind as it allowed me to continue working to flesh out the iPad version and then, eventually, to quickly go back and do it properly in IB.

Posted in Programming | Comments Off on At last… combining the two approaches worked.

Delicious Library and Me

I’ve been cataloguing a lot of stuff that I have with a view to selling it. Having got the new mac I checked to see if my code for delicious library still worked, which it did. Since then I’ve realised that what I also need is a searchable index for the ammo box type things full of CD’s. Currently they’re in there with the CD in the front of the slip and the inlays in the back. A lot of these are scanned in already or I’m scanning them in as I go.
Delicious Library has a ‘location’ field which is blank by default and only shows up when you edit an item. I needed to set this for things as I went so I created this small applescript:

-- Menu Title: [3] "Set Location"
-- Menu Keyboard Shortcut: command-l
-- Menu Path: [3]

-- Copy and paste everything into Script Editor (use spotlight to find it).
-- Then save to home/Library/Scripts/Applications/Delicious Library 2
-- You can edit the menu keyboard shortcut to be whatever you want.

tell first document of application "Delicious Library 2"
set selectedItems to selected media
set itemsRef to a reference to selectedItems
repeat with mediaItem in itemsRef
display dialog "Enter location:" default answer "X.X"
set newLocation to text returned of result
set location of mediaItem to newLocation
end repeat
end tell

Which does what I want. After I’ve scanned an item in I can hit apple-l and type in the location. Much much faster.

Posted in Miscellany, Programming | Tagged , | Comments Off on Delicious Library and Me

Updating to the iPad err update.

So all the code is now in place and functionally it should be the same as the iPhone version now, yet I discover that somewhere along the line I broke the code to actually add ingredients. I had to go back to code from August 17th to find working routines. The curse of cut and paste strikes, somewhere along the way of refactoring the code I broke a call from the ingredient view back to the recipe table view which meant that when the updates finished the sanity check that it does failed. It checks, when exiting edit mode, that the number of rows in a section matches the number of rows before the updates +/- any rows inserted/deleted.

In other news I finished FFXIII yesterday, the worst story of any FF game I’ve played although I never did finish FFIX. That might be slightly unfair, the story may have been brilliant but such was the story telling that it made very very little sense even for FF.

Onto Brutal Legend now, which appears to be like playing an Epic Metal Rock Video which is to say it’s a lot of mindless Fun! Although the reason for playing through all these unfinished games is now moot. I was finishing them to trade them in and stash up the points on a game gift card. However I’ve discovered I can only spend them in store and thus can’t use them against my online Kinect pre-order. Ho hum.

Posted in Miscellany | Comments Off on Updating to the iPad err update.

I’m still here. A smorgasbord of stuff.

It’s been a while since I posted anything so this is a bit of a mish mash update.

The holiday in Madeira was excellent. In particular the Monte Palace gardens which included an excellent exhibition of minerals, I bought the book and one on madeiran cooking too. Although the latter was bought at the airport as it was rather too expensive elsewhere. The minerals book is pricey but has excellent photos and can’t be found anywhere else. Check the binding of it though as the first one I got was degraded. They swapped it and apologised profusely though with no hassles. Photos are up on flickr. I might post really heavily edited highlights sometime.

Rewriting my code for the iPad has taken a bit longer. Mostly due to design decisions I made when coding it for the iPhone. Particularly the parsing of messages between objects, changing the way views are presented (image pickets etc), and realising where NSNotificationCenter would be more appropriate than delegate protocols. Progress is steady now though.

Laughs in the Park was excellent with Eddie, Dylan Moran and Reginald D Hunter. Took my dad along to it and a great time was had. All were funny with Eddie seeming to relish the telling of his roman material amongst roman ruins and Dylan Moran just being on fire. Hunter made some excellent observations/jokes too. All in all wonderful stuff. A friend of mine even bought out some VIP passes which was a pleasant change from the rather cold field during the breaks.

Flew up to Aberdeen on Sunday to help a mate with the rather horrible task of sorting out her fathers house since his passing in February. Driving back south tomorrow. Looong drive time.

Also just watched the girl with the dragon tattoo. Excellent adaptation of the book, although it shied away from blomqvists promiscuity a bit which I feel is important in lending the relationship with slander more depth.

Posted in Miscellany | Tagged , , , , | Comments Off on I’m still here. A smorgasbord of stuff.

Following on from dynamic clocks.

It would also be nice to draw multiple clocks if one is ‘full’ it starts another. This example draws and returns a maximum of three clocks but always returns a 90×30 image:


- (UIImage *)drawClocks:(NSNumber *)time {
	UIImage *image;
	int clock1=0, clock2=0, clock3=0;
	CGRect rect = CGRectMake(0,0,90,30);
	UIGraphicsBeginImageContext(rect.size);
	CGContextRef context = UIGraphicsGetCurrentContext();
	
	// We wish to draw clocks right to left according to how many minutes we have, max of 180m.
	int era = [time intValue];
	if(era>59) {
		clock1 = 60;
	}
	else {
		clock1 = era;
	}
	if (era>119) {
		clock2 = 60;
	} else {
		clock2 = era>60?era%60:0;
	}
	if (era>179) {
		clock3 = 60;
	} else {
		clock3 = era>120?era%60:0;
	}

	if (clock1) {
		UIImage *image1 = [self drawTime:[NSNumber numberWithInt:clock1]];
		CGContextDrawImage(context, CGRectMake(0, 0, 30, 30), [image1 CGImage]);
	}
	if (clock2) {
		UIImage *image2 = [self drawTime:[NSNumber numberWithInt:clock2]];
		CGContextDrawImage(context, CGRectMake(30, 0, 30, 30), [image2 CGImage]);
	}
	if (clock3) {
		UIImage *image3 = [self drawTime:[NSNumber numberWithInt:clock3]];
		CGContextDrawImage(context, CGRectMake(60, 0, 30, 30), [image3 CGImage]);
	}
	
	image = UIGraphicsGetImageFromCurrentImageContext();

	UIGraphicsEndImageContext();
	
	return image;
}

Also the <A HREF="http://www.thelostsouls.org More Help.uk/2010/08/drawing-little-clock-icons-dynamically”>last post mentioned that the eventual UI view would need to do the rotate. If this is added straight after the context is obtained:


	// Save our current state (effectively inverted y for iOS)
	CGContextSaveGState(context);
	// Move image UP
	CGContextTranslateCTM(context, 0, 30);
	// Flip Y Axis
	CGContextScaleCTM(context, 1.0, -1.0);
	// Rotate 90 degrees
	CGContextRotateCTM(context, -M_PI/2);
	// Move it Back down so it's in our frame again.
	CGContextTranslateCTM(context, -30, 0);

	// It really helps if you're stuck to draw your image on a bit of paper and flip/rotate it visually.
	// E.g. I draw my 45 minute clock on a bit of paper with 0 marked on the east then tried rotations/flips
	// to get the view I wanted.  then wrote them out above!

You don’t need to include my last comment… then add this before you get the image:

	// Restore original context.
	CGContextRestoreGState(context);

No more rotation is needed. It’s left as an exercise to whomever as to why the translations above produce the correct orientation. I really did draw it on a little square of paper. 😛

Posted in Programming | Tagged , , , , , , | Comments Off on Following on from dynamic clocks.

Drawing little clock icons dynamically.

It’s kind of nice to be able to dynamically draw little ‘clock’ time icons. This function returns a UIImage of 30×30 pixels containing such an image:

static inline float radians(double degrees) { return (degrees * M_PI) / 180; }

- (UIImage *)drawTime:(NSNumber *)time {
	UIImage *image;
	CGRect rect = CGRectMake(0,0,30,30);
	UIGraphicsBeginImageContext(rect.size);
	CGContextRef context = UIGraphicsGetCurrentContext();
	// Calculate end angle in radians according to time..... e.g. 60mins == 360o == 360*M_PI/180
	CGFloat endAngle = radians((360/60)*[time doubleValue]);
		
	// Set colors
	CGContextSetStrokeColorWithColor(context, [[UIColor blackColor] CGColor]);
	CGContextSetFillColorWithColor(context, [[UIColor grayColor] CGColor]);
	// Set Pen width.
	CGContextSetLineWidth(context, 1);

	// Draw outer circle
	CGContextStrokeEllipseInRect(context, CGRectMake(1, 1, 28, 28));
	
	// Set rect to top left of where we want next circle
	CGContextStrokeEllipseInRect(context, CGRectMake(4, 4, 22, 22));
	
	// Draw segment as grey
	CGContextMoveToPoint(context, 15.0f, 15.0f);
	CGContextBeginPath(context);
	// Draw radius out so we end up with a segment drawn and NOT a chord
	CGContextAddLineToPoint(context, 15, 5);
	// Draw arc, note documentation states final argument is 1 for Clockwise and 0 for CCW.
	// However, iOS inverts the Y axis so 0 for CCW becomes CW.  OF COURSE!
	CGContextAddArc(context, 15, 15, 10, 0, endAngle, 0);
	// Add line back to middle
	CGContextAddLineToPoint(context, 15, 15);
	CGContextClosePath(context);
	CGContextFillPath(context);
		
	// Gimme ma image.
	image = UIGraphicsGetImageFromCurrentImageContext();

	/* Due more core graphics weirdness note from the documentation that:
	 startAngle
	 The angle to the starting point of the arc, measured in radians from the positive x-axis.
	 
	   Thus the resulting image will need a -90o transformation to look like a clock.  E.g. 0 is North
	 
	   Simple way is to apply an affine rotation transformation to the view as it will rotate from the centre point.
	   The CG Rotate will perform from the origin so you would need to translate, rotate, translate seeing as 
	   The CG instance has it's Y axis inversed.  What crack smoking @!$% came up with this co-ordinate
	   system?  This isn't 3D graphics people.  It's 2D  stick to one co ordinate system not 2!
	 */
	// Close context
	UIGraphicsEndImageContext();
	
	return image;
}

Input value must be between 0 and 60 minutes. Also the result image will need a 90degree CCW transform applied, due to co-ordinate changes between Core Graphics and main iOS you may find, depending on where one applies it, that it becomes a 90 degree CW rotation. Ho hum. For values over 60 minutes I would recommend a helper function to draw several clocks alongside one another and return that resulting image.

UPDATE:
This entry continues this tale…

Posted in Programming | Tagged , , , , , , | 1 Comment

Gym part 2 of x.

So first visit this week. Went three time last week, once with Martin. Good to exercise with company and not as pain inducing as a trainer. Still not hitting 8 mins for 2km rowing but we’re getting there. Cardio is def improving and flexibility is gradual I hope.

2km 9m6s rowing
10mins cycling.
Various bicep, tricep and pec weights between 20 and 6 kgs.
Stretching exercises, the nice bit.

Posted in Exercise | Tagged , | Comments Off on Gym part 2 of x.

A view of a dying way of Fen life.

Nice audio slideshow.

The Eel Man of the Fens

Posted in Miscellany | Tagged , , | Comments Off on A view of a dying way of Fen life.