Recently in Programming Category

Another script to rename files

programmer_mug-p1682924711369532772ln8f_400.jpg I'm posting another small script to rename files.

I'm working on files with spaces in their name (Oh! The Evil!) and I need to rename them to remove spaces and conver in camel-case.

At this time, I chose Python (version 3) to guarantee the script works also on Windows.

Just create a file called (for example) ToCameCase.py and past into it:

#!/usr/bin/env python3

import sys
import os

if len(sys.argv)<2:
    print("Indicate the file pattern, please")
    exit()

for filename in sys.argv:
    name_tokens = filename.split(" ")
    new_name=""
    for token in name_tokens:
        new_name+=token[0].upper()+token[1:]

    os.rename(filename,new_name)

From the console call the script passing to it the file name o pattern to rename. For example

 ToCameCase.py *.obj

it will convert the name of all the OBJ files in the directory.

Just a warn: it is very simple and only-for-my-usage oriented, so be careful if you use it: read the code and test it before use on your files!

Python lib installer for 64bit windows systems

I'm developing tools to support automatic tasks in a multi-system enviroment for the web radio RadioOhm.

To install additional python libraries on my Win7 64bit, I downloaded the easy_install windows installer and I tryed to launch it.

I realized that the official python website site provides only the 32bit version of the package so the installer fail to find the Python installation.

But this is an happy-ending story. I surfed the Net and I found this website where you can find windows installer for a lot of python library compiled for the 64bit environment. Enjoy it!

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Be an Emacs pro

I saw a interesting page that explain how to be more productive by Emacs.

Read it, it is awesome: http://sites.google.com/site/steveyegge2/effective-emacs

Emacs for Python guys

ropemacs_example.png

The necessity to face Python programming in a "extremely serious way" leads me to try to define a portable and powerful development environment. For long time I used IDLE for Python programming but there isn't enough feeling between us.

I need a consistent multiplatform python programming environment because I work on 3 different operating systems (Win, Mac, Linux) and 2/3 different distro for each of it (XP, Vista, 7, archlinux, debian, ubuntu, slackware...).

Mainly I love texmate but it works only on Mac machines. My first choiche is EMACS on Linux systems (ok, ok, it's not true: for sysadmin tasks I prefer Vim...) On Windows... damn! After years, I'm still looking for something making me effectively comfortable.

Today, Googling for a while, I found an interesting post on http://www.enigmacurry.com

It describe a solution based on:

On Archlinux, installing the tools is trivial by Yaourt:

> yaourt -S ropemacs

> yaourt -S emacs-yasnippet

I'm going to test these for a while: if I'm happy with it, I'll post my configurations files to make this setup portable