Should I Be Ashamed…

category Uncategorized admin Thursday 12 March 2009


My computer geek score is greater than 100% of all people in the world! How do you compare? Click here to find out!

I was assuming that I’d get something like 70% or so but %100… I’m not that geeky…

MCTS Study Made a hell of a lot quicker with FastSharp

category C# admin Thursday 12 March 2009

I blogged about FastSharp a couple of days ago, and today I sat down to do some studying for my .Net Fundamentals MCTS Exam (70-563) and it occurred to me that FastSharp might prove useful, it really has.

Previously I’d been a little reticent to open up a new project to compile and test the fragments of code in the book, now I just keep a copy of FastSharp open and type in the fragments and run them, it’s as easy as Pie.

It would be nice if it supported methods and extra classes but once you get to that level of complexity you should be using Visual Studio, for the first few chapters it’s really useful.

At first I thought it was a bit annoying that it doesn’t do code highlighting or intellisense, however, when you are first starting to work in a programming language these things can get in the way, because you are being helped by the IDE you don’t learn as much.

I certainly think that I have a better functional knowledge of Java because I started working in Emacs rather than Eclipse which I use at the moment. But thats a discussion for another day…

kick it on DotNetKicks.com

Fast Sharp

category Uncategorized admin Tuesday 10 March 2009

Matt Mannella has written a nice looking small app that will execute lines of C# for you so you can answer your quick coding questions without having to create a project file.

I’ve yet to try it out, but it has potential to be useful, so I’m writing about it here.

IDE Idiosynchronicities

category C#, Eclipse, Java, Visual Studio admin Wednesday 25 February 2009

I’ve been coding in Eclipse for the past two months and now I’m back to using Visual Studio and it’s wierd I keep on expecting Visual Studio to throw a hissy fit whenever I mistype something, or use a class name that doesn’t exist yet.

Those features I found really annoying when I started using Eclipse seem to have become normal to me. Yeah I still find them irritating, but they are also really useful, because they tell me straight off when I’ve done something wrong.

I don’t miss the Auto formatting truncating my lines, and I don’t miss is highlighting every variable I’ve not used as a warning the second I type it, but I do miss it’s abbility to just correct things on the fly by hitting ctrl-1 to create new methods and classes.

It’s swings and roundabouts really, I doubt I’ll ever be fully happy with either IDE but now I find myself pausing after I write something I know is wrong and expecting it to highlight that fact so that I can fix it.

Some part of me thinks that reliance on IDE features makes you a worse programmer, it does make coding faster if you know all the short cuts, but the second you switch IDE or go to a different language all that specialized knowledge is wasted, and you code slower because you rely on the “Helpful” features your IDE of choice provides you with. Sometimes I think maybe I should just go back to coding in emacs, I think I might have been a better coder when the only IDE features I used were syntax highlighting, line numbering, and the abbility to cut and paste code.

I’ll be writing up a list of things that I think Java is  missing that C# does better at some point in the near future, and maye do it the other way round. As a cross platform developer I find this stuff interesting.

My current pet peeve with Java

category C#, Java Omar Thursday 22 January 2009

My current pet peeve with Java is the inconsistency in the naming of methods and properties.

An Array has a length public property.

Most Collections have a length() method which returns the length.

Except some (Like the linked list) have a size() method which returns the size.

I guess this also applies to C# which has either length or count, properties… But at least count is consistent accross pretty much the whole Collections framework in C#.

I might put together a list of things I like about Java and a list of things I like about .Net that might actually make a good post. You never know.

Cleaning up after source safe

category Development, Source Control, Visual Studio Omar Tuesday 6 January 2009

First let me get this out of the way I hate Source Safe with the fiery passion of a thousand suns, but it’s the source control provider my work uses so I’m forced to deal with it.

Today I was sent a request from my manager to look at some old .Net 1.1 code with a view to porting it Java, I dutifully checked it out of source safe and tried to open it in Visual Studio 2008 and was unsurprisingly taken to the project migration window. I was expecting this as each version of VS uses slightly different project files I I clicked through to “Updgrade” the project to be used by VS2008.

This is where Visual Studio fell over horribly, there were files that couldn’t be checked out, or that had locks on them or some other problem but the net result was that I couldn’t get Visual Studio to open files that were on my own machine… Which is rubbish.

I decided to trick Visual Studio into thinking that the files weren’t under source control by deleting the VSS meta files; namely the  .scc and .vssscc files, this didn’t work because visual source safe also stores data in the .sln files and the .csproj files.

Doing some diging into the files I found a section in the .sln that mentioned source control and deleted that, namely the global section starting with this line:

GlobalSection(SourceCodeControl) = preSolution

In the .csproj the following lines needed to be deleted:

    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>

Basically anything mentioning Scc

and if you have an installer you have to open up the .vdproj file for that and also remove any references to source control:

"SccProjectName" = "8:\"$/project path"
"SccLocalPath" = "8:..\\..\\..\\.."
"SccAuxPath" = "8:"
"SccProvider" = "8:MSSCCI:Microsoft Visual SourceSafe"

Is that it? Of course not, the fact that you are using a rubbish source control system is also stored in the solution user options (.suo) file, which you can’t just jump into with a text editor and mangle as it’s binary…

Luckilly the .suo is regenerated when you start up the IDE and open a project so you can just delete that…

Voilla it works…

so In summary:

  1. Delete VSS files (.scc, .vspcc)
  2. Clean Solution (.sln) file
  3. Clean ALL project (.csproj) files
  4. Clean deployment project file (.vdproj)
  5. Delete user options file (.suo)

Friends don’t let friends use source safe…

Oh and credit where it’s due I found this site after I’d figured this all out… Typical.

http://www.knowdotnet.com/articles/removefromsourcesafe.html

kick it on DotNetKicks.com

Home Beta First Impressions

category Gaming, PS3, Playstation Home Omar Saturday 29 November 2008

So I checked my e-mail yesterday, and found an invite to playstation 3’s Home beta. Now I’ve had a whirl of I thought I’d post some of my impressions.

Firstly I Akcnowledge that home is still in beta so it’s not finished, and thus I can’t really comment on the final product just the current version. Bearing that in mind:

Character Creation:

The character creation has a lot going for it, you get to create a representation of yourself that is a lot more realistic than what Nintendo’s Miis or Microsofts avatars have to offer.

You are presented with a set of default facial structures and are given the opportunity to modify it to your hearts content.  While it’s not quite as customisable as say Oblivion’s character creation, it’s damn near close. The way you change your face is also quite novel, you use the analog sticks to move a dot to a point in a 2d space, wher the 2 axis are facial features. it’s quite intuitive.

Once you are done warping the face of your avatar into submission you then get to choose your body type, skin colour and… hair. This is where my first gripe comes into play.

The options for both hair and facial hair are really disapointing, there is no really long hair for girls or guys which meant both myself and Annabel found it hard to make our avatars look like ourselves, this ia okay because it’s an approximation so we both eventually managed to settle on something that fit, where the hair really falls down is facial hair, which presents you with a selection of moustaches most of which are comical at best and not a single beard or goatee… I’ve not been clean shaven in 10 years, how am I supposed to make an avatar that looks like me if I can’t give it a beard?

The clothing choices are equally disappointing, guys get a choice of jeans combats or sweat pants, no choice of colour, the choices of tops and shoes are equally uninspiring. And there are only two pairs of glasses for guys and girls both have different glasses, which is a shame because the guys glasses look similar to Annabels glasses where as the girls dont.

Basically the choic of clothing is really unispiring, there are no shorts no hawaian shirts, and there is no opportunity to change the colour. Because of this every one looks really similar.

On to the various locations:

Harbour Studio:

This is your Home in Home as it were,  it’s nice if a little bland, the only thing I’ve managed to do here is move about some furniture and change the wall paper, it seems there will be other furniture items but for the time being there is the default furniture and you will like it. I’ve emptied out my apartment as there is no real point in having any furniture in it…

This is where you get to see the world of home for the first time, and to be honest it’s very pretty, but until they give me something to do here, it’s also very boring.

Home Square

This is how you navigate Home, it’s a big square with a garden in the middle and a bunch of surrounding buildings. In the garden you can play chess or draughts, other than that there isn’t much else to do here aside from stare at the video bill boards, which show adverts for PS3 games…

Shopping centre

I headed to the shopping centre thinking that maybe they didn’t want to clutter up your choice of furniture and clothing in Home and that you could pick them up here… There are 4 types of shops in here, clothing, furniture, “Stuff” and estates (which I assume lets you buy a bigger house?) none of which were open for business… Entering a store takes you to an empty playstation store screen, that is it.

Amusingly though there were two guys, wearing the echodrome suit, robot dancing on the steps in the pool here. You can get the echodrome suite in the bowling alley which is our next stop…

Bowling Alley

This is as far as I can see the only reason to visit home… You can play bowling pool or any of three arcade games here.

The bowling is quite fun, but it’s nothing special. The controls in pool are terrible, the arcade games however are quite fun. This brings me to the biggest issue with the bowling alley, it just doesn’t scale… There are 10 arcade cabinets, 3 bowling lanes, and i think 6 pool tables. if these are occupied then there is nothing for you to do. I’ve yet to play one of the arcade machines because it was constantly occupied.

If I wanted to wait around to play games I’d go to an actual arcade…

Theatere

This is another pointless addition to home you can wonder about a cinema and watch trailers. To watch a video clip you go into a screen and watch a video, many of which seem to be completely random with no indication what it on the screen untill you enter and start watching.

Once you have started watching a video you can’t fast forward pause or rewind, and it’s not full screen either but instead rendered on the theater screen, the best you can do is zoom in a little bit.

Conclusion

All in all home is very pretty and could evolve into something fun, but to be honest it just seems a little bit pointless…

Stubborn Services II

category C#, Development, Services, Visual Studio Omar Wednesday 17 September 2008

In my last article on Stubborn Services I was having issues uninstalling a service that I had installed. Today I was having a problem with a service that started and stopped straight away.

I’m sure most people have come accross the problem of a service they have written giving you the following error:

The service started and then stopped. Some services stop automatically if they have no work to do…

The problem is that because the service starts and stops so quickly you don’t have time to attach a debbugger to the process. Thats where System.Diagnostics comes to the rescue.

if you put the following line of code in your services OnStart method:

    System.Diagnostics.Debugger.Launch();

Then when you start the service you will be prompted to open the your debugger of choice to debug the service. this lets you see whats going wrong. In my case I’d forgotten to initialize a path for an event watcher.

Hope this is useful to someone.
kick it on DotNetKicks.com

Watch your step on the XPath

category C#, Development admin Friday 12 September 2008

I learned something today…

I had written some C# code to itterate through an Xml file while contained a bunch of dumped rows from a database and stick them into another database.

I had a list of fields that I was expecting to be in the Xml file so I did something like this:

XmlNodeList nodes = xmlDoc.SelectRows("tableName");
foreach (XmlNode node in nodes)
{
    foreach (string fieldName in _fieldNames)
    {
        node.SelectSingleNode("//"+fieldName);
        // Snip... Do something with the field
    }
}

Now I ran this on a 12 meg Xml file and was surprised that after a few minutes it wasn’t done… I stopped the debugger and the code was chugging away quite happilly it was just taking a hell of a long time to get things done.

I expected it to maybe take a while, but having timed it it was taking 1,350ms to process each row which given the data size meant that it would take just about 4 hours to process the whole document.

I suspected something was wrong with the code that processed the row, so I took it out. just iterating through the rows took about the same time as above.

To cut a long story short the reason that my iteration was taking so long was because of five characters…

"//"+

.

Thats the XPath syntax to search the whole section for a node ignoring the hierarchy. I’d used it assuming that since the Xml node was only one deep it wouldn’t matter but no…

Once I’d taken out the slashes the entire file processed in about 3 seconds.

Go figure…

kick it on DotNetKicks.com

Overriding ToString() Makes Debugging Easier

category C#, Development, Visual Studio Omar Thursday 11 September 2008

How many times have you looked at a list of objects and had this “useful” view?

God only knows which of those objects is which, if you want to know whats in each of those classes you will have to expand them one by one and search through possibly hundres of instance variables to discern what is in each of them.

If only there was an easier way, a way that you could format some of the instance variables to make each of those object make sense.

Well there is, that display you get when you mouse over an object is the output of that objects to string, since most objects don’t override ToString they just shoe the default objects info, which is useful for telling what type of object it is but not much more than that.

Now having overridden ToString you get the following output:

public override string ToString()
{
      return String.Format("Name: {0}, ID: {1}, Date: {2}",_name,_id,_date.ToString());
}

And hey preso! I’ve been meaning to post this for ages as I’ve yet to meet somone that hasn’t found it interesting, but I’ve never seen anyone mention it online.

kick it on DotNetKicks.com