Sunday, October 25, 2009

About JSON, Bespin, Prosessing.js and other stuff ... !!!

I love this feeling :D ... the feeling of achievement ...

I have just (almost) finished an assignment in one of my cources ...

The assignment was pretty simple yet (somehow) challenging ... We were required to use the mediaWiki API to get some information about our wiki, and then visualize this information using the Processing.js language ... Oh and it was recommended to use Bespin as the editor, as it is a group project, and Bespin (supposedly) inhances collaboration ... We chose to show a graph of user versus number of contributions ...

A few things to say here ... I have used JavaScript before, but not for a long time ... just enough to know that its a nightmare!!!

I also haven't written JS for a long time, so, being the energetic person that I am (!!), I fired bespin, and started coding ...

First thing I did was to use jQuery, and instantly started trying to send a GET request to the server following the mediaWiki API ... Those of you who know JavaScript and know me can guess that I kept trying for the following 2 hrs :s ... I just thought I was doing something wrong ...

Two hrs later I remembered vaguely hearing something about "cross browser AJAX calls" ... and that "something" was more or less that they didn't work ... So I just Googled "MediaWiki API JavaScript" ... The one of the first results luckily had a JavaScript wrapper library. I honestly dont know what it is, just that it has something to do with JSON ... will put researching that on my todo list.

With the wrapper available, me and my team were able to play around and try different things. We were finally able to find a call that given a list of users, will return the number of edits ... That means we could do the whole thing in 2 calls!! One to get the names of the users, and one to get all their contributions ...

Now a few experiences with Bespin ... I like the idea :D ... Its simple and fast for sharing small stuff ... but you can expect an alpha to be like it is ... one of the most frustrating moments was when one of my friends started working on the file, right after I shared with him, and everything I wrote disappeared!! That happened twice actually but we learned to take local copies :) ...

Now for Processing.js ... I knew it was a language which you can write fancy animation stuff in ... I had a simple problem though ... I did know how to make the code work in the browser :s ... I expected from the ".js" part that there will be JavaScript. I went to their website and their was LOADS of examples ... in Processing ... I was one step behind ... I needed to know how I can get these codes to run!!! I started thinking maybe its like GWT; it is a language that "compiles" to JavaScript ...

Needless to say I spent sometime wondering ... I finally chose a webpage with a simple example and viewed the source ... Fair enough the guy was using a "processing.js" file ... He was then, in the JavaScript, calling "Processing(canvas, code)" where "canvas" is the canvas tag where the animation is to be rendered in, and "code" is the actual processing code. Finding that was a relief :D ... We could finally start experimenting with it ...

So now we could draw fancy stuff ... what next? Well, we did make our calls using JavaScript, and now we want to draw using Processing ... The first naive idea was to create a variable in the JavaScript code and try to access it in the Processing code ... It worked!!! We could even call JavaScript functions from in here!!!

I must say we did very little with processing, but from what we saw, it is beautiful ... I later found this page, which could have saved me alot, as it takes you from a zero-knowledge-of-processing level into a can-make-graphs-and-charts level ... Its tailored for our task :P ...

So now we are in this stage: we can make API calls, get the data, "see" it in the Processing code, and can draw lines and rectangles in processing ... I have a feeling the rest will be easy :) ...

I think I may talk more about Processing in a future post, but for now, I need to go help my team mates get this thing done.

Wednesday, October 7, 2009

3D Cities

A while ago I read about these guys who were able to write a very clever program that can regenerate a 3D model of a whole city from its photos on the web ...

The idea is that this program will go into a website like Flickr, download all the images tagged by the city name, and then attempt to deduce how the city looks like exactly, where each photo was taken, and rebuild the city in 3D!! The great thing about this is: a city can be built in one day, as the algorithm utilizes the power of parallel computing ...

When I first read this, I couldn't help but think about Google Earth. Google has attempted to introduce 3D into its Earth before. They have created sketchup, and wanted to utilize the community to create models building and monuments. You might also remember when Google modeled almost every building in Manhattan Island. The problem with this is that it has that human factor; building models are not always good, and are sometimes misplaced (I have seen a couple floating in the air).

This new technology promises to remove that human factor, but its currently limited to cities that have photographs covering the entire city (the reason why Rome and Venice where chosen). However, think of what the technology can do with the data from something like Google street view. This data is interesting because, not only it has excellent coverage, but also the exact location and direction of each photo is known.

Its thus good to see that Google was one of the supporters of this project :) ...

P.S.: I knew about this from: slashdot

Monday, October 5, 2009

Hello :)

Hello :) ...

My name is Abdurrahman, I am a computer science student at the German University in Cairo ...

I have reserved the name of this blog for quite a time now but haven't had the guts to post anything ...

i dont think I would have ever thought of actually starting to blog, for you see, I am one of those people who fear to be viewed as idiots!!

The reason I have changed my mind is because I took an elective at my university this year, and one of the requirements is to have a blog :P

So here I am, finally, forced to do what I have always wanted to do, which may be a good thing. This blog is meant to be a technical one; almost all topics here will be related to technology, hardware, software (especially open source ones), and a lot more ...

Finally the name!! The blog is called "A to the 5", and the reason is that my first 5 initials are all the letter 'A'!!! My full name is "Abdurrahman Ahmed AbdulMoneim Ahmed Aly".

Hope you will have as much fun reading my posts as I will have writing them :) ...