Welcome to Alfreido's Blog, the home of Ben Thomson's random thoughts and code snippets.

Follow up - Big Brother

Thursday 14th February, 2008 at 4:00 pm

A bit of a laugh. Apparently my Big Brother: Internet Filtering is well and truly loved by someone (that someone being Google) because, as of Thursday February 14th 2008, I am:

#1 when searching ‘australian internet blacklist’ on Google
#3 when searching ‘australian government internet blacklist’ on Google
#5 when searching ‘australian government blacklist’ on Google
#16 when searching ‘australian blacklist’ on Google
#1 when searching ’shitty site’ on Google

Seems my blog’s days are numbered, I’m pretty sure the government will blacklist my site if it appears on all these search results.

[ Tags: | No comments ]

Why Google will never be defeated

Thursday 14th February, 2008 at 3:45 pm

Why google will never be defeated header

Hot of the heels of an announcement by Microsoft and its intention to bid nearly $50 billion for internet dinosaur Yahoo, it got me thinking of the shape of the Internet if the deal were to take place (which, as I write this, will probably not go ahead, but Microsoft won’t give up so easily). In my slightly unprofessional view, I don’t think it will change the shape of the Internet at all.

It really hit home for me today on the way to work, whilst listening to an advertisement for a dentistry company, they quickly listed their contact details and they also told the listeners to ‘Google’ for their company name. It then dawned on me that, for me and nearly all of the Internet community, Googling’ has become the official Internet synonym for web-searching. I have also noticed that at my work, when most people go up to someone and ask to do a web search, they usually ask ‘Could you Google something for me?’. Improper asking skills aside, it just shows you how much influence Google has in modern culture. Google has way too much influence for the community for even a Microsoft/Yahoo joint company to put even a dent in Google’s reputation, its usage, and its profits. To compare the synonyms for the other two companies, when I think Microsoft, I think Windows and Office, and when I think of Yahoo, I think of fossil.

If this deal were to take place, what would Microsoft really have to gain for it? Yahoo’s search engine? Well, it would be an improvement over Microsoft’s one, but nowhere near Google. Mail? Google has GMail, which isn’t as popular as Microsoft’s Hotmail but is gaining momentum. Not to mention how closely entwined Google’s Mail service is to all its other services and how many more features Google Mail has over Hotmail. The only thing I can see Microsoft gaining in this deal is a photo-sharing social network, in Flickr. Flickr is currently owned by Yahoo, and is probably its only redeeming feature in my opinion, and it’s also the one thing Google hasn’t got inside its huge Fortress of Doom. But really, in the world of Facebook and photo sharing on there, would that even be a thing that Google worries about? With the money Google has, it could probably buy Facebook. That’d be the end of that chapter.

I think Microsoft is throwing a lot of money to a lost cause. I’m no business expert, but I can clearly see when someone is just simply throwing large briefcases of money out the window. Microsoft should stick to what it knows best: monopolizing the OS industry.

Big Brother - Internet Filtering

Friday 4th January, 2008 at 1:16 am

Something that has crept up on the Australian Internet community lately which is probably the most controversial thing that has happened in the history of Australia’s internet usage is the announcement by our new Labor Government and their intention to introduce a mandatory filter to every ISP currently operating in Australia. It’s sparked many disapproving thoughts throughout the Australian Internet community and I thought I would weigh in on the issue and give my opinion (even though I’m sure no more than 2 people really give a shit). I’m not going to launch into a whinge about how we are becoming alarmingly similar to China’s current state of Internet (ableit with less bandwidth available to us) where the government can instigate a ban on a website without the public being able to scrutinize the decision, but instead, I wish to analyze just how far this sort of mandatory blocking of questionable websites could go, and what it could do to Australian Internet.

For those not in the know, basically, the mandatory filter is going to be activated on every ISP on an opt-out basis (ie. you have to go out of your way and opt-out of the filter to be allowed to use your Internet fully again). It will then mean that every site you visit on the Internet will be checked against a blacklist of sites with questionable content (ie. pornography, violent content, messages to Allah/God/Santa) and if you have yet to opt-out, you will not receive the site, and will more than likely receive a message along the lines of “You dirty perv, the Australian government believes you should not be allowed to view this site, so ner-ner.” What possible explanation could be given to institute such a ridiculous system? Well, let’s queue Reverend Lovejoy’s wife for a second… “OH PLEEEASE, WON’T SOMEONE THINK OF THE CHILDREN?”. Basically the new Labor Government (ie. Kevin Rudd and Senator Stephen Conroy) believe that something has to be done to protect the children from viewing inappropriate material whilst surfing the web, at the expense of everyone else’s viewing experience.

How is this going to inconvenience Australia? Well, let’s have a quick think:

  • If the blacklist is quite big (which it will mostly be, considering the amount of filth on the Internet), every time you visit a website it will have to check against EVERY site on the blacklist before it will let you continue. This could slow down the Internet immensly. This would then directly contradict another promise delivered by the Labor Government, the promise of fast broadband widely accessible in Australia.
  • The blacklist is rumored to have two levels, an R-rated level and an X-rated level. R-rated level, which is softcore porn, questionable but not offensive material, etc. will be viewable once you opt-out of the filtering. However, X-rated sites will continue to be blocked even after being opted-out, hence the Australian government is directly interfering in the content that you can view.
  • With a population of around 20 million in Australia, it can be safe to assume that around 50% of Australia will want to opt-out of the filtering program. So that is going to be at least 10 million calls to customer service divisions all around Australia. We could easily see a massive increase in wait times for customer service, at least while that 10 million or so people get sorted out.

There’s are just some of the side effects of this filtering system, but what is even worse is how far this sort of system could go, if the Government was to avoid a backlash from the churchies or whingers who asked for this system in the first place (sorry, but I have to be blunt and take a leaf from Chopper Reid: “Harden the fuck up”).

Think a Big Brother scenario, where if you opt-out of the filtering, your actions on the Internet will be monitored. It’s already been hinted by the government, it may not be official policy yet but it’s definitely a possibility that it will be implemented. The government could implement ‘flagging’, where if you view any page which has the certain words (like say, ‘doggy-style’, ‘anal’ etc.) would be flagged and could be blacklisted very shortly. Sites like Youtube, Myspace, Facebook etc, they could easily be flagged and blacklisted as there is questionable material on there. Search engines like Google (which already automatically redirect to the Australian version of the site) could also be forced to have search results filtered, just like in China. The outcry which happened in China when this happened would happen all over again, and would undermine Google’s aim of being a search engine which delivers true search results. The search results would be only the ones that got through the filter.

This is a VERY slippery slope that the Government is taking, and I think it could destroy the crucial young vote that Labor relied on to actually get here in the first place, because I’m sure there’s a lot of teenagers who would be very disappointed that they can no longer bat off on a Friday night over those porn sites. It’s a major fuck-up in my opinion, and I really hope that the legislation is kicked out or the public outcry so large that the Government would be forced to back down, because once they implement it, it can only get worse, never better.

PHP: Pretty Highly Pedantic

Monday 3rd December, 2007 at 1:35 am

PHP Pretty Highly Pendantic header

I had to come up with some bad meaning for the abbreviation PHP, which had pedantic in it, ‘cos that’s what is has been for me the past few days (yes, this is coming from a person who is a PHP web developer by trade). I’m still working on the new version of the Gamestah website, and it’s just giving me strife at every turn. I do like that because it IS so pedantic, it’s a lot more stable, but I just wish it would ease up on some of the little things it pings you for, like spelling errors, missing semi-colons etc.

Anyways, that’s not why I’m posting today. I’m posting because I haven’t posted for a while, and because I haven’t posted for a while, I’m feeling generous. So here’s a couple of functions which you can use in your scripts, commercial, non-commercial, whatever, it’s all good. A shoutout on your site would be nice, but I’m not going to be pedantic about it… unlike PHP!

SMART SHORT

Shortens any given text to a specific length at the best possible place.

This is useful for blogs, news teasers, RSS feeds etc, the script is given a piece of text, a couple of end characters and an end range to find the best possible place to end the text, ie. end of a paragraph or sentence. This is better than just cutting the text at the Nth character, usually ending up with half-words or broken sentences.

<?php

function smart_short ($text, $end_chars = array(‘.’, ‘ ‘), $maxlength = 255, $slack = 50) {

    $maxlength2 = $maxlength + $slack;

    // If the text is shorter than the max length, just return the text

    if (strlen($text) <= $maxlength) {

        return $text;

    }

    // Check for suitable ending with an array of characters

    if (is_array($end_chars)) {

        foreach ($end_chars as $end_char) {

            $pos = strpos($text, $end_char, $maxlength);

            if ($pos <= $maxlength2 && $pos !== false) {

                return substr($text, 0, $pos + 1);

            }

        }

        // If it hasn’t returned by now, it means it couldn’t find anything to work with, so it

        // will try and find the characters before the maxlength.

        $sub_text = substr($text, 0, $maxlength);

        foreach ($end_chars as $end_char) {

            $pos = strrpos($text, $end_char, 0);

            if ($pos !== false) {

                return substr($sub_text, 0, $pos + 1);

            }

        }

        // If it still hasn’t returned by now, return the sub-text.

        return $sub_text;

    } else {

    // Check against one ending character

        $pos = strpos($text, $end_chars, $maxlength);

        if ($pos <= $maxlength2 && $pos !== false) {

            return substr($text, 0, $pos + 1);

        }

        $sub_text = substr($text, 0, $maxlength);

        $pos = strrpos($sub_text, $end_chars, 0);

        if ($pos !== false) {

            return substr($sub_text, 0, $pos + 1);

        }

        return $sub_text;

    }

}

?>

$text - The text to shorten

$end_chars - Characters which the script is allowed to end on. Can be a single character, or an array of characters.

$maxlength - The amount of characters you would like before the script finds a cutting point.

$slack - The amount of characters after the maxlength the scripts has to find a suitable end point.

FRIENDLY DATE

Converts a timestamp to a friendly date (ie. Today at 12:30pm - Yesterday at 7:30pm etc.)

<?php

function friendly_date ($date, $dateformat) {

    $seconds = time() - 60;

    $minutes = time() - 3600;

    $hours = mktime(0, 0, 0, date(‘n’), date(‘j’), date(‘Y’));

    $yesterday = mktime(0, 0, 0, date(‘n’), date(‘j’) - 1, date(‘Y’));

    if ($date > $seconds) {

        if (time() - $date == 1) {

            return ‘A second ago’;

        } else {

            return floor(time() - $date) . ‘ seconds ago’;

        }

    } elseif ($date > $minutes) {

        $temp_time = time() / 60;

        $temp_time_2 = $date / 60;

        $min_count = floor($temp_time - $temp_time_2);

        if ($min_count == 1) {

            return ‘A minute ago’;

        } else {

            return $min_count . ‘ minutes ago’;

        }

    } elseif ($date > $hours) {

        return ‘Today at ‘ . date(‘g:i a’, $date);

    } elseif ($date > $yesterday) {

        return ‘Yesterday at ‘ . date(‘g:i a’, $date);

    } else {

        return date($dateformat, $date);

    }

}

?>

$date - The timestamp

$dateformat - The date format the script will use, should it not be able to make the date friendly. See the date() PHP function.

That’s it for now, but there will be more to come. :)

[ Tags: , | No comments ]

2007 WA Web Awards

Saturday 18th August, 2007 at 12:11 am

Two words… massive night! One of the best in recent memory.

Well, the main news was that the company I work for, Bam Creative, won the award for Best Medium Site (6-30 employees), so we were all pretty ecstatic about that. When we were called out by the MC of the event (who was classic, not because he was funny, but because he realised a lot of his jokes fell flat, and maintained a great face - If he reads this, cos I hear he’s somewhat of a blog hunter, I thought you were funny, so you have at least one fan :) ), we cheered like no one cheered before. It was so great, we actually felt sorry for the next finalist since their cheer wasn’t as loud.

We had free beer and wine, which was great. Most of the Bam guys got pissy, and we all celebrated hard, even when the rest of the WA Web Community sat around us having idle chit-chat and looking weirdly at us. We also got a 3-course meal. The soup (mushroom and something else) was crap, but the fish was great. And desert was good as well (not like you can stuff that up).

I’ll have to post up some photos when I get the chance, in the mean time, know that it was a good night.

… and that this is the first happy post I’ve made in a while :D

[ Tags: | No comments ]

You know you are a nerd when…

Saturday 28th July, 2007 at 12:51 am

It usually hits you with little warning, little provocation and little effort. The realisation that you are a nerd. Here are 10 tell-tale signs that you are starting to become a nerd:

  1. Your girlfriend/boyfriend made you choose between her/him and the computer… and the computer won.
  2. You don’t call it pornography… you call it ‘pr0n’.
  3. When you start your car in the morning, you wait for 3 beeps and someone to yell ‘Go!’
  4. You quote Wikipedia in your English essays.
  5. You can only talk to the opposite sex on MSN Messenger, and fumble for words when meeting up IRL.
  6. Speaking of IRL, you actually say ‘IRL’ as opposed to ‘in real life’.
  7. You create a list of 10 tell-tale signs that you are becoming a nerd (knowing full well you must be a nerd to know of the tell-tale signs)
  8. Your idol is someone along the lines of John Carmack or Jimmy Wales. (Notice how I qouted Wikipedia… fark I’m such a nerd :P)
  9. Your best joke is: “There’s 10 types of people in the world. Those who know binary… and those that don’t.”
  10. You feel at home at Harvey Norman Electrical and Computer stores.

Image: A spoon-bending, 1337-5P34K-ing image of the Matrix

[ Tags: | No comments ]

Movie Reviews

Tuesday 24th July, 2007 at 7:26 pm

Movie Reviews header

Apparently, these days, you can never enjoy a movie that was based on a best-selling book, according those “wise” people who call themselves movie reviewers. You have people like Roger Ebert (pictured right), who probably don’t do anything else but watch movies judging by his figure, saying that YOU, the innocent movie goer who might be scarred for life for watching BAD MOVIEZZ, shouldn’t watch certain movies because they don’t follow the books close enough.

Please, do the world a huge favour and shut those excrementitious orifaces that you people call your mouths.

What has sparked this anger, I hear you ask? Probably the can of Bundaberg Rum sitting right next to me. Oh… and the fact that I went to see Harry Potter and the Order of the Pheonix on the weekend. I must say, although I wasn’t as thoroughly impressed with it as I was with Goblet of Fire, I still enjoyed it immensly. Being the inquisitve person I am though, I logged onto Rotten Tomatoes to see what everyone else said about it. Sure enough, plenty of people were whinging about the movie. It doesn’t follow the book. They cut side-stories. J K Rowling is my hero. It’s the kind of dribble that makes you just shudder at the thought that these people represent our best interests with movies. I have read the book, ableit quickly, but the point is, whilst the movie deviates from the book in some cases, none of the magic (excuse the pun) is lost. Hell, I prefer the streamlined approach of the movie, as some of the details of the book weren’t needed. And by the way… J K Rowling liked the movie. The author of the book liked the movie. That’s saying something.

So, my closing comment is… If you haven’t seen the new Harry Potter movie, go and see it.

Image: A psychically confused Harry Potter from Order of the Phoenix.

New job!

Monday 2nd July, 2007 at 8:57 pm

New job header

Now for some good news for a change :P… I have a new job as a web developer. I am now under the employ of a company called Bam Creative. Be sure to check them out if you want your website done the proper way ;)

Image: A dastardly copyright-infringing image of Bam Creative.

[ Tags: | No comments ]