Navigation

Search

Categories

On this page

HOWTO Get the size of a file as a formatted string
WPF development with Visual Studio and Expression Blend
Vista on my Toshiba Satellite M30
World's smallest radio controlled helicopter
I won a copy of Vista !!

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 149
This Year: 2
This Month: 0
This Week: 0
Comments: 43

Sign In
Pick a theme:

# Friday, March 30, 2007
Friday, March 30, 2007 2:54:54 PM (GMT Daylight Time, UTC+01:00) ( .Net General )

Quick and dirty function to return the size of a file in a properly formatted string in KB, MB or GB. There has to be an easier way than this .....

 

    private const double KByte = 1024;
    private const double MByte = KByte * 1024;
    private const double GByte = MByte * 1024;

public static string GetFileSizeString(int bytes) {
        if ((bytes / GByte) < 1) {
            if ((bytes / MByte) < 1) {
                if ((bytes / KByte) < 1) {
                    return String.Format("{0} B", bytes);
                }
                else {
                    return String.Format("{0} KB", Math.Round((bytes / KByte), 2));
                }
            }
            else {
                return String.Format("{0} MB", Math.Round((bytes / MByte), 2));
            }
        }
        else {
            return String.Format("{0} GB", Math.Round((bytes / GByte), 2));
        }
        
    }
Comments [0] | | # 
# Sunday, March 25, 2007
Sunday, March 25, 2007 10:34:32 PM (GMT Daylight Time, UTC+01:00) ( )

Started work on a small personal project using WPF and ClickOnce today. I'm using Expression Blend (RC) to design the interface and VS for the code. I can open the same VS project in Expression Blend, both environments detect file changes but with that popup message. Blend makes it easier to add controls and set properties, but it lacks intellisense, tag completion and code formatting that the VS XAML editor has. I hope this is added in the final version.

Here are a few reasons why I think WPF/E is better than Flash, though I think it won't be a Flash killer yet.

  1. Data binding: Flash does not come with any of this out of the box, it has to be done using Action script. WPF has extensive support for data binding. Binding to an XML data source is done easily in XAML using declarative code. This makes it easier for the designer types to add data integration without having to rely on an action script developer for the task.
    Update : WPF/E however does not have databinding in the current CTP build. See point 3, which makes it not so bad.
  2. Source is available: If I find really cool whizz bang work created with WPF, I can look at the source and see how it's done. This is similar to HTML and CSS where one can look at the code and copy/learn/link. This leads to more reusable code and gets people sharing great WPF implementations. Can't do this with Flash now, unless a decompiler is used.
  3. Generate XAML from the server: Since all it takes is to have the web server serve up a xml file it is possible to generate customized interfaces based on backend data. XAML from ASP .Net

More on WPF vs. Flash

http://donburnett.wordpress.com/2007/03/07/poor-maligned-and-misunderstood-by-many-wpfe/

http://thewpfblog.com/?p=17

http://www.nukeation.net/PermaLink,guid,ea198313-623e-400f-be22-82c242b5812c.aspx

Comments [2] | | # 
Sunday, March 25, 2007 10:32:20 AM (GMT Daylight Time, UTC+01:00) ( Odds & Sods )

My Vista installation has to wait a while longer. Toshiba does not support Vista on the Satellite M30 and considers it an out of date model ( ??? ). Though the hardware is perfectly capable of running Vista with Aero glass. NVidia doesn't have Vista drivers for the GeForce Go 5X series GPUs. There are hacky ways of getting this to work, but these are not stable so far from what I've read.

However, I'm in the mood to buy a new laptop. I'm looking at the Toshiba P100 series of laptops, as they have a decent mix of features i.e good graphics Nvidia geforce 7600 with at least 128 MB of video ram, IGB of memory and a 100gb hard drive. My budget for all this is about £1000. I play games on my laptop and it serves as my main entertainment center therefore it should have a  decent graphics card. Should be able to run secondlife and need for speed :). I've narrowed down my requirements and now just need to hunt around the shops more till I get it for as cheap as possible. It's cheaper to buy a laptop with 1 GB of RAM and upgrade it later. Crucial is selling 2 GB kits for less than £100. The price difference between a 1GB laptop and a 2GB model is close to £250.

Comments [0] | | # 
# Saturday, March 24, 2007
Saturday, March 24, 2007 5:40:27 PM (GMT Standard Time, UTC+00:00) ( Odds & Sods )

I bought a Picooz on impulse a few weeks ago. I saw it on display and it was only £30 and it gave me a "What the heck, its only 30 quid" moment. Turns out that I've bought the world's smallest RC helicopter, weight about 10 grams. Though it is small, it does have a lot pf power in it. The copter charges from the RC controller and takes about 20 minutes to charge for a 5 minute flight.

It's hard to control it at first, though I'm getting the hang of it. It's a very forgiving toy and handles all the bumps and crashes very well. Indestructible so far :). Getting the Picooz to fly forward took a bit of hacking it. It has a tendency to fly in circles and get into an un-controllable spin. This happens even after trimming. I added a nose extension, which looks like an antenna to add a bit more weight to the front so it can fly forward slowly.

Comments [0] | | # 
# Monday, March 19, 2007
Monday, March 19, 2007 10:03:51 PM (GMT Standard Time, UTC+00:00) ( Windows )

I should be receiving my copy sometime this month. This was for answering a question after the UK  Vista and Office developer launch event. I thought I didn't  win since I didn?t get the email from MS. Yesterday I requested a list of the winners and my name is on the list.  Yippee !!  :)

Ok, now I have to find a laptop to run it, my current laptop is showing its age. In retrospect, I should have entered the Office competition because I would be able to use that on this laptop. 

Comments [0] | | #