October 27th, 2008 Denham Coote
As some may recall, Stormhoek were kind enough to let us spend the day on the farm when we were down in Cape Town for WordCamp 2008. Good food, good company and good wine! A perfect Sunday. As if this wasn’t enough to convince me just how awesome these guys are, they are now running a promotion where they will send wine and photos to just about anywhere in the World, to users who engage with them online.
I’m sure not gonna miss out on the opportunity to get myself some of their awesome wine! (I opened my last bottle of Stormhoek last week)
Hope you’re all well!
Posted in General | 1 Comment »
June 20th, 2008 Denham Coote
Grab your popcorn, coffee, blowup doll, whatever it is that passes time, and settle in for a lengthy post!
Being relatively new to the world of PHP development, as well as the associated technologies (MySQL, CSS, etc), I’m going to ask that you bear with me while I ramble on about things that, for many of you, may seem entirely trivial. My reasoning for doing this is because a) repeating what I’ve learned reinforces the lessons, and b) someone else may find it beneficial. The level of detail and technical jargon I use will vary. Sorry. So, without further ado, here goes…
The application is a platform for users to submit pick up lines (guys) and seduction tips (girls). Users are allowed to vote on content added by the opposite sex (IE, guys may vote for seduction tips, and girls for pick up lines) as well as being able to comment (on either type).
The above requirements are quite straightforward. The implementation thereof, is interesting. While the application is really simple, a lot of users never get to see what’s really going on behind the scenes. Here’s a quick rundown:
The first thing we do is grab the user’s sex from their profile. This allows us to automatically present the correct input forms when they wish to post a pick up line / seduction tip.
Submitting
When the user submits a pick up line / seduction tip, it needs to be cleaned of any potentially harmful code (like bad JavaScript). This is done by stripping out any illegal characters from their submission.
Once we have the submission, we give it a unique tracking id, so we can find it again later on. We also record the pertinent details such as who made the submission (in this case, the user’s unique Facebook ID), the date and time, and the type of submission (pul/tip). All of this is done behind the scenes, on the fly. This information is then added to our database as a new record.
Formatting
Having hundreds of lines of content stored in a database is all good and well, but we need a way to display it. For this I wrote a simple function (Yeah Tyler, simple ;-)) which could be called in a number of ways, depending on how we wished to display the content. For example, listing the 10 most recent entries, whether they be pick up lines or seduction tips. Or, more specifically, displaying all the entries of a single user. Or a random selection. Or the 5 most voted (more on voting in a bit!) for pick up lines, tips, or both.
Once the function is called (and provided with its criteria) it will send the data (encapsulated in named <div> tags) back to the calling file, which then applies any CSS styling we need (to make it pretty!) and pushes it to the browser. The data it sends back include:
- the author
- date and time
- number of votes for the item
- the actual text of the item
- number of comments.
Voting
Users are allowed to vote for content submitted by the opposite sex. They may only vote once per item, but can vote on as many items as they like. A few things need to happen here. When the pick up line / seduction tip is displayed, a voting badge is (think Digg) is attached to it. This badge is generated along with every pul/tip that gets sent back to the browser. Every time a line is displayed, we need to check if a) the current user is allowed to vote for this item (opposite sex?) and b) if they are allowed to vote, have they voted for this item before? If so, we disable voting for that item. If not, we provide a button with will then enable them to vote.
When a user votes for an item, we need to record some more details. We need to know
- who the vote is coming from (the user’s Facebook id)
- which item the vote is for (the unique tracking id I mentioned earlier)
- the date and time of the vote
1 & 2 are important in terms of avoiding duplicate votes in the system.
Ranking
Once we have a table full of votes, we can use the information to do some form of ranking on our items. A few possibilities include ranking based on:
- Overall number of votes per user
- Overall number of votes per item
- Most active users (who’s doing the voting)
Commenting
Quite similar to voting in terms of code and structure, but a bit more simple. Here there are less constraints. A user can comment on any item, and more than once. Here we record the following:
- who the comment is coming from (the user’s Facebook id)
- which item the comment is for (the unique tracking id I mentioned earlier)
- the date and time of the comment
- the actual comment itself (the text)
And that’s pretty much it! There are a bunch of other cool bits and pieces, but that would make this an (even more) exceptionally long post.
Posted in General, php | 1 Comment »
June 12th, 2008 Denham Coote
6 months. A lot can happen in 6 months. A lot _has_ happened in 6 months.
I’m sure that a lot of what I’m about to tell you would probably have made decent individual posts. Thing is, life, being the rollercoaster it is, tends to have its share of extreme ups and downs. You, as the rider, experience every turn, every drop and every loop for the gut-wrenching, invigorating, thrilling & exciting bit of fun it is. At the end of the ride, trying to describe how the *aaargh* at turn 3 was different to the *uuurghhh* at turn 5 is a bit more difficult, and a lot less colourful. To the person you’re trying to describe it to, often, the best you can do is “Wow! Just, WOW!”. In the same sense, trying to convey the happenings of the past 6 months with the same gory detail is simply not going to happen.
So here’s the summary:
Let’s see. I’ve taken very few photos. My car was totalled. I resigned. I now work for myself, freelancing as a PHP developer. Richard, the bass guitarist for Sandbox, left to move down to George. Ann, his replacement, is no longer with the band either - she’s off to New York, I believe. I got a puppy (a boerboel x boxer) called Java. He died. I got myself a 22″ widescreen. I’m thinking about getting a 2nd one. Been spending some time with Tyler Reed of Younique lately, working on some things together. I am currently working on a facebook project for M-Net. I am also working on some really cool projects for Pixelmagic. Went and saw Counting Crows. I helped my brother set up a site for the World of Warcraft guild he plays with. My studies have taken a back seat. I missed my accounting exam completely. Today I wrote (guessed) business management.
I have too many unread books, too many items on a dusty todo list, too many unread feeds, too much unopened mail, and plenty of wine that wants to be shared. Anyone up for it?
Posted in General | No Comments »
May 22nd, 2007 Denham Coote
With the advent of Facebook becoming as popular as a $2 whore on a US Navy ship, it would appear that now’s the time to jump in. I’d been putting it off for the better part a year. I caved about 2 weeks ago, though. All along, I had figured that there was no point - I mean, what do Myspace, Orkut, Datingbuzz, Digg, Blogger, del.icio.us, etc all have in common? They all contain some or other digital representation of my miserable life. Social Networking, so I’m told.
So, as with Orkut, I signed up and found a bunch a friends I’d happily forgotten about. My day now works as follows: Constantly check to see if I can find more friends. Poke. Leech more friends from other friends. Poke. Comment. Poke. Waste time reading cyanide and happiness groups. Poke. Lather. Poke. Rinse. Poke. Repeat. Poke.
One thing I will give Facebook is the fact that their plain-jane layout doesn’t give me nearly as many headaches as Myspace. Gods, I cannot articulate just how much I dislike Myspace for the simple fact that users have too much control over the layout. Flashing black and white stars with skulls and crossbones on a lumo pink background is BAD! Don’t do it!
Oh, before I end this, here is another interesting read. It’s all about how Facebook is secretly funded by the CIA. Enjoy.
Posted in General | No Comments »