Archive for web


Flex Camp Cleveland was fun

Yesterday I attended Flex Camp Cleveland.

Slides from the presentation “Introduction to Object-Oriented Programming” are available here. Thanks to Kristopher Schultz for the link.

A few random notes and opinions mixed together:

  • Flex is a topic that attracted a lot of people! We had more than a hundred attendees, and at least drove from places like Columbus, Michigan, and Pittsburgh.
  • There’s a lot of technical talent in Ohio. I don’t believe that we have a technical shortage. Instead, we have a shortage of managers and entrepeneurs that know how to build technology-based businesses.
  • Flex addresses a lot of my personal frustrations with HTML. In particular, I’m thrilled to be able to add tags to the language itself.
  • Flex 3.0 is not just zero-cost, but truly open-source.
  • Search engine spiders may have difficulty indexing flex apps, but typically, you don’t want search engines linking into your app. You want them linking into your documentation and marketing text.
  • People say that there’s a difference between being knowledgeable about a subject and being able to teach that subject well. The same thing is true about public speaking. Speaking well is really hard to do. You can easily tell a professional from an amateur.
  • Air is now available on linux, in an alpha state. Hurray!
  • Flex offers server-initiated pushes out to clients. Flex uses a family of protocols to make this happen. Depending on network configuration, it uses anything from a true server-initiated push to client-side polling.
  • We all got flexcamp t-shirts, but they were all sized extra-large. Any reader that wants mine is welcome to it.
  • I’m a command-line snob and don’t like using GUIs to build user interfaces, but I was impressed by how powerful the designer view was in flex builder. I wasn’t impressed enough to pay for it though.

Comments (3)

Web design rap

Comments

Why I still heart k5

Sure, it’s probably one of the meanest spots on the intarweb, but there’s just so many smart people on there. I can get good advice on just about any topic imaginable. Some recent diary posts:

and so forth. And the insults are pretty clever too.

Comments

lolcats apotheosis

The snake is eating its tail.

Comments

Working with em-based widths can be baffling

These four paragraphs have the same number of characters, but because the letter M is fat and the letter I is skinny, different amounts of characters appear in each line:

M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M

I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I

This is the exact same text, but now I’m using a monospace font:

M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M

I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I

Comments

Franz Kafka would like this

I got a subscription to Backyard Poultry magazine earlier this year. It’s awesome. This month’s issue led me to to the City Chicken website. And that led me to this hilarious video that chronicles one man’s quest to find out if he can raise chickens in Chicago:

Update: Cleveland Heights has an ordnance against keeping chickens. Grr. Maybe I can team with the libertarian dude down the street and make a run for city council to get this thrown out.

Comments (2)

jQuery for the win

I needed to toggle some text between “show help” and “hide help”.

First, I wrote this and thought I was good:

<style type="text/css">
span.hide { display:none }
</style>
<script type="text/javascript">
$(document).ready(function () {
    $("a.showhide").click(function (event) {
        $("span.show").toggle();
        $("span.hide").toggle();
        return false;
    })
});
</script>
<a class="showhide"><span class="show">Show Help</span><span class="hide">Hide Help</span></a>

That flips the text from “Show Help” to “Hide Help”. But the code can be made even shorter by calling toggle on both spans at once:

<script type="text/javascript">
$(document).ready(function () {
    $("a.showhide").click(function (event) {
        $("a.showhide span").toggle();
        return false;
    })
});
</script>

I heart jQuery.

Comments (4)

I need the straight dope on jQuery

I really like how tiny the library is. It is nice that I can use selectors to find nodes; for example, $(”li a”) will find all the anchors inside list elements. Furthermore, it seems really well documented. There’s not just one, but several real books all about jQuery available on amazon.

So, what am I overlooking? What’s the terrible secret of jQuery?

Comments (2)

How I spent Saturday night

My wife keeps winning when we play scrabulous. So I wrote some performance-enhancing javascript here to close the gap.

The first time the page loads, you have to download the whole 1.4 mb word dictionary. Then your browser will cache that file locally, so future look-ups are really quick.

There’s at least one bug so far. When you submit your list of tiles like ABCDEFG and your pattern B..Y.. I make a regular expression object where I replace each dot with [ABCDEFG]. So that means I’m not keeping track of how many of each tile you have. If the BGGYGG were a real word, then my function would suggest it, even though this is clearly impossible.

Along with fixing that bug, I want to make a few improvements:

  • Figure out how to make this into a firefox extension.
  • Display the score next to each word suggestion.

Comments

How to use itertools.cycle to set even and odd rows

I find code like this in a lot of web applications:

list_of_x_objects = ['a', 'b', 'c', 'd', 'e']
for i, x in enumerate(list_of_x_objects):
    if i % 2: htmlclass = "odd"
    else: htmlclass = "even"
    print """<li class="%s">%s</li>""" % (htmlclass, x)

Never mind the print statement. That’s just to illustrate the point without having to explain some template syntax.

The same thing can be expressed with itertools.cycle:

list_of_x_objects = ['a', 'b', 'c', 'd', 'e']
for htmlclass, x in zip(itertools.cycle(['odd', 'even']), list_of_x_objects):
    print """<li class="%s">%s</li>""" % (htmlclass, x)

I see several advantages of the second approach:

  • It’s way more flexible. I can easily switch to a style that repeats every three lines (or four, or five…).
  • I don’t create the variable i when all I really want is a class variable that toggles between values.
  • The second approach avoids the modulus operator. Since I hardly ever use the modulus operator, when I do come across it, I always have to take a second and puzzle out what’s happening.

Comments (2)

« Previous entries