Andrew Jaswa

Software, Daily

I recently had a harddrive crash in my MBP and it got me thinking about the software I use on a daily basis, since I had to restore all of it.

  1. Chrome, probably one of the best browsers out there today.
  2. Firefox, still use FF from dev work and some sites.
  3. Coda, a great all around code editor.
  4. MacVim, my co-workers have gotten me hooked on MacVim, though there are still some things I like about Coda so it won’t be taking over as my full time editor, maybe 50/50.
  5. Adium, what is there to say? All around best IM client there is?
  6. Transmit, another great tool from the guys at Panic, you can mount (s)ftp servers as local drives and other magical things with this tool.
  7. Clusters, compresses files on your harddrive seamlessly. I’ve already saved 15.6 gigs.

That pretty much sums up the software I use every day. I have to admit, when I started this list I thought it would be longer. I guess I use more websites and cloud services than I thought.

category life,software
June 19, 2011

Internet Explorer and line breaks

Recently I’ve run into an interesting issue where Internet Explorer won’t break on some lines when there is a string followed by a space followed by a period followed by a string. For example: “I’ve written some text here .So that I can illustrate this issue.” I’ve made a mistake and put the period on the wrong side of the space, I’m not the best typist in the world so this happens to me from time to time.

.exe .jpg .gif .php .html .flv .doc .pages .zip .pdf .torrent .mp3 .mov .wmv

My issue steams from hit highlighting in search results. Our back-end database automatically adds code similar to this for the search term “foo”:

<span>Found In:&lt/span> ...<span class="hitHighlight">foo</span> ...<span class="hitHighlight">foo</span> ...<span class="hitHighlight">foo</span> ...

Now normally this wouldn’t be an issue and probably would go unnoticed but there are some cases where the search term is rather long. ( I’ve been working on a Finnish site and the term I’m having issues with is “Kappaletavarakuljetukset”. ) When the search term is long we want the text to wrap on to the next line. Which in IE it won’t unless you force it by adding <wbr> or another space after the period.

You might be able to imagine there are some legitimate places you will want to place “text .text”. However as in my case its not really legitimate and due to the Microsoft (!) back-end we are using to produce the code/text its rather difficult to change the generated code.

Update: Since the bug isn’t overly apparent in non-IE browsers… Screenshots:

Non-IE:
Non-ie

IE:
IE

Update2: It seems that <wbr> doesn’t work in all cases. Sadly in my case in IE8, I had to add an extra space.

category code
September 17, 2010

Markup Conditionals

I loathe conditional comments and browser targeted code. But there comes a time when you have to support an old and out dated browser (I’m looking in the direction of IE6 at the moment). So what do you do? You have to make it look the same and function the same as other browsers. You also shouldn’t use browser hacks to target them. I’ve touched on this subject before and figured conditional comments were the best route to go. Even if I don’t like them.

I’ve recently started working with a new company and have picked up on some of the bright things they do. I’m not sure why I never thought of this before since it seems so simple (and I can’t take credit for it).

Let say you have your standard body element and a few other things on a page:

<body>
    <div>
        <p>Some text</p>
    </div>
</body>

Typically to target the paragraph element for, say IE6, you might use a simple hack like the underscore hack. So you might write some CSS like so:

p {
    width:150px;
    _width:200px;
}

I mean you might do that, some other hack or you might use conditional comments to provide a style sheet just for IE6. I’m sure you’ve seen code like this before:

<!--[if IE 6]>
    <link rel="stylesheet" type="text/css"
       href="ie6.css" />
<![endif]-->

That’s all fine and dandy, but do you see what you did there? I did and I don’t like it. You’ve just created another HTTP request. Shame on you. And to think about how many CSS rules are typically in a file like that? 10? 50? It also creates a maintenance headache. You’ve now split up rules for one element into two files. Yes yes I know that is what the cascade is for… But you could make it easier on yourself and people that come behind you.

What I’ve found is to use conditional comments to specify a class on the body element when the browser is IE6 or 7 or even 8.

So taking our markup example from above I’ve modified it to have conditional comments in it:

<!--[if IE 6]><body class="IE6"><![endif]-->
<!--[if !IE ]><!--><body><!--<![endif]-->
    <div>
        <p>Some text</p>
    </div>
</body>

You’ll need all those extra comments to make the page valid. It is also pretty easy to add as many combinations as you like as long as they can be read by the browsers…
And our CSS from above:

p {
    width:150px;
}
.IE6 p {
    width:200px;
}

Of course this only works with IE but really you shouldn’t need this at all since you build awesome websites that are already cross-browser compatible, right? And there is no chance ever that a client will want a site to be usable in IE5.5, right?

category code,websites
tags: , ,
May 13, 2009
Andrew Jaswa