Archive for Programming

Katthatt.se is becoming famous ;)

Read this very interesting thread about SEO optimized URLs and note what URL they use as an example :)

SEO Optimized URLs

www.katthatt.se

Flash Reloads on Javascript show/hide

I don’t work that much with flash, especially I don’t tend to show and hide objects on a website with Javascript. Today was an exception.
Apparently, when you hide an flash object with Javascript and then show it again, toggle the visibility if I may, the flash will reload every time you show it. That’s quite annoying, especially if loading the flash involves server calls and such.

It took me a while to confirm that this was actually my problem but once I knew exactly where the problem lie I already had a solution in mind.

Instead of showing/hiding the flash object I move it out of the view by setting the left margin to -10000px. Only doing this will however make sure that the flash still occupies the space it was in and I want to swap the content where the flash was for another div. By positioning all these divs absolute that problem was taken care of. Great news for my end users :)

I won’t post example code as all you really need to do is set position: absolute in the css and then toggle margin-left between 0 and 10000px (or any other value that you like and is enough to hide it) in your Javascript code.

Twitter + Wordpress

It took a while and a bit of trial and error (sorry about that to all of you who subscribe to my feed) but now I think it’s finally working.
I’ve got my Twits on your right and my blog posts will pop-up and be linked in my twits.
This way you can follow my blog or my twits and don’t miss a think. Ain’t it wonderful :)

Photo gallery updates

I’ve updated the photo gallery.
All photos are hosted on Flickr now instead of locally. This means that I’ve done a bit of rebuilding to integrate with Flickrs APIs. It turned out very nice and it wasn’t that hard to do :)

Internet Explorer Vulnerability

It seems Internet Explorer is in trouble.
A security flaw can make any web page malicious and according to Microsoft themselves it isn’t only version 7 of IE that’s affected but every version out there.

In short, if you are using IE, switch your browser now. At least until this has been sorted out,
http://www.mozilla.com/
http://www.google.com/chrome

More information on this topic can be found here:

http://www.microsoft.com/technet/security/advisory/961051.mspx
http://www.f-secure.com/weblog/archives/00001561.html
http://news.bbc.co.uk/1/hi/technology/7784908.stm

Random You Say! Oh, Really…

I don’t know how many times I’ve stumbled across PHP code for generating random strings and numbers that aren’t random at all.

Take this example that I just found for instance:

<?php
...
$RandomStr = md5(microtime());
...
?>

Statement from the author: “…[md5 (microtime ())] use to generate the random string…”. [source]
So very wrong… I can predict the time and hence I can predict the outcome of that piece of code. That’s not random.
If you have a look at the website where I found this you can of course argue that the above snippet would be sufficient and maybe it is enough to fool most bots but it’s still not random and that’s my point.

If you wonder about the definition of Random I think wikipedia is doing quite a good job at it.

Ever Needed an Ajax Loader Image?

I just found this website where you can generate ajax loaders gifs on the fly. They are free to use. Very handy indeed.
www.ajaxload.info

jQuery check all – Final update?

This may, or may not be, the final version of the check all function.
The main diffrence this time is that it’s accutally a jQuery function.
You simply enable it by wrapping a group of check boxes in som kind of box (fieldset, div, td, table, or anything else that feels good) and set a class on the wrapper.

<div class="checkbox-wrapper">
<input type="checkbox" name="box1" />
<input type="checkbox" name="box2" />
</div>
<script type="text/javascript">
$(document).ready(function(){
	$(".checkbox-wrapper").checkall();
});
</script>

Include this function:

/*
* jQuery function: checkall
* Description: Adds a check all box that will toggle the checkboxes within the parent element.
* Options:    text: The text that is displayed next to/the toggle box. Default is "Select/Deselect All"
*/
(function($){
$.fn.checkall = function(options){
var defaultoptions = {
text: "Select/Deselect All"
};
var options = $.extend(defaultoptions, options);
return this.each(function(){
var obj = $(this);
obj.append('<label><input type="checkbox" class="checkallselect" />&nbsp;'+options.text+'</label>');
$(obj.find('.checkallselect')).click(function()
{
obj.find('input[@type=checkbox]').attr('checked', $(this).is(':checked'));
});
});

};
})(jQuery);

Summary of Chris Heilmanns Talks

As I’ve mentioned earlier Chris Heilmann from Yahoo came here last week and talked.

Last Thursday Chris talked at the GeekMeet here in Stockholm and the day after he came to the bwin Games office. He did essentially do the same talks here as he had done at the GeekMeet but I reckon the talks with us where a bit more intimate considering we were about 20 and at the GeekMeet there were about 150 in the audience.

The first talk was a high-level talk about the web. Chris hadn’t really prepared for it so he had no slides but instead he seemed very relaxed and just kept on about the the web, especially 2.0 but also what’s coming in 3.0.
He showed a lot things that’s been done recently in 2.0. Since we had business people attending the first talk he didn’t go into details, instead he showed Firefox plug-ins such as Greasemonkey.

The second talk was about performance on the web. This time he drilled further down and got technical. It was really interesting.
Basically he discussed the major pit falls in web development, especially when you are using a lot of JavaScript, and how you can work your way around them.
He also showed us a lot of useful tools such as smush.it for image optimizing, YSlow for web site load debugging and a couple of simple techniques like minifying and bundling JavaScript includes via APIs. You can find the slides here.

All in all it was two very good talks and it gave me a lot of ideas and tools that I’ll use to improve my sites in the future.

A Visit From Chris Heilmann

Chris Heilmann from Yahoo is in the office today and he’ll have three talks throughout the day out of which I plan to attend two.

He’s just finished his first talk about the future of Javascript and the web.
It was a very high-level talk without too much technical details as there were a lot of business people attending but it was very interesting still. it wasn’t so much how to do things but more what you can do and where we are going with Web3.0, sharing and integrating web applications.
The second talk will be about web performance. From what i understand he’ll show us tips & tricks, what to do, what not to do etc.

I’ll try to get my head around the talk during the weekend and summarize the two when I have digested the contents of them.

« Previous Entries   Next Page »

10 Most Recent Twits

Loading twits...