The IPv6 Subnet Matrix Table
September 10th, 2010iPad Web Design & Development
July 27th, 2010I found a site that provides some nice tips and tricks for development on the iPad. With some handy CSS example files..
Did you know that you could use :
@media only screen and (device-width: 768px) and (orientation: landscape) {
/* rules for iPad in landscape orientation */
}
Sencha Touch Framework
June 29th, 2010The First HTML5 Mobile App Framework
Sencha Touch allows you to develop web apps that look and feel native
on Apple iOS and Google Android touchscreen devices.

Google commandline (GoogleCL)
June 18th, 2010- google blogger post --tags "GoogleCL, awesome" --title "Test Post" "I'm posting from the command line"
- google blogger post blogpost.txt
- google blogger list title,url-site # List posts
- google blogger delete --title "Test Post"
- google delete --title "Silly post number [0-9]*" # Delete posts matching regex
- google tag --title "Dev post" --tags "Python, software" # label an existing post
- google calendar add "Dinner party with George today at 6pm" # add event to calendar
- google calendar today # List events for today only.
- google calendar list --date 2010-06-01,2010-06-30 # List events.
- google calendar delete --title "Dinner party with George" # Delete an event.
- google contacts add "J. Random Hacker, jrandom@example.com"
- google contacts list name,email --title "J. Random Hacker"
- google contacts delete --title "J. Random Hacker"
- google docs delete --title "Evidence"
- google docs edit --title "Shopping list" --editor vim
- google docs get --title "Homework [0-9]*"
- google docs list title,url-direct --delimiter ": " # list docs
- google docs upload the_bobs.csv ~/work/docs_to_share/*
- google picasa create --title "Vermont Test" --tags Vermont vermont.jpg
- google picasa get --title "Vermont Test" /path/to/download/folder
- google picasa list title,url-direct --query "A tag"
- google picasa post --title "Vermont Test" ~/old_photos/*.jpg # Add to an album
- google picasa tag --title "Vermont Test" --tags "places"
- google picasa delete --title "Vermont Test" # delete entire album
- google youtube post --category Education --devtags GoogleCL killer_robots.avi
- google youtube delete --title "killer_robots.avi"
- google youtube list # list my videos
- google youtube tag -n ".*robot.*" --tags robot
Creating daemons in PHP
June 17th, 2010Nucleus web karting trophy
June 13th, 2010Oinks teamed up with our friends at DigitalBase and Devart yesterday for the nucleus kart event saturday. It was a very exiting 3h race, with over 150 drivers in 21 karts/teams.We were able to hold the 1st position for over 2hours, but then at one of our last pilot changes things went wrong and we lost a lot of time.
We did manage to get back into 3th position by the end of the event. (And an award for the fastest lap-time )
We really enjoyed the event and hope to see you guys again soon !
Oh, and we really kicked some MicroSoft ass
Flash Player 10.1
June 11th, 2010After months of betas and release candidates, the final bits of the Adobe Flash Player 10.1 (r53) are here. Flash Player 10.1 is much more than a minor update, it comes with a broad set of new features and capabilities. Chief among these is support for hardware acceleration for 2D and 3D graphics and for video playback. Flash Player 10.1 also touts improved memory management and better performance. Plenty of improvements have been made to the streaming video features.
Get your copy here
Hello World
June 8th, 2010Our new site finally made it to the world wide web
Muchas gracias go to Mujo for helping us with this.
We hope you enjoy it as much as we do, and do come back for updates !
Gmail contacts fetch
January 8th, 2010For one of our social media projects we could use a tool to access an users gMail contacts. We are willing to share this basic class. For advanced usage we suggest using an openauth / openId implementation instead of having an user to POST his google login/password.
/*
* Copyright (c) 2010 Sam Hermans
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
* gMail Class ...
* Usage :
* $gmail = new Gmail('sam.hermans@gmail.com','ThisIsN0tMyPassword');
* $contacts = $gmail->get_contacts();
*
* if($contacts == 1)
* die('Login / password field not provided');
*
* if($contacts == 2)
* die('Login / password incorrect');
*
* if(is_array($contacts)) {
* $names = array_shift($contacts);
* $emails = array_shift($contacts);
* }
*
*/
class Gmail {
private $location = "";
private $cookiearr = array();
private $csv_source_encoding='utf-8';
private $ch;
private $login;
private $password;
public function __construct($login,$password) {
$this->login = $login;
$this->password = $password;
}
public function get_contacts(){
#check if username and password was given:
if ((isset($this->login) && trim($this->login)=="") || (isset($this->password) && trim($this->password)==""))
{
#return error code if they weren't
return 2;
}
#initialize the curl session
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_URL,"https://www.google.com/accounts/ServiceLoginAuth?service=mail");
curl_setopt($this->ch, CURLOPT_REFERER, "");
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_HEADERFUNCTION, array($this,'read_header'));
#get the html from gmail.com
$html = curl_exec($this->ch);
$matches = array();
$actionarr = array();
$action = "https://www.google.com/accounts/ServiceLoginAuth?service=mail";
#parse the login form:
#parse all the hidden elements of the form
preg_match_all('/<input type="hidden"[^>]*name\="([^"]+)"[^>]*value\="([^"]*)"[^>]*>/si', $html, $matches);
$values = $matches[2];
$params = "";
$i=0;
foreach ($matches[1] as $name)
{
$params .= "$name=" . urlencode($values[$i]) . "&";
++$i;
}
$this->login = urlencode($this->login);
$this->password = urlencode($this->password);
#submit the login form:
curl_setopt($this->ch, CURLOPT_URL,$action);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $params ."Email=$this->login&Passwd=$this->password&PersistentCookie=");
$html = curl_exec($this->ch);
#test if login was successful:
if (!isset($this->cookiearr['GX']) && (!isset($this->cookiearr['LSID']) || $this->cookiearr['LSID'] == "EXPIRED"))
{
return 1;
}
#this is the new csv url:
curl_setopt($this->ch, CURLOPT_URL, "http://mail.google.com/mail/contacts/data/export?exportType=ALL&groupToExport=&out=GMAIL_CSV");
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->ch, CURLOPT_HTTPGET, 1);
$html = curl_exec($this->ch);
$html = iconv ($this->csv_source_encoding,'utf-8',$html);
$csvrows = explode("\n", $html);
array_shift($csvrows);
$names = array();
$emails = array();
foreach ($csvrows as $row)
{
if (preg_match('/^((?:"[^"]*")|(?:[^,]*)).*?([^,@]+@[^,]+)/', $row, $matches))
{
$names[] = trim( ( trim($matches[1] )=="" ) ? current(explode("@",$matches[2])) : $matches[1] , '" ');
$emails[] = trim( $matches[2] );
}
}
return array($names, $emails);
}
private function read_header($ch,$string) {
$length = strlen($string);
if (preg_match("/Content-Type: text\\/csv; charset=([^\s;$]+)/",$string,$matches))
$this->csv_source_encoding=$matches[1];
if(!strncmp($string, "Location:", 9))
{
$this->location = trim(substr($string, 9, -1));
}
if(!strncmp($string, "Set-Cookie:", 11))
{
$cookiestr = trim(substr($string, 11, -1));
$cookie = explode(';', $cookiestr);
$cookie = explode('=', $cookie[0]);
$cookiename = trim(array_shift($cookie));
$this->cookiearr[$cookiename] = trim(implode('=', $cookie));
}
$cookie = "";
if(trim($string) == "")
{
foreach ($this->cookiearr as $key=>$value)
{
$cookie .= "$key=$value; ";
}
curl_setopt($this->ch, CURLOPT_COOKIE, $cookie);
}
return $length;
}
private function trimvals($val) {
return trim ($val, "\" \n");
}
}
Random string generator
December 8th, 2009I’m currenty working on a private special project, for this project i was in need of a random string generator… Because i’m in such a good mood today i’m willing to share the code.
Example:
echo Random::getRandom(10);
returns : dKGP79pGna
<?php
class Random {
private function getRandomArray() {
$lowercase = array('a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z');
$uppercase = array('A','B','C','D','E','F','G','H','I','J','K','L','M'
,'N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
$numbers = array('0','1','2','3','4','5','6','7','8','9');
//$special = array('-','_','!','(',')','*','+','$');
return array_merge($lowercase,$uppercase,$numbers/*,$special*/);
}
static function getRandom($length = 5) {
if($length>0) {
$randsource = self::getRandomArray();
$rand_id= "";
for($i=1; $i<=$length; $i++) {
mt_srand((double)microtime() * 1000000);
$num = mt_rand(0,sizeof($randsource));
$rand_id .= $randsource[$num];
}
}
return $rand_id;
}
}



