My favourite quotes.

“A vital ingredient of success is not knowing that what you’re attempting can’t be done.” ~ Terry Pratchett

“When it comes to the future, there are three kinds of people: those who let it happen, those who make it happen, and those who wonder what happened.” ~ John M. Richardson, Jr.

“When I hear the word «impossible», I smell a good business idea” ~ Yrjö Ojasaar

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

Mandatory training for every new startup – Preparing, Testing and Executing – Yrjö Ojasaar

Yrjö is one of the best experts of startups is Baltic region who I have seen personally and who keeps on speaking on different conferences. I believe that the training session what I am describing here should be wort several hundered EUR at least but this is totally free. You can skip this training only if you have launched at least one successful startup and even then it is worth repeating the basics. I am only gonna write very brief overview, to udnerstand further take your time to see these videos.

Part 1 Preparing. How to generate business idea? Is there competition and how people can survive without your invention. How to setup product hyphothesis. How to perform risk analysis. How valuable ideas can you get on toilet?
Reseources needed: people, time, motivation, money.

Read the rest of this entry »

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

Facebook login on multiple subdomains with one app id

If you add Facebook authentication on your website then you need to enable “Website with Facebook Login” and set value for “Site URL:” . You can only set single site url and if you want to use same Facebook app in different domains then you might get error:

An error occurred. Please try again later.
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.

Fortunately it is possible to enable login for multiple subdomains if you configure “App Domains:”. In this case Site URL dows not have to match with acutal redirecturl domain exactly.

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

IE and Facebook iFrame app session cookies problem

I wrote and Facebook app that uses sessions. I worked fine in my machine where I use mostly Firefox and Chrome. Suddenly I discovered that after resetting security settings to medium in IE 9 the app suddenly did not work anymore.

Each time I refreshed the new session key was created because requests did not send the cookies. Apparently IE decided to delete the cookies when I was running my Facebook app as page tab inside iFrame. Fortunately I have seen this before and immediately recognized the problem when I saw session key changing each request. It is called P3P headers that someone invented long ago but then understood that these are useless.

To fix it you need to add following line in your PHP code.

header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');

If you happen to use Laravel or other framework then add above code to Before filter.

See for other languages http://www.admon.org/how-to-implement-p3p-http-headers-for-cross-site-cookies/

 

 

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

Facebook signed _request missing

I have Facebook app as a page tab and sometimes it did not get the signed_request.

I saw with Firebug that POST to my app is made and signed_request is there but this call made redirect to GET instead. This was always reproducible with one Facebook account but with another account it worked just fine. I used Laravel framework and tried adding debugging code to index.php where all requests are routed through and also created separate index.php so that .htaccess would be bypassed. It turned out that POST request is not reaching the code at all.

What I found out is that even though I run all the services over HTTPS and in Facebook app config I have only HTTPS links then Facebook still forces app to be loaded over HTTP. I have apache2 virtual host configuration so that all HTTP requests are redirected to HTTPS which loses all the POST data and that is why the guaranteed signed_request never reached my app.

I resolved it by allowing HTTP but any navigation in the website was changed to HTTPS again.

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

But really, why java is enterprise and PHP is not.

I have a lot of experience with Java and until this was only language I knew well I could not say out the real answer. Now recently I have been working with PHP + Laravel and finally I know the answer.

PHP by itself is not bad. Programmer can quickly hack all kinds of great things, deploy it just by copying new files to webroot and done. In that sence PHP is easy to learn and use, it is flexible and in that sense great tool for beginners.

Java, however, is more cumbersome. It requires more setup and compiling. All the data types must be strict, all kinds of places have to try catch Exceptions. It feel like a lot of extra work for nothing.

Now when we look how enterprise projects looks like. There are thousands or even millions lines of code, huge number of files, classes etc. Stack traces traces are tens and hundreds of rows. Maintaining such a projects must not leave any room for error. Making simple typecasting mistake or typing method for object that is not supported is not an option.

So the answer is:  Java is more refained, it forces you to think harder and make it more right on first try. IDE-s allow you to traverse code much more easily, leaving out all possible confusion with data types in inheritance.

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

mysqldump export rows cli in sql format

Sometimes I need to export a set of data from staging or testing database to production. Usually it is related to configuration settings It is best to export the data in SQL format so it is possible to import it easily in other machine.

Follow this template

mysqldump -p -uusername  -w "where query" databasename tablename

For example

mysqldump -p -uroot  -w "id < 10" website settings
Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

How to download ca certificate chain

It might happen that some machine has missing CA chain certificates and you get error

OpenSSL: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
 Unable to establish SSL connection.

If accessing the specific URL in browser works without warning then you can export and download CA certificate chain

In Firefox right-click > View Page Info > Security > View Certificate > Details . There you see Certificate hierarchy and can export each certificate in chain individually.  Depending on OS you need to add these certificate in PEM format ti /etc/pki/tls/cert.pem or similar.

See more useful tricks about SSL here.

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

Never do sudden changes in Google or Facebook ads

Lets say you are running low budget campaign and new ad starts to perform really well. You want to increase budget to take use of it but if you do it without thinking then you will jsut waste your money.

I had Facebook campaign and it was running 2EUR a day.  Ad for my latest post related to end of world started to perform really well having CPM of 0.01EUR and it generated a lot of likes, comments and shares. Now I wanted to take use of it and increased budget 5 times from 2EUR to 10EUR. What happened is that after 15 minutes all of the 10EUR was spent, CPM went up from 0.01 to 0.11 and there was only a little extra action.

Please bear in mind that if you do changes to you successful campaign then to this bit by bit. Facebook and google advertisments engine will overcompensate and all of your money will be wasted.

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

Paypal [L_SHORTMESSAGE0] => Internal Error [L_LONGMESSAGE0] => Timeout processing request

Paypal error messages are very unfriendly. It can say “Timeout processing request” without delay like

2012-12-20 19:45:34 INFO - Paypal call: https://api-3t.sandbox.paypal.com/nvp?VERSION=74.0&USER=username&PWD=12345&SIGNATURE=12345&METHOD=SetExpressCheckout&RETURNURL=http%3A%2F%2Fttawidget.dev%2Findex.php%2Fpayments%2Fpaypal%2Fsuccess&CANCELURL=http%3A%2F%2Fttawidget.dev%2Findex.php%2Fpayments%2Fpaypal%2Fcancel&L_PAYMENTREQUEST_0_AMT=2.00&L_PAYMENTREQUEST_0_ITEMAMT=2.00&L_PAYMENTREQUEST_0_CURRENCYCODE=EUR&L_PAYMENTREQUEST_0_DESC=payment+description

2012-12-20 19:45:34 INFO - PayPal call response: Array
(
    [TIMESTAMP] => 2012-12-20T19:45:34Z
    [CORRELATIONID] => cdea44429896f
    [ACK] => Failure
    [L_ERRORCODE0] => 10001
    [L_SHORTMESSAGE0] => Internal Error
    [L_LONGMESSAGE0] => Timeout processing request
)

Actually this means that some parameters in request are not correct. Try to fiddle with params and consult official API docs to fix the call. Some docs can be found here https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout

Share on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit