Home » Archive by category "Windows" (Page 5)

Prevent a MySQL query from using the query cache

Whilst I was busy trying to optimize a MySQL query I got annoyed by the fact that when you make use of MySQL’s query cache that a query gets cached. When that happens a second time you execute the query it’s being looked up and the cached results are being returned. If you want to optimize a query and test its performance this can be quite annoying.

Luckily I found out there’s an easy solution to this problem. Just make use of SQL_NO_CACHE like this:

  1.  

Now when you run this query it makes sure MySQL doesn’t store it in its query cache.

Why I won’t develop a Maximus for Monkey

I had originally planned for this post to be a bit different, but due to recent events the idea of a (or my) module manager for Monkey has become obsolete.

Not too long ago I asked around Twitter, the BlitzMax and Monkey forums to see if there was any interest in a module manager for Monkey. I’ve had some positive responses and so I decided to start a IndieGogo crowdfunding campaign for a Monkey Module Manager. I started to write down things I would want to do for this module manager and made a cost estimate. Setting up a decent looking crowdfunding campaign takes quite some time and I had originally planned on launching the campaign 1st of June.

20130609-150012.jpg

But then BRL released a simple module manager with a recent Monkey release. Though very different from what I had in mind it’s capable of installing modules from 3rd party developers. Although I haven’t tried it out yet and am unsure of how useful it is the fact is that there’s now a module manager for Monkey.

So what’s going to happen to the IndieGogo campaign? I’ve decided not to launch it. There now is a BRL supported way to manage and install 3rd party modules. And while I think having the option to choose which solution to use would be better (competition is always good for innovation) I have little faith in the Monkey community supporting another solution. Yes, I would’ve loved to develop a Monkey Module Manager but as it is now it’s not going to happen.

Disabling hiberfil.sys on Windows 7

Hibernation is enabled by default on Windows 7 and Vista. But on a desktop system you usually don’t make use of hibernation. To disable it run a command line prompt (Windows Key + R, type cmd) and enter the following command: powercfg.exe -h off.

On systems with a lot of memory this can free up a lot of disk space.

Vim essentials: Ack

Ack is a tool for searching your (code)files, much like grep already does, but better. Ack is written in Perl and works on all major platforms, including Windows. To use Ack with Vim there’s this nice plugin called ack.vim. Install it together with App::Ack and you’re set to go.

With a single command (:Ack [options] {pattern} [{directory}]) you can recursively search for files matching {pattern}. The results returned from Ack will be visible in a newly opened pane in which you can navigate and open the file to start working with it. Every result line contains the file path, position of the matched search and the contents of that line.

ackvim

Vim essentials: NERD Commenter

Another great Vim plugin I use is NERD Commenter. Using this plugin makes it easy to comment out lines of code with just a few keystrokes. By pressing <leader>cc or <leader>c<space> you can comment out your selection using a single comment character per line. With <leader>cm you can comment your selection with one set of multipart delimiters, though your programming language has to support those. Repeat the commands to uncomment your code again. These commands work on single lines as well as on multiple lines which you’ve selected in visual mode (e.g. ranges).

In some cases it can happen that NERD Commenter doesn’t know which comment characters to use which causes it to use comment characters your language doesn’t or may not support. So far this only seems to happen when the filetype can’t be determined by Vim. This can be annoying at times, but I can live with it.

All NERD Commenter commands

For completeness I’ve copied the full command set from its README below. Personally I only use the ones I mentioned earlier. Though I think I’ll go and try to memorize the NERDComYankComment function since that particular case can pop up quite a lot when programming.

[count]<leader>cc |NERDComComment|
Comment out the current line or text selected in visual mode.

[count]<leader>cn |NERDComNestedComment|
Same as <leader>cc but forces nesting.

[count]<leader>c |NERDComToggleComment|
Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa.

[count]<leader>cm |NERDComMinimalComment|
Comments the given lines using only one set of multipart delimiters.

[count]<leader>ci |NERDComInvertComment|
Toggles the comment state of the selected line(s) individually.

[count]<leader>cs |NERDComSexyComment|
Comments out the selected lines “sexily”

[count]<leader>cy |NERDComYankComment|
Same as <leader>cc except that the commented line(s) are yanked first.

<leader>c$ |NERDComEOLComment|
Comments the current line from the cursor to the end of line.

<leader>cA |NERDComAppendComment|
Adds comment delimiters to the end of line and goes into insert mode between them.

|NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between. Disabled by default.

<leader>ca |NERDComAltDelim|
Switches to the alternative set of delimiters.

[count]<leader>cl
[count]<leader>cb |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the left side (<leader>cl) or both sides (<leader>cb).

[count]<leader>cu |NERDComUncommentLine|
Uncomments the selected line(s).