A reference that cannot be null

2010-03-10

In most (all?) object oriented programming languages it is possible to have a reference to an object and have this reference be null/nothing/nil.  There are many cases this isn’t a good idea; like for instance method signatures.

AddCustomer( Customer customer )

and customer is null.  Not very common…

It would be nice to have a reference type that cannot be null.  Ever.  The compiler should also know about this and break if the code flow allows the reference being null.


Shortcut aid duplicate in Visual studio

2010-03-04

When developing Winforms (and Webforms and Aspnet) in Microsoft Visual Studio there is no aid to stop me from entering overlapping shortcuts.

For example I have a menu with 5 items which have shortcuts alt-F, alt-E, alt-V, alt-T and alt-H.  It is then important that my buttons don’t have the same shortcuts.  There is nothing in Visual Studio signalling a shortcut used in more than one place.

Technically this could be solved through recursing through the controls of a form.  It can be done in the OnLoad event and only in debug mode.  The controls could then be highlighted and maybe reported since it isn’t possible to statically change shortcut while debugging and at least I forget which two controls should be changed to what.
One could take it further to show up already in the designer, that would be the nicest solution.

It is more complex for MDI interfaces.  There is no static linking between a parent and child forms.  One could have a settings file describing the relations.

Ditto tab controls.

Then we have rules like that alt-S should be Save and alt-E should be used for Seek throughout the application.  Without thinking one could use alt-S for Seek in a form somewhere which could fool the user into believing he has saved when he have not.
The technical solution to this could be to have a common settings file.  Controls using one of the regulated short cuts then flag that they are approved for this by a flag.  A developer might accidentally set a short cut but not a flag at the same time.


Quiet coffee grinder

2010-03-02

Every electrical coffee grinder I have hear has been noisy with an irritating sound.  There is no need for this.  I once took my manual coffee grinder and my cordless drill.  Not noisy at all and it managed coffe for a table of 12.  It was maybe not as fast as a professional machine and absolutely more complex to use.  But it *was quiet*.

A 1000€ machine in a coffee shop really shouldn’t sound more than the guests.


Quiet vacuum cleaner

2010-03-02

There is no need for vacuum cleaners to be as noisy as they are.  It is probably both easier to design and create a noisy vacuum cleaner that a quiet one.  But there is no law of nature stating that a vacuum cleaner has to sound more than a 100kW car.


Safe Server Side Scripting – SSSS

2010-02-23

There is a safe way to write client side script; Javascript in the web browswer.

But there is no way to do it on the server.

There are free hosting sites but no one I am aware of allows upload of server side scripts.
Wouldn’t it be nice to allow for The Kids to do simple interactive sites?

Allow for a (script) language, a database and let the server handle resources and CPU so noone can’t clog the machine.

Update: Google has something like it with Google apps script http://www.google.com/google-d-s/scripts/overview.html


A snowplough that doesn’t shove the snow to the sides

2010-02-21

All (most of?) the snowploughs today shove the snow to the sides. This makes the snow pile up and the road narrower. In the city the parked cars get snowed in and there becomes a wall/pile of ice and snow that makes parking more difficult. The house owners that move the snow out of their garage entrance and sidewalk get a new load of snow for every plough.

If the snow could instead be collected and moved to another place the problem with snow and ice walls would lessen.

There are problems with the cost and logistics with the very tranport of the snow. I also don’t know how to create a reliable machine to gather the snow and not how to get the snow from the snow gathering machine to a vehicle that moves it away without clogging the roads.

But I doubt it cannot be done.


A buy/sell site that works

2010-02-21

Private sellers and buyers do not think alike.
One sells a Nokin D70. Another wants to buy a system camera.
A buyer is looking for a used designer lamp of brandx. This search can take years depending on preferences and requirements.
A seller is selling an anitque chest. It can be labeled as furniture, antique, or storage. Then the possible buyer has to choose the same label.
No sell/buy site does this today in a good way.


Hello world!

2009-04-28

Testing source code:

class ReflectionUtility
 {

 public static string GetPropertyName<T, TReturn>(Expression<Func<T, TReturn>> expression)
 {
 MemberExpression body = (MemberExpression)expression.Body;
 return body.Member.Name;
 }

 public static string GetMethodName<T, TReturn>(Expression<Func<T, TReturn>> expression)
 {
 var body = expression.Body as UnaryExpression;
 var operand = body.Operand as MethodCallExpression;
 var argument = operand.Arguments[2] as ConstantExpression;
 var methodInfo = argument.Value as System.Reflection.MethodInfo;

 return methodInfo.Name;
 }

 }