Google I/O 2009 / San francisco trip

Google IO 2009

img_18081First of all, Google I/O 2009 was awesome. First day during the keynote they tell us we get an android phone ! And the second day they announce Wave. (Somehow I feel like combining the two :) ) .I already had an android phone but since i’m a gadget nut I welcome all new toys :D… The sessions were cool.. I went to several sessions on Android , Opensocial and Google Web Toolkit. I just updated my eclipse to the latest version and updated the sdk and got my first hello world android app to work :) now to build that shortner app ! And maybe some others. I’m also looking forward to the invite to wave… That has to be something else.. I’m eager to show it off at work … And I really feel like writing my own implementation. I loved that console version :D

Hotel Palomar

Like last year this hotel rawks.. I’ve been in a few hotels by now and I really like this hotel for its great rooms. Not the biggest .. but definatly the best kept…. The only bad thing is we ordered a room at the zen garden but got a room looking into offices … which is not really ” zen”

img_1837San Francisco

I love this city. Allthough it is a bit littered with all these homeless people its pretty easy to get around. If you watch where you step.  We took a tour of the bay and underneath the golden gate brige and back around alcatraz.

http://picasaweb.google.com/johntaromobile/SanFrancisco

The weather here is like Holland .. The difference is though that the weather here changes on which altitude and which part of the city you are. Ocean climates rock!

Right there is a picture of the trans american piramid. Which is a pretty nice view  from up that hill.

I will post some more in depth reviews of the phone (Google ION) later

Cool shit in models

Recently we added models to our framework (over at work) And I wanted to put down some of the concepts we added..

Recoverypoints

We use these to track the changes. There are 2 types. Temporary (virtual) recoverypoints who only exist during the actual existance of the modelfactory. These are stored in the memory of our modelfactory (which builds, maintains models, datasources ,resultsets and  recoverypoints) The other type is both stored in memory… and in database. These recoverypoints can be saved for later use.

Any change made that is saved using the ->save() or ->saveProperty() method results in a recoverypoint. The recoverypoint id is returned from this method.

After which the usre can recover to that recovery point on that object by using $model->recover($recoverypointid);

Cross database transactions.

Since datasources for our models are spread across databases and even servers we can’t rely on normal mysql transactions. But we have to have transactions.. In case that user creation didn’t go as smooth as it was meant to. We solve this by creating our own transaction system in our modelfactory. (since that has all the data.. it seemed like the right place to do this)  Which allows us to do everything we want … and if it breaks half way through or at the end.. just recover it.

Triggers

We built in triggers to make sure that when lets say a domain gets changed from type 1 to type 3 that certain processes are triggered and certain changes made.

Filters/Transformations

Certain fields have encryption be it one way or two way. We added these to transform certain pieces of information in their proper form. Like for example a string in the database that is actually a CSV format. Which you want to use as an array. All reading and writing is passed through these functions

Autofill
Autofill is used to generate new data like “created” dates on items or ip addresses.

And plenty more (will add more later)

Php and ssh woes using pty with proc_open on vserver

Recently I had to create an ssh module @ work to connect to our servers and send and recieve information using ssh and scp. However because we use vserver simply using proc_open() with all PTY descriptorspec wasn’t going to work. After about half a week of fiddling and stressing out over certain things and escalating the issue to the tech dude @ work. The Tech manager kicked the ball back saying there was probably a bug in vserver and that i had to learn to live with it…
So back to SSH…. the -t option should force pseudo-tty allocation…. after having tried that numerous times using normal pipes .. I gave up on it …and continued to work on the ssh module using PTY and had a fallback using the local shell for development.

Now the in the man pages for ssh it says “Multiple -t  options force tty allocation, even if ssh has no local tty.”…(thanks to Bert the tech manager for figuring that out)

So in essence “-t -t”  is another way of saying “YES I REALLY WANT A PSEUDO TERMINAL!!!!11oneone”

I’m just putting this out there so other people can benefit from this bit of pretty usefull information.

Things learnt:

  1. Read manual pages better
  2. Look for those “exception” rules and parameters.
  3. vserver has some limitations

Who the bleep comes up with this stuff….thats like “rebooting it three times

Thanks Bert for reading those flipping hard to read man pages and diving into the depths of vserver.

Using the Google Safe Browsing API to check shorter urls.

I’ve been wondering for a while how many of shortner’s short urls would lead to a site containing malware.

Luckely the Google is here lending a helping hand when checking for bad urls.

In short/simple terms the google safe browsing api lets you download a set of hashes of urls that contain nasties and updates to keep that list you have locally up to date.
After that you can create a list of possible urls to check against.. create md5 hashes of those.. and then check those against that list you have. If you get a hit.. the big chance the url contains some form of malware or another. Now I don’t want my users to end up on a site with malware so I can stop the redirect and give people the choice to continue or not.

Anyway. More information on this awesome thing you can find over here:
http://code.google.com/intl/nl/apis/safebrowsing/developers_guide.html 

Oh and thanks Google for putting this awesome thing out there for developers to use to protect their users.