mapleman's restroom graffiti
Fri, 10 Nov 2006
Amazon Web Services

Been very busy lately, going back to school to finally get my bachelors. Lately I have been playing with Amazon Web Services so I decided to add a list of my programming and personal books to the personal menu using the awesome AWS platform. I am only touching the tip of it obviously. Too much Web 2.0 hype lately, bring back the telnet days please =P

posted at: 23:17 | path: /

Tue, 18 Apr 2006
Just another day.

Working on RaidAlert which is a project that was customly ordered designed for my former boss. It is a systray Win32 application that connects to a web page using XML-RPC and checks for events issued by the web page administrator. And allows you to register or not to those events. Ironically this project is designed for a World of Warcraft clan. To the client what he wants right?

Been playing EVE Online a little bit. It is a great MMO that doesn't require as much attention as any other I have played and still allows you to advance. I use it as my Solitaire, just to relax between coding thoughts.

Following the elections in my country. I hope we beat Mr. Hugo Chavez's clone on the polls next July. Great blog about the current political situation in my country México en Peligro

I hope he gets squashed baaad in the polls otherwise I will have to run around like chicken little looking for an H1-B or an L1 *shivers*

Oh I finally updated the links on the projects in the page except mapleBlog which I can't find the original WAR file since the old site that hosted it shut down. *sobs*

posted at: 04:57 | path: /

Some code dare I just found. Simple matching algorithms. I love going nuts with pointers in C :^)

uncommon.c

#include <stdio.h>


int main( int argc , char ** argv , char ** env ) 
{
	if (argc != 3)
        {		
		fprintf(stdout, "Usage: %s <palabraX> <palabraY>\n\r", argv[0]);
		return -1;
	}

        /* find out the size for the registry */
	char * registry = NULL;
	registry = (char*)malloc( strlen(argv[1]) * sizeof(char) + 1);	
	memset(registry, 0, sizeof(registry) + 1);
	     
	char * wordX = argv[1], *wordY = argv[2], *startY = wordY; 

	while ( *wordX ) 
	{
		while( *wordY )
		{
			if (*wordX == *wordY)
			   break;	

			wordY++;
		}

		if (!*wordY)
		{
			char *rr = registry;
			while(*rr) rr++; 
			*rr = *wordX;	
		}

		wordY = startY;	
		wordX++;	
	}        	 

	fprintf(stdout, "output: %s\n\r", registry); 
	
	free(registry);
	return 0;
}

common.c

#include <stdio.h>


int main( int argc , char ** argv , char ** env ) 
{
	if (argc != 3)
        {		
		fprintf(stdout, "Usage: %s <palabraX> <palabraY>\n\r", argv[0]);
		return -1;
	}

        /* find out the size for the registry */
	char * registry = NULL;

	registry = (char*)malloc( strlen(argv[1]) * sizeof(char) + 1);	
	memset(registry, 0, sizeof(registry) + 1);
	     
	char * wordX = argv[1], *wordY = argv[2], *startY = wordY;

	while ( *wordX ) 
	{
	
		while (*wordY)
		{	
			if (*wordX == *wordY)
			{
				char * rr = registry; 
				
				while( *rr )
				{
					if (*rr == *wordY)
						break;
					++rr;
				}

			
				if (!*rr)
				{
				    *rr = *wordY; 
				    break;
				}
				wordY++;	
			} 
		        else		
			     wordY++; 
		}	 

		wordX++; 
		wordY = startY; 
	}        	 


	fprintf(stdout, "registry: %s\n\r", registry); 
	free(registry);

	return 0;
}

posted at: 04:57 | path: /

Thu, 18 Aug 2005
mapleman's Java Proxy

Lately I been messing with Medved QuoteTracker's API. It is an XML through TCP protocol. Medved only allows you to interact with its API from localhost. Unfortunately the PC that hosts the executable is not, well, mine. So I decided to rewrite my Java Proxy and make it extremely easy for anyone (the ones that use that particular PC) to run it without a hitch.

So obviously I had to write it with GUI. And well, it all went well, I think, and now its ready to battle the streaming protocols and beyond :)

mapleJProxy in action

Naturally the console based one is still included.

Ant Buildable source: mapleJProxy.jar

posted at: 09:42 | path: /java

Tue, 16 Aug 2005
Free Microsoft SQL Server 2005 Express Edition

Get your free Microsoft SQL Server while its hot!. Another alternative for small websites.

SQL Server Express is an ideal choice for independent software vendors (ISVs), server users, non-professional developers, Web application developers, Web site hosters, and hobbyists building client applications."

URL: Microsoft SQL Server Express 2005

posted at: 00:38 | path: /windows

Mon, 15 Aug 2005
Asynchronous Javascript and XML (AJAX)

The Buzzword of the year. It seems to be on everyone's mouth. Specially since GMail and other Google services started using it. So I jumped on the bandwagon, and wrote my menus using this technique. Totally unnecesary? Definitely. Entertaining? You bet. It turns the dullness of writing webpages into something interesting.

So how does it work? As you connect to the website, an XML Http Request is sent from your browser into a Python cgi. That Python CGI reads the variables and pulls the database table that match the parameters. It then proceeds to generate an XML that ultimately your browser (and the Javascript) parses and feeds to the DOM.

Source: toilet.js

posted at: 20:23 | path: /web

Sat, 13 Aug 2005
Javascript Closures

Closures are one of the most fascinating constructs ever IMHO. Not many people know about their existence, let alone in Javascript. However the knowledge of them can seriously leverage your designs.

So what is a closure? A function that keeps an environment. The best way to explain a closure is with an example, so thats what I will show you.

var globalVariable = 20;

function createClosure(arg)
{
   var env = 10;
   return function(x) { alert ( arg + env + x ); }
}

// main body
ourClosure = createClosure(globalVariable);
globalVariable = 0;
ourClosure(30);          // prints 60
alert(globalVariable); // prints 0 

ourClosure() will return 60 even though we have just set the value of the globalVariable to 0. That is, it keeps the values defined when the closure was created.

alert(globalVariable) will output 0, the current value of globalVariable.

IUnknown

posted at: 03:21 | path: /web

Audio Player DLL

Well this project involves a lot of things that definitely are entertaining. It started as a Audio Playing DLL. Vague? You bet. Anyway, this DLL is nothing more than an MP3 player or was. I started writing and got more excited everytime and eventually I decided to make it compatible with XPCOM, and use it to play audio through mozilla. I actually wrote that piece of code and its stashed somewhere!

Anyway, it was becoming more like a kludge than a library. So I decided to rewrite it entirely. I separated the code a lot in order for it to become sort of modular. Now you can actually play OGG's aswell. Can add any other type of sound aslong as you rewrite the 5 routines required.
Here is how it currently works:

#include "AudioDecoderEngine.h"
#include "MP3Library.h"
#include <windows.h>
#include <stdio.h>
#include <time.h> /* This callback only works on MP3s */ void callback(void * data, status ourStatus, void * user_data) { pfData ourData = (pfData)data; pmp3data innerData = (pmp3data)ourData->extraFileData; static int calls = 0; if (calls++ < 1 && ourStatus != STATUS_CLOSING) fprintf(stdout, "Layer[%s] Mode[%s] Emphasis[%s]\n\r", MP3Layer[innerData->layer], MP3Mode[innerData->mode], MP3Emphasis[innerData->emphasis]); switch(ourStatus) { case STATUS_CLOSING: break; case STATUS_OPENING: break; case STATUS_PLAYING: fprintf(stdout,"%d%%\r", (ourData->currentFrame*100) / ourData->totalFrames ); break; case STATUS_DONE: fprintf(stdout, "done playing\n\r"); calls = 0; break; } } int main(int argc, char **argv) { PAudioLib audio =
     AUDIO_INIT("D:\\Dream Theater - Another Day.mp3", NULL, callback) int i; AUDIO_LOAD(audio) AUDIO_PLAY(audio, 0) while(audio->playing) { Sleep(2000); } AUDIO_STOP(audio) AUDIO_CLOSE(audio) return 0; }

I am still working on it. I assume its thread safe but I really haven't checked that thoroughly. Feel free to download and try it out.

IUnknown

posted at: 03:17 | path: /windows

Thu, 11 Aug 2005
New Books

I recently bought a few books. One of them is Essential COM by Don Box. I can only be in awe, what a fantastic book. COM is the component object model and is a way to enhance Object Oriented programming through the use of interfaces. It is similar to Java's implements keyword in that sense. However, describing what COM exactly is would require a few hundred of pages.

Another book that recently arrived is COM and .NET interoperability by Andrew Troelsen. I figure, I love COM and if I can combine it with .NET, even better. The simplicity of winforms intertwined with the power of COM. Andrew Trolsen's style of writing is very comprehensive and to the point, with good practical examples. This is the second book I get written by him, the other I've got is COM & ATL 3.0. That one is the book that introduced me to COM. The book is available online for free if you prefer to read in electronic form (I don't). Get it from The Server Side .NET.

Finally I ordered Petzold's (Windows SDK canon text) off Amazon. I figure I could leverage my complete windows understanding. I should've read this book a long time ago.

Yes. I do love Amazon.

IUnknown

posted at: 01:30 | path: /

Wed, 10 Aug 2005
Blog

I guess I finally (reluctantly) got myself into writing my own blog. I'm not particularly a fan of web development which was one of the main reasons to put this off. Besides having http://www.resynthesize.com/code I felt pretty much covered web wise. But that site is definately outdated. So I decided to put up a blog; In python. Anything BUT PHP works, right? :D

posted at: 22:17 | path: /