All posts by Steven

Renaming MVC Application Ambiguous

Seems when you rename a MVC application in ASP.NET MVC and then perform a ‘Clean Solution’ and ‘Build Solution’, well it doesn’t exactly clean.

Just friggin’ lovely.

Go into your applications ‘Bin/’ folder and delete all the files there first, then perform a ‘Clean Solution’ and ‘Build Solution’ and enjoy!

Caturday Browser Memory Tests

I saw this posting over on Fark yesterday and knowing how the previous Caturdays go I knew it would be a page filled with images, links, loads of text – a great page to do another quick browser memory test on.

So I started the browser, set the home page to nothing, closed. Started browser, pasted URL into the address bar hit enter. I then waited ten minutes for various memory collections to happen and give each browser a period to “stabilize”.

Capture 

Here are the browsers I tested;

* IE 8.0.7100.0 64-bit – 248MB used
* IE 8.0.7100.0 32-bit – 245MB used
* Maxthon 2.5.1.4751 32-bit – 234MB used
* Opera 9.64 Build 10487 32-bit – 234MB used
* Firefox 3.5b4 32-bit – 137MB used
* Google Chrome 2.0.172.30 32-bit – 62MB used

So I guess the proof is in the memory usage, speaks volumes for WebKit to me.

Enjoy!

Firefox memory usage is out of control

Well I am about at my breaking point with using this release of Firefox (v3.0.10), seems there is *REALLY* something seriously wrong with its RAM consumption.

I have three pages open in the browser and its is using over 1GBof RAM, yes that’s right over 1024^3 bytes of RAM;

firefox_really_part_two

So I think well hell surely somebody see’s this as a problem and most likely there is a fix or something. Well I was sorta right;

firefox_really_part_one

That nugget of wisdom is found here.

Its no damn wonder people are using IE and Chrome. Bah!

Browser Memory Usage

Surprising to me how much difference is between three major browsers memory consumption rendering the same pages.

I loaded up two pages in;
FireFox 3.0.10
Internet Explorer 8.0.7100.0
Google Chrome 2.0.172.30

The memory difference is 10 fold. Firefox is over 250 MB, IE around 60MB (each tab gets its own process its seems in IE8) and Chrome around 20MB.

mem_usage

Wow. One would figure the Mozilla team would do something about that. Seems to me that something with memory management really isn’t being done correctly.

Apple Development

Decided I would be adventurous and try to develop something for the iPod + iTouch and make millions and live the life of a pimp daddy – or something like that.

So off I adventure to figure out what it takes to develop an application, get the application to the Apple store and be able to cash the checks from Apple.

Seems this task is its own hellish task. The Apple SDK is only designed to work on a Macintosh machine, so that’s problem #1 for me.

The Apple SDKis $100, not horrible but why? I guess this is just to ensure (presumably) that the people developing apps for the Apple store are serious? Seems to me that Apple would just give the damn SDK away – they already require that you have a Apple Macintosh OS to develop for it anyhow.

Then it seems that Apple (for whatever damn reason) decided to use Objective-C for their SDK, not C++ or even C, yes Objective-C. As a non Apple fanboy I don’t get why on earth they wouldn’t just use something that the rest of the development world uses – ie; C++.

So my first task down this journey will be to figure out if I can get OSX86 working on a standard PC. Yay!

Upgrade of Vista to Windows 7

Well I had a wild hair thinking that I could recover some RAM usage by upgrading from my current Windows Vista Ultimate to the Windows 7 RC1 (Build 7100). Why not I figured if it blows up then I will just whack it all and re-install Vista anyhow.

My machine is a Q6600 (Quad 2.4 Ghz) with 6GB of RAM. With just Vista at a cold boot it consumes 2.2GB of RAM!;vista_64_mem_usage

I thought for sure that upgrading to the latest Windows 7 RC1 would lower the memory usage. But after the upgrade (which took about 2 hours, blah) I still have 1.25GB of RAM being used by just the OS.

One really has to wonder what the hell Windows is doing with all that friggin’ RAM. I mean seriously over a gigabyte of RAM? I dual-boot into Ubuntu 9.0.4 and its using 250MB of RAM to the desktop. Really makes you wonder.

TraceListener and writing to a listbox with EventHandler

So say you want to have a Trace listener setup to listen for any Trace outputs and you would like to take the Trace Write outputs and put that into a listbox.

This shows you how to setup a custom eventargs, custom TraceListner and then add the custom Trace listener to add messages received to a listbox.

Make a new custom EventArgs like this:

[code:c#]    public class EventListenerArgs : EventArgs
    {
        private string _message;

        public string Message

        {
            get { return _message; }
            set { _message = value; }
        }

        public EventListenerArgs(string Message)
        {
            this.Message = Message;
        }
    }[/code]

Then setup a custom TraceListner that implements the EventListener above like this;

[code:c#]    public class EventFiringListener : TraceListener
    {
        public event EventHandler<EventListenerArgs> WriteEvent;

        public override void WriteLine(string message)
        {
            EventHandler<EventListenerArgs> temp = WriteEvent;
            if (temp != null)
            {
                temp(this, new EventListenerArgs(message));
            }

        }

        public override void Write(string s)
        {
            EventHandler<EventListenerArgs> temp = WriteEvent;
            if (temp != null)
            {
                temp(this, new EventListenerArgs(s));
            }

        }          
    }

[/code]

Then in your form (where you have the listbox) create the custom TraceListener and add it to the TraceListener collections;

[code:c#]

EventFiringListener listener = new EventFiringListener();
listener.WriteEvent += new EventHandler<EventListenerArgs>(listener_WriteEvent);[/code]

And the method event could look like this;

[code:c#]        void listener_WriteEvent(object sender, EventListenerArgs e)
{
        this.listbox.items.add(e.Message);

}
[/code]

Enjoy!

Subsonic Delete Example

Subsonic seems to be really all that for DAL (Data Access Layer). In this example I have a table named “DvdNote” that a struct was generated by the Subsonic SubCommander tool.

Example on how to perform a delete statement;

[code:c#]                    SubSonic.Query qryDelete = new SubSonic.Query(DvdNote.Schema);
qryDelete.QueryType = SubSonic.QueryType.Delete;
qryDelete.WHERE(DvdNote.Columns.DvdnotePkid, this.Identity);

qryDelete.Execute();[/code]

Syntax highlighting, ftw! Hurrah!

Subsonic Simple Select and IDataReader Magic

Simple code snippet on using Subsonic Query for selecting data back.

[code:c#]

SubSonic.Query qry = new SubSonic.Query(Usr.Schema);
qry.SetSelectList(Usr.Columns.UserPkid);
qry.QueryType = SubSonic.QueryType.Select;
qry.AddWhere(Usr.UsernameColumn.ColumnName, SubSonic.Comparison.Equals, Username);

using (IDataReader reader = qry.ExecuteReader())
{
    while (reader.Read())
    {
        userpkid = long.Parse(reader[Usr.Columns.UserPkid].ToString());
    }
}

[/code]

Javascript Model Window Wont Fire Page_Load

I have a page that fires a popup window and in that popup window I have some logic that I need to perform in the Page_Load.

Works great the first time as the popup window gets created, the problem is each subsequent call does not fire the Page_Load event. This is because the form is still in memory and has not disposed.

So the secret to making the form go away on close code like this;

[code:c#]

        // a script to be run in client-side
        string scriptStr = “<script>window.close();</script>”;

        // send the script to output stream
        ClientScript.RegisterClientScriptBlock(typeof(string), “closing”, scriptStr);

[/code]

On the ASPX page put this as the very first line (as in line #1);

[code:html]<% Response.Expires = -1;%>[/code]

Super!

Enjoy!