Search This Blog

Loading...

Tuesday, December 13, 2011

I really like the interface to git provided by the GitHub guys: GitHubMac Home Page

Friday, August 26, 2011

Removing PackageKit

Finally I found how to remove the annoying "Command not found" message from the command line on fedora :
yum erase PackageKit

Sunday, August 21, 2011

Comparing E-mail Address Validating Regular Expressions

It seems there is NOT a unique way of validating an email address by a simple regexp; http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses" From stackoverflow you arrive at different websites, among which there is http://isemail.info/about that provides a php,java and C# package to check the email. Is neat also the trick of adding a + sign to the end of your email to a website, to track if they gave the email to someone else. Nice also the quote: be conservative in what you do, be liberal in what you accept from others. So do you still think parsing an email is easy ?

Saturday, August 20, 2011

Tuesday, August 9, 2011

Finding synonyms from the command line in linux

Just found Wordnet

A Dictionary-Thesaurus for Linux

To find a synonyms (useful when trying to find a meaningful name for an object ) just type

wn -simsv


Wednesday, July 27, 2011

Nice trick to get the memory usage of a python process

From: StackOverflow Question:

import os

def memory_usage():
    pid=os.getpid()
    return next(line for line in open('/proc/%s/status'%pid).read().splitlines()
            if line.startswith('VmSize')).split()[-2]"

Thursday, July 14, 2011

How to decode Vorbis from a Webm audio stream

I had to decode audio in vorbis format from a webm file, here are some notes on what is involved in the process.

First of all you need to extract the AudioTrack from the WebM file.

Then from an AudioTrack Extract the privateData from it getPrivateData(size);

This PrivateData is the Header that libvorbis needs to initialize the internals of the VorbisDecoder

The VorbisDecoder needs 3 Ogg packets. This ogg packets have to be extracted from the PrivateData.

You have to unpack them as described in
Vorbis 3 Packets Specification (Xiph Laced format)

Then you are ready to follow the process described in :

Vorbis Decoding worflow

Pay attention that the internal buffer is limited so you have to call vorbis_synthesis_pcmout
after vorbis_synthesis_blockin. Always check for the return values of this functions.

The buffer returned by vorbis_synthesis_pcmout is in FLOAT32. To covert them to int16 you have to
multiply by 2 ** 15 - 1 and then clip them between - 2 ** 15 and 2 ** 15.

Pay attention to the number of channels as the data is stored as sample_ch1, sample_ch2, sample_ch1, sample_ch2.

Have fun !

Wednesday, July 13, 2011

Git Command

# How to list git untracked files
javascript:void(0)
git ls-files --other --exclude-standard >> .gitignore

Tuesday, April 12, 2011

Logitech Control Center for Macintosh® OS X

Bought a new mouse, but the provided drivers does not work,
I had to download and install from:

Logitech Control Center for Macintosh® OS X

SELECT COUNT(grade) FROM table GROUP BY grade ORDER BY grade

How to create an histogram from a SQL database.
From:
http://stackoverflow.com/questions/485409/generating-a-histogram-from-column-values-in-a-database

Wednesday, April 6, 2011

Installing PyTables On Fedora

Steps that I am doing to install PyTables on Fedora 10.
sudo yum install hdf5-devel
sudo yum install bz2-devel
sudo yum install lzo-devel
# optional : create and activate a python virtualenv
pip install -U numexpr

pip install http://pytables.org/svn/pytables/branches/std-2.2


now the trick is to go inside the build directory (/build/tables if you are using a virtual environment)
and execute:

python setup.py build_ext -i
the you can simply do from the tables directory:
pip install -U .

Simulated Annealing

This morning I spent one hour refreshing the method of simulated annealing. I find very interesting how the association and explanation using thermodynamics terms makes the problem very easy to understand

Tuesday, April 5, 2011

Interesting approach to metadata in a file format

Reading Stackoverflow:


"tend to store metadata in a structure at the END of the file, not the beginning. This has two advantages:

Truncated/unterminated files are easily detected.
Metadata footers can often be appended to existing files without impacting their reading code."

To read the file simply seek to the end - sizeof(Metadata) and search for the magicString

Sunday, April 3, 2011

Cool tricks With Automator

After discovering the cool trick with latex on my previous post I played around a bit more with services.
And I discovered a new world.

Following the instruction from MidWinter :

I managed to create my own Convert Image service:




Here is how it looks like on my Automator:



A part from

OmniGraffle and Latex

Today I discovered something really really nice and useful.
Being a mix between an artist and a scientist, I use daily both OmniGraffle and Latex.

You can create latex images directly from OmniGraffle using the Latex services provided by
MacText:






Result:







Saturday, April 2, 2011

How to upload images from your Computer to the Web

Well I was dealing with a lot of small images that you need to share around the internet in a quick and fast way, but also that are not really important to you like common life-picture.

Is there any good tool to upload quickly an image to some sort of pastebin for images website ?
Are there any good paste-image services on the web?

I liked the stackoverflow way of uploading pictures, and then I noticed the small link to their provider: Imguru.com

I registered in a breeze and ... surprise ! they have already tools to do what I need:
From the Tools Page:

A Google Chrome Extension:

https://chrome.google.com/extensions/detail/ehoopddfhgaehhmphfcooacjdpmbjlao

I did not tried each plugin but I am very happy with this simple Macos Uploader :

http://cocoastep.github.com/uploadur/#9-about.png

Python PostgresSQL and puntuaction

I am experimenting some Database processing and as a simple test I want to query all the entries of a database that contains a given text.

What if the text contains quotes ?
Using psycopg2 the solution si to use adapt

Reading Stackoverflow answer and testing them myself the solution is to use the adapt function


from psycopg2.extensions import adapt

Wolfram at TED 2010

Good quotes from the Video of Wolfram at TED 2010


I really liked the phrase:


We're used to having science let us predict things.
But something like this is fundamentally irreducible. The only way to find its outcome is effectively just 
to watch it evolve.




The video that he shows contains pretty much mind blowing examples 



Video About Wolfram Alpha

I just finished to watch the introductory video about Wolfram Alpha
It mainly explained the main feature of the website and their main challenges in how to implement it.

I also liked the break down of their challenge:
  1. Data Acquisition
  2. Data Curation
  3. Linguistic Curation
  4. Dynamic Visualization
or as I translate;
  1. Get the information
  2. Extract the Good Information
  3. Make it understandable
  4. Make it attractive


Interesting sales data

While playing with WolframAlpha

I came up to this interesting data of retail sale per item, provided by the US govern census

Monthly & Annual Retail Trade