Category Archives: Other

Basic SEO—An Example

A friend of name, a teenage actor, asked me about SEO stuff earlier today. She has a website and was concerned it wasn’t rising up the rankings very well.
Using a third party website site doesn’t give you a huge amount of control but the basics are the same under any circumstances: You need a page with information on the topic at hand; and you want other websites to link to it. I originally had Rachel’s name in the title of this post, but since she’s now dominating the rankings for here name, I guessed it was no longer necessary! It does help if you have a name like Rachel Kevern though – shared by only a handful of other people in the world 😉

Rachel Kevern

In 2013 I saw Rachel acting & singing in Les Miserables and also saw her singing last night as part of The Voice. Which was excellent! After that, she got the role of Vi, the Reverend’s wife in Footloose, at the Z-arts centre in Manchester. Find her at http://rachelkevernactor.wix.com/rachelkevern.

Fastest XML Editor

The really fasted XML editor I’ve ever used is XMLMarker which loads a 5MB file in a fraction of a second. When editing, it shows the XML simultaneously in tree, text and ‘Data Grid’ views which is quite impressive as are a couple of its other features:

  • You can edit data in the data view, not just in the text view
  • If you ‘break’ the document by editing the markup in text view, the data and tree views still work (arguably a dangerous feature: caveat user)

But I’m often doing RegEx search and replace, which XML Marker doesn’t do, and often editing text as well as xml. Notepad++ is quite speedy and can do regexes, but Sublime Text 2 does regex search and replace much better: it does live highlighting of what its found as you type, so you can ‘debug’ your regexing on the fly.

Everyone wants xml pretty printing (well, re-indenting), which for Sublime Text 2 is done by first installing the WBond.net package manager and then installing the ‘Indent XML’ package. Package Management in Sublime Text is a bit command-liney, so do read Mr. Bond’s instructions.

Missing Mail in OS X Lion – IMAP accounts such as gmail

In my case, this was easily solved. Click on a folder or inbox that is missing mail. Then from the menu, Mailbox – Rebuild.

A worst case would be – assuming that you do have all the mail on your IMAP server – backup (or just move) the mailboxes on your Mac, and then delete and re-create the accounts. DON’T do this unless you’re sure you made a copy OR that all your emails are on your IMAP server.

Time Machine Backup fails on network

This article is a life’s-work saver if your network time machine backup is playing up.
I was all ready to give up on time machine as worse than worthless. It’s one thing for a backup to fail because of a wireless network failure. It’s an orders-of-magnitude different kettle of stinky fish for a failed backup to take down your entire backup history with it.



Copy of text

This is a modification of an original post for use when you have a corrupt sparsebundle backup on a NAS (as opposed to an external drive attached to a router) and it needs to be repaired. The NAS is likely a hardware product from the likes of Netgear, Synology, Buffalo or QNap – or for those of us with a home-grown backup server running FreeNAS.

The error you may see is “Time Machine completed a verification of your backups. To improve reliability, Time Machine must create a new backup for you.” This can be fixed by following the below.

From your Mac, connect to the network share that houses the sparsebundle. At the top level of the drive are the various sparsebundles that make up your individual computer backups. Do not double click on these sparsebundles or try to repair with Disk Utility.

Open Terminal and then switch to root by typing
sudo su –
and then enter your password.

The verication that has already run has marked your sparsebundle as bad, so first we need to make it look normal.
From the command line
chflags -R nouchg /Volumes/{name of your network share}/{name of}.sparsebundle
This may take a little while.

Now type
hdiutil attach -nomount -noverify -noautofsck /Volumes/{name of your network share/{name of}.sparsebundle

You will then see something like
/dev/diskx Apple_partition_scheme
/dev/diskxs1 Apple_partition_map
/dev/diskxs2 Apple_HFSX

Where x is the disk id for the external disk. You are interested in the one labeled Apple_HFSX or Apple_HFS. It might be 2, 3, 4 or higher.

At this point, I have found that the filesystem check is already happening. You can check for activity by tail’ing the fsck_hfs.log
tail -f /var/log/fsck_hfs.log

If fsck is going then in my experience it will be able to repair the sparsebundle. Go away for a few hours and let it chug away. When it is done, you will either see
‘The Volume was repaired successfully’
or
‘The Volume could not be repaired’

If the latter you can run disk repair again:
fsck_hfs -drfy /dev/diskxs2

(Optionally if you have the available RAM, you can set a RAM cache in the command above to help speed up this command like so:

fsck_hfs -drfy -c 750 /dev/diskxs2

This will use 750MB of RAM – feel free to change this amount to best fit your system (amount of RAM vs size of your Time Machine Sparsebundle). If you are unsure about this, use the first command. Make sure to replace x with whatever number your disk is from the output above.

The letters “drfy” tell the filecheck utility different things. d for ‘Show Debug’ – r for ‘Rebuild Catalog Tree’ – f for ‘Force’ and y for assume ‘yes’ to any prompts. Now go do something for an hour or two. Come back and
tail -f /var/log/fsck_hfs.log

If all went well, the last output you will see is ‘The Volume was repaired successfully’
Now you need to type
hdiutil detach /dev/diskxs2

You can redo the above for any other Time Machine sparse bundles you have permission to modify while you have the network share attached to your computer.

Final step.
When complete, you need to edit an plist file within the sparsebundle that records the state of the backup. On the top level of the sparsebundle find a file called com.apple.TimeMachine.MachineID.plist. Edit it and remove these two nodes

RecoveryBackupDeclinedDate
{whatever-the-date}

Finally you want to change
VerificationState
2

to
VerificationState
0

Now you can eject the network share and have Time Machine give it another go. After the (long) verification step, backups should proceed once again.

Notes:

Ideally this should be done over a gigabit wired network connection. Do not attempt using Wi-Fi. You also want to make sure your machine does not go to sleep during the above operation.

[Update: 12.23.2012]

If after running the initial

fsck_hfs -drfy /dev/diskxs2

command you get a message in the fsck_hfs.log along the lines of

RebuildBTree – record x in node y is not recoverable.

then try

fsck_hfs -p /dev/diskxs2

followed by

fsck_hfs -drfy /dev/diskxs2

And see if that works. It did for me today.

postscript

You can express your thanks to garth via a small donation using a paypal button his page at Garth’s website.

F# on Mac and Linux

is not, in 2012, in a great state. There are 2 not-great options and I add here a third, also not-great option. It has the advantage of working, and not requiring you to learn emacs. (Jump straight to F# with Sublime)

F# on MonoDevelop

The F# language bindings for MonoDevelop broke after version 2.4. You can get MonoDevelop version 2.4 by consulting the wayback machine for the MonoDevelop Download page at July 2011. You can then use the fsharpbindings and instructions from http://functional-variations.net/monodevelop/.
Personally I fould MonoDeveloper before 2.6 more prone to crashing, and I couldn’t get 2.4 working with FSharp.

F# on Aquamacs

If you’re an emacs fan, then you won’t need my help to find and install the f# mode for it.
For emacs newbies on the Mac with a day to burn on the learning curve, a couple of the answers on stackover gives you some clue as to how to get fsharp working:
http://stackoverflow.com/questions/1210125/is-there-any-f-ide-that-works-over-mono
http://stackoverflow.com/questions/2120533/how-to-setup-aquamacs-for-clojure-development


F# with Sublime Text 2 (Quick and Dirty)


This was the best I could do in 2 hours:

  1. Get Sublime Text 2
  2. In the Sublime text menu : Tools – Build System – New Build System
    {
    	"cmd": ["/usr/bin/fsharpcandrun", "$file"]
    }

    and save as fsharp.sublime-build .

  3. At a terminal command line, use your favourite editor to save this file as /usr/bin/fsharpcandrun :
    #!/bin/bash
    fsharpc "$1" && nameafterquote=${1#\"} && exe=${nameafterquote%.*}.exe && mono "$exe" && echo done
  4. Make it executable, again from a terminal command line:
    sudo chmod a+x /usr/bin/fsharpcandrun

    The password that sudo asks your for is your login password.

  5. If your new favourite editor is in fact Sublime, you can save files in directories requiring sudo-ed permissions by putting a command line alias for sublime in your ~/.bash_profile script:
    alias edit='open -a /Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2'

    and typing edit foo.txt to open Sublime

  6. Choose Tool — build system — fsharp in Sublime
  7. Now, <f7> your file. It should compile and run. At least, it did for me.
  8. Get some kind of syntax colouring by creating a .fs file, and then choosing View — Syntax — Open all with current extension as … OCaml. This is because F# is near enough to OCaml for the colouring to be pretty good.

I wouldn’t call this great, but it will do for the moment. It only “builds” a single file, which is hardly a build system. But it does give you syntax colouring and compile-and-run for learning F#.

The next step forwards might be to modify the bash script to fsharpc a list of files, or all files in the directory of the file to be run.