Twitter Updates

Friday, 8 May 2009

Microsoft Word Changing Case

Changing the case of text in Microsoft Word is no longer done in the fomatting pane. It has its own 'Change Case' menu item.

Select/Highlight text then select Format -> Change Case

WordChangeCase01

Select from these 5 options. Sentences case is useful if you accidentally typed everything upper case

WordChangeCase02

Firefox shorcuts Tips and Tricks

If you use Subversion or other web based tools you might have cgi scripts/web pages that take the url of another page as an argument, this is a nice trick for easily entering the the new page with the other url as a refference.

Create a new shortcut in firefox.
Right click and select properties.
Set Name to What ever you would like.
Set Location to be:
javascript:location = 'http://newpage.com/new.php?url='+escape(location); void 0

goto google.com then select your new shortcut then you will load http://newpage.com/new.php?url=google.com

Tip Originated from here:
http://www.mvps.org/dmcritchie/firefox/kws.htm#url

Wednesday, 6 May 2009

Convert sections of Web pages to images

If you find a need to convert a web page into an image, say saving a section of a google map, Abduction is a good plugin for Firefox 3.

Once installed, just right click on the web page choose 'Save Page As Image'. A preview window then opens which lets you select which part gets included in the image, where and what image format.

Tuesday, 5 May 2009

Java delete non-empty folders

The Java File.delete(); method only works on empty folders to delete a folder and its contents recursivly do some thing like:


   public static void recDelete(File folder) {
if(folder.exists()) {
if(folder.isDirectory()) {
File[] files = folder.listFiles();
for(int i=0; i < files.length; i++) {
File curFile = files[i];
// call to delete the current file/folder
recDelete(curFile);
}
}
//If a folder Deleted all contents
//If a File Jump straight here
folder.delete();
}
}

Tuesday, 28 April 2009

Displaying code Snippets on blogspot

I have been trying to show pretty code snippets on blogspot.com/blogger.com. I found for larger files github.com displays code nicely but not very handy for short inline examples. Today I discovered prettify by google



This post describes setting up code.google prettify on blogger.com



Originally explained here:
http://lukabloga.blogspot.com



Include this before the head tag in the blogger template.



I have made a modified version of the css file suitable for displaying code on darkbackgrounds, I use this instead:





Then change the body tag to:



Then use the prettyprint class when using pre tags around code:



Monday, 27 April 2009

Scite bash script config

in Scite the config for bash/shell scripts are handled by the perl.properties by default.

I believe this is the section of the config file which applies it to .sh file by default.
file.patterns.perl=*.pl;*.pm;*.cgi;*.pod
file.patterns.bash=*.sh;*.bsh;configure

shbang.perl=pl
shbang.sh=sh

filter.perl=Perl (pl pm)|$(file.patterns.perl)|
filter.bash=Bash (sh bsh)|$(file.patterns.bash)|

lexer.$(file.patterns.perl)=perl
lexer.$(file.patterns.bash)=bash

Ruby Shoes, Get full path of current application

After reading this post [1] I though that [2] would return the full path, as the url suggest it is only a relative path. For Ruby scripts executing under Shoes the current dir can change so it is always best to refer to a full path. The short script at [3] should give just that.

[1] http://stackoverflow.com/questions/757455/relative-file-paths
[2] File.dirname($PROGRAM_NAME)

[3]:
def getFullPath
modulepath = File.expand_path($PROGRAM_NAME)
modulepath = $modulepath.gsub($PROGRAM_NAME,"")
return modulepath
end