Archive for Technology

Howto use Pageant and Putty

For those of you who already use PuTTY: Here’s a little improvement that’s surprisingly little known. Probably because it is very hard to explain. But I’ll try.

Here is how you can avoid starting programs, entering login information or indeed typing passwords when you use PuTTY:

  1. Download Putty installer from the PuTTY Download Page. Make sure to grab the “Installer”
  2. Install Putty
  3. Start PuttyGen from Start -> PuTTY-> PuttyGen
  4. Generate a new key and save it as a .ppk file without a passphrase
  5. Use Putty to login to the server you want to connect to
  6. Append the Public Key text from PuttyGen to the text of ~/.ssh/authorized_keys
  7. Create a shortcut to your .ppk file from Start -> Putty to Start -> Startup
  8. Select the .ppk shortcut from the Startup menu (this will happen automatically at every startup)
  9. See the Pageant icon in the system tray? Right-click it and select “New session”
  10. Enter username@hostname in the “Host name” field
  11. You will now log in automatically.

This process is a bit hard to explain, so I have made a short video that explains it:

In order to streamline things even more, notice how Saved sessions show up under the Pageant icon in your system tray.

Comments (5)

Is Steve Jobs really a benevolent dictator?

It’s not secret that Apple likes to control their platform tightly. As long as their dictatorship is a benevolent one, whether you find this objectionable or not is a rather uninteresting question.

But lately, the question seems to be less and less academic: Google’s Voice Application for the iPhone got rejected and two existing applications (GV Mobile and Voicecentral) were removed from the AppStore! This is an extremely nasty thing to do to the developers.

To make matters worse, Apple is seeking to sue users who jailbreak their phones. Yes, you can actually sue for that!

The latest WFT-Apple moment was the news of the Ninjawords dictionary application which was forced to censor naughty words out of wiktionary.

So far, Apple’s actions have mostly hurt developers. But eventually, when developers on a platform suffer, users suffer as well.

You may think Microsoft is a bloated company and that Steve Ballmer is a weirdo, but when he shouts “Developers, Developers, Developers, Developers” he understands something that Steve Jobs just doesn’t get.

So the iPhone is seeming rather unattractive now. I’m looking forward to what seems to be an Android-filled fall!

Comments (3)

Felles IKT-arkitektur for offentlig sektor

This Norwegian language post describes my response to the report from a task force exploring a common IT-architecture for the public sector in Norway.

Den norske regjeringen har besluttet at en felles IKT-arkitektur for offentlig sektor ville være fint. Jeg fikk greie på arbeidet på tirsdag, og har lest rapport til den store gullmedalje. Jeg er fortsatt ikke helt sikker på hva som menes med “felles IKT-arkitekt”, men jeg kan se omrisset av mange store evighetsprosjekter i dokumentet.

Jeg har forfattet et svar på rapporten.

Spesielt er jeg bekymret for at dette skal bli en unnskyldning for store SOA-prosjekter uten veldefinerte formål. Rapporten beskriver en god del ønskede effektmål, men disse beskrives i såpass runde former at man aldri kommer til å etterprøve om prosjekter faktisk oppfyller dem. Formålene er ting som økt grad av interoperabilitet.

Frykt nummer to ligger i hvordan SOA-krigen går om dagen. Rapporten nevner veldig lite konkret på teknologier, så jeg slapp unna å gå inn i dette minefeltet. I stedet må jeg ligge våken og frykte effekten av de usagte ordene i rapporten.

Jeg har startet å høre om dogmatiske SOA-prosjekter som ikke lykkes, til tross for store investeringer. REST starter å bli mer akseptabelt å snakke om i høflig selskap. Men fremdeles virker det som om at “SOA prosjekt” er et kodeord for “vi skal kjøpe dyr WS-* programvare fra Oracle, IBM eller Microsoft”.

Jeg skulle ønske jeg hadde mer erfaring innen offentlig sektor før jeg skulle uttale meg om dette, men dersom det er som noe annet jeg har sett, handler interoperabilitet grunnleggende sett om å sende eller motta informasjon på et standardisert format. Det betyr tre ting: En aksjon (les, oppdater, lever), noe som identifiserer et objekt (søknad, personopplysning) og et innhold (“Jeg ønsker med dette herved å søke om bla bla bla”).

Og her har WS-* skadet oss mye. Når man bygde standarden SOAP (Simple Object Access Protocol, som verken er enkel eller handler om “object access”), skrellet man vekk to fine deler av HTTP standarden: Verb (GET, POST, PUT – det vil si “aksjoner”) og URL’er (det vil si den nøkkelen som representerer et objekt). Det betyr at vi ikke lenger kan si “legg til” (POST) en “søknad” (http://etat.no/tjeneste/soknad/) som inneholder noe data (ikke en del av standarden). I stedet må vi si “send en melding som inneholder informasjon om noe vi tenker å gjøre” (ikke en del av standarden).

I en rimelig verden burde interoperabilitet betydd at å utveksle informasjon om objekter burde være en del av en universell standard som er akseptert rundt hele verden. En standard basert på å sende meldinger om å utføre én eller annen oppgave (som for eksempel å utveksle et objekt) virker sørgelig utilstrekkelig. Og offentlig sektor i lille Norge kan vel ikke være den som brøyter vei her.

Så lenge SOA-krigen pågår er jeg ikke optimistisk for sjansene til at en rimelig standard dukker opp.

Comments (5)

Post-It Fetish

Anders Nordås wrote a blog post where he talks a little about how he uses his beautiful moleskin notebook. I will pick up his challenge and write about my favorite tool, Post It notes.

As many who know me are aware, I always have a pad of Post-It notes and a pen in my left pants pocket. I use the sticky notes for todo-lists, note taking in meetings, planning talks and doing brain dumps. After the jump, I post a few examples of Post-It notes from my pocket.

Read the rest of this entry »

Comments (2)

Rails #1b: Heroku

If you though getting started with Rails seemed easy from my first post, you haven’t tried out Heroku yet. Heroku is a hosted solution for Rails that comes with a browser based IDE. There’s nothing to install. It is so easy that it’s almost ridiculous. To me, this is the future of application hosting.

One of the remarkable things about Rails is that it lets you get up and running very quickly. Here is what you need to do to get your first application up and running on Heroku.

Read the rest of this entry »

Comments (13)

The coolest Eclipse plugin ever!

I have just one thing to say: w00t!

Failing unit test

Unit Test Fails

Unit test succeeds

Unit Test Succeeds

Thanks to Litrik de Roy

Litrik used my C code to control the lights of the Dell XPS computer and integrated them into an Eclipse plugin. Coolest plugin EWAR!!one!! See more about it on the project blog.

Comments (6)

XPS Lights: Source code in Subversion

I have exported the XPS light control source code into my subversion repository. The software is currently set up to build with Cygwin. As an added bonus, I now have added a target that creates a dll so the code can be reused more easily.

How to use:

xps_lights>make all
rm -f *.o *.dll *.exe
gcc -mno-cygwin -Wall   -c -o xps_led_control_lib.o xps_led_control_lib.c
gcc -shared -o xps_led_control_lib.dll xps_led_control_lib.o
gcc -o testexe xps_led_control.c -L./ -lxps_led_control_lib
testexe -all 4 [all the leds turn turquise]
gcc -mno-cygwin -Wall   -c -o xps_led_control.o xps_led_control.c
gcc -o xps_led_control xps_led_control_lib.o xps_led_control.o
ruby xps_led_control.rb
Cycle array [the side and top leds cycle through a list of colors]
xps_lights>ls
Makefile     xps_led_control.c    xps_led_control.o   xps_led_control_lib.c    xps_led_control_lib.h
testexe.exe  xps_led_control.exe  xps_led_control.rb  xps_led_control_lib.dll  xps_led_control_lib.o

Enjoy.

Comments (3)

Dell XPS lights addition: Touchpad light

I got the following addition on my Dell XPS LED code from David Pritchard.

The new version of the code has a “-touchpad” argument. Specify “-touchpad 1″ to turn the XPS 2 touchpad light on, “-touchpad 0″ to turn it off.

Here is the updated source code and executable. The executable should work without Cygwin now. (Note to self: Use “-mno-cygwin” gcc option to strip out the dependency)

Comments

Dell XPS Vanity Lights Blink!

My newest computer is a Dell XPS thing. It’s a huge monster of a laptop (really a gaming laptop, good for the performance). It comes with external LED lights on the top, sides and bottom. These lights are normally only configurable though a custom program. Since I got the PC, I have been dying to find a way to control these LEDs from a script. Finally, today, I found out how.

A post on Notebookforums made med aware of the tool API Monitor, which allows me to see how a program is using the Win32-API. From there, it was easy to recreate a program to do the same. The hardest part was that I decided to try to use the Ruby Win32API interface to call the methods. It was hard to find out how to pass the arguments, and in the end, I ended up with a pure C solution.

The final solution is a command line program, which allows me to script it. I have encapsulated the modification of the LEDs in a simple function for easier reuse.

For any reader with an XPS who would like to replicate it, I have posted the C source code and Executable. These files are licensed under a Creative Commons Attribution2.5 License.

Attachments

Creative Commons License

Update: The previous version of the xps_led_control.exe required cygwin installed on the client PC. I have compiled a new version that presumably should run without cygwin.dll. If you have the chance to test this out, I appreciate positive or negative feedback as to whether it works. Thanks.

Comments (68)

To autowire or not to autowire

Jason Zhicheng Li has written a blog article about Spring configuration. It is called the 12 Best Practices for Spring configuration. Best practice #1 was “don’t use autowiring*. That got me thinking:

I feel very ambivalent about autowiring. Initially, I thought it sounded like a great idea because it reduced clutter, but then people like Jason convinced me that it was not. The more I think about it, the more usure I am.

So, what are we afraid of when it comes to autowiring? Documenation is one thing, definately. In my experience, I don’t use the configuration much for documentation anyway. And we are used to automagic stuff happening anyway, so autowiring won’t be too different. Nothing stops us from explicit wiring in the cases where autowire would be too “undocumented”.

So what can go wrong? Either something gets shouldn’t be, or something doesn’t gets set which should. Autowire ensures nonambiguity, so if something gets set its always what should’ve been set.

As I can understand the issue, using autowire to, say, let all DAOs use the same DataSource seems much easier to manage than explicit wiring: If a class has setDataSource, it has the standard datasource. What could be easier?

I cannot see any realistic way where the first scenario would actually happen. If you have a setter on a bean, having it called can hardly be a surprise to you! Why else would you have it! If it wasn’t needed, it will not cause any harm, and if it was, it would be the right one.

Nor is there any great risk in a property being unset. If a property is critical, we already know how to deal with it: Dependency check or implementing InitializingBean.

So: We all have this fear of autowiring, but I have yet to understand a rational reason not to use it. (And yet, I don’t use autowiring either)

Can someone please explain WHY autowiring is bad without just waving their hands around? What bad things can happen if you autowire? Has anyone experienced any pains after autowiring?

This article has been posted as a comment to Jason’s blog

Comments

Creative Commons Attribution 3.0 Unported
This work is licensed under a Creative Commons Attribution 3.0 Unported.