Javascript Complete Object Serialization (JSON) with Methods (Object Type) and Circular References

Object serialization can be a powerful feature for transferring or persisting objects, but when using JSON  serialization with JSON.stringify()  you have to keep in mind some things:

  • Values that do not have a representation in JSON (such as functions and undefined) are excluded
  • Objects are stored as ‘Object’ without a prototype reference
  • Circular references within an object can cause an error: too much recursion

If you want to have those features get cycle.js do it like this:

 

 

 

Google translate with PhantomJS

PhantomJS is a headless browser which is controlled by Java Script statements.

Here is a small sample for using Google translate:

Save this code as gtranslate.js and put jquery.min.js within the same directory.

 

 

Ganglia IOStat Disk Metrics

When using Ganglia to monitor your cluster you might miss the possibility to measure disk metrics.
Luckily Ganglia allows to measure user defined metrics with the command line tool gmetric.

Combined with the disk monitor tool iostat, gmetric allows to measure disk metrics.

So i wrote I small PHP script which puts the iostat data to gmetric and is called periodically by a cronjob.

Using Ganglia Web 2 the outcome is pretty candy

PHP Curl Proxy

If you want to use random anonymous proxies for your curl connections, but TOR is not available use the PHP function below.
It uses the CURL proxy option with a random chosen proxy from proxylist.net.
Simple but very effective and it also supports POST data, cookies and retries.

HBase and Hive Thrift PHP Client

Due to my newest project I built a php client to access the HBase and Hive services within a hadoop cluster.

Those services are accessible via thrift a high performance protocol for back end services.

As building a client with thrift is not that easy I decided to put my HBase and Hive php thrift client packages online for others.

Links:
Hadoop

Hive
HBase
Thrift

How it works

Start the HBase and Hive Thrift server via shell:

 

Download HBase and Thrift php client package and write your own client:

 

iSearch – Meta Search Engine

Regular expression pattern based meta search with  an editor that is able to auto create patterns based on html code.

Download source code


K9 Surveillance Robot

K9 surveillance robot is a lejos and android implementation running on Lego mindstorm hardware with the following features:

  • Explores it’s environment while avoiding obstacles with an ultra sonar scanner and detects collisions with a bump sensor.
  • Creates a map from cruising data and detected obstacles.
  • Connects to bluetooth devices to exchange control data and commands.
  • Is monitoring the surrounding area by decoding video data processing it with face detection
    and draw detected faces into the map
  • Detects QR codes to receive commands and authentications.
  • Uses text to speech.
  • Serves a telnet interface for an interactive speech output.
  • Implements a web interface for live image streams, log output and a real time map

Download