Confessions of a Guru....

22 July 2008

Orcon bumps their prices up

Winking away in my inbox today was an email from Orcon - this is generally a good sign as they like to announce new plans, good deals etc. This announcement in particular was not welcome:

Putting our prices up is something we try really hard to avoid. But sometimes it's beyond our control.

So unfortunately we've been forced to pass on an increase for the monthly rental of your Orcon homeline. This will mean your Orcon Homeline Plus (includes W&M Insurance) plan price will increase by $3.00 per month.

We're also having to increase our national landline calling rate from 15c to 19c per minute. If you have an unlimited number of national calls as part of your plan don't worry, that's not changing - this rate will only be applied if a call exceeds an hour, effective from the 23rd of August.

The discount you get for having your tolls with us will remain, but will now be $5 instead of $10. This will effectively mean that your broadband plan is $5 more expensive per month.

These changes are going to take effect from the 23rd of August.

There is some good news though. We've managed to keep the capped calling rate exactly the same. So if you don't have unlimited national calling you'll still pay no more than $2.95 for calls of up to an hour in duration to NZ landlines.

That's a monthly increase of $8 which is pretty significant. For them to say that there's good news in that they're not raising some prices is pretty sad. I would have thought that with technology being what it is, prices would be coming down, not going up.

The bad news for Orcon is that they'll likely be losing a customer. Watch this space for my findings on researching other NZ providers.

Labels: , ,

Custom Search

20 June 2008

Things that I hate about PHP

Ok so I've been back in the swing of development for a while now and I've reminded myself about the things that I hate about PHP. Overall I like it a lot but these are the things I hate.

magic_quotes

So the deal here is that when enabled, any posted information will have any quotes magically escaped, so if you were to post the text "Fish 'n' Chips" then your script would receive the text "Fish \'n\' Chips". This is useful because then you don't have to do anything to it to include it directly in a query for insertion into a table, but nowadays parameter binding and database abstraction layers take care of that. If you're starting from scratch, do yourself a favour and disable magic_quotes on your PHP installation. If you can't, use this to do it for you:

// If magic quotes are on, remove any slashes in the input.
// This allows us to operate on all inputs without having to addslashes().
if (!empty($_POST))
if (get_magic_quotes_gpc())
foreach ($_POST as $var=>$val)
if (is_string($val))
$_POST[$var] = stripslashes($val);

This will ensure that the contents of the $_POST variable will always be as it was posted when you first get your hands on it. What you do with the content is then up to you.

addslashes, stripslashes

Ok, I don't hate these functions as much as I hate how they are abused. The problem is that people don't seem to understand when and why they should be used. It is not correct to always addslashes() your content before inserting it into a database and stripslashes() when getting it back. It is correct to addslashes() the content as you're inserting it ONLY if the string hasn't been addslashes()ed before - remember that magic_quotes does this too. The result is that if you have magic_quotes enabled and you addslashes then our string "Fish 'n' Chips" ends up becoming "Fish \\\'n\\\' Chips", then it is inserted. A "fix" (ahem) is to stripslashes() when you get it out of the database but this is not correct, it is very much a bandage on a problem.

Automatic Typecasting

It's useful to be able to have a string with the value "10" and add an integer value of 2 to it and have the result as an integer of 12, but you cannot disable the automatic typecasting. This lends itself to bad programming practice, and confusion when it comes to how your application will behave when it casts an array to an integer for example. The PHP website lists the exact behaviours but it is annoying when "0", "", 0.0 (float), 0, false, NULL, Array() and an empty object (PHP4 only) are all treated as FALSE, but "0.00" is treated as true. This is alleviated somewhat by using the type equality operator (===) where the result is only true if the type on both sides of the operator is the same but it does annoy me. Hungarian notation may be of use to help set the standard in a project.

Variable Scope

The scope of a variable is the current function, method or global in the case of neither. It would be nice to have the scope of a variable be the current block as in perl (forgive me, it's been a long time since I had to write perl) where the variable only exists for the scope of the current block, for example:
for (var $i=0; $i<10; $i++)
{
// do something with $i
}
// $i no longer exists here

Prefixing variables with $

I heard one of the PHP guys on a podcast (a TWiT one I think) saying the reason that variables had to be prefixed with $ was that it was easier to write a parser that just knew that $ had to be a variable, rather than determining whether it was an operator. Ok, I agree but let me see how many lines with $'s I can find in my current project: 37375 out of 55925. I'm just annoyed, oh and switching between PHP and Javascript where you don't use $ as variable name prefixes is annoying (as is the fact that + is the concatenation operator in Javascript and it's . in PHP)

I miss something like pascal's "with" operator

Especially when you're dealing with data deep in an object, for example $foo->bar->baz->quz[] (and I use this object level often) it would be nice to be able to go:
with ($foo->bar->baz)
{
.quz['element1']
.quz['element2']
.quz['element3']
// etc
}
Can't do it :( VB has a similar construct but I can't recall what it's called.

Different Quoting Behaviours

The difference between a "string" and a 'string' irks me. "string" is parsed for variables, e.g. with $name = 'Bob', "My name is $name" would return "My name is Bob", but 'My name is $name' would return 'My name is $name'. I opt for the latter please, and just let us work out what we want to do.

Other than that ...

.. it's all good! As I said above I like PHP a lot and the fact that it's got such a huge following and is used on some pretty major products (Facebook for one, Yahoo for another) is a testament to how well it can work when implemented properly.

Custom Search

11 June 2008

Simple Content Manager Launches

If you care you may know that I've been working with Turboweb for a couple of months now. I've been mostly working on a system for creating websites. The gist is that if someone wants a website to complement their business or group or whatever but they don't know how to get started then we provide EVERYTHING that they need (hosting, email addresses, domain names, ecommerce, image gallery, news, events etc etc) for a single monthly cost. We call it the Simple Content Manager (SCM). It's pretty neat.

I've been furiously coding and testing for the last couple of months and to see the final product working - actually working - is almost unbelievable and kind of scary. You can get a website up and running in just a couple of minutes, and thanks to some great design skills the websites look pretty decent too. I'll be the first to admit that we're not firmly in the saddle as the horse is taking off but the best way to find out is to ride it.

I've heard that it's not uncommon for people to be charged a single design/build fee of several thousand dollars for a new website - which is kind of silly as the majority of people who want a new website want pretty much the same features that other websites have got. I know of two people who have recently paid over $5,000 for a basic website with ecommerce. That sucks. So, we're aiming at less than $20 per week with no long term commitment required. A big advantage here is that for small businesses who don't know how well they're going to do in the future they can just have their website as a regular monthly outgoing cost.

Anyway, the long and short of this blog post is that everyone on the planet (with internet access) can trial our SCM for 14 days to see if they like it. We're also on the hunt for resellers so drop me a line if you're curious.

You can sign up for a trial at http://www.scmdemo.com/signup/. Would be interested in your feedback.

Custom Search

08 June 2008

Tweeting in Linux

Quickly tweet from your Linux environment with this script - all you need is the ability to launch a shell script, e.g. from a terminal, shortcut on your desktop or Gnome panel

Requires: curl, zenity.

Change the TWITTER_USERNAME and TWITTER_PASSWORD accordingly. Remember to make the script executable and since it contains your twitter username and password you most probably want u+rwx, go-rwx (or 0700).

#!/bin/bash
TWITTER_USERNAME=twitterusernamehere
TWITTER_PASSWORD=twitterpasswordhere

tweet=$( zenity --title "Tweet:" --entry )
if [ ! -z "$tweet" ]; then
result=$( curl -s -u $TWITTER_USERNAME:$TWITTER_PASSWORD -d status="$tweet" http://twitter.com/statuses/update.xml | grep -i "could not authenticate" | wc -l )
if [[ $result -eq "1" ]];
then
zenity --error --text="Error logging onto Twitter - please check your username and password or Twitter availability."
else
zenity --info --text="Tweeted!"
fi
fi

Custom Search

19 May 2008

Getting help anonymously

I've often wondered how to go about getting technical assistance for work related issues without revealing sensitive information to your competitors, or even worse, making yourself look like you don't know what you're talking about to your current and potential customers. The number of times I've seen ridiculously simple questions asked by people whose business it is to know is astounding, and especially so when they appear to be asked by the person literally named in the forum post or email.

Case in point: one of the projects I worked on in the past was the integration of a bespoke image library system into a global image management system. The idea behind it was that an end user with a native Windows/Mac desktop publishing application would be able to search for anything they like, and the results would be served up from a broad range of sources. They could then use the image in their work and the global company would facilitate the payment between the provider of the image and the end user.

When we were invited to pass the benchmark integration tests, one of the first things I did was to look at the authors of the specification and Google them. It was clear that at least one of the authors who was top billed on this specification had very little knowledge about what it was he was implementing, and he was using his work email address to ask these questions, dutifully stamped with the company name after the @ symbol.

I haven't yet had a need to venture into the public arena with work-related questions, although a do feel guilty that I'm a community 'sucker' - that is when I have a problem I exclusively google it and never give anything back, at least not where it's needed. For when I do make that step, it would be irresponsible of me to assume that posting with my work email address (or indeed my personal address which can easily be tied back to my employer) would do no harm. For that reason, I've prepared this list of ideas.

Pick a pseudonym
A fake name, or a handle would be appropriate. A fake name would imply a level of professionalism not given by the use of a handle. Consitent use of the name for posting questions is important for the sake of the community rather than me. It would be easy enough to make up a new name for each question.

Hide your tracks
Posting to a forum or newsgroup with a gmail email address is not enough, as your IP address is normally recorded, resulting in an easy trail to follow for someone determined enough to do so. I'm pretty sure Gmail has your original IP as a X-* header in the email. Other possibilities are to use a free/anonymous proxy server, however be aware that a lot of proxy servers add a "forwarded for" HTTP header for tracking/logging purposes. A commercial tool such as anonymizer, or a dialup account and spare modem would be suitable. Whatever solution you chose, carefully examine what happens when you post to a forum or send an email to ensure nothing to link you to the email is there.

Don't get tagged by cookies
There's no reason why a website can't track your visits, and associate the website accounts used from your computer, thus undoing your careful aliasing and track hiding. Make sure you clear your cookies, or even better, use a virtualised OS (Microsoft Virtual PC and an Ubuntu install would be perfect) to avoid this. If using the latter in order to avoid having to delete cookies, ensure you use the virtual OS exclusively for anonymous posting.

Reword your problem
Goes without saying really, but make sure your problem/question gets reworded so that it looks as little as possible like what your issue is that you're facing, but make sure you give enough meat for the community to help you out. Boiling it down to it's metasyntactic bones makes it disinteresting and an academic question - real people like solving real problems. You're likely to get more bites if your problem doesn't start "given a class called Foo and a method called Baz..."

Give and take
Make sure that you give back to the community by answering questions, writing documentation, bug fixing etc. This was one of my new years resolutions for 2008 and so far I'm doing pretty badly at it. It doesn't help that my chosen project to contribute to has gone on ice and the maintainers are incommunicado. Pfft.

Any other ideas you may have are welcome.

Custom Search

10 May 2008

A New Career

In the last six weeks I've changed jobs. My previous job was with SmartMedia Solutions as the Development Manager - a role that I effectively inherited due to staff churn and a bit of restructuring. While interesting and certainly a challenge, I couldn't see myself enjoying it long term because it didn't scratch my itch to develop software. Directing development is interesting but not hands on enough for me.

So, I had been in talks with my new employer Turboweb a long time before they were even at the point where they could afford to even think about employing someone. I suspected that things were about to happen and mentioned to the guys at work that there was a chance that the planets would align and I wouldn't be with them much longer. To my surprise a formal offer from Turboweb came just a few weeks after that announcement.

I served out my notice period trying to get everything ready for a replacement to step in, including trying to get together an appropriate job description and advertising it with a local recruitment agency. Seems that I left a hole that is hard to fill as three months down the track after announcing my departure they're still advertising. I wish them luck.

So, my new job as a Web Developer (I type the programs in with PHP/MySQL/Javascript mainly) thus far has been pretty rewarding from an interest point of view. I've gone back to my roots - hands on development has been my interest since I first got into IT and since I left my Web Developer job at Bluhalo I've been missing it.

We're shaping up to launch our Simple Content Manager (SCM) application to the world. I've been getting the application into shape (reviewing performance and security), hooking up a demo signup and expiry and getting involved with the marketing side of things. It's pretty exciting. Being a small company we have to be careful that we don't swamp ourselves on launch day so we'll probably dip our toe in the water first and see how we get on.

On the home front, things are cranking along with Linus being the most cutest and astonishing boy in the world (check out the Loopy Mummy Blog for reasons) and Ada has been giving us grins and the occasional giggle for the last month or so. I'm on the verge (maybe this weekend) of mixing up my next batch of home brew, a pilsner this time. Linus is staying away for TWO nights at Granny & Pop Pop's. I'm also researching options for replacing my home server, and will blog about that as it happens.

Oh, and the Scooter is still awesome, and the jacket that was a leaving present from SMS is almost twice as awesome as that. Keeps the cold and wet out, which is a requirement in the Dunedin winter. Thanks guys! :)

Custom Search

03 April 2008

Beryl - hidden secrets

I surprised myself last night by accidentally holding down the super key (also know as the *ahem* Windows key) and scrolling my mouse. It took me ages to work out how I'd zoomed in on the screen, just like I've seen happen on recent flavours of MacOS.

I figured it was a Ubuntu Hardy feature, as I had just upgraded to that but it looks like it's something that's been in Beryl for some time now (just googled and found someone complaining it worked in Feisty but not Gutsy).

I also found that Alt-mousewheel adjusts the opacity of the current window, allowing you to see behind it without having to Alt-Tab.

Go Beryl/OSS :)

Custom Search

25 March 2008

Quotable Quote

I found this quote in the margin of Code Complete 2, attributed to Pablo Picasso.
When art critics get together they talk about Form and Meaning. When artists get together they talk about where you can buy cheap turpentine.
:)

Custom Search