Archive for the ‘1’ Category

Replacing text in XSL, the dirty way

February 24, 2009

Here the example replaces quotes with escaped quotes \”, but can be generalized.

First define a template:

<xsl:template name="cleanQuote">
<xsl:param name="string" />
<xsl:if test="contains($string, '"')">
<xsl:value-of select="substring-before($string, '"')" /> \"
<xsl:call-template name="cleanQuote">
<xsl:with-param name="string">
<xsl:value-of select="substring-after($string, '"')" />
<xsl:if test="not(contains($string, '"'))">
<xsl:value-of select="$string" />

Then use it at the appropriate point by calling:

<xsl:call-template name="cleanQuote">
<xsl:with-param name="string">
<xsl:value-of select="text" />

Setting up Edimax EW-7318USg under Linux

November 2, 2008

This is from here:

Edimax EW-7318USg aka Hawking HWUG1 (rebranded in US)

# Driver : rt73
# Chipset : Ralink
Ralink RT2571W chipset (can be used with rt73 drivers)
chipset : RT2571WF or RT2528L

HOWTO:RT2500 wireless cards etc. sticky
Ralink 257x/2671 using RT73 driver?

I think that you might be doing some of these steps in the wrong order. eg from the instructions I was given you need to blacklist first. Here are the instructions I use:

1. sudo rmmod rt73usb (remove old drivers)

2. sudo gedit /etc/modprobe.d/blacklist and add these lines to the end of the file:

blacklist rt73usb
blacklist rt2570
blacklist rt2x00lib
blacklist rt2500usb
blacklist rt2x00usb

3. sudo apt-get install build-essential

4. sudo apt-get install linux-headers-`uname –r`

5. get the latest version of the driver source from the serialmonkey site. The name is rt73-cvs-daily.tar.gz. I saved it in my user dir:

6. sudo wget -O ~/rt73-cvs-daily.tar.gz

7. sudo tar -zxvf rt73-cvs-daily.tar.gz

8. cd ~/rt73*/Module

9. sudo make

10. if the file produced is 2Mb in size there is a problem as it should be about 250Kb. To fix this, use the “strip” command:
strip –S rt73.ko

11. sudo make install

12. sudo modprobe rt73

13. as sudo, edit /etc/modules – add the text rt73 at the end

14. as sudo, create text file called rt73 in /etc/modprobe.d

15. put the text “alias wlan0 rt73” in this file

16. remove /etc/modprobe.conf as it’s no longer needed (back it up first – but note I didn’t have one)

17. add the following to /etc/network/interfaces file. You might need to customise this to suit your particular situation (eg if you don’t use WPA encryption):

auto wlan0
iface wlan0 inet dhcp
pre-up ifconfig wlan0 up
pre-up ifconfig wlan0 down
pre-up ifconfig wlan0 up
pre-up iwconfig wlan0 essid “yourSSID” # use quotes if you have spaces in the name of essid
pre-up iwconfig wlan0 mode Managed
pre-up iwpriv wlan0 set Channel=11 # change channel accordingly
pre-up iwpriv wlan0 set AuthMode=WPAPSK
pre-up iwpriv wlan0 set EncrypType=TKIP
pre-up iwpriv wlan0 set WPAPSK=”yourkey”
pre-up ifconfig wlan0 up

18. reboot

How to list all file extensions within a directory

October 1, 2008

Here’s a simple command to list all file extensions (recursively) within the current directory
(thanks to this forum posting

find . -type f | sed -e 's/.*\.//' | sort | uniq -c | sort -rn

When you have, for example, a large codebase with lots of files that have no extension (e.g., Makefile, README, etc.), the above lists them with their full path.

Here’s a modified version of this to remove any /path/to/file/ and so just list those files too:

find . -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq