Emulate max-width / max-height for Internet Explorer (no extra work needed!)

July 11th, 2009 by Evan

As I’m sure many of you know, Internet Explorer (even IE8) completely ignores the max-width and max-height css properties. I did some Googling but unfortunately all of the stuff I found was for manually setting the max-width/max-height or some similar buffoonery. I’ve written a nice Javascript (uses jQuery) function that you can include in your head tag to emulate proper detection of the max-width and max-height css attributes without doing any extra work after that (so long as it’s in the head of the content you’re loading with max-width/max-height attributes). Feel free to use it but please keep my copyright statement if you don’t mind!

Cheers and happy designing:

function css_emulateMaxWidthHeight() {
/* (c) Evan Roberts - 7/10/2009
www.GoWFB.com - Wholesale Furniture Brokers
Everyone is free to use/mdoify this but please keep the copyright statement!
*/

	$('img').each(function() {		

		if( $(this).css('max-width') != 'none' || $(this).css('max-height') != 'none' ) {

			max_width = $(this).css('max-width').replace(/[^0-9]/g, '');
			max_height = $(this).css('max-height').replace(/[^0-9]/g, '');		

			if( $(this).width() > max_width || $(this).height() > max_height ) {
				if( (max_width / $(this).width()) < (max_height / $(this).height()) ) {
					$(this).css('height', Math.round($(this).height() * (max_width / $(this).width())));
					$(this).css('width', max_width);
				} else {
					$(this).css('width', Math.round($(this).width() * (max_height / $(this).height())));
					$(this).css('height', max_height);
				}

			}
		}
	});
}

$(document).ready(function() {

	css_emulateMaxWidthHeight();

});
Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Bruno!!!

July 10th, 2009 by Evan

So – Bruno is coming. I haven’t been this excited for a movie since – well – maybe ever. I’ve been following the skits posted on facebook and youtube. If you haven’t considered watching Bruno yet, I encourage you to do so.

Preview:

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Want to return to stardom after falling from grace? Easy – just die.

July 8th, 2009 by Evan

When I was a young sprout, I fondly remember the movie “Free Willy” and Michael Jackson singing that song. Even at such a young age, it was vividly apparent that the he had talent. I think it’s probably undeniable that Michael was (and is) one of the greatest musical talents of all time. At any rate – I forget exactly when it was, but it all of a sudden became cool to make child molestation references in association with Michael Jackson. I guess I (and most of the population) pretty much accepted that he was pretty weird and likely a child molester.

I guess what pains me (and obviously a lot of people) is that now, after his death, it becomes apparent just how much on an impact he had on the world, and what a great person he really was. As far as the allegations – well – who knows. I certainly don’t know – but I’m about 150% sure that the last case in 2003 or whatever was 1000% bullshit, and I do recall feeling sort of sorry for him at the time that went down. In any case, it seems that “early death” was just what the media prescribed for Jackson’s defamation, and the medicine certainly appears to have worked.

Rest in peace MJ – I think we owe you a collective apology.

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Air Canada to allow pets in the cabin..

July 2nd, 2009 by Evan

Air Canada passengers can now carry on pets

I’m not sure about the exact details, but it seems like this applies to all flights. I can only hope that this doesn’t apply to international flights. While I’m aware that there are enough “it’s OK if my dog licks my face” pet owning hippie-vegan PETA membership holding animal rights activists in Canada to perhaps economically justify this move, the day a majority of the world thinks this way is the day that the world is ravaged by large herds of newly liberated livestock. It’s probably likely (and it’s definitely fitting) that these smug self righteous airheads probably supported the ban on indoor smoking in Canada while lobbying for the right to inconvenience and disturb others by bringing their animals into the passenger cabin. I wonder how things would go over if I were to light up a smoke to dampen the stench of their pets..

Now, in addition to the already pretty shoddy service that Air Canada provides, passengers can look forward to the possibility of smelling cat shit or listening to a dog yap throughout the flight. Rather than take the chance of this happening to me, I think I’ll just not fly Air Canada until they change this ridiculous policy – I’m ashamed that such an airline is given the right to use my country’s name.

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Teenage cat killer may get 158 years in state prison

June 16th, 2009 by Evan

Floridian Teenage Cat Killer may get 158 years in state prison

What the hell is wrong with the USA? No seriously.

I mean, I understand that this guy probably has some issues, and killing cats is bad or whatever, but 158 years for a bunch of cats? Seriously?

I mean, a cat is worth something like $500 on average I guess, if that. This kid steals and destroys something like $10,000 of cat. To my estimates (at $500 per cat), that means he’s eligible for one year in prison for every $60.13 of damage that he caused.

Since when did animal lives become worth so much, and more importantly, since when did human lives become worth so little?

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

In Canada

June 15th, 2009 by Evan

Well,
I’m in Canada – and it’s just as boring as I’d imagined it would be!

On the bright side:

  • I will finally have the time to get my Zend certification
  • I will make a decent amount of money because of long work hours
  • I may finally get back into shape
  • I may finally get a chance to launch my poker site

I look at this time as – well – prison time. Counting the days. Doing my best to stay alive.

Cheers,

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

The Dziekanski scandal continues..

May 15th, 2009 by Evan

For those who are unfamiliar with Canadian news, or who live with your heads buried in the sand, Robert Dziekanski was a Polish man immigrating to Canada to be with his mother. He’d apparently never flown before, and was at least somewhat frightened by the prospect of human flight – at least of the personal kind. I could drone on about the incident, but to get down to brass tacks, it can be summed up as: man is afraid of flight and stressed out, doesn’t speak English, lost in airport for a long period of time, nobody tries to help him find a translator, he gets agitated and starts throwing things around (as may be the Polish custom – I have no idea about the culture of ex Soviet bloc rubbish countries), security calls the RCMP, the RCMP (4 pretty buff men) come in and taser him, causing five times, including while he is on the ground, kneel on his head, and stand around while he dies. This, by the way, was video recorded, and the video is available on the wikipedia page (I believe – use Google).

OK – so we’ve established that this man was an ignoramus from the hinterlands, but did he deserve to die? Probably not. First off, while not necessarily related, I should point out that one of the officers has since been charged in connection with a fatal hit n’ run incident. Additionally, from watching the video, it’s incredibly obvious that the RCMP officers involved used excessive force.

The RCMP as an organisation, for its part, has been handling the situation far from well, and in my opinion, deserves many a harsh word. They have repeatedly made outrageous claims regarding the incident, such as the suggestion that Dziekanski was showing an “aggressive stance” by raising his hands (hands up – again, watch the video), and now, they give us this:

Psychologist defends claim Mounties panicked in airport Taser incident

Seriously? God keep our land glorious and free indeed.

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

May May May

May 14th, 2009 by Evan

Welp, heading back to Canada at the end of the month. Might get a bit of poker in beforehand. I’ve got a big project to do with work to work on, so I’m sort of excited about that. One of those things that’s been dragging on for a long time, and which should clear the way for rapid progress once it’s complete. Since my cousin (and boss) has the work ethic of a concentration camp inmate, I suppose I’ll be working long days, although that’s not a bad thing as I should be able to save up quite a lot of money.

After these two moths of extreme work, I’ll most likely be visiting family/friends and playing a lot more poker. The games in Alberta were super soft last time I was there, and now that I have a good bankroll, I can only hope that the games are still good.

As far as personal projects, I’m chipping away at pokerscraper in my spare time, and have some work done on hand import classes. I always seem to get hung up on the details, though. Right now I’m pondering the advantages of the Kohana vs Symfony frameworks.

That’s all for now..

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Solution: Secondary LCD monitor flickers when laptop connected to AC power

April 27th, 2009 by Evan

A secondary monitor is a very useful thing when you do anything that requires multitasking. In my case, as a web developer, it’s pretty much essential, at the very least being a huge productivity booster. I had this strange issue with my laptop, though, wherein my secondary LCD monitor would flicker if my laptop was plugged in (connected to AC power). Strangely and baffling to me, though, if my laptop was running from its battery, there was no problem at all. Naturally, this led me to suspect my power supply, my laptop’s AC adaptor, the laptop battery, the power bar, the LCD itself, and even my display drivers. Nothing helped.

Solution: THE VGA CABLE. Now, conventional wisdom would probably lead one to assume that the VGA cables that come in the box with your new LCD monitor would be of at least relatively decent quality. If you’re having the same issue that I had, this is incorrect. Apparently most LCD manufacturers are too cheap to include higher quality dual shielded VGA cables with their monitors. The VGA cable that came with my monitor (BenQ T2200HD) only had a shield (the round thing an inch or so from the plug(s)) for one plug. Replacing the cable with a double shielded cable immediately resolved my problem, to my great relief.

I Googled for untold hours trying to fix this issue, and found some similar posts, but none with a solution. I posted on a tech support forum and none of the techies seemed to know. I am telling the world: GET A DUAL SHIELDED VGA CABLE! Shame on manufacturers that include substandard accessories with their products!

I sincerely hope this post reaches those who need it. If the post happens to help you, leave a comment with your story if you don’t mind =)

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Canada for 2.5 months

April 16th, 2009 by Evan

Well, I’ll be heading back to Canada for 2.5 months on a work/vacation (mostly work) sort of venture. I’m hoping that I’ll be able to stand it, but time will tell. I get the feeling this is a turning point in my life, and I think that however things turn out, it’s going to be for the better!

Social Bookmarks:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • Reddit
  • Technorati
  • Yahoo! Bookmarks