Webkit background image wrapping bug

Context: I am doing a mobile web project for one of my clients.

Problem screenshot

WebKit wrapping bug screenshot (zoom)
Android Browser: background image is wrapped. Red arrow shows the height of the DIV.

Problem description

When using DIV with background image that is the same height as the DIV and top pixels of the background image are transparent, with repeat-x (or no repeat) there is an observable line at the top of the div painted with the color of the bottom pixel of the image.

Suspected buggy mechanism

I suppose it’s subpixel smoothing. Because of the observed facts:

  • The additional lines is less than a pixel wide as seen when zooming
  • Pixels affect colors of neighbours pixels

Suggested solution

  • Add two pixels at the bottom of the background image: one of the same color as the last pixel and one transparent. For example, if original image is from top to bottom (transparent,…,transparent,red,green,blue) it should become (transparent,…,transparent,red,green,blue,blue,transparent).
  • Keep the DIV vertical size the same as the original background: the two new pixels should be “rendered” outside the DIV.

Initially I’ve added only the transparent pixel at the very bottom but it interacted badly with both the last visible pixel and the contents of the div (not shown in the example, for simplicity).

I have created a Gist that shows the problem and the suggested solution. The Gist also includes the half-solution of only adding one pixel. For your convenience I have also uploaded the HTML of the problem and the suggested solution to this blog.

Additional info

  • On some devices, when going to landscape mode, the line disappears and is only observable when zooming in

P.S.
I learned something the hard way but I hope you will find this post and it will save you something from 1 to 5 hours of work.

RDS restore from dump time

Doing recovery test for one of my clients. I think recovery times might be useful to not-so-general public 🙂

TLDR version

.sql.gz file size: 829M
DB size after restoring: 6.2G
RDS instance: db.m1.small, MySQL 5.5.20, 50G, us-east-1b, not Multi-AZ.
Recovery tests date: 2012-08-14
Network: MySQL client in same AZ
Instance provisioning time: 8 minutes
Dump loading time: 58 minutes

More info

RDS parameter group: default.mysql5.5

RDS backups configuration: 35 days of backups

Restore command: time pv X.2.sql.gz | gunzip | mysql X

Restore command exact times:

real 57m35.001s
user 2m27.085s
sys 0m22.113s

Backup command: mysqldump --add-drop-table --add-locks --create-options --create-options --extended-insert --single-transaction --quick

Backup time: about 28 minutes.

Client: m1.small

Load on client when restoring: about 0.01, above 90% CPU idle.

Tables sizes info after recovery: SELECT data_length / 1024 / 1024 as "data", index_length / 1024 / 1024 as "index" FROM information_schema.TABLES where table_schema = 'MASKED' :

+---------------+---------------+
| data          | index         |
+---------------+---------------+
|    0.01562500 |    0.03125000 |
|    0.01562500 |    0.01562500 |
|    0.01562500 |    0.00000000 |
|    0.01562500 |    0.00000000 |
|    0.01562500 |    0.00000000 |
|    0.01562500 |    0.01562500 |
|    0.01562500 |    0.01562500 |
|    0.01562500 |    0.00000000 |
|    0.00000000 |    0.00000000 |
|    3.51562500 |    0.00000000 |
|    0.01562500 |    0.04687500 |
|    0.01562500 |    0.03125000 |
|    0.01562500 |    0.01562500 |
|    0.01562500 |    0.01562500 |
|    0.19713211 |    0.01269531 |
|    0.20276260 |    0.04687500 |
|    0.01562500 |    0.00000000 |
|    0.12012100 |    0.03613281 |
|    0.00007629 |    0.00195313 |
|    0.01562500 |    0.00000000 |
|    1.51562500 |    1.51562500 |
| 2053.00000000 | 1946.00000000 |
|   28.56250000 |   31.09375000 |
|    0.01562500 |    0.00000000 |
|    0.26562500 |    0.12500000 |
|    0.01562500 |    0.01562500 |
|    0.00000000 |    0.00000000 |
|    0.00000000 |    0.00000000 |
|    0.00000000 |    0.00195313 |
|   12.56250000 |    0.00000000 |
|    0.34375000 |    0.00000000 |
|    0.46875000 |    0.00000000 |
|    0.01562500 |    0.00000000 |
| 2139.00000000 |    0.00000000 |
+---------------+---------------+

Graphs from AWS RDS console

Screenshots were taken few minutes after restore finished.

HTH, Ilya.

Stop thinking, start doing.

Backgound

I could not find a “todo” software that would staisfy my needs so I decided to create one. The decision was also backed up by the fact that my good friend, Guy Egozy, was also very frustrated by the existing solutions.

The story

I started thinking about my “todo” software that I wanted to create. What it should include, how it should behave, etc… I was thinking for months. The important part is to realize when thinking becomes mental masturbation. Yes it is fun but it’s not productive. I admit I was slow to recognize the situation. When I did, I decided to start writing the code. It was a throw-away code, a protoype. When I had something that worked, I finally understood the following advantages:

  1. You learn a lot when implementing. No thinking + reading + analyzing will take you there. Of course you should but don’t over-do it.
  2. It’s much easiear to collaborate on. I can tell my friend all day about what I think but showing working application is a totally different story. Also he was finally able to participate by adding more code. Which he does till this day. (Thanks!)
  3. Makes possible to get any meaningful feedback from people, possible feature users.
  4. And of course you make steps toward the goal of having a good working version of the application (which we named Tagoholic), something you can share with the world, after few throw away versions.

Conclusion

Stop thinking, start doing — it’s way more productive.

P.S.

We are still working on Tagoholic. Collaboration (sharing) and mobile version are the two top requested features that are not there yet. We will let you know via Twitter when these are ready.

Is it so hard to get the UI right, Youtube?

Let’s keep it short. Obvious things Youtube got wrong:

  1. Can’t drag videos into playlist – WTF? Really? How hard could that be to implement?
  2. The home page with subscriptions and etc. The user does only one thing on all sites – chooses what to click next. (Well, and watches the videos if it’s Youtube). So why the f*ck you are making it so hard? Gray out the videos that were already watched! No one should scan all the page trying to spot new videos! Unjustified cognitive load. Other pages would certainly benefit from this too but the home page is really frustrating.
  3. I wouldn’t complain if it was only this minor bug but since I’m posting anyway … “Added to queue” does not go away if you remove the video from the list. It goes away only if you reload the page after you remove the video from the queue

Find one file of each kind (on Linux)

Suppose you have large number of files but most of them are identical. For example, the files’ contents are: A A A B B C C C C .
You’d like to find one of each kind and for example compare.

mkdir cmp
cd cmp/
find .. -name stupid-page.html | xargs md5sum | sort | awk '{print >$1}'
head -1 -q [0-f]* | awk '{print $2}' | xargs diffuse

Or if you just need the list, replace the last line with

head -1 -q [0-f]* | awk '{print $2}'

Note that you are left with the lists of files. Each list is named after MD5 of the content of the files listed in it.
Like this:

> ls -1
09b37d3089b1c1837e4741973df1e67e
4d701e2420bf49c85dd21c9b1dbb10e1
6135d23fcb0113ab9a2f574d7f0bf703
> cat 09b37d3089b1c1837e4741973df1e67e
09b37d3089b1c1837e4741973df1e67e  ../some-folder/stupid-page.html
09b37d3089b1c1837e4741973df1e67e  ../some-other-folder/stupid-page.html

Do not click here

Most of the sites use "click here for/to …" wording. That implies that:

  • The user is too stupid to see it is a link (alternatively the webmaster made it impossible to see it is a link)
  • The user has and uses a mouse
  • The document is not going to be printed (it will look stupid then)
  • The webmaster has no imagination
  • The webmaster does not care how the site will be indexed by search engines

See Web Content Accessibility Guidelines 1.0.

Editing YAML with VI

Put the following in your .vimrc file and you are set:

au BufNewFile,BufRead *.yaml,*.yml set et ts=2 sw=2

When you will be editing YAML files, you’ll automatically have the following behaviour:

  • et – expand tabs – puts spaces whenever you use tabs
  • ts=2 – tab stop – 2 spaces per tab
  • sw=2 – shift width – 2 spaces to move with < and > commands

YAML in VI

Debian kernel upgrade to 2.6.30

Debian testing just got kenrel 2.6.30. The previous version was 2.6.26.
I will summarize here the new features for the upgrade but only the ones I will find interesting.

2.6.30

  • POHMELFS – kernel client for the developed distributed parallel internet filesystem
  • DST – network block device storage
  • LZMA/BZIP2 kernel image compression. The kernel size is about 10 per cent smaller with bzip2 in comparison to gzip, and about 33 per cent smaller with lzma.
  • SR-IOV support – PCI virtualization helper
  • Networking: Allowing more than 64k connections and heavily optimize bind(0) time.
  • Virtualization: virtio_net: Allow setting the MAC address of the NIC
  • Many Bluetooth improvements

2.6.29

  • WiMAX (Intel Wireless WiMAX/Wi-Fi Link 5×50 USB/SDIO devices)
  • Filesystem freeze (LWN has very technical article about this)
  • Support for multiple instances of devpts
  • MD: Allow md devices to be created by name, make devices disappear when they are no longer needed
  • Xen: add xenfs to allow usermode and Xen interaction
  • USB: storage: recognizing and enabling Nokia 5200 cell phones
  • Bluetooth: Add suspend/resume support to btusb driver

2.6.28

  • Memory management Scalability improvements (technical details on LWN)
  • NFS: authenticated deep mounting
  • Port redirection support for TCP
  • gre: Add Transparent Ethernet Bridging
  • Support discard requests on SSD devices to improve wear-leveling
  • Add generic ATA/ATAPI disk driver

2.6.27

  • Multiqueue networking
  • ftrace, sysprof support – another tracing mechanism for kernel (not related to SystemTap)
  • Improved video camera support with the gspca driver. (List of devices is at LWN)
  • Add HTC Shift Touchscreen Driver
  • Bluetooth: Track status of Simple Pairing mode and remote Simple Pairing mode
  • HP iLO driver

The sources (full lists of changes):

  1. http://kernelnewbies.org/Linux_2_6_30
  2. http://kernelnewbies.org/Linux_2_6_29
  3. http://kernelnewbies.org/Linux_2_6_28
  4. http://kernelnewbies.org/Linux_2_6_27