Living with code addiction

18. January 2010 14:36

My name is Johan. I'm a code addict. *cheering crowds*

Have you ever been tossing and turning in bed for hours, brooding over some problem you really want to solve? Have you at last, at 3 a.m., gone up, started the computer, solved the darn thing and then gone back to bed and slept so good you never thought you could?
Welcome to the club. You're not alone.

So, now when that's out, I can assure you I have no ambition whatsoever to "recover" from this addiction. On the contrary I intend to enjoy it while I still have it. Can't imagine the day I realize there isn't another problem I want to wrap my brain around, or there is no snippet of code I want to try. Until then, I'm hooked.

I'm primarily into producing code (of course?), but going through someone else's code can also be quite satisfying. If it solves some interesting problem, that is.
For me there are two ways consuming code can make you feel good. The first one is when you see something that you would have solved in a much better way. Then you can pat yourself on the sholder and put on that smug face of yours.
The other way is when you actually learn something new, a new solution to an old problem, or some code that for some reason is simply brilliant. That's when your synapses really start sizzling...

About the code production part, it has to be quality code to be really satisfying. That run-of-the-mill code you pour out most of the time doesn't really ring the bell, does it. It's those times when you sqeeze out that golden code that counts. Clear, concise and just excellent. Unfortunately that extatic feeling doesn't stay for very long. Then you're back in the search for the next code-high.

My intention with this blog is not to teach the golden path to code perfection. Mainly because I'm not there myself. I'll let you know when I am.
It's more likely to be useful tips in various development areas, comments on annoyances, whatever is on my mind and so on. Since english is not my native language, you are not likely to find any free courses in english grammar on these pages. Hopefully I will at least make myself understood.

Welcome aboard.


A developer's life


3/26/2010 6:53:09 PM #


I like studying about technology. I will be coming back.

computers Belgium |

4/11/2010 4:20:21 PM #

rid of bed bugs

I am researching this issue and your post is very helpful and informative. Thank you.

rid of bed bugs United States |

4/13/2010 4:41:24 AM #

Margy Dragos

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.

Margy Dragos United States |

4/13/2010 9:59:39 AM #


I'm glad you found it interesting! Welcome back anytime ;)
I thought I'd pop by your blog at and read a couple of posts. Only had time for a quick glance now, unfortunately.
Have a nice day!

Johan Sweden |

4/24/2010 5:24:20 PM #

Wilson Ellner

You can find a lot of very nice points made here. Commonly, I am not pretty keen on websites. nevertheless, every now and then all of us must take notice. Inspiring, I'm grateful to you.

Wilson Ellner United States |

2/11/2011 5:26:09 PM #

Selva Sabaratnam

I have only read your posts on DNN module development and they helped me tremendously. I am sure millions of us aspire to be able to say that we are "code addicts" of your caliber. Once again thank you for sharing and showing the way. I will religeously check out / look for your new posts.
I would love to read your posts on other DNN related topics.  Being new to DNN based development I have a specific question that I would like to know your answer / comment.
Please forgive me if this is not the place to raise it.
We have multiple ASP.NET Apps currently being considered for DNN conversion. We are all new to DNN and we are yet to delpoy our first system in production.
They are disparate systems except for sharing the User details for authentication and security control.  We are not sure if all our systems should be installed around a single DNN instance using a single DNN database. Since some of our SQL contents are highly sensity and protected we are concerned about merging such data within DNN databse which has to allw "DB Owner" level access to DNN.  Is it a standard practice to merge sensity data within DNN database or keep them seperate. From a developers point of view is it advisable to have seperate DNN instance for each Disparate system with its own DNN DB rather than merging all systems under one huge DNN database?   What is better for easy maintenance. Would appreciate your comments ver much.

Selva Sabaratnam United States |

2/12/2011 9:41:42 PM #


I am very pleased that my efforts helped you and thank you for the feedback. So +1 member in the code addicts club then ;)
I sincerely hope that I soon find the time to work on this blog again. As you may have noticed it was all too long since my last post Frown

You have an interesting question there. I'll try to get back to you with my take on it as soon as possible.

Johan Sweden |

2/19/2011 3:03:21 PM #


Hello again and sorry for taking so long before coming back to you.
Regarding the issue with sensitive data, DNN should be able to run without db owner access. This forum post is a bit old, but it might get you on the right track:

I don't think there is any standard practice regarding this. To me it's very much a case-to-case decision. If you have (a lot of?) existing data it might be easier to let the data reside in its current db instead of migrating it into the DNN db. Also, this probably avoids setup and revalidation of your backup procedures and such stuff for your sensitive data.

With the little knowledge of your situation I have, it sounds like I would go for a single DNN installation hosting all the systems. Should make maintenance easier since you only have to update/backup/whatever one place instead of several.

Hope I made some kind of sense and good luck with your systems.

Johan Sweden |

2/20/2011 9:44:33 PM #

Selva Sabaratnam

Johan, Thanks a lot for taking the time to analyze and comment.  
I appreciate your great comment on mixing up Application / system data within DNN database. My concern too is that if for whatever reason the DBA decides to rollback the database the DNN might (more than likely) die due to DNN tables being out of Sync with the DNN pages/tabs. As you said the setup and revalidation of our backup procedures for our sensitive data would become another challenge.

My other main concern is .. what if we have geographically seperated teams developing / supporting the individual (sub)systems/child portals that are to be implemented within a single DNN instance. Assuming each team has its own local test and UAT environments (having copies of production DNN database).  How will the individual teams deploy their own modifications without affecting the others/systems?  I see from your posts on module development that Modules and Skins can be packaged.  How about new pages or page changes? How about DB changes that arise outside of module, Skin package installations. Can page related changes be packaged  from the individual development environments and installed on the production server? Won't there be conflicts even on database objects like TabID, Module ID..etc. We are hoping to build an SVN repository for tracking versions of existing source files.  However I am not sure how would one keep track of the DB changes when multiple teams contribute on top of the changes typically applied by DBAs on behave of non-web apps.

Sorry about dumping all my questions onto this comment. Hope my questions make sense.

Selva Sabaratnam United States |

2/24/2011 9:26:03 PM #


If the teams keep their functionality contained in modules and appearance/layout in skins and create proper installation packages for them, it should not affect the others. Regarding content, the simplest practice would be to work against the live installation. You can't package content, although you can export pages (and import them on another installation).
Regarding the "syncing" of databases I really don't have any good suggestions for you.
What I do suggest is that you raise your questions on the DotNetNuke forum. Not because I mind giving my view of it here, but because there are a lot of sharp people there that know DNN inside out far better than I do.

I wish you the best of luck with this integration. It is certainly not a trivial task.

Johan Sweden |

2/25/2011 7:37:54 PM #

Selva Sabaratnam

Johan, Thanks a lot again.  Will try and post my question onto the DNN forum..only when I figure out how to post on that sit that is.
I need to investigate the possibility of packaging up DNN Pages for deployment on to a remote server.  Currently someone with an Admin / Host access has to manually create the pages on the production server and configure the pages with the appropriate modules etc. Our security policy prevents developers from having such access to the production environment and as a result we have to develop elaborate and meticulus deployment steps to cover each DNN page creation/modification and configuration.

Not sure if an entire child portal can be packaged up for the same purpose.  

Thanks a lot once again for your help and wishes!!

Selva Sabaratnam United States |

5/18/2011 11:39:30 PM #

Selva Sabaratnam

I have another newbie question.
How can I access the friendly url string inside my Page_load method of my custom module.

I have to set my Custom module title to a specific text depending on the "friendly URL" string.

My custom module is used in multiple pages using custom module settings. It would be nice if I can customise the module title also depending on the existence of a specific string in the friendly URL.
HttpContext.Current.Request.Url.AbsoluteUri, OriginalString; etc give me only the tabID.

Here is what I would like to do:-

Control ctl = DotNetNuke.Common.Globals.FindControlRecursiveDown(this.ContainerControl, "lblTitle");
linksCat = Request.QueryString["fm"].ToString();

if ((ctl != null))
if ((friendly url string contains "string1"))
string s1 = new StringBuilder().Append("ABC Handbook: ").Append(linksCat.ToString()).ToString();

((Label)ctl).Text = s1;
string s2 = new StringBuilder().Append("ABC Data Sheet: ").Append(linksCat.ToString()).ToString();

((Label)ctl).Text = s2;

I am not sure how to get the full friendly URL into a string variable.

Selva Sabaratnam United States |

5/19/2011 8:58:41 AM #


Think you will find help here:

Johan Sweden |

5/19/2011 5:59:06 PM #

Selva Sabaratnam

Johan thanks a lot! It solved my problem. First of all sorry for wasting your time. I should have done the search myself on DNN site. I like your site better I suppose.

Here is the line I added:-
string originalRequestedUrl = Context.Items["UrlRewrite:OriginalUrl"].ToString();
Once again thanks a lot.

Selva Sabaratnam United States |

5/20/2011 11:27:14 AM #


Glad to hear you got it working! If it helped you out the time was not wasted. Very pleased to hear that you like visiting here instead, but unfortunately I think you usually get quicker answers in the DNN forum. Would be fun to have it the other way round Smile
I wish I had the time to refresh my site with some new exciting content, but right now...

Anyway, good luck now!

Johan Sweden |

9/19/2011 2:57:07 AM #

Selva Sabaratnam

I am having a lot trouble getting an implementaion of client callback event to work from within my (C#) DNN module.
The existing legacy ASPX page works fine (uses ICallbackEventHandler/RasieCallbackEvent/GetCallbackResult..etc).

I am trying to bring it under a DNN page using a custom module.  Understand that I must use IClientAPICallbackEventHandler and its corresponding methods to achieve this under a DNN module.
Searched all over for some sample code but found none.

Wondering if you can point me in the right direction. You may be aware of some useful links that shed some light on using C# to implement "callbacks" within DNN modules.
Kindest regards,

Selva Sabaratnam United States |

Comments are closed

About the addict

Johan Seppäläinen lives in Uppsala, Sweden. He spends most of his days working as a systems architect/developer, specialized in solutions built on Microsoft platforms.
Occasionally there is time for some recreational coding, when he pursues optimal solutions and code zen, mainly in C#. When he is not writing in this blog, that is.