Lagoonia - a Sims like game from InnoGames

I got about a week ago an email from InnoGames about a new game they just released: Lagoonia. I talked about InnoGames in previous posts: they're the guys that made The West, Tribal Wars and Grepolis.

It's been a week now since I've been playing Lagoonia and I can't help compare it to EA Games' Sims. I haven't played Sims in a while and I can't say I was a great fan when I did play it, but the two games are very similar. Lagoonia of course is played online, in a browser.

The story of Lagoonia

But let's talk about it a little. At first you are starting out with one player or character, stranded on a deserted island after the plane you were in crashed. You are, from what you can tell, the sole survivor and you need to make everything in your power to make life better for yourself.

You start collecting different items from around the island and from the wreck of the plane, you build a fire, a stack of woods and a hammock. You find a box with chocolate bars and instant coffee that give you some extra energy. And that's how you get by for the first 5-10 minutes of the game.

The plot thickens

You find a bottle with a message inside in the lagoon. After reading the message you realize that there were other survivors of the plane crash. You start building more things that will help you get by and make your life easier. As time passes you consider the chance that you could somehow get together with the other survivors.

After reading a new message from another bottle, you find out the that a survivor stranded on a small island close to yours is going to try to swim to yours, but he/she needs some sort of a heading. So you light a beacon (constructed by you) and then have a companion.

The mechanism of the game

In Lagoonia the game is mainly base on actions you take. You can perform certain actions as long as you have the necessary energy to spend. Energy can be received from different buildings you already have or you will construct.

You start off at level 1 and as time passes and you perform more actions and fulfill the tasks the game sets for you, you gain experience and reach higher levels. Upon reaching a new level you can research and build new structures. These will open up new possibilities, and so on.

I'm not sure how much importance this has, but Lagoonia also introduces a "relationship" function that takes care of the social relationship between your survivors. Later on you will notice that babies will start coming along (from a stork's nest of course).

The items needed for different buildings can be obtained either by searching the island or by making them using the different buildings you have. Some items can be planted, others need to be manufactured from other raw materials. The further you advance in level, newer and more complex items and buildings will appear.

Also, as your level increases, you can explore new sections of your island and find newer and more interesting items around it.

Some tips and tricks

In Lagoonia some buildings can be moved, others can not. In the beginning your fists building will be a small campfire and it can not be moved. You can build 3 of these and you should because they provide you with energy. Make sure you build all three very close to each other so that you won't have to build more than one of the structures that provide them with a bonus in energy: stack of wood (29%) and hammock(14%).

You will begin with a bonus of 200 pearls (the premium currency in Lagoonia - you can get energy, resources and time reductions with pearls). Even if it is tempting to use them to perform certain actions faster, don't. You will receive a task later in the game where you need to spend 200 pearls and those are perfect.


This is my little info on the game Lagoonia from InnoGames. I hope you find it useful and you enjoy the game. If it's anything as complex as the Sims series, I'm sure Lagoonia will become a very addictive occupation.

Die2Nite - a cool zombie game with a twist

I've been playing quite a few games lately since I don't have a lot of activity. And I'm also waiting for the Christmas holidays and I have very little productivity.

So I've been playing DinoRPG for quite a while now, I guess about a year or so, on and off. This week a new announcement came up from the developers saying that they've launched a new game: a zombie game. I guess they planned to launch it before Halloween, but didn't make it. The game is made by MotionTwin, the guys that also have great and popular web games like MyBrute (La Brute in French), Dinoparc and AlphaBounce.

Play Die2Nite zombie game by MotionTwin

The game is called Die2Nite (pretty cool considering it's zombie game) and here's how it works. You are a simple citizen stuck in a town with a lot of other Die2Nite citizens and each night a large number of zombies will attack your town. You need to gather the required materials to upgrade your town and survive the night.

The thing is there are a lot of items that you can find walking around the Die2Nite map and many of these can be used in different ways by either combining them with something else or transforming them in something else, more useful. The number of items is impressive and so is the number of combination that can be achieved. The Wiki's really come in handy here (Die2NiteWiki.com and on Wikia).

Each day you get 6AP (Action Points) to use for your daily activities like exploring, building at the Construction Site or carrying out the dead bodies of your dead comrades (citizens that died in town because of the previous zombie attack).

Of course other things can be done with your AP, but once they're consumed you can have a refill by drinking water from the town's well, eating something, taking drugs or drinking some alcohol (the last two have some funny side effects).

Die2Nite.com zombie gameThe twist in the game is that the whole town needs to work together to survive the night. If people don't communicate and collaborate the town will be overrun and everyone will be dead.

Death is something relative in Die2Nite, because once you die you can start all over again in a new town with new citizens. And the fun starts all over again. You gain points to your soul (the only thing you can't lose) from these experiences in various towns. I guess there's a ranking someone, but I couldn't find it.

If you want to give Die2Nite a try, go right ahead. And let me know if you like it or not. It looks really fun so far and I see it as a game I'll keep playing for a while.

QWOP Game - running is pretty hard

Most of you have probably already heard about the QWOP Game. It' all over the Internet. That's how I found out about it. But for those of you that don't know it yet, here's what it's about.

The QWOP Game is a running simulation game in which the aim is to run as far as possible. You control the legs of your character (named Qwop) and try to synchronize the movement as best as possible. It's apparently pretty hard to achieve a good running distance. All I got so far are 6.8 meters and that after a lot of practice.

QWOP Game - running simulation

The game is controlled using just 4 keys. Go ahead, guess which keys... That's right: Q, W, O and P. The Q and W are used to control the thighs while O and P control the calves. The way you use these keys should mimic the human body movement in running as accurately as possible if you want to run the 100 meters.

A few tips the game developers give us is to start leaning the body forward at the beginning, tapping the O key. Also there seems to be a surprise at 50m and another one at 100m. Has anyone found what these are?

In any case, go ahead and give it a try. You could experience small problems accessing the game page, probably caused by the huge popularity the game is enjoying lately. More information about the game can be found on foddy.net.

If I find some really good tutorials on how to get a better distance I'll update this post. If you find any, please let me know. Also I would like to hear what other people have scored on this game. Leave a comment below. I'll keep practicing a little longer but it's king of frustrating.

Oh, I almost forgot. The link to the QWOP game is below:

Play the QWOP game

KingsAge - fully upgraded city

Today I had some more spare time. I tend to have a lot of that lately. So I decided to find something to do. Being at work, I couldn't exactly play Starcraft, so I began browsing the web in search for a nice little browser game. I came across KingsAge so I gave it a try.

The first thing that stood out was the fact that the map overview resembles the one from TribalWars so I thought that this one is made by the guys at InnoGames. But it's actually made by Gameforge Productions GmbH, the creators of Ikariam.

Now here's the funny part: Grepolis (from InnoGames) looks like Ikariam (from Gameforge) and KingsAge (from Gameforge) looks like TribalWars (from InnoGames). It's like these guys just copy each other :). I'm kidding of course.

But back to KingsAge. I always find it more exciting if I know what I'm going at. In other words, when it comes to browser based games, I want to know what my village/town/polis or whatever it's called, will look like. I want to know how a fully developed city will look like. And since I already made a few mock-ups with Grepolis in the past, I thought I'll give this one a go too.

And here it is, a KingsAge fully developed or upgraded city. And I must say that it looks pretty nice. I don't know why but it reminds me of Age of Empires. As almost any strategy browser game, most buildings have 3 different images that show their level of development. So there are 3 images below, each showing the buildings in the 3 different stages. Some buildings (like the Memorial or the Hideout) have only one image no matter the level and that's why they look the same in all images. The Residence has two images.



I can't really form an opinion on whether I like the game or not. I'll have to play it for a few days. But so far I'm not really impressed with anything in particular. It looks like it's just one more browser game.

PS: These are mock-ups, manufactured images, don't think I've reached that level and that my city is fully upgraded. I might even quit playing in a day or two. Please don't ask me any questions regarding the game also. I'm a newbie too. Check the Help pages and the Forum. You'll find all the information you need there.

aTokens from Entrecard - a new currency platform

A few days ago I remembered that there once a website/service on the Internet that got a lot of attention in the past. I remember every single blogger talked about it and everyone thought it was such a great service. Important players on the "make money online" sector made it really popular and people flooded in. It was called, and still is, Entrecard.

Both praises and critics emerged in regard to that service. Some people, including me, thought it is in no way beneficial to building a community. All it did was attract mass droppers and that's about it. Contests were held and prizes were given. It was a really agitated time for Entrecard. And then nobody seemed to pay attention to it anymore.

By accident I stumbled on a Entrecard drop box about a week ago and I remembered all about it. So I created a new account just to see what else is happening with it. Apparently the community, even if it's not that active anymore, is partly still there. The large players have left. But new people still join.

But this post is not about Entrecard, but rather about a new service they are promoting: aTokens. It seems it's yet another virtual currency platform, but aimed at the social networking area this time. aTokens stand for (a)ppreciation tokens and it's meant to be a way to show your appreciation towards someone. I still don't know what that means in the real world.

The creation of the account is rather simple and it allows you to connect your account with your existing Twitter account, for faster registration. It even has a built-in messaging system similar to the one Twitter has.

To fuel your account you can purchase aTokens through PayPal at a price of $4.99 for 100 tokens. The tokens can latter be transferred between users or can be redeemed for cash or coupons. The main advantage I'm seeing with the redeeming part is the fact that it will attract a lot of people and that's a good thing for a website like this. For any website for that matter. The good part is that aTokens don't just sprout out from the ground. They are created only in exchange of real cash. I guess that creates a stable economy.

Even if it sounds pretty good now i doubt it will last. The thing I suspect will happen is a lot of dead accounts will populate aTokens and it will soon roll over and die. Unless some real hot-shot from the high players makes it popular and some high-traffic online shop adopts it as a form of payment. I hope I'm wrong.

In any case, head on over to aTokens and give it a try. And hey, if you found this post useful I don't mind if you send a few aTokens my way :)

Social Share 2.0 Widget for Blogger

The latest and probably last version of the Social Sharing Widget for Blogger is here. Now at version 2.0, for no particular reason.

The generator has been simplified, no more height/width adjustments. It just fills the space it has. The icons have been changed with the Aquaticus.Social pack from jwloh. A few icons have been created following the same template since there were not in that pack.

In total I have added 11 new social networking sites: Friendfeed, Newsvine, Mixx, SurfPeople, Google Bookmarks, Yahoo! Buzz, LinkedIn, MySpace, Orkut, Friendster and Diigo. There are a lot more out there, but these should be enough. If you have anything else that you would like to see added, just leave a comment below and I'll think about it.

So just select the ones you like, change the order as you please and enjoy!

Select items Select below the items you want to appear in your widget. Make sure you select at least one. An empty widget serves no purpose. You can also drag them to specify the order you would like them to have.

If you have already installed the previous version, make sure you remove it if you plan to use this one. I doesn't matter if you remove it before or after you install this version.

StarCraft 2: Wings of Liberty - you shall be mine

The release of StarCraft 2 has to be one of the greatest gaming events of the year. For me anyway. This is the one game I never tire of waiting for. Ever since I've discovered StarCraft, and later on Brood War, I have waited for a new and hopefully improved version.

There was nothing wrong with the old Starcraft, but you get the urge for something new once in a while. There are what, more that 12 years, since the release of the original StarCraft, and people are still playing it. I doubts any other game in history has had that kind of success.

The very balanced units and abilities of the three races (Terran, Protoss, Zerg), the great resource management, the different technologies available and the ability to play multiplayer games over LAN makes this one of the greatest strategy games of all time. I remember this was the number one game we all wanted to play the moment we installed the local area network in our apartment building. We were hooked.

The rush of killing the Ghost at the very last second before being able to plant the nuke, the frustration of not being able to take down those Siege Tanks while they're clearing your base or the amusement of bringing down a dozen Carriers with a pack of cheap kamikaze Scourge. The long wait against a huge attack or the speed at which a well placed drop can render you useless. I also remember those damn High Templar and their Psionic Storm or the accursed Arbiter with that Stasis Field and Recall, the Battlecruiser's devastating Yamato Gun or the Gurdian's incredibly long atack range. I remember them all. Those were my days of glory in StarCraft.

And now, after so much time waiting and hoping for the release of a new version, StarCraft II: Wings of Liberty makes that dream come true. Damn you Blizzard for making me wait that long. All you did was mess around with that blasted WoW and did nothing for the rest of your players. Even more, you created a first person shooter. Who the hell cares about a first person shooter related to a strategy game? But now it's finally our time. Finally I can carry on interstellar battles against my enemies. I will bring them pain and despair and maybe I'll even live long enough to tell the tale.

This has got to be the only thing I have waited for this long. Just a few more days until July 27th and StarCraft 2: Wings of Liberty will be in my grasp. We shall meet again dear friends: Terran, Protoss, even you Zerg. Again we shall battle 'til the last man. And glory shall be ours!

Mathletics - the children's mathematical resource

mathletics logo - visit mathletics.co.uk for mathematical learning

Mathletics - I came across this by accident earlier today, and since I noticed that I haven'tpublished anything else lately, I thought I should give it a go. Oh, and I also found it interesting.

Mathletics, run by 3P Learning Pty Ltd, describes itself as "Australia's most used educational website". I can't argue with that, since I don't live in Australia and I've finished school a few years now. But even if it's dedicated to Australian kids we all know that maths is universally identical no matter the country. It doesn't even matter on what planet you write a formula, according to maths, the result will always be the same. We can't say the same thing about physics for example.

Mathletics is aimed at students aged 5 to 18 and is one of the world's most used mathematics educational website. It is built in such a way that it will help student improve those aspects that they feel uncomfortable with. The website provides children a fun way to learn what most of us consider a torment: mathematics. if something like this would have existed back in the days I went to schol, maybe the stress would have been a lot less present: "Will I pass this year? Will the teacher flunk me?" The horror!

Mathletics UK is the website's version aimed at those students that live in the United Kingdom. There are also versions for some other countries across the globe, like the United States, Canada or South Africa. More details can be found on their official blog, at blog.mathletics.com along with the website addresses.

So,if you have a child that's not doing so great on maths, go to the Matheletics website and give it a try. It's most likely not the means to turning your kid in a maths genius, but at least it might get him to learn a few things. And maybe, just maybe,pass the year.

CodeIgniter resources/checklist thingy

This is a list of resources for CodeIgniter that I've put together mainly because I find myself way too often searching the web for something in particular to use when I start a new project in CodeIgniter and I need to set up some default configuration options. And I almost always end up on the same pages. You could consider this a list of bookmarks of checklist, because that's what it basically is. I hope someone else can find it useful and if you think there are more things that need to be added to the list, just leave a comment below with a link to the page where to find it.

The list will be sorted in a few basic categories so they are easier to navigate.

Configuring the framework - initial steps

mod_rewrite for CodeIgniter - directly from the official wiki this tutorial shows how to rewrite the URLs on Apache servers with mod_rewrite enabled. This is a great way of creating user friendly URLs by removing the index.php from the address/link and includes a detailed explanation of how it works. It's worth setting this up from the very start.

Encription key generator - there are many random string generators on the web, but I almost always use this one because it allows you to select both the length of the generated string (32 characters is recommended for CodeIgniter) and the type of characters used in the string

Managing multiple applications - even if you don't plan to set up multiple applications it is good practice to move the "application" folder out of the default CodeIgniter "system" folder. This also allows you to update the framework easier if you need to by replacing only the system folder, but also have several applications using the same "system" folder. This however will become obsolete with CodeIgniter 2.0 because the "application" folder is moved outside by default.

Configuring the work environment

Autocomplete for Netbeans - I personally prefer Netbeans over Eclipse when writing PHP code. But one frustrating thing is the lack of autocomplete. This page describes the process of enabling autocomplete for CodeIgniter in Netbeans for all the CodeIgniter system libraries, helper functions, but you can also add your own libraries and models.

CodeIgniter Quick Reference Cheatsheet - not really fits in the configuring stage, but it is related to the work environment and a handy thing to have around. It saves a lot of time from alt-tabbing and searching the User Guide. There are several cheat sheets on the web and you can pick any one of them, but be sure to use one close, if not exactly made for the CodeIgniter version you're using, as several functions have been deprecated or renamed over time and even more have been added.

CodeIgniter Tutorials

The CodeIgniter User Guide - your number one place to go before asking a dumb question on the forums. You get a copy of this when you download your copy of CodeIgniter so it's good manners to refer to that one instead of using the online copy.

The official intro videos - these will give you a quick insight of what CodeIgniter can do but too bad that there are only two of them

Derek Allard's AJAX tutorial - I found this very useful and easy to follow. It does help the fact that Derek Allard is Technology Architect at EllisLab, the company behind CodeIgniter. On top of that the tutorial can have a lot of applications AS-IS in your own projects.

The CodeIgniter tutorial list - many CodeIgniter tutorials gathered from all over the internet. A pretty long list of great resources.

CodeIgniter Directory - a growing directory of resources (helpers, libraries) and tutorials

Codeigniter resources - helpers, libraries

Code - Elliot Haughin - a page of several great libraries and ports for some of the most popular social platforms right now. If you plan to develop a social networking application, it's worth taking a look at this page. Unfortunately Elliot also had a few great screen casts on his website which are no longer available.

CodeIgniter Directory - I repeat the CodeIgniter Directory because it easily fits into this category also. It is a great place to start when you need something specific.


Again, I will update the list if I think of anything else or if anyone throws me a link to a specific resource worth adding.

How to make a CSS3 and JavaScript analog clock

1 2 3 4 5 6 7 8 9 10 11 12

This is a "How To" guiding the ones that are interesting in the creation of an analog clock, similar to the one on the left, with CSS3 and jQuery. First of all, I would like to say that this is in no way a useful method of placing an analog clock on your website. It's only meant as an experiment with CSS3. If you do want an analog clock, you could probably use Flash or an image based JavaScript clock.

I used as a reference the Windows 7 sidebar clock, but it's not a perfect copy. I could have added a lot more details to make it look closer to the real one, but it would have made it a lot more difficult to implement.

Internet Explorer (any version) has not been targeted for this experiment due to it's lack of CSS3 support, so don't be surprised if it doesn't work. Making it functional in Internet Explorer would have over-complicated the JavaScript, attempting to make it work with IE's filters. With that out of the way, let's get started.

The HTML

All the styles will be set in the stylesheet later on, so don't bother with it for now. You can see there are a lot of tags that make the clock very heavy. That's why this is not a good way to create an analog clock for use on your website.

The div#clock will hold everything together. The div.hour-marks holds all the numbers and hour marks. We could have done without it, but it's good to have some sort of container just for those. The next 3 divs are the clock handles (hours, minutes, seconds). The last span is the round circle in the center of the clock.

<div id="clock">
 <div class="back"></div>

 <div class="hour-marks">
  <span class="mark m1"></span>
  <span class="mark m2"></span>
  <span class="mark m3"></span>
  <span class="mark m4"></span>
  <span class="mark m5"></span>
  <span class="mark m6"></span>
  <span class="mark m7"></span>
  <span class="mark m8"></span>
  <span class="mark m9"></span>
  <span class="mark m10"></span>
  <span class="mark m11"></span>
  <span class="mark m12"></span>
  <span class="hour h1">1</span>
  <span class="hour h2">2</span>
  <span class="hour h3">3</span>
  <span class="hour h4">4</span>
  <span class="hour h5">5</span>
  <span class="hour h6">6</span>
  <span class="hour h7">7</span>
  <span class="hour h8">8</span>
  <span class="hour h9">9</span>
  <span class="hour h10">10</span>
  <span class="hour h11">11</span>
  <span class="hour h12">12</span>
 </div>

 <div class="hour-handle"><span class="handle"></span></div>
 <div class="minute-handle"><span class="handle"></span></div>
 <div class="seconds-handle"><span class="handle"></span></div>

 <span class="center"><span></span></span>
</div>

The CSS

Oh man, this is a lot of CSS for something so trivial. Let's try to lay it out.

We're going to start with our clock div, or better yet, div#clock and standard CSS. I gave it a width and height of 200px, but you can change that to whatever you like. Take note however that you will need to modify the position of the dandles and marks also. Actually you will need to modify pretty much everything. Position:relative will allow us to position everything else inside it with position:absolute.

div#clock{
 width: 200px;
 height: 200px;
 position: relative;
 }

Now for the fun part. We don't need a rectangular clock. That would look unattractive. Instead we will make it round with the border-radius feature in CSS3. This allows you to make the corners of a box element round. But if you take it all the way up, that box will turn into a circle. For that you need to specify at least half of the width or height, in this case 100px. This works best for squares as it creates a perfect circle. The first rule is the standard CSS3 declaration. This is used by Opera also. The next one is the proprietary declaration for Gecko based browsers (Firefox, Flock) and the last, but not least, is the proprietary declaration for Webkit based browsers (Safari, Chrome).

div#clock{
 border-radius: 100px;
 -moz-border-radius: 100px;
 -webkit-border-radius: 100px;
 }

To make it look a little nicer, we'll add a gradient for the background. First the standard CSS background. Opera will use this as it does not have a linear gradient method implemented yet. The second one is for Mozilla and the third for Webkit.

div#clock{
 background: #3a3937;
 background: -moz-linear-gradient(right 240deg, #3a3937, #1b1d1c);
 background: -webkit-gradient(linear, right top, left bottom, from(#3a3937), to(#1b1d1c));
 }

Now we're adding a drop-shadow around our clock, just to make it stand out a bit. This can be changed to look like a halo on a dark background. The color can be changed and also the size of the shadow.

div#clock{
 box-shadow: 0 0 10px #666;
 -moz-box-shadow: 0 0 10px #666;
 -webkit-box-shadow: 0 0 10px #666;
 }

These methods will be used throughout the stylesheet, so there's no point in describing each of them. Here's some more of the CSS:

div#clock div.back{
 width: 184px;
 height: 184px;
 position: absolute;
 top: 8px;
 left: 8px;

 border-radius: 92px;
 -moz-border-radius: 92px;
 -webkit-border-radius: 92px;

 background: #fffdf4;
 background: -moz-linear-gradient(top 260deg, #fffdf4, #e2dfce);
 background: -webkit-gradient(linear, center top, center bottom, from(#fffdf4), to(#e2dfce));

 box-shadow: inset 0 0 5px #000;
 -moz-box-shadow: inset 0 0 9px #000;
 -webkit-box-shadow: inset 0 0 9px #000;
}
div#clock div.hour-marks span{
 display: block;
 position: absolute;
}
div#clock div.hour-marks span.mark{ background: #333; width: 8px; height: 3px;}
div#clock div.hour-marks span.hour{
 font-size: 14px;
 text-align: center;
 font-family: Helvetica, Arial, sans-serif;
 color: #444;
}
div#clock span.center,div#clock span.center span{
 position: absolute;
 top: 95px;
 left: 95px;
 background: #333;
 width: 10px;
 height: 10px;

 border-radius: 5px;
 -moz-border-radius: 5px;
 -webkit-border-radius: 5px;
}
div#clock span.center span{ width: 6px; height: 6px; top: 2px; left: 2px; background: #666;}

In order to rotate our hour marks so they face towards the center of the clock, we will be using -*-transform: rotate(). This rotates the element by a specific number of degrees. Since we have 12 hours and a circle has 360 degrees, each mark will be rotated at 30 degree intervals. The positioning of these marks are more of a guess. I didn't feel like finding a method of calculating where each of them should go on a circle. So I positioned them by eye.

div#clock div.hour-marks span.m1 {-moz-transform: rotate(-60deg); -webkit-transform: rotate(-60deg); -o-transform: rotate(-60deg); top:  22px; right:  52px;}
div#clock div.hour-marks span.m2 {-moz-transform: rotate(-30deg); -webkit-transform: rotate(-30deg); -o-transform: rotate(-30deg); top:  52px; right:  22px;}
div#clock div.hour-marks span.m3 {-moz-transform: rotate(0deg);   -webkit-transform: rotate(0deg);   -o-transform: rotate(0deg);   top: 100px; right:   8px;}
div#clock div.hour-marks span.m4 {-moz-transform: rotate(30deg);  -webkit-transform: rotate(30deg);  -o-transform: rotate(30deg);  top: 146px; right:  22px;}
div#clock div.hour-marks span.m5 {-moz-transform: rotate(60deg);  -webkit-transform: rotate(60deg);  -o-transform: rotate(60deg);  top: 176px; right:  54px;}
div#clock div.hour-marks span.m6 {-moz-transform: rotate(90deg);  -webkit-transform: rotate(90deg);  -o-transform: rotate(90deg);  top: 188px; right:  95px;}
div#clock div.hour-marks span.m7 {-moz-transform: rotate(120deg); -webkit-transform: rotate(120deg); -o-transform: rotate(120deg); top: 176px; right: 140px;}
div#clock div.hour-marks span.m8 {-moz-transform: rotate(150deg); -webkit-transform: rotate(150deg); -o-transform: rotate(150deg); top: 146px; right: 170px;}
div#clock div.hour-marks span.m9 {-moz-transform: rotate(180deg); -webkit-transform: rotate(180deg); -o-transform: rotate(180deg); top: 100px; right: 184px;}
div#clock div.hour-marks span.m10{-moz-transform: rotate(210deg); -webkit-transform: rotate(210deg); -o-transform: rotate(210deg); top:  52px; right: 170px;}
div#clock div.hour-marks span.m11{-moz-transform: rotate(240deg); -webkit-transform: rotate(240deg); -o-transform: rotate(240deg); top:  22px; right: 140px;}
div#clock div.hour-marks span.m12{-moz-transform: rotate(270deg); -webkit-transform: rotate(270deg); -o-transform: rotate(270deg); top:  10px; right:  95px;}

div#clock div.hour-marks span.h1 { top:  27px; right:  62px;}
div#clock div.hour-marks span.h2 { top:  50px; right:  35px;}
div#clock div.hour-marks span.h3 { top:  90px; right:  20px; font-weight: bold; font-size: 16px}
div#clock div.hour-marks span.h4 { top: 130px; right:  35px;}
div#clock div.hour-marks span.h5 { top: 153px; right:  62px;}
div#clock div.hour-marks span.h6 { top: 163px; right:  95px; font-weight: bold;font-size: 16px}
div#clock div.hour-marks span.h7 { top: 153px; right: 132px;}
div#clock div.hour-marks span.h8 { top: 130px; right: 160px;}
div#clock div.hour-marks span.h9 { top:  90px; right: 170px; font-weight: bold;font-size: 16px}
div#clock div.hour-marks span.h10{ top:  50px; right: 160px;}
div#clock div.hour-marks span.h11{ top:  27px; right: 132px;}
div#clock div.hour-marks span.h12{ top:  20px; right: 100px; font-weight: bold;font-size: 16px}

The handles are also rotated using CSS3 and JavaScript. To make them rotate around a certain axis, we need to set the transformation origin. If we don't do that, they would just spin in one place, like the needle on a compass.

div#clock div.hour-handle, div#clock div.minute-handle, div#clock div.seconds-handle{
 height: 55px;
 width: 6px;
 position: absolute;
 top: 45px;
 left: 97px;
 overflow: hidden;

 -moz-transform-origin: 50% 100%;
 -webkit-transform-origin: 50% 100%;
 -o-transform-origin: 50% 100%;
}
div#clock div.minute-handle{ height: 80px; top: 20px; width: 4px}
div#clock div.seconds-handle{ height: 80px; top: 20px; left: 100px; width: 1px;}

The color for the handles is given by the inside span.handle. This will also suffer some transformations, in order to become pointed towards one end. In this case we will skew them along the Y axis by a huge amount. The number of degrees indicates the angle at which the skewing is make. This increases the height of the handle, but it's parent container has overflow:hidden and the only part that we can see is the one that we nee: a nice sharp clock handle.

div#clock div.hour-handle .handle, div#clock div.minute-handle .handle, div#clock div.seconds-handle .handle{
 display: block;
 background: #333;
 width: 180%;
 height: 100%;

 -moz-transform: skewY(-84deg);
 -webkit-transform: skewY(-84deg);
 -o-transform: skewY(-84deg);
}
div#clock div.minute-handle .handle{
 -moz-transform: skewY(-86deg); 
 -webkit-transform: skewY(-86deg); 
 -o-transform: skewY(-86deg);
}
div#clock div.seconds-handle .handle{
 -moz-transform: skewY(-88deg); 
 -webkit-transform: skewY(-88deg); 
 -o-transform: skewY(-88deg); 
 background: #f00;
}

That's about all the CSS required for our analog clock.

The JavaScript - jQuery, what else?

After loading the jQuery framework (1.4.2 in this case, but older versions might work) we can add the JavaScript required for the clock to function. It does this by repeating a function every second with the help of setInterval(). Read the comments below for more information. The position / angle of the handles is modified each time the function is run using the same -*-transform: rotate() method described in the CSS.

/* make sure everything is loaded */
$(document).ready(function(){
 /*
 *  this function is run every second to update the clock handles
 */
 function setClock(){
  /* get the handles of the clock */
  var hourHandle = $('div#clock div.hour-handle');
  var minuteHandle = $('div#clock div.minute-handle');
  var secondsHandle = $('div#clock div.seconds-handle');
  /* get the current date from te users computer */
  var now = new Date();

  /* 
  * determine the degrees we need to rotate each handle 
  * we need to create this variable as a string here, before applying it
  */
  var hourDeg = 'rotate(' + ((now.getHours() * 30) + Math.floor(now.getMinutes() / 2)) + 'deg)';
  var minDeg = 'rotate(' + (now.getMinutes() * 6) + 'deg)';
  var secDeg = 'rotate(' + (now.getSeconds() * 6) + 'deg)';

  /* change the CSS for each of the handles */
  hourHandle.css({
   '-moz-transform': hourDeg,
   '-webkit-transform': hourDeg,
   '-o-transform': hourDeg
  });
  minuteHandle.css({
   '-moz-transform': minDeg,
   '-webkit-transform': minDeg,
   '-o-transform': minDeg
  });
  secondsHandle.css({
   '-moz-transform': secDeg,
   '-webkit-transform': secDeg,
   '-o-transform': secDeg
  });
 }

 /* call the function every second */
 setInterval( setClock, 1000);
 });

This is all there is to it. A working example can be seen at the top of this page. I would like to repeat myself: this is not a good way to add an analog clock to your website. It's just a way of showing what can be done with CSS3. Here is the complete code used to make the clock.

The HTML

The CSS

The JavaScript

If you have any comments or questions, please let me know.

To validate or not to validate?

This post is intended to address the issue of HTML validation from my point of view. I will try to point out the advantages and the reasons a web page needs to validate (again from my point of view of course), but I will try to line out a few other opinions on the matter. Long story short, I will try to answer a simple question: "Should I care about validation or not ?"

What is HTML validation?

For those of you that still don't know what validation really is, here is the short explanation. Validation is the process by which an HTML or XHTML page, meaning it's source, is brought in accordance with world wide accepted standards. What this means is actually writing the source code of the page in such a manner that is respects all the guidelines implemented by the W3C (that's the World Wide Web Consortium). In order to make sure your web page is valid from an HTML or XHTML point of view, you can use a lot of different tools, but my favorite is the online one provided by W3C at http://validator.w3.org. Simply type in the URI of your page or copy/paste your code and hit the "Check" button. That's it.

Does it even matter?

Believe it or not, it does. There are people that say that validation is just something that developers thought up to brag about their skill. Others just don't care if it's not valid as long as it works. But here is where the funny thing comes in. For it to work it still needs to be coded after some specific guidelines, so unintentionally people do give a though to validation. After all, they do want their pages to look nice, don't they?

There are many situations when a page full of errors looks flawless, the layout is just the way it was planned. That doesn't mean it's right and that it doesn't need to be coded differently. It just means the browser is aware there are bad developers or that errors might slip by unnoticed and it just ignores the situations and renders things just like nothing happened, mostly "guessing" how things should have been.

So browsers fix things for me. Then why should I bother to validate?

The idea here is that browsers can't fix everything. There are situations when you do need a valid page and a well thought out structure. One of the most common situations i when you're using JavaScript, like the many wonderful frameworks available out there (jQuery, MooTools, Dojo to name just a few). These don't bother to check your code, they just use what they are given.

For example if you forget to close a paragraph (<p> tag), the browser will render just fine. When it finds the next paragraph tag or the next block element, it assumes you closed the previous one. But if you use some JavaScript code to work on your paragraph tags, let's say for example that you want to change their background when you hover over them, errors will appear. JavaScript will assume that the paragraph ends when it meets the closing tag (</p>), but that will cause the change to be applied to the next elements (maybe other paragraph or maybe lists), until that closing tag is met.

That's all? Closing tags?

No, that's not all. Because browsers continue to evolve and improve, a strict set of rules is required. And these rules must be respected by everyone, both website owners and browser developers. If they are ignored, progress will be just a long list of hacks and fixes from either side. Browser developer will try to support obsolete and sometimes wrong interpretations of standards just to please the users and not render the pages chaotically. And website owner and developers will try to work around browser incorrect renderings by various CSS, HTML or JavaScript hacks.


In closing, I would like to say that I try my best to make every page as valid from a W3 point of view as possible. There are situations when it's jut too much work and it's not worth rewriting the entire code just to shift a few pixels. But these days things are a lot more easy. Modern browsers even support standards not yet officially recognized in preparation for when they will be made generally accepted, like CSS3. The only thing developers need to do is focus on the new implementations (which are already pretty old by now) and leave behind the old hacks. And if a browser doesn't display the page the right way, it just means it's the browser's fault. Most likely it's an outdated version and the users should upgrade for their own sake.

On the same note, I would like to keep a moment of silence for the soon to be dead and hopefully forever forgotten, IE6. Your death's coming soon.

Source: StatCounter Global Stats - Browser Version Market Share

Social Share 1.5 - the new and improved social sharing Blogger widget

A new version of this widget has been released. You can find it here: Social Share 2.0

Having a little spare time and not being particularly happy with the first version of my "Social Share!" widget, I thought I can make a better one. And I believe I did. Introducing "Social Share 1.5" Blogger widget. It's not a great improvement when it comes to how it looks, but rather how it is generated.

The new generator uses jQuery to dynamically update the widget code and allows for a greater customization of the widget. You now have the possibility of choosing which links should appear in the widget. The order of the links can also be changed by drag & drop. You can also select from a range of color schemes for the icons.

From a design point of view, it's not at all brilliant. But the fact that the code can be changed easily allows a more flexible evolution of the widget, in the sens that future changes can be implemented with much more ease. So without any further ado, I invite you to use the generator bellow to generate your very own Social Share! 1.5 Blogger widget.

Appearence Below you can select the size of the widget and the icon set it will use. If you leave the sizes empty or auto, the widget will fill the entyre width of the container unless other CSS rules are applied to it by your template. px Auto

px Auto

Select items Select below the items you want to appear in your widget. Make sure you select at least one. An empty widget serves no purpose. You can also drag them to specify the order you would like them to have.

If you have already installed the previous version, make sure you remove it if you plan to use this one. I doesn't matter if you remove it before or after you install this version.

Please stay tuned for future releases. If you like this widget, all comments are welcomed and tune in soon for a new version. I plan to make the next one (maybe named "Social Share 1.6" as an external script. Hopefully it will allow dinamic updrade of the widget in the sense that you will not need to reinstall it manually. So make sure you come back soon.

PS: if you notice a long time has passed and no new version has been released, drop me a comment. I might have forgotten.

How to get Slimbox to work with Blogger

I planned to make this happen for some time now: getting Slimbox to work with Blogger's quirky platform. But the solutions I always come up with never seem to be any viable ones. But today I finally managed to make it work in a way that satisfies me. If you want to know how, read on.

Firstly, the problem is the incapability to host the files required for Slimbox on a server (unless you're running on your own server/hosting account and not the free *.blogspot.com). Slimbox provides a very nice way of presenting an image or even a collection of images. For those that do not know, Slimbox is a clone of the original Lightbox. I prefer Slimbox because it's more lightweight as file size and also file count. The original Lightbox was built using the Prototype framework, which I personally never liked, and Slimbox comes in two flavors: MooTools and jQuery. So if you use any of those, you are safe to go for Slimbox.

But the issue at hand is not the history or origins of Slimbox, but rather the way we need to go to implement it into Blogger. So let's get started.

  1. Include the jQuery framework in your Blogger layout's html. Because we can't just upload it, we'll use the one Google places at our disposal here. So just go like this in your <head> tag:
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
    I went here for version 1.3.2 but you can use whichever you'd like
  2. That's one down. Now we need to include the Slimbox files. Head on over and download them from digitalia.be. At the moment of this writing, the latest version is 2.03. Once downloaded unpack them somewhere on your hard drive where you can find them
  3. Uploading the files to our host is again an issue, as we don't have one. But Google yet again comes to our aid. Go to Google Sites and make a new website or use an existing site if you have one already. Having a Blogger account, I assume it shouldn't be too hard. On your Google Site click the "More Actions" button, go to Manage and click Attachments. Upload the slimbox2.js and image files you unpacked from the Slimbox archive. Don't upload slimbox2.css yet. You need to edit that first
  4. Open slimbox2.css with your favorite editor (please don't use Microsoft Word, I don't feel like explaining why it won't work if you have any problems) and edit the location of the image files. There are 4 of them, all of which you should have already uploaded to your Google site (closelabel.gif, loading.gif, nextlabel.gif and prevlabel.gif). Make sure you replace the url in the css file so they point to the location of your uploaded images. You can find out the location if you hover over the download link in your Google Sites Attachments section. You can skip the last part of the URL, after the file extension, the one with "?attredirects...". You don't need that. After you're done editing the slimbox2.css you can upload that one too
  5. Get back to editing your Blogger layout and add the JavaScript and CSS files from your Google site. It should look something like this:
    <link href='http://sites.google.com/site/your_site/slimbox2.css' rel='stylesheet' type='text/css'/>
    <script src='http://sites.google.com/site/your_site/slimbox2.js' type='text/javascript'></script>
    
    Make sure the HREF and SRC attributes point to your uploaded files.
  6. That' about it! Now all you have to do is place a rel="lightbox" (or rel="lightbox[some_name]" if you would like to group them) attribute on the links that point to an image and you want it/them to have Lightbox/Slimbox capabilities. More on how Slimbox works and available features can be found on the official website. For a working example you can check out this page. At the end you will find a gallery of just 5 images and you will be able to scroll through them left/right.

One issue I had was with the fact that the links to images uploaded through Blogger were not pointing to the image itself but rather to a Picasa page containing the image and the Lighbox was activated but no image was displayed. To fix this I had to right-click the image in that page (Picasa page) and click "View image" in Firefox. After that replace the SRC in the link tag with the one of the image. A little more work but it gets the things working.

That's all I went through to get Slimbox working on a Blogger blog. Hope anyone find this useful. If you have any questions/suggestions feel free to leave a comment.

Grepolis - fully upgraded city

Because I had a little spare time on my hands I started playing Grepolis, the latest game from InnoGames. I enjoy this kind of strategy games but they can be very time consuming and you get really frustrated when you lose everything you've worked for over night. That's the reason why I quit playing by the time my city is fully developed. But this time I decided I would have a look at how a fully developed city would look like. And If anyone else is interested, here's a sneak peak.

The first one show the Grepolis city with all the building at the level 1 and with the Oracle and Thermal Baths built. Some of them will change appearance as they level up but some will remain the same. The second image shows the Grepolis building at intermediary levels and the last three show the city with the buildings at their top level. Also the Olympic Games and the Triumph are in full display and all the buildings that have animation have been activated, as if they're working. Sadly, I don't have the patience to make an animated version of the town so you'll have to settle for the static ones.

Because certain building in Grepolis city view share the same spot in town, the last three images show the various buildings in this order:

  1. Library and Tower
  2. Theater and Trade Office
  3. Thermal Baths and Oracle

One thing I didn't manage to display is the Statue. I'm not even sure how it's supposed to look like, but it should occupy the same place as the Oracle, Tower and Trade Office.

Grepolis town buildings level 1 Grepolis town buildings level 2 Grepolis town buildings level 3 with library and tower Grepolis town buildings level 3 with theater and trade office Grepolis town buildings level 3 with thermal and oracle

And after all the trouble I went through, I found this little app that would have made everything extremely easy. It even shows the Grepolis statues. Bummer! Oh well, that's life. At least my pictures have the Olympic and Triumph in town :-)

Oh, oh, and if you find the pictures helpfull and would like to give the game a go, please use this link: Sign up to Grepolis. Thanks.