Web development

FF2: Cursor not visible in text fields

I’m used to dealing with bugs in legacy browsers, just not ones in Firefox. A strange bug in some releases of FF2 causes the cursor to disappear in text fields and textareas. A general fix was to specify overflow: auto for the fields. However, in some stubborn cases (inside the div-complexity of a modal box), this didn’t help.

I ended up using Jquery to inject a wrapper and some CSS to fix the issue.

$('.modal input[type=text], .modal input[type=password]')
.live('focus', function(){
if ($(this).parent().hasClass('ff2fix') == false) {
$(this).wrap('<div class="ff2fix" style="float: left; width: '
+ $(this).outerWidth() + 'px; height: '
+ $(this).outerHeight() + 'px;"></div>');
$(this).css('position', 'fixed');
}
$(this).focus();
return true;
});
Ilya


How to stop non-UTF-8 characters from breaking your Wordpress feeds

If you have problems with non-UTF-8 characters breaking your feeds in Wordpress (ie. breaking XML parsers), one solution is to attach a filter to the the_excerpt_rss() function and stripping or converting the characters. I’m guessing the errant off-character characters (ahem) are the result of promiscuous copypasting.

  1. Grab Jason Judge’s self-contained function for limiting to valid UTF-8 characters (here’s a link to the source).
  2. Paste it into your theme’s functions.php file.
  3. Also add the following lines:
    function the_excerpt_rss_utf8($text) {
    return trim(clean_utf8_xml_string($text));
    }
    add_filter('the_excerpt_rss', 'the_excerpt_rss_utf8');
Ilya


  • jQTouch. A Jquery plugin for mobile web development.

What’s wrong with buttons?

I had totally forgotten why I don’t use <button> elements:

  1. When using multiple buttons in a form, IE6 and IE7 sends the values of all of them
  2. IE6 and IE7 sends the innerHTML as the value of the button (ignoring the value attribute)

If you need a longer explanation, Drew McLellan has written about it.

Ilya

Pedestrian validation woes, part Nectar.com

Today I tried signing up for a Nectar card, a customer loyalty card for Sainbury’s (among other stores). Their site, Nectar.com, is nice looking, and finding where to sign up for a card was nice and easy.

However, my attempt to sign up was thwarted when, on page two, I hit a form asking me a) how many children under 18 I had living in my household (answer: 0) and b) to provide their birthdays (empty text fields). Whatever I entered — and I mean whatever — it wouldn’t let me past the javascript validation complaining about a mismatch between the number of children and their ages. I couldn’t get past it despite an attempt to create an imaginary child to get by it.

Stumped, I gave up. Figuring I’d notify them of the issue, I clicked over to their Contact us page.

But they have only three options of contacting them: chat (which requires you to have a Nectar card number), calling them, and writing them — via snail mail.

No email address or contact form!

Adding insult to injury, their footer promo content for contacting them offers an “Email us” link.

Ilya

  • Hurl. Test REST/web APIs.




  • WP Cumulus is a Wordpress plugin that creates a Flash-based tag cloud (demo).


  • Kernest. A rather awkward-looking alternative for Typekit?
  • Kaltura.org. An open source video community.
  • Underscore.js. "Provides 50-odd functions that support both the usual functional suspects: map, select, invoke — as well as more specialized helpers: function binding, javascript templating, deep equality testing, and so on. It delegates to built-in functions, if present, so JavaScript 1.6 compliant browsers will use the native implementations of forEach, map, filter, every, some and indexOf."


Flooring using double bitwise not

An interesting tidbit from Thomas Fuchs’ Extreme Javascript Performance:

~~(1 * 12.5) is faster than parseInt(12.5).

The ~~ is a double bitwise not, and the multiplication by one forces a string into a float.

Via Janne’s Delicious stream.

Ilya




Powazek: “FAQ you SEO!”

It’s a bit amusing that Derek Powazek’s own rant-rebuttal is currently the number two result on Google for “SEO FAQ.”

And oh my, his URLs aren’t even optimized!

As a designer-slash-developer, I can definitely understand where Derek’s coming from. But I’m also willing to admit that there’s a legitimate place for specialized SEO experts. Maybe it’s like consultants and lawyers?

Ilya





  • Uni-Form. "Uni-Form is an attempt to standardize form markup and css [...] get nice looking, well structured, highly customizable, semantic, accessible and usable forms."


Changing the table prefix in an installed Wordpress

Changing the table prefix in an installed Wordpress. Otherwise an obvious task, but steps four and five can stump you.

For step five, the following SQL snippet may come in handy.

UPDATE new_prefix_usermeta SET meta_key = REPLACE(meta_key, "wp_", "new_prefix_");

There’s also a plugin available.

Ilya
  • jQuery Enlightenment. "The concepts essential to intermediate and advanced jQuery development."
  • httplib2. A comprehensive HTTP client library in Python.

Secure your Wordpress uploads directory

If you serve only specific file types (eg. images) it can’t hurt to secure your Wordpress uploads directory a .htaccess file. Add to the file extensions as necessary.

Order Allow,Deny
Deny from all
<Files ~ "\.(jpeg|jpg|png|gif|pdf|gz|zip)$">
Allow from all
</Files>

Ilya

  • Scrapy. An open source web scraping framework for Python
  • Home
  • About
  • Preferences


This category in RSS

March 2010

Mon

Tue

Wed

Thu

Fri

Sat

Sun

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Feb   Apr

Beared souls

caught together