The inaugural CodeFest 2008 is over. Attendees Clarence Bakirtzidis and myself made our first 3 silverlight apps. Though I have made a small one before for work.
Showing some images
Showing a video
We spent a day from 10 am and it was a lot of fun.
We used Microsoft live to host the silverlight apps as its free, the only hitch is it has no database. The video was encoded using Expression Encoder and the code was Developed using Expression Blend2 sp1 and Visual Studio 2008.
Our next attempt will have to be a game, or so we said as clarence left.
Monday, 29 December 2008
The inaugural CodeFest 2008 is over. Attendees Clarence Bakirtzidis and myself made our first 3 silverlight apps. Though I have made a small one before for work.
Friday, 26 December 2008
I found this great post to speedup the firefox startup.
It amounts to settings 4 settings in the about:config
and add integer
"Normally Firefox will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading."
And the initial paint delay of 0 makes firefox render immediately.
Be warned this may break some of your page views. But for me if it gets rid of the annoyingly slow startup while sacrificing a few pages, I can live with it.
If I find any others Ill add them.
Saturday, 20 December 2008
I found this reason to use a DSL today, and it is the best reason to use a DSL I have heard of so far.
"DSL allows business people to read through code and understand what is going on, so they can spot misinterpreted requirements."
I wonder if it is true in practice?
Saturday, 6 December 2008
I ran into this little plug in on CodePlex StyleCop For Resharper the other day. It's still in development but it seems a great idea.
To all the people working on it, keep it up, it looks really good so far.
Friday, 21 November 2008
I found this Plastic Logic e reader a while back. I hope its development is not affected by the global economic slump we are in, this seems such a cool product and much better than the kindle or its ilk. The original release date was Spring 2009 which i assume means March-May. Hopefully its not delayed or even put off.
I was originally tempted by the Illad by iRex as it wold allow me to develop stuff for it too. Well here's hoping the Plastic Logic will be a developers platform too.
Friday, 7 November 2008
Asus and Intel have a new site up for you to suggets your dream PC. I found this one a laptop with 3 screens and I have been wanting one of these for ages. When not plugged in you use one screen to save power, but other times as a developer I really appreciate 3 screens, so it would be a true mobile workstation for me.
Whats your dream PC? Why not suggest it, it can't hurt.
Saturday, 18 October 2008
Haven't posted for a while, I've been using the new stack overflow website of late.
I'm not sure its working yet. The aim of the site is to become the one source of useful answers for code and computer related questions and it is getting a huge number of questions and answers. I've steadily been answering and voting on questions to up my reputation points.
The biggest issue I have with the site is almost no questions end up as wiki style entries. There ends up a long list of answers, some better than others but a combined and detailed answer may be the most useful. I suspect the initial steam to gather reputation and badges will slow down after a while and the site might struggle to maintain the desired wikipedia like feel.
Maybe wiki answers are irrelevant for the long term survival of the site. It remains to be seen.
Check it out anyway its a new resource.
Monday, 25 August 2008
I have had a login problem for a while. Whenever I booted up and logged in I would get to the "Apply Computer settings" message and it would sit for ages.
Well I found a solution last week, refresh your DHCP lease using
in a command prompt. This worked for me and now my boot up time is minutes shorter.
Thursday, 14 August 2008
I discovered today that trackbars in windows forms .net don't support transparency, now why would i want transparency, so that when you put it on a tab control it looks the same as all the other controls. I could have set the tabPage UseVisualStyleBackColor to false but then i get the same old grey controls.
so I searched around today for a transparent trackbar and I found 2.
The first is just a dll from Mick Doherty, with no code, so im a little hesitant to use it in case it breaks
The second was originally on Matt Bird's web site but has now been moved to codeplex TransparentTrackBar as the original link was taken down.
Thanks to Matt Bird for allowing this code to be open sourced.
I hope people find them useful.
Sunday, 3 August 2008
I ran into Microsoft StyleCop the other day. While I disagree with some of its style conventions, I agree with most of them. I can forsee see the day when it will be the default for nearly all C# applications.
To this end I hope JetBrains update ReSharper to be able to auto format to the Microsoft standard. Much of it is boilerplate but it would be really good.
There is a JetBrains enhancement request for this so feel free to add your vote if you are a ReSharper user. (Search for (RSRP-71904) StyleCop / Source Analysis reformatting if the link doesn't work)
StyleCop itself will be adding the ability to auto format code to their coding conventions (http://blogs.msdn.com/sourceanalysis/) and Jason Allor responded to me via email that they will be publishing their style rules in a document soon.
Sunday, 22 June 2008
We have had this problem at work for ages now where we have added 300-400 database scripts to our .net installer project. This included tables, stored procedures, functions, indexes, triggers, the lot. It was a constant pain in the arse adding the files to the correct output directory.
When all we really wanted was a "grab all the files in these directories and copy them in the exact same layout to the install directory when the installer runs" method.
This would be a nice function to have in the native .net installer but it isn't there.
When we move to a better installer maybe they will have a function like that but if your still stuck using the native .net installer projects then we came up with a bit of an easier way to do it, its not a perfect fix but its a bit quicker.
Add all the files to an empty project as content.
This will retain the directory structure of the files as they are on your disk.
Then add this project to your Merge Module or MSI installer project. In the correct directory of the Files view window just add the content files of your newly created empty project.
It has saved me a heck of a lot of time maintaining the directory structure in the installer project. Now I just maintain the file structure on the disk and in our source control.
Now to check out installawhere.
Sunday, 11 May 2008
I've been using Foxmarks a bookmark synchronizer for FireFox for the last year or so.
Its just this little icon on the corner of Firefox
It is fantastic, it kills del.iciou.us by a mile. It so easy its just totally behind the scenes and I can organize my bookmarks using the standard bookmark manager. Check it out if you can. No crappy extra menu like delicious which, when i last used it, had no sub menus and i had to regroup/organize every single one of my existing bookmarks. No way! They lost me.
Firefox is my browser of choice because it forces Microsoft to innovate and competition is a good thing. I encourage everyone to download Firefox and use it as their primary browser with Foxmarks as their bookmark synchronization program, if for no other reason than a monopoly on the internet is not a good thing. I don't mind there being big players and small players but without a critical mass people won't write their pages to work with Firefox, so no one will use it, so there will be a real incentive for Microsoft to create proprietary standards. I'm assuming you are the technical elite or why are you reading a blog on software? Go download Firefox, so it keeps its critical mass, which will keep standards Open and maintain internet diversity.
Its Free! 10/10 Foxmarks! Get Firefox.
Tuesday, 6 May 2008
I found this link that says a bit about the Office 2007 orb.
The old style menu system from Office 2003, Office XP, and earlier versions has been replaced with a brand new interface, which most people call the ‘Ribbon’. Why did Microsoft replace the old style menu with the new Ribbon? Because it was getting to difficult to find the right menu options because the menus were too complicated. The Ribbon is designed to make it easier to find the features that you need to use.
It still doesn't tell me why it doesn't have a word on it, and why it doesn't actually look like a button. Its like its deliberately hidden. I assume there was some logic based upon some statistics but I don't grok this one.
Anyway you can get your old toolbar back it seems.
I ran into this little game today. Gee it can get hard. Its a game designed to improve your IQ, I can understand how it might work.
In addendum, my brothers laptop has easily migrated back to windows XP and he is a happy user again.
In one final comment why is the menu for MS Office Vista an icon, not a word?
Yep that sqiggly round hashy thing on the top left is a menu.
In nearly every other program I have used in windows the menu's are labeled with words. Talk about breaking conventions, no wonder Joel Spolsky was not a fan.
Saturday, 26 April 2008
My brother the other day called me up at work. He'd just bought a new laptop and it had windows vista on it. So he spent the morning trying to install things and had finally given up. He rang me to find out if he could just back up vista onto disks and then downgrade to XP, keeping Vista in case he wanted to upgrade later.
Now my brother has a degree in engineering, and an MBA. He has worked as a materials engineer for a number of years, and then as middle management. Of late he's run his own business. I consider him to be pretty well educated and techno savvy.
So why did he give up on Vista? The learning curve is too big, the hassles of things just not working on it are too big. Microsoft had a morning of his time to ease him into it and it flunked. I haven't even upgraded to Vista as I'd need a new PC at home.
I guess its getting harder and harder for Microsoft to convince people to upgrade as there seems to be very little immediately obvious reason to migrate. Maybe the memory requirements of programs will eventually break the 4GB barrier and with that 64 bit processors will take over and Vista at the same time. Personally I hope it happens. 4GB of memory seems a silly limit to me and I like some of what I've seen in vista, but saying that we have never gotten over the x86 instruction set, so maybe it will just be easier to retro fit everything to XP forever? I hope not.
Tuesday, 15 April 2008
I found an interview with Bjarne Stroustrup of C++ fame on MSDN Magazine where they asked him about DSL's.
I noted that he also thinks DSL's need a general purpose (I used the word broad) language fall back position.
Q: What are your thoughts on DSLs in general? What do you envision as the relationship between DSLs and general-purpose languages?
Bjarne: I worry about the number of languages being designed, implemented, introduced with great fanfare, and then fading away without significant impact. During this—typically many-years long phase of development—a new language consumes significant resources with essentially no returns. I wrote a paper on this phenomenon called "A Rationale for Semantically Enhanced Library Languages" (research.att.com/~bs/SELLrationale.pdf). I argue for using libraries, possibly supported by tools, and a general-purpose language.
I think that a DSL should be a last resort, not a first. If at all possible, the DSL should be firmly rooted in a general-purpose language and standard tool chains. A DSL needs a general-purpose language (or at least a systems programming language) for its implementation and the implementation of its run-time primitives. I think it would be best if a DSL is consciously and firmly paired with at least one general-purpose language so that it is easy to add new facilities through the use of libraries written in that general-purpose language. Obviously, a professional should master several languages, but I do wonder if the sum of complexity of a variety of DSLs couldn't become so high that it became a problem. Also, many (if not most) DSLs seem to "want to" become general-purpose languages.
Here's the full interview if you want to see his opinion on other things.
Sunday, 13 April 2008
Why do we have domain specific languages? They are supposed to make our lives easier for a specific task. SQL is the classic example of this, but XPath and other DSL's exist. SQL does an excellent job of doing what it was designed to do, support database access. Or does it?
SQL began life without and If statement, without assignment statements (:=) and variables but PL/SQL and T/SQL added them to make it useful. SQL has changed its spec 6 times since 1986. To include new features that people thought it should do. Still this is not enough.
I think the concept of a DSL has a a fundamental flaw. They can't move with business requirements and as such they need access to a broader language. This almost defeats the entire purpose of them.
The solution going on around the database world is to replace or integrate the DSL (SQL) with broad languages.(Oracle and SQL Server now support .net assemblies). The other solution is to add the useful features of the DSL into the non DSL (LINQ kind of adds SQL to .net). The point is SQL as the most well known DSL has failed to accommodate the business requirements of the developers world. And yet it is hugely popular and very useful.
The wikipedia entry for domain specific languages makes a good comment. "A domain-specific language is somewhere between a tiny programming language and a scripting language, and is often used in a way analogous to a programming library." And herein lies some of the problems with DLS's.
- DSL's are not libraries. They are not easily extensible. You can add to a library pretty easily. It's nigh on impossible for me to extend Oracle PL/SQL. The only people who can extend PL/SQL are Oracle and they move like a glacier. (Does this mean they are speeding up of late with global warming? ;) )
- DSL's by definition are limited in scope and usually dont' have access to the entire operating system. This means they usually don't cover all of the area's that people want to use them for.
This is a big problem for the developer. Initially you get a problem and let's say you solve it with a DSL, like SQL. It seems a a good solution, the language is designed for the job, its all a neat fit. But inevitably business requirements change and code needs to be refactored. But its a change thats not really in the fundamental design of the DSL, (ie you want to do some maths on data retrieved from a database). You oughta turf the DSL and go with a more flexible solution but you can't. Time and effort has already been invested, there is no time, the impact would not be this one area of the code but would affect other areas of the system. You are forced politically to go with the existing solution and do some kind of work around. The code ends up as a bit of spaghetti as a result and maintainability suffers. This goes on for a while and eventually the entire system becomes a rigid, impossible to morph system prone to bugs and errors due to the enormous complexity.
The problem here was not the change of the system, that happens all the time, the problem was the choice of a DSL.
It is hard to refactor SQL and as far as I know you can't unit test SQL. While functions are supported, classes aren't and using maths libraries in SQL is way out there.
Part of the problem lies in that SQL does not have access to a broad language like C#. LINQ is an attempt to solve this. This traditional boundary of DSL's not having access to the full operating system (which is by design) is a fatal flaw.
So my thought is to be warned when you choose a DSL that will not have access to a broad language. Ask yourself will it work in the longer haul? Can you break out of it to do non DSL specific things? And do this before you are wedded to the code base it will create. They have good bits but they are all flawed. In the end I now try and only use DSL's that have access to a broad language if I reasonably can (note the use of reasonably). Still I like the fundamental structure of something like SQL.
Saturday, 5 April 2008
I was posting a reply to a codeproject lounge comment the other day when I got a response that challenged me to justify why its good multiple inheritance is not in c#.
I'll cut and copy my response here
You don't have to know what every method does of the parent class(es). You just have to implement the interface.
If you don't know what the parent class(es) do then when you modify an existing class structure you may leave in (fail to override) code that will just not work. And that applies all the way up the inheritance tree too. The deeper the inheritance tree the more you have to know if your going to modify the structure. Usually I find just using a class is fine, but modifying a class hierarchy to me requires you understand it on a deeper level.
Now maybe this is just an argument against inheritance in general but multiple inheritance just makes it harder and binds things together more tightly.
In general I'm moving away from inheritance as it has
1. largely failed to provide code reuse on a big scale,
2. has a habit of hiding implementation details and
3. locks in structure based on assumptions/goals that change and make it hard(er) to modify.
The best form of code reuse I have heard of is in components, in particular VB components and they don't use inheritance in that model as far as I know. Though internally the component may.
One of my experiences with the problems of inheritance hierarchies was when designing a bunch of firewire camera classes to grab frames from multiple cameras and save them to disk, in c++. We initially designed a nice little class hierarchy based on a a Basler BCAM library with a common frame grabbing thread. The aim being that if we wanted to use a different library we could just replace the Basler camera library with the new camera library object.
Of course along came a second CMU library and we found that this was trickier than expected. The libraries grabbed frames in a different manner to each other and this is where we went wrong. The first one had a sequence of 1. Set callback in camera library, 2. Start 3. Wait for Frames to arrive. 4. End grabbing frames. The second library had a sequence of 1. Begin Grabbing Frames, 2. Grab Frame, 3. End grabbing frames.
So we tried to fit the second camera library to the existing structure, bad move. Eventually it got done but it was a huge effort just to maintain the same frame grabbing thread code.
It would have been much easier to have had an interface to each library and write code for each type of camera. What really happened is I foolishly believed that the original hierarchy we had defined would apply to all camera libraries and that a new camera would simply slide into our class hierarchy. This wasn't true, we had bound our existing classes too tightly to the Basler library. At that point we should have abandoned modifying the existing class hierarchy and moved to a different code base for the new type of camera library.
The real point about this is that because I had a class hierarchy I thought I should reuse it. If it had been just an interface then I probably would have been less emotionally and politically tied into it. What can I say, I was young and inexperienced, none the less it is a lesson well learned.
The lessons I learnt
- Changing a class hierarchy may impact on many areas.
- Class hierarchies can be hard to change
- Because they are hard to change they can tie you politically and emotionally into a way of thinking
- Inherited code can be harder to reuse than helper classes.
- Inheritance doesn't necessarily lead to much code reuse.
If you want to know the arguments a little further get the book Effective C# by Bill Wagner page 118
Thursday, 27 March 2008
I/we ran into a installer error the other day at work when we were installing on a Windows XP machine. A dialog popped up saying "There is no MTS context object". Then a couple of days later it came up again installing on a windows 2003 machine. So we searched installer logs using the "voicewarmupx" registry key. Check the Windows Installr Team Blog for how to generate these log files.
Well in the end Ben Hounslow (he even gets his name in bold) one of the guys at work found a solution, so if you ever run into this error here is the solution below as cut and paste from Ben's email.
"Microsoft Distributed Transaction Coordinator was installed but was non-functional. This caused the installer to fail with the following error:
This problem can be resolved by reinstalling MSDTC. This can be done with the following commands (entered at the command-line):
[may need to reboot at this point]
All thanks to Ben for this fix. How the MS Distributed Transaction Coordinator became damaged is nobody knows.
Tuesday, 11 March 2008
Better late than never I figure Ill put down my goals for the year. I must be feeling motivated.
1. Marry my gal Susheila. Thats an easy one.
2. Build a web page. The aim is to make a self sustaining, low maintenance web page. I have always wanted a Sudoku helper/hinter. Something that will help me with the tough ones when I get stuck. I plan to use it as an excuse to firstly learn Ruby and web programming which I am sorely lacking in.
Secondly its part of a larger plan to make some money from the web eventually.
Thirdly its an ad for my skills.
3. Search for houses/apartments. This I will leave until later in the year when the housing market has settled a bit.
Well thats all for now and thats probably a big enough list for now.
Wednesday, 5 March 2008
At work we have to record our time on our time sheets. I have never been all that good at doing this, partly making it up each week once I had to fill it in. I've tried a few timing programs in the past but hadn't found a good one.
Recently I looked again. At first I was suggested one by a work colleague. Susheila said "It looks like government made it" when she saw it. So I looked around some more.
Then I found SlimTimer by Richard White. It just kicks arse over the other timing programs I have looked at. All you do is add tasks and select your current task. Then it logs the time you have taken.
Combined with bubbles which puts an icon in the system tray for any url you care to imagine this has transformed my time sheet world. I now actually know what I do each day and for how long. Some tasks that I feel are taking ages, I can now prove are taking ages, which gives me more information to choose when to pull the plug.
The reporting section is one of the wonders of SlimTimer, its just obvious how to use it.
I thoroughly recommend it.
Saturday, 9 February 2008
I ran into a blog entry today Is Microsoft a doomed dinosaur and felt I had to respond.
For me the more I hear and read about Microsoft, the more I think they are doomed. And its not Open source thats going to take over, its sheer middle management inertia that is going to slowly choke Microsoft. A while back I heard Microsoft had 7 layers of management between Bill Gates and the developers. I figure Steve Ballmer has recognized this with his "Developers Developers Developers" speech, the problem here is that as soon as Steve goes the next CEO will be a person who is good at playing internal politics. They will not be an entrepreneur, they will not be an exceptional businessman with an eye for an opportunity like Rupert Murdoch. They will be smart, a great presenter and wear really nice suits. But they won't be what made Microsoft the behemoth it is today.
They will be Big Blue II style middle management rising to the top.
And just like Apple in the 80's during Gil Amelio's tenure at the top, they will slowly drown in company politics and stupid decisions.
In some ways I feel Steve Ballmer is already making some ordinary decisions, that appear to focus on near term profits for and from businesses, not on building communities, but he is trying to focus on developers which I will give him credit for. No one person in IT has all the ideas and one of Microsoft's historic strengths has been to steal other peoples good ideas (Windows, Browsers, tabbed Browsing the list is endless). This is leading to some really good ideas like Silverlight and the profits are growing.
Don't get me wrong, I don't think Microsoft is going to go away pretty much ever, like IBM, but I suspect it will be a long (20-30 year) slow grind downwards, based on the wrong people, too many middle people, average decisions, bad internal culture and some shocks along the way. Eventually they will get to where they do not have a single no 1. selling product in any category just like IBM got to in the 80's. Oh and more people will wear suits to work, than not.
Maybe Steve will have an epiphany before then and split the company up into Baby M's, but you can almost guarantee no one new will do it. It won't be in any new CEO's own interest ever to do it.
But I'll be about retirement age when that happens, so I'll just keep along for the ride.
Monday, 28 January 2008
What is the optimal lines of code per method? How long should you make a function?
For years I've lent on a rule of thumb, every method must be viewable on a single screen. I assume I read it somewhere and it seemed logical to me and I've done it ever since.
Recently though I thought I'd go find where I got this rule from, so I looked up my old copy of Code Complete. In chapter 5.5 How Long Can a Routine Be? it points out a few studies that suggest that my rule of thumb is wrong! Up to 200 lines of code was acceptable per routine. Something made me a little suspicious of this partly due to the fact they were using the word "routine" instead of "method". This leads me to think they were thinking in terms of C routines and also that some of the studies in the book may be out of date. Earlier on the book was even arguing for using routines, well duh!!! Which I find just amazing, still methods must have come from somewhere.
So I searched around the net and found an article on encapsulation and module size. It claims a module is most effective when between 200-400 functional Lines of Code. Which leads to 400-800 lines of code with comments white space etc. Which is more within my thinking.
Still this didn't solve my problem, where did I hear this rule? Well the answers is I can't find it. But I have a guess as to where it comes from. Earlier in Code Complete it mentions "Cohesion" breaking it up into 4 good types, Functional, Sequential, Communicational and Temporal.
- Functional cohesion is when a method performs only one operation e.g. sin, GetLocation, CalculateLoanPayment. I have always striven for this as it makes my code easier for me to understand.
- Sequential cohesion is when a group of things have to be done in order. I find this common enough but each step in the sequence I will break up into functionally cohesive method calls.
- Communicational cohesion is when the method operates on the same data but may do two things on it. I generally don't like methods like this.
- Temporal Cohesion is things that occur at the same time. ie OnLoad
I think that in my efforts to create functionally cohesive methods I have adopted a practice that the studies of the mid 80's did not support. To make a function cohesive I have to see it all at the same time and confirm it really only does one thing. Even now if i run into a big method i bust it down to understand it.
The later study I found, while not directly supporting small methods, pretty much makes it impossible to create long methods while having shortish classes. In the end you would have 2-6 methods per class, each ranging from 65 to 200 lines of code.
Code Complete hints that functional cohesion is the most important of the cohesions and it seems pretty obvious to me. One method to do one thing, how easy is that?
What this leads me to believe is that a new generation of developers have been trained in OO methods and think differently when coding. And that the studies done in the 80's are probably out of date in regards OO coding practices. For one thing there is no mention of Cyclomatic Complexity or Halstead Complexity measures.
I have a few Electrical Engineering friends who still seem to get taught to code in sequence, rather than in encapsulated object terms. Is this better or worse? I'm not sure. We know that sequential code can become spaghetti but this has as much to do with bad cohesion and coupling, rather than method length.
Is OO better, I suspect so in that it encourages encapsulation and functional cohesion. Note how i said encourages, because some coders just never grok these two terms. Which is probably bad, but maybe not if some of the old Code Complete studies still apply. I also like to create logically cohesive objects, which is what OO (Object Orientation) is all about. BigMother is not a good name for an object (or a database table, which I once ran into).
So in the end i think i chose my rule of thumb based on functional cohesion and cyclomatic complexity without having a study to base it on.
Friday, 25 January 2008
I changed the title of my blog today in response to an article on Seonoobs.
While I didn't agree with the article's contention that long title's are always good, I do agree with the keywords idea and I thought who would read my blog if all it says is "The Occasional Observation". Observations on what? is the logical next question. So I've changed it to use a few keywords. I may change the title again as time goes on. It will be interesting to see where I end up in the google search ranks.
Thursday, 17 January 2008
We were chatting about UML the other day at work and one guy found this article bagging UML.
I'm a bagger of UML too, I've never really liked it. It seems to me it was just 3 guys combining their own 3 ways of doing diagrams. So it ended up being design by committee, with hundreds of symbols meaning arcane and obscure things. It's still hard to beat screen shots, flow charts and basic object diagrams with stuff written on them in English so you know what the heck each blob means.
Maybe one day I'll propose a simple modeling language, nice and opinionated like Ruby On Rails. Then I'll leave UML to the architects and managers in big Telco's who use it as an excuse to justify their existence. (see the last paragraph of bagging UML)
Tuesday, 1 January 2008
I ran into the new windows PowerShell the other day at another Readify Developer Network session. Presented excellently by Mitch Denny with true geek cred.
So following the cues I downloaded space invaders for PowerShell by soapyfrog. Its an interesting example of how to to things in PowerShell and get graphics going.
Excellent stuff must get into it some more.
Also in my travels I have run into the new silverlight based microsoft downloads page. At work we have been debating whether or not silverlight will kick off. Its a plugin afterall, and people are loathe to download plugins. But this is sheer genius, make the default download page use silverlight and the world downloads your plugin. Also the world downloads the latest version of your plugin too. Once again another example of microsoft proving it is the catch up football king.
Silverlight is here to stay and could really start to make inroads.