Apr 27, 2011

Custom page numbering in MS Word

I'm sure most of you came across this problem before - how to add custom page numbering.

I don't really like making seperate documents for the pages I don't want numbered and options in MS Word are preety limited. You can set up the numbering to start with a different number. You can't, however, set it up to start with a negative number.

Example: You have the first three pages you don't want numbered (front page, page index, thanks). Everything after those pages is numbered and starts with 1.

- Go to the header/footer - wherever you want to set up page numbering.
- Add page numbering, set it up to start with zero and check the option to have a different header/footer on the first page. This way the front page will have the page number zero, but you can delete numbering for that page.
- Now you need to "extend" the first page, so that the second (or third) page will also be unnumbered. You can do this with page breaks, go to Insert -> page break. There are a couple of different page breaks, choose the one that fits your needs.

There's an other way to do a completely custom page numbering, but it involves a tiny amount of "programming" and it won't work the same if you add page index, but here goes:

- Go to the header/footer
- Retype this code for the example above:
{ IF { PAGE } < 4 "" "{ = { PAGE } - 3 }" }


The important thing here is that you need to press CTRL+F9 to get the curly braces. If you retype them, it won't work.
- After you've written the conditions for page numbering, right-click on it and choose "Update field".

{ IF { PAGE } < 4 "" "{ = { PAGE } - 3 }" }
This is a simple conditional statement, if the current page number is less than four, the first argument (The empty "" string) will be used, otherwise it will calculate the current page number minus three.

Here are some other examples:
{ IF { PAGE } < 3 "" "{ = { PAGE } - 2 }" }
Skip the first two pages

{ IF { PAGE } < 3 "{ PAGE }" "{ = { PAGE } + 5 }" }
Number the first two pages normally, then add 5 to the current page number.

{ IF { PAGE } < 3 "{ PAGE }" "" }
Add a page number only to the first two pages.

Source

Apr 25, 2011

PHP: in_range()

function in_range($num,$low,$high,$step=1) {
    return in_array($num,range($low,$high,$step));
}


Apr 16, 2011

jQuery cycle flash - swf file reloads

Flash object gets reloaded if you use jQuery functions .hide() and .show() or to be exact, setting the css property display from 'block' to 'none' resets the swf (flash) objects.

This topic has some info on how to hide a flash object without resetting it.

jQuery Cycle plugin hides slides with .hide(), so I changed all .hide(), .show() functions and .display properties to use the 'visibility' property. The topic mentioned above says that this is not a cross-browser solution, so it needs some testing.

Here's the fixed code
http://pastebin.com/r5bySug4

Apr 14, 2011

Exporting wireless network passwords in windows

Open command prompt as an administrator

netsh wlan export profile folder=C:\

To import, type:

netsh wlan add profile filename="c:\Wireless Network Connection-whatever.xml" user=all