Monthly Archives: June 2014

XMLRPC – Programmatically post on WordPress with an attach image to post in WordPress

This is how I make it!
Shared on StackOverflow


$title = 'My title';
$body = 'My body';
$category="category1, category2"; // Comma seperated pre existing categories. Ensure that these categories exists in your blog.
$keywords="keyword1, keyword2, keyword3";
$customfields=array('key'=>'Author-bio', 'value'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format

$title = htmlentities($title,ENT_NOQUOTES,@$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,@$encoding);

$content = array(
'post_status' => 'draft', //
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'custom_fields' => array($customfields)

// Create the client object
$client = new IXR_Client('');
$username = "wp_username";
$password = "wp_username_password";

$params = array(0,$username,$password,$content,true); // Last parameter is 'true' which means post immediately, to save as draft set it as 'false'

if (!$client->query('wp.newPost', $params)) {
die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage().'');

$post_id = $client->getResponse();
echo 'Inserted with id'.$post_id;
$picture = '/full/path/to/pic.jpg';
$content = array(
'name' => basename($picture),
'type' => mime_content_type($picture),
'bits' => new IXR_Base64(file_get_contents($picture)),
if (!$client->query('metaWeblog.newMediaObject', 1, $username, $password, $content)) {
Something went wrong - newMediaObject'.$client->getErrorCode().' : '.$client->getErrorMessage().'
$media = $client->getResponse();
$content = array(
'post_status' => 'publish',
'post_thumbnail' => $media['id']
if (!$client->query('wp.editPost', 0, $username, $password, $post_id, $content)) {
Something went wrong editPost - '.$client->getErrorCode().' : '.$client->getErrorMessage().'

Download YouTube videos


Clip Converter is a free online media conversion application, which allows you to reocord, convert and download nearly any audio or video URL to common formats. Currently supported services: YouTube (HQ, HD, 4K), Vimeo and many more. This free and fast converter allows you to watch your favorite YouTube videos on your cell phone, PSP, iPhone or nearly any other device.

How to convert and download a YouTube video:
1. Paste your YouTube URL at ‘Media URL’ and press Continue.
2. Select the format and the options for the conversion. The default options are for most videos a good setting.
3. Press the ‘Start’ button at the bottom to start the conversion.
4. This may take several minutes. After the conversion is finished you can download the converted file.

HAProxy, Docker, Shipyard, CoreOS etc.

Some readings for today.

HAProxy as a static reverse proxy for Docker containers

You can’t have lots of containers listening on the same public port 80, so you have to have your containers listening on some random port like 4553, 4566, 4333 etc. But your site’s visitors are coming to port 80 so you need to somehow listen to port 80 and forward requests to the right Docker container on the right port.

There are several ways to do this and I started out with Nginx as a reverse proxy. This works fine but I don’t want a web server doing that. I’ve used HAProxy in the past for load balancing. And it is actually just what I need, a load balancer is made for forwarding requests.


rock ssd

Auto-loadbalancing with Fig, HAProxy and SERF



Management from a Single View
Shipyard gives you the ability to manage Docker resources including containers, images, hosts, and more all from a single management interface.

Multi-Host Support
Shipyard can manage multiple Docker hosts giving the flexibility to build redundant, highly available applications.

Container Metrics
Shipyard monitors and reports container metrics such as CPU and Memory utilization.


SERF, from hashicorp, the creators of Vagrant

A decentralized solution for service discovery and orchestration that is lightweight highly available, and fault tolerant.



CoreOS is a new Linux distribution that has been rearchitected to provide features needed to run modern infrastructure stacks. The strategies and architectures that influence CoreOS allow companies like Google, Facebook and Twitter to run their services at scale with high resilience. We’ve implemented them correctly so you don’t have to endure the slow, learn-as-you-go infrastructure building process.

Today we’re excited to announce that official CoreOS images are available on Google Compute Engine. This means it’s now even easier to spin up a CoreOS cluster on GCE using the API or from the command line. Adding an instance is as simple as:

Strange characters, even using meta charset=”UTF-8″

I’v deployed a work on one of my clients – a french one – server and even using charset=”UTF-8″ meta in HTML, some characters were displayed different from what they should.

cópia was showed cópia

I had to add the following line to .htaccess – forcing the Charset to be UTF-8

AddDefaultCharset UTF-8


AddDefaultCharset Off

disabling Default Charset! 🙂

Introduction to NoSQL by Martin Fowler



Know more about  Martin Fowler.
NoSQL Intro by Martin Fowler.


Like a blog it captures small items on many topics which are mostly read through my feed. Like a wiki, however, each entry is a wikiWord as I try to organize the bliki through named concepts. I write the entries to be things that are valid for a long time, and most bliki posts are just as valid now as when I wrote them.

The bliki, like much of the website, has grown and now has over 400 entries. The tags are probably the best way to explore it. There is also a page with all the recent bliki entries. All bliki entries are put, with full text, into my news feed.