Read posts about programming

September 15

DjangoCon Videos [django, programming] (Clint Ecker (clintology)) by Clint Ecker

It looks like six of the videos from DjangoCon have been posted:

Here’s Cal Henderson’s funny, Why I Hate Django talk:

and some more:

Click here for all the videos from DjangoCon.

Posted in: django , programming
September 10

My DjangoCon coverage for Ars Technica [django, programming, technology] (Clint Ecker (clintology)) by Clint Ecker

I just wanted everyone to know about all my DjangoCon 2008 conference coverage that I did for Ars Technica while I was attending the event this past weekend.

Django: The framework for ponies with magical powers

I agree totally with Brian Veloso that the conference was probably the best I’d ever attended. The infrastructure and logistics provided by Google were second to none and the small, focused group of attendees was just right.

Here are the posts I made:

There’s one more coming up that wraps up the final day of the conference, so keep an eye out for that one. I took a lot of photos while there which you can see in my Flickr photoset:

Posted in: django , programming , technology
August 13

My new job: Project Manager at Condé Nast [ars technica, internet, programming, social networking, technology] (Clint Ecker (clintology)) by Clint Ecker

I made a post last week that I was going to be ending my employment at Stone Ward, where I’ve worked for the past two years. It was a really hard decision and I’ve turned down lots of jobs because I’m great friends with my coworkers and I genuinely loved the job.

However, when the opportunity came around to work for another set of friends at a really awesome company like Condé Nast and on an awesome publication like Ars Technica, it was an offer I couldn’t turn down.

As of Monday, I’m going to be working full time on Ars—mostly doing programmer stuff, but also covering events and writing up technical stories for various sections of the site. I’ll be joining a bunch of other full-time employees (including Jacqui) in the new tech capitol of the universe, Chicago, IL.

Rock on!

Posted in: ars technica , internet , programming , social networking , technology
July 18

django-oembed is awesome [django, programming, social networking] (Clint Ecker (clintology)) by Clint Ecker

Have I mentioned that django-oembed is awesome? oEmbed is a data exchange protocol that content providers (Flickr, YouTube, Digg, Revision3, Vimeo, et cetera) can supports that lets you programatically determine how best to display their content. oEmbed is an open standard that was spearheaded by Leah Culver of Pownce and she made a post on the subject when the project was announced.

Imagine this scenario: You’ve got the URL to a YouTube video. You can link to that page easily enough, but what you really want to do is embed that video on your blog. How do you do that? You can go to the YouTube page and ferret out the proper embed codes, but those are different for every site.

To embed content from Vimeo or Rev3 is different than from Youtube and Viddler. oEmbed lets each of these services run an oEmbed endpoint into which you pass a URL resource and get back an XML response with all the necessary information for embedding the content.

Even more fantastic than oEmbed is django-oembed, a small Django project by Eric Florenzano. It contains a few data models and fixtures that define a pretty good set of content providers and their endpoints. The real meat is in the {% oembed %} tag that you can wrap around a URL and which pops out the correct embed codes!

You might’ve noticed the tag stuck into my last post because I’m now using it to embed YouTube videos in my tumble/lifestream page sourced from FriendFeed & django-friendly.

Posted in: django , programming , social networking
July 17

django-friendly: New template tags for FriendFeed data [programming, social networking] (Clint Ecker (clintology)) by Clint Ecker

Just a friendly (ho!) update on some of the things I’ve added to my FriendFeed Django application, django-friendly recently. I needed a way to pull out all the media from an entry. As I mentioned in my original post, getting at that stuff was a nasty mess of object attributes in your templates, so I set out to fix that.

To that end I’ve created a few media-related tags. The first is get_friendfeed_media_list

get_friendfeed_media_list

This is very straightforward as it works just like comments and likes. You might use it in this manner (see second line):

{% get_friendfeed_media_list for [friendfeed_id] as [varname] (limit) %}

 ...
{% for entry in object_list %}
{% get_friendfeed_media_list for entry.ff_id as media %}
{% if media %}
  <dd class="media">
  {% for m in media %}
  {% ifequal entry.service.ff_id 'youtube' %}
    {% oembed 160x120 %}{{ entry.link }}{% endoembed %}
  {% else %}
  <a href="{{ entry.link }}">
    <img src="{{ m.mediathumbnail_set.all.0.url }}"/>
  </a>
  {% endifequal %}
  {% endfor %}
  </dd>
{% endif %}
{% endfor %}
...

In some instances you might want to just grab the first thumbnail of the first media object associated with an entry. I use this a lot when displaying Flickr entries in that photo strip at the top of my site. For those instances, I’ve created a tag called get_friendfeed_first_media_thumbnail. You’d use it in this manner:

{% get_friendfeed_first_media_thumbnail for [friendfeed_id] as [varname] %}

...
{% get_friendfeed_entry_list for 'flickr' 12 as flickr_photos %}
<div class="column span-24 first last" id="photos">
    {% for photo in flickr_photos %}
        {% get_friendfeed_first_media_thumbnail for photo.ff_id as thumbnail %}
            <a href="{{ photo.link }}" rel="photo">
            <img src="{{ thumbnail.url }}" 
                width="{{ thumbnail.width }}" 
                height="{{ thumbnail.height }}">
            </a>
    {% endfor %}
</div>
...

I’m thinking about adding some other tags, but so far, I’m not sure. I think I’ll let these percolate for a little while and see if I need any new ones.

Posted in: programming , social networking
July 13

Site converted to django-friendly: FriendFeed integration [django, internet, programming, social networking] (Clint Ecker (clintology)) by Clint Ecker

I posted about it on Twitter this afternoon, but I finally succumbed to the FriendFeed trend and I’m going to let them do the hard work of aggregating my life stream and normalizing it. Honestly, I don’t need to fight the never-ending battle of scraping and parsing a billion feeds when a company flush with cash and smart people can do it for me, right? :)

What’s great is that they provide a fabulous API and so I took some time yesterday to build a Django application I call django-friendly that you can pop into your site to integrate everything on your FriendFeed (entries, likes, comments, media) into your own site!

  • Download and install the Python FriendFeed API module somewhere on your Python path
  • Grab the application from the Google Code project site
  • Add the line friendly to your settings.py
  • Add a setting to your settings.py called FRIENDFEED_NICKNAME and set it to your FriendFeed username.
  • Perform a ./manage.py syncdb
  • Go through the management commands I detail below to back fill in some information if you’d like. Alternatively you can just set up a cron tab to periodically call the general case: ./manage.py feed --feeds --likes
  • Dig into the template tags I detail below to start displaying the information on your site in interesting ways!

There are a few models that implement all of the normalized fields that FriendFeed can return back to you, such as your entries, services, FriendFeed users, media, thumbnails, et cetera.

There’s a few management commands you can script to call on a regular basis to synchronize your database. Here are some possible usage cases:

This will pull the most recent 30 entries and insert any new comments, likes, entries, and so forth.

./manage.py feed --feeds

This will go back as far as it can (around 330 entries) and gather all the appropriate links and such:

./manage.py feed --feeds --all

You can get more items from other services by filtering what you pull like this. This will pull the 30 most recent Flickr entries

./manage.py feed --feeds --service flickr

This will pull all the Flickr entries it can get at:

./manage.py feed --feeds --service flickr --all

The service name you supply is a FriendFeed specified nickname for the service. They are typically pretty guessable (googlereader, twitter, pownce, googletalk, lastfm, et cetera). The only one that might not be apparent are pure FriendFeed items which are specified using the internal nickname.

You can pull in your liked items with the following command:

./manage.py feed --likes

All of the other arguments (—all, —service) apply for likes as well. In fact you can pull your items and likes at the same time like so:

./manage.py feed --feeds --likes --all

Template tags

There are currently only two template tags for pulling FriendFeed information into your templates.

get_friendfeed_entry_list

This is a fairly complex tag; it was built to the specifications I needed for my blog here, and I think it’s fairly applicable to nearly any use case. Here’s how it works, first you’ve got the load the friendly template tags:

{% load friendly %}

Then you can call the tag like this (simple case):

{% get_friendfeed_entry_list for 'all' 30 as friendfeed_entries %}

This will pull 30 most recent entries from all services and stick the resulting list of entries into a context variable called friendfeed_entries which you can loop over and access just like any other template variable. For example:

{% for entry in friendfeed_entries %}
<li>
  <img src="{{ entry.service.iconURL}}"> 
  <a href="{{ entry.link }}">{{ entry.title }}</a>
</li>
{% endfor %}

You can get a lot more complex. Lets say you wanted to pull any kind of entry except Flickr photos:

{% get_friendfeed_entry_list for 'all' except 'flickr' as no_flickr %}

You can even specify multiple services to exclude:

{% get_friendfeed_entry_list for 'all' except 'flickr|picasa|smugmug' as no_photos %}

As you might’ve excpected, you can do the same when you filter. You can specify only certain services to be pulled instead of all of them like so:

{% get_friendfeed_entry_list for 'lastfm|pandora' 30 as music %}
{% get_friendfeed_entry_list for 'reddit|digg|googlereader' 100 as links %}
Getting likes

You can use standard model methods to get the likes on an entry. For example to show a like-count:

{{ entry.num_likes }} {{ entry.num_likes|pluralize:"person,people" }} liked this.

You could alternative iterate over entry.like_set.all to print out each like.

Issues with this tag

Currently, the process of pulling out media thumbnails is a bit ugly. I hope to write some convenience methods. This is how you have to do it now:

{% get_friendfeed_entry_list for 'flickr' 12 as flickr_photos %}
{% for photo in flickr_photos %}
<a href="{{ photo.link }}" rel="photo" class="image" title="{{ photo.title }}">
 <img src="{{ photo.media_set.all.0.mediathumbnail_set.all.0.url }}">
</a>
{% endfor %}

Nasty, right?

get_friendfeed_comment_list

For any FriendFeed entry, there’s the possibility that you or others have left comments. In the case of Google Reader (and Reddit and Digg I believe) your comments on a story are imported into FriendFeed as the first comment.

You can use this tag to pull out comments by everyon or by a specific person. The specific case is what I use to filter out just my comments. You can use it like thus:

 {% get_friendfeed_entry_list for 'all' as object_list %}
 {% for entry in object_list %}
   {% get_friendfeed_comment_list for entry.ff_id as my_comments by 'clint' %}
   <dt>
     <img src="{{ entry.service.iconURL }}"> 
     <a href="{{ entry.link }}">{{ entry.title }}</a>
   </dt>

   {% if my_comments %}
   {% for comment in my_comments %}
     <dd>{{ comment.body }}</dd>
   {% endfor %}
   {% endif %}
 {% endfor %}

You could leave out the by 'clint' argument to get comments by all users on the entries.

I think that’s all there is right now. You can see how I’ve put all of this into action here on my site in the middle sidebar and in my Life Stream page. I paginated the results using the awesome django-pagination application.

Posted in: django , internet , programming , social networking
July 9

django-galaxy: a reusable feed aggregator in Django [django, internet, programming] (Clint Ecker (clintology)) by Clint Ecker

I’m flooding the site with Django stuff lately, but I’ve had a recent burst of productivity that I attribute almost solely to my reading of James Bennett‘s new book, Practical Django Projects.

This particular project isn’t completely done yet, but it mostly works. I just need to make this public to force me to get it to where I want it to be.

The idea is this: I maintain one or two sites that aggregate posts from other people’s blogs. Typically these are called “planet” sites after the first popular bit of software that performed this task. They’re very popular in aggregating blog posts from tight knit communities.

There is a Django project I use on ArsLounge called FeedJack, but there are a lot of things I don’t find to be optimal. One of those is that it’s hard to just plug FeedJack into your existing projects and start overriding things in a Django-ish way.

With that, I’ve started a simple project I call django-galaxy that aims to fill that gap for me. It’s essentially some models to represent Blogs and Posts, some basic templates for basic display, and it tries to make as much use of generic views (and other such things) as to be as extensible and configurable as possible.

The real magic comes in with the script you have to run on a regular basic to comb your feeds. This uses the venerable feedparser project by Mark Pilgrim and goes above and beyond to determine if an RSS feed has bad date-support, supports tagging (and uses django-tagging) when appropriate. There’s a bunch of other junk in there to handle janky feed, which are more prevalent than you might imagine!

Since many planet-esque sites are topical in nature and you can’t always come into possession of a category/tag feed for every site, I’ve also included a method of processing entries to determine if they are “on topic” for your site.

Right now I’ve got it a bit too coupled with my testing set of Django sites, but you can get an idea of how it works. Basically, it helps me filters out posts on xxxxx topic so I can exclude someone’s posts about their family vacations which are not on topic for a topical aggregation site.

This works by performing a keyword search across a post’s content and subject. You can provide a dictionary of as many terms as you find necessary.

Another neat thing is a method to clean up what I call junky feeds. In my experience, some HTML markup that ends up in feeds does not lend itself well to re-aggregation. So I’ve written a process to strip out comments, div tags, header tags, weird paragraph tags, and such.

If you’re interested, please take a look at my first check-in on Google Code (which I’ve been working on in another repository for a while now) and let me know what you think!

Posted in: django , internet , programming
July 8

Allow template tags in Flatpages (and chunks) [django, programming] (Clint Ecker (clintology)) by Clint Ecker

One of the big downfalls of storing bits of templates in your database is that you’re limited to HTML/CSS/JavaScript. Individuals editing flatpages can’t use template filters or other bits of Django’s awesome templating language.

Usually this doesn’t make much sense, but for one CMS use-case (linking to other pages by identifier and not hard-coding their URL), it could make a big different.

In that vein, Kyle Fox posted a comment on my post about django-chunks and mentioned that he had developed a template tag that allows individuals to insert Django templating language into Flatpages (and chunks!)

This tag will let you write django template code into, for example, a Flatpage’s content and render it with the current context. So if you had a template tag called “getlatestnews” and wanted to add latest news to a flatpage, just enter this in the flatpage’s content:

{% get_latest_news 5 as news %} 
{% for article in news %}
    <li>{{ article.title }}</li>
{% endfor %}

This ability has proven extremely useful to us. Please note this is just a “summary” snippet to illustrate the concept. Use in a production environment should include more robust error checking.

Øyvind Saltvik also wrote in to tell me about two other projects that allow you to store more of your projects in the database:

Thanks everyone!

Posted in: django , programming
July 7

Super simple Google Analytics for your Django projects [django, programming] (Clint Ecker (clintology)) by Clint Ecker

I just whipped together another really simple Django application I call django-google-analytics that simplifies the process of inserting Google Analytics tags into your Django projects.

Why did I create this?

I manage a lot of Django projects that present slightly-different forms to users depending on the site/domain they’re visiting. There’s also a bunch of custom submission code that differs from form to form, but that’s neither here nor there.

I need different Google Analytics codes depending on the sites and after sticking these tags into every single template, I thought it would be cool to be able to manage these Google analytics accounts from the Django admin page. I also added a mode of operation that excludes the admin interface altogether (you can just use the template tag)

Aren’t there other solutions already?

In my searches I ran across two methods that have been around for a while but which I didn’t find to be adequate. The first is a Google Analytics middleware by Will Larson. This method inspects each request, searches it for a <body> tag and dynamically insert the google analytics code.

The bad thing is that the template for the tags are hard coded into the middleware, and as far as I know, this kind of defeats the purpose of caching, as a regular expression and some other code must be called for every request. You’ve also got to purposefully exclude the admin interface, which most people are never going to want to track anyway.

Finally, you can’t tie GA codes to sites (you can specify them in different settings files, though) and have them inserted properly. I like the ability to administer as much as possible from the admin (when ideal).

The second method I found was a snippet that defined a simple template tag which replicates the second mode of operation you see below. It’s a little raw, but it works. The main downside with this is that, again, you cannot edit the codes from the admin interface and you can’t tie them to specific sites.

Two modes of operation

Administering and associating codes with Django sites

  1. Add the google_analytics application to your INSTALLED_APPS section of your settings.py. This mode requires that you be using the Django sites framework too, so make sure you have that set up as well.
  2. Run a ./manage.py syncdb to add the database tables
  3. Go to your project’s admin page (usually /admin/) and click into a site objects
  4. You’ll now see a new field under the normal site information called “Analytics Code”. In this box you put your unique analytics code for your project’s domain. It looks like UA-xxxxxx-x and save the site.
  5. In your base template (usually a base.html) insert this tag at the very top: {% load analytics %}
  6. In the same template, insert the following code right before the closing body tag: {% analytics %}

Just using the template tag

  1. Add the google_analytics application to your INSTALLED_APPS section of your settings.py.
  2. In your base template, usually a base.html, insert this tag at the very top: {% load analytics %}
  3. In the same template, insert the following code right before the closing body tag: {% analytics "UA-xxxxxx-x" %} the UA-xxxxxx-x is a unique Google Analytics code for you domain when you sign up for a new account.

One problem

I’m not sure how to avoid this, but if you only want to use the second method and you do a syncdb you’re going to get the model added to your database whether you want it or not.

My best advice at the moment would be to ignore that (smile), but if anyone knows how I can make the database portion an optional install, that’d be much appreciated advice!

Posted in: django , programming
July 6

RestrictMiddleware [django, programming] (Clint Ecker (clintology)) by Clint Ecker

Here’s another one that I’ve yanked out of a project. I call it RestrictMiddlware and it is a real simple, and really easily bypassed “security” mechanism. Like most security, it’s just security theater, but some clients make it so hard to enable true security that you’ve got to resort to this type of stuff.

As a warning, I’d really emphasize that you shouldn’t ever use this type of access restriction on any site that contains truly secure, private, or sensitive material. Use strong user logins or better.

This is the RestrictMiddleware and you just pop it into your Django settings.py under the MIDDLEWARE_CLASSES section. By default, this middleware is going to deny access to every request, so a little bit of configuration is required. This is all laid out in much detail in the documentation of this middleware; the following items must be added to your settings.py for the middleware to pick them up.

RESTRICT_IP_WHITELIST: a list or tuple of strings representing IP addresses

RESTRICT_REFERRER_WHITELIST: a list or tuple of strings to be searched as substrings in a request’s HTTP_REFERRER

RESTRICT_GET_CODE: a dictionary of key/value pairs which, if specified, will be checked for complete equality with a client’s GET paramters.

RESTRICT_COOKIE_NAME: a string representing the name of a cookie that will be checked at the beginning of the process and will be set if any of the tests pass.

RESTRICT_ACCESS_DENIED_MESSAGE: a string that will be displayed to the user in the event of no tests being passed.

Some examples:

RESTRICT_IP_WHITELIST = (
    '127.0.0.1',
    '24.39.293.222',
    '24.39.292.222',
)

RESTRICT_COOKIE_NAME = 'my_auth'

RESTRICT_GET_CODE = { 'i': 'ae723bff82e8f', }

RESTRICT_ACCESS_DENIED_MESSAGE = 'You're not authorized.  Get out!'

This middleware applies up to four tests on a request. If any of them pass, a session variable, and the request is passed on. In the documentation and in the examples above, the term cookie is still used. This isn’t an accurate representation of what actually takes place. Django maintains a single cookie in a user’s browser with a unique session hash. When a client is marked as safe, a special session variable is flipped to “true” on the server side. This is a little bit “safer” than what I imply in the code.

As you might’ve guessed, the first test is to see if the session variable has already been set. The second is if the request’s IP is in the IP white list. The third is if the referrer is in the white listed referrer list. The final test are the “get codes”. If a dictionary of “get codes” is supplied, this test only passes if all of the codes are present in the request and their values match exactly.

As I mentioned before, only one of these tests must evaluate to true for a request to be considered valid and the client marked as safe (session variable set). A future improvement might be to allow a user configure which tests must pass (or all of them) before a request is considered valid. Another might be to ditch the session variable altogether and validate every single request.

Posted in: django , programming

django-chunks [django, programming] (Clint Ecker (clintology)) by Clint Ecker

I’ve built an impressively simple and basic reusable Django application in the process of creating a mini-CMS for a client. It’s called django-chunks and it’s really nothing more than a model and a template tag.

By adding chunks to your installed apps list in your Django project and performing a ./manage.py syncdb, you’ll be able to add as many “keyed” bits of content chunks to your site.

The idea here is that you can create a chunk of content, name it with a unique key (for example: home_page_left_bottom) and then you can call this content from a normal template.

Why would anyone want this?

Well it essentially allows someone to define “chunks” (I had wanted to call it blocks, but that would be very confusing for obvious reasons) of content in your template that can be directly edited from the awesome Django admin interface. Throwing a rich text editor control on top of it make it even easier.

Usage:

{% load chunks %}
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <h1> Blah blah blah</h1>
        <div id="sidebar">
            ...
        </div>
        <div id="left">
            {% chunk "home_page_left" %}
        </div>
        <div id="right">
            {% chunk "home_page_right" %}
        </div>
    </body>
</html>

This is really helpful in those cases where you want to use django.contrib.flatpages but you need multiple content areas. I hope this is helpful to people and I’ll be making minor edits as I see them necessary.

Posted in: django , programming
May 13

Django project idea: Disqus application [django, internet, programming] (Clint Ecker (clintology)) by Clint Ecker

I’m putting this out there because I can see there’s a need for it. Disqus, which I mentioned in my previous post, has a couple of methods of integration.

The method I chose, the quick and dirty route, is to insert a chunk of JavaScript in certain places on your blog that injects comment counts, a comment thread, and a comment box into your page.

On the other side, is a great potential for true integration with your custom blog or site. Disqus has a fairly full featured API:

All API methods accept their parameters in the query string of a GET request. All requests MUST end with a trailing slash (before the query string). Requests are currently throttled per IP address. In the event that you are throttled, the data is retrieved from a cache of the previous request. Slug parameters are human-readable unique identifiers (usually a string shortword for describing an object, such as a thread’s title).

It is conceivable that an individual could construct a model or two that contains all of the information returns by Disqus’ API.

One hang up

The only issue I can see is trigging the importing of new comments. The comment form will likely have to be either constructed in a similar manner as the form injected via iframe when you slap the JavaScript bit into your site, or mimicked somehow. The submission of the comment (to Disqus’ server) would, ideally, trigger a refresh of the comments via the API.

The first problem is how you throw a local trigger on a submission to a site you don’t control. The second problem is the delay you’ll no doubt encounter in bringing that comment into your local system.

As it stands, most users expect their comment to show up once the page reloads, and it doesn’t seem entirely possible with the current API (or perhaps the documentation is out of date?). I would love if someone more familiar with Disqus or a developer could fill in any gaps I might’ve missed!

Posted in: django , internet , programming
April 20

Made some updates to the site [django, programming, site news] (Clint Ecker (clintology)) by Clint Ecker

I fixed a bug in my Google Reader feed processor that was making some of the stuff I shared through Google Reader lose the actual content (except for title and link).

So if you follow my link blog through any of the RSS feeds on this site, you should start to notice that they’re much cooler now ;)

I also cleaned up the middle sidebar you see on the home page of the site by separating out Tweets, songs, and links into their own lists. So now I list the 5 most recent tweets, 5 most recent songs, and the 100 most recent links.

On the Django side, I broke all that stuff out into their own context processors and their own template bits so I can include them piecemeal elsewhere on the site:

I’ve done just that. Now on all the interior pages of the site, I include my last 5 tweets and songs below the right sidebar:

I also added a very short bit of text under my photo over there, for those people who don’t want to click through to my about page.

Posted in: django , programming , site news
April 18

So, the Balticon Programming Schedule is a little blank... (Punkadyne Labs (Punkwalrus))

I got a call for program ideas from Balticon programming (well, she's calling on everyone, not just me). They are mostly dead for Friday, Monday, and need more "fannish programming."

I could suggest my staples, but what would YOU guys want me to talk about?

Keep in mind, I only feel comfortable about subject matter I actually KNOW, but that hasn't stopped me in the past. I once hosted a panel on Heinlein, and I hadn't actually read any books of his since high school, and I didn't like what I read. So I sat up there and challenged anyone to know more than me about Heinlein than me to come up and prove it. And they did. I didn't have to do anything but moderate and ask random questions to my new panelists.

They don't call 'em "cons" for nothin'... :) Posted in: balticon , programming
April 16

Django question of the day: two apps, relating them [django, programming] (Clint Ecker (clintology)) by Clint Ecker

Here’s a quick question to the Django people following my blog, and one I think will be a huge help to individuals attempting to perform something similar.

I’m currently working on a project that could make use of Nathan Borror’s excellent django-basic-places and django-basic-people applications.

I’m loving them so far, and getting a lot done. However, one thing that I would like to do is allow for a Person to be associated as an “owner” of a place. If I were writing all of these as a cohesive application, I would add an ForeignKey field to the Place model and link it up to the Person model.

Those apps, however, should be standalone and not linked and kept as generic as they are. So how can I link these two models in my project? Should I create some sort of intermediary model that relate the two? Is that too much of a hack?

Is there some mechanism I’m just plain overlooking?

Posted in: django , programming
March 14

Nerd Alert [blogging, django, programming] (Clint Ecker (clintology)) by Clint Ecker

I know the going is slow here. I’ve been doing a lot more nerd blogging over on our Stone Ward Interactive blog. So if you’re into web development and other technical subjects, check it out!

Posted in: blogging , django , programming
February 7

South by Southwest Interactive [internet, marketing, programming, social networking, technology] (Clint Ecker (clintology)) by Clint Ecker

Yes, Jacqui and I are heading south this March. To Austin, Texas for South by Southwest, or SXSW as the kids say. A lot of really cool people from all over the country who also happen to be friends are going too. I am also excited to be attending my first conference in a long time where I am not media.

That means I can have fun, enjoy things, learn stuff, goof around with friends, stay up as late as I want, and get a pony for Christmas too!

For those who may not know exactly what South by Southwest Interactive is, just watch this video by ZeFrank.

So what should we definitely do when we’re in Austin? Furthermore, what good panels should I definitely not miss?

So far I am pretty sure I want to attend the following, but scheduling may work against me and I will most likely not likely get to see them all:

  • Saturday
    • AJAX and Flash Mistakes (Jonathan Boutelle)
    • 10 Things We’ve Learned at 37signals (Jason Fried)
    • Go For IT! Attracting Girls to Technology (Clare Richardson)
    • Quit Your Day Job and Vlog (Tim Shey)
    • The Suxorz: The Worst Ten Social Media Ad Campaigns of 2007 (Henry Copeland)
    • The Weird Turn Pro: Crowdsourcing For Creatives (Derek Powazek)
    • Worst Website Ever: That’s So Crazy, It Just Might Work (Andy Baio)
  • Sunday
    • A/B Testing: Design Friend or Foe? (Corey Chandler)
    • 10 Tips for Managing a Creative Environment (Bryan Mason)
    • Tools for Enchantment: 20 Ways to Woo Users (Kathy Sierra)
    • Wireframing in a Web 2.0 World (Richard Rutter)
    • Magic and Mental Models: Using Illusion to Simplify Designs (Jared M. Spool)
  • Monday
    • A Critical Look At OpenID (Jason Levitt)
    • Building Developer-Friendly Web Service APIs (Ben Vinegar)
    • Self Replicating Awesomeness: The Marketing of No Marketing (Brian Oberkirch)
    • The Web Agency: There Will be Blood (Chris Bernard)
    • What User Generated Video Means to Word of Mouth Advertising (Daphne Kwon)
  • Tuesday
    • Considerations for Scalabale Web Ventures (Chris Lea)
    • Creative Collaboration: Building Web Apps Together (Paul Hammond)
    • Secrets of JavaScript Libraries (John Resig)
    • Using Entertainment to Create Effective Mobile Advertising (Adam Zbar)

I have bolded the items that I think will really help me out at my day job at Stone Ward. While I am the lead web developer there, I am increasingly being called on for my expertise in the ways of social networks, approaching bloggers and blogging, et cetera. It would be nice to have some time listening to the ideas and thoughts of some people who are smarter and who have more experience than I do.

If you’re going, what panels are you most interested in?

Posted in: internet , marketing , programming , social networking , technology
February 5

Javascript Loading Speed [internet, programming, technology] (Clint Ecker (clintology)) by Clint Ecker

A great post by John Resig, the lead developer of jQuery. The pbWiki guys did an excellent analysis of many different Javascript libraries and there are a few takeaways that web developers should note. On the subject of compressing your Javascript files:

Looking at the speed of loading jQuery in three forms: normal, minified (using Yahoo Min), and packed (using Packer). By order of file size, packed is the smallest, then minifed, then normal. However, the packed version has an overhead: It must be uncompressed, on the client-side, using a JavaScript decompression algorithm. This unpacking has a tangible cost in load time. This means, in the end, that using a minifed version of the code is much faster than the packed one - even though its file size is quite larger.

Performing these tests across a broad spectrum of Javascript libraries shows that jQuery is indeed to speediest to get going with. According to pbWiki’s test, jQuery loads and evaluates the fastest and has a 200-400ms lead on it’s nearest competitor.

Bundle all that up with jQuery’s excellent selector engine and plugin structure and you can’t beat it! Go jQuery!

Posted in: internet , programming , technology
January 22

Stale web developers [programming] (Clint Ecker (clintology)) by Clint Ecker

Jeremiah Owyan, an analyst at Forrester Research has a post titled “What to do when web developers get stale?” A seasoned web developer that knows Jeremiah expressed his frustration at the seemingly quickening pace of the web development eco-sphere.

This web developer had been programming and developing websites for nearly 10 years, but admitted he was having a very hard time keeping up with the younger faster developers that knew the new languages.

Jeremiah suggested that the individual in question try and move into a more business / production role. That was probably a good suggestion, but it’s not the only route this guy could take. Depending on whether or not this individual’s problems with keeping up with new technologies and techniques are a result of a growing need to focus on his adult/familial responsibilities he can still take some steps to keep competitive in the marketplace.

Here are four quick suggestions that can keep almost anyone in the game, development wise:

  • Attend local tech meetups. These days there are a multitude of TechCocktails, BarCamps, Ignites, and more where you can meet people who are on the forefront of technology. What’s even cooler is that a lot of these are free to attend, you just need to know when they’re happening. But how do you keep up on all these events?
  • Read blogs! No, really! If you’re interested in keeping up in development, there are a whole host of blogs where people are discussing the latest stuff. Read Ajaxian, if they link to someone’s blog that interests you, follow those links and subscribe to that guy’s blog. Keep it up and you’ll have a nice, neat little collection of blog to read and absorb each week.
  • Go to big conferences to get inspired. Every time I go to a conference and surround myself with smart, ambitious people, a little bit of it rubs off on me. If you’re interested in Mac development, rub shoulders with the developers at WWDC. Interested in cool new web technologies? There are a dearth of opportunities from South by Southwest Interactive, O’Reilly Web 2.0 Expo, ETech, RailsConf, OScon, PyCon, The Future of Web Design, and tons more!
  • Find a pet project or cause. Does something annoy you? Come up with a way to solve it and implement it in a new language or framework. You don’t have to bang out the solution in one night, work on it progressively over the course of a few weeks. Your blog software getting you down? Write your own. There’s no better way to learn new concepts than to find and itch and scratch it.

I’m sure there are tons more ways to get your inner-developer going again. Leave your suggestions in the comments.

Posted in: programming
January 20

Signed up for PyCon this evening [django, programming] (Clint Ecker (clintology)) by Clint Ecker

Just thought I’d post here and let everyone know that I signed up for PyCon this evening. PyCon is the biggest Python Conference (and perhaps the only, who knows?). The coolest thing is that PyCon is taking place in Chicago for 2008 and 2009! Yay!

I will only be attending for the conferences on Friday afternoon and the weekend and mostly for the web/Django related stuff. Also, just to meet people who I’ve only interacted with online. Those are the best parts about going to conferences.

Posted in: django , programming
August 19

A weird problem with PHP/MySQL/CSS/HTML (Kilala.nl (Cailin Coilleach)) by Cailin Coilleach

I've no clue what's going on and I don't like it. No sir, I don't like it at all.

I've almost finished the programming work on the new version of my website. Most of it seems to be working rather nicely and I've hammered out most bugs. Most of the code has been greatly improved and I've taken away a lot of the extraneous PHP files. For instance, no longer will I need six separate PHP files to display blog posts and the archives, nor to add or view comments. All of that is now handled by two site-wide scripts. Nice.

Of course now that things are wrapping up it's time for the weird bugs to show up. I should've learnt my lesson from The soul of a new machine. I mean, I've only read that book three times. :/

Anywho... This morning I added three articles to the database, through Firefox on my Powermac. All three of these articles show up with completely screwed make-up. The CSS is completely ignored, as is the HTML and some parts of the text itself. Two articles that were added after that show no problems whatsoever. The problems are independent of which index.php file I use to view them as each of these shows A) the buggy posts incorrectly and B) normal posts correctly.

So there's -something- in these three posts that's interfering with the post displaying code that I've written, that doesn't show up with any of the other posts. Remarkable. At first I thought this might be due to these posts having been written on my Powermac, as opposed to my Macbook. Who knows, maybe there's some difference in character encoding or whatever between the two. But no dice. I replicated one of those posts using my Macbook and the same problem pops up.

Weird.

I'm gonna have to spend some midnight oil on this =_=

Posted in: overhaul , programming , website , weird problem
April 16

On commenting and debugging your code (Kilala.nl (Cailin Coilleach)) by Cailin Coilleach

When writing shell scripts for my customers I always try to be as clear as possible, allowing them to modify my code even long after I'm gone. In order to achieve this I usually provide a rather lengthy piece of opening comments, with comments add throughout the script for each subroutine and for every switch or command that may be unclear to the untrained eye.

In general I've found that it's best to have at least the following information in your opening blurb:
* Who made the program? When was it finalised? Who requested the script to be made? Where can the author be reached for questions?
* A "usage" line that shows the reader how to call the program and which parameters are at his disposal.
* A description of what the program actually does.
* Descriptions for each of the parameters and options that can be passed to the script.
* The limitations imposed upon the script. Which specific software is needed? What other requisites are there? What are the nasty little things that may pop up unexpectedly?
* What are the current bugs and faults? The so-called FIXMEs.
* A description of the input that the program takes.
* A description of the output that the program generates.

Equally important is the inclusion of debugging capabilities. Of course you can start adding "echo" lines at various, strategic points in the script when you run into problems, but it's oh-so-much nicer if they're already in there! Adding those new lines is usually a messy affair that can make your problems even worse :( I usually prepend the debugging commands with "[ $DEBUG -eq 1 ] &&", which allows me to turn the debugging on or off at the top of the script using one variable.

And finally, for the more involved scripts, it's a great idea to write a small test suite. Build a script that actually takes the real script through its loops by automatically generating input and by introducing errors.

Two examples of script where I did all of this are check_suncluster and check_log3 with the new TEC-analysis.sh on its way in a few days.

So far, TEC-analysis.sh checks in at:
* 497 lines in total.
* 306 lines of actual code.
* 136 lines of comments.
* 55 lines of debugging code.

Approximately 39% of this script exists solely for the benefit of the reader and user.

Posted in: code , comment , debug , programming , scripting
February 28

FizzBuzz Quiz (The Jux Entente) by bbqfrito

From Why Can’t Programmers.. Program?

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

I gave the above test to Graeme, Travis, and Brett. They all failed due to logic errors. It is important to note that Brett and Travis are both professional programmers. Failing this test does not in anyway demean them or anything. It is more of a test to point out how hard it is to write correct code the first time.

Me, on the other hand, passed with flying colors.



EDIT:

There was no testing before submission and only the first submission would be accepted. Everyone did get it right the second time though. Travis and Brett’s original if statements were incorrect and in turn outputted wrong results. The only thing wrong with Graeme’s code was that his range was from 0 to 100; however, Graeme’s output was unreadable because it was on one line.

FINAL VERDICT: EVERYBODY FAILS

Posted in: news , programming
January 29

Awaiting the Day When Everyone Writes Software - New York Times [ma.gnolia] (Put together quickly (Haligan)) by MichaelBiven

Awaiting the Day When Everyone Writes Software - New York Times

Too many software programs are ugly: inelegant, unreliable and not very useful. Software that satisfies and delights is as rare as a phoenix.

Tags: , , , ,

Posted in: agile , charles simonyi , intentional programming , pair programming , programming