Web Ben's Questions and Answers

Friday, April 29, 2005

What Is The Default Printer

I was just asked a question about how to get the default printer name in windows.

The answer is that you call GetDefaultPrinter()

Please leave a comment if you think that there's anything which I've missed and if you have any other questions which you'd like me to answer please send an email to Ben Dash at

Software Crab Fishing Style

I saw a couple of episodes of a reality TV show about the people who are involved in the Snow Crab fishing industry in Alaska, in particular in the Bering sea. The programme was very interesting and I have to admit that I was certainly feeling tempted to try it and had considered the idea briefly back in College. As a result I began to ask myself; "What is so appealing about Alaska Snow Crab fishing?".

After reflecting on that question for a couple of days I've come to the conclusion that it's partly the excitement of the potentially high stakes, it's certainly a dangerous job, but mostly I like the idea of being rewarded based on your performance. The Alaska Snow Crab fishermen, from deckhand to captain, all get a share of the catch. The "Green Horn" first timers are the only exception as they are paid a fixed rate as they are so much less experienced they're really only getting cost of living compensation for their apprenticeship. The Alaska Snow Crab season is variable length, depending upon the estimated stocks of Crab, and now only lasts a few days. Due to the time constraints the Crab fishing season is a virtual sprint between crews who each want to catch as large a portion of the quota as possible before the season end date is announced. Consequently crews work 24 hours a day for these few days each year, catching sleep in 15 minute intervals whenever they can. However, the crews are paid well for this adrenaline rush and their take home pay at the end of the brief season may be as much as $300 per hour. Considering that the crew is working 24 hours a day during this time you can easilly see that financially the reward is very significant.

Since my business involved computers, I was wondering if the same model which is used in the Snow Crab fishing industry would work for the Computer Consulting/Services Industry. Several people who I have spoken to about this believe that the Computer Consulting Industry is already operating under the same model, however, I'm not so sure. Certainly, contractors are paid hourly, however, that's actually the opposite of the Crab fishing model. The Crab fishermen are paid a percentage of the boat's catch revenue, if they want more money they need to work harder and faster, since the revenue is limited by the short duration of the season. To mirror this in the Computing Industry it would be like a firm offering a bounty for the delivery of a computer system before a certain set date. Multiple independent teams of contractors would each compete for the bounty by delivering their version of the computer system specified in the firm's bounty requirements document. At the time of delivery each solution would be evaluated and the firm would choose how to distribute the bounty, a single team may receive the entire purse or it may be distributed amongst multiple worthy teams. Admittedly this scenario would be slightly different than the case with Crab fishing.

The real appeal of this model is the fact that it is largely self regulating. If a firm offered a bounty but no teams came forward to meet the challenge then the firm would be free to adjust the value of the bounty upwards or the date of delivery outward until teams did sign up. A team would be free to either drop out or join the race at any time and a firm would be free to adjust the bounty and the delivery date at any time. The most successful team would tend to be the one which worked hardest for the longest time, since a team would want to deliver the best solution possible at the time that the firm judges the solutions. If a team was confident in their solution they would be free to deliver it early, and a firm would be free to choose to reassign the delivery date and settle for the early solution if they choose. The consulting team would then be able to pursue other projects, however, they run the risk that their solution may not be chosen if the firm decides to wait until the original delivery date for competing solutions before choosing how to distribute the bounty. If a firm was unhappy with the solutions submitted at the time of delivery they would be free to set a new bounty and delivery date for solutions to remedy the failings of the current submissions.

In order for this model to work there would need to be an open ranking system for both individual team members and firms. When a firm received an application to compete for a bounty from a consulting team the application would include the teams past performance/satisfaction grade. This grade would be calculated as a sum of each team member's performance grade, which would be calculated from the team member's past peer review based grades combined with the team member's past team's firm ranked solution grades. This way a firm would be able to decide if their bounty and delivery date were likely to receive solutions from teams which had previously provided satisfactory results. If only mediocre teams apply to compete for the bounty then the firm may choose to adjust the criteria for the solution either though changing the requirements, changing the bounty, or changing the delivery date. When a team receives their share of the bounty they would grade the firm, which would enable a team to choose which bounties to apply to compete for based not only on the bounty solution criteria but also on the firm's standing in the eyes of those who have been involved in projects for that firm in the past. In other words; firms would grade solutions, team members would grade firms, and team members would grade each other.

The benefit of this system for the firms is that they receive the best possible solution based upon their requirements, their bounty, and their delivery date.

The benefit of this system for the individual team members is that they would receive a portion of the bounty according to their their skills and effort as evaluated by their peers, i.e. their team mates, and their customers, i.e. the firms when they evaluate the team's solution.

What do you think? Please add a comment or send a question to Ben Dash at

Thursday, April 28, 2005

Online Supermarket Grocery Store Status

Someone just asked me:

"Do online supermarkets and online grocery stores still exist in the US or were they just a fad that went extinct?"

The answer is that online supermarkets and online grocery stores certainly do still exist although in a scaled down version from when the concept originally exploded into the marketplace soon to fizzle and almost die althogether. Some online supermarkets include Albertsons and Safeway, NetGrocer, AUL Superstore and Peapod. Hopefully you'll find an online grocery store which is able to deliver in your area, good luck.

What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Learning Languages, i.e. Spanish and French

I spent many years learning various languages in school, as I'm sure almost everyone else has. My success rate was relatively good, however, I had little motivation to really apply myself. Now that I am living in the US I am far more immersed in alternate cultures, which speak alternate langauges other than English, namely Spanish and French.

I am currently receiving at least three Spanish language TV stations, and consequently, I now find that I have much more motivation to expand my Spanish vocabulary and general Spanish comprehension. Once I have reached the conversational Spanish point I intend to do the same with my French vocabulary and comprehension, which should be an easier task than is the case with Spanish since my French abilities are already above the level of my Spanish.

With this new found motivation I have been wondering: "How can I improve my Spanish language vocabulary and comprehension?". I tried simply watching Spanish language TV, however, the total immersion technique was flawed due mainly to the fact that I was not totally immersing myself. Simply watching Spanish language TV does not constitute total immersion in a language or culture and, although I was able to comprehend a little of what was transpiring in the various TV programmes, the vast majority of the TV content was going completely over my head.

Luckilly I mentioned my language plans to someone who recommended that I try Michel Thomas' Spanish 8 audio CD Spanish course. Having listened to the majority of the first CD at their house I was sold. Michel Thomas has a revolutionary teaching style which centers around the student not trying to learn, rather the student cannot help but learn through following the instructions that Michel provides. There is no homework, there is no memorising, rather than trying to concentrate you are instructed to relax. I ordered the 8 CD set from Amazon and listened to the first CD in its entireity this morning and can confirm that the brief few minutes which I listened to previously is reflective of the CD as a whole. The various rules that he highlights mean that as an English speaker you already have a Spanish vocabulary of several thousand words simply by changing the endings from the English version to the Spanish.

If you're interested in learning Spanish I would feel very comfortable recomending "Spanish with Michel Thomas - Deluxe Edition" and will certainly be considering his French course when my Spanish reaches a reasonable conversational level.

What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Wednesday, April 27, 2005

Are Callbacks A Bad Idea?

Someone was asking me yesterday why I think that Callbacks are such a bad idea. Firstly let's define exactly what a Callback is in terms of computer programming in C, C++, or Java.

Many people use callbacks as a form of RPC. The user implements an abstract interface, in the OOP world, or a function pointer in the non-OOP world. When the underlying API needs to notify the calling application of an event then it calls the Callback function specified by the calling application. This is the crux of the problem, as I see it, the calling application specifies what action is to take place within the Callback and this is potentially very hazarous to the API's efficiency.

For example, what would happen if an API called a Callback and the Callback decided to sleep for 10 seconds? The API would loose control of the thread which called the Callback for that 10 seconds and could potentially be dead in the water unless it has other threads available for work. By definition a Callback needs to execute quickly otherwise the application risks slowing the API down. Unfortunately the application and the API may have two completely different ideas as to what quickly means.

Rather than use Callbacks I would propose that the use of Semaphores is far more sensible. Using a Semaphore you can notify a thread that an event has taken place without any risk to yourself that the notification will take any significant amount of time. If you use a Callback you have no way to predict how much time the Callback will require to execute and return control back to code which you have, the API author, control over. Note that I'm proposing the use of a Semaphore rather than simply a Synchronization Object, in Java, or an Event in Win32 since a Semaphore is capable of being triggered multiple times and retains the knowledge of how many times it was triggered, i.e. an Event is bistate, 0 or 1, true or false, however, a Semaphore maintains a reference count. This allows a Semaphore to be triggered for multiple events and for the application to service each of those events.

Have you had a callback problem in any of your programs?

Good luck with your inter-thread communication, if you have any additional thoughts please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Tuesday, April 26, 2005

Insert Mapquest Map into Word Doc

I just had a question though email asking how you insert a map from mapquest into a Microsoft Word document. The way that I did it was actually very simple. Using the Firefox web browser I went to mapquest, entered the address which I wanted a map for, and then right clicked on the map and selected the "Save image as" menu item. Since the image is in the GIF format I made sure to name the files using a .gif file extension.

Once I had the map image file I simply opened MS Word, selected the "Instert" menu, then selected "Picture", then selected "From File". Then I browsed for the mapquest gif image that I had just created and clicked the "Insert" button.

Have you ever had a problem inserting images from the internet into your MS Word documents?

If you have any additional suggestions please leave a comment below, and if you have a question which you'd like me to answer for free, please email it to Ben Dash at

Monday, April 25, 2005

US Cars versus EU Cars

Several people were amazed when I told them that my parents are just about to buy a gasoline engined car, which isn't a gasoline electric hybrid, that has 5 doors, seats 5 people, and gets over 60 miles per gallon (mpg). Why? Because the closest non hybrid car would be a diesel VW Golf and it doesn't get any more than 46mpg. Surely this 60mpg car must be a 5 door rickshaw? No, not at all, it actually looks very nice, and I'd certainly consider trading in our Ford Focus for one if I were in the market for a new car and if they were sold in the US.

"What gasoline car gets 60mpg?" you may ask.

The answer is; "A Honda Jazz", and here are the specifications:

So the question is; "Why are all american cars so inefficient?"

Gasoline electric hybrid cars are not popular in the UK. Why would anyone want one when you could get a normal gasoline car which gets better fuel economy than the hybrid. The US consumer seems to demand a large engine, our Ford Focus has a 2 litre while the Honda Jazz has either a 1.4 or the 1.2, which makes the 60mpg figure. Both cars are quite capable of cruising comfortably either on the US highway or on the UK motorway, however, the Focus gets just over half the mpg that the Jazz gets despite the fact that the Jazz actually has more passenger room inside.

Perhaps the american consumer will soon adopt more fuel efficient cars. I, for one, would be very happy getting 60mpg without having to resort to buying a gasoline electric hybrid whose battery will most likely die soon after the 100,000 mile mark.

What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

US Trucks versus EU Trucks

My father in law is a truck driver here in the US. He just got a new Volvo VT 880:

and we were wondering why all the trucks in Europe are cabover instead of the traditional US style with the log hood/bonnet.

Volvo is obviously a European company and certainly builds cabover trucks:

In fact Volvo doesn't even sell US style trucks in Europe. In order to get a traditional US style truck in Europe you'll have to go to Scania's T series:

According to Volvo "There’s a reason for the 880’s long hood: power.", however, the VT 880 is only 625hp which is not significantly different than Volvo's FH16 series cabover truck which has 610hp from the same 16litre engine:

In fact, I wouldn't be surprised if the FH16 was every bit as capable as the VT880 simply due to the fact that the FH16 doesn't have the extra weight associated with the long hood on the VT880, although I can see that the VT880 may be marginally more aerodynamic.

After much wondering I finally found this info on Volvo's site that indicates that US trucks are not restricted to 18 meters in length like EU trucks, and since the US consumer prefers the style of the long hood very few US trucks are cabovers:

Aestetics aside, US and EU style trucks seem to have largely equal power and weight capacities, although the shorter length of the EU cabovers is a large advantage in close quarter manuvering as is often required in Europe. Consequently you never see US style trucks in Europe because their longer length makes them very difficult to manuver through tight windy country lanes.

What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Regular Expressions

Someone asked me if I could help them with some Regular Expressions on Friday. I ran across several turorials but A.M Kuchling's Howto seems to be one of the better ones, available here:

As an example, this is the regular expression for a standard 8.3 DOS file name, assuming that file names' case is recorded even though the case is ignored:


This means that a file name is made up of between one and eight alphanumeric characters, folowed by a "." followed by between one and three alpha numeric characters.

Once you know where to find the rules for Regular Expressions they are pretty easy. What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Friday, April 22, 2005

Alternative Commuting Methods

I've been thinking about getting more exercise, as is reflected in my personal blog, Ben's Daily Thoughts and Ben's Workouts, and so was looking into options for commuting to work by bicycle instead of by car.

I have several bikes already, each for a specific purpose; a mountain bike, a road bike, a unicycle. The purpose of the unicycle is "because I've always wanted to be able to ride a unicycle" which is purpose enough considering that I didn't even have to pay the $50 cost myself as someone bought it for me. I expect that the buyer thought that $50 was a bargain to see me make an ass of myself, but I digress.

One class of bike which I didn't own, until a couple of months ago, is a "Trash Bike". I was helping someone with thier car and talked them out of their ancient Schwinn road bike, however, it was just too trashy. A couple of weeks later I happened to be at a yard sale with my wife and noticed a much less trashy road bike for $10, I talked them down to $7 and became the proud owner of a "Trash Bike" which really wasn't very trashy at all.

That was a few months ago, and I still haven't actually ridden the new bike beyond my back garden. The excuse is that I have been waiting for the weather to improve, however, there's no excuse now as the weather is perfect. My next excuse it that I'm just too lazy, which leads me long windedly into this current question which I submit to myself; "Does a powered bike trailer exist?"

The answer is; "Yes, and there are a couple of them."

The expensive version seems to not be available currently:


The cheap one requires you to build it yourself:

Bidwell Bike Pusher

I'm quite tempted by the cheap version, as I think that I could probably build it for only about $200 including all the parts. I like the fact that it's cheap, I like the fact that it has a low center of gravity, I like the fact that it is load bearing, but I especially like the fact that it is easilly detachable for the times when you just want a normal bike.

Do you commute by bike?

Be careful if you choose to ride a bike to work or school, if you have any suggestions please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Thursday, April 21, 2005

Can large companies be effectively reorganised

Yesterday I was discussing whether large companies can become so large and tangled in their own webs that they are irrevocably broken Business Process wise. Certainly there have been plenty of examples of large companies reorganising with great results, Tesco being a prime example having just released news of record earnings in the UK. However, is Tesco merely an example of a company that went from good to better? I would say; "Yes". Tesco was clearly not irrevocably broken in the first place.

I would think that there are many examples of large companies who are only able to stay in business because they are large. You could visualise these companies a huge lumbering dinosaurs. Just as it is impossible to reorganise a Diplodicus into a Cheetah it is impossible to reorganise a large broken company into a small efficient company. Perhaps that is the problem; large versus small. No matter what new management technque is used a large company will remain a large company until it jettisons much of its market share, employees, capital etc. A small company is inherantly more agile than a large company and more easily lends itself to self-reinvention.

In conclusion I would say that it is certainly possible for a large company to become so irrevocably broken that the only solution is to virtually dispand the company and start again from scratch. This begs the question; "Will the new, and smaller, version be able to maintain any competitive advantage once its one redeeming factor, its size, has been removed?".

The case for a large company is generally one of Imperfect Competition. The large company may exist in a Monopoly or, more likely, an Oligopoly. Since a market is never black or white as regards perfect competition or imperfect competition I would say that the demand curve in this scenario will certainly be kinked even in the case of the supposed Monopolistic company. An example of this is Microsoft who exist as a Monopoly for the Microsoft Operating System yet sell the operating system at various price points. Rather than being merely a simple case of price discrimination in could be argued that Microsoft has found it necessary to vary the price that they sell at due to other products which do not compete on price, namely Free Open Source Software (FOSS) operating system alternatives.

If this Monopolistic or Oligopolistic company were to recreate itself as a smaller company it would eliminate all of the benefits which it was able to enjoy in its previous position. The demand and supply curves would shift dramatically in the case of a Monopoly and in an Oligopoly a competitor may now find that it now has a virtual Monopoly. This leads me to wonder if it is logical for a large company to strive to reinvent itself completely. In the short term the consumer would undoubtedly benefit from lower prices in a more perfectly competitive market, however, in the long term, the lack of supernormal profit would mean that research and development would be more difficult for the more price competitive companies. In reality, however, products are rarely competely hetrogenous and so a market for the companies which I'm primarilly imagining would probably not compete solely on price and consequently R & D would just be one of many costs of doing business which all companies would have to bear.

In final conclusion, I think that clearly I've opened a Pandora's box on this one and am sure that I'll revisit this topic again as although the answer to the original question is a resounding "Yes" there are clearly many other questions now to be answered.

What do you think? Please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at

Wednesday, April 20, 2005

The future prospects for human memory

The other day someone asked me about the potential impact that the internet will have on mankind in the coming decades. Already, at even this early stage, the internet has largely eliminated the need for people to spend time memorizing information. As illustrated in the film "National Treasure" the star's almost super human memory merely enables him to be one step ahead of the villain. The villain remains very much in sight of the hero simply by using Yahoo to search for "stow declaration of independence", if I remember correctly. I used the same search phrase on Google, my personal search engine of choice, and can confirm that the number one rated result was indeed the answer to the riddle in question.

With the emerging ubiquity of internet access and its inevitable inclusion into "Augmented Reality" (AR) devices it seems as if there is a very real possibility that humans will soon have to modify their entire basis for assimilation of knowledge. Rather than spending time memorizing facts humans may find it more efficient to memorize more general concepts, concepts which provide just enough information to facilitate a person finding a fact but no more than that.

This leads me to wonder if perhaps Ray Kurzweil's "Singluarity", the idea that there will be a time where Artificial Intelligence (AI) will surpass human intelligence at which point the future of the human race will be uncertain, may well be unfounded. Kurzweil postulates that there is an event horizon, at the point of AI surpassing human intelligence, which we cannot see beyond nor return from the brink of. The crossing of this event horizon will result in drastic consequences for the human race, although whether these effects will be beneficial or catastrophic is impossible to predict in advance.

Perhaps AI will not take the form that it is so often portrayed as taking in science fiction. Perhaps AI will take the form of a human with an intelligence supplemented by some form of AR. Having just said that I wonder if this future AR human hybrid may finally be capable of creating AI in the traditional sense, so perhaps AR is merely a step on the path to Kurzweil's AI "Singularity".

In conclusion, I would say that clearly the future will be very different as a result of the combination of AR and ubiquitous Internet access. I'm not sure if you would call this new development part of the Silicon Age or if perhaps we are now on the verge of entering a new age; perhaps you could call this new era the Augmented Reality Age.

Have you found that your memory is suffering through the use of the internet?

It certainly makes you think, if you have any other ideas please leave a comment or email your question, which you'd like me to answer for free, to Ben Dash at