Social Website Fail - A Look At Yahoo! Answers

Posted in Misc on March 1st, 2010 by helloworlder – Be the first to comment

Anyone who has ever used the programming Q&A site Stack Overflow knows that it has an extremely low noise to information ratio, resulting in extremely high quality answers most of the time. I think part of the reason is that the community rewards users based on high quality answers, not simply the quantity of answers, although that matters too of course. Furthermore, at Stack Overflow you can lose points for crappy questions and crappy answers. And when your question gets deleted for some reason, you will be told why. However, it depends on users being mature and reasonable about voting answers up or down, and no one is mature and reasonable 100% of the time.  But over all, it works very well.

So it comes as a shock that Yahoo! Answers rewards very low quality answers. A massive problem is that you get points simply by answering questions! So it’s not surprising then that some people answer with just 1 word, or with some answer that has absolutely nothing to do with your question. Basically, you can level up purely based on the quantity of your answers and not on the quality. You can just sit there typing rubbish answers all day. Someone can become a “Top Contributer” with only a tiny % of their answers being chosen as “Best Answer”, as long as they post a massive quantity of answers. Another problem is that when Yahoo! Answers deletes questions, they don’t give you a reason, which really is just rude, lazy or both. Yahoo! Answers also seems to remove questions arbitrarily. I made a policy mistake by posting a question in German asking for a German equivalent of an English phrase (I speak enough German to have asked the question in German).  I did this because in the past when I asked in English I’d get huge spam from non-German speakers using an electronic translator! W..T…? Anyway my question got deleted presumably because half of it was in German, which is fine because it’s against policy. But this begs the question - why aren’t the thousands of other plain offensive/nonsense/in the completely wrong category questions removed as well? Like I said, arbitrary.

Yahoo! Answers has expressed desire to improve its quality for a long time now but it hasn’t happened. It would be good if they take some lesson from Stack Overflow and apply it there, but not entirely because simply applying a new system to a completely different audience won’t work. I guess it would be as fruitless as trying to apply the blueprint of Western democracy to a non-democratic country. But try to do something to start rewarding people who put time and effort for free into their answers rather than simply allowing progression based on quantity, and start deleting poor questions and spam answers … in a non-arbitrary way :-)

End Rant.

The Ongoing Role Of Flash On The Internet

Posted in Actionscript 3.0 on March 1st, 2010 by helloworlder – Be the first to comment

Flash already has an important role on the Internet when it comes to general interactive applications,  games and video.

Then there’s HTML5, which is supposedly going to replace many instances where Flash would otherwise be used. YouTube has been experimenting with using HTML5 instead of Flash. However, there is not yet any reason to believe that HTML5 and AJAX technologies will become a significant threat to Flash. The fact that HTML5 is an open standard doesn’t automatically put a halo on its head and a path to RIA domination, even though that may happen in the future.

Then there’s the ongoing Flash accessibility issue. Sure, Adobe has its fair share of problems and yes they still have, but they are concerned about accessibility and have been making improvements over time. For example, can screen readers read SWFs? Yes, they can. In fact, to provide accessibility developers can even provided built in readers and voice overs recorded by real people. Can users tab through components? Yes. The problem is becoming less of an issue of Flash itself than an issue of inaccessible design by developers. Remember, you can write inaccessible AJAX too.

The more relevant question regarding accessibility is now becoming  “Can Adobe provide developers with easier ways to implement accessibility?” instead of “Is Flash accessible?” Flash today isn’t the same as Flash 10 years ago, and I’ll bet you Flash in 10 years won’t be the same as Flash today.

Finally, while the Flash Platform is not open source, the SWF file format specification is open and free of charge to anyone. Yes, that includes you Apple!

I might be wrong, but I think Flash is not only here to stay, but we’ll see more diverse applications of it in the future. But I’m not betting on this one :-) The thing is, don’t dismiss the technology.

http://www.adobe.com/accessibility/

Why Do Package Names Start With com. In Actionscript 3?

Posted in Actionscript 3.0 on February 16th, 2010 by helloworlder – Be the first to comment

Question:

Why do package names start with com. in Actionscript 3?

By the way, I’m guessing you already know that package names map to folder names. E.g. an as3 source file in the package com.example must be under the folder example, which in turn must be under the folder com..

Answer:

Package names do not have to begin with com. However, it is the convention to do so. E.g. com.thebestcompany.thebestproduct

What is the significance of com? Well, the package name is simply a domain name reversed. E.g com.helloworlder.utils

The domain name technically does not have to exist but you should own it. Obviously never use someone else’s domain name!! That’s just rude. It is standard practice to use a domain name because it helps to guarantee that your package names don’t collide with the names of someone else’s package on the other side of the world.

If I release some AS3 code that creates popup windows, I may place the code in a package called com.helloworlder.utils.popupwindow and not simply popupwindow

Likewise, if I download some third party code to use in my own project I’d expect their code to be packaged properly. E.g. com.goodbyeworld.utils.modalwindow. Then, I can just place their goodbyeworld folder under by own com folder.

Just as importantly, putting your as3 files into packages helps you think about how to organize the files. Often people place all files (their own and 3rd party code) under one folder! The advice is - don’t.


Unit Testing AS3 Code on the Flash CS4 Platform

Posted in Actionscript 3.0 on February 15th, 2010 by helloworlder – Be the first to comment

I’m developing a project on the Flash CS4 platform and finally started unit testing my AS3 code.  Not doing unit tests seems lazy and negligent. The only reliable unit testing framework I’ve found so far is asunit, which is open source. The Flash CS4 platform has been traditionally targeted at designers and not programmers so unit testing was somewhat neglected in the past.

Installation is very simple. Just unzip the archive and place the as3 folder anywhere on your system. Then in Flash CS4 go to Edit->Preferences and click on the button “Actionscript 3.0 Settings” at the bottom of the popup.  You need to add both of the following paths under “Source path”:

as3/src/

as3/test/

IMPORTANT: Don’t just add as3/ otherwise the framework files won’t be found.

That’s all for the installation. For usage, the asunit website has enough information to get you started.

So I’m a Freelance Web Developer Now! Pros and Cons?

Posted in Misc on February 12th, 2010 by helloworlder – Be the first to comment

It kind of feels weird that I now consider myself a freelancer as I’ve never had a “real” 9-5 job before. So, my first job out of university is a freelance web developer (programmer + graphic designer).

I don’t know whether I’ll regret the decision to snub the 9-5 lifestyle in the future. I’ll be missing out on things like working in a team (which is an important skill and which I value) and a stable flow of money and being supported by co-workers are nice things. But equally important is learning how to function independently and communicating directly with clients. Another perk about freelancing is that you get experience in managing your own business (because that’s exactly what you are doing, starting a business).

Often in the corporate world there’s this almost dogmatic mantra something along the lines of “lone wolf evil, team player good.” Yes, that’s absolutely true when you are working in the corporate world, because it’s the nature of the environment to work in packs otherwise companies can’t survive (duh)! But remember there is a market for small-medium websites and software that individual freelancers (or pairs developers) can do professionally and timely, where hiring web/software firms would be an overkill. There is absolutely nothing “bad” in any sense of the word about choosing to be a “lone wolf” as opposed to working in a team, just as there isn’t anything wrong with participating in the so called “rat race”. Some people are more individualistic in nature - there’s nothing wrong with that. By the way I don’t understand how some people can confuse valuing individualism with being selfish or having an inability to work as a team.

Another perk you often get in the corporate world is free training (although I’d really, really try to avoid sheep dip training). On the other hand if you’re freelancing you can learn what you want, when you want - but you do have to motivate yourself to do it.

There is one last important thing about working in the corporate world - you get to work with large systems. Reading other people’s code and getting to know big systems is a great learning opportunity. As a freelancer you won’t have as many opportunities to work  with large systems, although there are online communities like SourceForge where you can build on large projects.

I’ve never held a 9-5 job before, but I’m pretty sure that freelancing is a lot harder at least financially. If you’re looking for “team spirit” and stability then you probably want a corporate job. On the other hand if you’re feeling brave, have the spirit for adventure and more control over your work then freelancing might be for you.

Anyway, my plan for Monday morning? Probably watch a movie with a friend.

Terrible Usability on Government Site

Posted in Misc on December 18th, 2009 by helloworlder – Be the first to comment

I just tried to apply for an ABN (Australian Business Number), so I had to visit (shudder) a government site. Why is it that government websites are often the most unusable on the Internet?

The site does not support Firefox. Huh?! Apparently the site also implies that it does not support Windows Vista and Windows 7, the latest supported OS being Windows XP. Right. Browsers that work with the site are IE and Netscape Navigator.

The last time I tried to use a government site was when I was going overseas and wanted to apply with Smart Traveller, which is a government office that takes care of Australian overseas during emergencies. Maybe it’s just that I’m stupid, or that the form was completely unusable. Now this.

Anyway, I fired up IE and managed to get the site working. Here are some screen shots highlighting some problems with the site.

screenshot of website 1

screenshot 1

screenshot 2

screenshot 2

screenshot 3

screenshot 3

Javascript Tutorial - Digg Style Selectors

Posted in javascript, tutorials on December 5th, 2009 by helloworlder – 5 Comments

If you’ve posted stories to Digg before then you’re familiar with the “Choose a Topic” form. This form allows you to select which category your Digg submission belong and then lets you submit the form, all without using radio buttons. This tutorial tells you how to achieve the same effect. But I warn you that this Javascript code will not be degradable. If it’s any consolation, if you disable JS on the Digg website their form will also not work. I’m not trying to encourage obtrusive Javascript, but this is a tutorial and not production code. If you want you can build on the code to make it non-obstrusive.

digg_selection

Digg’s Choose a Topic form

digg_style_select

Our version of it (it’s better isn’t it?)

First, create a new HTML file with the following code, and call it anything you like:

<html>
<body>
<head>
<title> Digg Style Selectors </title>
<script language="JavaScript" type="text/javascript" src="digg_selector.js"></script>
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
</head>

<h1> Digg Style Selectors </h1>

<hr />

<form action="CHANGE_THIS.php" method="POST">

<div id="container">

<a href="javascript://" class="digg_style_link" id="1"> Link 1 </a>
<a href="javascript://" class="digg_style_link" id="2"> Link 2 </a>
<a href="javascript://" class="digg_style_link" id="3"> Link 3 </a>
<a href="javascript://" class="digg_style_link" id="4"> Link 4 </a>

</div>

<input type="hidden" name="hidden_data" id="hidden_data" value="nothing" />
<input type="submit" value="Submit" />

</form>

</body>
</html>

To note here is the inclusion of the “digg_selector.js” file which we will look at next. Also important is the hidden field with the id of “hidden_data”. Since what we’re doing is replacing the functionality of radio buttons with nicely styled links, we need another way to get the information submitted and we do that with the hidden field. That’s where the Javascript file comes in:

window.onload=function() {
    var container = document.getElementById('container');
    var containerAnchors = container.getElementsByTagName('a'); // get anchors
    for(var j=0;j<containerAnchors.length;j++)
    {
        containerAnchors[j].onclick = handleClick;
    }
};

function handleClick()
{
    document.getElementById('hidden_data').value = this.id;

    var container = document.getElementById('container');
    var containerAnchors = container.getElementsByTagName('a');

    // unhighlight all the links
    for(var j=0;j++;containerAnchors.length;j++)
    {
        containerAnchors[j].style.backgroundColor = "#eceff6";
        containerAnchors[j].style.color = "#3b5998";
    }

    // highlight the link that was just clicked
    this.style.backgroundColor = "#3b5998";
    this.style.color = "#ffffff";
}

This is simple - there are just 2 functions. Looking at the first one:

window.onload=function() {
    var container = document.getElementById('container');
    var containerAnchors = container.getElementsByTagName('a'); // get anchors
    for(var j=0;j&lt;containerAnchors.length;j++)
    {
        containerAnchors[j].onclick = handleClick;
    }
};

When the page is loaded, we get all the anchors in the container div (these anchors are the digg style selectors/buttons or whatever you want to call them). Then, inside the for loop we attach an event handler to each anchor, which executes when the anchor is clicked. The event handler is a function called handleClick(), which we look at now:

function handleClick()
{
    document.getElementById('hidden_data').value = this.id;

    var container = document.getElementById('container');
    var containerAnchors = container.getElementsByTagName('a');

    // unhighlight all the links
    for(var j=0;j<containerAnchors.length;j++)
    {
        containerAnchors[j].style.backgroundColor = "#eceff6";
        containerAnchors[j].style.color = "#3b5998";
    }

    // highlight the link that was just clicked
    this.style.backgroundColor = "#3b5998";
    this.style.color = "#ffffff";
}

The line document.getElementById(’hidden_data’).value = this.id; gets a hold of the hidden field we talked about earlier, and dynamically sets its value to this.id . So what is this.id? Well, this refers to the anchor that gets clicked on. So this.id gets the id of the anchor. The hidden field is set, and when the form is submitted we can get the value of the hidden field in the $_POST['hidden_data'], assuming you’re using PHP.

Finally, here’s the CSS stylesheet, which needs to explanation:

body
{
font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
font-size: 15px;
}

a:link {color: #3b5998}
a:visited {color: #3b5998}
a:hover {color: #3b5998}
a:active {color: #3b5998}

h1 {
font-family: Georgia, serif;
font-style: italic;
font-size: 20px;
font-weight: bold;
}

hr {
color: #A8A8A8;
height: 1px;
}

#container {
margin:0;
margin-top: 20px;
margin-bottom: 20px;
}

.digg_style_link {
color: #3b5998;
padding: 3px;
margin: 3px;
margin-bottom: 20px;
background-color: #eceff6;
text-decoration: none;
border: 1px solid #d4dae8;
}

That’s pretty much all there is to it.

Web App #2 - Another Facebook App

Posted in php on December 3rd, 2009 by helloworlder – Be the first to comment

So, this is my 2nd Facebook book app and it’s an FBML app this time, not an iframe. You can find it at http://apps.facebook.com/makedebate . It’s called “Make Debate” and you can share your (passionate?) opinion on topics with friends and other Facebook users.

It’s more fun (and easier) to build a site using FBML rather than using an IFRAME app. You can just use FBML tags rather than lots of PHP API calls.

Web App #1 - A Facebook App

Posted in Facebook, php on November 23rd, 2009 by helloworlder – Be the first to comment

This was my first Facebook app and can be found at http://apps.facebook.com/try-to-pronounce-it

What the app does it let you upload pronunciations of phrases in a foreign language and share it with others. I think the fatal flaw of this app would have to be that users have to upload WAV files instead of any format they want. This opens up a lot of issues with usability. For example, the windows sound recorder does not by default save the recorded sounds as WAVs, and since WAVs are uncompressed they are large. In addition, streaming WAVs in the browser is awkward - whereas with MP3 files I could just use a SWF player to stream the files in a nice way.

In fact, at once point I had successfully implemented the FFmpeg library to allow the user to upload almost any file type they want, and the app would automatically convert that file to MP3. Also, since the files were all in MP3 format, I could stream it in a nice SWF player. Unfortunately I discovered that the MP3 (and other codecs) were patented and the usage of them wasn’t actually legal. Pesky software patents …

A Web App a Week Challenge

Posted in php on November 4th, 2009 by helloworlder – Be the first to comment

Now I’m back from Europe and starting to look for a job. While the job seeking is going on, I’m going to try to give myself a challenge that is to try and create one web app each week until I get a job!

The first web app should be up in a few days (err, hopefully).

EDIT: Well this is taking more than a week, but I should have my first Facebook App up within a day or two. It’s written in PHP. At first I wanted to use the Codeigniter framework but it was virtually impossible getting it to gel with Facebook so I went with straight PHP, unfortunately.


Easy AdSense by Unreal