<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>devedup.com</title>
	<atom:link href="http://blog.devedup.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.devedup.com</link>
	<description>... about Software Development and stuff ...</description>
	<lastBuildDate>Wed, 21 Jul 2010 08:39:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone: UITextView with rounded edges (to look like a UITextField)</title>
		<link>http://blog.devedup.com/index.php/2010/06/06/iphone-uitextview-with-rounded-edges-to-look-like-a-uitextfield/</link>
		<comments>http://blog.devedup.com/index.php/2010/06/06/iphone-uitextview-with-rounded-edges-to-look-like-a-uitextfield/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 19:31:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[rounded uitextview]]></category>
		<category><![CDATA[uitextfield]]></category>
		<category><![CDATA[uitextview]]></category>
		<category><![CDATA[uitextview border]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=226</guid>
		<description><![CDATA[UITextView has square edges, and looks ugly compared to a UITextField!

Unfortunately, there isn&#8217;t an option to give the UITextView a nice border. There are various ways to do this, such as creating your own background image for the UITextView, but I have found a relatively easy way to do it &#8211; and one that anyone [...]]]></description>
			<content:encoded><![CDATA[<p>UITextView has square edges, and looks ugly compared to a UITextField!</p>
<p><img src="http://blog.devedup.com/wp-content/uploads/2010/06/Screen-shot-2010-06-06-at-20.22.29-161x300.png" alt="Screen shot 2010-06-06 at 20.22.29" title="Screen shot 2010-06-06 at 20.22.29" width="161" height="300" class="aligncenter size-medium wp-image-231" /></p>
<p>Unfortunately, there isn&#8217;t an option to give the UITextView a nice border. There are various ways to do this, such as creating your own background image for the UITextView, but I have found a relatively easy way to do it &#8211; and one that anyone without photoshop skills can achieve. </p>
<p>I achieve it by placing a UITextField behind the UITextView. However, in InterfaceBuilder you can&#8217;t change the height of a UITextField, so you have to edit the .xib file in Text Edit to change its height.</p>
<p>Here are the steps you need to do:<br />
<b></p>
<ol>
<li>Add a UITextField to your View and put a UITextView on top of it. </li>
<li>Decide on how high you want your UITextView and resize it.</li>
<li>Give the UITextField a tag of 999 (or whatever you want) (hit CMD-1 to bring up the attributes inspector to do this).</li>
<li>Save the .xib file and then right click the file > Open With > Other > TextEdit</li>
<li>Search for your tag, 999, and in the same <object> section of the xml you will see something like: <string key="NSFrame">{{25, 199}, {275, 31}}</string> (see below)</li>
<li>You need to change 31 to the same height as your UITextView and then save the .xib file in TextEdit</li>
<li>When you return to IB it will tell you the document has been modified, click Revert</li>
<li>You should now see a tall UITextField behind your UITextView. Make sure your UITextView has a transparent background!</li>
</ol>
<p></b></p>
<pre class="brush: xml;">
&lt;object class=&quot;IBUITextField&quot; id=&quot;154341485&quot;&gt;
	&lt;reference key=&quot;NSNextResponder&quot; ref=&quot;774585933&quot;/&gt;
	&lt;int key=&quot;NSvFlags&quot;&gt;292&lt;/int&gt;
	&lt;string key=&quot;NSFrame&quot;&gt;{{25, 199}, {275, 31}}&lt;/string&gt; THIS IS THE LINE THAT YOU NEED TO EDIT.... CHANGE 31 TO THE HEIGHT OF YOUR UITEXTVIEW
	&lt;reference key=&quot;NSSuperview&quot; ref=&quot;774585933&quot;/&gt;
	&lt;reference key=&quot;IBUIBackgroundColor&quot; ref=&quot;157267157&quot;/&gt;
	&lt;bool key=&quot;IBUIOpaque&quot;&gt;NO&lt;/bool&gt;
	&lt;bool key=&quot;IBUIClearsContextBeforeDrawing&quot;&gt;NO&lt;/bool&gt;
	&lt;int key=&quot;IBUITag&quot;&gt;999&lt;/int&gt;THIS IS THE TAG YOU CHOSE TO HELP YOU FIND THIS SECTION IN THE XIB FILE
</pre>
<p>Here is my project if you need help seeing how I did it.</p>
<p><a href="http://blog.devedup.com/wp-content/uploads/2010/06/RoundedUITextView.zip"><img src="http://blog.devedup.com/wp-content/uploads/2010/03/xcodeProject.png" alt="xcodeProject" title="xcodeProject" width="70" height="59" class="aligncenter size-full wp-image-218" /></a></p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2010/06/06/iphone-uitextview-with-rounded-edges-to-look-like-a-uitextfield/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhone: Maintain visibility of form inputs &#8211; auto-scrolling views</title>
		<link>http://blog.devedup.com/index.php/2010/03/25/iphone-maintain-visibility-of-form-inputs-auto-scrolling-views/</link>
		<comments>http://blog.devedup.com/index.php/2010/03/25/iphone-maintain-visibility-of-form-inputs-auto-scrolling-views/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 20:57:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[form visibility]]></category>
		<category><![CDATA[inputs hidden]]></category>
		<category><![CDATA[keyboard hiding view]]></category>
		<category><![CDATA[scrolling view]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=198</guid>
		<description><![CDATA[When you develop forms or any screens with input fields, occasionally the inputs will be obscured by the keyboard when it appears. This is bad usability for the user who now has to input data without being able to see what they have typed! One solution is to slide the whole view so that the [...]]]></description>
			<content:encoded><![CDATA[<p>When you develop forms or any screens with input fields, occasionally the inputs will be obscured by the keyboard when it appears. This is bad usability for the user who now has to input data without being able to see what they have typed! One solution is to slide the whole view so that the field being edited is always visible.</p>
<p><img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-20.21.31-163x300.png" alt="Screen shot 2010-03-25 at 20.21.31" title="Screen shot 2010-03-25 at 20.21.31" width="163" height="300" class="aligncenter size-medium wp-image-201" /><img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-20.21.41-158x300.png" alt="Screen shot 2010-03-25 at 20.21.41" title="Screen shot 2010-03-25 at 20.21.41" width="158" height="300" class="aligncenter size-medium wp-image-202" /><img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-25-at-20.32.47-157x300.png" alt="Screen shot 2010-03-25 at 20.32.47" title="Screen shot 2010-03-25 at 20.32.47" width="157" height="300" class="aligncenter size-medium wp-image-203" /></p>
<p>This solution I provide adds a few methods to UIView (yes i know, adding categories to cocoa classes is naughty) &#8211; which will determine how much to slide the view based on the inputs position on the whole screen, and then slide the view at the same speed as the keyboard slide entry. It then will slide back to where it was when you are finished editing.</p>
<p>It is pretty simple to do this &#8211; here is how I calculate where to scroll the view:</p>
<pre class="brush: objc;">
- (void) maintainVisibityOfControl:(UIControl *)control offset:(float)offset {
	static const float deviceHeight = 480;
	static const float keyboardHeight = 216;
	static const float gap = 5; //gap between the top of keyboard and the control

	//Find the controls absolute position in the 320*480 window - it could be nested in other views
	CGPoint absolute = [control.superview convertPoint:control.frame.origin toView:nil];

	//If it would be hidden behind the keyboard....
	if (absolute.y &gt; (keyboardHeight + gap)) {
		//Shift the view
		float shiftBy = (deviceHeight - absolute.y) - (deviceHeight - keyboardHeight - gap - offset);
		[UIView beginAnimations:nil context:nil];
		[UIView setAnimationDuration:0.3f]; //this is speed of keyboard
		CGAffineTransform slideTransform = CGAffineTransformMakeTranslation(0.0, shiftBy);
		self.transform = slideTransform;
		[UIView commitAnimations];
	}
}
</pre>
<p>..and then I reset the view afterwards using:</p>
<pre class="brush: objc;">
- (void) resetViewToIdentityTransform {
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.3f]; //this is speed of keyboard
	CGAffineTransform slideTransform = CGAffineTransformIdentity;
	self.transform = slideTransform;
	[UIView commitAnimations];
}
</pre>
<p>You only need to make minimal changes to your own code, and call these methods from your UITextFieldDelegate methods (or other control delegates):</p>
<pre class="brush: objc;">
- (void) textFieldDidBeginEditing:(UITextField *)textField {
	[self.view maintainVisibityOfControl:textField offset:0.0f];
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
	if (textField == currentControl) {
		//If the textfield is still the same one, we can reset the view animated
		[self.view resetViewToIdentityTransform];
	}else {
		//However, if the currentControl has changed - that indicates the user has
		//gone into another control - so don't reset view, otherwise animations jump around
	}
}
</pre>
<p>Here is a copy of the XCode project:<br />
<a href="http://blog.devedup.com/wp-content/uploads/2010/03/FormScroll.zip"><img src="http://blog.devedup.com/wp-content/uploads/2010/03/xcodeProject.png" alt="xcodeProject" title="xcodeProject" width="70" height="59" class="aligncenter size-full wp-image-218" /></a></p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2010/03/25/iphone-maintain-visibility-of-form-inputs-auto-scrolling-views/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhone: Number Pad with a decimal point (OS 3.0, OS 4.0) using public API</title>
		<link>http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/</link>
		<comments>http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:05:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[iphone keyboard]]></category>
		<category><![CDATA[legal]]></category>
		<category><![CDATA[number pad]]></category>
		<category><![CDATA[number pad decimal point]]></category>
		<category><![CDATA[OS 4.0]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=187</guid>
		<description><![CDATA[Of the various keyboards you can choose when developing iPhone apps, the number pad doesn&#8217;t come with a decimal point. There is a blank button in the bottom left corner that doesn&#8217;t do anything, so I&#8217;m going to show you how to put a decimal point button there to look like this:
 
There are a [...]]]></description>
			<content:encoded><![CDATA[<p>Of the various keyboards you can choose when developing iPhone apps, the number pad doesn&#8217;t come with a decimal point. There is a blank button in the bottom left corner that doesn&#8217;t do anything, so I&#8217;m going to show you how to put a decimal point button there to look like this:<br />
<img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-13-at-17.40.13-161x300.png" alt="Screen shot 2010-03-13 at 17.40.13" title="Screen shot 2010-03-13 at 17.40.13" width="161" height="300" class="aligncenter size-medium wp-image-185" /> <img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-13-at-17.40.19-161x300.png" alt="Screen shot 2010-03-13 at 17.40.19" title="Screen shot 2010-03-13 at 17.40.19" width="161" height="300" class="aligncenter size-medium wp-image-186" /></p>
<p>There are a few other tutorial around that show you how to do this, but i believe mine is better&#8230;.because the code is simpler to use, its more flexible, and the UI colors and button states are perfectly matched to the rest of the keyboard (unlike some of the other tutorials) The code you use to implement this will look like this:</p>
<pre class="brush: objc;">
@interface DecimalPointNumberPadViewController : UIViewController &lt;UITextFieldDelegate&gt; {
	NumberKeypadDecimalPoint *numberKeyPad;
}
@end

@implementation DecimalPointNumberPadViewController
- (void) textFieldDidBeginEditing:(UITextField *)textField {
	numberKeyPad = [[NumberKeypadDecimalPoint keypadForTextField:textField] retain];
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
	[numberKeyPad release];
}
@end
</pre>
<ul>
<li> it works on any number of UITextFields that are displayed on your view controller.</li>
<li>It will only add one decimal point per text field.</li>
</ul>
<p>To achieve this, here are the basic steps of what i do:</p>
<ol>
<li>Create a custom UIButton with clear background and dark grey text.</li>
<li>For the highlighted state i change the background image of the button and the text color to be white</li>
<li>I find the UIKeyboard in the application window and add the custom button at the required location</li>
<li>I add a delegate to the button to listen for click events and pass the event to a handler which adds a decimal point to the current UITextField</li>
</ol>
<p><b>Update 5th June 2010: OS4 compatible and using only public API</b></p>
<p>As using private API&#8217;s is against the SDK agreement, I&#8217;ve updated the code to remove references to any private API. It is also now compatible with OS 4.0.</p>
<p><b>Update 20th July 2010: This code was part of the app I&#8217;m working on and was accepted by apple. </b></p>
<p>A copy of my XCode project is here:</p>
<p><a href='http://blog.devedup.com/wp-content/uploads/2010/06/DecimalPointNumberPad-v4.zip'><img src="http://blog.devedup.com/wp-content/uploads/2010/03/xcodeProject.png" alt="xcodeProject" title="xcodeProject" width="70" height="59" class="aligncenter size-full wp-image-218" />DecimalPointNumberPad-v4</a></p>
<p>Thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>iPhone: Animate an object along a path</title>
		<link>http://blog.devedup.com/index.php/2010/03/03/iphone-animate-an-object-along-a-path/</link>
		<comments>http://blog.devedup.com/index.php/2010/03/03/iphone-animate-an-object-along-a-path/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 21:39:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA["animate along a path"]]></category>
		<category><![CDATA["animation path"]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CAKeyframeAnimation]]></category>
		<category><![CDATA[UIGraphicsBeginImageContext]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=166</guid>
		<description><![CDATA[Here i will show you how to animate an object along a path on a UIView. I will create the path and draw it onto the UIView so that you can see it, and then use the same path for the animation.
I&#8217;m doing all of this within a UIView that i have added to my [...]]]></description>
			<content:encoded><![CDATA[<p>Here i will show you how to animate an object along a path on a UIView. I will create the path and draw it onto the UIView so that you can see it, and then use the same path for the animation.</p>
<p>I&#8217;m doing all of this within a UIView that i have added to my screen&#8230; </p>
<p><img src="http://blog.devedup.com/wp-content/uploads/2010/03/Screen-shot-2010-03-03-at-21.40.45-161x300.png" alt="Animate along a path" title="Animate along a path" width="161" height="300" class="aligncenter size-medium wp-image-171" /></p>
<p>Firstly, we will draw a curved line on the screen&#8230;.</p>
<pre class="brush: objc;">
//This draws a quadratic bezier curved line right across the screen
- ( void ) drawACurvedLine {
	//Create a bitmap graphics context, you will later get a UIImage from this
	UIGraphicsBeginImageContext(CGSizeMake(320,460));
	CGContextRef ctx = UIGraphicsGetCurrentContext();

	//Set variables in the context for drawing
	CGContextSetLineWidth(ctx, 1.5);
	CGContextSetStrokeColorWithColor(ctx, [UIColor whiteColor].CGColor);

	//Set the start point of your drawing
	CGContextMoveToPoint(ctx, 10, 10);
	//The end point of the line is 310,450 .... i'm also setting a reference point of 10,450
	//A quadratic bezier curve is drawn using these coordinates - experiment and see the results.
	CGContextAddQuadCurveToPoint(ctx, 10, 450, 310, 450);
	//Add another curve, the opposite of the above - finishing back where we started
	CGContextAddQuadCurveToPoint(ctx, 310, 10, 10, 10);

	//Draw the line
	CGContextDrawPath(ctx, kCGPathStroke);

	//Get a UIImage from the current bitmap context we created at the start and then end the image context
	UIImage *curve = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();

	//With the image, we need a UIImageView
	UIImageView *curveView = [[UIImageView alloc] initWithImage:curve];
	//Set the frame of the view - which is used to position it when we add it to our current UIView
	curveView.frame = CGRectMake(1, 1, 320, 460);
	curveView.backgroundColor = [UIColor clearColor];
	[self addSubview:curveView];
}
</pre>
<p>Now we will create a keyframe animation, and a path that is the same as the line we just drew. We will also draw a circle, and animate it along that path:</p>
<pre class="brush: objc;">
- (void) animateCicleAlongPath {
	//Prepare the animation - we use keyframe animation for animations of this complexity
	CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@&quot;position&quot;];
	//Set some variables on the animation
	pathAnimation.calculationMode = kCAAnimationPaced;
	//We want the animation to persist - not so important in this case - but kept for clarity
	//If we animated something from left to right - and we wanted it to stay in the new position,
	//then we would need these parameters
	pathAnimation.fillMode = kCAFillModeForwards;
	pathAnimation.removedOnCompletion = NO;
	pathAnimation.duration = 5.0;
	//Lets loop continuously for the demonstration
	pathAnimation.repeatCount = 1000;

	//Setup the path for the animation - this is very similar as the code the draw the line
	//instead of drawing to the graphics context, instead we draw lines on a CGPathRef
	CGPoint endPoint = CGPointMake(310, 450);
	CGMutablePathRef curvedPath = CGPathCreateMutable();
	CGPathMoveToPoint(curvedPath, NULL, 10, 10);
	CGPathAddQuadCurveToPoint(curvedPath, NULL, 10, 450, 310, 450);
	CGPathAddQuadCurveToPoint(curvedPath, NULL, 310, 10, 10, 10);

	//Now we have the path, we tell the animation we want to use this path - then we release the path
	pathAnimation.path = curvedPath;
	CGPathRelease(curvedPath);

	//We will now draw a circle at the start of the path which we will animate to follow the path
	//We use the same technique as before to draw to a bitmap context and then eventually create
	//a UIImageView which we add to our view
	UIGraphicsBeginImageContext(CGSizeMake(20,20));
	CGContextRef ctx = UIGraphicsGetCurrentContext();
	//Set context variables
	CGContextSetLineWidth(ctx, 1.5);
	CGContextSetFillColorWithColor(ctx, [UIColor greenColor].CGColor);
	CGContextSetStrokeColorWithColor(ctx, [UIColor whiteColor].CGColor);
	//Draw a circle - and paint it with a different outline (white) and fill color (green)
	CGContextAddEllipseInRect(ctx, CGRectMake(1, 1, 18, 18));
	CGContextDrawPath(ctx, kCGPathFillStroke);
	UIImage *circle = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();

	UIImageView *circleView = [[UIImageView alloc] initWithImage:circle];
	circleView.frame = CGRectMake(1, 1, 20, 20);
	[self addSubview:circleView];

	//Add the animation to the circleView - once you add the animation to the layer, the animation starts
	[circleView.layer addAnimation:pathAnimation forKey:@&quot;moveTheSquare&quot;];
}
</pre>
<p>To get all this running, you can use this init method:</p>
<pre class="brush: objc;">
- (id)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		[self drawACurvedLine];
		[self animateCicleAlongPath];
    }
    return self;
}
</pre>
<p>and use something like this in your ViewController&#8230;.</p>
<pre class="brush: objc;">
- (void)viewDidLoad {
	UIView *customView = [[Canvas alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
	customView.backgroundColor = [UIColor blackColor];
	[self.view addSubview:customView];
	[customView release];
    [super viewDidLoad];
}
</pre>
<p>Also&#8230;don&#8217;t forget to add your Quartz import:</p>
<pre class="brush: objc;">
#import &lt;QuartzCore/QuartzCore.h&gt;
</pre>
<p>I&#8217;m sure there are lots of better ways of doing this, such as using CALayers and adding CGImage to the layers. But that&#8217;s something I haven&#8217;t tried yet. The example above should be enough to get you started with animation along a path.</p>
<p>Here is a copy of the XCode project:<br />
<a href="http://blog.devedup.com/wp-content/uploads/2010/06/AnimateAlongAPath.zip"><img src="http://blog.devedup.com/wp-content/uploads/2010/03/xcodeProject.png" alt="xcodeProject" title="xcodeProject" width="70" height="59" class="aligncenter size-full wp-image-218" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2010/03/03/iphone-animate-an-object-along-a-path/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhone: This class is not key value coding-compliant for the key &#8230;..</title>
		<link>http://blog.devedup.com/index.php/2009/11/16/this-class-is-not-key-value-coding-compliant-for-the-key/</link>
		<comments>http://blog.devedup.com/index.php/2009/11/16/this-class-is-not-key-value-coding-compliant-for-the-key/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 21:34:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[iphone development]]></category>
		<category><![CDATA[key value coding-compliant]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=153</guid>
		<description><![CDATA[Doing some iPhone development and this error really caught me out for a while:
2009-11-16 21:02:48.387 Pickers[3779:207] *** Terminating app due to uncaught
exception 'NSUnknownKeyException', reason: '[&#60;UIViewController 0x381d740&#62;
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key datePicker.'
2009-11-16 21:02:48.388 Pickers[3779:207] Stack: (
It&#8217;s seemed fairly cryptic at the time. I had created a Tab Bar Controller and [...]]]></description>
			<content:encoded><![CDATA[<p>Doing some iPhone development and this error really caught me out for a while:</p>
<pre class="brush: objc;">2009-11-16 21:02:48.387 Pickers[3779:207] *** Terminating app due to uncaught
exception 'NSUnknownKeyException', reason: '[&lt;UIViewController 0x381d740&gt;
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key datePicker.'
2009-11-16 21:02:48.388 Pickers[3779:207] Stack: (</pre>
<p>It&#8217;s seemed fairly cryptic at the time. I had created a Tab Bar Controller and for each tab button, i hadn&#8217;t set its class identity &#8211; so each tab was still declared as a UIViewController instead of the actual Controller class that i had created. </p>
<p>The error comes from the NSKeyValueCoding category which allows you to access properties via setValue: forKey:</p>
<pre class="brush: objc;">
Person *aPerson = [[Person alloc] initWithAge: 53];
aPerson.name = @&quot;Steve&quot;;
// NOTE: dot notation, uses synthesized setter, equivalent to [aPerson setName: @&quot;Steve&quot;];
NSLog(@&quot;Access by message (%@), dot notation(%@),
    property name(%@) and direct instance variable access (%@)&quot;,
      [aPerson name], aPerson.name, [aPerson valueForKey:@&quot;name&quot;], aPerson-&gt;name);
</pre>
<p>So i guess it is just complaining that it can&#8217;t find the generated setter method named setDatePicker &#8211; because datePicker instance is  not  on the generic class.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/11/16/this-class-is-not-key-value-coding-compliant-for-the-key/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wake On LAN and Wake Up Button</title>
		<link>http://blog.devedup.com/index.php/2009/09/24/wake-on-lan-and-wake-up-button/</link>
		<comments>http://blog.devedup.com/index.php/2009/09/24/wake-on-lan-and-wake-up-button/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 18:45:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA["wake on lan"]]></category>
		<category><![CDATA[wol]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=139</guid>
		<description><![CDATA[Wake-on-LAN is an Ethernet computer networking standard that allows a computer to be turned on or woken up by a network message. The message is usually sent by a simple program executed on another computer on the local area network.
BIOS Setup
You first need to enable WOL in your bios. This might be a Wake on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Wake_on_lan">Wake-on-LAN</a> is an Ethernet computer networking standard that allows a computer to be turned on or woken up by a network message. The message is usually sent by a simple program executed on another computer on the local area network.</p>
<h2>BIOS Setup</h2>
<p>You first need to enable WOL in your bios. This might be a Wake on LAN setting under power management, or it might be something like &#8220;Allow power from S5 by PME&#8221;. S5 is a <a href="http://www.intel.com/support/network/sb/CS-008459.htm">power management state</a> and PME is Power Management Event.</p>
<h2>Computer Setup</h2>
<p>You need to make sure you allow your network device to wake up your pc. In windows you can do this through the device manager for your network adapter. If you edit the properties for your network card (Control Panel &gt; Device Manager &gt; Network Adapters &gt; Your Ethernet card &gt; Properties &gt; Power Management) &#8211; you can check a box to &#8216;Allow this device to wake up the computer&#8217; and you can force it only to allow WOL magic packets to wake up the pc.</p>
<h2>Routers</h2>
<p>If your pc is behind a router, then you will need to forward all requests to port 9 to your pc that you want to wake up. Some routers allow you to assign applications to certain devices, and you may see &#8216;Wake On LAN&#8217; as one of the applications.</p>
<h2>Java code to wake up your pc</h2>
<p>Below is some java code that you can use to wake up your pc using wake on lan. You will need to know your IP address and the MAC address of your network card.</p>
<pre class="brush: java;">
package com.devedup.net;

import org.apache.log4j.Logger;

import java.io.*;
import java.net.*;

/**
 * Used for waking up computers
 *
 * @author dave
 * @since 9 Apr 2009 08:00:04
 */
public class WakeOnLAN {

    private final static Logger logger = Logger.getLogger(WakeOnLAN.class);

    public static final int PORT = 9;

    public static void main(String[] args) {

        if (args.length != 2) {
            logger.info(&quot;Usage: java WakeOnLan &lt;broadcast-ip&gt; &lt;mac-address&gt;&quot;);
            logger.info(
                &quot;Example: java WakeOnLan 192.168.0.255 00:0D:61:08:22:4A&quot;);
            logger.info(
                &quot;Example: java WakeOnLan 192.168.0.255 00-0D-61-08-22-4A&quot;);
            System.exit(1);
        }

        String ipStr = args[0];
        String macStr = args[1];

        try {
            wakeup(ipStr, macStr);
        } catch (Exception e) {
            logger.info(&quot;Failed to send Wake-on-LAN packet: + e&quot;);
            System.exit(1);
        }

    }

    /**
     * Send a Wake On LAN magic packet to ip and mac address specifed
     *
     * @param ip
     * @param macAddress
     */
    public static void wakeup(String ip, String macAddress) {
        if (ip == null || ip.length() &lt; 1)
            throw new IllegalArgumentException(
                          &quot;ip address cannot be null or blank&quot;);
        if (macAddress == null || macAddress.length() &lt; 1)
            throw new IllegalArgumentException(
                          &quot;macAddress cannot be null or blank&quot;);

        byte[] macBytes = getMacBytes(macAddress);
        byte[] bytes = new byte[6 + 16 * macBytes.length];
        for (int i = 0; i &lt; 6; i++) {
            bytes[i] = (byte) 0xff;
        }
        for (int i = 6; i &lt; bytes.length; i += macBytes.length) {
            System.arraycopy(macBytes, 0, bytes, i, macBytes.length);
        }

        DatagramSocket socket = null;
        try {
            InetAddress address = InetAddress.getByName(ip);
            DatagramPacket packet =
                new DatagramPacket(bytes, bytes.length, address, PORT);

            if (logger.isInfoEnabled()) {
                logger.info(&quot;Sending datagram (UDP) packet to ip[&quot;
                                   + address + &quot;] on port[&quot; + PORT + &quot;]&quot;);
                logger.info(&quot;Message bytes [&quot; + bytes + &quot;]&quot;);
            }

            socket = new DatagramSocket();
            socket.send(packet);
            logger.info(&quot;Wake-on-LAN packet sent.&quot;);
            return;
        } catch (UnknownHostException e) {
            logger.error(e);
        } catch (SocketException e) {
            logger.error(e);
        } catch (IOException e) {
            logger.error(e);
        } finally {
            if (socket != null &amp;&amp; !socket.isClosed()) {
                socket.close();
            }
        }
    }

    private static byte[] getMacBytes(String macStr)
                                     throws IllegalArgumentException {
        byte[] bytes = new byte[6];
        String[] hex = macStr.split(&quot;(\\:|\\-)&quot;);
        if (hex.length != 6) {
            throw new IllegalArgumentException(&quot;Invalid MAC address.&quot;);
        }
        try {
            for (int i = 0; i &lt; 6; i++) {
                bytes[i] = (byte) Integer.parseInt(hex[i], 16);
            }
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                                &quot;Invalid hex digit in MAC address.&quot;);
        }
        return bytes;
    }

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/09/24/wake-on-lan-and-wake-up-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computer starts and then shuts down before booting &#8211; problem solved</title>
		<link>http://blog.devedup.com/index.php/2009/09/09/computer-starts-and-then-shuts-down-before-booting-problem-solved/</link>
		<comments>http://blog.devedup.com/index.php/2009/09/09/computer-starts-and-then-shuts-down-before-booting-problem-solved/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 11:32:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[boot problems]]></category>
		<category><![CDATA[dust]]></category>
		<category><![CDATA[power supply]]></category>
		<category><![CDATA[startup and shutdown]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=136</guid>
		<description><![CDATA[I switched on my pc and then between 5 and 30 seconds later, before it booted into windows, it would shut down again. It would do this continuously. I disconnected everything from my pc (hard disks, usb devices, all but 1 memory module etc) so I had the bare minimum running. It still happened. So [...]]]></description>
			<content:encoded><![CDATA[<p>I switched on my pc and then between 5 and 30 seconds later, before it booted into windows, it would shut down again. It would do this continuously. I disconnected everything from my pc (hard disks, usb devices, all but 1 memory module etc) so I had the bare minimum running. It still happened. So I narrowed it down to cpu, motherboard or power supply.</p>
<p>Doing a search revealed others with similar problems and the most common problem was power supply failures.</p>
<p>I decided to buy a new power supply and the motherboard and cpu upgrade anyway (mine was 3 yrs old). Swapped cpu and motherboard first and the problem was still there. So definitely the power supply. I swapped that, and the problem was resolved.</p>
<p>I then put the old motherboard and power supply on the bench and ran the system from there. I had the power supply fan side down (yes this is bad) &#8211; and noticed the system shut down a lot quicker. So I had deduced that it could just be an air flow problem with the power supply overheating. I opened up the power supply (they recommend you not to do this, so be careful!) and there was a lot of dust in there. I vacuumed it all out, ran the system again and the problem hasn&#8217;t returned!</p>
<p>So, after all that work (and £250 later) it was dust causing the problem. However, that&#8217;s 3 years of dust. I sent back the new power supply and now have put the old one back in and my system has been fine for weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/09/09/computer-starts-and-then-shuts-down-before-booting-problem-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cisco 64bit windows client and Shrewsoft VPN</title>
		<link>http://blog.devedup.com/index.php/2009/09/09/cisco-64bit-windows-client-and-shrewsoft-vpn/</link>
		<comments>http://blog.devedup.com/index.php/2009/09/09/cisco-64bit-windows-client-and-shrewsoft-vpn/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 10:31:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[shrew soft]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=128</guid>
		<description><![CDATA[Cisco don&#8217;t support a 64 bit client apart from their AnyConnect client, which doesn&#8217;t support IPSec. This is a little annoying for those of us who want to run XP, Vista or Windows 7 in 64 bit.
I&#8217;ve just installed Windows 7 64 bit and I&#8217;ve found a vpn client that is compatible with Cisco! Shrew [...]]]></description>
			<content:encoded><![CDATA[<p>Cisco don&#8217;t support a 64 bit client apart from their AnyConnect client, which doesn&#8217;t support IPSec. This is a little annoying for those of us who want to run XP, Vista or Windows 7 in 64 bit.</p>
<p>I&#8217;ve just installed Windows 7 64 bit and I&#8217;ve found a vpn client that is compatible with Cisco! Shrew Soft Inc <a href="http://www.shrew.net"></a></p>
<p><a href="http://www.shrew.net"><img class="aligncenter" title="shrew soft logo" src="http://www.shrew.net/images/shrewsoft-logo.png" alt="" width="100" height="111" /></a></p>
<p>I installed version <a href="http://www.shrew.net/download/vpn/vpn-client-2.1.5-rc-3.exe">2.1.5-rc-3</a> and it works perfectly with Windows 7 and also supports importing Cisco .pcf files.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/09/09/cisco-64bit-windows-client-and-shrewsoft-vpn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t sign you in to Windows Live Messenger</title>
		<link>http://blog.devedup.com/index.php/2009/07/02/121/</link>
		<comments>http://blog.devedup.com/index.php/2009/07/02/121/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 08:46:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=121</guid>
		<description><![CDATA[I just got this error message when I tried to sign into MSN Live  this morning:
We can&#8217;t sign you into Windows Live Messenger. Signing in to Windows Live Messenger failed because the authentication service is not compatible with this version of the program!
I haven&#8217;t installed a new version, so I don&#8217;t know why it&#8217;s decided [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_120" class="wp-caption aligncenter" style="width: 548px"><img class="size-full wp-image-120" title="msnliveproblem" src="http://blog.devedup.com/wp-content/uploads/2009/07/msnliveproblem.jpg" alt="msn live cant sign in" width="538" height="231" /><p class="wp-caption-text">msn live cant sign in</p></div>
<p>I just got this error message when I tried to sign into MSN Live  this morning:</p>
<p><em><strong>We can&#8217;t sign you into Windows Live Messenger. Signing in to Windows Live Messenger failed because the authentication service is not compatible with this version of the program!</strong></em></p>
<p>I haven&#8217;t installed a new version, so I don&#8217;t know why it&#8217;s decided it can&#8217;t sign in anymore. However, I&#8217;ve seen the error before and it&#8217;s fixed by added an entry to your hosts file. Go to the file:</p>
<blockquote><p>C:\Windows\system32\drivers\etc\hosts</p></blockquote>
<p>and add the line</p>
<blockquote><p>65.54.239.80    messenger.hotmail.com</p></blockquote>
<p>Thats it. You should now be able to sign in.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/07/02/121/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Struts 2 ActionMapper</title>
		<link>http://blog.devedup.com/index.php/2009/06/11/custom-struts-2-actionmapper/</link>
		<comments>http://blog.devedup.com/index.php/2009/06/11/custom-struts-2-actionmapper/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 17:31:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[struts 2]]></category>
		<category><![CDATA[ActionMapper]]></category>

		<guid isPermaLink="false">http://blog.devedup.com/?p=84</guid>
		<description><![CDATA[The ActionMapper is the component that maps a url onto one of your action classes. More information can be found about it here:
http://struts.apache.org/2.1.6/docs/actionmapper.html
In most applications you won&#8217;t need to change the default ActionMapper. A project I am currently working on required that I implement an API specified by a 3rd party. The requests that they [...]]]></description>
			<content:encoded><![CDATA[<p>The ActionMapper is the component that maps a url onto one of your action classes. More information can be found about it here:</p>
<p><a href="http://struts.apache.org/2.1.6/docs/actionmapper.html">http://struts.apache.org/2.1.6/docs/actionmapper.html</a></p>
<p>In most applications you won&#8217;t need to change the default ActionMapper. A project I am currently working on required that I implement an API specified by a 3rd party. The requests that they send us are all POST requests over HTTPS. Nothing fancy. To determine which method/procedure that they want to call, they send a parameter on the request named &#8216;function&#8217;. I decided that I would implement the receiving service using Struts 2 and create a custom ActionMapper. I did a search, but the results didn&#8217;t show any examples of creating a custom ActionMapper, so I downloaded the  struts 2 source to see how the default one worked, and then I constructed mine with that as a &#8216;guide&#8217;.</p>
<p>My implementation is rather basic, as it isn&#8217;t such a complex requirement.:</p>
<pre class="brush: java;">import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import org.apache.log4j.Logger;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class SyncActionMapper implements ActionMapper {

    private final Logger LOG = Logger.getLogger(getClass());

    private static final String UNKNOW_FUNCTION_MAPPING = &quot;unknownFunction&quot;;

    @Override
    public ActionMapping getMapping(HttpServletRequest request,
                              ConfigurationManager configurationManager) {
        Map&amp;lt;String, ActionConfig&amp;gt; actions =
           configurationManager.getConfiguration().
              getPackageConfig(&quot;sync-facade&quot;).getActionConfigs();

        ActionMapping mapping = new ActionMapping();
        mapping.setNamespace(&quot;/&quot;);

        String actionName = request.getParameter(&quot;function&quot;);
        if (actionName == null || actionName.length() &amp;lt; 1) {
            LOG.error(&quot;function param no found on request &quot; + actionName);
            actionName = UNKNOW_FUNCTION_MAPPING;
        } else if (!actions.containsKey(actionName)) {
            LOG.error(&quot;action not found in struts.xml &quot; + actionName);
            actionName = UNKNOW_FUNCTION_MAPPING;
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug(&quot;function param found, &quot;
                    + &quot; mapping to action with the name: &quot; + actionName);
            }
        }
        mapping.setName(actionName);
        return mapping;
    }

    @Override
    public ActionMapping getMappingFromActionName(String actionName) {
        ActionMapping mapping = new ActionMapping();
        mapping.setName(actionName);
        mapping.setNamespace(&quot;/&quot;);
        return mapping;
    }

    @Override
    public String getUriFromActionMapping(ActionMapping actionMapping) {
        throw new IllegalStateException(&quot;not implemented&quot;);
    }
}</pre>
<p>I also wanted to map unknown functions to an error action. Checking the struts.xml file and returning a valid ActionMapping is not part of the ActionMapper contract (so the docs say), but I decided to add this here. After getting the function name, I check to see if this function exists in struts.xml using the ConfigurationManager (i may need to optimize this line of code, not sure yet).</p>
<p>To set my custom ActionMapper to be the default I added a reference to it in struts.xml:</p>
<pre class="brush: xml;">&lt;constant name=&quot;struts.mapper.class&quot;
    value=&quot;com.devedup.sync.dispatcher.mapper.SyncActionMapper&quot;/&gt;</pre>
<p>I can now map to actions simply from the url http://localhost/myapp?function=myAction  (or similarly with the function param in the body of the POST request).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devedup.com/index.php/2009/06/11/custom-struts-2-actionmapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
