vendredi 29 décembre 2006

Switching from a Linux to a Windows Desktop

When I'm using a WinXP desktop I'm searching for an equivalent "Linux experience". Here's what I find useful so far (a mix of freeware and Free Software).

1) Look and feel

I don't like WinXP theme. CristalXP.net have great themes, wallpaper, icons, etc. I use the Microsoft "Royale Noir" a nice dark and sober theme.

Also very handy is iColorFolder to manage folders icons and the ability to quickly set their color for a better visual organisation.

You may also be interested by a Virtual Desktops Manager or want to access the "contextual" command line window from a right click on a folder or maybe to customize completely you're right click menu.

2)Shell and processes

This was the weakest point of winXP for me. Microsoft now released Power Shell and I must admit I find it good (it is just a little long to start). There are also aliases for usual Linux command (ls, pwd, cd /, etc) but I think Power Shell commands are very neat and clear.

Also, if you want to see the running processes in a graphical way Process Explorer is a great tool to replace the Task manager.

3)Copy/Paste and Screenshots

WinXP doesn't keep an history of your cut and paste actions and this can result in a loss of data. Cliptray is a freeware which solve this problem.

Linux distros always come with handy screenshots utilities. Cliptray can also do it but I prefer to use irfanview (tuto).

4)Security

Microsoft OS is unfortunately a big target. Apart from an antivirus and a firewall I feel safer to use Firefox and this KeyScrambler extension against eventual data loggers for login/passwords.

5)Applications

Software are not a problem since I'm using either web services (gmail, google reader,etc) and/or multi platform software (Vim,Python,OOo,Firefox,etc).

Also to work with a Linux PC or server Putty and WinSCP are a must.

dimanche 24 décembre 2006

[win] Visualize your Hard Drive and more

WinDirStat for windows is an excellent Free utility (GPL):

- visualize disk usage per folder of per file types
- click on a box (file or folder) for properties, edition commands, contextual explorer or command prompt

A really nice and useful tool to organize and know more about what's really on your Hard Drive.

http://windirstat.info/

lundi 18 décembre 2006

[Python]: Introspection with help()

An article on this subject

Let's say for example I want to integrate a FTP client in my script and I don't want to lose time searching in books or on the web.

Humm, I'm not sure which lib to use ?

>>> help('modules') #gives a list of all the modules

Oh "ftblib" could be useful, lets check

>>> import ftplib
>>> help(ftplib) # gives a description of this module with the classes, etc.

=> the class "FTP" is what I need for the client part

>>> help(ftplib.FTP) # if I just want to see the description of the FTP class

For more informations about 'help' just type help() at the Python prompt.

Another way to find documentation if you are on-line is to use the Python Sidebar in Firefox.

samedi 16 décembre 2006

[Python] How-to: hide the source code when distributing a Python script ?

Create a .pyc file with your script:

>>> import py_compile
>>> py_compile.compile('myscript.py')

This will produce myscript.pyc (c for compiled) that you can distribute instead of the .py (python will run the .pyc).

[Python] How-to: hide the console

Solution 1 :

Rename the .py file in .pyw (w for window)

Solution 2:

Use' pythonw' instead of Python to launch the script.

This second solution is useful if you have a pyc file : create a shortcut and in it open the file with pythonw (the pyc file won't open a console)

[Ubuntu] How-to boot windows by default

After a fresh Ubuntu install, on a Windows PC, the Grub boot loader put Linux as the default system.

To change the default OS (Windows to boot first in our case):

  • edit the menu.lst file (in /boot/grub) with root rights.
    For example with the Vim editor in a shell:
    sudo vim /boot/grub/menu.lst
  • find and change "default 0" to "default X" where X is the "position" of the Windows OS in the list presented by Grub at boot time (count the "title"s/lines beginning with X=0 for the first line)

Using Vim without the arrow keys

I've used a Linux laptop where the arrow keys don't behave as excepted in Vim and was then forced to learn the equivalent keys.

h: a char back
j: a line down
k: a line up
l: a char forward

All this is accessible from the right hand and leave the left one free to reach the escape key to change mod.

Handy, I begin to like it :)

More informations here and here

EDIT:
Funny, I also discovered that the excellent Google Reader have j and k short-cuts to go down or up on the RSS list :)

[Win] Command line : recording a live video from a webcam or another video device

I use Microsoft Windows Media Encoder 9 Series which is free as in beer (I didn't need to download the free SDK).

In "Program Files\Windows Media Components\Encoder" it installs in particular a script called WMCmd.vbs.

You can run this script with cscript.exe which should already be in "Windows\system32" :

cscript.exe WMCmd.vbs -adevice X -vdevice Y -output C:\test.wmv -duration Z

where,

X= the number of the audio device (I used 1 in my case for my webcam)
Y= the number of the video device (I also used 1 for my webcam here)
Z= the duration in seconds (you can always kill the process on the go if the video is shorter)

For command-line options type "cscript.exe wmcmd.vbs" in the shell.

If I want the video to be shorter than the given duration and want to control this from a Python script I use the DOS taskkill command.

More informations also here.

jeudi 7 décembre 2006

[Win] Video/Audio conversion with MMconvert

I'm searching for a tool to convert videos on Windows (in particular wmv) in a more open format. I also need a command line control (for later Python scripting).

A quick search on SourceForge brings me a first tool : MMconvert

In its installation folder there are MMconvert.exe (for command line) and MMConvertGUI (with a GUI ...)

The GUI version:

- choose the video container in "Video Operations" (I have avi, wmv,mkv)
- "add" one or more video to convert
- select the video and audio codecs to use, "ok" -> "execute"

Command line version:

Let say I want to convert my wmv into a matroska (mkv).

First I check for the audio and video codecs that I have on my computer (and that I can use with this container):
MMconvert.exe /f:mkv /lv
MMconvert.exe /f:mkv /av

This commands gives a list of codecs I can use for the matroska container (just remember the associated number, X and Y in the following).

To convert the video:
MMconvert.exe if=test.wmv of=test.mkv /f:mkv /v:X /a:Y

Memo:
if= input file
of=output file
f=format (for the container: avi,wmv,mkv...)
v=video
a=audio

To know more about the aguments : mmconvert.exe /?

It looks like a great tool but I haven't found yet if I can hide the little "Status windows" in command-line mod. I don't see either if I can play with the bitrate


mardi 5 décembre 2006

What is this ... "Blog" ??

This is more a 'Memo pad' about *technical* stuff than a Blog: I put here fragments of memories, recipes, links, ideas I want to explore, to do, etc.

It's messy, possibly won't be useful to you, but it helps the "externalization of my cognitive functions" (through the search function + permanent web access). There is no password to keep my synaptic delay short ;)

Everything here is in a 'draft'-state