SWC Header

Cablechip Solutions

web development with Unix, Perl, Javascript, HTML and web services

Title

Cablechip Solution's Blog

Should I buy a Xiaomi Redmi phone? (mi vs samsung)

 Yes!

Xiaomi are not so well known in the UK, but are the world's 3rd biggest smartphone manufacturer (on 11%) after Apple (1st on 20%) and Samsung (2nd on 16%).

Chinese Huawei (with sub-brand Honor) used to be 3rd until President Trump banned US firms from dealing with them, so they could no longer access western chips or the Google Play store. Now Xiaomi and fellow Chinese Oppo are duking it out to chase Samsung.

So, how do Xiaomi compare to Samsung?

Very well on value for money and very well on customer focus.

Both firms take Google's raw Android, and give it a 1) a "skin" of their own, and 2) a lot of default apps you can't remove and take up space.

Fortunately, #2 is now no longer a problem. Even cheap phone can have 64G of memory - more than enough for all the apps you could ever want.

With Xiaomi, #1 is not a problem either. The phone does come with lots of their apps and lots of Google's as well, so you can just ignore their mail or calendar app, and use Google's instead. In the past their used to be a problem with intrusive ads - that's no longer the case. The Xiaomi version of Android seems to be "stock Android" plus a few things, so you can swap from a Xiaomi phone to another Android phone without being lost.

Where Xiaomi wins though is value for money. Their phones are much cheaper than Samsung. My 64GB phone with a great camera, big screen, big battery, fast charge, fingerprint sensor, and NFC (Android pay) was £140. A few weeks later is was £10 cheaper with a free smartwatch thrown in! 

Oh, and my phone has already had 2 Android security updates - something my Samsung never had. One year after their mid-range phone's are released, so 6 months or so after you buy it, they are abandoned by Samsung. No more Android or security updates. That's another reason Xiaomi win.

Google release new versions of Android annually. Google's Pixel phones get it straight away. Xiaomi's mid range phones get it about 18 months later. Later, but better later than never like Samsung. (Security updates are different - they come after a month or so)

So what's bad about Xiaomi. The phones not quite as good as a Samsung. It crashes occasionally (the Samsung never did), and when the battery dies, so does the phone, it doesn't "hibernate" and resume from where it left off. Both are very mild gripes.

But comparing it to  partner's flagship Samsung, I much prefer mine. OK, her camera is awesome, every picture is just perfect, but my fingerprint sensor is much better, her volume is broken (she need to make calls on handsfree to hear them), then lots of Samsung clutter that annoys her. Samsung repairs are outrageous - the cost to fix her phone was more than mine cost in the first place. Some Xiaomi's now come with a free screen replacement.

Another drag are their endless discounts :) did I say my phone was cheaper with a free smartwatch a week after I brought it.

Top tip. Follow Xiaomi UK on Facebook. They are always having sales events - just like a  sofa or carpet shop! Wait a week or 2, and you'll get a fab sale. A recent example was their flagship for £200 off, or the current range ("9") about to be replaced for 1/2 price (£80 for a 64G phone). They often do promotions on Amazon. If you buy direct - the best discounts apart from Amazon promotions - the phone comes from France and takes 2 or 3 days.

Their ranges seem to come out every 6 months or so. I brought an "8" six months ago when it was being remaindered. Now they about to launch a flagship "11".

Note: some of their cheaper phones don't have google pay (NFC) - check if this is important to you.

Summary : After 6 months I am so glad I switched from Samsung. Great phone. Awesome value for money. Nothing I don't like about it.

How to fix a memory card (or TomTom Home hangs on the 'updates screen')

I've had a TomTom satnav for years, with a map of Europe on an internal memory card. And its always just worked. Once in a while, like every 6 months, I've updated it using my PC and the TomTom Home program. Recently, it started to hang / freeze on the updated screen.

The solution was to fix the corrupted internal memory card. Note this solution works for any SD or other memory card.

1. Plug the memory card in to your Windows PC (or attach your TomTom with the USB cable)

2. Use File Explorer (not Internet Explorer) to see which drive letter it is, e.g. F: (do not actually go in to it)

3. Use search to locate cmd (old windows) or powershell (new windows)

4. Right-Hand-Click it, and choose 'run as administrator'

5. Enter this command chkdsk J: /F /X /R Replace J: with the letter for your memory card

What does this mean?

chkdsk is the windows "check and repair disk drives" program.

chkdsk /?

Checks a disk and displays a status report.

CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix]

volume              Specifies the drive letter (followed by a colon), mount point, or volume name.

/F                  Fixes errors on the disk.

/V                  On FAT/FAT32: Displays the full path and name of every file on the disk.

/R                  Locates bad sectors and recovers readable information 

/X                  Forces the volume to dismount first if necessary. All opened handles to the volume would then be invalid

[shortened - NTFS options not displayed]

Litespeed - A drop-in replacement for Apache?

Our webhosts recently switched to Litespeed, a "drop-in" replacement for Apache httpd (webserver).

Except, it isn't. In theory, Litespeed follows the same syntax as Apache for the configuration files - except for the directives they don't support! And they don't document which ones they support, and which ones they don't.

So when you try something, you don't know if its not working because:

  • its not supported, or,
  • it is supported, but you didn't configure it correctly

Apache httpd does seem a little moribund of late, so a newcomer has to be good. But Litespeed is let down, seriously let down, by its documentation.

Windows Print Screen - The PrntScr Key

Capture the screen, or a window, and paste it into a document.

In brief

Print-Screen (may be PrtScr, or some similar abbreviation)
  • this copies the screen. Then paste into MS Word, Picasa, Gimp, etc.

ALT, then Print-Screen together.
  • this copies the active window. Paste as above.
Windows-Key, then Print-Screen together.
  • this copies the screen (takes a screenshot) and save it to a file in My Pictures/Screenshots

Details here

Favicons, Apple-Touch-Icons, and MS-Tiles

Once upon a time, a website had one "favicon" (a picture bookmark), and it was called favicon.ico, and life was good.

Then Apple came along, in the best Microsoft traditions of taking something simple, and making it labyrinthine, obfuscated and over-complicated, introduced a whole suite of favicons. Then Microsoft got in on the game. And Android. So now a website need loads of favicons in different sizes.

This website does it all. Upload an image, and it generates all the favicons you could ever dream of, and the HTML you need to go with them.

http://realfavicongenerator.net/

Top tip.

The favicons ideally need to be at the top level to work, e.g. www.website.com/favicon.ico - but having all these files there makes you website untidy. Solution - place them in a directory, e.g. /icons, and use .htaccess to take care of the links

##favicon pollution
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^favicon(.*) /icons/favicon$1
RewriteRule ^apple-touch-icon(.*) /icons/apple-touch-icon$1
RewriteRule ^mstile(.*) /icons/mstile$1
RewriteRule ^browserconfig.xml /icons/browserconfig.xml

Our favicons - 1 is no longer enough!

apple-touch-icon-114x114.png
apple-touch-icon-120x120.png
apple-touch-icon-144x144.png
apple-touch-icon-152x152.png
apple-touch-icon-57x57.png
apple-touch-icon-60x60.png
apple-touch-icon-72x72.png
apple-touch-icon-76x76.png
apple-touch-icon.png
apple-touch-icon-precomposed.png
browserconfig.xml
favicon-160x160.png
favicon-16x16.png
favicon-196x196.png
favicon-32x32.png
favicon-96x96.png
favicon.ico
mstile-144x144.png
mstile-150x150.png
mstile-310x150.png
mstile-310x310.png
mstile-70x70.png


A New Website Design

Our website is content heavy - lots of walk directions, maps, and updates, so space is at a premium.

We've also noticed a lot of traffic coming from tablets and smartphones - smaller, landscape orientated, with a touchscreen, without a mouse.

So it was time for a redesign, something brighter and bolder, and smartphone friendly. With responsive design. This is the current buzzword. It means responding to the users device - e.g. if the user has a small screen width, display a narrow ad and smaller images - and if the user has a large screen side, serve wider ads and bigger images. Simples.

Sorry, a bit of CSS, even if you are not techie, you should be able to see what's happening.


<style>
.example { background: url(small.jpg ); }
@media (min-width:500px) { .example { background: url(medium.jpg); } }
@media (min-width:800px) { .example { background: url(large.jpg ); } }
</style>


Also, Windows Metro style flat icons with bold colours are in at the moment, rather than ones with Photoshopped embossed shading. The guys at DesignModo.Com have produced a cool free Flat UI pack (based on JQueryUI) which includes everything you could want. It has some nice colour swatches which I might yet use.

I particularly like turquoise on midnight.

While looking for a new drop down menu layout I chanced upon a tutorial, and from the same site, an even cooler tutorial for CSS breadcrumbs

I cannot finish without mentioning a cool start up http://pagefair.com/. They have a system for Ad Blockers. Lots of websites, including our are ad supported. Now if you use an ad blocker (I do myself!), you are freeloading. Pagefair have a system that inserts a bit of Javascript on your page. If it detects an adblocker, it asks you to unblock the page, donate a few dollar, or be reminded again in a few weeks.

Rather than customising all these ity bity things, its maybe its worth going the whole hog and using Bootstrap - combines mobile friendly CSS and Javascript UI widgets like drop down menus and tabs. Another To Do.

Welcome

Welcome.

This will be a bi-polar blog. News about walking in Southeast England, and techie stuff about being a webmaster.

OS Maps and GPS Data

GPS - the global open standard - use latitude and longitude. to identify a point.

Ordnance Survey Maps use their own systen. The points (e.g. TZ123456), or sometimes given at 6 figure easting and northings (e.g. 123456,123456) while user friendly, and easy to locate on the grid superimposed on OS maps, can't easily be be used by satnavs.

The maps to convert between the 2 systems is rather comples, but we can do it for you..

Character Sets

Definitions

Character Sets
  • A character set in a sequence of characters, each character is represented by a number.
    e.g. 65=A, 66=B, 67=C, ... 1234=£, ...
  • Examples of character sets are:
    ASCII, ISO 8859-1, Windows 1252, ANSI

Character Encoding
  • A character encoding is a means of representing a character set in a file.
  • For ASCII and Windows 1252 (or ANSI), its easy, 1 byte = 1 character.
  • For large character sets, with more than 256 characters, it is more complex, as more than 1 byte per character is used.
  • "UTF-8" uses 1, 2, 3 or 4 bytes per character.
Character References in HTML and XML
  • An entity reference is of the form:
    &quot; &euro; &copy;
  • A numeric reference (in HTML and XML) for character 256 is of the form:
    &#255; (decimal) or &#xFF; (hexidecimal)

Character Sets

ASCII

  • ASCII is the original Character Set, with 128 characters defined.
  • 1 byte = 1 character.

ISO 8859-1

  • This is the ISO "Western European" character set.
  • It is the original "web" character set, and used as the default by older browsers.
  • ISO 8859-1 is a subset of the larger UCS/Unicode character set (not quite true, but almost)
  • It is now depreciated (obsolete) - use UTF-8 instead.

Unicode and UCS (Universal Character Set)

  • This is a very large character set. It is a combination of the ISO 8859-1 characters,
    plus mathematical and other symbols,
    plus the Chinese, Hebrew, Japanese, Greek, Thai, Persian and other alphabets.
  • Some special cases :
    - there are spaces reserved for 'user defined' characters,
    - some characters can be combined to make composite characters (e.g. Thai)
  • Unicode/UCS is a character set. It is encoded using UTF-8
Windows 1252 / ANSI Character Set
  • This is the Windows character set.
  • It is encoded using 1 bytes (0-255) per character.
  • From 0-127, its the same as ASCII
  • Between 0x80 and 0x9F there are differences. This is the problem area, as these character positions are 'not defined' in ISO 8859-1 and UTF-8
  • From 0xA0 and above, its "the same" as ISO 8859-1.

Character Encoding


UTF-8

  • UTF-8 is actually a character encoding, not a character set. Colloquially, it is now used to mean "Unicode/UCS with the UTF-8 encoding"
  • Its a means of using 1, 2 , 3 or 4 bytes to store a very large character set.
  • ASCII characters (0-127) take up 1 byte, so its backwards compatible.
  • £, maths symbols, Chinese and Japanese characters take up 2, 3 or 4 bytes
  • Some Windows editors use a 'BOM', a character at the front of a file to indicate that the file contains UTF-8 encoded characters. (Actually, its a 2 byte character that's illegal in UTF-8). Not part of the spec.

Character Set Conversion Problems


Whatever you've used in the past, UTF-8 (Unicode/UCS), is the thing to aim for. Google, Blogger etc all use it.

From Windows 1252 / ANSI to the ISO character sets

  • If converting text from a Windows file to a web page in ISO format, you may have to map some 'hi byte' characters, e.g. the euro symbol, as the character numbers will not be the same.
  • If copy-and-past'ing, windows will take care of the conversion for you.

From ISO 8859-1 to UTF-8/UCS/Unicode

  • Viewing a ISO 885901 file in a web browser page set to UTF-8 will display any characters greater than 128 as illegal characters
  • In terms of character sets, the conversion is straight forward, as there are "no" differences you are likely to encounter.
  • The character encoding is the problem. Example: In ISO 8859-1, character(165) is stored as binary 165. In UTF-8, it should be 2 bytes. The single byte will be an illegal UTF-8 character.
  • The solution is programing language dependent or editor dependant.
    • For example, in the Notepad++ editor, there is a 'convert ANSI to UTF-8' option.
    • In perl: $string =~ s/ ( [\x80-\xff] ) / chr($1) /gxe;

UTF-8 to ISO 8859-1

  • Viewing a UTF-8 file in a web browser page set to ISO 8859-1 will display 2 (or more)characters for each UTF-8 'hi byte' character.
    e.g. For 2 byte UTF-8 characters, it will display an illegal character, followed by the character you want.
  • The solution: First, identify all characters in your input stream, that don't have ISO 8850-1 equivalents
  • Maybe convert
    • all the exotic utf-8 bullet points to &#nn;
    • the exotic hyphens to - (minus sign)
    • the various 6, 66, 9, 99 style quotes to ' and "
  • For XML feeds with character codes greater than 255, consider &#nn; escape sequences(rather than &name; or the binary code, both of which will cause problems)

Case Study

A well known international newspaper has a publishing system that uses UTF-8, and a series of XML feeds that use ISO 8859-1

  1. Analyse an entire year's worth or newspaper articles.
    • Make a list of every unique characters used.
    • Cater for &#nn; and &name; style characters.
  2. Map all the UTF-8 characters found (with character code greater than 128) to ISO 8859-1 equivalents.
  3. Flag up any UTF-8 characters encountered in the conversion process which are not covered by this mapping.
    • Again, cater for &#name; and &name; characters.
  4. Escape all characters greater than 128 with the XML &#nn; escape sequence, so the output file is pure ASCII

Appendix : Differences between Windows 1252 and the ISO Character Sets


In practise, you may wish to map characters to ', ", and - rather then "left single quote" etc

0x80 0x20ac ;Euro Sign
0x81 0x0081
0x82 0x201a ;Single Low-9 Quotation Mark
0x83 0x0192 ;Latin Small Letter F With Hook
0x84 0x201e ;Double Low-9 Quotation Mark
0x85 0x2026 ;Horizontal Ellipsis
0x86 0x2020 ;Dagger
0x87 0x2021 ;Double Dagger
0x88 0x02c6 ;Modifier Letter Circumflex Accent
0x89 0x2030 ;Per Mille Sign
0x8a 0x0160 ;Latin Capital Letter S With Caron
0x8b 0x2039 ;Single Left-Pointing Angle Quotation Mark
0x8c 0x0152 ;Latin Capital Ligature Oe
0x8d 0x008d
0x8e 0x017d ;Latin Capital Letter Z With Caron
0x8f 0x008f
0x90 0x0090
0x91 0x2018 ;Left Single Quotation Mark
0x92 0x2019 ;Right Single Quotation Mark
0x93 0x201c ;Left Double Quotation Mark
0x94 0x201d ;Right Double Quotation Mark
0x95 0x2022 ;Bullet
0x96 0x2013 ;En Dash
0x97 0x2014 ;Em Dash
0x98 0x02dc ;Small Tilde
0x99 0x2122 ;Trade Mark Sign
0x9a 0x0161 ;Latin Small Letter S With Caron
0x9b 0x203a ;Single Right-Pointing Angle Quotation Mark
0x9c 0x0153 ;Latin Small Ligature Oe
0x9d 0x009d
0x9e 0x017e ;Latin Small Letter Z With Caron
0x9f 0x0178 ;Latin Capital Letter Y With Diaeresis

How to Install Template Toolkit on Windows

If using Activestate Perl on Windows XP, Windows Vista etc.:

  1. Have a look at : http://cpan.uwinnipeg.ca/PPMPackages/10xx/
  2. These modules are for Perl 5.10 (only). Use perl -v to check you're using 5.10
  3. run ppm (activestate's perl packet manager)
    - can just type ppm at a dos prompt (in vista at least)
  4. In ppm: Edit > Preferences > Add Repository
    - name = university of winnipeg
    - url = http://cpan.uwinnipeg.ca/PPMPackages/10xx/
    - this will then sync with the repository
  5. In ppm: Select template toolkit (may have to do "view > all packages" to see it)
  6. In ppm: File > Run Marked Actions

As a bonus, there's loads of other perl modules as well.

Regex : Tutorial

Regular expressions, or regex, are one of the best things about Perl. So good infact, that they been copied by most other programming languages.

They are sadly let down however by Perl "man pages" and the chapter in the 'Programming Perl' camel book which in no way does them justice. It explains them, but only in a way a Computer Science PHD student would understand.

So, here's my tutorial with lots of examples.

NB 1: this is based on Perl, but you can use them in Javascript, Python etc.

NB 2: once you understand this, you should be ready for the reference material

Regex : Using a regular expression (perl specific).

There are 3 ways to call a regex:
  1. Use: $x =~ //
  2. Use: $x =~ m//
    or m## or m"" or m{} or anything else you care to choose
  3. Use: qr()
    or qr## or qr"" or qr{}
Why so many ways. First, that's Perl. But it helps with escaping, see examples below. Just choose the delimiters that don't appear inside the rege.

The usual choices are // () ## and ""


$x =~ /andrew/;
$x =~ m/andrew/;
$x =~ m#andrew#;
$x =~ qr(andrew);

#matches speachmarks
$x =~ m/"andrew"/;

#matches HTML tags - there's no need to escape the / in </b>
$x =~ qr# <b>andrew</b> #;

Regex : Using whitepace and comments

The /x modifier

Using whitespace and comments inside your regular expression is a brilliant idea, especially as regex often look like line noise, even to yourself a week later..

If you need a space, you'll need to escape it as \ (that \ then a SPACE ) or \s (which means any whitespace character)

$x =~ / andrew /ix

# these last 2 are the same
$x =~ m# <b> \s* andrew \s* </b> #ix;

$x =~ qr" # " is the delimiter to start and end the regex
<b>
\s* andrew \s* # allow optional whitespace (0+ chars) at start and end
</b>
"ix; # ignore case

Regex : Some simple examples

Some simple examples to start


$x = 'Andrew';

print 'match' if $x =~ /rew/;
match

print 'match' if $x =~ /And/;
match

# no match as and doesn't match And
print 'false' if $x =~ /and/;

print 'true' if $x =~ /and/i; # the 'i' is ignore case
match

Regex : How many times to match?

Place these modifiers after a character:

  • + matches 1+ times
  • * matches 0+ times
  • {3} after a charater matches it 3 times
  • {2,3} after a charater matches it 2 to 3 times
Greedy and Not Greedy


$x = "

one

two

";

#.* is greedy, so this matches from the first

to the last



$x =~ m#

.*

#x

#.*? isn't greedy, so this matches

one

only

$x =~ m#

.*?

#x

Regex : Predefined Groups of characters

Groups of characters

  • /s matches a whitespace character
  • /S matches anything except a whitespace character
  • /w a word charaters (a-z, A-Z, 0-9, Persian, Greek, Chinese alphabets, etc)
  • /W anything except a word character
  • /d matches 0..9
  • /D matches anything EXCEPT 0..9

Regex : Groups

Use ( ) for groups.


$html =~ (andrew)
# matches andrew

((andrew)|(john)|(peter))
# matches andrew OR john or peter

# the same, but with whhitespace
# m# - use # as the delimiter
# #x - allow whitespace
$html =~ m#
(
( andrew ) |
( peter ) |
( john )
)#x;

Perl Complex Variables

Perl has 3 types, scalar, array and hash. These can be combined to make complex variables.

Unfortunately, the syntax isn't kind.

Defining Scalars, Arrays and Hashes.


$name = 'andrew' ;

# these 2 are the same, qw() is 'syntax sugar'
@names = qw( andrew john peter );
@names = ('andrew', 'john', 'peter');

%age = (
'andrew' => 20,
'peter' => 30,
'paul' => 17,
);

# note the outside hash uses (
# - but the inside hash uses {

%names = (
'andrew' => {
'age' => 20,
'height' => 1.76,
},
'peter' => {
'age' => 30,
'height' => 1.2,
'friends'=> ['andrew', 'paul'],
}
);


Scalars


$x = $names{'andrew'}{'age'};
# now $x = 20

$names{'andrew'}{'age'} = 35 ;


Arrays

Arrays are a bit more complex - use @{ } to access them and [ ] to set them

@x = @{ $names{'peter'}{'friends'} } ;

$names{'peter'}{'friends'} = [ 'bill', 'john', 'fred' ] ;


Hashes

Hashes are similar, use %{ } to access them and { } to set them

%hash = %{ $names{'andrew'} } ;

$names{'andrew'} = { 'age' => 20, 'height' => 1.76 } ;


Important Gotcha

When using the %hash = %{} and @array = @{} syntax, you are making a reference to the data, NOT a copy of it;


%hash = %{ $names{'andrew'} } ;
# %hash is a reference, change %hash and you change %names, and visa versa

%new_hash = %hash;
# now safe

Regex : Doesn't match


# $x does not contain andrew
$x !~ /andrew/

Regex : Match on word Boundary

\b match on a word boundary

\B matches on not a word boundary

Regex : . and the /s modifier

A . matches anything except a newline

To match a newline, use the /s modifer (treat as a Single line)


$x = qq(
andrew
was
here
);

$x =~ /andrew .* here/xs;
# matches as the /s carries the search over the newlines

Regex : Anchors and the /m modifier

Anchors
^ matches at the start of a string
$ matches at the end of a string


$x = /andrew/

$x =~ /^a/ ;
# matches as andrew starts with an a

$x =~ /rew$/;
# matches as andrew ends with a rew


But what if you have a string containing several lines (e.g. a file with \n characters) ?

The /m modifier.

This treats the string as multiple lines, so ^ and $ will match the start and end of each line in the file


$x = qq(
andrew
john andrew
andrew
);
$x =~ s/^andrew/ANDREW/mg;
# will replace 1st and 3rd andrew
# without the /m, it would only replace the third
This treats the string as a single line, so

Regex : Global Replace

The /g modifier

This repeats the regex until there are no more matches


$x = /andrew andrew andrew/;

$x = s/a/A/;
# Andrew andrew andrew (1 replace)

$x = s/a/A/g;
# Andrew Andrew Andrew (all the 'a' get replaces)

Regex : Using expressions

This is the /e modifier

Example: make HTML tags upper case


# ( ) - capture the text
# .*? - match the least amount of text, i.e. an HTML tag
# uc ($1) - make the matches text uppercase
# gxe - g is global replace
# gxe - x is allow whitespace and comments
# gxe - the bit on the right is an expressions to be evaluates

$html =~ s# ( < .*? > ) # print uc($1) #gxe ;


Example : find hi byte characters


# find hi-byte characters in HTML
# - and keep a record of all the hi byte chars found in %found
my %found ;

sub find {
my ($char) = @_ ;
$found{ $chars } ++; ## keep a record
return '[' . ord( $chars ) . ']';
}

## this will find euro and £ symbols, but not €
## \x80 is hex (ascii char 128)
## \x80-\xffff is a range - if the file is utf8, it will match hi bytes chars as well
## gxe - expression, whitespace, and global replace
$html =~ s# [\x80-\xffff] # &find( $1 ) #gxe;

Regex : Substitutions

Regex : Capture Matched text

Use brackets to capture text, and $1, $2 ... to refer to it


$x = 'andrew john';

# swap the first and second word around

$x=~ s/ (\w+) \s+ (\w+*)
/ $2 $1
/ x;

# s/ - substitute
# (\w+) - 1+ word charcters, captures as $1
# \s+ - 1+ whitespace characters
# (\w+) - 1+ word chars, captured as $2
# /x - use whitesapce and comments

# $1 and $2 survive
print $2;
# prints john

Regex: Ranges

Use [ ] for ranges - match any 1 char inside the range

$x =~ /[0-9]/;
$x =~ /[a-z]/i; # so match a..z and A..Z as /i is ignore case
$x =~ /[\n\r]/;

#match 1+ chars in the range 0..9 + - and .
#\. escape the dot so it doesn't mean "any 1 char"
$x=~ /[0-9+-\.]+/

Perl Poetry

This isn't mine, but its quite cool.

$_ = reverse sort qw p ekca lre uJ reh ts
p, $/.r, map $_.$", qw e p h tona e; print

Recommended PC Shareware

On my new Windows Vista PC I have:

Google Pack (which includes)
  • Firefox (web browser)
  • Picasa (organises photos)
  • Adobe PDF Viewer
  • Spyware Doctor (anti virus)
  • Google Earth

Comodo (firewall) NB: Online Armour is better for Windows XP

Ubuntu (so the PC can dual boot in Linux)

Activestate Perl (a programming language)

OpenOffice shareware version of MS Word, MS Excel etc)

Notepad++ (an editor that believes in Perl)

The National Trust in Southeast England

The National Trust is a charity that own many historic buildings and gardens in the UK. This is a review of its properties in the southeast

Many NT places are country houses set in grounds, or in rural areas that are nice for a walk, so its best to visit them on pleasent days. Very few have public transport, so you really need a car to visit most of them.

Their pricing policy makes it expensive to visit an individual property, but the annual membership is very good value. Join via the website to get 25% off on your first year. Note that they send out your next's year membership pack after 9 months or so to 'force' you into renewing.

Kent (southeast of London)


  • Knowle Palace: 4/5
    Large Bishop's palace set in a massive deer park. One of the biggies. Can walk from Sevenoakes train station. Nice tea room. Outside is stunning. Interior is a dimly lit (conservation) museum of very old furniture and faded portraits. The landscaped deer park is beautiful. Recommended.

  • To Do
    Chartwell, Emmetts, Igtham Mote, Quebec House, Scotney castle, Sissinghurst, Smallhythe


Sussex (south of London)


  • Nymans Gardens : 5/5
    A large, beautiful, word-class garden with a ruined house set on a hill. One of the biggies (for gardeners). Hundreds of different plants, shrubs and trees. South of London, just off the M23, between Gatwick Airport and Brighton. Waymarked walks down in the nearby forest. OK tearoom. Best when the garden is (spring and summer). Go there!

  • Petworth : 5/5
    Very large house, almost a palace, containing a large selection of paintings and sculpture, set in a massive landscaped park. One of the bigges. Most of the ground floor is open (and some family rooms on weekdays only). Great for a walk or picnic. Go there!


  • Uppark : 2/5
    Great looking house, and a great location on a quiet part of the South Downs. However the interior is very "cold", like an unlived in museum. Visit for a walk or picnic. Little information about the people that lived in it would have made for a much more interesting visit. No public transport. A long way southwest of London, near Portsmouth. Poor tearoom would be amazing if you could sit outside in summer, so best on a nice day.

Surrey


  • Clandon Park and Hatchlands : 4/5
    2 country houses close to each other in parkland. Takes about 3 hours with a walk in the parkland

  • Poleseden Lacy : 4/5
    Large country house overlooking a secluded valley. Formal grassed terrace with a view. Waymarked walks in the nearby forest. South of London, just outside the M25. OK tearoom (its being relocated). Recommended.

  • Winkworth Arboretum : 3/5
    Pretty trees on a hillside

Hampshire (Southwest of London)


  • To Do
    Hinton Ampner, Mottisfont Abbey, The Vine


Berkshire (west of London)


  • Basildon Park : 2/10
    Nice, medium sized house in a park, close to the Thames. Little about the family. Takes 1 hour.

  • To Do
    Ashdown House


Oxfordshire (west of London)


  • To Do
    Buscot Park, Chastleton House, Greys Court


Buckinghamshire (northwest of London)


  • Claydon House : 5/5
    Beautiful, medium sized house, remote location, near Stowe. Very homely. Highly recommended. Nice tearoom. Takes 1-2 hours.

  • Stowe : 3/5
    A large park with many follies. One of the biggies. I was really looking forward to this place as I like follies, but it was a bit of an anticlimax. Takes about 2-3 hours to visit as you walk around. NB the house belongs to the school, and isn't NT.

  • To Do
    Hughenden Manor, Waddesdon Park, West Wycombe Manor, Cliveden, Ascott