Sunday, March 25, 2012

Reading delimiter tab (\t) from request with PHP


If you give to user a possibility to enter freely for example a delimiter character for csv-file, and the user selects horizontal tab, '\t', you need to change it to "real" tab character yourself in PHP, at the server side.

The inputted value "\t" is sent to server as a string, which length is 2, and contains to characters '\' AND 't'. You need to change it to one single character '\t' for example with:

$delimiter = $_REQUEST["delimiter"]; // use here the input form name you have 
$delimiter = str_replace("\\t","\t",$delimiter);

You can make a function for replacing any of the special characters you allow the user to enter.

If you are sending a pre-formatted text which contains \t characters, they remain unchanged after sending the form to the server. That is because the user did not type the characters '\' and 't', but did use a program to type a single tab character '\t'.

Friday, March 23, 2012

Angry Birds soda cans

I was shopping at our local grocery store when I spotted these cans.

Even without my kids being there, I would have bought these. Just to know what they taste like.

The flavors are Paradise (tangerine and pineapple) and Tropic (tropical fruits).

The manufacturer is Finnish company Olvi and the price at out store was 1,14 e.





EDIT 2012-03-28

Okay, yesterday I visited another shop of the same brand and found the proper stands for Angry Birds soda. I took some pictures with my old Nokia (hence the image quality!).




Too bad, they had attached the pricing information on top of the Angry Birds logo. If you look at the lower image, you can see that the stand is labeled with "Olvi" and "Rovio". Also the price per soda can is higher in this shop...

EDIT 2012-04-04

The Finnish beverage manufacturer Olvi has made the official nutrient info for Angry Birds soda available here: http://www.olvi.fi/web/fi/angrybirdstropic and http://www.olvi.fi/web/fi/angrybirdsparadise. The pages are in Finnish. The company has also information in English but it looks like it is not up to date.

EDIT

The same text in Finnish:

Viikonlopun ruokia ostaessani huomasin Citymarketissa ison telineen Angry Birds limsaa. Vaikka lapset eivät olisikaan olleet mukana kauppareissulla, olisin silti ostanut molempia makuja.

Maut ovat Paradise (mandariini ja ananas) ja Tropic (trooppiset hedelmät), juoman valmistajana Olvi ja hinta "Sittarissa" 1,14 e / tölkki.


New Angry Birds soda cans!


Angry Birds candy


Angry Hockey Bird
Do you know Hockey Bird?



Thursday, March 22, 2012

Error in Eclipse and Android environment: The method X or type Y must override a superclass method

After importing two Android projects to Eclipse workspace, I received over 3000 errors!

* Some errors were removed after selecting the correct SDK from
Properties > Android > Project Build Target 

* Some errors were removed after clean and rebuild.


But still there were 600+ error with message:
"The method X or type Y must override a superclass method."


The solution was to set the Compiler level from 1.5 to 1.6. 

So, setting

Properties > Java Compiler > JDK Compliance level to 1.6

solves the problem.

EDIT 2012-03-24

You may need to"delete" the projects from the workspace and then import them again. You may need to do that more than once.