Nov 14, 2012 by Matt | Posted in Coding
Mac users with custom entries in their
/etc/hosts files may have noticed that, under Mountain Lion at least, lookup times for local resources are incredibly slow. I routinely set up names that point to virtual hosts on my laptop so I can give projects their own local domain instead of having
http://localhost/projects/something/index.php or somesuch. Typing
something.dev is much easier. I noticed that, since upgrading from Snow Leopard to Mountain Lion, Firefox would spend several seconds trying to look up those names before consulting the hosts file and loading the page.
While I don’t know why it’s happening, exactly, I do have a fix. The wait goes away if you put the local entries on one line.
Instead of having something like this:
You need to have this:
127.0.0.1 myproject.dev wordpress.dev somesuch.dev
Leave the lines that say “localhost” alone, of course. Messing with those could cause all manner of Bad Things.
Dec 5, 2011 by Matt | Posted in Domains
There has been a sudden outbreak of design and development blogs having their domain names hijacked and held for ransom. It seems to have started with David Walsh’s site, when his domain name was mysteriously transferred from GoDaddy to Name.com and from there to 1and1. The DNS records have been pointed back to Walsh’s host by 1and1 while things are sorted out, but for now the domain is still not under his control.
About one day later, the same thing happened to Chris Coyier’s CSS-Tricks.com. Someone gained access to his GMail and GoDaddy accounts and moved the domain to PlanetDomain. From his detailed chronicle of the events, it’s a possibility that he may have a keylogger on his computer, as the miscreant has been able to get around password resets of the GMail account, and may have even accessed the Media Temple server CSS-Tricks is hosted on. Coyier also received the impeccably-penned threat “pay 2k to get ur domain back.”
This has recently happened to a few other big-name sites in the same field, including Abduzeedo, Kirupa, Design Shack and InstantShift. Abduzeedo was able to catch the transfer and stop it, though. (Interestingly, it has been almost exactly four years since the same thing happened to logo designer David Airey.)
Just to be on the safe side, you might want to do a quick WHOIS search on your own domain and make sure it’s still on your registrar.
Update, Dec 5: Planetdomain is reversing the transfer, and moving the CSS-Tricks.com domain back to Chris Coyier’s GoDaddy account.
Oct 24, 2011 by Matt | Posted in Coding, Featured
iOS has a simple event-based XML parser built in, which makes it fairly easy to do less involved parsing operations without having to load up a third-party framework. This tutorial will show you how to build a simple iPhone application that will download an XML feed from Twitter containing a user’s tweets, and then display them with a pretty UI. (You could easily adapt this to parse other XML documents, such as RSS feeds.)
Apr 20, 2011 by Matt | Posted in WordPress
BlackBox is a handy WordPress plugin that I’m going to have to try out for development. It adds a debug bar along the top of each page, with items that would be invaluable for plugin and theme developers but probably of little interest to bloggers who don’t like getting under the hood.
With the theme you can have a look at all of the globals, see any errors generated, and keep tabs on the MySQL queries (including their execution times) behind the page generation. It even includes a profiler.
Feb 23, 2011 by Matt | Posted in Services and Tools
If you’ve ever tried a little iPhone development out, you might have run into an inconvenient problem. Apple uses a code signing system on iOS devices to ensure that software that ends up on them has either passed through the App Store (and has thus been checked for malware-like behavior) or has been assigned to the unique device ID using an ad-hoc distribution. This is generally good for the end user, but it’s a real pain to distribute betas.
I’m not sure how it does it, but TestFlight takes the pain out of iOS beta distribution. You just build an app, upload it, enter some email addresses, and TestFlight magically takes care of the rest.
When a beta tester gets an email from TestFlight, they register their device by logging into the TestFlight website on their iOS device. It installs a provisioning profile over the air, and lets them access your uploaded application builds in the same way.
However it does its magic, TestFlight is an indispensable tool for developers.
Feb 24, 2010 by Matt | Posted in Coding
Have you ever wanted to learn how to write your own iPhone applications? It’s certainly more difficult than web development, but the device is a good platform to learn client-side programming with. Mobile applications that tie into web services are becoming increasingly common, so now is a good time to give it a try.
iPhone Application Development For Dummies is a good primer on building applications for the iPhone or iPod Touch. It covers the basic theory over the first few chapters, and then moves on to building a simple View-based application. I haven’t finished the book quite yet, as I’m working my way through the tutorials as I read, but the book seems to cover all of the basics quite well. There are parts on data storage, input events, and many other things that are critical to iPhone development.
I’m finding the book to be a bit challenging, as I don’t have any real desktop programming experience, other than BASIC if that counts. I don’t think I’d recommend it to someone who doesn’t have a strong grasp of at least one programming language with a C-style syntax, such as PHP or Java. Knowledge of object-oriented programming is important, in addition to more basic skills such as dealing with variables and control structures. If you’re a total programming newbie, I would recommend reading a good introductory book first, and then moving on to iPhone Application Development for Dummies.
I’ve enjoyed what I’ve read of the book so far, and I hope that, by the time I’m done, I’ll have a good enough grasp of things to develop an idea I’ve had for awhile into an app.
Oct 19, 2009 by Matt | Posted in WordPress
WordPress has a class, $wpdb, that contains several useful functions for manipulating the database. (The $wpdb object is a global variable that WordPress automatically creates.) This is used throughout the core, and by plugin and theme developers to easily run custom MySQL operations. It even has functions for building and executing prepared statements.
You can find a nice introduction and examples at WP Engineer. Here’s a sample of how you would go about changing the title of a post with a certain ID:
$wpdb->update( $wpdb->posts, array( 'post_title' => $new_post_title ),
array( 'ID' => $the_post_id ) );
That’s just scratching the surface, but it gives a good idea of how the database functions work.
For even more in-depth reading, there’s a good Codex page on the subject as well.