Vagrant enables a developer to isolate their project to a dedicated virtual machine while still coding in the same environment they use for other projects. You can essentially edit your project files in Windows and access the result through Windows while everything is running on Linux without having to do any of the tedious work of setting up and installing a virtual machine. The cool thing about Vagrant is how the configuration file for the project can be redistributed with the rest of the code base to give other developers access to an exact replica of the original development environment.
I stumbled across this comment a while ago and though it was pretty funny, so I wrote a basic one liner to add the “feature” to my shell. Basically what it does is allowing you to write “fucking” instead of “sudo” for the humorous effect of it, example below. $ make install No. $ fucking make install Here’s the code for setting it up. The specified configuration file needs to be changed for it to work in other shells than bash.
This is a really short response to a question I’ve stumbled across twice today, “Is [language] worth learning?” All languages have some worth, but they are all good in different areas. It all depends on what you want to do and how much you want to learn about programming. C is very good if you want to learn how computers work without delving into the inaccessible mess that is assembly programming.
I was reading up on improving the performance on MySQL when I found an article and stumbled on a really cool alternative to using offset when generating pagination results from the database. On the query side, instead of using LIMIT with offset, you can select one more row than you need, and when the user clicks the “next page” link, you can designate that final row as the starting point for the next set of results.
Possibly the most common sign of bad code is tight coupling, especially between logic and presentation. It might seem like a good idea to print out the HTML while the data is being generated, but it more often than not leads to a big incoherent mess of tangled code. It also causes other issues, like what happens if an unexpected error occurs in the middle of the page? By then half the page has already been outputted and it might be too late to handle the error nicely.
If you’re using Git you know how powerful it is as a CVS tool. But when Git is used as a deployment tool to be able to quickly revert changes if needed it may cause some headaches when deploying major features. There’s a trade off between having one giant commit and working with Git the preferred way of using small, incremental commits when deploying in this way. If there’s a critical problem with the new feature it will need to be reverted quickly which could become quite annoying if there are a lot of commits.
Creating a new user should be a lot simpler than it is. I always forget one or two things and need to look up the exact syntax whenever I need this to make sure that everything is included properly. This is the full command used to create a new superuser in one line with full access to all tables and ability to create new users as well. The following command essentially creates a new root user that is allowed to connect from any host so use this with caution.