Monthly Archives: June 2014

Terminal access from Windows Phone to VM somewhere™ in cloud

Suppose you are in situation when you need to edit and then run some Python code, or C++ or whatever. And you need to this from your Windows Phone. What you will do?

Okay, most obvious solution is just to run one of the compliers that send your code somewhere and return result. You can find few of them in store. Most of them are quite low quality, but they work. Unfortunately, this options does not work for me. In my Python scripts I am using NumPy and none of the “compilers” have one preinstalled. So the question is custom environment.

Custom VM

Requirement of custom environment leads to custom VM somewhere™ in cloud. I already have had a few VMs on Azure, so I decided just to fire up another one. I created Ubuntu VM.

image

Through SSH I configured environment:

sudo apt-get update
sudo apt-get install git
sudo apt-get install python python-numpy python-scipy

Sidenote: this might be temporary issue, but. apt-get might fail with some wired 503 errors:

E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/s/suitesparse/libamd2.3.1_4.2.1-3ubuntu1_amd64.deb  503  Service Temporarily Unavailable

E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

well… Azure distribution of Ubuntu, preconfigured with Azure own mirror for packages archive and looks like some packages are missing. To fix this replace all “azure.archive.ubuntu.com” to something like “archive.ubuntu.com” or “ua.archive.ubuntu.com” in “/etc/apt/sources.list”. One-liner do this from askubuntu:

sudo sed 's@http://azure\.archive\.ubuntu\.com/@http://archive.ubuntu.com/@' -i /etc/apt/sources.list

Windows Phone Terminal

Now we have VM in somewhere™ in cloud. Next step is to connect from Windows Phone. Search gives few SSH clients. I tried most of them. They all actually looks the same(I think they use same terminal emulator) and only difference is keyboard. I selected Admin Shell and everything else is just self explanatory.

wp_ss_20140621_0001

Vim works fine too.

wp_ss_20140621_0002

And results:

wp_ss_20140621_0004

Enjoy! Happy cheating on exams!

Tagged , ,

Octave on Windows

For me this is third attempt to complete ML course on Coursera Посмішка, wish me lack so I have time to eventually complete it. In general I prefer to use Python for my studies, I like IPython, numpy and just Python, but for this course Andrew Ng decided to go with Octave, so I need Octave environment.

GNU Octave

Octave does not have Windows distribution on home site. So you need to grab one from Octave Forge. Installation is easy and after all you will have octave.exe on your PATH (if not, just add bin folder to your PATH).

image

There are few items, that I found important for daily use.

– By default Octave starts in non interactive mode. You can type your commands and do math, but first error will terminate process, effectively. You need interactive mode, to do so just add -i when you start octave. In interactive mode you will have more chances to survive Посмішка

– Octave outputs huge welcome screen, after you read it and can repeat it word by word at 3:00 AM, you can turn it off. Just add -q when you start octave. Personally I created cmd file that add both of this params for me.

Unfortunately, console Octave cannot plot graphs inline, this actually means that it shows plot in different window, with quite wired life time. Comparing to the other environments like IPython, wxMaxima or R Studio, I was sure that I will be able to find something like this for Octave. Actually I was wrong, there are nothing useful, but anyway, I spent some time to investigate and will put here aggregated information about Octave environments.

Octave Workshop

imageOctave Workshop is firs item that pops up when you search for Octave IDE. Project seems to be inactive, home site is down. If you will take a look at downloads section and find 5 downloads, it probably all y me.

In general it works. It has panel that shows variables(good), but actually without values(bad). It bundles quite old Octave 2.9.4. And does not plot inline.

Dead end. No value at all.

Xoctave

Commercial IDE for Octave, costs $49 for students.

image

Good things are: has variables view, can show actual values of variables. Uses Octave that installed on your system.

Bad things: on my system does not plot at all, when plot, still does not plot inline or at least to one of the tabs, it plots to separate window, that makes it quite unusable.

Well, my verdict. I would take one for free, $49 is over-over price(take R Studio as base of price judgment).

Qtoctave

It is not in Internet any more :(.

Octave inside IPython

imageYeh, that is true. There is magic that enables Octave in IPython. It uses system installed Octave. It can output variables, it can work almost interactively. And it can plot inline! And of course it can exchange variables with main Python session, so after doing something in Octave you can easily play with results in vanilla IPython.

For me most visible problem with IPython as environment for Octave is requirement to put “%%octave” on every cell that actually octave cell, but I can live with that.

Conclusion

It is obvious, there is not single IDE for Octave that actually meets my requirements. Neither free, nor commercial. Until I will find something useful, I will continue to use console Octave in interactive mode and will also give a try for IPython Octave magic.

Tagged