<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ancient Programming</title>
	
	<link>http://www.ancientprogramming.com</link>
	<description>What I encounter in my software part of life is in danger of being commented upon here</description>
	<pubDate>Thu, 29 Dec 2011 23:48:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AncientProgramming" /><feedburner:info uri="ancientprogramming" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to implement drop shadow and immerse effects for UIViews</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/sR1siSdDgMk/</link>
		<comments>http://www.ancientprogramming.com/2011/12/30/uiview-drop-shadow-and-immerse-effec/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 23:43:26 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[ios]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[objective-c]]></category>

		<category><![CDATA[dropshadow]]></category>

		<category><![CDATA[immerse]]></category>

		<category><![CDATA[uiview]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/?p=54</guid>
		<description><![CDATA[



It is pretty easy to create a drop shadow or immerse effect like this in iOS.
Here is two static helper methods I created to do the trick.
The first method is capable of dropping a shadow from one view onto another:
+ (void)dropColor:(UIColor *)dropColor from:(UIView *)dropFromView onto:(UIView *)toView x:(CGFloat)x y:(CGFloat)y {
    CGFloat cornerRadius = [...]]]></description>
			<content:encoded><![CDATA[<p><div><script type="text/javascript"><!--
google_ad_client = "pub-3557368819388454";
/* 728x90, created 01/03/08 */
google_ad_slot = "3206414101";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><br />
It is pretty easy to create a drop shadow or immerse effect like this in iOS.</p>
<p>Here is two static helper methods I created to do the trick.<br />
The first method is capable of dropping a shadow from one view onto another:</p>
<pre name="code" class="cpp">+ (void)dropColor:(UIColor *)dropColor from:(UIView *)dropFromView onto:(UIView *)toView x:(CGFloat)x y:(CGFloat)y {
    CGFloat cornerRadius = [[dropFromView layer] cornerRadius];
    UIView *shadow = [[[UIView alloc] initWithFrame:dropFromView.frame] autorelease];
    [[shadow layer] setCornerRadius:cornerRadius];
    CGRect dropRect = dropFromView.frame;
    shadow.frame = CGRectMake(dropRect.origin.x + x, dropRect.origin.y + y, dropRect.size.width, dropRect.size.height);
    [shadow setBackgroundColor:dropColor];
    [toView insertSubview:shadow belowSubview:dropFromView];
}</pre>
<p>The second takes advantage of the first and creates an effect that makes it looks like the first view is immersed into the other:</p>
<pre name="code" class="cpp">+ (void)immerse:(UIView *)immerseView into:(UIView *)toView depth:(CGFloat)depth {
    CGFloat x = 0.7;
    CGFloat y = 1.4;
    [UIUtil dropColor:[UIColor darkGrayColor] from:immerseView onto:toView x:-1 * x * depth y:-1 * y * depth];
    [UIUtil dropColor:[UIColor whiteColor] from:immerseView onto:toView x:x*depth y:y*depth];
}</pre>
<p>The following effect can be added to a tableview by doing this:</p>
<pre name="code" class="cpp">
- (void)viewDidLoad {
    [super viewDidLoad];
    [[_tableView layer] setCornerRadius:5];
    [UIUtil immerse:_tableView into:self.view depth:1.5];
}
</pre>
<p><a href="http://www.ancientprogramming.com/wp-content/uploads/2011/12/dropshadow_sample.png"><img class="alignnone size-medium wp-image-58" title="dropshadow_sample" src="http://www.ancientprogramming.com/wp-content/uploads/2011/12/dropshadow_sample-300x212.png" alt="" width="300" height="212" /></a></p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/sR1siSdDgMk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2011/12/30/uiview-drop-shadow-and-immerse-effec/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2011/12/30/uiview-drop-shadow-and-immerse-effec/</feedburner:origLink></item>
		<item>
		<title>Extend UITabBarController with an arrow marker</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/r0jHTbflTxE/</link>
		<comments>http://www.ancientprogramming.com/2011/09/18/extend-uitabbarcontroller-with-an-arrow-marker/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 07:03:16 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[how to]]></category>

		<category><![CDATA[ios]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/?p=38</guid>
		<description><![CDATA[I have seen a couple of iPhone apps using an UITabBarController having an arrow showing just above the selected UITabBarItem as an extra visual pointer to the current visible view. At the same time the arrow moves animated between the items as the user selects them.
I decided to try implement the same effect and I [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen a couple of iPhone apps using an UITabBarController having an arrow showing just above the selected UITabBarItem as an extra visual pointer to the current visible view. At the same time the arrow moves animated between the items as the user selects them.</p>
<p>I decided to try implement the same effect and I have shared my solution here.</p>
<p>The solution is made generic enough to handle any number of UITabBarItems in the UITabBarController and basically what it does is:</p>
<ul>
<li>In the viewDidAppear selector, the arrow is places above the first element. This is done by calculating the size and location (also known as the CGRect) of the first UITabBarItem. Then a new UIImageView is created and positioned centered and above the UITabBarItem. Again some math is used to find the offset to use for the newly created UIImageView</li>
<li>In the didSelectItem a transition is used to animate the movement of the arrow between the items as they are selected.</li>
</ul>
<table border="0">
<tr>
<td><a href="http://www.ancientprogramming.com/wp-content/uploads/2011/09/tabbarmarker1.png"><img src="http://www.ancientprogramming.com/wp-content/uploads/2011/09/tabbarmarker1-300x227.png" alt="" title="tabbarmarker1" width="300" height="227" class="alignnone size-medium wp-image-42" /></a></td>
<td><a href="http://www.ancientprogramming.com/wp-content/uploads/2011/09/tabbarmarker2.png"><img src="http://www.ancientprogramming.com/wp-content/uploads/2011/09/tabbarmarker2-300x227.png" alt="" title="tabbarmarker2" width="300" height="227" class="alignnone size-medium wp-image-43" /></a></td>
</tr>
</table>
<p><!-- WSA: ad in context leaderboard not shown: too many ads --></p>
<p>My CustomUITabBarController.h and CustomUITabBarController.m files looks like this:</p>
<pre name="code" class="cpp">
@interface CustomUITabBarController : UITabBarController {
@private
    UIImageView *_imageView;
}
@end
</pre>
<p>The actual implementation looks like follows:</p>
<pre name="code" class="cpp">
@interface CustomUITabBarController ()
@property(nonatomic, retain) UIImageView *imageView;
@end

@implementation CustomUITabBarController

@synthesize imageView = _imageView;

- (CGRect) rectForItem:(UITabBarItem *)item {
    NSUInteger itemsInTabBar = [self.tabBar.items count];

    CGSize itemSize = CGSizeMake(self.tabBar.frame.size.width / itemsInTabBar, self.tabBar.frame.size.height);
    //find current selected item index
    int currentIndexSelected = 0;
    //if the item is nil, we keep the index at zero (selects the first element)
    if (item != nil) {
        for (int i = 0; i < itemsInTabBar; i++) {
            UITabBarItem *currentItem = [self.tabBar.items objectAtIndex:(NSUInteger) i];
            if (currentItem == item) {
                currentIndexSelected = i;
            }
        }
    }
    //construct the rect that defines the current selected item
    return CGRectMake(lrint(currentIndexSelected * itemSize.width), itemSize.height, itemSize.width, itemSize.height);
}

- (CGRect)getRectForImage:(UIImage *)markerImage andTabPosition:(CGRect)itemRect {
    CGFloat windowHeight = [UIScreen mainScreen].bounds.size.height;
    CGRect markerImageRect = CGRectMake(itemRect.origin.x + lrint(itemRect.size.width / 2) - lrint(markerImage.size.width / 2), windowHeight - itemRect.size.height - markerImage.size.height, markerImage.size.width, markerImage.size.height);
    return markerImageRect;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];  //To change the template use AppCode | Preferences | File Templates.
    UIImage * markerImage = [UIImage imageNamed:@"tabMarker.png"];
    CGRect firstItemRect = [self rectForItem:nil];
    CGRect markerImageRect = [self getRectForImage:markerImage andTabPosition:firstItemRect];
    _imageView = [[UIImageView alloc] initWithFrame:markerImageRect];
    _imageView.image = markerImage;
    [self.view addSubview:_imageView];
}

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    CGRect selectedItemRect = [self rectForItem:item];

    [UIView beginAnimations:@"move tabMarker" context:nil];
    [UIView setAnimationDuration:0.3f];
    _imageView.transform = CGAffineTransformMakeTranslation(selectedItemRect.origin.x,0);
    [UIView commitAnimations];
}
...
@end
</pre>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/r0jHTbflTxE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2011/09/18/extend-uitabbarcontroller-with-an-arrow-marker/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2011/09/18/extend-uitabbarcontroller-with-an-arrow-marker/</feedburner:origLink></item>
		<item>
		<title>Logging sql statements and parameters using hibernate</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/ytiOQkVrv2Q/</link>
		<comments>http://www.ancientprogramming.com/2009/11/12/logging-sql-statements-and-parameters-using-hibernate/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 20:32:44 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[how to]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[hibernate]]></category>

		<category><![CDATA[logdriver]]></category>

		<category><![CDATA[logging]]></category>

		<category><![CDATA[runtime]]></category>

		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/?p=33</guid>
		<description><![CDATA[If you need to log sql statements using hibernate you can turn debug on for the org.hibernate.sql logger.
That will log all sql statement, but the actual parameter values will not be logged.
To log the values bound to the hibernate prepared statements, you can turn on trace for the org.hibernate.type logger.
Unfortunately (apparently because of perfomance) the [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: ad in context leaderboard not shown: too many ads -->If you need to log sql statements using hibernate you can turn debug on for the org.hibernate.sql logger.<br />
That will log all sql statement, but the actual parameter values will not be logged.</p>
<p>To log the values bound to the hibernate prepared statements, you can turn on trace for the org.hibernate.type logger.</p>
<p>Unfortunately (apparently because of perfomance) the value of the org.hibernate.type logger is evaulated once in a static block, and cached, see:<a href="http://www.docjar.com/html/api/org/hibernate/type/EnumType.java.html" target="_blank"> EnumType.java</a>.</p>
<p>That prevents you from turning the log on and off during runtime using a simple jsp page like the <a href="http://ananthkannan.blogspot.com/2009/10/how-to-change-log-levels-on-fly-using.html" target="_blank">log4jAdmin.jsp</a>. Note that if it were possible you still had to add trace to the page as debug is currently the lowest value.</p>
<p>Of course there must be a reason why the hibernate implementation are caching the value of the org.hibernate.type logger, but I believe it is still valuable to be able to turn on sql logging with parameters at runtime.</p>
<p>For that purpose I came across the <a href="http://rkbloom.net/logdriver/" target="_blank">logDriver</a>. A simple database driver written by Ryan Bloom, that is wrapping an existing jdbc driver.</p>
<p>To use the logdriver all you have to do is set the driver and connection url as follows:</p>
<p>driver:net.rkbloom.logdriver.LogDriver<br />
url:jdbc:log_real_driver_class:real_jdbc_connection_url</p>
<p>Now you can turn on logging by setting the net.rkbloom.logdriver logger to debug.</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/ytiOQkVrv2Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2009/11/12/logging-sql-statements-and-parameters-using-hibernate/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2009/11/12/logging-sql-statements-and-parameters-using-hibernate/</feedburner:origLink></item>
		<item>
		<title>Any good maven support for Google Appengine?</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/XS_2mtQk0Nc/</link>
		<comments>http://www.ancientprogramming.com/2009/06/05/any-good-maven-support-for-google-appengine/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 14:18:44 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[appengine]]></category>

		<category><![CDATA[google-appengine]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/?p=29</guid>
		<description><![CDATA[Yesterday I created a appengine project testing the JPA/Spring/Wicket stack.
This was created using the build.xml file found in the appengine documentation. It all worked fine, but I would like to build my project using maven so I started looking for a good maven plugin.
I found this blog talking about what features a good plugin should [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I created a appengine project testing the JPA/Spring/Wicket stack.</p>
<p>This was created using the <a href="http://code.google.com/appengine/docs/java/tools/ant.html">build.xml </a>file found in the appengine documentation. It all worked fine, but I would like to build my project using maven so I started looking for a good maven plugin.</p>
<p>I found this <a href="http://www.sonatype.com/people/2009/04/my-google-app-engine-maven-plugin-wishlist/">blog</a> talking about what features a good plugin should contain and a guy from the <a href="http://www.kindleit.net/">kindleit</a> company claiming that they actually had implemented a <a href="http://code.google.com/p/maven-gae-plugin">maven-gae-plugin</a> capable of executing most of these tasks.</p>
<p>Unfortunately I ran into several problems using this plugin, hence I have created an <a href=" http://code.google.com/p/maven-gae-plugin/issues/detail?id=4">issue</a>.</p>
<p>Untill these tasks in the issue has been fixed I would like to use another plugin.<br />
Can anybody guide me in the direction of a more stable plugin?</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/XS_2mtQk0Nc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2009/06/05/any-good-maven-support-for-google-appengine/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2009/06/05/any-good-maven-support-for-google-appengine/</feedburner:origLink></item>
		<item>
		<title>Howto setup smooth ssh access</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/w4YIxA8c3iU/</link>
		<comments>http://www.ancientprogramming.com/2008/10/24/howto-setup-smooth-ssh-access/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 20:59:21 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[how to]]></category>

		<category><![CDATA[ssh]]></category>

		<category><![CDATA[.ssh/config]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[ssh-keygen]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/10/24/howto-setup-smooth-ssh-access/</guid>
		<description><![CDATA[Everytime I have a new machine or a new ssh access to setup I forgot how to configure the access so I don&#8217;t have to type the username each time (if I login with a different user).
At the same time I would like to use a private rsa key. So here goes a note to [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: ad in context square-right not shown: too many ads -->Everytime I have a new machine or a new ssh access to setup I forgot how to configure the access so I don&#8217;t have to type the username each time (if I login with a different user).<br />
At the same time I would like to use a private rsa key. So here goes a note to myself and other scatter brains <img src='http://www.ancientprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Instead of always have to type username and password like this:</p>
<pre>[jeyben@machine ~]$ ssh username@www.ancientprogramming.com
Password:
Last login: Fri Oct 24 16:31:03 2008 from somewhere
[username@servername ~]$</pre>
<p>I would like to just do the following:</p>
<pre>[jeyben@machine ~]$ ssh ancientprogramming
Last login: Fri Oct 24 16:31:03 2008 from somewhere
[username@servername ~]$</pre>
<h3>Create and use a public/private key pair</h3>
<p><strong>Client</strong></p>
<pre>$ ssh-keygen -t rsa
$ scp ~/.ssh/id_rsa.pub www.ancientprogramming.com:~</pre>
<p><strong>Server</strong></p>
<pre>$ cat ~/id_rsa.pub &gt;&gt; .ssh/authorized_keys</pre>
<h3>Modify .ssh/config</h3>
<pre>Host ancientprogramming
  User &lt;username&gt;
  Port 22
  HostName www.ancientprogramming.com
  LocalForward 3307 localhost:3306 (setup a localforward for the default mysql port)</pre>
<p><!-- WSA: ad in context leaderboard not shown: too many ads --></p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/w4YIxA8c3iU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/10/24/howto-setup-smooth-ssh-access/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/10/24/howto-setup-smooth-ssh-access/</feedburner:origLink></item>
		<item>
		<title>Fixedformat4j now supports primitive datatypes as well as innerclasses</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/uKx7UXjCuZk/</link>
		<comments>http://www.ancientprogramming.com/2008/10/16/fixedformat4j-now-supports-primitive-datatypes-as-well-as-innerclasses/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 19:02:49 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[fixedformat4j]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/10/16/fixedformat4j-now-supports-primitive-datatypes-as-well-as-innerclasses/</guid>
		<description><![CDATA[Support for primitive datatypes is added to the latest 1.2.1 release of fixedformat4j. I would like to thank Marcos Lois Bermúdez for contributing with this extension. The latest release can be downloaded here.
The same 1.2.1 release also fixed the bug that made it impossible to use annotate and format static nested classes and inner classes
The [...]]]></description>
			<content:encoded><![CDATA[<p>Support for primitive datatypes is added to the latest 1.2.1 release of fixedformat4j. I would like to thank Marcos Lois Bermúdez for contributing with this extension. The latest release can be downloaded <a href="http://code.google.com/p/fixedformat4j/downloads/list">here</a>.</p>
<p>The same 1.2.1 release also fixed the bug that made it impossible to use annotate and format static nested classes and inner classes</p>
<p>The complete <a href="http://fixedformat4j.ancientprogramming.com/changes-report.html">changelist</a> can be found on the <a href="http://fixedformat4j.ancientprogramming.com/">project website</a>.</p>
<p>In a few days the release should be available from ibiblio.</p>
<p>I encourage all users of fixedformat4j to contribute or create <a href="http://code.google.com/p/fixedformat4j/issues/list">issues</a> if they find a bug or would like new features to be added.<br />
<!-- WSA: ad in context leaderboard not shown: too many ads --></p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/uKx7UXjCuZk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/10/16/fixedformat4j-now-supports-primitive-datatypes-as-well-as-innerclasses/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/10/16/fixedformat4j-now-supports-primitive-datatypes-as-well-as-innerclasses/</feedburner:origLink></item>
		<item>
		<title>Automatically reconnect to NAS under Mac OS X</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/blTDPxJZHf8/</link>
		<comments>http://www.ancientprogramming.com/2008/06/27/automatically-reconnect-to-nas-under-mac-os-x/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 21:21:20 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[how to]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[automator]]></category>

		<category><![CDATA[connect]]></category>

		<category><![CDATA[nas]]></category>

		<category><![CDATA[os x]]></category>

		<category><![CDATA[reconnect]]></category>

		<category><![CDATA[remount]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/06/27/automatically-reconnect-to-nas-under-mac-os-x/</guid>
		<description><![CDATA[Mac OS X doesn&#8217;t remount network drives when booted. You have to do this yourselves.
You can easily automate this by creating an application using the automator and add it to your login items.

You automator script should contain two items:

Get Specified Servers
Connect to Servers

Save the script as an application and put it into login items for [...]]]></description>
			<content:encoded><![CDATA[<p>Mac OS X doesn&#8217;t remount network drives when booted. You have to do this yourselves.</p>
<p>You can easily automate this by creating an application using the automator and add it to your login items.</p>
<p style="text-align: center"><a href="http://www.ancientprogramming.com/wp-content/uploads/2008/06/automator-connect.gif" title="Automator - create application"><img src="http://www.ancientprogramming.com/wp-content/uploads/2008/06/automator-connect.gif" alt="Automator - create application" height="220" width="460" /></a></p>
<p>You automator script should contain two items:</p>
<ul>
<li>Get Specified Servers</li>
<li>Connect to Servers</li>
</ul>
<p>Save the script as an application and put it into login items for your user account. This will execute your small application each time you login and you should be reconnected to your NAS on startup.</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/blTDPxJZHf8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/06/27/automatically-reconnect-to-nas-under-mac-os-x/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/06/27/automatically-reconnect-to-nas-under-mac-os-x/</feedburner:origLink></item>
		<item>
		<title>Fixedformat4j 1.2.0 released</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/tkQbDV2v3H4/</link>
		<comments>http://www.ancientprogramming.com/2008/06/12/fixedformat4j-120-released/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 21:07:44 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/06/12/fixedformat4j-120-released/</guid>
		<description><![CDATA[This evening I released a new version of fixedformat4j containing improved error reporting when failing to parse data using the FixedFormatManager.
The lack of good error reporting was a bit of a pain. It was not easy to see where in the parsing failed and it was not possible to get a complete list of format [...]]]></description>
			<content:encoded><![CDATA[<p>This evening I released a new version of fixedformat4j containing improved error reporting when failing to parse data using the FixedFormatManager.</p>
<p>The lack of good error reporting was a bit of a pain. It was not easy to see where in the parsing failed and it was not possible to get a complete list of format instructions.</p>
<p>A new ParseException is now thrown which contains the nessesary information.</p>
<p>See example of the new and improved stacktrace:</p>
<pre name="code" class="java">
com.ancientprogramming.fixedformat4j.format.ParseException: failed to parse 'barfooba' at offset 16 as java.util.Date from 'foobarfoobarfoobarfoobar'. Got format instructions from com.ancientprogramming.fixedformat4j.format.impl.MyRecord.getDateData. See details{FormatContext{offset=16, dataType=java.util.Date, formatter=com.ancientprogramming.fixedformat4j.format.impl.ByTypeFormatter}, FormatInstructions{length=8, alignment=LEFT, paddingChar=' ', fixedFormatPatternData=FixedFormatPatternData{pattern='yyyyMMdd'}, fixedFormatBooleanData=FixedFormatBooleanData{trueValue='T', falseValue='F'}, fixedFormatNumberData=FixedFormatNumberData{signing=NOSIGN, positiveSign='+', negativeSign='-'}, fixedFormatDecimalData=FixedFormatDecimalData{decimals=2, useDecimalDelimiter=false, decimalDelimiter='.'}}}
 at com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl.readDataAccordingFieldAnnotation(FixedFormatManagerImpl.java:179)
 at com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl.load(FixedFormatManagerImpl.java:70)</pre>
<p>Feel free to <a href="http://code.google.com/p/fixedformat4j/downloads/list">download</a> the latest version and take a look at the <a href="http://fixedformat4j.ancientprogramming.com/changes-report.html">changelist</a>.</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/tkQbDV2v3H4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/06/12/fixedformat4j-120-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/06/12/fixedformat4j-120-released/</feedburner:origLink></item>
		<item>
		<title>How to create macros for maven-site-plugin</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/Cxd9y0Ccpsw/</link>
		<comments>http://www.ancientprogramming.com/2008/06/05/how-to-create-macros-for-maven-site-plugin/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 20:16:20 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[how to]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[doxia]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[macro]]></category>

		<category><![CDATA[maven-site-plugin]]></category>

		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/06/05/how-to-create-macros-for-maven-site-plugin/</guid>
		<description><![CDATA[Many maven projects uses the maven site plugin to generate there documentation.
The maven-site-plugin uses the doxia to let authors write xdoc, apt and fml documents as the source for there project documentation. These written documents is processed by doxia to generate html and merged into the complete project site by the maven-site-plugin.
I found doxia and [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: ad in context square-right not shown: too many ads -->Many maven projects uses the maven site plugin to generate there documentation.</p>
<p>The maven-site-plugin uses the doxia to let authors write xdoc, apt and fml documents as the source for there project documentation. These written documents is processed by doxia to generate html and merged into the complete project site by the maven-site-plugin.</p>
<p>I found doxia and especially the apt language somehow lacking in functionality. I would like to use the <a href="http://code.google.com/p/syntaxhighlighter">syntaxhighlighter</a> to be able to highlight code examples on the <a href="http://fixedformat4j.ancientprogramming.com">fixedformat4j</a> project.</p>
<p>Doxia comes out-of-the-box with a <a href="http://maven.apache.org/doxia/macros/index.html">small bunch of macros</a> and you have the ability to write custom macros as well.</p>
<p><strong>Custom macro</strong><br />
<!-- WSA: ad in context leaderboard not shown: too many ads --><br />
I wrote a simple macro based on the core snippet macro:</p>
<p>pom.xml:</p>
<pre name="code" class="xml">
<project>
<parent>
    <groupid>org.apache.maven.doxia</groupid>
    <artifactid>doxia-modules</artifactid>
    <version>1.0-alpha-11</version>
  </parent>
  <modelversion>4.0.0</modelversion>
  <groupid>com.ancientprogramming.maven.doxia</groupid>
  <artifactid>doxia-module-syntaxhighlighter</artifactid>
  <version>1.0-alpha-11</version>
  <name>Doxia :: syntaxhighlighter</name>
  <build>
<plugins>
<plugin>
        <groupid>org.codehaus.plexus</groupid>
        <artifactid>plexus-maven-plugin</artifactid>
        <executions>
          <execution>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project></pre>
<p>Changes to the <a href="https://svn.apache.org/repos/asf/maven/doxia/doxia/tags/doxia-1.0-alpha-11/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java">snippet</a> plugin:</p>
<pre name="code" class="java">
...
  public void execute(Sink sink, MacroRequest request)
      throws MacroExecutionException {
    System.out.println("ancientprogramming - running execute");
    String id = (String) request.getParameter("id");

    required(id, "id");

    String urlParam = (String) request.getParameter("url");

    String fileParam = (String) request.getParameter("file");

    String codeParam = (String) request.getParameter("code");

    required(codeParam, "code");

    URL url;

    if (!StringUtils.isEmpty(urlParam)) {
      try {
        url = new URL(urlParam);
      }
      catch (MalformedURLException e) {
        throw new IllegalArgumentException(urlParam + " is a malformed URL");
      }
    } else if (!StringUtils.isEmpty(fileParam)) {
      File f = new File(fileParam);

      if (!f.isAbsolute()) {
        f = new File(request.getBasedir(), fileParam);
      }

      try {
        url = f.toURL();
      }
      catch (MalformedURLException e) {
        throw new IllegalArgumentException(urlParam + " is a malformed URL");
      }
    } else {
      throw new IllegalArgumentException("Either the 'url' or the 'file' param has to be given.");
    }

    StringBuffer snippet;

    try {
      snippet = getSnippet(url, id);
    }
    catch (IOException e) {
      throw new MacroExecutionException("Error reading snippet", e);
    }

   sink.rawText("... syntaxhighlighter prefix ...");
   sink.rawText(snippet.toString());
   sink.rawText("... syntaxhighlighter postfix ...");
}
...</pre>
<p>Note: wordpress obfuscates the above code where I wrote the syntax hightlighter pre and post fix. You can see what you actually should write at the <a href="http://code.google.com/p/syntaxhighlighter/">syntaxhighligther</a> project.</p>
<p><strong>Use custom macro</strong><br />
To be able to use the macro you have to add your macro as dependency to the maven-site-plugin:</p>
<pre name="code" class="xml">
<plugin>
  <groupid>org.apache.maven.plugins</groupid>
   <artifactid>maven-site-plugin</artifactid>
   <configuration>
     <templatedirectory>${basedir}/src/site</templatedirectory>
     <templatefile>src/site/fixedformat4j-template.vm</templatefile>
   </configuration>
   <dependencies>
    <dependency>
      <groupid>com.ancientprogramming.maven.doxia</groupid>
      <artifactid>doxia-module-syntaxhighlighter</artifactid>
      <version>1.0-alpha-11</version>
    </dependency>
  </dependencies>
</plugin></pre>
<p><!-- WSA: ad in context leaderboard not shown: too many ads --><br />
Now you can use the macro by writing the following in your apt files:</p>
<pre>%{code-snippet|id=basicusage|code=java|file=../../BasicUsageRecord.java}</pre>
<p><strong>Change your site template</strong><br />
Before the the source can be highlighted in your documentation you should add the syntaxhighlighter javascript and stylesheets to your template.<br />
See how to change your template <a href="http://maven.apache.org/plugins/maven-site-plugin/examples/templatefile.html">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/Cxd9y0Ccpsw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/06/05/how-to-create-macros-for-maven-site-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/06/05/how-to-create-macros-for-maven-site-plugin/</feedburner:origLink></item>
		<item>
		<title>Fixedformat4j scores well on sonar</title>
		<link>http://feedproxy.google.com/~r/AncientProgramming/~3/PeCAZzco13E/</link>
		<comments>http://www.ancientprogramming.com/2008/06/05/fixedformat4j-scores-well-on-sonar/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 19:31:15 +0000</pubDate>
		<dc:creator>Jacob von Eyben</dc:creator>
		
		<category><![CDATA[fixedformat4j]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[sonar]]></category>

		<category><![CDATA[sonarsoftware]]></category>

		<guid isPermaLink="false">http://www.ancientprogramming.com/2008/06/05/fixedformat4j-scores-well-on-sonar/</guid>
		<description><![CDATA[Today I found fixedformat4j was obtained at sonarsoftware and it was exciting to see that it scored  pretty well compared to some other very well known opensource projects like the commons series, some of the spring module and even the Apache Maven project.

I didn&#8217;t know sonar before today. They describe them as:
 Sonar is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I found <a href="http://fixedformat4j.ancientprogramming.com/">fixedformat4j</a> was obtained at <a href="http://www.sonarsoftware.org/" target="_blank">sonarsoftware</a> and it was exciting to see that it scored  pretty well compared to some other very well known opensource projects like the commons series, some of the spring module and even the Apache Maven project.<br />
<!-- WSA: ad in context leaderboard not shown: too many ads --><br />
I didn&#8217;t know sonar before today. They describe them as:</p>
<blockquote><p> Sonar is an entreprise quality control tool, distributed under the terms of the GNU LGPL. Its basic purpose is to join existing continuous integration tools to place Java development projects under quality control.</p></blockquote>
<p>Even though the metrics at sonar doesn&#8217;t draw the complete picture on how good or mature a project is, it still gives a hint.</p>
<img src="http://feeds.feedburner.com/~r/AncientProgramming/~4/PeCAZzco13E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ancientprogramming.com/2008/06/05/fixedformat4j-scores-well-on-sonar/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.ancientprogramming.com/2008/06/05/fixedformat4j-scores-well-on-sonar/</feedburner:origLink></item>
	</channel>
</rss>

