Machine Learning with Apple – An Open Notebook

We all know how cool machine learning, predictive analytics and data science concepts and problems are. There are a number of really interesting technologies and frameworks to use and choose from. I have been a Python and R user for some time now and they seem to be pretty good for a lot of the things I have to do on a day-to-day basis.

As many of you know, I am also a mac user and have been for quite a lot time. I remember using early versions of Mathematica on PowerMacs back at Uni… I digress..


Apple has also been moving into the machine learning arena and has made available a few interesting goodies that help people like me make the most of the models we develop.

I am starting a series of posts that I hope can be seen as an “open notebook” of my experimentation and learning with Apple technology. One that comes to mind is CoreML, a new framework that makes running various machine learning and statistical models on macOS and iOS natively supported. The idea is that the framework helps data scientists and developers bridge the gap between them by integrating trained models into our apps. Sounds cool, don’t you think? Ready… Let’s go!

No shuffle in new iOS 8.4 Music App

I was not too sure about the new Apple Music offering, but so far it seems quite alright! The music choices are generally good, and I hope that as I use the music app in iOS 8.4 more the choices get better.

Unfortunately I ended up using the app while not having mobile coverage and no WiFi either… so I reverted to “My Music” and since I was in the middle of a run, I wanted just to hit the shuffle button and hope for the best… However, I was surprised that there was no shuffle button to be seen… I ended up hitting the first song in the list and take it from there. It turns out that the shuffle option is set by default, you just have to seed it by starting playing any song. That seems good, except for the fact that it is not obvious at all.

You can select if you want the shuffle mode or not after starting playing any song and expanding the “Now Playing” bar:

iTunes Shuffle 1


And there you will be able to see the usual Shuffle icon:

iTunes Shuffle


Apple Notes and Gmail Notes


I accidentally ended up creating some notes in the Gmail Notes inside my iDevice only to be completely confounded by the fact I could not see them in my desktop. I tried to find some resolution by looking at the instructions for the Apple notes, but got frustrated with the lack of information.

So, here it is how I solved my issue:

It seems that as an Apple Notes user, one can select to have the Notes saved “On my iPhone/iPad/Mac” or synced to any email account of one’s choice. If you chose the first option, then no issues there, but the “fun” part comes with the latter. In that case the application will send notes from the device via Gmail to the Gmail servers, or for that matter to the email account you designated under IMAP. This means that your notes are therefore treated as normal email and labelled as “Notes”. Not only that, they are automatically archived on arrival. The initial transfer is one-way only and this implies that the notes can’t be restored from Gmail to the device. In order to find your Notes in Gmail you have to search for the “Notes” label!

If you call up your note on your device, the application access it from Gmail and displays it. But if you deleted it, as many of us do, then the app gets confused as it does not know where they are… If they are deleted from the device removes the label in Gmail and thus they cannot be accessed by the device and they get zombiefied in Gmail! They will still be present in All Mail, but without label.

How to fix this… well it depends. If the Notes have been deleted from the Gmail account from the web interface they will still be there in the Trash for 30 days. You can “restore” then during that time and will be showing in the Notes App on the device.

If the Notes folder was deleted using the Mail App on the device, the notes will (probably) still be there under “All Mail” but without a label. You can search for them and re-apply the label!

My advice would be not to use the synching at all… it has caused more pains than it should be. Let me know if this helps.

Enable NTFS read and write in your Mac

CES 2013 - OWC Mac mini external storage - min...
CES 2013 – OWC Mac mini external storage – miniStack Max (Photo credit: the JoshMeister)

I was confronted with an old issue, that had not been an issue for a while: writing to an external hard drive that was formatted with Windows (NTFS) from my mac. I used to have NTFS-3G (together with MacFUSE) installed and that used to be fine. However, I guess something when a bit eerie with Mavericks as I was not able to get my old solution to work.

So, here is what I did (you will need superuser powers, so be prepared to type your password):

Open a Terminal ( and create a file called stab in the /etc folder. For instance you can type:

$ sudo nano /etc/fstab

You can now enter some information in your newly created file telling MacOS information about your device. If your external drive is called mydevice enter the following:

LABEL=mydevice none ntfs rw,auto,nobrowse

Use tabs between the fields listed above. Save your file and you are now ready to plug your device.

There is a small caveat: Once you do this, your hard drive is not going to appear in your Desktop. But do not disappear, you can still use the terminal to access the drives mounted by going to /Volumes folder as follows:

$ sudo ln -s /Volumes ~/Desktop/Volumes

et voilà!

Enhanced by Zemanta

Getting the latest version of Jekyll to work

jekyllI have been playing on and off with Jekyll and I find it very interesting, useful and once installed, easy tool for creating posts. However, the installation may or may not be that easy. Last time I installed it using Ruby directly and did not bother updating it for a while.

Recently I decided to update it and this time I decided to do that with the help of the fantastic Homebrew.

Everything seemed to work fine except that discountkept on complaining. So started afresh and this time round the terminal complained saying:

-bash: jekyll: command not found

The problem was easy to solve once I remembered that brew places the code in the brew Cellar and thus Ruby could not find the gem directory. So I simply added the correct path and exported it:

export PATH=/usr/local/Cellar/ruby/2.1.1/bin

et voilà!

Enhanced by Zemanta

Navigating the terminal

"Leopard" Icons in Black

The work computer of one of my colleagues has recently closed the circle and he has now a shiny new apple computer. He is very well-versed in a bunch of computer related tasks, nonetheless he asked me the other day about shortcuts to navigate a shell terminal. I showed him a few tricks, and I thought posting some here just in case they are helpful to my readers too:

  • To go to the beginning of the command line – Ctlr+A
  • To go to the end of the command line – Ctr+E
  • To delete from the current position to the beginning of the line – Ctrl+U
  • To undelete – Ctrl+Y
  • To delete words to the front of current position – Ctrl+K
  • To delete words to the back of current position – Ctrl-W

He also was wondering about an easy way to create a file and open it immediately. The way I do that is with a bash function placed in my .bashrc file

mytouch {
   touch #1
   open #1


Enhanced by Zemanta

Getting Gephi 0.8.2 to work with a Mac

Facebook Network Visualized with Gephi
Facebook Network Visualized with Gephi (Photo credit: yaph)

Ever since the previous Java update for the mac, my Gephi installation was not happy. I resorted to uninstalling version 0.8.2-beta and going back to 0.8.1. Not a bad version, but definitely not one with the latest updates. Well, at least it worked, did not freeze or panicked when trying to click on the menus. :D

I am very pleased to say that I have managed to get my installation of Gephi 0.8.2-beta working and here it is how:

Edit the contents of the package located in


To do so you can right-click on the Gephi application and open “Show Package Contents”. You can then navigate to the location mentioned above. I used Aquamacs to edit the file, but you can use your favourite plain-text editor.

Towards the beginning of the file add the following line:


Save the file and start Gephi as usual. This did the trick for me. I would like to credit the GitHub page for Gephi were I ended up connecting the dots.

Enhanced by Zemanta

Aquaterm plotting issue with Octave and Gnuplot (Mac)

Octave Mac

I recently updated my version of Octave using Homebrew and something went a bit eerie… Nothing major except that instead of plotting to the Aquaterm terminal, Octave and Gnuplot were only happy with X11. Not the greatest of issues, but I really prefer the look of graphs in Aquaterm and here are some steps I followed to get things sorted:

First I uninstalled gnuplot from Homebrew using:

brew uninstall gnuplot

Just in case the problem was with AquaTerm I re-downloaded it and installed it again. You can obtain AquaTerm here. I then reinstalled gnuplot just to realise that some symlinks were not created. You can check them thy typing:

ls /usr/local/lib/libaquaterm*
ls /usr/local/include/aquaterm/*

If they do not, you can set them up by typing the following commands in your shell:

sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.dylib

sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.1.0.0.dylib

sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/Headers/* /usr/local/include/aquaterm/

That did the trick for me. I hope you find this helpful.

Disabled bundles for Mail in Mavericks

I have just updated a previous post with some of the UUIDs for using some plugins with The correct strings for Mail 7.0 in Mavericks are:


For instructions on what to do with the strings above, please refer to this post.

Mail icon
Mail icon (Photo credit: Wikipedia)

Command Line: a few tips

Terminal icon in OS X

In various posts in the past, I have given some tips using the Terminal and some comments have arrived about how complicated they may seem. Nonetheless, I still think that the flexibility offered by the tools provided are what make the UNIX/Mac environment so good. So in this post I would like to share some useful tips to use the terminal. Let me know what you think!

1. Download a File from the Web & Watch Progress

If you know the URL of a file that you need to download from the web you can use curl with the -O command to start downloading it:

$ curl -O url

Be sure to use the full URL. Also, remember to use the upper case ‘O’ and not the lowercase ‘o’ to keep the same file name on your local machine.

2. List Directory Contents by Modification Date

You can indeed take a look at the graphical interface, but if all you want is a quick list of the files in a directory showing permissions, users, file size, and modification date, with the most recently modified files and folders appearing from the bottom up then simply type the following:

$ ls -thor

3. Search Spotlight with Live Results from the Command Line

To do that you can use the mdfind command:

$ mdfind -time findme

This can go awfully quick depending on the specificity of the searched terms, but if you see a match hit Control+C to stop looking.

4. Kill Processes Using Wildcards

Simply use the pkill command. For example, if you want to get rid of all the processes that start with “Sam” just type:

$ pkill Sam*

5. Re-Run the Last Command as Root

The bang is you friend (!) In order to re-run the last command typed but as root type the following:

$ sudo !!

6. Get the Last Occurrence of a Command Without Executing It

Once again, the bang is your friend. Use the following command, where “searchterm” must be substituted by the command you are looking for:

$ !searchterm:p

For example, to find the last full command that used the prefix “sudo” you would use:

$ !sudo:p

7. Instantly Create a Blank File or Multiple Files

All you have to do is “touch” the file…

$ touch filename

You can list out multiple names to create multiple files too.

Do you have any favourite commands or tips to use the command line? Let me know.