cmd.exe goodies

Googling to remember again the key that allows a command history window to be opened in cmd.exe (F7, in case you care), I found the misstitled Stupid Command Prompt Tricks post. Nice. Things that I did not know and that I'm going to use often:

  • dropping a file/dir on a console writes its full path in it
  • console settings (window/buffer size, fonts, quickedit...) are tied to the title, not to the shortcut that is used to launch them.
    cmd /c start "MyCmd" cmd /k ...
    will launch a command prompt that will use the settings associated to MyCmd. If there are none, just go to 'Properties' and create them


I am thinking now

Do not miss (sorry, louder, DO NOT MISS) this TED Talk:
Patrick Awuah: Educating a new generation of African leaders.

It's not only about Africa. It's about entitlement[1] and responsibility, education, ethics, critical thinking, incompetence, economic elites, empowerment... in any part of the world. 18 moving minutes that will make you think.

I'm keeping a quote from it:

Every society must be very intentional about how it trains its leaders
[1] I was talking about this to someone and could not think of a good Spanish term for "entitlement". He translated quoting something heard in lots of movies when the hero is in trouble while abroad: I am an American citizen. Not that I believe that Americans are worse than in my corner of the world in the entitlement disease, but I thought that it was a very funny and good translation.


XUL persist annoyances

XUL Elements have a persist attribute, that is documented as

A space separated list of attributes that are maintained when the window is closed. When the window is re-opened, the values of persistent attributes are restored. In Mozilla, persistent attributes are stored in the per-profile file localstore.rdf. Persistence can also be stored using the document.persist function. In order for persistence to work, the element must also have an id.
I've learned some things about it today:
  • It does not seem to work for the "value" attribute of "textarea" elements
  • It is stored as RDF
  • It asks for some quite verbose code if you need to access to it

var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
var rdfLocalStoreDS = Components.classes["@mozilla.org/rdf/datasource;1?name=local-store"].
var rdfRes = rdfService.GetResource("uri of interest after about in localstore.rdf");
var screenXRes = rdfService.GetResource("screenX");
var screenYRes = rdfService.GetResource("screenY");

if (rdfLocalStoreDS.hasArcOut(rdfRes, screenXRes) &&
rdfLocalStoreDS.hasArcOut(rdfRes, screenYRes)) {
var screenX = rdfLocalStoreDS.GetTarget(rdfRes, screenXRes, true).
var screenY = rdfLocalStoreDS.GetTarget(rdfRes, screenYRes, true).
window.moveTo(screenX.Value, screenY.Value);
I failed to call QueryInterface(Components.interfaces.nsIRDFLiteral) for quite a while of wasted time. In another piece of code that I wrote, this was magically called for me by checking if (target instanceof Components.interfaces.nsIRDFLiteral); I need to get a better understanding of Mozilla's component model mechanisms... I also failed to use "Value" with a capital letter, to add up to the waste. :-(

Look up and marvel!

The Cloud Appreciation Society Manifiesto:

WE BELIEVE that clouds are unjustly maligned and that life would be immeasurably poorer without them.
We think that they are Nature’s poetry, and the most egalitarian of her displays, since everyone can have a fantastic view of them.
We pledge to fight ‘blue-sky thinking’ wherever we find it.
Life would be dull if we had to look up at cloudless monotony day after day.
We seek to remind people that clouds are expressions of the atmosphere’s moods, and can be read like those of a person’s countenance.
Clouds are so commonplace that their beauty is often overlooked.
They are for dreamers and their contemplation benefits the soul.
Indeed, all who consider the shapes they see in them will save on psychoanalysis bills.
And so we say to all who’ll listen:
Look up, marvel at the ephemeral beauty, and live life with your head in the clouds!

via the tips in neave.com:
Turn the computer off and read something new. Sit on a park bench and gawp aimlessly at the clouds or stars above you. Smile like an idiot. Count your blessings. Don't worry about the future. Don't think too much. Don't take life too seriously. Don't pay attention to a word I say.

Besides these good tips, neave.com features some great Flash apps worth checking.


Menos es más

Avram Hershko, Nobel de Química 2004, en la Contra de La Vanguardia:

No me gustan los grandes laboratorios ni los grandes presupuestos para investigar (...) Como yo no tengo que pagar a mucha gente, puedo dedicar mi tiempo a investigar y no a buscar el dinero para retribuir a mi equipo.
Detesto a los sí señor. Para darme la razón siempre, ya me tengo a mí mismo; lo que aprecio es que me lleven la contraria, pero con fundamento; que me hagan pensar... Ésa es la principal virtud de los buenos júniors, que no dan nada por aceptado y que plantean nuevas preguntas a las viejas certidumbres. (...) Que tengan iniciativa; que no esperen a que yo les dé órdenes, sino que me sorprendan con sus propias y nuevas ideas, y que tengan más ganas que yo todavía de investigar. (...) Necesito preguntas, no que me den la razón.

Siempre me gusta ver que alguien progresa en algo técnico sin verse forzado a abandonarlo por la gestión. El Principio de Peter no siempre se cumple.

Equipos pequeños, diversos, con redes sociales extendidas: buenas recetas no sólo para la investigación, sino para cualquier tipo de innovación.


SendTo Clipboard coolness (TiddlyWiki links to your files)

The SendTo folder is a simple and powerful tool to customize Windows Explorer to simplify some recurring tasks. If you often want to link to files in your PC from your TiddlyWikis, you'll like this hack. It creates two new items in the "Send To" menu:

  • clipboard - file url: Copies to the clipboard the file: url of the file or folder that was showing the "Send To" menu
  • clipboard - new tiddler javascript url: Copies to the clipboard a javascript: url that, when pasted into the address bar of a Firefox tab showing a TiddlyWiki, will create a tiddler with the contents of the file that was showing the "Send To" menu

You can jump and just download and run the thing, a small .hta file, or take less than three minutes watching it in action in one of the lamest screencasts ever:

SendTo Clipboard Screencast from Xavier Vergés and Vimeo

Using it
  • Just download the .hta file and open it. No, wait! Never open .hta files unless you trust its author or you have taken a look at the code.
  • Provided that you trust me or that you have checked the code, you can now open it. Maybe a double click will be enough (your Windows associates .hta files to mshta.exe, a version of IE with high security privileges in your machine). Maybe you need to use the command line and type mshta path2twlink.hta.
  • Follow the simple steps described in the .hta file, and you can start using your new shinny Send To menu items.
  • You are expected to edit the file to customize what gets copied into the clipboard. It should be easy. You may get ideas to push the sendto+clipboard+javascript urls concept further; adding them to the tool should not be too hard.
  • You are also expected to do some dancing, since this is DanceLikeMattHardingWare.
Lessons learned while hacking
  • I initially wanted to use just a .js file. Getting access to the clipboard from a .js file is hard, so I went for an .hta. It turned out to be a good thing, because it ended up providing a way to avoid to the users the trouble of creating the shortcuts by hand and to me the trouble of documenting the recipe.
  • The problem of using an .hta file is that I found no way to keep it invisible, that it has an unusual way to receive its params, and that I had to warn you about its dangerousness.
  • I think that I've spent more time recording the lousy screencast and comparing video hosting services that coding. The number of times that I rerecorded the #@%! thing will remain undisclosed; I have my pride. Regarding the hosting services, after reading about them, I posted the video to google, blip.tv and vimeo.
    I still have no winner, but google's video quality was awfull, so I had to drop it despite its super cool feature of letting you link to a specific point of the video.
    Update: looks like the winner is http://viddler.com: links, comments and tags on specific points of the video, plus the best player of all (in full screen mode, showing the original size, the quality was just perfect): http://www.viddler.com/explore/xdexavier/videos/1


Upcoming DanceLikeMattHardingWare (half cooked hacks)

I have a longish backlog of hacks worth cleaning up and publishing

  • FoxyHistory, a better Firefox History Manager. Having the ability to include urls when searching, and to sort the history by date of first visit has already saved me some time trying to restore some foggy memories.
  • TiddlyWiky SendTo Shortcuts, that allow to easily create customized links to files in a tiddlywiki and tiddlers with the contents of a file (Thanks for that first implementation, -- F.!)
  • MultiTiddlyWiki, that allows to have a bunch of tiddlywikis in a single Firefox tab. Specially nice when used with the terrific WebRunner, a XULRunner based distraction-free browser (Thanks for the link, schilke!)
I also had a xkdc (a webcomic of romance, sarcasm, math, and language) specific bookmarklet, but I just learned about the Long Titles Firefox extension that obsoletes it.

I think that I'll make the hacks available as DanceLikeMattHardingWare:
You are free to do with this whatever you fancy, but you are expected to do some small à la Matt Harding dancing steps now and then.

If you are too serious to dance, consider changing some things in your life, or just use it under some form of beerware or Creative Commons licensing.

Matt Harding in Berlin