Koke’s

My English alter-ego

Improving your finances the European way

Posted by Jorge Bernal May 28, 2007

I’ve been thinking about this for a long time and talked to some American friends about this, so I decided to share with you some insights into the personal finances in Europe (actually it might be only Spain, or just me).

Debt

The original idea for the title was “What’s wrong with American personal finance”, but I guess a positive thinking could help more than just criticism. I usually read some productivity and lifehacks blogs like LifeHacker or zenhabits and once in a time, a money article pops up. The two most common pieces of advice in this field are:

  1. Avoid late fees by using Quicken/MS Money to pay your bills
  2. Get rid of your debt

Those two common issues amongst American people were really bizarre for me the first time, and still today I can’t fully understand were the problem comes from.

Avoiding late fees

Simply put, I’ve never paid a single late fee in my life (maybe renting videos long time ago). The most common payment method in Spain for recurrent bills like Internet, rent, phone,… is called domicilación bancaria. I’ve been told there’s something like that in the US, and I’ve found similar concepts on the Wikipedia: Direct debit and standing order.

That is, if I get a new DSL contract I give my bank account number to the service provider and they charge me every month directly in my account. The only chance to get a late fee there is if there are no funds in that account.

So, my piece of advice here is: ask your bank about this possibility and get your bills paid with direct debit

Get rid of your debt

This in fact hit me long time ago, in an episode of The fresh prince of Bel-Air, when Will gets his first credit card and starts spending way more than he can pay. I thought that was a silly joke, but as I discovered later, it seems like the sad beginning for a lot of people.

I have one credit card and I only use it to buy online and when I travel outside Spain. My other cards are debit cards: some Visa Electron and some Maestro. In fact, most of the time my credit card stays at home.

I don’t even know if there are debit cards in the US, but if they exist, you should get one.

I found this cool parody some time ago about getting out of debt:

Conclusion

My final basic trick is that my expenses are much lower than my income, so I can pay them every month.

I think the above video is my conclusion to this: don’t buy stuff you can’t afford and I should add find the financial tools you need to stay away from credits.

AddThis Social Bookmark Button   AddThis Feed Button

The beginnings of business decadence

Posted by Jorge Bernal May 25, 2007

The pursuit of happiness

Business was originated to produce happiness, not to pile up millions. Too many so-called “successful” men are making business an end and aim in itself. They regard the multiplying of their millions and the extension of their works as the be-all and end-all of life. Such men are sometimes happy in a feverish, hustling sort of way, much as a fly placed in a tube of oxygen is furiously happy until its life burns out. But they have no time for the tranquil, finer, deeper joys of living. They are so obsessed with the material that they cannot enjoy the immaterial, the intangible, the ideal, the spiritual&emdash;quiet thought, self-communion, reflection, poise, inward happiness, domestic felicity. What profiteth it a man to gain uncounted riches if he thereby sacrifices his better self, his nobler qualities of manhood? Mere getting is not living.

Forbes Magazine, September 15, 1917

This was the first Forbes editorial, the first US business magazine.

AddThis Social Bookmark Button   AddThis Feed Button

Classic riddle

Posted by Jorge Bernal May 22, 2007

Labyrinth puzzle

From the always great xkcd

AddThis Social Bookmark Button   AddThis Feed Button

Why to teach?

Posted by Jorge Bernal May 22, 2007

My decision about 1 year ago to start doing training was a strange move for me. It was totally new and scary field for me, but like I said at the moment, according to my experience all change has been for good. I think I can trust my intuition.

Like Seth Godin said (more than) once:
Safe is risky

I found a short article about How we learn which summarizes my point of view after 5 courses.

10% of what we READ

20% of what we HEAR

30% of what we SEE

50% of what we SEE and HEAR

70% of what is DISCUSSED with OTHERS

80% of what is EXPERIENCED PERSONALLY

95% of what we TEACH TO SOMEONE ELSE

William Glasser

You can never imagine the kind of questions you are going to get from so many different mindsets, so you have to find a lot of answers that you’d never find otherwise.

AddThis Social Bookmark Button   AddThis Feed Button

Fair price

Posted by Jorge Bernal May 20, 2007

Much has been said about music prices nowadays, I remember reading somewhere that usually the 10 most sold albums in Amazon every week were below $10. That’s not a bad price, but let’s call it sensible pricing.

Sensible pricing is sometimes not enough. Some albums are so good you’d feel confortable paying $20 for them, and some of those $9.99 albums have only one half-good song. I found this 37signals’ article today: Jane Siberry’s “you decide what feels right” pricing detailing how some small record labels are letting consumers (I don’t think that word applies anymore, but still) decide which is the fair price for a CD. At this time, 14% paid above suggested. See it on Sheeba Catalogue

The Canadian folk-pop singer Jane Siberry has a clever system: she has a “pay what you can” policy with her downloadable songs, so fans can download them free — but her site also shows the average price her customers have paid for each track. This subtly creates a community standard, a generalized awareness of how much people think each track is really worth. The result? The average price is as much as $1.30 a track, more than her fans would pay at iTunes

This is not new, magnatune has been doing that for about 4 years. They let you listen the full disc, then download it paying what you consider a fair price

Magnatune pricing

And to help this cool ideas, if you like piano music, let me recommend you Rob Costlow (blog). It’s a great album to stop and relax enjoying the beautiful sound of a piano. And he could be called a piano hacker according to his biography:

By the time he was twelve Rob Costlow was annoying his piano instructor by adding unwritten endings to songs during rehearsals and recitals.

AddThis Social Bookmark Button   AddThis Feed Button

Male Restroom Etiquette

Posted by Jorge Bernal May 16, 2007

I just found this video on Youtube by chance. It wasn’t being too funny but, after a while, when trying to explain why you shouldn’t talk in a public restroom, it starts with an example:

They strike up a conversation about Linux. […] So there they are, discussing the advantages of open source development…

That really got me. They story gets really complicated and in the end… well you best watch it yourself. And remember: never ever say a single word within a men’s room

AddThis Social Bookmark Button   AddThis Feed Button

Hacking MySQL: SIGNAL support (I)

Posted by Jorge Bernal May 09, 2007

I’ve been looking for an open source project to collaborate for some time now, and given the time I’m spending with MySQL lately and the expertise I’m gaining thanks to MySQL training, it looked like an obvious choice.

During the last advanced bootcamp, Tobias found bug #27894, which apparently was a simple fix. Dates in binlog were formatted as 736 instead of 070306 (for 2007-03-06). During the bootcamp I used my lonely nights at the hotel and came up with a patch, and some days later my first contribution was going into the main MySQL code.

The problem

Now I had to find something bigger. One of the things that most annoys me of MySQL is the lack of some way to abort a procedure or trigger: there is no raise method. To generate a custom error you have to do hacks like:

SELECT `

Error: Invalid firmware series for this model

` INTO dummy FROM model;

The solution

There is a SIGNAL command in the SQL:2003 standard which does the job, but it’s not implemented (yet) in MySQL. The syntax, according to the manual is as follows:

SIGNAL signal_value [ SET signal_information_list ] 

signal_value:
    condition_name
  | sqlstate_value

signal_information_list:
    [ signal_information_list , ] signal_information_item 

signal_information_item:
    condition_name = condition_value

condition_name:
    CLASS_ORIGIN
  | SUBCLASS_ORIGIN
  | CONSTRAINT_CATALOG
  | CONSTRAINT_SCHEMA
  | CONSTRAINT_NAME
  | CATALOG_NAME
  | SCHEMA_NAME
  | TABLE_NAME
  | COLUMN_NAME
  | CURSOR_NAME
  | MESSAGE_TEXT

In this first part I’ll cover the basics: just the SIGNAL command with a fixed generic error, enough to get rid of the dirty hacks.

The implementation

Getting used to foreign code always takes some level of difficulty, but when you have to deal with grammars and parsers it’s all crazy fun. First, we have to add a symbol for our new command

sql/lex.h

In this file, we have a symbols[] array where we have to add SIGNAL. Since it seems to be sorted in alphabetic order, we’ll put our line between SHUTDOWN and SIGNED:

   { "SHUTDOWN",    SYM(SHUTDOWN)},
   { “SIGNAL”,    SYM(SIGNAL_SYM)},
   { “SIGNED”,    SYM(SIGNED_SYM)},

sql/share/errmsg.txt

Before we get our hands dirty with the parser file, let’s get our custom error prepared. I took a look at the SQLSTATE error messages and I found the 38503 (Exception generated from user-defined function/procedure) enough related to this.

In this file we have a series of error constants with their corresponding error messages in various languages. Since our new error will be related to stored procedures, I decided to put with the rest of SP-related errors:

 ER_SP_CASE_NOT_FOUND 20000
         eng "Case not found for CASE statement"
         ger "Fall für CASE-Anweisung nicht gefunden"
 ER_SP_SIGNAL 38503
         eng “Exception generated from user-defined function/procedure”
 ER_FPARSER_TOO_BIG_FILE
         eng “Configuration file ‘%-.64s’ is too big”
         ger “Konfigurationsdatei ‘%-.64s’ ist zu groß”

sql/sql_yacc.yy

And finally to the point. Here we have to declare that we’ll be using the SIGNAL_SYM which we defined at sql/lex.h as a token.

 %token  SHUTDOWN
 %token  SIGNAL_SYM
 %token  SIGNED_SYM

Then, in the sp_proc_stmt label (look for sp_proc_stmt: at the beginning of a line), we add sp_proc_stmt_signal as another possibility (we’ll define this in a minute):

 	| sp_proc_stmt_iterate
 	| sp_proc_stmt_signal
 	| sp_proc_stmt_open

And finally, between the sp_proc_stmt_iterate and the sp_proc_stmt_open definition we add our code:

sp_proc_stmt_signal:
    SIGNAL_SYM
  	{
            LEX *lex= Lex;
	    sp_head *sp= lex->sphead;
	    sp_instr_error *i;

	    i= new sp_instr_error(sp->instructions(), lex->spcont, ER_SP_SIGNAL);
	    sp->add_instr(i);
	  }

This basically tells the parser to expect the SIGNAL_SYM token (SIGNAL) with no arguments, and generate an error with our new error code (ER_SP_SIGNAL). As you might see there’s some extra code which I copied directly from similar definitions, which I’ll refer to as parser magic (anyone willing to explain what sphead and lex variables are will be very welcome)

Conclusion

This one wasn’t so extremely difficult if you had some previous experience with Bison, but the next part can be more interesting, since I guess we’ll have to add some more functions than sp_instr_error to be able to show custom error messages. Also, we’ll have to prepare some test cases to verify our newly created behaviour.

I hope this helps someone trying to contribute to MySQL. If you want to try this at home you can follow the article or apply the patch

AddThis Social Bookmark Button   AddThis Feed Button

Who said penguins can’t fly?

Posted by Jorge Bernal May 07, 2007

Reading Linux failing to boot screen on the plane I remembered I saw something similar in my flight to the MySQL Users Conference. It wasn’t so critical, but my entertainment screen got an unexpected reboot and I could see the tux logo and the console for like 2 secons while booting. This was with Northwest Airlines.

So, who said Linux had problems with video? :P

AddThis Social Bookmark Button   AddThis Feed Button