Sunday, February 24, 2008

Facebook - your lifelong partner

Source: WikipediaI never realy knew a lot of people who were involved in social networking sites. Sure, there were few people I knew over the internet or a person here or there that I knew personally but that was about it. But when I joined the university this quickly changed and friend invitations became a daily phenomena on Facebook - as predicted by the Metcalfe's law the number of people using Facebook increased faster and faster as more people began using it and as it became a useful (or not) tool for nurturing old and new friendships.

Personally I never liked to share all the juicy details about my life or my conversations with other people - maybe some tiny paranoid bit of me was always thinking about what can happen if something goes wrong and published information end up in the wrong hands. That's probably why I hadn't joined any other social networking sites (with the notable exception of LinkedIn) before I was almost forced to.

Unfortunately it didn't took long before I started reading all kinds of horror stories about Facebook. A news that someone lost his job because he called his boss an idiot or got kicked out of school for posting pictures of drinking parties on his MySpace profile is realy becomming "business as usual". And as long as I or majority of my friends weren't using those sites the problem didn't seem important enough to bother or give it another thought - after all, everything was happening in the United States and Europe is still lagging behind in social networks usage.

Or does it?

Viadeo recently published survey data that 62 percent of British employers checked Facebook, Bebo or MySpace to see what kind of dirty things their future staff has done in the past and at least a quarter had already rejected a candidate because of their findings. With continuing trend of increased social network sites's usage the rest of Europe will probably follow - if it hasn't already.

In the end the simplest observation is to enjoy social networking sites as long as they benefit you in the collage when you still meet new people but when you grow up and get yourself a serious job the best course of action would be to just erase your Facebook/MySpace/Something profile and forget about those things you did during collage. Well, for Facebook at least, this is where things get messy. Until recently you could only "disable" your account - Facebook was hoping you would one day come back and to ease your pain you could just reactivate your account and continue where you left - which is still not good enough when you just want your account deleted, plain and simple.

Nipon Das, who faced this problem, had to start threatening with legal action against Facebook before the company got serious about it and finally deleted his account - which, acording to New York Times, still didn't prevent a reporter from sending him an email message. The deletion process did get a tiny bit better just two days after the publication of that article in NYT but a simple and obvious "Delete" button is still no where to be found.

What is then to do about your online identity? Probably the best solution is the one that was around all along and none of those involved into horror storied realy thought about - common sense. Would you show your parents how you got drunk and puked around someone's aparment? Would you want that to be seen by your boss? Probably not.

Friday, February 8, 2008

Cross-domain XMLHttpRequest

Source: WikipediaDuring my presentation @ Barcamp I was talking about Cross-site XMLHttpRequests and promised I'll write a follow-up on my presentation as well. As any web developer that didn't go to hidding before GMail came to life knows, XMLHttpRequests can be a very helpful tool for your users - sure, there are some accessibility and security issues but, providing that you use it correctly, it can be an enormous benefit to the user experiance.

One thing that plagued XMLHttpRequests (at least if you were a legit user) was same-origin policy that you had to follow. At some point, probably due to a bunch of mails, even Yahoo posted a tutorial on how to resolve this issue with a proxy. But fear no more! Firefox 3 bring us support for Cross-site XMLHttpRequests which provides us with options to control who can access our content with remote Javascript calls. W3C Access Control draft goes into very specific details on how exactly should browsers implament this feature, but I won't cover this in that much of a detail because Firefox 3 still exhibit some problems with it. However, it does bring us a nice new feature that we can play with and give it a try.

My lightning talk was just a quick introduction to this subject - due to time constrains I was also unable to show a practical example (hey, that's the whole idea of lightning talks! :) - and so will be my example which was built with Django. Basically just the code you get when you start a new project and nothing else.

On the client side (i.e. in browser) you code remains pretty much the same as it would be if you would be making same-domain request:

window.onload = function(){
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost:8001/");
xhr.onreadystatechange = function(){
if ( xhr.readyState == 4 ) {
if ( xhr.status == 200 ) {
document.body.innerHTML = "I received: " + xhr.responseText;
} else {
document.body.innerHTML = "Some error occured.";
}
}
};
xhr.send(null);
};

(Basically I just took John Resig's code for the client side, since he first publish this in the start of January.)

(Also note that
I am making calls from django instance running at port 8000 to the instance running at port 8001 - if you check Mozilla's same-origin policy you will see that different ports are also forbidden.)

Then of course comes the interesting part, the server side code - John published his blog post with PHP code, I will publish it for Django, but since it's so easy, you have to make it working in every language or framework you code/work with. :) Interesting part of course is the control of who can access your code and in what kind of way.

def foo(request):
r = HttpResponse("some content")
r["Access-Control"] = "allow <localhost:8000>"
And that's it! Yes, access control allows whole bunch of interesting features - for example, you can allow all sites [1] to access your resources (probably useful for mashups), limit your access only to specific request types [2], etc.

"allow <*>" [1]
"allow <example.com> method POST" [2]

But during my experimants I discovered that, at least for POST requests, Firefox still returned uncaught exceptions. If anyone has any ideas what went wrong, please don't hesitate to tell me in the comments or mail me so that I can publish it.

Now, if only IE would bring something equally useful...

Tuesday, February 5, 2008

Barcamp Klagenfurt 2008, #2

(As promised, I'm also adding my impressions regarding "Blogs and their connectivity network" and "BIG Weblog projects")

The "BIG Weblog projects" was a presentation on what is needed for a successful blog project and what kind of benefits that brings to your blog. The guy (I do have to apologise for not remembering his name and forgetting to take notes at the start of his presentation) has a cooking blog and decided to write 2 recipes for each game played (one from every country) for the entire duration of world football cup of 2006. I thought that searching for recipes themselfes was a trouble by itself but he decided to test every recipe as well! His entire preparatins lasted for a year and sure brought some rewards - his traffic was 100% up during the duration of football cup and remained 50% higher when the championship ended.

Source: Wikipedia
Max Kossatz had something even more interesting for me as I had already done some hacking with Google Maps. In his project he looked at how blogs are interconnected between each other - as it turns out although some blogs are heavily connected to the rest of the world, some are completly isolated (one such example are link farms) - and mashed that information with Google Maps. The result is quite impressive - I attached an image below so that you can see it for yourself.


He asked us not to run with the link to Slashdot so I won't be publishing that for now. ;-)

I also have to thank Werner for giving me a lift from pizzeria to trainstation when busses stopped to drive. Thanks! :)

Monday, February 4, 2008

Barcamp Klagenfurt 2008

As I mentioned in my introductionary post, I was getting high on Web 2.0 hype in Klagenfurt at the user-lead unconference Barcamp. When I took a train to Klagenfurt I never expected to be such a positive experience - after seeing a video from San Francisco's Barcamp (I'm including it below), I didn't realy expected that something organized almost in my neighbourhood could bring together so many interesting people with equaly interesting lectures.



The first lecture that I attended and obviously one that had some influance on me was the lecture from Monika Meurer titled "Time & ideas for blogging". Her idea of getting yourself a routine and following it as much as possible made me brave enough to start rethinking about blogging. The sheer amount of effort and work that she and her husband put into their blogs was almost jaw-dropping - it turns out that she prepars material for a month or so in advance and then uses Timestamp feature of Wordpress so that posts are evenly distributed. One could write enough posts to accommodate his holidays, use Timestamp and his readers would never even notice that he was out of town! :)

Following that I got myself some reality check with Stefan Jäger's presentation of his trip to North Korea. When you constantly annoy yourself with everyday troubles, a lecture like this does show you the other perspective of your life and how life goes on in some other, less fortunate parts of the world. When you get stripped of your mobile phone when you land at the airport you know the situation has to be bad, but then things just get worse in NK. I'm still waiting if Stefan will publish his slides on the net so that you can take a look by yourself. I know that most of it's people don't care about internet access and mobile phones due to North Korea's economic position, but it's just unbelivable to hear that goverment officals have access to both of these, while ordinary citizens have to get permits just to travel accross country.

After seeing "Blogs and their connectivity network" and "BIG Weblog Projects" (I'll write a follow up on them tomorrow), I slowly got to the part when you could see me before the board. I attended lightning talks (5 minutes, everybody, everything :)) and had a quick speech about Cross-site XMLHttpRequests. 

Me giving a speech
Me giving a speech (yes, my hair does look a bit weird :)

I'll be publishing my keynote and some code samples tomorrow or the day after it in a follow-up - I would like to do some code clean-up and make it as concise as possible. 

Here We Go (Again)

After much pressure from Jure (although I might be grateful to him someday :)) and after getting high with a bit of Web 2.0 hype at the Barcamp in Klagenfurt I had done some thinking and came to the conclusion that it's time to give blogging another go (as only I remember I did had something resembling blog in the past, but that didn't turned out very well).

Now, let's finish this introductionary post and let's get the show on the road with some thoughts about Barcamp! :)