Nate Weiner

This is an old archived post from my former blog The Idea Shower. It's where I cataloged my product explorations and releases, one of which ultimately became Pocket.

This post was published back in 2007. It may not function as originally intended or may be missing images.

5 Things I Learned this Week.

September 29, 2007

I believe that learning, especially when it comes to being a web developer, should never end. Every week I learn something new that I didn't before. A great thing about the tech community, whenever you run into a problem, you can almost always find someone who is willing to share a solution. I want to give back by sharing the things I learn each week, and linking back to the source. I encourage you to share in the comments what you learned this week as well.

1. Ternary Operator in PHP (and javascript)

$ternary = 'Awesome'; print ($ternany == 'Awesome')?('Yea it sure does'):('No');Outputs: Yea it sure does
It's a much more lightweight way of writing a simple if-statement with two outputs.

Where I learned about it: http://blog.rightbrainnetworks.com/2006/09/18/10-things-you-probably-didnt-know-about-php/

2. When dynamically generating iFrames in IE6 and SSL, their location must be preloaded.

I had a script that was creating empty iFrames serving as an Ajax method. But in IE6, I kept receiving a 'mixed secure and insecure content' warning. Combing through my source code I couldn't find what element wasn't being loaded without https. Well I finally Google'd the problem and found the answer. When I was creating the iFrames, I created them first and then set the src value. I discovered however you need to set the iFrame's src value upon creation with a secure page. If you need a tempory location to point to before loading without an extra page request, you can enter 'javascript:false'.

Where I learned about it: http://crazybob.org/2005/06/ajax-ie-iframe-bug.html

3. RegExp Subpatterns

In javascript, when you call the match method, the RegExp object will hold onto the subpatterns so you can reference them after a match.

var str = 'http://www.website.com/webpage.html'; if (str.match( '([a-z]+\.com)' )) { alert( RegExp.$1 ); } Alerts: 'website.com';

I learned about this from analyzing the iepnghack.htc code written by Aaron Porter.

4. IE6 Flicker, and Solution

Apparently, previously unknown to me, IE6 checks for a newer version of the background-image CSS property on links every time you move the mouse over a link. You can disable this behavior by running an Internet Explorer command:
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
I learned about this from: http://www.mister-pixel.com/#Content__state=

5. You can find diagrams of various plugs by using the word 'Pinouts'

A non-computer savvy friend needed to know the name of the port on a projector. He described it and it sounded like either a Serial Cable or a VGA Cable. I searched to find diagrams of both to send him and had a little trouble till I noticed on the Serial Cable's wikipedia page the diagram was labeled 'Pinout'. Searched for 'VGA Pinout' and bam, had a diagram.

What'd you learn this week?

Leave what you've learned this week in the comments.