Friday, July 13, 2012

How to easily upgrade your Galaxy Nexus to Android 4.1 Jelly Bean



This tutorial is mainly dedicated to Canadian owner of Galaxy Nexus phones or any owner of a GSM/HSDPA+ version of this phone (I9250) who wants to upgrade to Jelly Bean without waiting for monthes.
Update: you can use this proces to update other versions of Google devices like the Nexus S to any version of Android available from Google website.

It is a very simple process which uses only official Google tools, Firmware and tutorials.

DISCLAIMER: The following process will erase all data on your phone, and may void your warranty. So backup your data and do it at your own risk. I'm not responsible for anything.

The tutorial works with Linux and Windows.

First you have to update your USB config on your Linux box (even if adb already worked). Just create the file has described in “Configuring USB Access” in this page: https://source.android.com/source/initializing.html#configuring-usb-access
Follow only instructions from the “Configuring USB Access” section. All other instructions in this page have nothing to do with what we are doing here.
For windows, using USB drivers provided by Android SDK (often call adb driver) will be good. To download the USB driver, go to http://developer.android.com/sdk/win-usb.html, and go to http://developer.android.com/tools/extras/oem-usb.html#InstallingDriver to see how to install it. When you have the list of the 3 available drivers, instal the "bootloader" one.

Then, you need fastboot and adb software. Fastboot and  adb are available and already compiled in Android SDK ( download it http://developer.android.com/sdk/index.html ). Note that fastbook and adb programs must be in your path. You will find it in platform-tools folder in the sdk. To do that, unzip the SDK somewhere, but avoid spaces in the path to the SDK (a simple solution may be to put the SDK in your home directory), and add "platform-tools" to your path (here is how to add a directory to your path for Linux and windows)

Now we have to download the full firmware for Android 4.0.4 from Google server. We need the “yakju” version of android 4.0.4 available here: https://developers.google.com/android/nexus/images#yakju
Since Android 4.1.1 image is now available, you can directly download the 4.1.1 version, follow the same process to install it and avoid the upgrade process at the end.

Everything is now ready to start upgrading

First thing first, you have to unlock your phone. It's really easy, and Google describe how to do on this page : https://source.android.com/source/building-devices.html.
Since you already have fastboot and adb from Android SDK in your path, jump directly to “Booting into fastboot mode” section. Use the key combination described in the table, for “maguro”: Press and hold both Volume Up and Volume Down, then press and hold Power.
When a screen with some information is displayed, plug your phone on your computer using your USB cable and run this command:
fastboot oem unlock
If the process goes well it should say so. If it hangs saying it is waiting for the device, you may not have the good USB configuration/driver.

Once your phone is unlocked, unzip the “yakju” image you downloaded anywhere you want. From a command prompt, go in the created folder, and run flash-all.sh . This is a script for Linux (or cygwin). If you use Windows, can run the script from a cygwin terminal. Just download Cygwin installer at http://cygwin.com/install.html install it, and then, open a Cygwin terminal.
Wait until the installation is completed. It took 100 seconds for me.

Then you can reboot… and voila, you have Android 4.0.4 running.


Now you have to upgrade to 4.1.1. The first times you will check, it will say it’s up to date and no update is available.
You may have to make the following operations a few times to see the update for 4.1.1:

  • go in:/settings/apps/all/google services framework/
  • once it opens clear data and force stop
  • run "/settings/about phone/check for updates" to see if the update is available.

When it says an update is available, just accept it and the installation of Android 4.1.1 Jelly Bean will start.

That’s that simple. The good thing is that starting now, you will receive all Android upgrades as soon as Google will release them. Isn't it fantastic?

If you have any question, leave a comment.

Wednesday, November 2, 2011

Connect to Windows 8 Remote Desktop / Terminal service from Linux



UPDATE: Since Ubuntu 12.04, Remmina, which is a native remote desktop client, is able to connect to Windows 8. Maybe, you will have to setup your remote desktop server (Windows 8) to allow connection from old clients in your Windows 8 box.
Important thing: When you will connect to your Windows 8 box, you may have only a black window. Don't worry, leave it like that, and open a second connection. The second connection will display your Windows 8 desktop. Now you can close the first connection with the black screen. Don't ask me why it happens this way, I don't know.




Actually, it seems that none of the Remote Desktop / Terminal server clients available for linux are compatible with the new Windows 8 Remote Desktop server / Terminal Server.

However, there is a simple way to connect to Windows 8 Remote Desktop server / Terminal Service from your linux box. Here is the process tested on Ubuntu 11.10 with the default Wine version.

  • Install wine by executing the following command:
    • For ubuntu: sudo apt-get install wine
    • For RHEL/Fedora, as root: yum install wine
    • For last version of wine and other distributions you can go here: http://www.winehq.org/site/download
  • Now download Windows Terminal Service Client from Microsoft website: http://www.microsoft.com/download/en/confirmation.aspx?id=20609
  • When it is donwloaded, double-click on the file to launch it, like for a normal software. 
  • If the installer doesn't launch, open a terminal, go in the folder of the file and launch it with: wine WindowsXP-KB969084-x86-enu.exe
  • Follow the normal install process, like for a standard Windows install. Keep all default options.
  • The install process will not add a launch icon in your application menu, so you will have to create the launcher by yourself. However, at this time, for the purpose of the test, we will launch it from a terminal with the following command: wine ~/.wine/drive_c/windows/system32/mstsc.exe
  • And voila, Remote Desktop Connection is Running, as you can see below. However, having the remote desktop displayed on your screen may need some more settings, as you will see below.

  • Configuring some settings is required. For example, on Ubuntu 11.10, the following configuration is required:
    • In "Wine configuration", disable Direct 3D Pixel Shader:
      • Open "Wine Configuration" interface from your application menu or using this command: wine winecfg.exe
      • Go in "Grpahics" Tab
      • In "Direct 3D" area, un-check "Allow Pixel Shader (if supported by hardware)".
      • You can set "Vertex Shader Support" to "None" if you want, but it's not sure it has an effect.
    • In remote desktop client, Disable Audio streaming to local computer: 
      • Go in "Local Resources tab"
      • Click on "Settings..." in "Remote audio" area
      • Select "Do not Play" in "Remote audio playback" area
  • Now you should be able to have the login screen working and the desktop displayed. Note that it may have some errors or crash.



Friday, April 15, 2011

Set a simple SMTP relay with TLS and authentication

The goal of this post is to show how to configure quickly a SMTP relay for a postfix server. This may allow for example a local postfix server to use a remote SMTP to send emails. It is very useful if your ISP block port 25 and you want to use secure SMTP connection to send email from your local server using a remote server.

The system described here is:
  • a local postfix server
  • a remote SMTP server ( smtp.myserver.com) with TLS secure connection and which require authentication (login + password)

All the configuration is done in  /etc/postfix/main.cf. To edit this file, use this command:
gksudo gedit /etc/postfix/main.cf

First we will set the relay host. Add the following line and replace www.myserver.com:587 with your server information
relayhost = smtp.myserver.com:587
By default, your port may be 25. Set it according to your remote server configuration.

Next, we will set authentication parameters with the following lines:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
 /etc/postfix/sasl/sasl_passwd is the path to the hash file containing login and password information. You need to create this file and insure only root will have read and write capability. The edit the file and write:
smtp.myserver.com username:password
Replace  smtp.myserver.com, username and password with your SMTP server address, the username and password you want to use to login. Then execute the following command:
sudo postmap /etc/postfix/sasl/sasl_passwd

Now, we have to configure the TLS parameters. Add the following lines to /etc/postfix/main.cf:
smtp_use_tls = yes
smtp_enforce_tls = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
In this configuration, we will force TLS use and enforce ssl certificate verification.
If the ssl key used for your server is valid, you may not require more configuration. However, since postfix may try to connect to myserver.com and not smtp.myserver.com, it may not work correctly. Same thing if you uses a self signed ssl key. To fix that, we will use a fingerprint digest verification. To do that, add the following lines:
smtp_tls_security_level = fingerprint
smtp_tls_fingerprint_digest = sha1
smtp_tls_fingerprint_cert_match = 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55:66:77:88:99
 Replace 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55:66:77:88:99 with the sha1 fingerprint of your ssl key. You can use md5 instead of sha1, but sha1 is better.
To find the sha1 or md5 fingerprint, you can connect with firefox on your server (if you uses the same ssl key for the web) and just check ssl certificate information where md5 and sha1 info are displayed.

Now, restart postfix and it should work.
sudo /etc/init.d/postfix restart

Now you can test if everything work by sending email with this command:
echo "test" | mail -s "Test subject" youremail@youremail.com
Replace  youremail@youremail.com with your email address.

You should receive this email.

This configuration allow to relay email, but do not configure your postfix server to allow you to  use the SMTP fonctionnality of your local postfix server ton send email outside. It may need more configuration to give the right to relay email outside. By default postfix prevents it to avoid the server to be used for spam. Setting the following parameters may allow you to send email to email addresses hosted on the remote server (myserver.com), but not to all email addresses.
relay_domains = myserver.com
local_recipient_maps =
smtpd_recipient_restrictions = permit_auth_destination permit_mynetworks reject_unauth_destination
To allow relaying to all addresses, check required configuration in postfix documentation.

Thursday, March 24, 2011

Linux conspiracy against Microsoft Windows and against you

Everybody knows now that Linux and open source community are in a war against Microsoft and its operating system Windows.
What is impressive is to see the amount of energy and ingenuity spent by Linux fans to hurt Microsoft Windows. Recently, the Linux community has found a way nobody may thought possible to prevent Windows 7 Service Pack 1  to install and, in this way, hurt Microsoft Windows 7 security and credibility.
Indeed, they were able to prevent Win 7 SP1 to install as soon as a hard drive with a Linux partition is present in the computer.
Since the reason of the installation error is not understandable for standard humans like you and me, everybody will think that Win 7 SP1 can't install because of a bug in Windows 7 when the source of the issue is in fact Linux.

This is cheap, but this is the way Linux tries to discredit Microsoft Windows.

So, be warn, Linux community is here and is fighting against you....





Ok, I confess, I should have enclosed this post with <troll></troll> or <sarcasm></sarcasm> tags. However you must agree that with such nice, well documented and well thought article I should have been published on slate.com.


Last thing: the issue reported here with Win 7 SP1 installation is real. Crazy, stupid, unbelievable,... but real. This is a very bad issue from Windows 7, not Linux fault.

Sunday, November 7, 2010

Ubuntu logo used to sell Windows 7

We know that Ubuntu and Linux in general is more and more widely used.
So much used that we can see Ubuntu logo on the screen of a laptop advertised by a major electronic shop brand (The Source) both on the flyers and the home page of the web site.
You can see below pictures of the flyers and web site advertisement. But wait, this computer is sold with Windows 7, not Ubuntu.

Is Ubuntu so good that they use it to trick customer into buying Windows 7?

Flyer:

Web Site Advertisement:

Friday, October 22, 2010

Mac AppStore revolutionizes software installation???????

Have I missed something or it is the way it works on all Linux distributions for years now?

Saturday, July 3, 2010

Prevent mythtv from shutting down while you are connected to it

This is a simple python script I use to prevent my mythtv backend to stop when I'm connected to it with samba, http, ssh or other streaming systems...

Just replace 192.168.0.3 or 192.168.0 with the ip numbers from your mythtv backend.
#!/usr/bin/env python
# coding: utf-8

import commands
import sys

res = commands.getoutput('netstat | grep ESTABLISHED | grep -v -e .*192.168.0.3.*192.168.0.3.* -e .*192.168.0.3.*192.168.0.:microsoft-ds.*')
if len(res) > 10:
    sys.exit(1)
sys.exit(0)
 I know that it is possible to use only shell script without python to do that, but I do not master shell script so feel free to modify it to use only shell.

Use this script as the command to launch before shutting down mythtv backend to verify that it can really shutdown.

Sunday, February 21, 2010

Do not buy a Linksys WRT610N


UPDATE 2
Since I use dd-wrt, my random deconnections on irc are gone...  Everything works perfectely!
do not hesitate, switch to dd-wrt.

UPDATE
 After playing a few with the v2 (switch to 5Ghz wifi N), things went wrong. Wireless G stopped working correctly like before. Connection drop, ssid disappeared, etc.. Tried factory default configuration, flash firmware again, hard 30-30-30 reset...Nothing saved my router. This router is really a shame. It is clearly defective by design! Finally, I decided to install dd-wrt on, and since this time, everything works perfectly.  To find the last versions of dd-wrt, it's here (just write wrt610n in the field and choose your version of the router). For instructions on how to flash the router, it's here for v1 and  here for v2. Follow all instructions very carefully, this manipulation is risky for your router. Be informed that you may brick your expensive router. When the tutorial says do "hard reset", this means press the reset button during several seconds until the lights on the router blink.

Last but not least: with dd-wrt you will be able to do much more things with your router than what you could do with the original firmware.
END OF THE UPDATE


Here is a my experience with one.... in fact two Linksys WRT610N routers.
Basically, on the paper this router is really good:
  • Dual b,g,n Wifi card with 2.4 and 5Ghz support
  • 4 Gigabits ethernet connectors
  • 1 USB connecteor for mass storage disks or anything you want with specific linux distribution like dd-wrt.
When I received my first WRT610N v1, everything was fine. The 5Ghz wifi N worked perfectly with a 10MB/s (100Mb/s) bandwidth.

Then, I bought a PS3 old generation. And things started to go wrong. I switched the router to 2.4Ghz mixed b,g,n and tried to connect. The result: a very bad or impossible connection from the PS3. It seems that there is an incompatibility with the PS3. I changed my PS3 with a new slim version. The wifi started workimg correctly except that regularly, the wifi crashed, and the router needed to be rebooted. This was not a PS3 issue since all my wifi system stopped working.

Since this was not an acceptable behavior, I returned my router to the shop and get a new WRT610N v2 for free, as a replacement.

I expected major improvements with this new release. Unfortunately, things were as bad as before. The wifi regularly stopped working. It was even impossible to see the wifi (no ssid broadcast) from any of my computers. The ultimate solution I found was to set only the wifi G. With only G and no mixed mode, everything started working well.

When I say well... I don't talk about my normal connections using ethernet cable. Indeed, since I replaced this router, I am randomly disconnected from irc. This is something I never had before.

So basically, this router is really a shame, and should have been removed from the market since a long time.

It seems that most of the problems are hardware, since I tested the v1 of the router with standard firmware and dd-wrt and I had the same issues in both cases.

Sunday, November 22, 2009

Time Traveler... a sort of Time machine system

This is not a nice script, but it does the job for me in the way I need it to work. I share it with you in the case it can be useful to you.
I did it to store Time Traveler data on a separate disk, it is why I don't use a maximum backuped data size, and instead a free space to keep before starting the backup.
All backups are stored in folders starting with the time_t value, then the date in human readable format.
It is used in a server, so it sends the result to an email address. You can use it with cron for example.

The script is in python, so just copy it in the file timetraveler.py, change source and destination folder and email address at the top of the file, then chmod 700 timetraveler.py, then run it. Be sure you have python and rsync installed. Us only a linux compatible file system as backup folder (ext2, ext3, ext4 or other... not fat32 or ntfs, since I don't know if it will work)

Here is the script.
#!/usr/bin/env python
# coding: utf-8
#  TimeTraveler (c) 2009 Walter  http://computersstoneage.blogspot.com/
#
#
#TODO:
#     Répér dans les logs la sortie des commandes:
#            rm
#            rsync
#
import commands
import datetime
import time
import array
import string
import os


freeSpaceLimit = 50*1024*1024; #required disk space to start the backup in Ko. here it is 50Go.
path = "/mnt/timemachine/"  #folder where to store backups
source = "/mnt/data/"  #rértoire à auvegarder
mail = "/usr/bin/mail" #mail software
email = "timemachine"    #mail address to send the result of the backup


def disk_get_free(path):
    res = commands.getoutput('df -k '+path).splitlines()
    return int(res[1].split()[3])
  
def get_size(val):
    if val < (1024):
        val = str(val)+ ' KB'           
    elif  val < 1048576: #(1024*1024):
        val = str(float(int(val/102.4))/10.0)+ ' MB'       
    elif val < 1073741824 :#(1024*1024*1024):
        val = str(float(int(val/(104857.6)))/10.0)+ ' GB'   
    else:
        val = str(float(int(val/(107374182.4)))/10.0)+ ' TB'
    return val




date = str(datetime.datetime.now())
date = date.split()[0]
total = int(time.time())
#print(str(total)+"_"+date)

dest = path+str(total)+"_"+date

log = "STARTING TIMEMACHINE: "+str(datetime.datetime.now())+"\n"
log=log+"Backup folder: "+path+"\n"
log=log+"Source folder: "+source+"\n"
#lastInt = 0
#lastName = date+"_"+str(total)




#methode 1: je purge en fonction de l'espace disque
#print disk_get_free(path)
freeSpace = disk_get_free(path)
log = log+"Starting disk space recovery:\n"
log = log+"\tActual disk size: "+get_size(freeSpace)+"\n"
log=log+"\tDisk space to keep: "+get_size(freeSpaceLimit)+"\n"
if(freeSpace >= freeSpaceLimit):
    log=log+"\tNo need to free disk space.\n"
empty = False #cela me permet de savoir si j'ai encore des fichiers àffacer
while freeSpace < freeSpaceLimit and empty==False:
    files = os.listdir(path)
    files.sort()
    empty = True
    if len(files)>0:
         tab = files[0].split('_')
         if(len(tab) > 1) and str(tab[0]).isdigit():
            command = "rm -rf "+path+files[0]
            #print(command)
            log = log+commands.getoutput( command )
            freeSpaceNew = disk_get_free(path)
            log=log+"\tRemoving "+files[0]+": "+command+" recovered "+get_size(freeSpaceNew - freeSpace)+" => "+get_size(freeSpaceNew)+" free.\n"
            freeSpace = freeSpaceNew
            empty = False
   
if(empty==True):
    log=log+"ERROR: Can't recover enough space from previous backup. Current free space: "+get_size(freeSpace)+".\nABORTING BACKUP.\n"
    #print(log)
    p = os.popen(mail+" -s  \"Time machine "+str(datetime.datetime.now())+" - ERROR\" "+email, 'w')
    p.write(log)
    exitcode = p.close()
    exit()
log=log+"Disk space recovery finished.\n"



files = os.listdir(path)
files.sort()
found = False
i=0;
lastBackup = ""
size = len(files)
while found==False and i
    #print("i:"+str(i)+" size:"+str(size))
    tab = files[size-i-1].split('_')
    if(len(tab) > 1) and str(tab[0]).isdigit():
        found = True
        lastBackup = files[size-i-1]
    i = i+1
   
   
#lastBackup = "path"+files[len(files)-1]
#La, j'ai plus qu'a faire mon backup
command = ""
if lastBackup != "":
    log=log+"Found previous backup to increment: "+ lastBackup +"\n";
    command = "/usr/bin/rsync -a --safe-links  --stats --link-dest="+path+lastBackup+" "+source+" "+dest
    log=log+"Starting incremental backup:\n"+command+"\n"
else:
    log=log+"No previous backup to increment found.\n";
    command = "/usr/bin/rsync -a --safe-links --stats "+source+" "+dest
    log=log+"Starting complete backup:\n"+command+"\n"

log = log+commands.getoutput( command )
log=log+"\nBACKUP FINISHED!"
#print("Commad: "+command)



log = log+"Time machine finished: "+str(datetime.datetime.now())+"\n"
p = os.popen(mail+" -s  \"Time machine "+str(datetime.datetime.now())+" - OK\" "+email, 'w')
p.write(log)
exitcode = p.close()


 That's it

Sunday, November 15, 2009

Frets on Fire and FoFix Song Cover Art and/or Album Cover Art Downloader

Maybe you are a fan of Frest On Fire or FoFix (personnaly, I prefer Fofix, since it has much more capabilities and less bugs).
Maybe you have some songs to play, and you would like to have cover art for your song list. To help you retrieving them automatically, I created this short script.
It is a very dirty script, and is not able to get all cover art. However It seems to make the job pretty well
For linux users, this script is usefull to, since it changes filenames starting with a upper case to lower case in songs folders.

WARNING: BE VERY CAREFUL. THIS SCRIPT IS JUST AN EXAMPLE OF WHAT IT IS POSSIBLE TO DO. THIS SCRIPT CONNECT TO AMAZON TO FIND THE COVER ART. YOU HAVE TO CHECK WITH AMAZON FIRST TO KNOW IF YOU CAN USE IT AS IS. I'M NOT RESPONSIBLE FOR ANY THING THIS SCRIPT CAN DO. USE IT AT YOUR OWN RISK AND AT YOUR OWN RESPONSIBILITY. CHECK IT DOESN'T DO THINGS WHICH MAY BE FORBIDDEN BEFORE USING IT.

Maybe you can modify this script to use another search engine.
This script needs ImageMagick program called "convert" to work.
It is a python script. To use it, create a file called coverart.py in your "songs" folder, then copy/paste the script below, and save the file. Then, using a terminal, go in your song folder and execute: python coverart.py
The script will check for songs in sub-folders recursively and download album cover art for each song.

Here is the bad and dirty script:


#!/usr/bin/env python
# coding: utf-8


##########################################################
#                                                        #
# Copyright Walter http://computersstoneage.blogspot.com #
#                                                        #
# This program is free software; you can redistribute    #
# it and/or modify it under the terms of the GNU General #
# Public License as published by the Free Software       #
# Foundation; either version 2 of the License, or (at    #
# your option) any later version.                        #
##########################################################


import urllib
import shutil
import re, os
import commands

def download(url):
    webFile = urllib.urlopen(url)
    a = webFile.read()
    start = a.find('._SL')

    a = a[start-70:start]
    start = a.find('http://')
    img =  a[start:]+"._SL500_AA240_.jpg"
    #print img
    return img

def getinfo(path, cover):
    artist = ""
    song = ""
    try:   
        f = open(path+"song.ini", "r")
        tmp = f.readlines(2000)
        f.close()
        for line in tmp:
            if (line.strip().startswith('name') or line.strip().startswith('Name')):               
                song = line.strip().split("=")[1].strip()
                a = song.find('(')
                if a > 0:
                    song = song[:a]
            if (line.strip().startswith('artist') or line.strip().startswith('Artist')):
                artist = line.strip().split("=")[1].strip()
                a = artist.find('(')
                if a > 0:
                    artist = artist[:a]
        song = song.replace(' ','+');
        artist = artist.replace(' ','+');
       
        return 'http://www.amazon.com/s/ref=nb_ss?url=search-alias%3Dpopular&field-keywords=%22'+artist+'%22+%22'+song+'%22&x=0&y=0'
    except:
        print "Failed to open "+path+"song.ini"
        #return ""
        exit
       
   
def AddCoverArt(path):
    url = getinfo(path,True)
    if len(url) < 10:
        return
    img = download(url)
    if ((len(img) < 20) or (len(img)>1000)):
        print("Nothing found with cover for: "+path+" "+url);
        return
    img=urllib.unquote_plus(img)
    print("Loading: "+img)
    try:
        webFile = urllib.urlopen(img)
        localFile = open(path+"album.tmp.png", 'w')
        localFile.write(webFile.read())
        localFile.close()
    except:
        print "Can't get: "+img
        return ""


def ScanDir(g):
        files = os.listdir(g)
        for f in files:
                if(os.path.isdir(g+f)):
                        print('Entering: '+g+f+'/')
                        ScanDir(g+f+'/')
        if(os.path.exists(g+'Song.ogg')):
                print( 'mv '+g+'Song.ogg '+g+'song.ogg')
                os.rename(g+'Song.ogg', g+'song.ogg')
        if(os.path.exists(g+'Song.ini')):
                print( 'mv '+g+'Song.ini '+g+'song.ini')
                os.rename(g+'Song.ini', g+'song.ini')
        if(os.path.exists(g+'Notes.mid')):
                print( 'mv '+g+'Notes.mid '+g+'notes.mid')
                os.rename(g+'Notes.mid', g+'notes.mid')
        if(os.path.exists(g+'Rhythm.ogg')):
                print( 'mv '+g+'Rhythm.ogg '+g+'rhythm.ogg')
                os.rename(g+'Rhythm.ogg', g+'rhythm.ogg')
        if(os.path.exists(g+'Guitar.ogg')):
                print( 'mv '+g+'Guitar.ogg '+g+'guitar.ogg')
                os.rename(g+'Guitar.ogg', g+'guitar.ogg')
        if(os.path.exists(g+'guitar.ogg')) and (not os.path.exists(g+'song.ogg')):
                shutil.copy2(g+'guitar.ogg', g+'song.ogg')
                print( 'cp '+g+'guitar.ogg '+g+'song.ogg')
    if(os.path.exists(g+'Album.png')):
        os.rename(g+'Album.png', g+'album.png')
                print( 'mv '+g+'Album.png '+g+'album.png')
    if(os.path.exists(g+'song.ini'))and (not os.path.exists(g+'album.png')):
        AddCoverArt(g)
    if(os.path.exists(g+'album.tmp.png')):
        #os.rename(g+'album.png', g+'album.tmp.png')
        cmd = 'convert "'+g+'album.tmp.png" "'+g+'album.png"'
        print('Convertion: '+cmd)
        commands.getstatusoutput(cmd)
        os.unlink(g+'album.tmp.png')
       
ScanDir('./')



That's it...

Saturday, October 10, 2009

Fix a Happauge Wintv-PVR-150 which do not initialise correctely on linux


Maybe you have a Wintv-PVR-150 card on your Linux box, and you regularly encounter some "initialization" problems, even if the card is correctly recognized by linux.
Symptoms may be:
  • no mpeg2 output (empty video file in mythtv)
  • only snow (channel can't be selected?)
  • black picture
  • picture stretched or distorted
  • black and white image
To fix this problem there are two things you can do:
  1. Move your card on another PCI slot and see if things improve
  2. Change your motherboard
For sure changing the motherboard is not something we want to do, but sometime,  you have no choice.

I had this problem, and if changing the PCI slot reduced the ratio of bad initialization, it didn't fixed it completely. After my system died, I changed the motherboard and CPU, and now everything works perfectely.

Sunday, September 6, 2009

How Windows 7 is better than Linux

Ok, this is some training documents from Microsoft for resellers, and this is so good... Microsoft FUD at its best.













Friday, July 31, 2009

Sunday, July 19, 2009

How to prevent auto-replies to be sent when spams are received

This is a simple solution to not send auto-reply messages when you receive a spam, using spam assaassin, postif and webmin auto-reply system.

Here, I consider that you use webmin to manage your server and auto-replies , that your mail server software is postfix and spamassassin is configured and works. Since the default way spamassassin works is to add some text to the subject of your emails if it is detected as a spam, I consider that the text which is added is "[SPAM]".

To prevent the autoreply system set by Webmin to send a reply to emails detected as spam, just add the following code in file /etc/webmin/postfix/autoreply.pl at line 77:
if ($header{'subject'} =~ m/[SPAM]/) { exit 0; }
If your spamassasin system add another string to the subject, change [SPAM] for a string corresponding to your system.

Once everything seems to work perfectly, you have to modify the file autoreply.pl stored in the library folder of webmin, since webmin will replace the thew one you already modified by the one in its library folder every time an autoreply is created/modified. To do that, just copy the one you modified over the one in webmin library folder:
cp /etc/webmin/postfix/autoreply.pl /usr/libexec/webmin/postfix/autoreply.pl



That's it that's all...

Friday, February 6, 2009

Gnome Panel auto-hide stop working

Something boring with gnome panel is that it stops hiding automatically quite usually.
A simple way to restore the hide/unhide function quickly when it happens is to use the command:
killall gnome-panel

This command will kill gnome-panel, and it will restart automatically. It's not very nice, but it works.

To ease the process, just create a launcher with this command. This way, you will be able to restore you gnome-panel functionality with a simple click.

Gnome Panel advanced customization

Ok, lets start with a few tricks to customize your gnome panel.
I will talk about few parameters of the gnome panel which can't be changed from the gnome panel configuration interface.

The things I really don't like with gnome panel and which are not customizable from the configuration interface are:
- the time it takes to start showing/hiding
- the fact that the bar can't hide completely
- the slow movement of the panel
- the time it takes before hiding


To change these parameters, it's necessary to launch gconf-editor. To do that press alt+F2, then type gconf-editor in the text area, and press enter.

The following windows will appear:

Then, browse the the folder tree on the left to go to: /apps/panel/toplevels/panel_0
The interface should look like that:
If you use more than one panel, you may have panel_0, panel_1, ... folder. Choose the one which is the panel you want to customize.
If you don't know which folder is which panel, just change a few values. Since changes are effective in real time, you will quickly see which panel you modify.

To change a parameter, just double click on it.

Now here are interesting parameters:
  • animation speed: define the speed of the show/hide movement. Can be slow, medium or fast. If you want the panel to show/hide instantly, uncheck the parameter "enable_animations"
  • auto_hide: check if you want your panel to hide automatically when the mouse leave it
  • auto_hide_size: very useful, it's the size of the bar when it is hidden. Set it to 0 if you want the bar to disappear completely
  • enable_animations: If you want the panel to show/hide instantly, uncheck it
  • hide_delay and unhide_delay is the time the panel takes before hiding and unhiding in milliseconds (1 second = 1000 milliseconds)
All other parameters can be changed from the panel configuration interface.