sam's bits

ramblings on technology and other stuff

2 Years of Google Latitude Tracking

Google Latitude Tracks I’ve posted this elsewhere last year but thought it might be worth a post here. It visualizes around 2 years of having Google Latitude turned on.

Categories: Data Liberation

Comments: No comments yet


IP geolocation with city-level accuracy in Piwik Web Analytics

Piwik city-level location

Piwik Web Analytics is a self hosted PHP application that does exactly the same thing as Google Analytics: It tracks users that come to your websites, how often, where from, etc..

By default Piwik can recognise which country the user is from. If you want to have more precise location information, like the city you have to add an IP geolocation database.

  1. Download and decompress the MaxMind City Geolite database
  2. Upload it to the /misc directory in your Piwik root directory.
  3. Login to your Piwik instance and browse to “Settings”, then “Geolocation”
  4. Select “GeoIP (PHP)” and save your settings

Future visitors to your website will now be logged with an approximate (~40km radius ~60% of the time) city location.

Categories: Web Development

Tags: analytics, piwik, geoip

Comments: No comments yet


We choose to go to the moon.


We choose to go to the moon. We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win, and the others, too. John F. Kennedy, 1961

Categories: Space

Comments: No comments yet


Life as a geek: Then and Now

2008: Thinkpad T42, Nokia N800 “Internet Tablet”


 2013: Macbook Pro, iPad


Categories: Photos

Tags: n800, ipad, macbook pro, compaq keyboard

Comments: No comments yet


Integrating PostFinance Payments into your website

You would think integrating Credit Card or PostFinance payment methods into your site would be hard, but it’s not. If you can setup an auto-submitting form, then your pretty much done.

Before you can do anything though, you must subscribe to one of PostFinance’s monthly plans. There is a free plan, but it has a 195 Fr. activation fee and it only supports PostFinance cards (no MasterCard/Visa).

So once you’ve setup your account you get access to the testing and production environment. Your access information comes via snail mail. Make sure you have planned enough time for this in your project, it can easily take a couple of days.

 Gateway Form

The form below must be placed in the last step of your purchasing process and you need to prefill the values with your application. It will then be submitted to PostFinance where the user can pay for his purchase. The action in this particular form posts the data to a test environment.

<form METHOD="post" action="" id="form1" name="paymentform">
<input type="hidden" name="PSPID" value="your PSPID came with the post">
<input type="hidden" name="ORDERID" value="your order id (up to 8 digits)">
<input type="hidden" name="AMOUNT" value="amount of money">
<input type="hidden" name="CURRENCY" value="CHF">
<input type="hidden" name="LANGUAGE" value="de_DE">

<!-- layout information -->
<input type="hidden" name="TITLE" value="title to be displayed on the postfinance site">
<input type="hidden" name="BGCOLOR" value="#ffffff">
<input type="hidden" name="TXTCOLOR" value="#000000">
<input type="hidden" name="FONTTYPE" value="Arial">

<!-- post-payment redirection -->
<input type="hidden" name="ACCEPTURL" value="on succesful payment, where to redirect the buyer?">
<input type="hidden" name="DECLINEURL" value="on failed payment, where to redirect the buyer?">
<input type="hidden" name="EXCEPTIONURL" value="on exception/error, where to redirect the buyer?">
<input type="hidden" name="CANCELURL" value="if the buyer cancels, where to redirect the buyer?">
<input type="hidden" name="BACKURL" value="if the buyer hits the back button in the form, where to redirect the buyer?">
<!-- miscellanous -->
<input type="hidden" name="HOMEURL" value="">
<input type="hidden" name="CATALOGURL" value="">
<input type="hidden" name="CN" value="the buyers full name">
<input type="hidden" name="EMAIL" value="the buyers email">
<input type="hidden" name="PM" value="">
<input type="hidden" name="BRAND" value="">
<input type="hidden" name="OWNERZIP" value="">
<input type="hidden" name="OWNERADDRESS" value="">
<input type="hidden" name="OWNERADDRESS2" value="">
<!--<input type="hidden" name="SHASIGN" value="">-->
<input type="hidden" name="ALIAS" value="">
<input type="hidden" name="ALIASUSAGE" value="">
<input type="hidden" name="ALIASOPERATION" value="">
<input type="hidden" name="COM" value="">
<input type="hidden" name="COMPLUS" value="">
<input type="hidden" name="PARAMPLUS" value="">
<input type="hidden" name="USERID" value="">
<input type="hidden" name="CREDITCODE" value="">

<input type="submit" value="Click here if you are not redirected in 5 seconds..." id="submit2" name="submit2">


<script type="text/javascript">
            window.setTimeout(function() { document.paymentform.submit(); }, 2000);

If you’ve setup the form correctly it will redirect you to the test environment. If you want to go live replace test with prod in the form action.

For more information and an explanation of the other form fields: Detailed PostFinance Documentation

Categories: Web Development, E-commerce

Tags: postfinance epayment, payment gateways

Comments: 3 Comments