Skip to main content

Posts

"Cropped" images via CSS only

Had this problem on a site recently. There was an area where a variety of images could show up, dynamically pulled from a datbase. The images were of a fair variety of dimensions - all the same general size, but no exactly the same. The variety of dimensions made the area look bad - and simply forcing them to the same dimensions led to distorted looking images. At the same time it wasn't feasible to resize or crop them either automatically or manually. The solution I came up with was to simulate a cropping effect. I came up with a good "ideal" dimension. Say it's 100x100. The images themselves are in a grid of table cells. First, I fixed the table cell size at 100x100. Then, rather than placing the image inside the table cell as would be standard, I set it as the background for the table cell, and just put a "&bsp;" in the table cell (so it's not empty). This makes it so that the table cell displays the image as a background - any parts of the image ...

Handy vim - easily generate properly formated bullet lists

This is a problem I run into fairly often, because I do a bit of hand-coding HTML from word files or other content that clients send me. When you cut and paste the items for a bullet list into an html document, they often come in one per line with no formatting (or sometimes they have a "*" at the start of each line. Obviously you can create a macro to automate the process of putting <li> tags around each item, but there's an even faster way to do this using vi's powerful regular expression tools. Of course, this will only be useful if you can use vi, a command-line text-editor. If you're on shared hosting or something, you may be out of luck. There is a windows version of vi, but I haven't really done more than mess with it a bit. If you're on OSX, you're probably in luck - you can use the console, and I think that it has vim installed, although it's been like eight years since I used OSX regularly. First, figure out the lines that you w...

MaxVPS has new plans

One of the hosting companies I work a lot with has just gone through and redone all of their VPS hosting plans . They've simplified the number of plans, and improved them significantly, increasing the amount of storage space, bandwidth, RAM available at each price point. They've also updated their support for a wider variety of operating systems (including Windows ) and web control panels. A Virtual Private Server is essentially the same as a dedicated server, except that it's running on "virtual" hardware. In other words, the physical server that hosts the VPS is running virtualization software that allows it to host one or more virtual machines, and the VPS plans are set up on these machines. This has a number of benefits - it spreads the cost of the physical server out over multiple clients, making for cheaper hosting. At the same time a VPS server has many of the same benefits of a dedicated server, such as greater stability, security and flexibility when com...