So today I go to hackerspacekl which is a awesome place. One of their project now involving arduino. And they making their own. For the rest, I allow the pictures to do the talking. Check the links too
Monthly Archives: April 2010
android, foss and geeks @ #barcampkl 2010
BarcampKL 2010 just ended yesterday. It is a pretty awesome with many geeky talk, me as a geek, like it.
- we have the first podcast of This Week In Asia, and it is pretty awesome, it is something of a talk show with audience, now transmitted to cyberspace thanks to p1 wimax(aka the sponsor of BarcampKL)
- First time in barcampkl, we voted for talk. Where everywhere else, it is there already. And interestingly it serve as a check and balance of the talk. So we ends up with pretty interesting talk
- For the first time, I’ve seen Jedi vs Ninja…. What really happens is, KageSenshi was in the room where somebody brought a Light Saber, and kagesenshi teaching some sword fighting technique. and the other guys, practice their light saber skills. lolz
- Android hacks, member of Code Android malaysia, showing a android controlled robot, using a g1 and arduino. With python. No worry, the robot is benign, it still not a rival of the Governator.
- Time management by kaeru, i surprisingly learn alot
- Ditesh enlighten us with javascript
- Project Nimbus the Geeks On A Train in Singapore, they have manage to convence the government on singapore and some company to release data and using Open Data Protocol, they releases data to be used.
- Nginx talk is awesome too.
- Cookies and Cupcakes, that is real tasty!!!!
Accessing world bank api using python
World bank have recently release their data and you can access it through
http://data.worldbank.org/
It also includes API access through it. Which is a web api. Either way it is pretty easy to access from my 5 minute toying around. My experiment attempting to find population of malaysia,
1 |
import urllibimport urllib2 |
1 |
# here i use json, but the api also support xml |
1 |
import json |
1 |
# for url parameter, just to make it look niceparam = urllib.urlencode({'api_key':'your api key','format':'json'}) |
1 |
# get population of malaysia |
1 |
url = 'http://open.worldbank.org/countries/my/indicators/SP.POP.TOTL' |
1 |
data = urllib2.urlopen(url+'?'+ param)result = json.load(data) |
1 |
# btw result[0] is the data on the pages etc, data start at index 1 |
1 |
print result[1] |
1 |
1 |
1 |
<span style="font-family:'Times New Roman';"><span style="white-space: normal;">This is the result, after i clean up my codes and clarify it</span></span> |
BarcampKL is back 2010
using the subprocess module
I was trying to automate some task involving shell programs, which actually a handful to type. As a lazy programmer, AUTOMATE WE MUST. Just turn out it involve with virtualenv, or rather virtualenv bootstrap script(that is another story altogether). So I do it in python.
import subprocess
to use it, after the import, run this
subprocess.call([‘programname’,’parameter1′,’parameter2’……])
for example to call some unix command
subprocess.call([‘ls’,’-l’])
subprocess.call([‘ps’,’-aux’])
or in my case, i use it to run setup.py in bootstrap script for virtualenv
subprocess.call([‘python’,’setup.py’,’install’])
subprocess.call([‘easy_install’,’-U’,’packagename’])
Just a little writeup of subprocess, probably gonna use this a lot
A date parser from python dateutil library
Sometime you need to extract date form a string, and that is actually pretty hard to do even on python. On the other hand, there is dateutils, a python library which you can install using easy_install. The library is pretty nifty, and have many component, but now i concentrate on the date parser
from dateutil.parser import *
lets have fun, after the import, we should have the parser imported
parse(“monday”)
You should get the date of next monday as python datetime.datetime object.
parse(’14th of april’)
parse(’14th of april 3pm’)
you should get a datetime.datetime object of the date,
For python programmer, check it out, it is pretty useful.
http://labix.org/python-dateutil
Adventure with Virtualenv
In the python development world, people are using virtualenv, to isolate their python development environment from their system. Why that is cool,
- You don’t conflict with the global python library. Because all new library will be in the isolated environment, on linux many software uses python
- Then you have a fine grain control of what library is needed what is not, for each environment.
- Because all of the cool pythonista use that…ok that is not quite true, but many python based project strongly recommend using virtualenv, such as turbogears.
- and some tools are available for this, such as pip.
- It make it more easier to move project between directory
Lets get started,
here I assume that python setuptools is installed, i assume each project is one environment
to install, just run below as administrator.
easy_install -U virtualenv
To start a project
virtualenv projectname
This will setup an environment, with their own setuptools.
Let start using it
source projectname/bin/activate
and it should have the whole python environment there, isolated from the system. including python, their own site-packages
To stop using it
deactivate
To totally isolate from the system, start a new project by
virtualenv –no-site-packages projectname
It will not use library from the system.
Some tools already begin to support virtualenv. Such as pip, a replacement for easy_install, with uninstall support. To use pip with virtualenv
pip -E projectname packagename
So, virtualenv is now the requirement of most project now. Time to learn it…
What I really working on
I am currently with a local startup, which don’t want to be named. Our goal is to increase local usage of local content, to build a content company that conform to the local culture, and not letting the foreigner corrupt our beloved local culture!!!
We can’t really tell what we really try to do, we can however show our technology stack, which we all really proud of 🙂 and hopefully certain information minister would be proud too.
OS
We previously use Ubuntu, because african culture is OK, until they plan to put in a music store. That shows that Ubuntu really foreign company that try to corrupt our culture, we cannot allow that.
After much consideration, we going to move to Linux From Scratch, so that we can really check what we want to add and what not to add. We must not allow the westerner have a chance.
Which hopefully we don’t need to rewrite an OS, because we really can’t, because the lecturer in universiti never taught us that.
Web development
We originally plan to use python and django, now we know, python is really named after Monty Python, and Django, is named after Django Reinhardt, a jazz guitarist.
Two western media that will corrupt our mind, we cannot allow a joke on Spam to ruin us, you know Spam is a serious problem, how can you make it into a joke?? Django Reinhardt is a jazz guitarist, malaysian must not listen to that, no we must watch wayang kulit and all malaysian thing.
To minimize that, we will use haskell, precisely with happstack. because it does not show too much of the western culture.
Conclusion
It is hope that by starting from the technical level, we can be a content company that is suitable for the local culture.
changed: droping the minister name