Wednesday, 28 October 2009

Hubbly Bubbly in the Skye!

The first paragraph is not in any way interesting or relevant, so please people just skip it.
So, i have four email addresses, my usual hotmail, my uni email and two other emails that i had created for trolling purposes. All accounts (except the uni account) share the same password because it is much easier to manage them that way. Clearly. The password i has, happened to be shorter than 8 characters, which is not acceptable for google accounts. Googley accounts need FORTIS!!! passwords, which consist at least of 8 characters. So basically i had to come up with a new password (which i forgot. Instantly.) just for this blog. I used one of the old email-addresses though, and i had forgotten which one i had used. So i had to try all my accounts with different 8-char passwords, till i gave up and tried hitting this "forgot your password?" link. It actually werx *thumbs up* and now i can be bloggingz agenz! woohoo! Actually i dont really want to anymore because this whole fuss (yes it was a fuss) made me loose my blogging appetite.. but uh... i has to. If you really read up to here, then i am sorry but that is your fault, i told you to skip this paragraph. I'll even make that bold now, so that no one can complain! Bolded up!

I know i should have updated my blog with this post like over 9000 days ago, but there was not really much time, and i doubt, that i have time now, but c'mon... blogging is fun. So, last week's assignment or mini-project was about processing.js, which is actually a very nice language, tool, ... whatever you want to call it. I am impressed, that you can create such cool interactive graphic windows using javascript (although it's not really javascript, but it's still cool though).

The application we (Ahmed-Yasser Fadl, Shehab El-Noury and me) did was displaying all the blogs as floating circles in a window. We gave it the name "Blogs on Blobs". The whole application was based on the mouse following window, that you all probably already know from the processingjs website, and we added a simple collision detection method also taken from the examples on the website.

More about the application:

There are as many bubbles or blobs as there are blogs, which is 29 in our case, i guess, the part about how to parse the names and links to the blogs should be found on Ahmed-Yasser's blog. since he did that part.
All blobs have labels on them. The blobs move randomly through space trying to avoid colliding with each other. The user can drag a random blob and move it around in space or can click it to be redirected to the blog of the corresponding blob.

In our code we defined a structure for a bubble which had the variables
int x and y - the current x and y coordinates
int nx and ny - the new x and y coordinates
float radius - radius of the bubble (depends on the length of the text displayed on the bubble)
String text - the text (or label) displayed on the bubble
int delay - the movement speed of the bubble (the higher the slower)
String link - the link to which the page is redirected when this bubble is clicked

Troublez wiz Bubblez:

The only problem - worth mentioning - we had was when putting the code together (using s.th. like Bespin would have been useful for that project, only Bespin does not work *smiley face*).

Ahmed-Yasser was responsible for parsing the links and the texts for the bubblez from the .xml file.
Shehab was responsible for displaying the text on the bubblez (and changing their position with the bubble).
I was responsible for dragging the blobs and the random movement of the bubblez when not being dragged.
Any other tasks not mentioned here were done together in a way, that no one could be considered the contributor for them (pure team werx!).

So, the problem i had to deal with was getting the text to work with the xml parsing. Our last step was putting the text on the bubblez and for some reason that did not work as expected. Although the problems we had, were pure n00b problems (mainly coming from skitz) they are worth being mentioned here.

1. In the method parsing the names and links for the bubbles, the text was stored in a "bubblez[i].title" variable (bubblez is an array of Bubble containing all bubblez) , which clearly does not exist and should be replaced by bubblez[i].text. One word about that: "N00B!"

2. In that very same function there was a variable "text" which somehow was recognized as a function (since a function text() exists) but with no valid arguments, since it was used as a variable. So this variable had to be changed to any other random name (e.g. "t"). And that made it all work.

Parsing Names/Links, Moving/Draggable Bubblez, Text/Links.

I think this must be the most boring post EVAR!!!1!!eleven!!!

Saturday, 24 October 2009

LINUX IS TEH OWNZ!!!

FIRST.. DEACTIVATE CR00Z QUONTROL.

Ok... so, we are working on the application for "processing.js". I am working on ubutnu and my very nice friend shehab is working on windows 7. We all know - as the computer scientists we are - that Linux OWNS all!

First thing, uh... originally i wanted to call this post "How to crash Ubuntu in 2 easy steps" but now i have something to add, and i'm not going to post two separate posts about the same thing, kind of.
Let's start with how to crash Ubuntu in 2 easy steps:
  1. press the "fn" key on your laptop - function key
  2. press left - to increase the brightness of the screen.
FREEZE!

Why? Because Linux is cool and rolls like that!

Another cool way to crash Ubuntu in 2 easy steps - although this one does not really work 100%.

  1. In mozilla firefox press "ctrl"
  2. next, press "t" - which opens and new tab... and crashes ubuntu sometimes. xD
Now, to the processing.js related linux stuff:
I had a VERY basic file, where i was trying to display some text in a window. But it just did not work. So i sent the code to shehab (Windows 7 FTW) to tell me what's wrong with the code. And you know what was wrong? Ubuntu. Code runs on windows 7 like *thumbs up* .. no make that *TWO thumbs up* and ... well doesnt really run that nicely on ubuntu. Say, does not run at all.

Now people could tell me, that it's not working because i had to h4x0r my way into ubuntu to make it work. But on windows i didnt have to h4x0r my way through anything. It just worx. Now i am on windows um... it's something unknown actually called "windows vortex" i like to call it "windows hello evandro" ;) it's a new breed (windows XP 3ala windows vista). Does not really matter what windows it is. The code works. :)

Windows for the win??

NOOOO!!!!

LINUX!!! LINUX!!! c'mon people.. we are computer scientist, if we are not the ones to use Linux, then who will?

I wish i had a camera so i could take a photo of myself giving Linux 4 thumbs up. But i guess i cant.

Monday, 19 October 2009

Ubiquity tips for the total n00b

Last week in the osc-class we started using ubiquity. So, yes! i iz teh total n00b! Personally, i would be VERY pleased if i would have found like steps or easy tips to guide the TN0 through ubiquity (I decided, that this is the abreviation of total n00b, could have been TN only but TN0 looks WAAAAY cooler, gives it a whole new cs feel).

I am not really equipped enough to guide TN0s through ubiquity since I am still a TN0, maybe an advanced one, but still. So, I think an easy way of doing this is for all to contribute.


CONTRIBUTE!! CONTRIBUTE!! CONTRIBUTE!!


The idea is, whenever you discover something in ubiquity (of course this could apply to any other program, but I’m still on ubiquity so, …), where you say “WOAH! How could I be such a TN0!!” just post it on your blog or we could have a wiki for it or wateva. The idea is TN0s would like it. I am pretty sure they would.

Remember, this is not about explaining the whole concept of ubiquity, it’s just explaining some simple functions a TN0 might not know.Of course there could be complicated stuff in it. But i would prefer starting with the simplest most basic things.

Initially, I wanted to call this post something like “10 hints for the ubiquity n00b” but since I am a n00b myself I don’t think I would be able to get 10 on my own, so, again.


CONTRIBUTE!! CONTRIBUTE!! CONTRIBUTE!!


My contribution to this could be simple commands such as:

- Utils.focusUrlInBrowser(“enter Url here”) and Utils.openUrlInBrowser(“enter Url here”): opens the url inserted between the double quotations.

- displayMessage(“enter msg here”): displays the inserted message as a mozilla firefox notification.

- CmdUtils.CreateCommand({…}): enables the developer to create a new command. The three dots represent what you actually write in the command. A command could be used to do almost anything. For more information just ask google.

- Adding arguments to your command: you can add arguments to your command to create dynamic commands, instead of having a command execute the same thing over and over again without taking any input from the user/developer. To add an argument you write “arguments: “ just like how you add name/s to the command, and then you enter the arguments you want.

As an example:

Arguments: [{role: “o_hai”, nountype: noun_arb_text}],

This creates an argument for the command with the identification “o_hai”, the type of this argument is noun_arb_text, which means that it is just arbitraty text. Of course those two can be changed.

To access this argument write:

arguments.o_hai.text or arguments.o_hai.html,

depending on what you want to do.


You might be wondering “why is this useful to me, how can I benefit from this?”. Well, you cant. You can only add something. For the TN0. C’mon people.



Do it for the n00bs! n00bs needz halpz! too you know.




by the way. mina metias is a n00b. :)

TO DO!

Since we all know that open source is all about "scratching ones personal itch" i thought i would start with that. I remember having had troubles with viewing the TO DO - list of the course. Even though finding the to do list is much easier than how it was in the first week, it would still be easier, if there was a ubiquity command that instantly - well.. not really instantly, but much faster than having to click your way through the wiki - sends you to the chosen to do list.

So, the only problem with that is, that the URLs to the TO DOs aren't really following a certain structure, which would make it easier for the developer. In other words as a developer you can't have a generic function that gives you the desired URL depending on a digit you enter (1 for the first week, 2 for the second, ... and so on). It all has to be written manually, which is still no problem, since we won't have more than 10 weeks, i guess. But still, i remember something being said about laziness in the CAB document - which i by the way did not find very impressive, but as a computer science student i think i have to worship it, just like ze germenz HAVE to hate Hitler, which is not the point by the way, but it just crossed my mind. Isnt that what blogging is all about? Rite?

To the command: you basically type the command with a number representing the week you want and VOILA! it send you directly to the desired TO DO page. Not very complicated, but useful. To me at least.

This is the code:

CmdUtils.CreateCommand({
names: ["g-osc-todo", "todo"],
author: { name: "Majid Serag El-Din", email: "majid.serag@gmail.com"},
description: "Sends you to the desired to do list.",
arguments: [{role: "number", nountype: noun_arb_text}],
preview: "Can haz give todo list??? kthx.",
execute: function do(arguments)
{
if(arguments.number.text == "1")
Utils.focusUrlInBrowser("http://se.bigbuddysociety.net/wiki/index.php?title=Introductory_Meeting#To_Do_List");
else
if(arguments.number.text == "2")
Utils.focusUrlInBrowser("http://se.bigbuddysociety.net/wiki/index.php?title=Second_Meeting_-_Revision_Control#To_Do_List");
else
if(arguments.number.text == "3")
Utils.focusUrlInBrowser("http://se.bigbuddysociety.net/wiki/index.php?title=Build_Automation#To_Do_List");

(this is not part of the code, but adding a new if-else for a new week could be done here!)

else
Utils.focusUrlInBrowser("http://se.bigbuddysociety.net/wiki/index.php?title=To-Do");
}
})

Of course the if-else region looks a bit fuzzy. I tried searching for a "switch" function instead of the ifs and i succeeded. not. The bad thing about this code is, that whenever there is a new to do week the URL to this page has to be if-elsed with a new number (the number of the current week), which is not really hard to do, it is just inserted in the area shown in the code above.

I would like to thank mkhouly (and his very nice friend omar roushdy) since i got the "Utils.focusUrlInBrowser" off of his blog. On his blog you will find special thanks to abdallah el guindy (or gindy) since he got it off his blog. So, i guess we'll thank abdallah here again, although i don't really get the difference between both: "Utils.focus - " and "Utils.openUrlInBrowser", so if someone could explain the difference it would be imba.

According to this link: http://ubiquity.mozilla.com/trac/ticket/230 "Utils.openUrlInBrowser" opens all URLs in the same tab. So if we replace all "Utils.focusUrlInBrowser"s by "Utils.open..." it should open them all in the same tab, which would not be bad, actually. If it would work.

Difference between open and focus. Anyone?

Two thumbs up.

Sunday, 18 October 2009

Blogging is imba!

So, let's start blogging.
This is me; just majik.