Skip to main content

Posts

Showing posts with the label Linux

Keyboard shortcut for 'paste as plain text' in Pidgin

I use Pidgin at work for communicating with my remote colleagues and I regularly paste code snippets and log file output into the Pidgin window. Often the text formats completely wrong and you end up sending the recipient a page of garbage rather than the real text. Pidgin has a right-click context menu option for getting round this called 'paste as plain text' which normally does the trick but what if you normally use CTRL-V to paste your text in? After 2 seconds of experimentation today I found that CTRL-SHIFT-V is the keyboard shortcut for 'paste as plain text', I now feel complete...

Paste Email Plus - perfect for multiple text snippets in Firefox

I've found recently when commenting on various blogs that I want to add a little footer to the comment with my name and blog address. For one or two comments typing it out by hand is fine but after a while I decided to try and find an automated way to deal with this issue. So I was looking for something that allows me to enter multiple lines of text and then very easily insert this text wherever I choose. Well I quickly found the perfect solution - a Firefox add-on called Paste Email Plus by Chuck Baker . You simply open the Paste Email Plus options window, enter a 'Label' to help identify this text, then enter the multi-line text in the 'Pastetext' field and click 'Save changes': You are now set up and ready to start pasting that text snippet, in any area where you would normally type text just right-click and select 'Paste Email Plus' (below 'Paste' on my system) and then choose your labelled snippet: You will now see your ...

JavaScript splits & matches with regular expressions (regex)

I had been developing some client-side validation code in jQuery / JavaScript and using Firefox (and the excellent Firebug ) to test and debug it. I was then asked to ensure that it worked in IE6 & IE7 and that's when the problems started. Apart from the usual "which file does that line number equate to, and why does it not tie up?" issues I found that IE doesn't like taking a regular expression as it's parameter to the JavaScript split function . Firefox will happily accept this and works fine but IE doesn't. After some searching it appears that Firefox might be the odd one out and that it's non-standard to pass in a regex. So what do you do if you want to split up a string based on a regular expression or rather a rule that can't be simply expressed in the way that the split function wants it? Wouldn't it be nice if you could ask if a string matches a regex but then use certain matched bits of the string in your next few lines of c...

How to disable the auto-completion 'bell' in Cygwin (using RXVT)

If you have ever hit TAB a few times in bash (via RXVT) you will probably be greeted with the loudest 'bell' your PC can muster. After a while this gets pretty annoying so here's how to disable it if you are using RXVT inside Cygwin (this might work for other Cygwin terminals, I've just not checked) Navigate to your home directory (normally just by typing cd and either edit or create a file called .inputrc Add the following lines to the .inputrc file: # Disable the annoying bell set bell-style none Save the file, close the terminal and reopen - you should now be bell-less! Technorati Tags: Cygwin , RXVT , Andrew Beacock

How to get Scala working with the RXVT terminal on Cygwin

Out of the box Scala support Cygwin , but this is only with the Windows command prompt-based bash terminal. If you have opted for the more UNIX-like terminal of RXVT then you will find that although the interactive Scala interpreter runs, you can't get it to do anything! This has been raised as a bug ( Ticket #2097 ) against the Scala project and graehl even posted a patch to changed the generation of the scala runtime scripts.  As my Scala install was based on the downloaded Windows binaries ( scala-2.7.6.final.zip ) I couldn't directly use this patch, but I could examine it to see what graehl's fix was. It appears that the key bit was to add the following Java command line option to the java statement that starts the scala interactive interpreter: -Djline.terminal=jline.UnixTerminal So the last line of my bin/scala file is: exec "${JAVACMD:=java}" $JAVA_OPTS -cp "$TOOL_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLA...

Use Pidgin? Send screenshots with this great new plugin!

I've been a big fan of Pidgin (formerly Gaim) for the past few years and one feature that I've always wanted was an easy way to send a screenshot to a buddy. Well Raoul Berger obviously wanted it too and he's gone and developed the excellent 'send screenshot' plugin . Download and install it and make sure you have enabled it: Then you can right-click and buddy in your buddy list and choose 'Send screen capture...' - your screen then darkens and you have a crosshair with which to select the region that you would like to send to you 'buddy': You can also send a screenshot within a existing conversation by choosing the 'Convesation' -> 'More' -> 'Send screen capture...' option: Another and fast, better way is to ensure that you have 'Show detailed information' selected in the 'Conversations' tab of the preferences and then you can simply right-click on the person's banner and select the op...

Installing Ubuntu inside Windows XP using VirtualBox

Since moving companies over a year ago I've missed my Ubuntu desktop having moved back to development on Windows. I've had a few comments that some of my old Ubuntu blog posts are now out of date and I've wanted a way to ensure that they remain 'correct'. After discussing virtualisation with a friend I opted to install VirtualBox - an open source virtualization tool which is free and easy to get going. This blog post contains my installation notes from installing VirtualBox and then creating an Ubuntu9 virtual machine... First I downloaded the latest version of VirtualBox (version 3.0.0) and selected the "VirtualBox 3.0.0 for Windows hosts". Then I downloaded the latest version of the Ubuntu Desktop edition . After both of these were fully downloaded I double-clicked the VirtualBox installer and choose to install everything. When the "not passed Windows Logo testing" alerts pop-up choose to "Continue anyway" then register if you w...

How to copy recorded TV programmes off your PVR (Humax 9200T)

We have had a Humax 9200T PVR for quite some time now and occasionally we have wanted a more portable copy (think DVD) of a particular programme that we have recorded. If you flip down the right-hand panel you will notice an unlabelled standard USB B socket . It's by the use of this socket that you can stream recorded programmes off the Humax and onto a PC ready for converting to a DVD (or just watching on the PC). Here's how you do it: Visit Humax's support site and download & install their rather old and flaky Media E-Linker software (Click the "Media E-Linker software (Version 2.5) download link). Get a regular USB lead with an 'A' type plug on one end, and a 'B' type plug on the other. Plug the 'B' end into the Humax, and the 'A' into any USB socket on your PC. Your PC should now 'find' the Humax and request to install the drivers, I let mine 'auto-search' and it found and installed the drivers just fine (I t...

Replace your broadband provider's DNS servers with OpenDNS ones for more reliable service

I had an 'internet issue' last week when around 10am my connection to the internet was lost. Well not completely lost - my work PC (a remote box accessed via VPN ) was still working fine so I still had a connection (at an IP level), but I couldn't visit any websites. The problem was that Pipex's DNS servers were offline (I couldn't ping them) and it wasn't planned maintenance. So I replace them with settings for the free OpenDNS servers . These DNS servers are used by millions of people around the world, I suppose I've not migrated to them before because I've not had an issue until now. The migration couldn't have been easier - I logged into my router , accessed the 'internet settings' menu option, and selected 'DNS'. Then I unticked the "Automatic from ISP" box and entered the OpenDNS server details in the IP address boxes: The OpenDNS DNS server IP addresses are: Primary DNS Server: 208.67.222.222 Secondary DNS Ser...

Easy, collaborative web UI mockups with Balsamiq

Every now and again you come across a tool that is so easy to understand, so fast to use and so effective at conveying it's ideas that you just have to tell people about it. One such tool is Mockups by Balsamic . It's a web page mockup drawing tool written using Adobe Air which provides a palette of HTML widgets with which to 'draw' your screens. It has a querky 'freehand' style which lends itself to conveying the components and ideas that a web page should have without forcing the designer to code it up in HTML (or for the customer to think that because the HTML is done, the app must nearly be ready...). Here is a very simple web page for search and listing users which I ' mocked up ' in less than 10 minutes: As you can see it's got a number of standard HTML widgets on it as well as a very useful 'post it' note allowing you to add distinctive notes and comments to the mockups themselves. So this in itself is enough to warrant using it to...

How to move an existing Cygwin installation

Although Cygwin is a self-contained installation with little in the way of the normal tendrils hooked into the dark shady corners of Windows there are a few hidden catches to moving an existing installation. Cygwin creates a number of mount points for your drives, and it's these that cause the problems when you move your installation directory around. Here are the steps to move your Cygwin installation: Save off existing mount points mount -m > /usr/bin/mountCommands.bat Unmount existing mount points umount -A Copy Cygwin directory to new home Update any Windows shortcuts & Start Menu items Update the Cgywin path within $CYGWIN_HOME/cygwin.bat Update mount points within $CYGWIN_HOME/bin/mountCommands.bat Re-mount to new location Start Cygwin ./mountCommands.bat Close Cygwin Restart Cygwin, and carry on with life This tip was compiled from information about Backup Your Cygwin installation Technorati Tags: Windows , Unix , Linux , Terminal , Cygwin , Installation , ...

How to get the Home & End keys working in Cygwin (RXVT)

Last year I blogged about how to get the Home & End keys working in remote Linux shells & terminals . Well now it's time to sort the Windows shell Cygwin out. If your Home and End keys are producing funny characters on the command line rather than moving the cursor then the input codes of the keyboard need to be remapped. Open your Cygwin terminal and create a file called .inputrc in your home directory, and add the following: # Home Key "\e[7~":beginning-of-line # End Key "\e[8~":end-of-line # Delete Key "\e[3~":delete-char # Insert Key "\e[2~":paste-from-clipboard Now edit or create .bashrc in your home directory and add the following line to ensure the above .inputrc file is picked up: export INPUTRC=$HOME/.inputrc To see if all the above has worked, reopen your cygwin terminal and try it out! If it doesn't work then just delete the .inputrc file and remove the line from .bashrc. Technorati Tags: Keyboard , Mapping , Window...

RXVT - a better console for Cygwin (Unix on Windows)

If you use Windows for software development you will have probably come across Cygwin at some point, the Unix shell for Windows (well a bit of a fake console but it will have to do!). The console out of the box is a bash shell running within a normal Windows cmd prompt box, which is ok but doesn't really give you all the features of a proper Unix shell, click and drag to select text, middle click to paste, decent scroll buffers, etc. However there is a solution to these issues - scrap the silly Windows DOS box and run RXVT instead! First off you will have to run the Cygwin installer again (don't worry it's quite clever and won't corrupt your current version of Cygwin) and select the rxvt terminal package to install. Then continue the installation as normal so that you are left with the Bash shell shortcut icon. You will now need to replace the normal DOS box bash terminal with the new RXVT one. Right-click on the shell shortcut and change the "target" an...

Restoring disappeared context menu items in Eclipse

A recent problem we have had with Eclipse is where on one particular developer's PCs some of the options in the right-click context menu were not available. These options were also only not available on non-'build path' source folders. It was a very strange issue but we did manage to solve it: Choose the 'Reset Perspective' option from the 'Window' menu to restore all the default options which includes the right-click context menus! Technorati Tags: , Eclipse , Andrew Beacock

Using ampersands (&) without variable substitution in Oracle either direct or with SQL*Plus

Oracle uses the ampersand (&) symbol within a string to indicate a substitution variable. But what if you want to use an ampersand as part of a regular string such as 'Bob & Sons'? There are two solutions that I know of and which one you use depends on the context in which you are running your SQL: Dealing with the ampersand on an SQL level To turn off interpreting the ampersand as a substitution variable it must be at the end of a string: insert into companies values ('Bob &' || ' Sons'); Dealing with the ampersand when using SQL*Plus To disable Oracle's variable substitution and therefore return & to the pool of standard characters you need to tell SQL*Plus to disable it: set define off Add that to the top of your Oracle SQL script or type it manually at the SQL*Plus prompt. These tips plus many more can be found within the rather useful The Oracle (tm) Users' Co-Operative FAQ . Technorati Tags: Oracle , Database , Ampersand , Variable ...

Colour Linux & Cygwin console searches with Colourised Grep

Grep is a wonderful tool useful for searching for all kinds of stuff but sometimes what you are searching for gets lost: To get your console shell to add a little colour to your grep search terms add the following to your .bashrc or .profile or the like: export GREP_OPTIONS='--color=auto' export GREP_COLOR='1;33' Now if you perform the same search again your output should be a little clearer: And as an added bonus this works on Cygwin (the Windows Unix shell) as well as Linux! Technorati Tags: Cygwin , Linux , Console , Shell , Colour , Grep , Andrew Beacock

How to control another PC without a KVM using Synergy

If you sometimes have your laptop next to your desktop PC you might find that you are hopping from one keyboard/mouse/trackpoint to the other. After a while this gets a little uncomfortable so wouldn't it be cool if you could use your desktop PC's mouse and keyboard on your laptop? Synergy is one such utility, this is how the Synergy team describe it: Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems without special hardware. It's intended for users with multiple computers on their desk since each system uses its own display. Download Synergy from sourceforge and install it as normal on both you desktop PC (the server) and your laptop (the client). On your desktop PC, start Synergy (Start -> Programs -> Synergy -> Synergy) you will be presented with the following screen: Click "Share this computer's keyboard and mouse (server)" then click "Configure..." to set up the lay...

How to restore "Escape closes windows" shortcut in Pidgin (using Ubuntu Linux)

I use Gaim/Pidgin as my IM client as it can connect to all other IM services (AIM, MSN, Yahoo, GTalk, etc.) but keeps them all within one tidy app. My favourite feature is that when you want to close a conversation window you simply just hit 'Esc' and it's gone. A collegue asked recently why his Escape shortcut was not working any more after an upgrade to Ubuntu Gutsy . It appears from Pidgin's release notes that this 'feature' was changed in version 2.0.0 (5/3/2007) : Removed "Escape closes windows;" default key binding is now Ctrl-W This hadn't happened to my version (I'm also running Gutsy) but I had to get to the bottom of it. After a little searching in .purple (the home of Pidgin's user configuration) within my home directory I was able to find the following uncommented in my accels file: (gtk_accel_path " /Conversation/Close" "Escape") In my collegue's ~/.purple/accels file he just had to change <Con...

How to use logrotate with Apache's Tomcat (and any other Java process)

Logrotate is an excellent utility for managing log files that can start grow into an unmanageble size, Tomcat 's catalina.out is one such file. Most of the solutions (scroll down to the 'Rotate the logs' section) for managing catalina.out, or other log files generated by Tomcat or any Java process for that matter, don't mention the copytruncate option: Truncate the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one, It can be used when some program can not be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place. This basically means that you don't have to configure your logrotate script to restart Tomcat just so you can tidy up...

An update to my Thunderbird TNEF script for opening winmail.dat

Back in July I blogged about Opening winmail.dat (TNEF) files in Thunderbird (on Ubuntu) . Well a colleague at work has 'refined' my script so that rather than it create a folder on your desktop it simply opens Nautilus to display the contents of the attachment. This is the new version of the script: #!/bin/bash LOCATION=/tmp/winmail_$$.dat mkdir $LOCATION /usr/bin/tnef -C $LOCATION --save-body -f $1 nautilus $LOCATION The interesting part of this script for me is the $$ - this special script variable is the process ID (PID) of the currently running script, so it makes a temporary file called winmail_<current process id>.dat . Other than that it's pretty similar to my original script apart from opening Nautilus at the end. Now it's even easier to open and extract files from winmail.dat files! I found out the reason for the $$ from here . Technorati Tags: winmail.dat , TNEF , Thunderbird , Ubuntu , Andrew Beacock