Friday, 20 September 2013

Defragmenting Pagefile

Greetings, Audience.

Have you encountered the situation where you wanted to defragment your hard disk, but somehow the 'unmoveable' files have become so fragmented and it cause your defragmentation effort to have pretty much no effect?

No worries. There's a cure for that. However, you might need additional hard disk to make this happen.

Lets say, your disk fragment look something like this:


The unmoveable files, marked as green, are actually your pagefile. It is used as temporary storage to swap the information from your RAM. Those file are created on startup, and cannot be moved while the Operating System is on. When they become too fragmented (as in the image), it will be hard to properly defrag the rest of the file in that disk.

To prevent this from happening (or, say, fix it if it is already happened), i would recommend you to prepare an empty disk partition, with the size of twice of your RAM. Meaning, if your RAM is 8 Gigabyte, the empty partition should be 16 GB. This partition will be used as dedicate storage for pagefile.

Note that this guide will be based on Win XP. Newer OS should be quite similar to this.

To reassign the pagefile to the empty partition, go to the 'System Properties' (right click My Computer, and click properties).
In the Advanced tab, click the 'Performance' setting (1). It will pop the performance option. In that window, go to the Advanced tab, and click the 'Change' button under the virtual memory (2).

A new  window will pop up. Here, you can set the size and location of your pagefile.
By default, the pagefile will be under your OS partition (usually C:). Select it and set to 'No paging file'. Then, select your empty partition, and set it to 'Custom size' or 'System managed size'.
If you chose to make it custom, set the initial size to the size of your RAM, and the maximum size to the size of that partition (at most twice the size of your RAM)..

Once you have done that, reboot the PC and you can see the difference. The image below shows the OS partition without the pagefile. Note that there is no more 'green' block.


And this image below show the new partition dedicate for the pagefile:

Take note that you should not save or put any file into this partition. That would beat the purpose of having a dedicated partition.

If you want to do this, make sure you do it properly. Try not to resize your existing partition since it might cause the data to corrupt. Best to have someone who can take action in case things go wrong on your side while you're doing this.

So, that's all for now. Cheers. ^.^

Thursday, 19 September 2013

Warcraft 3 Hotkey

Greetings, Audience.

I'm pretty sure there are still a lot of you guys who still play War3 even though that game already at least a decade old.

Thanks to the vast number of custom map developer available, the number of interesting maps keep increasing, along with the game complexity where the need for micromanagement now also include the good timing in using the 'clickable' item in the inventory.

By default, the key for the unit's inventory are mapped to the keyboard's numpad (1,2, 4,5, 7 and 8). On normal keyboard, these keys are pretty far from our left hand (where mostly right hand will only be on the mouse). To make your gameplay easier, you can 'bind' these key to another key that is closer to 'WASD' region.

To do this, I prefer to use a software called Autohotkey. It is a lightweight program, and highly customize-able. For those who are familiar with programming, the learning cure is pretty simple.

To get back to the topic, below is the hotkey that I use to remap War3 intentory keys:

!z::send {Numpad1}
!x::send {Numpad2}
!a::send {Numpad4}
!s::send {Numpad5}
!q::send {Numpad7}
!w::send {Numpad8}

To use it, simply copy paste those 6 line of code into your favourite text editor, and save it with the extension of '.ahk'. Then run it to use it. Make sure you have the autohotkey software installed. You might need to run it as administrator on vista / 7, depending on your computer's setting.

In that code, I remapped numpad 1 to ALT + Z, numpad 2 to ALT + X, and so on.

Have fun trying it in game. ^.^

Utilizing SQL Developer autocomplete feature

Greetings, Audience.

Lets say, in your line of work (or maybe study) requires you to work with Oracle SQL, I would recommend that you use SQL Developer as the client IDE. It is quite lightweight, and currently maintained by Oracle itself.

Ok the point of this post is not to promote SQL Developer, but instead to show on how to utilize the autocomplete feature of SQL Developer. For this, I will show the example using a simple SELECT statement.

To begin, create the skeleton SELECT query from the desired table:
Be sure to follow the proper syntax so that the IDE won't complain (in which it might cause the auto-complete not to work). Use the indentation that best suit your style.

When you are typing the table name in the FROM clause, the auto-complete dropdown box will come out if you pause for several seconds. You can force this to come out by typing the first letter of the table name, and press CTRL + Space.

Next, build the WHERE clause. Link those tables and put restrictions. Here, the auto-complete box will come out when you type in the table name (or alias), followed by a dot '.'.
If somehow you accidentally do something that make the box disappear, you can force it to appear again by pressing CTRL + Space. Make sure that the typing caret is still nearby the 'dot'.

Once you've completed the WHERE portion, then only you come back to the SELECT part, and select the proper column that you want.
Similar to WHERE portion, the auto-complete will appear after any table and dots, and can be force to appear using CTRL + Space.

So.. Yeah.. That's pretty much about it. The main thing that you need to remember here is to always have the skeleton first. The auto-complete feature will appear based on the table that you choose.

Good luck, and have fun query-ing.
^.^

Intro

Greetings, Audience.

Welcome to my, blog. This will be the place that I will store some tips and tricks, mostly related to the games that I played and maybe something on programmings.

Look forward for the future posts that I might make, and have fun.

^.^