hash_bucket()

Archive for August 2006

In relation to the above post, I’ve decided to write my own little wireless network scanner, for my own pleasure only. I know there are dozens of tools out there that works just fine, but I just want to see if maybe I can write one on my own. I then plan to use this little tool to map which stations on the subway lines I usually ride in Tokyo, that have open wireless networks available from within the station.

Thus, some special features will be required such as to be able to save AP profiles to a particular station name, and then using the application to easily switch to a certain profile once you arrive at a station.

Also, if people would download and use the application to map other train lines, maybe we can build a database of all the stations in Tokyo where you can connect… (or you could just do a quick scan yourself once to get to a station, it wouldn’t take you more than 3 minutes anyway to locate an AP if there is one.) But the point is that it is fun! And that I for one would like to know from how many and which stations you can get a connection, without having to go there to look for myself….

Maybe this should be a webpage and not an application?

Advertisements

wardriving

Posted on: August 23, 2006

Going by car back from the office last night, I decided to leave the laptop running netstumbler, just to see what I might catch. Turns out that while riding the down the highway inside Tokyo, on a trip that takes about 25 minutes, I was able to spot ~320 access points of which ~110 were unencrypted… Seems that Sony Mylo might not be such a bad idea after all…

Currencies

Posted on: August 18, 2006

Frustrated as ever by not being able find a currency converter that will JUST convert a currency of a specified amount to another, without sending emails, connecting you to chatrooms and adding the BEST TOOLBAR IN THE WORLD!!!!! to every browser you have installed, I decided to build my own. It uses an online webservice so you’ll need to be connected for it to work… (ok I’ll admit it, I was just looking for an excuse not to code on my actual work for a few minutes…)

oki I wanted to post it but this free hosting version of WordPress of course blocks exe files… shout if you want it…

Oh, and yes it was written in 30 minutes so no complaining about missing features please ;)

This is my first time writing a post out of the Windows Live Writer, sort of a simple text editor that lets you write blog post into just about any blogging service from a stand alone application on your desktop. Also, it saves backups of all the posts you publish through it on the local drives and provides some very nice rich editing features that actually out class the original interface of my wordpress blog.

Give it a try!

I love the class designer that was added to Visual Studio 2005. Class design (and indeed application design as well) would ideally be divided into a series of related steps that if you follow them generates beautiful non-redundant, efficient and well segmented code. However, the nature and contents of these steps have been a hot topic for debate amongst developers for many many years, and consequently there are to this day a plethora of different “workflows” or “piplines” that you are free to pick and choose from.

Really though, if you simplify the whole process (a_Lot();) you end up with maybe 3-4 major steps.

  1. Design
  2. Implement
  3. Bugfix
  4. Document

And while for example UML and the likes of which may be great tools and guidelines for these steps when it comes to big development teams, long time projects or just simple vast oceans of code, they all tend to be a little bit to detailed and complicated for smaller developer teams and short projects that span say a month or so. To put it simply you end up spending more time drawing diagrams and formatting pictures for pretty print-outs, then actually designing and implementing code.

While I am a firm believer in thorough design and planning from start to finish in any project, one must also I think sometimes realize that a small project, or a project that might never make it to the market but is only executed for research or learning, might not survive the burden of all this great planning and thinking.

One big reason for this is I think the lack of really light-weight, easy to use UML tools and applications. Often you will simply spend to much time defining meta data about your project, and figuring out how to build good looking and easy to understand diagrams of your design (remember, one important point of tools like UML is the ability to communicate your thoughts and designs precisely to your other team members and peers). Also, the next step will be to implement the actual design that you draw so nicely in your UML diagram editor, and I have seen a lot of people who forget that drawing boxes and connecting them with lines is a whole lot easier and faster than actually writing the code that supposedly reflects these lines and boxes.

Enter the Class designer. A built in tool with VS2005 that lets you create, organize and manipulate classes, enums, structs, interfaces and so on in a graphical context with just the bear minimum of tools. Using the Class designer you create classes, define properties, encapsulate fields, add methods(with parameters) and define heritage and accessibility, all in a very intuitive and time efficient way.

Also, what is even better, the Class designer will actually create a bare bone implementation of your and reflect back to the code any changes that you make while designing. This makes it a very nice tool for creating unified diagrams of application and code design that can be easily shared with your co-workers, and it also servers as a very good overview of your code. Actually as my projects grow, I often find myself navigating to particular classes and methods using the Class diagram as a visual map of my code.

There are only to setbacks with the class designer as I see it today. First it does not support unmanaged languages like C/C++, and second if you add a class to your code with out using the class designer, the only way(?) to make it show up in the diagram is to regenerate it, thus loosing your layout and reverting to a standard grid layout of the classes… Hopefully this will be fixed some day…

While the standard debug console in Visual Studio is a nice bucket to throw your debug stuff into, sometimes I find the company of a good old console next to my app a lot more easy to keep track of. However, in order to get a console up and running when executing managed code you have to perform some p/Invoke magic that goes something like this:

using System.Runtime.InteropServices;

[DllImport(“kernel32.dll”, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();

[DllImport(“kernel32.dll”, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FreeConsole();

Add(import) these static classes to some class of yours and then call them whenever you need to open or close a console window. Basically, once you’ve allocated a Console, anything sent to Cosnole.Write() or Console.WriteLine() will be printed to your new Console window:

Foo.AllocConsole();
Console.SetWindowSize(80, 20);
Console.SetBufferSize(80, 40);
Console.WriteLine(“Hello Console”);
Foo.FreeConsole();

Be aware though that if you do not create this console on its own thread, the next time you call AllocConsole() it will be silently ignored and the output to your *new* console will be swallowed by the previously created one. Also if you close the new console window it will drag your main application with it in the fall…

Update:

If you also add this:

[DllImport(“kernel32.dll”)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate HandlerRoutine, bool Add);

little function and create a delegate:

delegate bool ConsoleControlDelegate(CtrlMsgTypes msg);

then add an Enum (all in good faith of interop):

enum CtrlMsgTypes : uint
{
_C_EVENT = 0,
_BREAK_EVENT,
_CLOSE_EVENT,
_LOGOFF_EVENT = 5,
_SHUTDOWN_EVENT
}

and a function:

private bool ctrlHandler(CtrlMsgTypes msg)
{
switch (msg)
{
case CtrlMsgTypes._C_EVENT:
FreeConsole();
return true;
case CtrlMsgTypes._BREAK_EVENT:
FreeConsole();
return true;
case CtrlMsgTypes._CLOSE_EVENT:
return true;
case CtrlMsgTypes._LOGOFF_EVENT:
return false;
case CtrlMsgTypes._SHUTDOWN_EVENT:
return false;
default:
return false;
}
return false;
}

then call the new function after Alloc()ating the new console:

where this.consoleDelegate is a instance created somewhere else (remember that if you do not keep a reference to the delegate alive for the time is might be called by the console, the GC might collect it and then the console will have no delegate to call anymore (thus resulting in a CallBackOnCollectedDelegate…)):

SetConsoleCtrlHandler(this.consoleDelegate, true);

This at least lets the user press Ctrl+c to log out from the created console without closing the whole application, though the Close button still causes the same behaviour…

So after my previous hosting solution (a server hidden away at my former office) was suddenly taken offline, I have decided to go with a free hosting service that the excellent people at WordPress.org provides.

I am hoping to be able to migrate this data to a more stable solution with the help of my dear friend DeZENT as soon as possible, but while he is busy (no I am not pushing you, all in good time…) I will be using this space…

日本語版

ここまで使ったサーバーは突然無くなったので(前の会社にずっと隠れたけど、誰かにバレッタみたい。。。)、とりあえずこちらのフリーサービスを使わせて貰っています。後でDeZENTという友人のお陰で新しいサーバーが貰えるそうけど、それまではこちらのアッドになってしまいます。

宜しくお願いします。


.

This blog has no clear focus. It has a focus though, it's just not very clear at the moment...

Dev Env.

Visual Studio 2008 Prof / NUnit / Gallio / csUnit / STools (ExactMagic) / doxygen / dxCore / TypeMock / TestDriven.net / SequenceViz / CLRProfiler / Snoop / Reflector / Mole / FxCop / Subversion / TortoiseSVN / SlikSVN / CruiseControl.net / msbuild / nant

Blog Stats

  • 81,435 hits