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.