Author Archive | Bill

Lighttpd – url rewrite and query string QSA

One of the first things I was curious about when I started using Lighttpd was url-rewrites. On apache mod_rewrites you can use the [QSA] flag to allow for the query string after your new urls. Here is the equivalent in lighttpd. This would go in your lighttpd.conf file which is usually located in /etc/lighttpd/lighttpd.conf on […]

Continue Reading 0

PHP: Handle comma separated input

A quick example of how to handle comma separated input from a POST variable in PHP. The code below will turn your POST variable into an array containing the user’s input which you can further validate or store in a database. This is useful for letting users add tags to items on your website. $tagsString […]

Continue Reading 1

iOS tip: Center UILabel in tableFooterView

If you’re building an app that supports portrait and landscape you will probably run into an issue with keeping things centered after device rotation. Below is a quick example of adding a UILabel to a UITableView’s footer and keeping it centered regardless of device rotation. The trick is to use autoresizingMask which does all the […]

Continue Reading 3

SDWebImage fixed width cell images

While looking for a easy solution to load uitableview images remotely, I came across a great library called SDWebImage. It’s very simple to use and provides a lot of flexibility for loading and caching images in your iOS project. As I started to use it, I ran into a issue when loading inconsistant thumbnail image […]

Continue Reading 16
JQuery. Write less, do more

JQuery: Sorting JSON results

This is a follow up to a previous post on sorting elements using JQuery. A few people messaged me asking how to modify the code to sort JSON results from a ajax request so here it goes. The JSON (json.php): [{“id”:600385,”name”:”Featured Titles”,”url”: “”}, {“id”:562680,”parentId”:567182,”name”:”Business”,”url”: “”}, {“id”:562677,”parentId”:567186,”name”:”Other Misc.”,”url”: “”}, {“id”:562664,”parentId”:567186,”name”:”News \u0026 History”,”url”: “”}, {“id”:562678,”parentId”:567186,”name”:”Men\u0027s General”,”url”: “”}, […]

Continue Reading 1

Check image type in PHP

Quick PHP tip: If you’re looking to determine the type of uploaded image you can use the following code: $type = exif_imagetype($_FILES[‘uploaded_image’][‘tmp_name’]); if ($type == 1 || $type == 2 || $type == 3) { //image type is jpg, gif or png } The code above shows a snippet to check if the uploaded image […]

Continue Reading 0