working with pypm/python in internet proxy on windows

Posted on Wed 11 April 2012 in General • Tagged with easy_install, internet proxy, pypm, python, windowsLeave a comment

Well guys,

Currently I am working on PC in my company's development center.Its an Windows XP. This place is highly secured, you need to get all proxy setting for your internet use.

I want to install few python packages with pypm, but in DOS prompt it is not allowing me to do that.

So after little bit of google, i got the solution as below:

-set HTTP_PROXY=domain\username:password@myproxy:myproxyport

example: set http_proxy=IND\namit.kewat:xl123456@192.168.180.150:8880

after that.. .pypm works fine!!!


Solution of "UnicodeEncodeError:'latin-1' codec can't encode character ..." while working with MySQLdb and Python.

Posted on Wed 28 March 2012 in General • Tagged with mysql, mysqldb, pythonLeave a comment

I got the error of "UnicodeEncodeError:'latin-1' codec can't encode character ..." while i was inserting data into mysql with MySQLdb/Python.

Below is the solution:

import MySQLdb as litefire
conx = litefire.connect('127.0.0.1', 'root', '' , 'litefire2' );
conx.set_character_set('utf8')
conr=conx.cursor()
conr.execute('SET NAMES utf8;')
conr.execute('SET CHARACTER SET utf8;')
conr.execute('SET character_set_connection=utf8;')

Enjoy,


XBRL Extension Boost pack (for SEC fillings)

Posted on Thu 22 March 2012 in XBRLLeave a comment

I think the title of this post is correct in the sense that the amount of extensions that have been created in XBRL fillings on sec.gov.

Python/ElementTree has helped me in doing so!

I have extracted all extensions that are gone in XBRL fillings of during that last quater of 2011. Output has surprised me. It is 1092354. There are 1092354 line of labels(with their extensions) during last three months of 2011 were filling in XBRL on SEC.

SEC has given around 16000 elements and we have created so much extensions.

Well i am putting my output in excel as a link. They are in 8 parts; 1-1 for 10th and 12th month and 6 part for 11th month of 2011. Below is the link for that.

http://dl.dropbox.com/u/2409700/extenstion_database/out_10.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_1.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_2.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_3.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_4.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_5.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_11_6.xlsx
http://dl.dropbox.com/u/2409700/extenstion_database/out_12.xlsx

In the excel there is a column as "sumtax", it gives information about taxonomy version; 2 for UGT-2011 and 1 for UGT-2009 and 0 for mutual funds ... .

Anyway, such amount of extensions will create XBRL mess. We can't compare our financials when there is so much difference in xml tags of valuable data.

I think one solution will be, lets put this data into public domain, just like search taxonomy feature of xbrl.us and tell fillers to use from this database when they require extra extensions.

Solve it like a distrubuted way.(like wiki has grown)

Also along with it, chartered accountant from all over the USA/abroad should invest their little time online for finding elements which has similar meaning. Because we are focusing on single and last quarter, it will be sufficient for us.

Anyway, lets see, may be FASB/SEC will prohibited the extensions or public domain will find their way to standardize extensions(based on the concept of crowd sourcing).


My first AI game of Credit/Debit

Posted on Wed 21 March 2012 in XBRL • Tagged with AI, credit/debit, NLTK, python, xbrlLeave a comment

I have created a game in python using Natural language Toolkit which is a library in python for processing of language.

I have used US GAAP 2011 taxonomy as base database, which later will be utilized to understand the meaning of input. SQLite will support me in doing that.

Results are pretty satisfactory, with 55% accuracy tested on 7500 XBRL monetary type elements.

Anyway, it was for fun only.. .


Solution of "Could not Find any X11 fonts, check that Font path is correct" while working with "R-statistics" and "Python-rpy2" on MAC LION 10.7.2

Posted on Mon 13 February 2012 in General • Tagged with bashrc, Could not Find any X11 fonts, python, R, R Foundation for Statistical Computing, rpy, rpy2 and python, X11, x11 fontsLeave a comment

Such kind of error i got while i want to get some graphics using python and rpy on Mac LION 10.7.2.
After some google i got the solution, but that search was very tedious, so i decided to simplified the whole procedure. Below is the solution for that.

First check where our problem is located. When you give command like 'xeyes" in your terminal, it open eyes, that means X11 is there.
Now in your "R" GUI or from your terminal interface give sample task, it can be "plot(1,1)".
Here i can see the same error which i am getting in python intrepretor,
its
"Could not find any X11 fonts
check that Font path is correct"

Then in your R, given another command like "sessionInfo()".
You can see both of above command in pic given below.

In "sessionInfo()" you can see that in "Local" fonts are mentioned but this list in incomplete.

So here we got the troubled part and by fixing this point our problem is solved.

For that open "etc/bashrc" and add the following lines which is mentioned below the lineĀ "Setting for the new UTF-8 terminal support in Lion" as in pic below.
These two lines are:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Save the changes, and restart it!

After new logging, give "sessionInfo()" command in your R, You can see in missing fontsĀ are there, and for simple ploting of "plot(1,1)" gives desired output.