IE Bug: Fading animation makes text render without anti-aliasing

Affects: IE6, IE7

Description

When using jQuery to fade elements, Internet Explorer will remove anti-aliasing from text (causing it to appear pixelated) .

Workaround

Remove the ‘filter’ attribute used by IE to fade elements once the fade is complete (view the full post to read the code)

Continue Reading »

Uncategorized

Comments (0)

Permalink

IE Bug: Fading does not work on child elements that have position rules

Affects: IE 8

Description

When using jQuery or similar to fade an element (animate its opacity) IE 8 does not fade child elements that have any ‘position’ property set (’relative’, ‘absolute’, etc).

Workaround

Removing position rules will work, but presumably you’re using them to, well position stuff. The only workaround I have found is to use the IE 7 compatibility meta tag to force IE 8 to render as 7 would.

Unfortunately this means you have to deal with the IE6/7 text anti-alias bug - workaround here

See also

http://glow-project.lighthouseapp.com/projects/33663/tickets/161-fade-animation-children-with-positionrelative-ignore-the-opacity-of-the-parent-in-ie

http://flowplayer.org/tools/forum/55/28425

Uncategorized

Comments (0)

Permalink

IE bug: 1px vertical margin around input fields

Affects: IE7, IE8

Description

Input fields wrapped with an inline element will render with an extra 1 pixel margin above and below, regardless of the ‘margin’ property set in the CSS rule.

Workaround

1) Use a conditional comment or similar to serve a margin rule to IE that is 1px less than desired. So for no margin:

form input, form textarea{
    margin:			-1px 0;
}

2) Remove the border from the input - this will also remove the extra margin.

Uncategorized

Comments (0)

Permalink

Usable multiple-selection with checkbox lists and jQuery

There are two out-of-the-box methods for multiple selection in HTML: checkboxes and the <select> tag. Neither are perfect - I’ll be discussing why, and proposing a sort of mashup of the best aspects of both, using jQuery.

Continue Reading »

Uncategorized

Comments (3)

Permalink

Uploading images and making thumbnails with web.py and PIL

I ran into an issue today while trying to implement image uploads. It’s a very basic implementation: taking files from a POST request, copying them to a local folder, and then making thumbnails of them.

I started with the file upload tutorial in the web.py cookbook.

The problem I was getting was that the Python Image library (PIL) was failing to make the thumbnails, with the error ‘image file is truncated’.

Continue Reading »

Uncategorized

Comments (1)

Permalink

Passing variables from a child template to a parent in Mako

After looking at Web.py’s own templating system, and considering Cheetah, I’ve ended up going with Mako for now. So far I’ve found it very straightforward, with some powerful-looking features to expand into in the future.

One of the great features is template inheritance - but I hit an issue recently with passing a variable from a child template to a parent. It’s not immediately obvious how to do this, but I found the answer on the Mako Google Groups archive (link here):

Child:


<%inherit file="meta.html"/>

<%def name="vars()">

	<% return (meta.id,) %>

</%def>

Parent:


<% (id,) = self.vars() %>

On a side note, I found out today that two of the Python libraries I’m using, Mako and SQLAlchemy, were coded by the same guy - Michael Bayer. Clever chap - not only are the libraries pretty impressive, but they are both well documented and he regularly contributes to the mailing lists for both projects. And he doesn’t even have a big internet head like some developers - though I tracked his blog down here:

http://techspot.zzzeek.org/

Uncategorized

Comments (0)

Permalink

Making a copy of a SQLAlchemy object

Should that be ‘a’ or ‘an’ SQLAlchemy object?

My current CMS project is based on creating templates in the back-end, and then using these to produce ‘inherited’ objects with the same attributes.

multiplicity

I quickly found that it’s surprisingly tricky to grab a template object using SQLAlchemy, and copy it into a similar, but separate, entity. Using the Python ‘copy’ function confuses SQLAlchemy - when you try to save it, it thinks it is merely a representation of the original (template) object.

Here’s how I create separate ‘clones’ from my template objects, defining a function on the object itself:

Continue Reading »

Uncategorized

Comments (0)

Permalink

Having cake and also eating it: Compiz and dual-head on an ATI HD 2600

dual head photo

Only a day after complaining about my ATI card running under Ubuntu, I seem to have a solved a lot of the issues. Slightly embarrassing. To recap - my system is set up like this:

HP 8510p laptop with an ATI HD 2600 mobility card running Ubuntu 8.04 with a 1680×1050 screen, often connected to an external monitor (same resolution).

My ideal setup would be like this:

  • ‘Big desktop’ mode when plugged into an external monitor, allowing windows to be dragged between screens.
  • When the monitor is unplugged, to continue working on the laptop screen, without restarting Xorg.
  • Compiz-fusion providing ‘expose’ functionality amongst other things.
  • Generally not having crashes would be nice.

Continue Reading »

Uncategorized

Comments (1)

Permalink

The past is a foreign country

They do things in Windows there.*

So I’m making a valiant effort to move to Linux, and stay in Linux.  I like how easy it is to install development stuff (servers, compilers, libraries) and I like the ethos of open source software. I installed Ubuntu a few months ago, and again on my new HP laptop. Everything is snappy and responsive, but I have had a few problems…

Continue Reading »

Uncategorized

Comments (0)

Permalink

Python-style startswith and endswith string functions in Javascript

The Python language has useful string methods to search for prefixes and suffixes:


my_string.startswith('pre')

The same thing can be achieved in Javascript using the rather powerful search and replace methods.

Continue Reading »

Uncategorized

Comments (1)

Permalink