is the world coming to an end??

Arrgghh!! El Goog and el Jobbso are fighting! WTF? So Apple has pulled Google Voice from the App Store and won’t explain why; other than that tired old excuse of “it duplicates feature of the iPhone”. Like it suddenly started duplicating features after 4 months in the store. No one seems to be able to get any answers about it yet. Riverturn posted this blog post to explain their confusion at having their Google Voice app removed from the store. Gizmodo has started the App Disapproval Watch and has loudly voiced their disgust. Some parodies have come about (here); as well as Marissa Mayer’s deleted tweet. At least it shows she has a sense of humour.

I have a feeling this is going to be one of those historical turning moments in tech history. I’m not trying to come over all melodramatic, but Google is a giant, and so is Apple. While this is not going to turn into a legal battle, this is shaing up to be a clash of the Titans in some respects. There has always been an undercurrent of discontent at Apple’s very closed App Approval Process, but now one of the big guys has been touched. Not only with Google Voice, but with Google Latitude last week.  Latitude is moving to a web-app, and so it seems will Google Voice for the iPhone. What I believe this will have the effect of doing however is pushing forward Google’s motivation and timeline for fronting out web-apps and the related services. One thing we do know, is that when Google does something, they do it well. If they are going to need to front web-apps faster than expected, they will do it well.

The other question which hasn’t really been touched on yet is “what is Apple doing?” They are not a naive company, and will have been aware of the publicity this would cause. So, I have to ponder, what are they hoping to achieve with this action? Time will tell, and I have no answer yet, but I will be thinking upon this and posting my thoughts in this regard as I shape them all pretty.

quick update: great recipe

I just made myself dinner (no, that’s not news!) and I thought I’d share the recipe quickly. It’s nothing flash, and is made from fresh vegetables, as well as some nice “fresh” tinned product. Anyway, it all came together in under half an hour and was healthy, nourishing, and filling. As well as having left-overs for work tomorrow.

Here goes:

  • one whole leak (fresh)
  • 300-400 g whole washed baby potatoes (fresh)
  • two large white onions
  • 500-600 g pure beef mince (fresh)
  • two tins diced fresh tomatoes with basil
  • one tin mixed beans
  • two tsp cinnamon sugar

So, rough chop the potatoes into cubes (ish) and steam them until nicely soft, but not mushy.

Meanwhile, rough chop the onions and the leak, before tossing in an oiled pan until starting to brown. Half-way to brown toss in the mixed beans.

Once browned, remove the vegetables from the pan, and add in the mince. Keep turning the mince until brown adding the cinnamon sugar over it, then add the vegtables back in. Pour over the tins of diced tomatoes, and turn down to simmer for 5 minutes once mixed through.

Take a good sized dinner bowl, lay a bed of the steamed potatoes, and cover with the mince. Top with grated parmesan cheese if you like.

Like I said, nothing flash, but a good basic meal which is very filling and nutritious, and doesn’t take long to pull together either.

[insert title here]

I just felt like using that as a title today. Hmmm. Found this cool picture of the difference between Pixar and DreamWorks. Kinda says it all doesn’t it. While you’re at it, check out the short films on Pixar’s site….definitely worth not doing any work for an hour or so.

Also, this is just AWESOME!! They seriously need to actually make this movie: TRANSFORMINATORS….

I’d pay good money to go see that, and I think you would too.

Just been to a leture this morning on how to generate codes. Kinda flat really, and not that stimulating. I find the texts much more interesting, as you can see a bit more of the history and context of the content. I also realised today that I was in a room full of foreigners, being lectured to by a teaching staff of foreigners, and then we wonder why New Zealanders don’t push themselves. We are a bit of a nation of slackers in general. We have some achievers, but, y’know. Don’t get me wrong, I don’t have a problem with foreigners. Actually, one of my lecturers was a senior research scientist at the Russian Institute for Optical Studies or something. Basically, in the 1970’s he was involved in analysing satellite imagery of US bases and processing it through software he wrote to get real data out of it. I am glad that we do actually have world experts teaching us this stuff, and people who have used it for real-life scenarios too.

And then I stumbled upon this gem, and I really mean gem, of a YouTube flick. Validation – because you are great!

I’m pulling together a whole lot of stuff today, catching up on what I’ve missed over the past week due to being sick. I was intending to tidy everything, and get all prepped for semester, as well as semi-launch sites etc. Now assignments are loading up, and I’ve also got Google CodeJam to prep for too; so good times ahead. I’ve also been glancing at some of the thoughts floating around regarding HTML5 and the influence/impact it will have. Particularly interesting was this article (from January 2009) by Steve Smith. It gives a nice summary of what is happening, and also some guidance as to how to handle compatibility/incompatibility issues and how to future-proof sites as you are building them now.

I’m also getting more inspired to customise my own WordPress theme and host it myself, because I’m still not entirely happy with the aesthetics and thematics of how my code snippets and other components display. I changed to this theme the other day, and it’s ok, but not “what I would envision”.

Anyways, back into the study and assignments, so enough of my wiffle ’til tomorrow.

quick update: awesome wedding procession!!

I just found this Minnesota couples wedding video on YouTube…..I won’t do a spoiler, so just watch and enjoy. This is AWESOME!!!

finally I speak again….

I’ve been sick since last Tuesday, massive head-cold rah-di-rah. I won’t share the gory details though. Made it to work Sunday night finally, after spending the week dodging work and uni (definitely not the most auspicious start to a semester I could imagine!!). I did manage to post a couple of tutorials as you will have seen, because I had them half written and could manage to focus for a few minnutes at a time to edit and post them.

Nothing overly exciting has happened due to being bed-ridden. I feel like a bum though. I made it to church Sunday morning, but once I walked in the heat hit me like a wave, so I had to say my farewells and go home.

Plans for this week are to catch up on readings for uni, and get into my assignments sooner rather than later; especially as one of them was issued last Monday, and it looks straight-forward. Best to get ahead while I can with 5 papers this semester!!
I haven’t been surfing intrawebz or anything so no exciting videos or links to post sorry. I’ll have to see how this week goes in between catching up on uni work.

Just a few comments though:

  • I like the way the police officer in Cambridge has been backed by his superiors and department, even to the point of telling Obama he should apologise. I respect Obama, but I think in this case he spoke too soon without all the facts, as it is now becoming more and more apparent that the officer in question is not likely to be racist – in fact, quite the opposite. He’s trained officers to not show racial bias, and was hand-picked by an African-American superior to do so; and his African-American partner says he did nothing wrong in the arrest….time will tell as the rest of the story comes out, but I think Gates was just trying to blow it all up, and picked the wrong cop to pin the story on.
  • I’m looking forward to getting the chance to play with Google Wave in the near future as time allows. I don’t think it’s going to destroy Twitter etc, but I do think it is going to have a major effect on how the web develops as a whole. Google is definitely stepping into the internet world in bigger and better ways constantly; and unfortunately for the competition, they do it more than well when they do launch so users actually stick around.
  • These are the cops that Obama needs to be berating!! They shoved a taser up a guys a$$ and had a chat about it!! I don’t have much more to say about it, it’s kinda self-explanatory, don’t you think??

That’s about it from me, so there you have it.

css based drop shadow effect

The drop-shadow effect is an used to provide that little bit extra to the formatting of your blocks. The following is a basic demonstration of how it can be achieved through the simple application of some CSS formatting. This removes the need for imagery to be cached, and enables the dimensions of the block in question to be altered without hassles. In turn this provides a decrease in the bandwidth requirements of your site which, if there are a large amount of blocks with shadows or other effects, can mount up very quickly in graphics intensive sites.

I did originally find this code elsewhere when I was doing some web design work, but I don’t recollect where from. I don’t claim original credit for this, and if it is yours, I apologise and and if you contact me I will reference you here immediately.

The CSS required is:

<style>
body {
margin: 0px;
padding: 20px;
font-family: verdana;
font-size: 12px;
}
#shadow-container {
position: relative;
left: 3px;
top: 3px;
margin-right: 3px;
margin-bottom: 3px;
}
#shadow-container .shadow2,
#shadow-container .shadow3,
#shadow-container .container {
position: relative;
left: -1px;
top: -1px;
}
#shadow-container .shadow1 {
background: #F1F0F1;
}
#shadow-container .shadow2 {
background: #DBDADB;
}
#shadow-container .shadow3 {
background: #B8B6B8;
}
#shadow-container .container {
background: #ffffff;
border: 1px solid #fff;
padding: 10px;
</style>

and then this is applied within the HTML as so:

<div id="shadow-container">
<div class="shadow1">
<div class="shadow2">
<div class="shadow3">
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sem enim, iaculis eget tincidunt quis, ultrices vel tellus. Quisque semper ante eu turpis convallis eget pharetra ligula pulvinar. Vivamus quis neque mauris. Praesent sit amet felis id lorem fringilla adipiscing ut ut felis. Etiam at lectus elit, vehicula porta ipsum. Nullam in turpis mi, et interdum sapien. Cras vehicula, eros eget rhoncus hendrerit, ante massa tincidunt nulla, sed iaculis quam ipsum congue risus. Integer id velit erat, vitae malesuada ipsum. Maecenas pretium ligula ut ipsum laoreet in tristique mauris accumsan. Cras lacinia justo quis tortor fermentum adipiscing. Donec consectetur eros sit amet ante lacinia venenatis. Aliquam erat volutpat. Morbi in suscipit dolor. Vivamus pellentesque fermentum lorem in bibendum. Vestibulum porta commodo fermentum.
</div>
</div>
</div>
</div>
</div>

And there you have it, a CSS define drop-shadow for any blocks you wish to assign this to. This works equally well with rounded blocks, ie using:

-border-radius: 1em;
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
// -opera-border-radius: 1em;
// -khtml-border-radius: 1em;

as long as you allocate this rounding to each element of the shadow-container family.

validate email in PHP

Here’s a simple script to validate an email address. This only checks for structure, and doesn’t confirm the validity of the address (ie does it actually exist).

<?php
function validate($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
?>

[Edit – 24.07.09: I’ve updated this script as I found some more detail of email address definitions, ie RFC 2822]

I’m working on a “confirmation” script which will ping or otherwise check the submitted email address for validity as an actual existing address.

This post here also has an even better email validator script (Listing 9) which also tests the email domain against a DNS.

generate random password in PHP

Just thought I’d share this little script for generating a random password with PHP. You can customise the length and strength of the password when calling the method.

<?php
function generatePassword($length, $strength) {
$vowels = 'aeiouy';
$consonants = 'bcdfghjklmnpqrstvwxz';
if ($strength == 1) {
$consonants .= 'BCDFGHJKLMNPQRSTVWXZ';
}
if ($strength == 2) {
$vowels .= "AEIOUY";
}
if ($strength == 4) {
$consonants .= '123456789';
}
if ($strength == 8 ) {
$consonants .= '@#$%';
}
$password = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) {
if ($alt == 1) {
$password .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
}
else {
$password .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
}
}
return $password;
}
?>

you then simply call the function from within your script as:

<?php
$newPass = generatePassword(length, strength);
?>

And there you have it, a randomly generated password. You can play with the strength factros and variables if you wish; entirely up to you.

trimming white space in JS easily

I’m still crook, as my Twitter tweets will have let you know, but I thought I’d jump online and do a quick post. I got up this morning feeling worse than ever, but ecided to give lectures a go. Got showered dressed and out the door, before the migraine and sinus went “MEH!!!”; so I got some Night-and-Day and the pharmacy and went home to bed….

Anyways, here’s a quick script to deal with white-space in JavaScript strings, and remove both leading and trailing white-space with one easy function:

<script language="javascript">
function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
</script>

Nothing flash or earth-shattering here, just thought it might be useful.

I’ll try to be coherent later, and post some more tuts. I won’t have much to say myself, as talking about sleeping and being in bed is boring for everyone, including the writer (me).

a new semester begins

Today is Tuesday (duh!), and uni started back yesterday. I am lucky enough to start my week at 8am on a Monday, so no easing into the lecture schedule for me. I was pleasantly surprised to find that one of my papers has already released the first assignment. This means that I will actually be able to get onto it in a timely manner. Normally they all wait until third/fourth week to all release them at the same time, and then are all due at the same time. I’m a bit sick today, so I’ll be starting on this assignment tomorrow and trying to get it done by the end of the weekend.

Also discovered that one of my other papers get to play with Windows source code (WRK). Very cool!! It’s only the WRK for Server 2003 but, as they say, that’s pretty much the same as XP, which is almost the same as Vista; so there we go. My schedule isn’t too bad for my – touch wood – final semester before returning to the real world, so I’m not stressing over possible time issues at all. I’m doing mainly CompSci papers to finish off, but most of them are network related, so I’m really weighing towards mainly InfoSys in reality. I’ll also be completing my CCNA semesters 3 & 4 as part of one of my InfoSys papers which is a bonus. And, I believe my other InfoSys paper allows me to sit an Oracle certification at the end too. Look at me the uber-student.

Check this link out for a bit of a laugh when you get the chance (make sure you have sound!). It is safe for work. Also, notpron.com is classic. It’s also safe for work, but the url my cause filters to trigger, so best to do it at home. I have to put in the following video, just because I hadn’t seen it for ages, and I re-watched it again over the weekend. It’s still as ridiculously funny as it was when it first came out!!

As you’ll soon see, I’ve been going through my favourites folder on YouTube, and I went right to the very back end for the oldest (possibly forgotten) vids I could track down. Here’s Best Baby Break Dance:

and this one of a guy catching glasses with his face:

I’ll end the queue of videos with this one. It’s actually quite heart-touching, so enjoy and be happy for him:

I’ll be doing some more tuts this afternoon, or tomorrow. Something to do with XML and HTTP now that I’ve had a bit of fun setting that up for my site (launch will be within the next two weeks I think!!) and coordinating it with JS so that other sites can call to mine and get responses back. I’ll also look at something to do with dynamic JS creation from PHP.