Monday, April 1, 2013

How to save namespaces of XML in dictoinary in Python and Lxml

I have a XML file with many namespaces:
 xmlns:ser="https://some_address" xmlns:mirror="https://some_mirror_address"/>
I am using lxml and python to this type of file. Now, My requirement is, When I parse this XML file I need to store all namespaces in a dictionary like:

nsd = {'ser' : 'https://some_address', 'mirror' : 'https://some_mirror_address'}
The intention of this, the namespaces are not predetermined. So When I parse the XML I need to store all the namespaces in a dictionary and then proceed with further activities.
Is this possible to achieve in lxml?

Why would sbt reload gen-idea use 6GB of memory?

I'm using the command

sbt reload gen-idea
to build a largish (hundreds of thousands of lines of code) IntelliJ Scala project.
After about 30 minutes+, the program is autokilled because it runs out of memory. I checked, and it used 6GB before getting killed.
What's going on? Can I do anything to improve this?

Install Chromium OS on USB Flash Drive with Ubuntu/Linux Mint

This article is for those who want to install and run ChromiumOS onto a USB storage device. Let us see how it can be done with the OS image.

Open the terminal and run these commands to download the ChromiumOS image to your home folder:
mkdir ~/ChromiumOS; cd ~/ChromiumOS
wget -c -O
unzip ChromeOS*.zip
mv ChromeOS*.img ChromeOS.img
Run the following commands and to identify the USB device:
fdisk -l
If you mounted the USB flash drive as /dev/sdb1 on your system.  Use the command and unmount the USB device:
sudo umount /dev/sdb1
Use your USB device name and replace /dev/sdb1
Run the following command to create a bootable USB device with the Chrome OS image. It will delete all data from your USB device.
sudo dd if=ChromeOS.img of=/dev/sdb1 bs=4M
sudo dd if=ChromeOS.img of=/dev/sdb1 oflag=direct
Boot from the Chromium OS USB flash drive after finishing the process. To boot from USB storage devices, you can use the Plop boot loader too. the ChromiumOS VM can download and use from when you fail to create a bootable USB stick.

Bodhi Linux 2.3.0

Jeff Hoogland has announced the release of Bodhi Linux 2.3.0, a new version of the Ubuntu-based distribution with the latest Enlightenment window manager: "After almost exactly three months since our Bodhi 2.2.0 release the Bodhi team and I are happy to announce the next update release for our 2.x.y series - Bodhi Linux 2.3.0. Again because this is a minor update release people who are already using our 2.x.y branch can simply upgrade to this release via their package manager. As with our 2.2.0 release there are three disc downloads for this version: 32-bit featuring a current PAE enabled kernel, 32-bit featuring a non-PAE kernel with older hardware support, 64-bit featuring a current kernel. Software wise we see the following updates with this release: Linux Kernel 3.8, Enlightenment 0.17.1, Midori 0.4.9, Terminology 0.3.0, eCcess system tool, Ubiquity 2.12." Here is the full release announcement with screenshots. Download (torrents): bodhi-2.3.0-64.iso (603MB, MD5, torrent).

Facebook desktop api not working Fine from 19th of March

 Is there any changes in facebook desktop api , as FacebookDesktop.login's callback function that was working fine ago,now returns fail for my Flex-Air desktop application. Here i means same code was working file before 19th of March.

protected function init(event:AIREvent):void
                    //Initialize Facebook library               
                    FacebookDesktop.init(APP_ID , handleLogin);
    // function to handle login
    protected function handleLogin(result:Object, fail:Object):void {
            trace (fail +" handleLogin " + result);
            if (result) { // User successfully logged in.                   
                } else { // User unsuccessfully logged in.
                                   // code

    // btnLogin click handler
    protected function handleLoginBtnClick(event:MouseEvent):void {

            FacebookDesktop.login(handleLogin, permissions);