Saturday, June 25, 2011

appengine unittesting trick

I was looking for the ideal way to run all my unittests on my appengine projects.
Let's define what is ideal:
  • http://project.appspot.com/test to run all unittests
  • create unittest directly in file it is testing/no need to create unittest file for each file
Solution:
  • install gaeunit
  • create or move unittest classes directly in file that it is testing
  • create /test/project_unittest.py
  • import all file containing unittest class in project_unittest.py
What's great with python is that unittest.main() run all unittests that are in the scope which means you simply have to import them and no need to create multiple test files if unittests classes are directly integrated in each files.

Saturday, May 14, 2011

Governments programs are destructive for new entrepreneurs

I reached my limits of bureaucracy. Enough is enough. My conclusion is that governments programs are destructive to new entrepreneurs. Let's face it, it is simply incompatible, entrepreneurs are looking for efficiency and government can only produce bureaucracy and inefficient process that are killing wealth creation.

Many entrepreneurs are trapped by government programs where they expect help and finally end up losing precious time, getting ridiculous support for massive paperwork if not excluded by incoherent rules. Entrepreneurs are here to create wealth not justifying bureaucracy existence.

I am tire of hearing bullshit like:
  • we are here to help entrepreneurs
Stop saying it and do it.
  • but you have to be profitable, have clients, make more then 200K, been incorporated since, have a product, have N employees, have to been able to pay your new employee to get the support, not this, not that, this, but only in 3 months, sorry in 6 months, it needs to go through the committee of the committee of the board and can't tell you when they might decide but it will required another meeting to decide, you have to come to our office, we need this form and this proof and letter of this and details of this....like if entrepreneur time is free.
If we were respecting your criteria, we wouldn't need your support. Again we aren't looking for advices but only financial supports and efficient process, we know what we have to do. The current system seems to subsidising establish corporations, corporation without financial constraints and most important, for a second time, justifying bureaucracy existence.

Here is in a nutshell what entrepreneurs need:
  • Real founding support, light and fast decision process...not advices nor endless decisions and paperwork process of months and please stop pretending you can help if you know you can't.
Worst thing is that it is sending a so bad signal to the new entrepreneurs, you should be an bureaucrat official, you will make more money, you will have a pension plan, less stress, no performance evaluation from people you are suppose to help...

Don't worry entrepreneurs can't go that way but can kill this system slowly. Without entrepreneurs, this system cannot sustain. I hope the new majority Conservative Party of Canada will make drastic cuts in this bureaucracy (their 10 billions cuts hasn't been unveiled). Officials aren't untouchable, don't shit in your plate rules applies to everyone. The effect might take longer but it will come and new entrepreneurs will help the momentum but what is bad is that founds might been cuts but no untouchable government jobs. Stop wasting time on their salaries and invest in entrepreneurs directly.

Government programs are making more damaged then good for new entrepreneurs by making them loose too much time and energy and encourage indirectly outsourcing which overall is extremely bad for the economy. Hopefully Canada has natural resources....but it isn't an excuse to tolerate destructive economy programs.

Thursday, April 7, 2011

Letters order isn't important for our mind: a simple appengine service to play with this idea

I got several time an email about cool visual illusions and enjoyed a lot the one on the fact that our mind doesn't care about letter order, the only important thing is that the first and last letter be in the right place (refer as a Cambridge study). You might have already seen this:

Olny srmat poelpe can raed tihs. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! if you can raed tihs psas it on!!

I decided to create a service to play with the idea on google appengine.
You can try it now with your own text:

Monday, January 10, 2011

How to create standalone python apps?

You might have to run your applications in your customer infrastructure but you might not want to give your recipes (python source code) so here are the alternatives depending on your OS:
On linux, pyinstaller works quite well but you have to generate it on the same distribution.
Here are the steps:
  1. download latest version
  2. python Configure.py
  3. python Makespec.py /path/to/yourscript.py
  4. python Build.py /path/to/yourscript.spec
  5. start app: yourscript/dist/yourscript/yourscript(binary executable)
(*) Freeze instructions:
  1. svn checkout http://svn.python.org/projects/python/trunk/Tools/freeze/
  2. python freeze/freeze.py yourscript.py
  3. make

Wednesday, October 13, 2010

simple multivariate classifier example using python & numpy

I was wondering how long it could take to write a multivariate classifier in python.
With python and numpy it isn't long. We simply need to be able to compute the covariance matrix, the determinant and to inverse a matrix (covariance matrix). Even if the matrix is singular, which mean it can't inverse it, you can compute the pseudo-inverse (Moore-Penrose) easily (i.e.: numpy.linalg.pinv).
As expected, assuming too much about the data lead to poor classification.
You can find a simple python program of 75 lines here.

Sunday, October 10, 2010

Dimensionality reduction; a simple PCA example using python




Dimensionality reduction is a powerful approach to reduce inputs size, reduce training time and visualize data.
As an example, you can use PCA(Principal Component Analysis) or ICA (independent component analysis) or LLE (Locally Linear Embedding).
to see class grouping. You can try it on your data easily with python in a couple of lines.
import mdp
pca = mdp.pca(ds.data)
pylab.title("PCA")
pylab.plot(pca[:,0], pca[:,1], '.')
The figure presents the PCA dimensionally reduction applied on a digit dataset. You can find the source code here to see you to do a PCA, ICA or LLE using python. Unfortunately, ICA doesn't work on our dataset because it doesn't converge.

Saturday, October 9, 2010

PDF watermarking service using pdfrw on google appengine

If you are looking to watermark a pdf, you can use this simple appengine service:
This service use pdfrw (a PDF file manipulation library written by Paul Gauvin) and reportlab. pdfrw is much faster then pypdf for watermarking.