Category Archives: Computers

Mac OS X and Windows

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.

Windows Explorer – add Open a Command Line Here to your right click menu

http://www.petri.co.il/add_command_prompt_here_shortcut_to_windows_explorer.htm has details of how to do this 5 different ways.
Unfortunately there’s a small error in the one about editing the registry, although it might be the simplest:

  1. Copy and paste these lines into a CommandLineHere.reg file on your desktop. Do include a carriage return at the end.
  2. Double-Click it.
  3. Say yes.
  4. Now right-click on a Folder and voila.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Line]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Line\command]
@="cmd.exe /k pushd %1"

Oops, I broke Windows explorer

In the course of trying out ways of adding a command line to the windows explorer right click menu, I broke it. Every time I opened a new window, I got windows search instead.

This handy post http://www.howtogeek.com/howto/windows/how-to-fix-double-click-always-opens-search-in-windows-explorer/ was my lifeline. You do have to be handy with windows registry though.

iPad printing problems

iPad printing is unreasonably difficult. It all works fine no doubt if you go out and buy a shiny new AirPrint enabled printer. Otherwise the simplest/cheapest thing I’ve found is:

I’ve had network problems too, similar to the problems with iTunes. Replacing my router was the best solution I had for that. If your router is old, or a very cheap broadband freebie, you may need to replace it.

Losing Internet Connection When You Plug In An Ethernet Cable?

How to keep your wireless internet connection working when you also have a wired connection

You know the scenario. There you are with a wireless internet connection, you want to configure a router, you plug it into your ethernet port because you still want to keep your internet connection alive and ping! your internet connection has gone.

Solution

Open your network control panel to the settings for your wired ethernet connection. Change the IP configuration from DHCP to Manual. Remove any router or gateway settings. Apply.
You should now find that your computer routes to the internet successfully over your wireless connection instead of failing by trying to reach the internet over your wired connection.