Showing posts with label web development. Show all posts
Showing posts with label web development. Show all posts

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.

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.

Social Share! Blogger Widget

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

Social Share! Blogger WidgetThis is the first version of what will be known as Social Share! Blogger Widget. The name is not very cool, I know, but it will have to do. What this widget does is it provides you, the owner of a Blogger blog, with a list of links your visitors can use to share whatever they like on your blog.

I came up with this little widget because I wanted to have an easy way to bookmark or share my posts on social networking sites with the help of a Blogger widget and I couldn't find one that gave me everything I need. If you find it usefull, please feel free to share it with others or install it on your own blog.

The widget currently provides your users 8 easy ways to bookmark or share your content. The list contains so far the following:

The icons used in the widget have been created by plechi.

To install this widget you must have a Blogger weblog. All you have to do after that is click the following button and you will be taken to the installation confirmation page. By default it installs itself in the sidebar, but you can place it wherever you like.

Enjoy it and I hope someone finds this useful. Please let me know if there are any problems and if you have any suggestions on expanding it or improving it. I thought about a few things but I haven't had the chance to implement them because I was too eager to release it. Maybe in a latter version, if it ever catches on.

How to really remove the Blogspot Navbar

The Blogspot Navbar is meant to provide some functionality to the Blogspot users, but let's face it: we don't want it there. It was probably placed at the top of all these blogs for people that don't want to read something in particular and are just browsing. And even if it can bring new users to your blog (very few indeed), it can also take users away. That, added with the fact that it just looks bad, forces many Blogspot blogs to remove it. And here are the ways you can do that.

The "hidden" way

Using this method you are not really removing the Navbar, but you are hiding it so people visiting your blog won't see it. What this involves is adding a CSS rule at the top of your CSS. Here's how to do it: on your blog's Dashboard, go to "Layout" and then to "Edit HTML". Scroll to the beginning of your CSS and on a new line, immediately after

 <b:skin><![CDATA[ 
write the following:
#navbar{display: none;}

The Navbar will still be loaded, but it will not be displayed. If you look at the source of your page you will notice that it is still there. I didn't like that so fortunately there is another way.

The better way

I believe this method to be a little better because the code for the Navbar is not loaded anymore. Using this little hack, the template engine will understand that you want to remove it, and will even ask for confirmation. Here's what you need to do: go to Layout and Edit HTML again. Scroll down to your closing

</head>
tag and just before that, on a new line paste the following:
<!-- </head><body> -->

When you click "Save Template" you will be asked to confirm if you want to remove the "Navbar1" widget. Click on the orange "Confirm & Save" button and that's it. If you look at the source of your page now, you will notice that the Navbar is really gone, not just hidden. Well actually something still remains, but it's just a comment line that is completely harmless. This is the line that actually tells the template engine to display the Navbar. The reason you don't see it when you edit your layout is because it gets added later and this way you "trick" it into getting loaded into an HTML comment. Because of that it won't be parsed, hence it won't be loaded.

And that was my quick "how to" for removing the Blogspot Navbar. I hope someone finds this useful.

Google Chrome: First impressions

Google Chrome Logo

Finally, it's here. As you might already know and as I said earlier today, Google recently announced the launch of their own browser, Google Chrome, version 0.2.149.27. I can't emphasize enough how much I waited for that download link. And the second I reached it, I immediately installed Chrome.

I said in the previous post that I'll get back to you with the first impressions I have about this new application. And here they are. In fact this entire post is written from within Google Chrome.

The first thing I did was check the About section of the browser. I have to say I did't make head or tails from it. I've seen there Mozilla/5.0, AppleWebKit/525.13, Chrome/0.2.149.27 and Safari/525.13. Well, they did say they took the best from all browsers and improved it, but this is getting me dizzy. Let's keep moving on.

One thing that annoyed me from the start is the fact that it installed with the language based on the country I'm in. Although this is seen as a feature for many people, let's put it this way. I hate the way Copy/Paste and other "standard" actions sound in my language. They don't seem natural. I looked for them once for 5 minutes in a drop down menu (a different application) and they were right there in front of my eyes. I know I could have used the shortcuts, but I had a sandwich in my left hand :). Anyway, it's a good thing you can change that from the Options menu.

The next step in the installation was very pleasing. It detected that I have other browsers installed on my machine an offered to import the default search engine, which was Google. And of course, later on, I was able to import the History (visited pages, user settings, passwords) and Bookmarks from my already installed browsers. But one thing eludes me tho: where are my imported bookmarks taken to?

I told you about the Options menu. Well this has been moved. In fact the entire Menu bar has been moved and cut down to just 2(two) buttons. Since it's still in Beta, I imagine this thing will change over time, maybe more buttons and menu items will be added. The Menu bar is now located at the same level with the address/URL bar. The Status bar has disappeared completely. It just appears in the lower left corner when you hover over a link, with a fade in and fade out effect. That's a nice touch in my opinion. Also the standard Title bar that we encounter at almost all Windows applications is gone, being replaced by the Tabs bar. All of these changes are meant to help the user in it's online activities, reducing the screen space taken by the browser to the bare minimum. Another change that I enjoy is the fact that the "Bookmark this page" button that in Firefox 3 was incorporated in the Address bar is in front of it in Chrome. I like this because in Firefox I continually bookmarked pages trying to click the "Go to" (this replaces the star only if you edit the current address, but I sometimes use it to refresh the current page. And yes, I know I could have hit F5, I just don't feel like taking my hand off the mouse sometimes. Or putting down that sandwich :) ). The Search box we encounter in most of the modern browsers has disappeared completely. In fact it has been incorporated into the Address bar. Multitasking?

One of the main features of Google Chrome is it's ability to generate independent processes for each tab. Although this means a greater stability for the application as a whole, when it comes to closing a process, you got me there. Having 5(five) tabs open means the Windows Task Manager shows 7(seven) active "chrome.exe" processes. How am I supposed to know which one is which so I can close it? I guess it will be the one that hugs my entire CPU or memory. Well, no. Another thing that may prove useful is the "about:memory" page. It shows you how much memory each of the open tabs consumes. And because each tab has it's own process, it also shows the PID's (Process ID's) of each tab. This way you know exactly which one is causing you trouble.

One other thing that annoyed me was the fact that when I closed my last tab, completely by accident, the application closed. Of course, closing all the tabs means I'm done and it's a high chance that I will close the browser. But you're not giving me a chance. It would have been nice that the moment you close the last tab, to have the browser display your homepage or that Most Visited page you see when you open a new tab. That's just a personal choice maybe.

Regarding the JavaScript optimization the Google team promised, I'm waiting for some benchmarks to be made by more qualified people, but from what I could tell, there is some improvement in speed. Also there seems to be a pretty good integration with Google Gears, although I never interacted with that too much.

The download manager is pretty cool, it opens in a tab of it's own, no more pop-out windows. Seems easy to use, even if I haven't tried it out yet. How hard can it be? From what I can tell, it has similar functionality like the one in Firefox.

When viewing various pages I noticed an incorporated box informing me that there are some errors on those pages, things like unclosed tags and such, and it would stop the page from loading beyond that point. While this is a great tool for web site developers, I highly doubt the casual user will find any use for it. Unfortunately I didn't manage to disable it. On the other hand it might convince or at least make aware website developers of the need to validate their websites. And speaking of developers, there is a dedicated menu for them where some tools are located: View Source, Debug JavaScript, JavaScript Console and Task Manager.

And those are pretty much my first impressions of Google Chrome. It still has a lot more things to work on and a lot more features to add and improve. Still, it indeed offers a fresh new perspective of how a browser should work. I'm saying this from a resource management point of view. Anyway, I expect to see great things from this browser. Who knows, maybe one day, I'll even make it my browser of choice.

Google Chrome: the new way we see the Internet?

Google Chrome

Like many other people, I've also learned about Google Chrome, the browser Google is planning to launch. To me and probably to many others, this came as a surprise. The collaboration between Google and Firefox is a long and fruitful one. So why did Google start to develop it's own browser, instead of investing more in Firefox?

One possible answer comes from their announcement made on the official Google blog: "Because we believe we can add value for users and, at the same time, help drive innovation on the web". Everyone likes to say that. But can they really deliver?

I took a look at the comic book they made to introduce the features of Google Chrome. What can I say? Looks awesome. The fact that each tab is a separate process with it's own memory allocation and it's own CPU thread would bring a lot of stability to the browser itself (or we could say "browsers", seeing that this approach actually replicates multiple instances of the browser being opened at the same time). I can't remember how many times I had to kill Firefox because of some crappy designed web pages or pages overloaded with Flash, JAVA applets and JavaScript snippets, taking my CPU to 100%. And keeping it there. And that meant closing even the working tabs. Thankfully there was the Session Restore, but it's still not a pleasant thing. So regarding the multi-threading part, I can hardly wait for it.

Now the JavaScript applications. Well, don't get me started. Yes, they're nice, they're useful. But they're huge and resource consuming, they're sometimes slow and they slow down your entire machine. I sure hope their solution works. You can find a detailed explanation of it in the comic book. But with every solution, comes a whole new set of problems. Making JavaScript driven applications use less resources might mean that people will begin to create even more complex applications, and also begin to disregard optimization. Much like what many programmers did when they got better CPU's and a lot more memory. They got lazy.

As stated by the Google team, the Google Chrome browser is largely based on existing Open Source applications. They took what was working and improved it, in their own vision. And what was not working, they made it work. Or at least tried to make it work. I guess the user will be the judge of that. Things like the quick buttons starting page (Opera had that, from what I remember) and the anti-phishing/malware warning that pops out when you're on a suspected page (I remember seeing that many times in Firefox) just prove that the Google team took really into consideration the user.

Since it's still in Beta (and on top of that I haven't had a chance to try it out) I still can't say for sure what I like and how I feel it behaves under "stress". But I'll consider making a new post after I give it a spin. By then I'll be able to say what I like and what I don't particularly like about it. But being a Google fan, I'll try of course to see all the benefits.

Until then, you can find more information on TechCrunch.com here and here.

Attempt to validate a default Blogger template (II)

checklist
Image by RXAphotos

Read the first part of this post: Attempt to validate a default Blogger template (I).

5. This error is caused by an unescaped ampersand ('&') at the import of a dynamic CSS file (http://www.blogger.com/dyn-css/authorization.css?targetBlogID=xxx&zx=xxx). The import is not present in the source HTML, so it is added later. We'll just leave this one alone for now.

6. Many times declaring an incorrect Doctype messes up you entire validation. In this case there was a Strict Doctype declared, but the template included iframe tags (navbar). So I replaced

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">.
Remaining 68 Errors and 62 Warnings.

7. Some of these error are displayed by the "Edit post" button when you are logged in. Comment or delete the line <b:include data='post' name='postQuickEdit'/>. Others are displayed by the comments link at the bottom of the post. I describe how to fix these lower down the page.
Remaining 64 Errors and 58 Warnings.

8. These are personal and intentional errors to accentuate the fact that your posts also need to be written in valid html/xhtml. I added the alt attribute to the image and changed the closing tag to />. This needed to be done in the body of the post, not in the template.
Remaining 58 Errors and 58 Warnings.

9. Errors disappeared because of previous modifications

10. A lot of errors caused by the "Quick Edit Widget" buttons. I removed all of them by commenting them. A easy way to do this is to search for name='quickedit' inside the template and comment the entire element (<b:include name='quickedit'/>).
Remaining 39 Errors and 39 Warnings.

11. Problems caused by the fact that the archive is displayed as Hierarchy. The easiest way to fix this is to change the way the Archive is displayed. For this go to Layout - Page Elements and edit the "Blog Archive" gadget. I changed the Style parameter to Flat list.
Remaining 8 Errors and 8 Warnings.

12. Errors disappeared because of previous modifications

13. Errors caused by the unescaped ampersands in the dynamic css and the comments link. Note that there would be more errors if you have more posts on the specific page you validate (or less if you have less posts). This is the tricky part. Let's start with the comments.
Find the line that says:

<a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'>

The problem is with the expression expr:href='data:post.addCommentUrl'. This gets replaced by something like http://www.blogger.com/comment.g?blogID=xxx&postID=xxx and the problem is the unescaped ampersand. To fix this change the expression to this:
expr:href='"http://www.blogger.com/comment.g?blogID=xxx&amp;amp;postID=" + data:post.id'

where xxx is the id of your own blog. You can find out what your blog id is by viewing the current link. Note the hack that i used after blogID (&amp;amp;). This is because of Blogger's engine: every &amp; is replaced with &, but luckily the engine goes over the template only once. While this is a feature in blog posts, it's a problem in URLs. They do work, but they don't validate. This same method can be applied for "Email post" links if you have that activated. Just make sure you replace "comment.g" with "email-post.g"
Remaining 3 Errors and 3 Warnings.

14. Errors disappeared because of previous modifications

Now the only problems that remain are caused by the loading of a dynamic CSS file. From what I know this is a new "feature" and can not be removed. This first checks whether you are logged in to Blogger and according to that it creates a specific set of CSS rules. And because of the way it is added to the template, it makes it impossible to fix. Unfortunately, this also prevents my Yoboo from validating. And I was so happy when I saw that green bar a while back :(. I'll keep on looking for a solution to this. If anyone has any ideas, you're more than welcome to share.

And that's about all I can do for now (due to lack of time and mood). Note that I focused solely on the front page. It's very possible that other pages still have errors. I hope this helps you minimize the errors you encounter in your own validation experience. If you find that I missed something or you know of other ways to do things, please tell me your own methods to validate a Blogger template.

Attempt to validate a default Blogger template (I)

html/xhtml editing
Image by pitel

Because the previous post regarding validation had somewhat of a success, I decided to do another one. This time I decided to try to validate a default Blogger template and I will also try to be more exact in the steps you need to take. Please note that the solutions I provide might not be the best or they might not be suited for your own template. In several occasions I remove elements I personally do not use, but you might find useful. However the general pointers I give should apply across the entire Blogger platform.

For now, I will deal with the default Minima template. The reason I chose this one is that I consider it to be a very clean one (from a visual point of view), that many people choose for their blogs. And on top of that, it's the one Blogger selects by default when you create a new blog. That being said, let's begin.

Template: Minima
Front page, two test posts
Gadgets: Archive, Profile, Labels
Encoding: utf-8
Doctype: XHTML 1.0 Strict
Initial errors: 339 errors, 73 warnings

Leaving the template HTML unchanged, we do an initial validation check. This is to see the things we need to fix, obviously. So here we are, a list of the main errors, somewhat grouped:

  1. "Missing xmlns attribute for element html. The value should be: http://www.w3.org/1999/xhtml"
  2. Warnings: multiple comments in comment declaration
  3. There is no attribute "name". There is no attribute "description". There is no attribute "type". There is no attribute "default".
  4. Element "Variable" undefined. End tag for "Variable" omitted, but OMITTAG NO was specified
  5. General entity "zx" not defined and no default entity. Reference to entity "zx" for which no system identifier could be generated.
  6. There is no attribute "src" (<iframe src="http://www.blogger.com/navbar.g?targetBlogID=xxx" ... >). There is no attribute "marginwidth". There is no attribute "marginheight". There is no attribute "scrolling". There is no attribute "frameborder". There is no attribute "height". There is no attribute "width". There is no attribute "id". There is no attribute "title". ... element "iframe" undefined.
  7. general entity "postID" not defined and no default entity. reference to entity "postID" for which no system identifier could be generated.
  8. "Required attribute 'alt' not specified" and "End tag for 'img' omitted, but OMITTAG NO was specified"
  9. "There is no attribute 'target'"
  10. several "General entity not defined" caused by de quick edit buttons that you see when you are logged in to Blogger
  11. more "General entity not defined" caused by the archive toggle link
  12. many "XML Parsing Error: Comment not terminated."
  13. many "XML Parsing Error: EntityRef: expecting ';'"
  14. a few "Opening end ending tag mismatch".

 

validation editing
Image by svanes

So now let's start with fixing stuff. I started from the top rather that analyzing what are the major errors and fixing those first. The reason for this is that it's easier for me to follow. You can use whichever order you like. Another way I recommend to start is with the Doctype declaration. Analyze the page, see in which Doctype it fits (or in which one you would like to fit) and change things accordingly.

1. The error is pretty self explaining. When I checked the HTML code, there were already several xmlns declarations, but none of them appeared in the source sode of the page when viewed in browser. So I removed all of them and replaced them with xmlns="http://www.w3.org/1999/xhtml". After saving the template the deleted attributes reappeared. I guess they're needed for something.
Remaining 338 Errors and 73 Warnings.

2. There were two lines of dashes (-) before and after the copyright notice in the template. Although these were commented out, they still caused errors. So I removed them.
Remaining 256 Errors and 73 Warnings.

In the skin section there were more dashed lines under the different sections described by the CSS (header, sidebar, comments, ...) used to separate and organize them. Although only the header section style comments created errors, I removed all the lines just to be sure
Remaining 79 Errors and 62 Warnings.

3. Errors disappeared because of previous modifications

4. Errors disappeared because of previous modifications

Continue to part 2 of this post: Attempt to validate a default Blogger template (II)