Tuesday, October 31, 2006

In my last post about memory leaks, I emphasized the importance of calling Dispose. This time I’m going to talk about how you can see how much memory your application is using.

You probably think that I think you’re stupid… Right? Right now you say to your self

Of course I know where to find my app’s memory usage! I’m not f$£@&g stupid!

Ok. I get it. You of course go to the task manager and look at the memory usage column for you app. Right? Wrong. Don’t do that. It dos not tell you anything about your app’s memory usage. Why? First here’s an example to make a point (or rub it in…):


.Net application just started.

Here I have started my test application and as you see it has a memory usage of 11 696K.

The funny thing is that if you minimize the application it only has a memory usage of 812 K.


.Net application minimized.

What happened? Did all my objects just disappear when I minimized my app. I don’t think so! The problem is that Mem Usage equals working set (http://support.microsoft.com/kb/293215). And what dos working set tell you? One of the more common definitions of working set is;

The working set of a process is defined as the number of virtual memory pages that it is allowed to keep resident in RAM.

In other words; it dos not tell you how much memory your app are using.

Now we know that Mem Usage is not much use to us, what CAN we use? What you want is your applications private memory. Private memory is the actual space in memory your application use. And as it happens, you can find that column in Task Manager as well… Only it’s called Virtual Memory. Go figure. In Task Manager go to View -> Select Columns…, and select Virtual Memory.

So my advice to you is to get rid of the Mem Usage column and replace it with Virtual Memory. Do this on all the computers at your office and tell everyone!

Tuesday, October 31, 2006 1:00:00 AM (W. Europe Standard Time, UTC+01:00)
 Monday, October 30, 2006
Last week I created a new blog powered by DasBlog. In order to use it you need to have some knowledge of html and CSS. .Net might come in handy as well. I guess most bloggers who are using DasBlog are developers, but it’s not restricted to developers.

Here is what I did to set up my blog:
  1. Downloaded the source for DasBlog at http://sourceforge.net/projects/dasblogce
  2. Unzipped the binaries. I did not use the source, but you can do that as well.
  3. In the unzipped folder I found readme.rtf, which basically tells you exactly what I’m telling you now.
  4. I then started the vb script file CreateDasBlogVdir.vbs. This script prompts you for a virtual directory and then sets everything up in IIS.
  5. After that I had to change the password for the admin user by editing the file dasblogce\SiteConfig\siteSecurity.config. Look for the tags.
  6. Now I could run DasBlog with http://localhost/DasBlog.
  7. I then used the admin user with my new password to start configuring DasBlog.
  8. The last thing I did was to create my own theme by copying an existing theme and tweaked existing CSS files, creating my own graphics and so on.
I found the theme Elegante which I though was quite nice, but I tweaked it a bit. Here is an overview of the file structure for this theme (I only show the most important files):

dasblogce
+ SiteConfig
- site.config
- siteSecurity.config
+ themes
+ YourTheme
- dayTemplate.blogtemplate
- homeTemplate.blogtemplate
- itemTemplate.blogtemplate
- admin.css
- base.css
- items.css
- rightSide.css
- theme.manifest
- web.config

File descriptions
site.config - Contain all configuration settings. Same as Configuration tab in DasBlog admin.

siteSecurity.config - Use this file to change admin password and add new users. This is also available in the User Settings tab in DasBlog admin.

dayTemplate.blogtemplate - Contain the date header for all blog items published on the same day.

homeTemplate.blogtemplate - Her you’ll see the complete structure of the site. If you want to change where the different elements are displayed (e.g. put the navigation menu on the left side), you can do this here.

itemTemplate.blogtemplate - This contains the structure of every blog item (post). Make changes here to alter the structure of information in a blog post. E.g. make changes that go beyond CSS.

CSS files - All descent themes have CSS files. You can either create you own set of CSS files and use them in the *.blogtemplate files, or you can change existing CSS files to your liking.

theme.manifest - This file is very important. Without it your theme will not work. DasBlog is looking for manifest files under the themes folder when it collects all available themes. Have a look at it and you’ll see it’s quite intuitive.

Issues
I had some issues while setting everything up. The first problem was while clicking trough the available themes to see if I found any I liked. When I selected the Mobile theme, I was unable to change to another theme. The Mobile theme did not display a dropdown for changing themes as the others did. If you have a look at site.config file, you’ll see that it contains a <theme> tag which holds the current theme. Change this to a theme of your liking.

My second issue was figuring out how to remove the themes dropdown. I didn’t want this on my site, so I change the file homeTemplate.blogtemplate. As I mentioned earlier this contains the base structure of the site, so if you want to do any structural changes, this is the place.

The last and most important issue (which is still not resolved) is publishing DasBlog to Windows Vista. As you know (because you red this post), I’m running my blog on Windows Vista Beta 2 and IIS 7. It seems as DasBlog is trying to access some registry information about the current time zone and are denied access. I guess I’ll just install the source and see what I can find out, but that have to be some other time. For now I’ll have to continue using Blogger. It’s fine, but as a developer it’s nice to have a bit more control and options. And I also liked all the features in DasBlog which is not available in Blogger.
Monday, October 30, 2006 1:00:00 AM (W. Europe Standard Time, UTC+01:00)
 Sunday, October 22, 2006
Right now I’m working on getting a new blog up and running with DasBlog. I’m not dissatisfied with Blogger, but I rather like the idea of having complete control of the blog source and binaries on my own server. I also like the idea of DasBlog being open source. I haven’t had too much time playing around with it yet, but I’ll try to be up and running with a new blog during this week.
Sunday, October 22, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
Scott Guthrie (General Manager at Microsoft Developer Division) writes in his blog that ASP.Net AJAX Beta 1 was released on Friday! If you want to download go here, for more information go to http://ajax.asp.net/ or se Scott’s blog at http://weblogs.asp.net/scottgu/.

I have not done any real development in any language supporting the AJAX phenomenon yet, so I’m really excited to get started and see what all the fuzz is about.
.Net | Ajax | Web
Sunday, October 22, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
 Wednesday, October 11, 2006
At Wednesday 18th of October we will have a new meeting at NNUG in Bergen where Bård Strøm will talk about Agile development and I about Memory Leaks in .Net.

Agile development
In Norway agile development gain more and more popularity. Statistics show that 3 out of 10 software projects are delivered as ordered, but 7 out of 10 fail completely or partly. Based on techniques like extreme programming, agile development presents techniques to create products not only with higher quality but delivery on time, to the customer’s satisfaction.

Bård will talk more about this in his talk, so don’t miss out on this.

Memory Leaks in .Net
In a previous post in my blog I talked a bit about memory leaks and the importance of the dispose pattern. At my talk at NNUG I will go into the heart of the problem, show you the tools necessary to detect these leaks, demo common coding mistakes and show you some guidelines on how to avoid these errors in your software.

So if you live in Bergen, Norway don't miss this out. Go to http://www.nnug.no/Avdelinger/Bergen/Moter/Brukergruppemote-Oktober/ to register.
Wednesday, October 11, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
 Wednesday, October 04, 2006
After a long disagreement with our IT manager I finally ended up with a HP Compaq nc8430. The detailed spec is still a surprise (for me that is).

I first asked for (or rather demanded) a new Dell. I have owned and used dell laptops daily since 2001 and have been very satisfied, especially with the screen, resolution, and the simplicity of changing components (hard disks, memory etc.). Basically I’ve never had any problems with my Dell laptops (even though I know others have), so therefore I wanted to go for what I knew was good, safe and was comfortable with.

But at my great surprise our IT manager refused. At first I thought he was kidding. He told me we only buy HP. Well, I didn’t really care what “WE” buy; “I” wanted a Dell. His reasons where:
  • If something goes wrong with the computer, he knows where and how to send it to get it fixed.
  • If I need replacement parts he knows exactly what and where to get them.
  • If I get a Dell all the others want one to.
  • And others that I don’t remember…
For the first point I must admit my previous laptops had a few problems. I remember one time I had a hard disk crash (can’t blame that on Dell though…). And what did I do? Sent it to my IT manager to get it fixed? No, of course not, that would take to long. I’m a developer, computer freak and nerd! I’m too proud not to fix it my self. I got a new disk, installed it, and problem solved.

When it comes to replacement parts, I have no problem ordering it my self. I know where to send the bill. Actually we’re still a quite small company, so this is no problem. I order stuff all the time.

The last point I’m not even sure I want to address, but since I put it there I guess I have to. Well, maybe if “everybody” else wants Dell, we should consider using Dell instead of HP ;) (I might regret this comment, but what the heck…)

The last issue I want to address is you reading this and are probably thinking one of two/three things. 1. I work for a ridicules company. 2. I’m a spoiled little brat. 3. Or even that my IT manager is a dork.

Well, my company is actually a great company to work for and even my IT manager is a great guy. We only disagree on this specific issue (I hope. I might have created another posting this.). Am I a spoiled little brat? I guess I am, usually I get what I want! Only not this time… And when I don’t get it I usually tell somebody. Only this time I told everybody…
Wednesday, October 04, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
 Monday, October 02, 2006
On Sunday I started installing Windows Vista on a computer I have running at home. My initial thought was just to test the OS, install some software and take it from there. But when I started playing around with IIS 7 I could not resist publishing my blog on my new OS. And it works great. Vista seams quite stable (no problems so far), but my greatest worry is my ISP and my wireless home network connecting my computer to the Internet. When that is said, please let me know if my blog stops responding :)
Monday, October 02, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
If you have bought or planning to by a ticket for TechEd in Barcelona, you can register yourself at NNUG (http://www.nnug.no/Tech-Ed-2006/Hvem-skal-pa-Tech-Ed/). By doing this you tell NNUG and other members that you are going and where you are staying (which hotel). Then we can get together for a beer or a bite outside the daily techno babble (not mutually exclusive of course).
NNUG | TechEd
Monday, October 02, 2006 1:00:00 AM (W. Europe Daylight Time, UTC+02:00)
 
Aggregate Me!
Feed your aggregator (RSS 2.0)  Rss
Locations of visitors to this page