2010-03-29

sqlalchemy ProgrammingError can't adapt type numpy.float64 - Python troubleshooting

Are you getting a

sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt type 'numpy.float64'

???

It's because psycopg (psycopg2) - which is used inherently by SQL Alchemy but if you're just dealing directly with alchemy you might not know this - has no idea how to make the numpy.core.numerictypes.float64 (complete type path: another thing they don't tell you) a string for SQL querying.

Simple solution, add:

# solution by Jorge Orpinel found at rehalcon.blogspotcom
import numpy
from psycopg2.extensions import register_adapter, AsIs
def addapt_numpy_float64(numpy_float64):
return AsIs(numpy_float64)
register_adapter(numpy.float64, addapt_numpy_float64)

somewhere in the program.

For a more complete reference of the problem see http://initd.org/psycopg/docs/advanced.html#adapting-new-python-types-to-sql-syntax

2010-02-18

surveysavvy sucks

Survey Savvy Review: It Sucks!

Its this website where you fill those surveys and they give you like $1 dollar for the whole thing that will probably take you like an hour to complete.

The worst part is that theyre a bunch of tricky bastards, in every survey there is a "screening" part where your eligibility is decided however now a days the whole survey is a screening apparently and surveysavvy doesn't care that the survey makers are taking advantage of the fillers by screening them out at the very end after much work just because they didn't match the criteria.

Ant this is supposed to be the best survey website... My advise: just get a job

2009-11-17

Max/MSP vs. PD vs SuperCollider vs ChucK vs JSyn/JMSL

That's right I' trying to compare them all. Feel free to make your comments.

Max/MSP/Jitter
Pure Data, PD anywhere
JSys/JSML + Wire
SuperCollider
ChucK


Who else could compete?

Reaktor?

2009-08-07

What is a Loser? What is a Winner?

Winners, losers, terms we hear every day, but very vaguely defined. Well, duh, winners win and losers loose. Is that all there is to it?

According to Eric Berne (transactional analysis) and more specifically Claude Steiner, most people tend to live their lives according to a life script. In very short words a script is like a cannon or a set of roles that a person has been taught unconsciously or has otherwise learned. Winner and looser are scripts or ways to live, and in my opinion they are almost THE SAME THING.


Losers win too

The main difference between winner and loser behavior is when do they win and when do they lose. Both types of people can be very competitive and are constantly exposed to win - lose situations. Job interviews, competitions, auditions, examinations; these are some examples of such situations.

The problem with losers is that when they win, they lose. Yes, losers win too, but somehow they arrange things in such an order that if they actually win a competitive situation, they will lose something else. And in the other hand when they lose, they have arranged things (maybe just in their minds) in order to win something else too. So they keep losing, because in their heads they are winning, and they don't want to win because they will lose anyway...

[I should provide some examples to make things clearer.]

Resuming, losers:
  • when they win, they lose
  • when they lose, they win


What about winners?

This is going to get confusing. Winners win when they lose! They are wise enough to see where they can win or learn something when they lose. Secret: winners lose a lot. They lose many more times than when they actually win, but this serves them as training to win when it counts. In the end they know how to win and they don't lose anything when winning. THAT'S THE DIFFERENCE.

So winners:
  • they win when they lose (not the same as losers' when they lose, they win)
  • when they win they just win


Becoming a Winner

The good news is that if you're a looser, you're just one step from becoming a winner. The main reason why losers end up losing always is that they are unrealistic in their goals while winners are very realistic and practical.

Losers have a fantasy about what they will win that supersedes the real price.

[TO BE CONTINUED I HAVE TO RUN!]

2009-08-06

How to find enum options in PHP for cakephp

I created this Bakery article showing some code designed for CakePHP to find enum options automatically from any Model. You can also just copy the code and use it in any PHP app.

http://bakery.cakephp.org/articles/view/find-enum-options-with-a-function-on-any-model

Simple server load test with cron and ab (Linux)

Load testing "refers to the practice of modeling the expected usage of a software program by simulating multiple users accessing the p...