Xcode Fix Recent Projects Empty
Terminal Command:
defaults write com.apple.Xcode NSRecentDocumentsLimit -int 10
Relaunch Xcode. Done.
New Favourite Terminal Command
Best command ever:
sudo !!
Tells the terminal to run the last command again, but to throw sudo in front of it.
obligatory XKCD link:
http://xkcd.com/149/
Pure PHP Pagination
So, for a while I’ve been looking for a ridiculously simple way to paginate data stored in a table. And while I love PHP, it just doesn’t come with some of the free things I take for granted in .Net
Today, while working on a pretty simple plugin, I wanted to add this functionality, and I didn’t want to waste a bunch of time. I was given a link to this great script: http://www.warkensoft.com/2009/12/paginated-navigation-bar/
It took me about a minute to implement the functionality. I then spent another 5 minutes doing CSS and that was it. Done. I’m not usually one for link sharing, but this made my life much easier. Hopefully it can make yours easier too.
The solution is pure PHP, no javascript required. Some day, I may try to expand upon this to include javascripty goodness, because that’s pretty much the only thing that could make it better
ASP.Net 301 Redirect
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
mysql command doesn’t work in OS X snow leopard
So you install mySql on your mac, and it’s working great, but then you go into terminal to run a mysqldump or something, and it doesn’t work!
you get a message something like:
-bash: mysqldump: command not found
so how do you fix this? well, copy and paste the following into your terminal window and press enter:
echo export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" >> ~/.profile
source ~/.profile
whoa, whoa, you say. what is this doing? It makes it so that when you type any command into the terminal, it does a check of these folders before giving you the “command not found” error.
If you want to undo it, you can always edit your .profile, or just delete it.
WordPress on Snow Leopard: Unable to Connect to Database
If an “unable to connect to database” comes up while installing WordPress on a Snow Leopard machine, try adding :3306 to the end of the DB_HOST in wp-config.php
Assuming everything else works, this should solve your problem!