Vi (or Vim in it’s modern incarnation) is a text editor. It’s a modal text editor. You can switch from insert mode to normal mode. Insert mode is where you type text into your document, and normal mode is where you type commands that do all sorts of functions. It’s incredibly powerful, incredibly complicated and even exiting the editor is not obvious. 🙂
So it’s always great when I dive into learning something new about Vim. There’s always something new to learn about Vim, even after more than twenty years of using it. I think there should be a Duolingo for Vim.
So, when you’re watched that, and watched it again, and again to understand it, have a look at the following presentation showing off the power of Vim without plugins.
When you just want to use Vim faster …
The power of Vim is in the commands. That also means it requires practice to learn those commands because they’re usually keyboard shortcuts. There’s no Edit menu to remind you to use something you just learned. With just a few core concepts and memorized keys or functions you can be very efficient at moving around or manipulating text.
A friend recently had a problem configuring a new server. He installed PHP, Apache, MySQL and phpMyAdmin but when he launched it he got the following error:
phpMyAdmin – Error
Cannot load mysql extension. Please check your PHP configuration.
If you’ve installed all of the above more than once you’ll know what is more than likely wrong. The MySQL PHP module isn’t loaded. First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the phpinfo(); command it will tell you where it is. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini
Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!
Calling all MySQL admins! When you’re working with InnoDB tables you may have noticed that MySQL takes an extraordinary amount of time to shutdown. Don’t panic! It’s normal.
InnoDB has extensive logs that it must run through and if your server is at all busy these logs can be quite big.
After you’ve started the equivalent of “/etc/init.d/mysql stop” it may not return for quite a while. Simply open another terminal and examine the system log. On a Debian or Ubuntu box, look at /var/log/daemon.log and you’ll see the “InnoDB: Starting shutdown…” message.
Now, go off and make a cup of tea because this could take a while. On a fairly large and busy database it might be half an hour or more!
Please, please, please don’t be tempted to killall -9 mysqld because bad things will happen! Even if your boss is looking over your shoulder, and you’ve promised that the company webserver will be online in 2 minutes, don’t do it.
However, cases where it is ok to kill the database with a “kill -9”:
International terrorists are planning on robbing the World Bank and you’re the only secret agent who can bring down the database which will stop them.
Lassie will be run over by the evil farmer who plagued the local village with his monster cows unless you can corrupt his database in time.
Or finally, you like hard work and restoring from backups!
Andrew van der Stock’s criticism of PHP’s security model. What security? Global request arrays go some way to making applications safer but there are obscure functions and settings which can trip up developers. (via) PHP Optimization Tricks from Ilia Alshanetsky has one gem I didn’t know about – the ctype extension. It’s somewhat limited but would be faster and less resouce intensive than a regular expression to do simple checks.
Yes, newer browsers have SVG support but this will work in older browsers and newer. Cute.
Ever wondered how some of your favourite apps get hacked and broken into? This page lists lots of examples of database “injections”.
Like an injection you get off your doctor these bits of code inject database code into your application. The code can do anything – delete all your data, grab your passwords, or anything.
And if it happens to you, a nice doctor isn’t going to give you a lollipop.
He has a couple of examples on his page, and it looks easy enough in principle. The devil’s in the details don’t you know but it looks like it’s worth trying!
He’s a busy beaver too.. he has an MVC framework and tutorial that steps you through an example.
Among developers, design patterns are a popular way to think about design, but what is the proper way to think about design patterns? In this interview, Erich Gamma, co-author of the landmark book, Design Patterns, talks with Bill Venners about the right way to think about and use design patterns.
We’re crazy about the details. We love the details. The space between objects. The perfect type leading. The perfect color. The perfect words. 4 lines of code instead of 7. The perfect flow. 90% vs 89%. 760px vs 750px. $39/month vs. $49/month. Success and satisfaction is in the details.
However, success isn’t the only thing you’ll find in the details. You’ll also find fixation, stagnation, disagreement, meetings, and delays. These poison projects. These are the things that kill morale (and if morale is low, your chance of success is even lower). You want to avoid these at all costs. If you procrastinate, procrastinate the details.