Cookies and IFrames Don't Mix

I’m not a fan of IFrames. Let’s just get that out on the table to start with. Every time I use one, it’s against my will and I always feel like it’s a kludge. There - I said it.

Why am I upset with IFrames today? I was trying to set some cookies in a IFrame, where the IFrame was loaded from a different domain from the main page, and the cookies refused to set. I was using the jQuery Cookie plugin, and my code looked like this:

1
2
$.cookie('myCookie', 'Chocolate Chip');
alert($.cookie('myCookie');

And this is what I saw:

I was expecting to have ‘Chocolate Chip’ be shown in the alert. No such luck - my cookie was eaten by the browser.

Read More

What's the Protocol?

On a recent project, @austegard recommended I look into using protocol-less URLs to load jQuery. My initial reaction was that of ignorance - “what is a protocol-less URL?” I quickly found an example:

//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

When I saw it, I thought, “That doesn’t look right. It won’t work.” But I was wrong. Sure, it’s missing an ‘http:’ or ‘https:’ prefix, but it works just fine. Look at the source for this page, and you’ll see that there is no ‘http’ or ‘https’ in the link above. But if you click on it, it loads jQuery without any trouble.

Is this the best way?

Protocolless URLs are interesting, but what’s the point? And what are the other options?

Suppose you have a website, such as contoso.com, and your website is available on both HTTP and HTTPS - at http://www.contoso.com and https://www.contoso.com. Next, suppose you want to load a javascript library from a different server, such as loading jQuery from the CDN link above on the ajax.googleapis.com server.

How can you add a script tag that loads jQuery?

Read More

The 7 Types of Estimates

I’m sure we’ve all estimated tasks. It’s usually not a fun exercise. I can’t make the estimating process any more fun, but hopefully you can have some fun reading about these 7 estimation techniques.

I only like to use the last 2 techniques, but you need the right client and project manager for them to be effective. Hopefully you can avoid the other techniques, but sometimes you are forced to use them.

Feet-To-The-Fire Estimate

This is a commitment, not an estimate. The person asking for the estimate wants the ability to exert pressure on you if you go over this amount. This results in significant overestimation to avoid the pressure.

Read More

The Case of the Case-Sensitive CustomFilter Refiner

While working on a project involving setting up FAST Search Server 2010 for Sharepoint, I ran into trouble setting up a custom date refiner. I was hoping to see refiner values that said things like ‘Last 30 Days’, ‘Last 60 Days’, and ‘Earlier’, but instead I saw this, which is the date ranges for the last 30 days, last 60 days, etc.

This is a problem, because it’s much harder to quickly grasp what the different groups are. Which is easier, to understand ‘Last 30 days’ or ‘From 2012-08-12 to 2012-09-12’? Considering that most of the date range is not visible, this makes it even harder to consume. I wanted to fix this.

Read More

Musings on my Fear of Blogging

A blog post can be scary to write. You’re putting your reputation out there for everyone to judge – and their judgments/comments can be viewed by the entire world.

I have two fears when writing a blog post: First, I fear I’ll write on a topic I’m familiar with, but that is so basic and simple that someone reading it will assume that I don’t really have much depth of knowledge. The second fear I have is that I’ll try writing on something that I’m not very familiar with, someone will point out some huge, obvious blunder I made in my post, and thus my blog post will be revealed as wrong and worthless. And sometimes I’ll have both fears at once about a post I write.


As for the first fear, I need to remember an interesting fact about learning: when you don’t know something, it can seem overwhelming and confusing, but once you work with it and learn it, it’s easy to think that you somehow had perfect intuition and picked up the technology as though it were second nature – and you forget that you were once overwhelmed and confused. So if I’m interested in writing about a technology that seems simple and obvious, I should remember that once it was this crazy, impossible technology that I was clueless about. It’s likely that there is someone else out there who could benefit if I wrote some of my thoughts an experiences down in my blog, even if it seems simple to me at the time. I’m just a couple of steps ahead of them.


As for the second fear, I just need to get over my pride and be willing to put some stuff out there on my blog, even if it might be wrong. If someone else rips it to shreds, it can be a great learning opportunity for me. It is certainly better than continuing in ignorance, and it can help me to connect with someone who is more knowledgeable than I who can help me learn even more.


Have I written anything helpful? anything worthless and stupid? Let me know!

Uglified Unicode on Rails

TL;DR - IE doesn’t like minified unicode. To fix this, create a custom passthrough minifier to disable minification of unicode when using uglify in the rails asset pipeline.

I’m pretty new to rails, so please let me know if I’m off the mark here.

Asset Pipeline

Rails has an interesting component called the asset pipeline that, among other things, can combine all of your js files into one file, and all of your CSS files into another, then it can strip out whitespace and rewrite your code to make it smaller, by doing things such as replacing long variable names with short ones. This is called combining and minifying. Combining and minifying are important because they can help a web page to load faster. A web page can load noticably faster if it has a single 150kb file to load from the server rather than 25 files that are 10kb each.

Without question, we wanted to minify and combine our code using the asset pipeline. For more information on setting up minification, see the asset pipeline documentation.

IE and Unicode Problems

However, we had strange results with the minification. When our code was _not _minified, it worked great in both IE and Chrome. After being minified by the asset pipeline, however, it worked great in Chrome but some parts of our app mysteriously failed in IE.

Read More