<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3784103612956882578</id><updated>2012-02-16T18:56:02.040-08:00</updated><title type='text'>Alvinator's Playground</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-8968940839801804283</id><published>2010-03-02T02:09:00.000-08:00</published><updated>2010-03-02T02:29:40.825-08:00</updated><title type='text'>PLM Open Source Seminar</title><content type='html'>For those who have attended the Open Source Seminar we conducted in Pamantasan ng Lungsod ng Maynila last saturday, I've posted the presentation and the cheat sheets I used below. Again, good luck on the tests. :)&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/present/edit?id=0AeBPhrGolhDlZGNwcnM4YjdfMzFmOWs5ZnoyNQ&amp;hl=en"&gt;Presentation:&lt;/a&gt;&lt;br /&gt;&lt;iframe src="http://docs.google.com/EmbedSlideshow?docid=0AeBPhrGolhDlZGNwcnM4YjdfMzFmOWs5ZnoyNQ" frameborder="0" width="410" height="342"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/Doc?docid=0AeBPhrGolhDlZGNwcnM4YjdfNzd2ZGdtcThjOA&amp;hl=en"&gt;Cheat Sheet&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-8968940839801804283?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/8968940839801804283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=8968940839801804283' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/8968940839801804283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/8968940839801804283'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2010/03/plm-open-source-seminar.html' title='PLM Open Source Seminar'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-7005279872349114548</id><published>2009-08-21T18:25:00.000-07:00</published><updated>2009-08-21T18:37:31.826-07:00</updated><title type='text'>Flumotion 0.6.0</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_DK22XhIO1L4/So9JW3Fq8OI/AAAAAAAAAEo/6WJD17aj7ag/s1600-h/flumotion.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 252px; height: 320px;" src="http://3.bp.blogspot.com/_DK22XhIO1L4/So9JW3Fq8OI/AAAAAAAAAEo/6WJD17aj7ag/s320/flumotion.jpg" alt="" id="BLOGGER_PHOTO_ID_5372593537569976546" border="0" /&gt;&lt;/a&gt;Just a few hours ago, Flumotion 0.6.0 "Can Punyetes" has been released. It's one of my first contributions to an open source project and I'm quite proud to see it hitting a milestone (even though I only worked on low-hanging fruits). So if you're looking for a way to stream media for free, be sure to check it out.&lt;br /&gt;&lt;br /&gt;Release Notes: &lt;a href="http://flumotion.net/releases/flumotion/0.6.0.html"&gt;http://flumotion.net/releases/flumotion/0.6.0.html&lt;/a&gt;&lt;br /&gt;Download: &lt;a href="http://www.flumotion.net/download/"&gt;http://www.flumotion.net/download/&lt;/a&gt;&lt;br /&gt;Demosite: &lt;a href="http://flumotion.com/demosite/index.php"&gt;http://flumotion.com/demosite/index.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It's quite sad that I won't be able to attend the release party though. =/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-7005279872349114548?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/7005279872349114548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=7005279872349114548' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/7005279872349114548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/7005279872349114548'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2009/08/flumotion-060-released.html' title='Flumotion 0.6.0'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DK22XhIO1L4/So9JW3Fq8OI/AAAAAAAAAEo/6WJD17aj7ag/s72-c/flumotion.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-5365817398440158750</id><published>2009-05-05T06:46:00.000-07:00</published><updated>2009-05-05T07:10:00.453-07:00</updated><title type='text'>A geek saying goodbye...</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_DK22XhIO1L4/SgBEP9c2c1I/AAAAAAAAADw/v5cTf-dbib8/s1600-h/signoff.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 118px;" src="http://4.bp.blogspot.com/_DK22XhIO1L4/SgBEP9c2c1I/AAAAAAAAADw/v5cTf-dbib8/s400/signoff.png" alt="" id="BLOGGER_PHOTO_ID_5332336999790965586" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;As of thursday this week, I will be no longer be tied with Smart Uzzap. Honestly it's kind of sad to leave a project that I've worked on for almost two years. I've been there since its infancy, growth pains, and up to its maturity. All I wish for now is to see my project Amazilia (the Smart Uzzap's backend) continue pumping out big numbers that will keep the project managers happy. As for now, I bid farewell buddy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-5365817398440158750?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/5365817398440158750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=5365817398440158750' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5365817398440158750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5365817398440158750'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2009/05/geek-saying-goodbye.html' title='A geek saying goodbye...'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DK22XhIO1L4/SgBEP9c2c1I/AAAAAAAAADw/v5cTf-dbib8/s72-c/signoff.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-2177118601129473154</id><published>2009-04-17T01:45:00.001-07:00</published><updated>2009-04-17T02:24:46.951-07:00</updated><title type='text'>Developing Applications with Python seminar</title><content type='html'>For those who will attend my Python Seminar on April 18, 2009 at Informatics Northgate; you can view and download the materials below:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/Presentation?id=dcprs8b7_4ggxj4xd8"&gt;Presentation&lt;/a&gt;:&lt;br /&gt;&lt;iframe src='http://docs.google.com/EmbedSlideshow?docid=dcprs8b7_4ggxj4xd8' frameborder='0' width='410' height='342'&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Source Codes:&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f7a7837ce"&gt;tweet.py&lt;/a&gt; - A simple micro-blogging software using CherryPy.&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f14d8d186"&gt;qt-textedit.py&lt;/a&gt; - A basic text editor using PyQt4&lt;br /&gt;&lt;br /&gt;Please feel free to email me if there is some inconsistencies with my materials.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-2177118601129473154?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/2177118601129473154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=2177118601129473154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2177118601129473154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2177118601129473154'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2009/04/developing-applications-in-python.html' title='Developing Applications with Python seminar'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-3362482671661980895</id><published>2009-04-08T05:34:00.000-07:00</published><updated>2009-04-12T09:43:44.014-07:00</updated><title type='text'>GStreamer Hack Sprint</title><content type='html'>My target: Get to know gstreamer and write something useful with it. :)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Day 1 (Hello GTK+):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;GStreamer's cool and has a good python binding although I decided to use C this time. It's been a long time since I wrote software in a low-level language and it seems now is the best time to resharpen. First up getting to know gtk, glib, and gobjects. I started my baby steps by writing a simple text editor using GTK 2.0 and Glade. Doing this exercise made me realize that I've been pampered by python for too long.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_DK22XhIO1L4/Sdyg9wfI6fI/AAAAAAAAADY/MuRAPdDiJQo/s1600-h/textedit"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 369px;" src="http://2.bp.blogspot.com/_DK22XhIO1L4/Sdyg9wfI6fI/AAAAAAAAADY/MuRAPdDiJQo/s400/textedit" alt="" id="BLOGGER_PHOTO_ID_5322305842493057522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here's the source code for those who are interested:&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f188cf542"&gt;&lt;span style="text-decoration: underline;"&gt;textedit.c&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f1904027b"&gt;&lt;span style="text-decoration: underline;"&gt;textedit.glade&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Day 2 (Hello GStreamer):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After barely reawakening some of my C programming, I headed over to freedesktop to read about &lt;a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html"&gt;application programming in gstreamer&lt;/a&gt;. I give kudos to all people who wrote the gstreamer manual. This enabled me to create a command-line mp3 player. (I'm now listening to my favorite artist Shiina Ringo with it). ^_^&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_DK22XhIO1L4/Sd4IrgEfNyI/AAAAAAAAADg/RRmRe8HPOkU/s1600-h/mp3.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 285px;" src="http://2.bp.blogspot.com/_DK22XhIO1L4/Sd4IrgEfNyI/AAAAAAAAADg/RRmRe8HPOkU/s400/mp3.png" alt="" id="BLOGGER_PHOTO_ID_5322701353034659618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The pipeline that was used here is:&lt;br /&gt;&lt;blockquote&gt;filesrc ! mad ! audioconvert ! alsasink&lt;/blockquote&gt;The mp3 player uses the mad plugin which is in 'gst-plugins-ugly' so you may have to install the gstreamer plugins-ugly to make it work (they usually don't get installed by default specially by Ubuntu). Below is the source code and a python version which does the same thing:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f6f035a33"&gt;mp3player.c&lt;/a&gt;&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f75b083f4"&gt;mp3player.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Day 3 &amp;amp; 4 (GtkTreeView woes):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Having some limited knowledge about GstBus (which is needed for catching GstMessages and take action on them), it seemed that it would be enough to create a simple 'playlist' engine by listening to GST_MESSAGE_EOS (end-of-stream).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_DK22XhIO1L4/SeIXXRM6xoI/AAAAAAAAADo/UZRxbz-y7LY/s1600-h/gstplayer.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 261px;" src="http://4.bp.blogspot.com/_DK22XhIO1L4/SeIXXRM6xoI/AAAAAAAAADo/UZRxbz-y7LY/s400/gstplayer.png" alt="" id="BLOGGER_PHOTO_ID_5323843398027363970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here's my baby steps to combine GTK+ and GStreamer together. It's miles away from becoming useful yet. GtkTreeView (as my playlist) is giving me a lot of challenges and parsing tags (media file info) doesn't seem to work properly.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/fe6468c6"&gt;gstplayer.c&lt;/a&gt;&lt;br /&gt;&lt;a href="http://alvinator.pastebin.com/f579568f8"&gt;gstplayer.glade&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-3362482671661980895?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/3362482671661980895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=3362482671661980895' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/3362482671661980895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/3362482671661980895'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2009/04/gstreamer-hack-sprint.html' title='GStreamer Hack Sprint'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DK22XhIO1L4/Sdyg9wfI6fI/AAAAAAAAADY/MuRAPdDiJQo/s72-c/textedit' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-1381712506203587954</id><published>2008-11-25T11:29:00.000-08:00</published><updated>2008-11-25T12:57:38.133-08:00</updated><title type='text'>Scaling MySQL for dummies</title><content type='html'>Alvinator's LOG: November 26, 2008 4:30am&lt;br /&gt;&lt;br /&gt;I know it seems unhealthy to stay up awake at these times. I just finished my work but I can't manage to sleep anymore so I thought about writing a short blog.&lt;br /&gt;&lt;br /&gt;MySQL has been my favorite RDBMS since I started working with databases. It's free, fast and easy to use although I know a lot of people arguing about its lack for features vs Oracle and postgresql specially on scaling. Well there's this mysql-cluster that promises High-Availabity and Performance, but I still find it pretty complex to setup and maintain. What you can do is put something on top of MySQL and you can do that with your own elbow-grease. There's a lot of techniques in doing this and these three are those that I've used so far:&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/replication.html"&gt;Replication&lt;/a&gt;&lt;br /&gt;You can replicate MySQL database (n) times, then configure your database applications to issue the SELECT commands on the replicas and INSERT/UPDATE/DELETE on the master database. This kind of setup is good for websites where most of the database operations is SELECT.&lt;br /&gt;&lt;br /&gt;Advantages: Fast Reads&lt;br /&gt;Disadvantages: Only one Master Database for writes (one point of failure)&lt;br /&gt;Problems that may arise: Slave data might lag due to connectivity problems with the master rendering your SELECTS outdated at some point in time.&lt;br /&gt;&lt;br /&gt;2. &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/partitioning.html"&gt;Partitioning&lt;/a&gt;&lt;br /&gt;A table that has multi-million rows will drag your queries. One solution is to partition your table into multiple tables on a specific category like dates, year, location, etc. You can do this programatically yourself or you can make use of MySQL 5.x's built-in partitioning support. I've used it when parsing logs into database.&lt;br /&gt;&lt;br /&gt;Advantages: Fast Reads&lt;br /&gt;Disadvantages: queries into multiple tables is quite hairy&lt;br /&gt;Problems that may arise: You're still using one MySQL server instance and that makes it one point of failure.&lt;br /&gt;&lt;br /&gt;3. Sharding&lt;br /&gt;I first heard about this when I was watching the youtube guys in google tech talk giving some information about their experiences scaling youtube. Sharding in a nutshell is where you partition your database across different MySQL servers and across different machines. A data can be stored in a shard (a MySQL database instance) using a specific foreign key like name, date, or a programmatic hash. I've personally implemented this kind of setup and I'm quite satisfied with it. Just one note: This is NOT the holy grail of MySQL Scalability, your specific requirements may not be met on this kind of setup.&lt;br /&gt;&lt;br /&gt;Advantages: Fast Read/Writes, Better HA since you have multiple MySQL instances&lt;br /&gt;Disadvantages: You have to implement it yourself, your database applications will need to connect to multiple databases.&lt;br /&gt;Problem that may arise: Resharding is a nightmare, your system admins will hate you because manual queries will be harder, a lookup that is not using the foreign key will require you to query across all shards.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In sharding you have to decide how you can spread your data across shards and know how to easily obtain them. You use for example the first letter in username ('A' goes to shard1, 'B' goes to shard2, ...) which is human understandable although there's probably more A's than X's, Y's, and Z's right? A better solution is by programmatic hash. Using a programmatic hash ensures that your data is equally scattered among your shards. In python you can do it like this:&lt;br /&gt;&lt;br /&gt;Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)&lt;br /&gt;[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2&lt;br /&gt;Type "help", "copyright", "credits" or "license" for more information.&lt;br /&gt;&gt;&gt;&gt; def hash_me(username, numshards):&lt;br /&gt;...     return hash(username) % numshards&lt;br /&gt;...&lt;br /&gt;&gt;&gt;&gt; hash_me("alvinator", 4)&lt;br /&gt;3&lt;br /&gt;&gt;&gt;&gt;&lt;br /&gt;&lt;br /&gt;That makes "alvinator" assigned to shard number 3 if you have 4 shards.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-1381712506203587954?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/1381712506203587954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=1381712506203587954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1381712506203587954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1381712506203587954'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/11/scaling-mysql-for-dummies.html' title='Scaling MySQL for dummies'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-5792158003078624180</id><published>2008-11-10T05:05:00.000-08:00</published><updated>2009-02-09T18:50:51.906-08:00</updated><title type='text'>Smart Uzzap launch</title><content type='html'>It's been almost six months since I last posted in this blog. The main reason of this long absence is because of this:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_DK22XhIO1L4/SRgzCb-stFI/AAAAAAAAAC4/23eHi1PDGRA/s1600-h/uzzap-update.jpg"&gt;&lt;img style="cursor: pointer; width: 345px; height: 295px;" src="http://4.bp.blogspot.com/_DK22XhIO1L4/SRgzCb-stFI/AAAAAAAAAC4/23eHi1PDGRA/s400/uzzap-update.jpg" alt="" id="BLOGGER_PHOTO_ID_5267015881173283922" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Jaj7-sq75ZY&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/Jaj7-sq75ZY&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Our main project Smart Uzzap has been launched last July 7, 2008 and it looks that it will have a bright future ahead. The total user base still keeps growing to the point that our public chat rooms can barely keep up to the number of people that would like to socialize.&lt;br /&gt;&lt;br /&gt;Like all systems, we did experienced a lot of birth pains and problems. We even encountered OS level issues that was pretty alien to us (TCP Zero Window, TCP half-open scenarios, weird behavior of mobile GGSN's, fuzzy network congestions, etc.). Although amidst of these stressful situations, I'm quite greatful for being a part of it since very few people do encounter and learn how to fix these problems.&lt;br /&gt;&lt;br /&gt;Being a python developer, I'm very proud to say that the Smart Uzzap server and its other components is written in python. While currently on production, it still keeps evolving silently in the background. Even though I get tired of attending meetings, fixing bugs, and introducing new features; I feel good knowing that people start building their own community with Uzzap. There has been some eyeballs, friendster accounts, blogs, and youtube clips like one below that was created by Uzzap users&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/wRwe6FR6LcE&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/wRwe6FR6LcE&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Here's the things that I've learned since the project launch:&lt;br /&gt;&lt;br /&gt;1. Every system has its own issues so don't panic.&lt;br /&gt;2. Resource Monitoring and Reports is a must but at the same time, you should be smart enough to interpret what they say to track down bottlenecks.&lt;br /&gt;3. Do not take TCP for granted!!! You should configure your TCP settings according to how you utilize the server.&lt;br /&gt;4. A low load average doesn't mean that the network traffic is low.&lt;br /&gt;5. Server applications should be smart enough to reconfigure itself during runtime.&lt;br /&gt;6. Avoid, the one-point of failure systems. Always provide a backup or have each component scalable.&lt;br /&gt;7. Do the network programmer loop:&lt;br /&gt;Relax -&gt; Look for bottlenecks -&gt; Fix bottlenecks -&gt; Test the fixes on development setup -&gt; Apply Fixes -&gt; go back to step 1.&lt;br /&gt;8. Sharding databases is quite nice as long as you only have 1 foreign key to each of the database servers.&lt;br /&gt;9. Sometimes, a measly one-liner of code can greatly improve the system. ^_^&lt;br /&gt;&lt;br /&gt;As for home projects, I'm too tired to horse around in my cave anymore although I'm planning to try my hands on some streaming stuff like the &lt;a href="http://www.ietf.org/rfc/rfc2326.txt"&gt;RFC 2326 RTSP protocol&lt;/a&gt;. So there we go, if anyone needs some advise on scalability, don't be shy send me an email and I'll try my best to answer.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-5792158003078624180?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/5792158003078624180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=5792158003078624180' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5792158003078624180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5792158003078624180'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/11/smart-uzzap-launch.html' title='Smart Uzzap launch'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DK22XhIO1L4/SRgzCb-stFI/AAAAAAAAAC4/23eHi1PDGRA/s72-c/uzzap-update.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-2221719343397129343</id><published>2008-05-05T06:06:00.000-07:00</published><updated>2008-05-05T07:01:01.660-07:00</updated><title type='text'>Testing 1-2-3 and foobar</title><content type='html'>I have a habit of using strings for sanity tests and tutorials such as: "hello world", "foo bar" and "Testing 1-2-3". I believe I got these from looking at other persons code and reading RFC's. Out of boredom, I googled these strings and found out they have colorful history attached to them:&lt;br /&gt;&lt;br /&gt;1. "hello, world" - There is almost no programming book and tutorial that doesn't teach you how to display this word. The string "hello world" first came out with Brian Kernighan's "The C Programming Language" in 1974 and has become the basis for introducing programming languages. (&lt;a href="http://en.wikipedia.org/wiki/Hello_world_program"&gt;http://en.wikipedia.org/wiki/Hello_world_program&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;2. "Testing 1-2-3" - was the first ever email message sent by ARPANet's Ray Tomlinson in 1971. Although Ray himself vaguely remembers it (It could've been "QWERTYUIOP" or "Testing 1 2 3 4"). (&lt;a href="http://openmap.bbn.com/%7Etomlinso/ray/mistakes.html"&gt;http://openmap.bbn.com/~tomlinso/ray/mistakes.html&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;3. "foo &amp;amp; bar" - if you happen to read IETF RFC papers (Request for Comments), you'll often come across with these words. Most of the times I noticed that they are used as variable names. The term foobar was first found in DEC (Digital Equipment Corporation) manuals during 1960's. One theory is that is came from the term "FUBAR" meaning "Fucked Up Beyond All Repair". (&lt;a href="http://en.wikipedia.org/wiki/Foobar"&gt;http://en.wikipedia.org/wiki/Foobar&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/FUBAR"&gt;http://en.wikipedia.org/wiki/FUBAR&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;Although I can't assure you that my resources are true, it still quite fun digging through wikipedia pages. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-2221719343397129343?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/2221719343397129343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=2221719343397129343' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2221719343397129343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2221719343397129343'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/05/foobar-hello-world-and-testing-1-2-3.html' title='Testing 1-2-3 and foobar'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-2046350421325847214</id><published>2008-04-27T02:49:00.002-07:00</published><updated>2008-04-27T08:57:08.258-07:00</updated><title type='text'>Fun with DirectX SDK</title><content type='html'>Whew! What a stressful week! I've been looking forward for this weekend to cave in my room and relax. Instead of talking about my SCTP work, I decided to spend my weekend to play around with DirectX SDK.&lt;br /&gt;&lt;br /&gt;There was a point that I considered myself a hard-core gamer. I remember the days back in college where I save every little bit of my allowance just to get that state-of-the-art Video Card. You'll often find me browsing the net looking at the colorful video card performance comparison graphs on &lt;a href="http://guru3d.com/" ref="http://www.guru3d.com/"&gt;guru3d&lt;/a&gt; making sure I'd get the best card for my hard-earned cash. Then after 6 months I got a Radeon 9600 which was a midrange card at that time. It was money well spent and even after five years I still use it.&lt;br /&gt;&lt;br /&gt;After wasting hours shooting pixelated enemies with my trusty video card, I got interested on DirectX. If you're a PC gamer there's is a point in time that you'll be asked to install DirectX first before the game could work. So what the hell is DirectX?&lt;br /&gt;&lt;br /&gt;DirectX is a set of tools that provides software developers direct interface to video hardware. In addition to that it also provides API's for other multimedia devices like keyboard/mouse input and sound cards which makes it a great tool for developing games. Developing with DirectX gives you an assurance that your application will work with across different video cards and platforms (like XBox360) and the most important thing is that it's free! How cool is that? So I headed over Microsoft to download the &lt;a href="ttp://msdn2.microsoft.com/en-us/directx/"&gt;DirectX 9.0 SDK&lt;/a&gt; to get my hands dirty.&lt;br /&gt;&lt;br /&gt;There's a very good DirectX game programming Tutorial over the net. I recommend you to drop by and read the tutorials &lt;a href="http://www.directxtutorial.com/"&gt;here&lt;/a&gt; . The website is a good jumpstart  and I plan to read it throughout this study. One notable game programming resource is &lt;a href="http://www.gamedev.net/"&gt;gamedev.net&lt;/a&gt; which I happen to read to get my interest going.&lt;br /&gt;&lt;br /&gt;With the great help of the tutorials, I managed to write a code that speaks directly to my Radeon 9600! It is basically a morphing triangle that redraws in 25 frames per second. ^_^&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_DK22XhIO1L4/SBRYuSZg9FI/AAAAAAAAABY/NmGN4UILv1U/s1600-h/demo1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_DK22XhIO1L4/SBRYuSZg9FI/AAAAAAAAABY/NmGN4UILv1U/s400/demo1.JPG" alt="" id="BLOGGER_PHOTO_ID_5193873822501106770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I wrapped most of the Windows-related mumbo-jumbo stuff in functions (specially the Window creation). The code will compile as long as you added the DirectX SDK to the project. This is a very basic demonstration on how to use DirectX. The code is still in its early stages but in truth, it can be used as your default template for creating games! I added a comment in the code where you'll insert your game logic. Hurry up and &lt;a href="http://www.mediafire.com/?x0dv1zmcg69"&gt;download&lt;/a&gt; the source code!&lt;br /&gt;&lt;br /&gt;It's been my dream to write my own game and so far I had my first step and I have a list of TODO's:&lt;br /&gt;&lt;br /&gt;- Write a collection of classes to make my job easier&lt;br /&gt;- Take a look at openGL&lt;br /&gt;- Learn how to load fonts, bitmap, and 3d models in DirectX&lt;br /&gt;&lt;br /&gt;I hope this could mutate into something interesting. When it gets to that point, I'll be sharing my code. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-2046350421325847214?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/2046350421325847214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=2046350421325847214' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2046350421325847214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/2046350421325847214'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/fun-with-directx-sdk.html' title='Fun with DirectX SDK'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DK22XhIO1L4/SBRYuSZg9FI/AAAAAAAAABY/NmGN4UILv1U/s72-c/demo1.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-434461072830156414</id><published>2008-04-17T06:09:00.000-07:00</published><updated>2008-04-17T08:05:12.332-07:00</updated><title type='text'>Writing Python modules in C</title><content type='html'>Python just like other scripting languages is &lt;span style="font-weight: bold;"&gt;interpreted &lt;/span&gt;meaning that a program written in python is processed by an interpreter that encodes it to computer understandable machine code during runtime. The interpreter overhead does reduce its performance over machine compiled languages like C &amp;amp; C++. One advantage though is that programs written in interpreted languages are portable as long as the platform has the corresponding interpreter installed.&lt;br /&gt;&lt;br /&gt;Thinking forward:&lt;br /&gt;--- "Is there a way to write an application that should perform as fast as possible but at the same time take the advantage of python rapid development?"&lt;br /&gt;&lt;br /&gt;--- "I have a project that uses a protocol that can only be written in C. Is there a surefire way to make my life easier?"&lt;br /&gt;&lt;br /&gt;...and the answer to both of the questions is "yes" there's a way.&lt;br /&gt;&lt;br /&gt;Most of the modules that comes with python is actually written in C or C++. They are compiled as a shared object library and it does makes applications using it run faster. It's just like writing small and fast C modules and gluing them together with a high-level language. One popular example of this technique is the game Civilization IV which uses python as its interface layer on its C++ game codes and today I'll teach you how to do that. :)&lt;br /&gt;&lt;br /&gt;First you need to have these necessary stuff installed in your system:&lt;br /&gt;gcc - GNU C compiler&lt;br /&gt;python-dev - python include files (you can download this on their &lt;a href="http://www.python.org/"&gt;website&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;For this tutorial, I wrote a very simple and useless python extension that takes two integer values and returns the sum:&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#AAAAAA" border="1"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;font color="black"&gt;      #include &amp;lt;Python.h&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;      int a, b, sum;&lt;br /&gt;      static PyObject *&lt;br /&gt;      Add(PyObject *self, PyObject *args)&lt;br /&gt;     {&lt;br /&gt;        if (!PyArg_ParseTuple(args, "ii", &amp;amp;a, &amp;amp;b))&lt;br /&gt;              return NULL;&lt;br /&gt;        sum = a + b;&lt;/span&gt;&lt;/python.h&gt;&lt;br /&gt;&lt;python.h&gt;&lt;span style="font-size:85%;"&gt;     return Py_BuildValue("i", sum);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;  PyMethodDef adder_methods[] = {&lt;br /&gt;   {"add", Add, METH_VARARGS, "Add two integers"},&lt;br /&gt;   {NULL, NULL, 0, NULL}&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;    PyMODINIT_FUNC&lt;br /&gt;   initadder()&lt;/span&gt;&lt;/python.h&gt;&lt;br /&gt;&lt;python.h&gt;&lt;span style="font-size:85%;"&gt;    {&lt;br /&gt;         (void) Py_InitModule("adder", adder_methods);&lt;br /&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/font&gt;&lt;/table&gt;&lt;br /&gt;Here's a quick run through:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Line 1&lt;/span&gt;: Include Python header&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lines 3-4&lt;/span&gt;: Create a function named Add that accepts and returns an abstract Python Object&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lines 6-7&lt;/span&gt;: PyArg_ParseTuple says that the function will require two Integers denoted by "ii" if the requirement is not met return NULL (which causes an error)&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Line 8&lt;/span&gt;: Our shameful adder logic&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Line 9&lt;/span&gt;: Py_BuildValue converts the C integer variable &lt;span style="font-weight: bold;"&gt;sum&lt;/span&gt; to Python integer denoted by "i"&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lines 12-15&lt;/span&gt;: PyMethodDef defines the functions available in this modules. As you can see it defines a function name "add" that points to our C function "Add".&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Lines 17-20&lt;/span&gt;: Initializes our modules and assigns it with a name "adder"&lt;br /&gt;&lt;br /&gt;To be able to use this in python, we need to build it first. The easiest way to do this is to use python &lt;span style="font-weight: bold;"&gt;distutils&lt;/span&gt;. Create a file named setup.py:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;from distutils.core import setup, Extension&lt;br /&gt;import sys&lt;br /&gt;&lt;br /&gt;setup(name = "adder",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;      version = "0.1",&lt;br /&gt;    ext_modules = [Extension("adder", ["adder.c"])])&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Then build adder by this chain of commands:&lt;br /&gt;# python setup.py build (compiles it with gcc)&lt;br /&gt;# sudo python setup.py install (installs it to python site-packages directory)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;And there you have it. Your own python module written in C. Cool isn't it?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_DK22XhIO1L4/SAdcmRt_zBI/AAAAAAAAABQ/fkqDZ5Nd9LQ/s1600-h/adder.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_DK22XhIO1L4/SAdcmRt_zBI/AAAAAAAAABQ/fkqDZ5Nd9LQ/s400/adder.jpg" alt="" id="BLOGGER_PHOTO_ID_5190218908228897810" border="0" /&gt;&lt;/a&gt;Sadly this is a blog, if I just have an actual web page I could explain this much further. For now, if you want to know more about the Python.h stuff that I used in this program, head over to &lt;a href="http://docs.python.org/api/api.html"&gt;python/C API reference manual&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This tutorial actually leads to my next blog which is about how do SMS (Short Messaging Service) actually work and at the same time give you a nice python extension that I wrote (SCTP sockets in python!). I hope that I helped somebody out there, Til next blog! ^_^&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-434461072830156414?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/434461072830156414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=434461072830156414' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/434461072830156414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/434461072830156414'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/writing-python-modules-in-c.html' title='Writing Python modules in C'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DK22XhIO1L4/SAdcmRt_zBI/AAAAAAAAABQ/fkqDZ5Nd9LQ/s72-c/adder.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-1588033372431255373</id><published>2008-04-14T05:24:00.000-07:00</published><updated>2008-04-15T05:00:44.983-07:00</updated><title type='text'>A Simple Chat Room Server</title><content type='html'>Server programming poses a lot of challenges but nowadays with the advent of high-level languages such as python, the code that actually makes the basic server functions is put out of the equation giving us the time to think more about the logic and features that were going to implement.&lt;br /&gt;&lt;br /&gt;Last March I conducted a network programming seminar in PUP's College of Eng'g. I expected a good question and answer session from them but sad to say, there were very few questions that was thrown at me. Probably the reason was that the seminar was a little bit too technical for the students and network programming is very rarely taught in College. (I wish I could've at least had more time to teach them with a hands on session)&lt;br /&gt;&lt;br /&gt;On the seminar I provided a simple Chat Room server program written in python. This is a very good example how easy it is to write server programs nowadays. The code is roughly 100 lines and is self-explanatory (rewriting this to C++ could take more lines).&lt;br /&gt;&lt;br /&gt;The Chat room server implements a very simple protocol:&lt;br /&gt;&lt;br /&gt;LIST - returns the nickname of the people that are online&lt;br /&gt;LOGIN:&lt;nick&gt;&lt;nick&gt; - login to the chat room with the provided nick name (Default is&lt;/nick&gt;&lt;nick&gt; 'Anonymous Coward')&lt;br /&gt;EXIT - leave the chat room&lt;br /&gt;&lt;br /&gt;The server assumes that it's a message if the typed message does not match the existing commands. The chat_server.py is tested to work under linux and should be started just like:&lt;br /&gt;&lt;/nick&gt;&lt;br /&gt;&lt;nick&gt;# ./chat_server.py "port number to listen to"&lt;port&gt;&lt;br /&gt;&lt;br /&gt;You can use &lt;span style="font-weight: bold;"&gt;telnet &lt;/span&gt;to connect to the server:&lt;br /&gt;&lt;br /&gt;# telnet localhost "port number where the server is listening"&lt;/port&gt;&lt;/nick&gt;&lt;nick&gt;&lt;port&gt;&lt;port&gt;&lt;br /&gt;&lt;br /&gt;We use &lt;span style="font-weight: bold;"&gt;localhost &lt;/span&gt;or &lt;span style="font-weight: bold;"&gt;127.0.0.1 &lt;/span&gt;assuming that the server in running in the same machine. The interface is similar to the old unix &lt;a href="http://en.wikipedia.org/wiki/Talk_%28Unix%29"&gt;talk&lt;/a&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;program.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/port&gt;&lt;/port&gt;&lt;/nick&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_DK22XhIO1L4/SANVvRt_zAI/AAAAAAAAABI/qVg19CZU9nU/s1600-h/msc.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_DK22XhIO1L4/SANVvRt_zAI/AAAAAAAAABI/qVg19CZU9nU/s400/msc.jpg" alt="" id="BLOGGER_PHOTO_ID_5189085466359483394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;nick&gt;&lt;port&gt;&lt;port&gt;So there, a Chat Room server written in 100 lines of code! If you're bored, you can &lt;/port&gt;&lt;/port&gt;&lt;/nick&gt;&lt;a href="http://www.mediafire.com/?tjnyznkjuzc"&gt;download the Source Code&lt;/a&gt;&lt;nick&gt;&lt;port&gt;&lt;port&gt; and see for yourself (some explanatory comments added).&lt;br /&gt;&lt;br /&gt;Now that I've posted a sample python code, next blog is about how to make your own python modules in C. That's it for now. ^_^&lt;/port&gt;&lt;/port&gt;&lt;/nick&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;nick&gt;&lt;port&gt;&lt;port&gt;&lt;br /&gt;&lt;/port&gt;&lt;/port&gt;&lt;/nick&gt;&lt;/nick&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-1588033372431255373?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/1588033372431255373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=1588033372431255373' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1588033372431255373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1588033372431255373'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/simple-chat-room-server.html' title='A Simple Chat Room Server'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DK22XhIO1L4/SANVvRt_zAI/AAAAAAAAABI/qVg19CZU9nU/s72-c/msc.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-5638695684282516752</id><published>2008-04-13T03:36:00.000-07:00</published><updated>2008-04-13T04:23:32.290-07:00</updated><title type='text'>Making a living out of python</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_DK22XhIO1L4/SAHkzRt_y_I/AAAAAAAAABA/0OkkBw_6fZY/s1600-h/zen.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_DK22XhIO1L4/SAHkzRt_y_I/AAAAAAAAABA/0OkkBw_6fZY/s400/zen.jpg" alt="" id="BLOGGER_PHOTO_ID_5188679815288310770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I was introduced with a number of scripting languages when I started developing unix applications. I've tried quite a few: PHP, perl, and even ruby but nothing can compare on how many projects I've done using python.&lt;br /&gt;&lt;br /&gt;What I like about python is the very simple syntax to the point that it's self-documenting. It has its own console (just what is shown above) which is great for debugging and checking what methods and members is inside a package or class (using the &lt;span style="font-weight: bold;"&gt;dir() &lt;/span&gt;function). It has a huge community of developers writing cool modules on it like DirectX and openGL wrappers, game libraries (pygame), network programming api's (python-twisted), and more. In case if you need help, there's a very active mailing-list (comp.lang.python) where you could ask questions.&lt;br /&gt;&lt;br /&gt;In my work which is mostly writing web services and implementing network protocols and stuff, python helped me to think more about how to make things work rather than how should I code it. Funny thing is that I know a lot of software developers who's never heard of it (I live in Philippines by the way, it could differ in other places). After googling on the web you'll find companies like google and youtube using python on their backend services. So if you have some spare time head to &lt;a href="http://www.python.org/"&gt;python.org&lt;/a&gt; and see for yourself. There also a free online book that you can &lt;a href="http://www.diveintopython.org/"&gt;download&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Okay after a brief introduction, we'll write some python code next. After that we'll write a python module in C. Till next blog! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-5638695684282516752?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/5638695684282516752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=5638695684282516752' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5638695684282516752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/5638695684282516752'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/making-living-out-of-python.html' title='Making a living out of python'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DK22XhIO1L4/SAHkzRt_y_I/AAAAAAAAABA/0OkkBw_6fZY/s72-c/zen.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-1419544525221182813</id><published>2008-04-12T22:30:00.000-07:00</published><updated>2008-04-14T18:54:49.554-07:00</updated><title type='text'>Tools of Trade</title><content type='html'>I've been professionally writing software for three years and worked with a number of IDEs, platforms, and languages depending on the problem at hand. So far here are my favourites:&lt;br /&gt;&lt;br /&gt;Platform: Linux/Unix&lt;br /&gt;Editor: emacs&lt;br /&gt;IDE: none&lt;br /&gt;Languages: C/C++ and python&lt;br /&gt;&lt;br /&gt;These are the combination that puts food on my table. I don't use IDE in linux even though there's eclipse. So far I can stay productive hacking away at a dark console window that is running my favorite emacs editor. Python hands down is the best scripting language in my own opinion.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Platform: Windows&lt;br /&gt;Editor: emacs&lt;br /&gt;IDE: BloodShed Dev-C++&lt;br /&gt;Languages: C/C++&lt;br /&gt;&lt;br /&gt;If I want to awe myself out of boredom, I write some useless software in Windows. Writing C++ software in Windows is really a headache but thanks to MSDN library and intellisense, it helps to ease out some pain. Lately, I've been horsing around with DirectX 9 SDK.&lt;br /&gt;&lt;br /&gt;There we go. I should have added Microsoft Visual Studio but I can't afford it. Microsoft does release free editions called "Express" editions but MS Visual C++ Express can't even compile a simple Win32 "Hello World!" program for it doesn't include the necessary libraries.&lt;br /&gt;&lt;br /&gt;I have a lot of plans for this blog. Namely introducing the Python language. It irks me to find that there is not much python job offerings in Philippines even knowing how wonderful it is. A more advanced Python tutorial (Writing C extensions in Python) will follow given time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-1419544525221182813?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/1419544525221182813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=1419544525221182813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1419544525221182813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1419544525221182813'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/tools-of-trade.html' title='Tools of Trade'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3784103612956882578.post-1461897034951242300</id><published>2008-04-12T22:15:00.000-07:00</published><updated>2008-04-12T23:50:41.883-07:00</updated><title type='text'>Why Playground?</title><content type='html'>All right this is my first time writing an online blog. Since I don't have any resources to have my own dedicated web server, I resorted to blogging for the meantime.&lt;br /&gt;&lt;br /&gt;I have a lot of hobbies specially dreaming of things to make while staring blankly on a car's window during commutes. Most of the time they eventually get written in code - Source Code under the directory "Playground".&lt;br /&gt;&lt;br /&gt;From here I'll be posting my ideas, code, and literature in hope to make the world a better place. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3784103612956882578-1461897034951242300?l=alvinatorsplayground.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinatorsplayground.blogspot.com/feeds/1461897034951242300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3784103612956882578&amp;postID=1461897034951242300' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1461897034951242300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3784103612956882578/posts/default/1461897034951242300'/><link rel='alternate' type='text/html' href='http://alvinatorsplayground.blogspot.com/2008/04/why-playground.html' title='Why Playground?'/><author><name>Alvinator</name><uri>http://www.blogger.com/profile/13365271840066599550</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_DK22XhIO1L4/TKOQAwmXdhI/AAAAAAAAAJo/hbeOBootnb0/S220/avatar.jpg'/></author><thr:total>2</thr:total></entry></feed>
