Tuesday, December 30, 2008

My Engineered Universe

I'm going to attempt describing my Universe. In my Universe, the Creator, is the ultimate Engineer. The 1st thing ever created was a Pen and Writing Material according to Islam. In my Engineered Universe, where nothing existed, a detailed paper design would be the perfect starting point. The 1st thing that needed to be designed was the host environment and with it a scaled down testing environment. The live environment OS, Heaven (UNIX based) would run on 7 servers, of increasing power and the test environment, the known Universe could be run as a virtual machine. The 1st applications developed after the OS, were some device drivers, API and hooks to the OS and hardware. These were called Angels and were written mostly in c(fire).

The 1st user-space application, also written in c was the Jinn. It included some cutting-edge non-Artificial Intelligence and were able to make decisions based on their nAI engines. Pretty cool, but they ended up writing into each others memory spaces and causing general havoc on the Earth virtual machine. Meanwhile the nAI engine was modified and re-written using a new programming Language c++(clay) and was called Adam. So impressed was the Engineer that He ran a demo of Adam on the directly on the live platform with an instance of the Jinn called Iblees (a.k.a Devil). Iblees and the Angels were asked to give up some CPU in awe of Adam. The Angels obliged, but the nAI engines of the Jinn kicked in, in particular a variable called
Pride and Iblees refused.

Iblees was taken off the live platform and run in one or other virtual machine and another instance of Adam, codename Eve was run on Live. Iblees somehow managed to spawn a trojan horse (worm-snake) that accessed the memory space of Adam and Even, causing them to access a read-only Apple file (iTunes?). The Engineer, upset that the new nAI engine was not behaving, decided it was time to do some real capacity testing with Adam to see if the nAI engine could self-correct and withstand attacks from other malicious c code. Adam, Eve, Iblees were all put onto the Earth VM (with some Jinn instances already there) and given the ability to spawn multiple instances. Each instance was given a max time-to-live and assigned a logger Angel.

A time was set for the capacity test afterwhich the logs will be examined. Each instance of Adam that withstands the malicious attacks of Iblees and his Spawn will be put onto the Live platform, the rest together with Iblees will be put onto a Windows based VM called Hell.

Saturday, December 06, 2008

How to get Google Friends Wall Gadget to work on WordPress

The code generated by the Google gadget customiser at http://www.google.com/friendconnect will not simply work on a WordPress Page or Post because of the Javascript that is thrown in.

Once you're done customising your gadget you will end up with code like this:
<!-- Include the Google Friend Connect javascript library. -->
<script src="http://www.google.com/friendconnect/script/friendconnect.js" type="text/javascript"></script> <!-- Define the div tag where the gadget will be inserted. -->
<!-- Render the gadget into a div. -->
<script type="text/javascript"><!--
var skin = {};
skin['BORDER_COLOR'] = '#cccccc';
skin['ENDCAP_BG_COLOR'] = '#e0ecff';
skin['ENDCAP_TEXT_COLOR'] = '#333333';
skin['ENDCAP_LINK_COLOR'] = '#0000cc';
skin['ALTERNATE_BG_COLOR'] = '#ffffff';
skin['CONTENT_BG_COLOR'] = '#ffffff';
skin['CONTENT_LINK_COLOR'] = '#0000cc';
skin['CONTENT_TEXT_COLOR'] = '#333333';
skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
skin['CONTENT_HEADLINE_COLOR'] = '#333333';
skin['DEFAULT_COMMENT_TEXT'] = '- add your comment here -';
skin['HEADER_TEXT'] = 'Comments';
skin['POSTS_PER_PAGE'] = '5';
google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);
google.friendconnect.container.renderWallGadget(
{ id: 'div-YYYYYYYY',
site: 'XXXXXXXXXX',
'view-params':{"scope":"SITE","features":"video,comment"}
},
skin);
// --></script>

The guilty code is highlighted above. This needs to be replaced the following code on your page/post:
<script type="text/javascript" src="/scripts/wall.js"></script>
<script type="text/javascript">
<!--
doWall();
//--></script>

and the code you cut out needs to be pasted into a separate file "/scripts/wall.js with some minor adjustments as highlighted below:
function doWall(){

var skin = {};

skin['BORDER_COLOR'] = '#cccccc';

skin['ENDCAP_BG_COLOR'] = '#e0ecff';

skin['ENDCAP_TEXT_COLOR'] = '#333333';

skin['ENDCAP_LINK_COLOR'] = '#0000cc';

skin['ALTERNATE_BG_COLOR'] = '#ffffff';

skin['CONTENT_BG_COLOR'] = '#ffffff';

skin['CONTENT_LINK_COLOR'] = '#0000cc';

skin['CONTENT_TEXT_COLOR'] = '#333333';

skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';

skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';

skin['CONTENT_HEADLINE_COLOR'] = '#333333';

skin['DEFAULT_COMMENT_TEXT'] = '- add your comment here -';

skin['HEADER_TEXT'] = 'Comments';

skin['POSTS_PER_PAGE'] = '5';

google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);

google.friendconnect.container.renderWallGadget(

{ id: 'div-YYYYYYYY',

site: 'XXXXXXXXXX',

'view-params':{"scope":"SITE","features":"video,comment"}

},

skin);

}

Figured this out using this guide. Results can be viewed on my comment wall.

Thursday, December 04, 2008

A script for adding multiple twitter follows....

@magitam had an interesting problem and I had an itch to try out the python-twitter API.

follow.py is the result.

Usage: ./follow.py <twitter username> <twitter password> <filename.csv>")

Copy the code above and save it using notepad as follow.py

You will need a python interpreter and the python-twitter API to run it. Tested on Linux but should run anywhere.

The input file can be either:
friend1

friend2

friend3

or
friend1,friend2,friend3

or
friend1,friend2

friend3

Disclaimer: I will not take responsibility for loss of life, revenue, sex drive, property or any negative consequence suffered as a result of using the above code.

[gallery]