I'd already forgotten...

September 20th, 2007

… the login to this site. :D

Anyway, let’s start to use this properly now.

How can I count the number of occurrences of a substring within a string?

September 20th, 2007

If you want a count of a certain character (X) within a string, you can use the tr/// function like so:

$string="ThisXlineXhasXsomeXx’sXinXit": $count = ($string =~ tr/X//); print “There are $count Xs in the string";

This is fine if you are just looking for a single character. However, if you are trying to count multiple character substrings within a larger string, tr/// won’t work. What you can do is wrap a while loop around a pattern match.

$string="-9 55 48 -2 23 -76 4 14 -44″; $count++ while $string =~ /-\d+/g; print “There are $count negative numbers in the string";

BTW, this is a Perl FAQ 4.24

How to disable or uninstall the pilot version of Microsoft Windows Genuine Advantage Notifications

July 12th, 2007

Just testing

February 16th, 2007

Whilst I’m on a conf call. It’s been a while since I’ve done any blogging, so here are some links:

http://anon.inf.tu-dresden.de/win/download_en.html (Anonymous Proxy Program that’s free and works!)

http://pause.cpan.org (The Perl Authors Upload Server: I need to submit my new Ngstatistics program)

http://uk.finance.yahoo.com/currency-converter?u (Currency converter)

http://www.reverso.net/text_translation.asp (A good online translator) http://babelfish.altavista.com/babelfish/ (And another one)

IMO, these are both better than the MS integrated translator with Worldlingo…

Changing the webmin password

December 28th, 2006

If you forget the webmin password, recover it with the command below:

/usr/webmin/changepass.pl /etc/webmin/ webmin_login your_new_password

Where :

changepass.pl is in your webmin directory
/etc/webmin are where your config files are stored
webmin_login is your webmin login (surprisingly) and
your_new_password is your new password (no kidding?)

Get webmin from here. It’s the dogs nads for administering *nix systems and is free.