Monday, May 11, 2009

Visual C++ 2008 Express: How to add class member?

Yes, I know I can add a class member by hand.

But since the GUI gives me a wizard to create a class, why doesn't it also give me a wizard to add a member or method to that class?

Labels: ,

Wednesday, April 16, 2008

Study material: Program structure and interpretation

Someone posted a link to the MIT coursework for "Structure and Interpretation of Computer Programs". There is also a full online version of the textbook.

http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/

It would be nice to get the textbook as a PDF.

Sunday, March 09, 2008

Firefox feature I would like

Sometimes I am using tabs to browse pages in Firefox and come across a page that I would like to open in a new browser. Of course, this is very easily done by right-clicking the link and selecting Open in New Browser.

However, if I already have the page open in a tab, I would like to be able to right-click the tab and have something like "Move current tag to new browser" and then have the current tab moved to a new browser instance, including all the tab history. The original tab could then be deleted from the original browser instance.

I bet there's already something like this on the plug-in page.

Tuesday, June 05, 2007

Trolls hit the BBC

If you've been paying attention to the 2012 Olympic bid, you'll have already heard of London's official Olympic logo. It's hideously ugly and pretty hard to figure out unless you stare at it for a while.

The BBC asked its audience to send in alternative logos, and the response was deafening. People did not like the official logo at all. It doesn't represent anything about London, and looks to be thrown together in a rush rather than carefully designed.

One response in particular was quite an eyeful. If you've ever had the honor of gracing your screen with the "goatse man", you'll recognize the logo in question. Have a gander.

And for God's sake, don't search for "goatse man"! Seriously. Don't click on this link.

Wednesday, May 30, 2007

Loose coupling/tight coupling: When things go wrong

I was thinking about coupling this morning. Loose coupling allows for one part of a system to change without impacting other parts of the system. The other parts are shielded from the impact because the coupling point is a contract. As long as the change happens behind the coupling point and the contract is fulfilled correctly, a change in any particular module will not affect any other module that relies on it.

But that's not really what I was thinking about this morning. I'm thinking more about trains, and the Tokyo train system specifically.

Every morning I take the Tozai line from Minami-Gyotoku to Nihonbashi. The "東西" line is one of the few train lines that, as its name suggests, travels the entire distance of Tokyo from East to West.

Before I get too far ahead of myself, I have to explain a little about the train system in Tokyo. There isn't just one train company here. There is the well-known JR lines (pdf) which has the famous Yamanote line which circles the heart of Tokyo and connects at many stations with other lines. There is also the very popular Tokyo Metro (pdf) of which the Tozai line is one (the blue line running from east to west). Still relevant and convenient is the Toei Transportation system which runs several trains (see the Tokyo Metro map) and a host of buses around the city. Less well-known lines like the Tobu lines and the Odakyu lines are also here.

What brought on this thinking of coupling wasn't the coupling of trains, but the coupling of train lines. If you look at the various maps, you will see that many train lines intersect with each other. These are prime points for coupling, and indeed many of those intersections are coupled by means of a shared station.

By "loose coupling" here, I mean that the passengers must unboard one train and reboard another to make the transfer. This is very convenient, though sometimes the rush to change trains is overwhelming with so many people needing to transfer at the same station. Also, it requires that the passengers actually leave one train to change direction. This is the standard way this works, and it works well.

But there are other points in the system that are much more tightly coupled. This means that more than just sharing stations with each other, multiple train lines may actually share the same track. The Tozai line is a prime example of this with its endpoint on the western end shared with the JR Sobu and Chuo lines. The Sobu and Chuo lines themselves share tracks from JR Ochanomizu westward. If you take a close look at the train maps, you'll even notice that the Tozai line and the Sobu line are connected at their endpoints and diverge in the middle, providing a wider area of service with the same terminal stations.

The benefit to the passenger should be obvious. By being able to board a single train and not have to transfer at stations, the passenger can relax and not be bothered until he reaches his station. From the passenger's point of view, it is less hassle and potentially faster than a series of transfers which loosely coupled train lines would require.

The downside, as I encountered this morning, is that a system failure in a shared area leads to a total system failure across all coupled systems. I get on the train at Minami-Gyotoku, as I mentioned before. It is on the east end of the Tozai line. An accident on the Chuo line, far on the west end of the lines, caused backups all the way through the entire Tozai line. As a result, I was late to work.

In a loosely coupled system, I would not have been inconvenienced since the Chuo line is really of no consequence to me personally. Passengers of that line would naturally have problems, but the other lines would run normally (as the Ginza line did when I transferred at Nihonbashi). Loose coupling would have prevented the impact of an event that occurred far away from affecting me.

But we don't live in a loosely-coupled world. In fact, the world which we live in is highly coupled. Tight coupling adds convenience while potentially compromising the stability of the system as a whole. How many people benefit from the tightly coupled train systems? How many people were harmed by events like today's backups? Where do you draw the line and say "Common convenience with occasional outages outweighs minor inconvenience with guaranteed service"?

Tuesday, May 08, 2007

XP Taskbar covers popup text

For a few days now I've been noticing a problem with my WinXP taskbar. The taskbar is forcing itself to the top of the Z-order, so it is always on top. Now, this wouldn't normally be a problem. I don't use the auto-hide feature, so it's not a big deal to have the taskbar always visible. However, with the taskbar at the top most visible layer, stuff like popup text is covered up by the taskbar.

If I hover my mouse pointer over the Messenger icon, I expect it to show me a little box indicating my login status. I can kind of make out that there is a box being displayed, but since the taskbar covers the box, I can't read the text at all. All context sensitive text bubbles are unreadable.

I tried auto-minimizing the bar, but since I can only hover my mouse over the icon when the taskbar is shown, that is not a solution.

I can drag the taskbar to the sides of the screen, and that seems to fix the problem, but I don't like having the taskbar all the way over there.

Microsoft is patching a bunch of things today. I wonder if this is something they broke earlier and will fix in this update. I can only wait and see.

Monday, May 07, 2007

Java Japanese font troubles

I am trying to get Netbeans working correctly on my PC.

As you already know, I'm in Japan, so my OS is WinXP Japanese language edition. In default mode, the locale is set to Japanese. Java takes that information and passes it along to Java apps. If an app, like Netbeans, has an internationalized config file, it will load the appropriate language strings and fonts.

If, on the other hand, a user does not want Japanese menus, the default system locale must be changed to English. This causes Java to interpret the environment as an English system, and all English strings and fonts are loaded. However, this has the side-effect of making Japanese fonts unreadable. Little boxes are displayed where Japanese characters should be. In Netbeans, this is first obvious in the File->Open->Browse dialog where "マイコンピュータ" should be displayed, but instead "□□□□□□□□" is.

On top of that, the editor itself ceases to be able to display Japanese fonts as well.

I was able to work around the editor problem by setting the editor font to MS Mincho, but I would much rather have the fixed-size fonts available for coding. Unfortunately, this still doesn't fix the problem of broken fonts in the system dialog boxes, but I can probably live with that.

I know I'm not the first person to run into this problem. The Sun support boards have the same problem repeated several times. It looks like "won't fix" is Sun's plan for this bug.