Moving from Windows/Linux to Mac, one of my Ruby on Rails applications wasn't working. I'd forgotten to install sphinx, and the error was a little cryptic for an amateur like me.
Anyway, knowing the problem, installing sphinx I expected to be easy. 2 hours later and I realise it's working. It was probably working within 5 minutes. These notes are here to remind me what I did next time I need to.
Get the 2.0.2(beta) from http://sphinxsearch.com/
I couldn't work out what to do with the Mac Binaries, so I grabbed the source .tar.gz version.
Installed ( `./configure` `make` `make install`)
I didn't realise it had installed fine - I should have typed "searchd" in bash to get a response like:
Sphinx 2.0.2-beta (r3019)
Copyright (c) 2001-2011, Andrew Aksyonoff
Copyright (c) 2008-2011, Sphinx Technologies Inc (http://sphinxsearch.com)
FATAL: no readable config file (looked in /usr/local/etc/sphinx.conf, ./sphinx.conf).
Then carry on and get the config working.
If anyone reading this knows what to do with the binary version, please share!
Where did that month go! It seems only 2 weeks ago I was opening the box of my new macbook pro but it's actually been a month already. So, what have I learned?
Remember how I said how I found it strange the mouse wheel direction had reversed? Well, that's a new 'feature' of OS X Lion. It's called "natural scrolling". Well, it might be natural if your on a touch screen grabbing the page, but I'm still used to considering the scroll controlled by mouse as moving the scroll bar down the side of the page. Fortunately, there's an option to turn that off. Now I like keeping to as many software defaults as possible so that when I use someone elses machine things work the way I expect, but this change doesn't seem ideal to me. It feels like a change for the point of change rather than a thought out user interface decision. That is, a nice idea in theory, but everyone is used to the standard so don't change it. To me, this would be the same as changing the keyboard number pad (number 1 is at the bottom) to match a telephone keypad (number 1 is at the top). Or, why not make a desk calculator the same as a desk phone (calculator number 1 is at the bottom). That difference has been a minor irritation of mine for years, but I wouldn't change it - not when so many devices are set that way and I'm used to it.
What else? Ahh, disk and memory. So, I knew I need to put windows 7 on the mac, but I hadn't realised just how much memory the two together would need. Some irritating slow performance of the Mac software has been caused by limiting it 3GB for the Mac, 1GB for Win 7. I know, that's not a lot for Windows 7 but for the design software and MS Access database I use that should be sufficient. Maybe it's not, maybe Parrallels is letting Win 7 use real memory as virtual memory (that would be clever), but I was constantly over the 4GB and noticing slow performance due to pages swapping in and out of Virtual Memory. For the geeks, on Friday after a couple of days use (I'm getting used to suspending the laptop, rather than not shutting down - I like that feature!) I had Page ins and outs of something like 20GB. So, I spend £35 on 8GB of memory chips (2 x 4GB) and after a day I have page ins of 3GB and page outs of 3MB (or 0.003GB). I haven't noticed any slow downs either but the proof will be a full day of design work, rather than just opening a load of programs.
Ruby, on the other hand, has been a pain in rear. I have at least become familiar with RVM (and I like the idea), JewleryBox (a GUI for RVM, which I like a lot) but I've yet to get one of my Ruby on Rails applications running. Things are falling down because Xcode 4.2 didn't include C compilers, I spent the time installing 4.1 and I still can't install Ruby. While I type this I'm downloading another set of compilers, uninstalling then reinstalling RVM and feeling every bit that all the people that rave about how Mac is great and doesn't go wrong, simply don't push their computers hard enough or far enough to experience the problems. That, or they accept the problems and don't find ways to fix them. Pretty much the same as me and my car - having spent about 2 years without a light behind the rev counter simply because it didn't really bother me a night knowing how many RPM's the car was using, especially as it's an automatic.
Oh, I gave up using the windows keyboard, had to buy a Mac keyboard. It's wired because I need the numberpad in my job. Although the wireless small version looked nice. I also have yet to get the Thunderbolt to HDMI adapter working. It may be my TV, but there's video and no audio. Another work in progress.
I'll leave this post with a picture. This is my desk last month, with new Mac, existing monitor and old laptop. When seen together I realise why it was getting so hard to use my old laptop - the screen had dimmed so much. It will be interesting to see if this Macbook lasts as long (5 years).
Part two of my notes of moving from Windows to Mac - read part 1 here
One of the most popular posts in the blog is the shortcut key in windows to 'show desktop'. I love shortcut keys, but they're all different on the Mac so I'm having to learn them all over again.
Here are the one's I've found so far along with their Windows equivalent;
| Action | Mac | Windows |
|---|---|---|
| Show Desktop | Fn + F11 | Windows Key + D |
| Lock Screen (when going away from my desk) | Ctrl + Shift + Eject | Windows Key + L |
For some things though, I've found I need to use a shortcut where I used to use a key. For example, "Delete" on windows, is the delete key. It removes the character to the right, as opposed to the "Backspace" key, which removes the character to the left. My Macbook Pro doesn't have a delete key, but the action is available using Fn + Backspace.
It also doesn't have a right mouse button... I'm still learning to live without that but haven't quite memorised the shortcut. I'm also finding gestures a little hard. While I'm remembering to use two fingers to scroll the page (my previous HP had a scroll function on the right side of the mousepad area), I'm finding a feeling of fatigue in my fingers similar to that I remember from learning to type or play the guitar. I like the principle of the gesture control though, so I suspect I'll wonder how I managed without it once I'm used to it.
My trusty HP laptop (nx6325 circa 2006) has finally reached retirement.
Actually, as a PC it was running fine. It's processor was expensive for it's time (a 64bit dual core AMD) and routine improvements (memory to 1.5GB, hard disk to 256Gb, 2 replacement batteries) had extended it's life nicely. The reason for replacing was the screen backlight becoming to dim to work effectively. For years I've been using it connected to a desk monitor for everyday use and it only became apparent this month when I needed to display a document on my laptop monitor alongside my desktop monitor while I worked. While I have a reputation for spending little money on computers and extending their life beyond many others it wasn't worth buying a new screen or replacing the backlight... at least, not for work. I may well play with doing that just because I can, but I can't be without a decent laptop for work.
So, what to go out and buy? A mac! Well, no, at least, I thought a mac would be far too expensive and then I've got all the incompatibility issues to deal with. That was, until I spent my mandatory several hours investigating models, options and prices. To cut a long story short, the cheapest 13" Macbook Pro worked out for me to be the best option for price and performance. Note here, I said "for me". My needs are quite specific. I expect my IT hardware to last a long time (I look after it, I'm happy to pull it apart and repair/update things, I don't need the latest & greatest processor or connectivity ports). I compared Sony Vaio, Asus, Toshiba, Lenovo and hunted through reviews on many different IT sites. As a quick summary:
The Macbook Pro won on a combination of:
- Screen Size I wanted no more than 13" screen. Smaller than my last laptop, more portable
- Battery Life claimed 7hrs, but I take that with a pinch of salt from all manufacturers. It does declare a WattHour of 63, equal to one of the HP options and greater than many others.
- Build Quality (+2 for the aluminium body, -1 for the screen's glossy surface and for two of my friends who've both managed to crack theirs... maybe thats co-incidence though)
- Connectivity I think the thunderbolt connection will be a common standard in the future, as USB is today. I could be wrong (SCSI only ever got popular on Mac desktops if I remember correctly, Firewire never made mainstream PC's) but I decided that was another nice to have feature
- My programming hobby - a lot of ruby stuff is written on Mac, so the tutorials lean that way. Easier to bug fix (well, I don't use windows for programming anyway - I dual boot my old laptop into Ubuntu)
- LearningAs the key IT person in my small business, it's good for me to know about the alternatives. Maybe Mac is really really good and our next office PC's will be replaced with Macs. I have a friend who's whole business runs on Mac, including their web servers, business databases, everything. If Mac could help me be as successful I'd be very happy!
It lost on:
- It doesn't include Windows (having to buy the licence is an additional cost)
- Battery isn't easily/user replaceable. I gather that's a side effect of getting so much battery in such a small laptop. I just about decided I could accept that compromise.
- I'd have to almost relearn how to use a computer (all my shortcut keys!)
- I don't really want to be seen with a Mac
- I have a feeling some of the ways the Mac expects me to work will be at odds with my penchant for OpenSource software, using hardware for more than the 3 year lifecycle IT salespeople seem to work to, and so on.
It was equal on:
- Price. Yes, really. £832 ex VAT against £992 ex VAT for a compariable (for me) HP Elitebook. Although, I did need a copy of Windows & Parallels/Fusion to run it, along with a few adapaters to connect the Thunderbolt to HDMI, VGA & HDMI.
- Processor the Intel core i5-2415M was better than some options, but slightly under some of the latest releases. However, my work isn't that taxing (the CAD design images can be left overnight to render).
On the subject of price, I bought it from a local (Whitstable based) company called Serviceweb who are Apple Authorised Service providers. The total order was for;
- Macbook Pro 13"
- Magsafe Power Adapter (one for my desk, spare for home and travel)
- Displayport -> VGA Adapter
- Displayport -> DVI Adapter
- Displayport -> HDMI Adapter
- Parallels Desktop 7
- Windows Pro7 64Bit
- Apple Remote
and the total cost £1095 + VAT (£1314 inc VAT @ 20%).
Considering that even for the HP I would have needed to buy a second power adapter the Mac was surprisingly well priced.
So, I've spent a couple of days using it so far, and so far, so.... average. Yes, average. I'm learning the new shortcuts quick enough. I knew it would take a while to get used to that. However, I'm also finding a few bugs. Or perhaps they're not bugs, maybe they're 'features' as no easy solution is jumping from google searching. Anyway, more on those next post, along with the essential shortcuts I'm discovering.
I haven't posted for a while, I know. I've been busy doing other things is all. Some of which you may hear about soon, others only if I get around to posting about it.
One thing I have done recently is set up an http://about.me page. For most people, that's a very easy thing to do. If the name you want hasn't been taken you're good to go. For me, picking the name sroot turned out to be quite a challenge!
I've always had problems with my name and computing. On unix and linux, 'root' is the name of the super user. 'root' is god. 'root' can access anything, do anything, delete anything. When a server gets hacked, the last bit you want hackers to get access too is the 'root' account. Many services often prevent anyone registering the name root. Many prevent people registering anything that contains the string 'root'. I first remember noticing this when I tried to get a hotmail account. 'steveroot' and 'rootskitchens' were simply not allowed.
When I tried to sign up for an about.me page, I figured the failures being displayed were because of my name. I like the about.me site, so I persevered. I emailed their support and they helped! It turns out the name was blocked by the AOL namespace. I don't really know what that means, but I guess their usernames connect with AOL services in some ways and my name failed to be accepted. What's most impressive, is that for this FREE service, they actually took the time to find a solution. I genuinely expected to be told, 'you can't have a name that contains root, try using a nickname, or maybe remove the last letter like steveroo'.
Having had them go to so much effort just for little old me, I hope my about me page http://about.me/sroot does them justice.
By the way, I'll keep that page up to date with things like my twitter name, social media spaces and any other big projects I may be working on.
I haven't posted here for a long time as I've been busy on other projects, but this is a quick sharing of a very good sailing opportunity (which I'd take up myself if I wasn't working). Too many words to include on facebook and twitter!
Morning Star Trust (Sail training ship) Vacancies on board
7 day or a 5 day sailing trip with us for just £99 ! This is a special price to fill the last few places on the boat
(From the newsletter I get)...
- action please: (from Ted) We have some great news, people can come on a
7 day or a 5 day sailing trip with us for just £99 ! This is a special price to fill the last few places on the boat on the Normandy Wine Run (14th-20th May) and the the Channel Islands Adventure (23rd-27th May).
The only problem is that people don't know about it!
You are by far the most effective way for them to find out. A recommendation from a friend carries more weight than any advert these days.
Could you make your friend's year by emailing them or putting out a Facebook message or Tweet, telling them about these discounts and giving them the link to the brochure, which is
http://www.morningstar.org.uk/images/MSTBrochure2011.pdf
The brochure still shows the trips at £330 and £240 respectively, so please let them know that about the last minute deal. Thank you. I know you are busy people, but this seems to be the best way to help Morning Star Trust serve people
(Quick addition from me: I loved sailing on this ship as a teenager. It's where I learnt about halyards, bowline knots, how to make pasta and cheese and so many other great things and memories - I recommend you all inundate them with bookings right now!)
One reason I've posted less and less to my blog this year is because I've joined a Rotary club. Rotary has been a tremendous amount of fun and given me a real big buzz of feel good factor seeing the difference my effort, combined with others, can make as we 'Do good things'.
The best thing for me this year has to be converting an empty shop window in Canterbury to an educational display about Polio, re-using enlarged images from a comic called "Amazing Stories of Polio". I'm going to unashamedly claim credit for the idea of this window display, or at least, I joined ideas from other places to come up with this one. However it wouldn't have happened without the help, both in time, effort and resources of friends who shared the vision.
We're not talking a small effort either. From getting permission to re-use the artwork, to finding the shop, to the managing agent agreeing, to the graphic design, the printing of the large panels (which in itself took many hours) and the hours spent hanging them carefully in the window of the empty shop.
I've still a lot of things to write about the window project and I'll probably never be satisfied with anything enough to put it here in full. So, without further ado, why not follow this link to the artist, Steve Buccellato's blog to read all about it.
Other ideas are in the pipeline. I expect I'll be posting less and less to this blog as a result.
I admit I've not been so busy posting the to blog this year. One thing that's kept me busy has been learning Ruby on Rails making my first opensource application.
I'm a hobby programmer, so the idea of sharing my code is worrying. I'm sure there are lots of errors, bad practice and so on. On the other hand, I had a problem to solve at work and the application I wrote may help others. I use lots of open source applications for home and work so it seems only right to share my efforts with others.
What have I created? An application that backs up google calendars for all of our office users.
Why? Because occasionally we delete something we didn't mean too. For example Mrs X phones up to cancel an appointment with Mr A. Mr A is out of the office but Mr B can edit Mr A's calendar, so deletes the appointment. Except Mr A had all the Mrs X contact information on that appointment and hadn't yet created our own internal computer record. We've no longer got any way of contacting Mrs X.
How? The application I wrote reads the Private XML feed of a google calendar. That contains the most recent newly created or amended appointments. I check each entry in that feed to see if it's new, or if it's an existing appointment that's been modified. If they are new or modified, I add them to a database. If they're old and unchanged, I ignore them.
One thing to note - it doesn't restore appointments. As you've got all the content though, it shouldn't be so difficult to add it again should you need to.
Where to get it? I've shared it through github - http://github.com/steveroot/Google-Calendar-Backup
This post will (hopefully) remind me in the future how to do something very simple.
A crontab is normally running one command on each line. EG:
# m h dom mon dow command
01 00 * * * /home/cronscripts/vine-warn-when-large-user-profile
05 00 * * * /home/cronscripts/vine-get-remote-pc-backup.sh
01 01 * * * /home/cronscripts/vine-samba-users
01 02 * * * /home/cronscripts/vine-database-backups
So the above jobs run at 00:01, then 00:05, then 01:01am then 02:01am.
Instead, I can run these cron tasks one after the other by putting && between each task. EG:
# m h dom mon dow command
01 00 * * * /home/cronscripts/vine-warn-when-large-user-profile && /home/cronscripts/vine-get-remote-pc-backup.sh && /home/cronscripts/vine-samba-users && /home/cronscripts/vine-database-backups
So these jobs start running at 00:01am. When vine-warn-when-large-user-profile finishes, vine-get-remote-pc-backup.sh starts immediately, and so on.
Why is this useful?
I have several backup scripts for our linux servers. Each script creates a tar archive of a directory, compresses it, SFTP's it off site, then deletes the tar archive from the server.
If the scrips all run at the same time, the server runs out of disk space. I need them to run one after the other. I can't effectively guess when to start each one. The backup can't start until after midnight and must be finished by 7am when users are likely to start work again. Some directories can take minutes to archive, compress, send, delete. Others can take 2 or 3 hours. One server also collects backups from a couple of other places, so that script has to complete before others start too.
Running this scripts concurrently means no useful transfer time is lost and I don't have to guess the time each script will take to run.
In the hope I find this post next time I'm trying to monitor a SmartArray drive controller, A fresh install of Ubuntu 10.04, installing package cciss-vol-status didn't seem to work. I couldn't even find the file on the system using 'locate'.
For some reason, it installed as cciss_vol_status (using underscores instead of hyphens).
Sigh. Here I am at work on Tuesday morning. List of jobs to do being interrupted by our web server triggering over load alarms. Actually, it's been doing it for quite a while, but I've never sat down to analyse the logs to find what's happening to trigger the alarm (our gandi.net virtual server is more than powerful enough to cope, so fault finding has been low on my to do list). This morning as I walked to work I saw an overload message arrive in my email. The sun is up, the sky is blue, it's 8am. It feels a good day to fault find...
It didn't take long to find the problem. I used grep to pull out todays log entries from the apache log and put them into a temporary file
me@server4:/path_to_logs/rkbb.co.uk$ grep '06/Apr/2010' apache-log > check.txt
The bot causing the problem has a user agent of "Mozilla/5.0 (compatible; Purebot/1.1; +http://www.puritysearch.net/)", going to puritysearch.net I find a 'search engine' that doesn't appear to do anything but display adverts disguised as search results.
So, how to stop this bot. Nice bots read a file called robots.txt which tells them where they're allowed to go. Purebot didn't read the robots.txt so I couldn't excluded it there.
My next thought was to use apache to exclude the user agent. After an hour or so of trying I gave up with that (it is possible, I just didn't figure it out and took the easy for me approach). The site is running Coldfusion (actually BlueDragon) so in the Application.cfm I can check the user agent and stop processing requests from Purebot there.
<cfset useragenttest = find("Purebot",#cgi.http_user_agent#)><cfif useragenttest GT 0 >
<p>Purebot banned</p>
<cfabort>
</cfif>
The code isn't my most elegant but it works. Next time I come across a badbot (or Purebot changes it's name) I'll just updated this piece of code to ignore their requests.
I've been looking at buying dragon naturally speaking from an IT supplier for typing on to the computer. It is software I heard of many years ago that converts speech into type as you speak. I had an mail offering it for only £30.00 which is less than I remember. However I like to test things before I buy them especially when it comes to software. I searched the Internet but couldn't find a trial version to download. Just as I was about to give up I discovered a webpage that mentioned windows built in speech recognition.
So I'm sitting at home to blog for the first time ever without typing a word. I've been through the tutorial and so far I'm finding it very accurate. In the first paragraph I Can Count Three mistakes, I'm sure that as I continue to use it accuracy will improve over time.
It isn't quite plain sailing, I'm having a little trouble remembering all the commands but that's no different to when I first learned to use a computer. (quick note, I was brought up with a local dialect where I use the word learnt, but the computer heard learned. I'm sure there's a blog Post about observations of my local dialect somewhere here). One thing I am glad of is that my headset microphone has a microphone mute button. The software does it by saying stop listening to stop listening, but sometimes while I've been thinking of what to say and start speaking it thinks it misheard my silence as a word and asks me to repeat.
As a beginner with speech recognition the other problem I've been having is getting the cursor mixed up with an action. For example, a moment ago I managed to select a whole section of text inadvertently and then change the format by telling the computer to use a button on the webpage.
I think I'm a long way off using this is a regular way of inputting text. I just tested my typing speed on the website and got a result of 72 words per minute. I think my current speaking speed is actually slower than 72 words per minute as I'm waiting for the computer to display each sentence as I've spoken. Those of my friends who have seen one of my presentations may know that one of my biggest floors (and there are many I know) is speaking too fast. Maybe I should record all of my presentation through speech recognition as a way of slowing myself down!
Now to see if I can publish this blog post without touching the keyboard ...
Taking Nicola to swimming club tonight we were talking about memories of her Nan and that reminded me of my Nan. Two things immediately sprung to mind, the first was going to Nan's for lunch.
She'd always lay on a huge spread of food, filling a table that to a 6 year old as as big as I was (so, I imagine, about 1.5m diameter?). It had fresh bloomer bread thick cut and spread with real butter (at home we had margarine so it was always a treat). New potatoes that always tasted unique (I later discovered, it was the salt. Nan always added lots of salt whereas mum didn't, which is why it always tasted so different at Nan's). Fine bone china bowls with pastel colour flower patterns spring to mind, though not in any detail. Runner beans and peas, fresh from Granddad's flower bed. Happy days of childhood.
I then remembered the 'Mars Milk'. I guess I was staying at Nan and Granddad's for a weekend. We'd gone shopping and I asked if we could buy the 'Mars Milk'. I didn't understand what Nan was trying to tell me at the time, that the Mars chocolate bar was an advert for Mars and the milk was normal milk. I liked it enough to ask for it again though. Several years later, and Mars flavoured milk appeared on the supermarket shelves.
I don't claim that any of the above is of interest to anyone but me, but the memories are wonderfully tasty in my mind.
I treated myself to a rails training course last weekend (with Well House Consultants, rather good, I'll write about it if I get around to it). Immediately I start to create my first ruby app and I forget all the sqltypes I can use in my Model and where to look them up. As I think I'll be looking them up quite a lot, I've put them here on my blog for my later reference
:primary_key,
:string,
:text,
:integer,
:float,
:decimal,
:datetime,
:timestamp
:time,
:date,
:binary,
:boolean.
Options that I can use in my migration
I must remember to specify the decimal precision I need!
:precision [1..63], :scale [0..30]. Otherwise Mysql Default is (10,0).
* :limit - Requests a maximum column length. This is number of characters for :string and :text columns and number of bytes for :binary and :integer columns.
* :default - The column's default value. Use nil for NULL.
* :null - Allows or disallows NULL values in the column. This option could have been named :null_allowed.
* :precision - Specifies the precision for a :decimal column.
* :scale - Specifies the scale for a :decimal column.
These came from: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html
I've been meaning to write about this for a while. Many people we send images files to don't know how to view beyond the first page of a multi page tiff file in Windows XP (probably Vista, I haven't tried).

If you open a multi page tif using 'Windows Picture and Fax viewer' (the default unless another program you've installed has taken over as your preferred tiff viewer) you get an extra little drop down box at the bottom of your screen, that allows you to choose which page you'd like to view. When you go to print, you're shown a preview of each page and can choose (by tick box) which pages you'd like to print.
Our fax to email scanner creates these multipage tiff's.
