Back to Paradise (music)

Ok, this is a music track I made last year that I have never posted here on my blog yet. This is made on an iPad with no external hardware help. Only the drum sounds are samples, but they are layered and edited on the iPad by me. All other sounds come from apps on the iPad. Most of the work is done in NanoStudio, one of the best apps on iOS.
Have a listen and let me know what you think.

Finally upgraded!

So I finally upgraded this blog to WordPress version 3 (3.3.2 to be exact). I thought it would require a great deal time as I tried it before by going the automatic route that didn’t work back then. But then it came to me that I would probably have to open up the full directory structure for the automatic upgrade and voila! Of course I closed it right after the upgrade and all seems to be working.

Not that I do an aweful lot with this blog, but it was nagging at me for quite some time and I didn’t want to invest too much time in it.

(Ended) Win $100 to Spend on iOS Music Apps and/or iPhone/iPad Accessories! (I won!)

Have a look here to make a chance winning $100 to Spend on iOS Music Apps and/or iPhone/iPad Accessories!

This giveaway has ended and I have won!

Thank you very much iDesignSound!

Html 5 Canvas with Mandelbrot

Updated! I have updated the Mandelbrot page. Now it’s an interactive viewer. You can zoom, increase the depth and the resolution yourself. Try to find your ultimate Mandelbrot image.

Last week I was thinking about the Html 5 Canvas and that I needed to have a look at it. During that same week I stumbled on the famous Mandelbrot fractal. I’ve seen them in old school demo’s, but I never knew, nor investigated, how they worked. So I did some research (thanks wikipedia) and thought it would be cool to test it out on a Canvas.

The result can be found here. I might add more features in the future, but I think it looks pretty cool already. But it’s quite slow at around 5-6 fps.

If you like it, please leave a comment. Feel free to have a look at the source code. If you use any part of it (why would you!?), please mention my name.


If anyone was reading my blog they probably have left it now. I haven’t updated in quite some time and I probably won’t for some more time. I don’t have many new or cool things I want to blog about and my mind has been on a few other things lately.

BUT! Don’t delete any subscription on the RSS Feed just yet or keep on looking here for more, because some day I will have another cool valuable post for all of you to read. Hope to “see” you soon. :)

CKEditor Maximum Length

Recently I needed to implement an HTML editor in an old ASP.NET 1.1 application. This application is a sort of generic survey application that has been abused a long time ago to not be so generic anymore, and this is put mildly. Our client was instructed by someone else that text entered into a description field needed to conform to web standards and we should use one of two free HTML editors. Another requirement was that the text could contain a maximum of 350 characters.

We had the choice of TinyMCE or CKEditor. Without much investigation we’ve gone with CKEditor, because it seemed the least focused on PHP in their examples, but to be honest we’ve spent no more than 5 minutes on the site and it shouldn’t really depend on the server side language we use, but the choice was made! As a side note, I did not know that WordPress uses TinyMCE.

It was very easy to install the editor and get it running. With a simple bit of javascript I was able to change a normal HTML textarea into an editor with the options I wanted.

	toolbar: [['CharCount'],
		['Bold', 'Italic', '-', 'NumberedList', 'BulletedList'],

So far so good. But the most difficult and annoying part was yet to come. CKEditor (and I believe TinyMCE as well) does not have a built in mechanism to restrict the number of characters entered. So we had to add something ourselves. There are some posts and sites that have options for this and I used one of them and modified it to my liking. The original discussion can be found here.

Once you have something like that in place you need to make up your mind about what to count. Do you need to count the visible text or do you count all the HTML formatting too? We have chosen – together with our client – to count the text you see and used a big line of replace code from the above link.

Something we added was this functionality to work with pasted text as well and we removed a visible counter. Last but not least we changed the code to be a bit more generic by using the event arguments of the events to get to the editor and use the configuration for some settings tied to the editor you are working with. This way the function works for any CKEditor on the page as long as you set some things when replacing your textarea.

I am still not 100% happy with the result as pasting a bit of text that will go over the maximum amount of characters will just get undone. Also sometimes it seems a bit buggy with pasting or typing fast, but in normal operation it functions quite well. Following is the new initialization of the editor.

	toolbar: [['CharCount'],
		['Bold', 'Italic', '-', 'NumberedList', 'BulletedList'],
	MaxLength: 350
CKEDITOR.instances.TEXTAREA_ID.on('key', checkLength);
CKEDITOR.instances.TEXTAREA_ID.on('paste', checkLength);

Here are the functions we added to the HTML head section of our page.

function getCurrentCount(editor)
	var currentLength = editor.getData()
		.replace(/<[^>]*>/g, '')
		.replace(/\s+/g, ' ')
		.replace(/&\w+;/g ,'X')
		.replace(/^\s*/g, '')
		.replace(/\s*$/g, '')
	return currentLength;
function checkLength(evt)
	var stopHandler = false;
	var currentLength = getCurrentCount(evt.editor);
	var maximumLength = 350;
		maximumLength = evt.editor.config.MaxLength;
		evt.editor.config.LockedInitialized = 1;
		evt.editor.config.Locked = 0;
			currentLength +=;
		else if(
			currentLength +=;
	if(!stopHandler && currentLength >= maximumLength)
		if ( !evt.editor.config.Locked )
			// Record the last legal content. 'saveSnapshot' );
			evt.editor.config.Locked = 1;
			// Cancel the keystroke.
			// Check after this key has effected.
			setTimeout( function()
				// Rollback the illegal one.
				if( getCurrentCount(evt.editor) > maximumLength )
					evt.editor.execCommand( 'undo' );
					evt.editor.config.Locked = 0;
			}, 0);

I have to apologise for the formatting. I have not figured out how to get better looking code snippets in WordPress yet. Please give me some tips if you know how to properly handle those.

Edit 2010-06-16: With some extra effort I formatted the code blocks better. It still isn’t how it should be, because real code blocks get formatted pretty strange and ugly with my current theme, but it looks ok and readable now.

Edit 2010-06-17: I installed a new plugin called WP-Syntax that uses GeSHi for syntax highlighting in code blocks. Together with my current theme it looks nice after some tweaking of the plugin stylesheet, but they don’t work well together when I use line numbers, so you won’t find those.

Edit 2010-07-19: I ended up removing all this custom work a few weeks ago, because in the end it just didn’t feel right and was kind of buggy. The client didn’t like it and the initial specification was that we just checked the length after saving, which is the default way for other fields in this application and is not very bad due to how it works overall. (It still saves, it just shows some kind of ‘incomplete’ message)

Blog update part 1

Last week hasn’t been inspiring for any in depth or cool posts, so it’s a good time to give you an update on the status of this blog.

As you no doubt have already seen the design is better than it was with the default theme. I now use the zBench theme, that gives me a clean look with nice colors and is easy on the eye. I hope you like it too.

The sidebar has changed today. I removed, changed and added some widgets to give me the links and options I want to have here, but I’m not fully satisfied yet, so this will probably change some day.

One of the things you will see, is that I added a Google Adsense banner in the sidebar. I tried to blend it in as much as possible, so that it is nonobtrusive. This also means I had to put a privacy policy, which you will find as a page under About. For Adsense to work a little better I installed a plugin called Auto Adsense Sections to target specific sections on the pages of this blog. This should give ads that are better targeted at the content of this blog. But this will probably take two weeks before actively indexed by Google.

To monitor my traffic I signed up for Google Analytics and installed the Google Analyticator plugin. It has a lot of options for tracking, allowing easy insertion of custom code before and after the default tracking code and removing tracking for specific accounts. And it uses the newest async tracking code. Have a look at the link for all options and features.

For better crawling of the blog I have installed Google XML  Sitemaps to automate the creation of sitemaps for the crawlers that support this format, so that basically amounts to the most important ones.

For further SEO (Search Engine Optimization) I installed and activated Headspace2. It has a lot of options, but I really haven’t found the time to dig into all the options and use it, so beside the sitemap I don’t do much SEO yet. If anyone knows a good article about Headspace2, please let me know in the comments.

For all the mobile visitors of this blog I have installed the WPTouch iPhone Theme plugin. This plugin will change the theme for anyone surfing my blog to a theme that’s more appropriate for mobile devices like the iPhone. Of course you can switch to the normal theme, but the mobile theme is pretty nice and really more suited for small (touch) screens. You can even specify your Google Analytics code so it gets inserted on the mobile theme too, but that’s something I have to investigate a bit more.

One last thing I would like to address here is that my blog feels a bit slow and yesterday I got two out of memory errors. I have asked my provider about this and they are aware of the problem and will have new hardware in place next week. I hope that will fix it and my site will be a bit more browsable.

If you have any comments, advice, tips, tricks or other criticisms, please don’t hesitate to comment on this post.

To var or not to var?

That’s the question that kept me busy a few times already. I’ve seen some code snippets using var in every possible situation and I thought to myself that I didn’t like the look of it so I gave it some more thought and looked around the net what other people think. I know there are many people that will think differently about it, but this post describes my opinion about the issue.

Don’t get me wrong, var is a very nice keyword and has it’s uses. First of all it’s needed for Linq to work; that’s reason enough. But should you use it all the time? Even Resharper seems to advocate using var at every occasion. I’ve found a post here about their team having two options for the use of var and deciding for the current one.

I like code where you can see what type a variable is just by looking at the declaration. I know intellisense tells you what type it is when you want it, but what about the snippets you find on the net? I don’t have intellisense in my browser. And I don’t even want to have to hover my mouse over a variable just to see what type it is.

What I like to do, is using var only when it’s absolutely clear what type it is and it makes the code cleaner and neater. That comes down to about the same thing that Dare Obasanjo writes about one of the options the Resharper team had:

  1. New object creation expression: var dictionary = new Dictionary<int, string>();
  2. Cast expression: var element = obj as IElement;
  3. Generic method when return type is generic: var manager = serviceProvider.GetService<IManager>();

So basically it comes down to this: I use var when it cleans up my code and it’s also very clear what type is meant.

www or not

For this domain and this blog in particular I was thinking about whether I want the www in front of the domain or not. At first I thoughtthat the shorter version would be better: shorter, nicer, cooler, but that I could just keep both of them pointing to the same files as is the default with my hosting.

Shortly after my first thoughts I found out that keeping both linked to the same files is not really a best practice. This way all traffic is split up between the two and that’s not pretty for any statictics, like with  Google Analytics. Client side caching could be screwed up as well with images coming from www and no www for example. It is good advice to handle both and permanently redirect one to the other with a 301 permanently moved redirect/http header. So the first lesson here is to have both www and without, but only use one of them to really handle the requests.

Now that we have that behind us, which of the two should we use for handling our traffic? As I said earlier, I thought without the www looks cooler and shorter and that was the way to go nowadays, that the www was just something left over from the old days, but after some searching I found some arguments that changed my mind.

The most common argument against not using www is that it can get in the way of cookies. Cookies used by sites without www will be used by all subdomains on the domain, because if the way cookies work. Actually there has to be a dot (.) before the domain, but I guess most browser will work without the dot. You can find a lot more info about this issue on the net from people that can explain this a lot better. A short explanation can be found here. So if you want different cookies or no cookies for some other subdomain in the future, you should use www.

Another argument is that in a lot of editors, be it in a mail client or an html editor online, url’s that have www (or some other subdomain) will get recognized, but url’s without will not unless you type http:// yourself, which is rather annoying. So the www will make life a little easier for people that need to link to your site.

A third argument and an argument I don’t really think is very valid is that people are used to the www. If you handle both ways than people can still type it and get to the right page. And people should be able to get accustomed to a change this small.

The last argument I want to address is that the www subdomain (as that’s what it technically is) adds some information to the whole domain. Without it is just a little bit too generic (although that could be just why you do not want it). The internet is so much more than just the World Wide Web, so use the corresponding subdomain. Use subdomains where subdomains are due.

There are also arguments against the use of www and there are probably other arguments than I summed up here. Some arguments may not seem very valid, some may weight heavier to one person that it does to the other. I think these arguments sum up most of the discussion and I have drawn my conclusion as you can see from my current set up on this domain. I am a proud user of www and I “301″ the other to it!

Hello world!

Hello world! My first post will be used to introduce myself and try to explain what I want to do with my blog. Don’t expect a full vision statement or anything like that; it’s an open end.

First of all, my name is Rodi de Boer. I am married and have a daughter, with another child hopefuly finding his way out of it’s mom this summer (Hello world!). At work I am a Lead Developer at NetSourcing, mostly keeping myself busy with .Net development and a little Sharepoint. At home I like to play games – if I can get some time away from my family. ;)

It took some time, but now I felt the urge to start my own blog. I have read some, found a lot of solutions to problems on them, got some tips and tricks off of them, but I never tried blogging myself. I’ve had my my own domain and web space for some time, but only used it for mail. Now is the time to get out into the world of blogging and write myself. Hello world!

I am not certain where I’ll be going with this blog. I will start writing some of the things that keep me busy during the week. Most likely this will involve development and related things as that’s my job. Besides that there could be some post about games, my personal life and what not, but I will try to keep it connected to only a couple of fields. As this is my first blog, I have much to learn and I will try blogging about those experiences as well. My personal goal is to post at least once a week, but that can change.

As you can see, this blog is just the default WordPress blogat the moment. This will change too. I will implement a nice theme, get the design up to my liking, install a couple of plugins and make this my blog. By the way, installing WordPress really is very simple. I did have some issues, but those were all related to my hosting provider, who does an outstanding job with support as I might add. If anybody reading this has got some tips on blogging or wordpress, don’t hesitate to leave a comment.

Have a good time reading my blog! Hello world!