Matlab: Creating multiple data cursors

You can create multiple data cursors in a plot, handy for pointing out multiple data values, by first placing your first data cursor, then right clicking and selecting “Create New Datatip”

Then you can:
* move the datatip by left-clicking and holding while moving mouse around–you can put the datatip to NW,NE,SW,SE of data point
* export datatip values to workspace — by right-clicking and selecting “Export Cursor Data to Workspace”

Quote of the Day

Some think the Earth is spherical, others that it is flat and drum-shaped.
For evidence they bring the fact that, as the sun rises and sets, the part concealed by the Earth shows a straight and not a curved edge, whereas if the Earth were spherical the line of section would have to be circular . . .
. . . but in eclipses of the moon the outline is always curved: and, since it is the interposition of the Earth that makes the eclipse, the form of this line will be caused by the form of the Earth’s surface, which is therefore spherical.
Aristotle. “On the Heavens”. Written 350 B.C.E.

Quoted in:
Kabanikhin, Sergey I. Inverse and Ill-Posed problems

Comparison of Clang 3.2/3.0 and g++ 4.7.3/4.6.3

Comparison is extremely informal, using non-vectorized code that does a lot of multiply/divide/exponent/add. Just trying to get a handle on option performance–Phoronix this isn’t!

End result: using -march=corei7-avx -mllvm -vectorize-loops on clang++ 3.2 Ubuntu 13.04 was the fastest by about 25% advantage over g++ 4.6/clang++ 3.0versions on Ubuntu 12.04, same CPU type

Both PCs used Core i7 Sandy Bridge.
PC1: Ubuntu 12.04, Clang 3.0, g++ 4.6.3
compiled using: clang++ -O3 -std=c++0x foo.cpp -lncurses -lm
normalized time to run compiled code: 1.0 (using this as PC1 reference)

compiled using g++ -O3 -std=c++0x foo.cpp -lncurses -lm
normalized time to run compiled code: 1.0 approximately (not a noticable change)

compiled using g++ -O3 -march=corei7-avx -mtune=corei7-avx -std=c++0x foo.cpp -lncurses -lm
normalized time to run compiled code: 0.95 approximately (slightly better)

PC2: Ubuntu 13.04, Clang 3.2, g++ 4.7.3
(first running the executable copied from PC1) — use as PC2 reference: 1.0

compiled using: clang++ -O3 -std=c++11 foo.cpp -lncurses -lm
normalized time to run compiled code: 0.95 (slightly faster)

compiled using: g++ -O3 -std=c++11 foo.cpp -lncurses -lm
normalized time to run compiled code: 0.95 (slightly faster)

compiled using g++ -O3 -march=corei7-avx -mtune=corei7-avx -std=c++11 foo.cpp -lncurses -lm
normalized time to run compiled code: 0.9 (faster than same options used on Ubuntu 12.04 PC)

compiled using clang++ -O3 -march=corei7-avx -mtune=corei7-avx -mllvm -vectorize-loops -std=c++11 foo.cpp -lncurses -lm
normalized time to run compiled code: 0.8 (a lot faster than Clang 3.0 (no loop vectorization))

Raspberry Pi: Practical Uses Review

The Raspberry Pi ARM computers have excited a lot of people — I was in the first groups to have them, having Model B of the 256MB and 512MB varieties. Here are some things I’ve tried using the Raspberry Pi Model B 256/512MB for, with the following number ranking (my opinion only, others may fervently disagree).

In summary, the Raspberry Pi is a capable FTP/SSH server, but for field deployments, I would choose the Beaglebone Black as the Beaglebone Black has a CPU nearly twice as powerful, native Ethernet, onboard SSD, better onboard I/O (for local sensors), etc.

Ranking key:
1: Cannot Install / Not working if Installed
2: Extremely slow, maybe single patient user only
3: slow, but perhaps usable for patient 1-3 users
4: adequate, may handle a handful of users (family, small club)
5: great, handles multiple concurrent users, not so much slower than a 10-year old Pentium 4 PC

Groupware (email/calendar) server:
Citadel
Rank: 3
As of this writing, Citadel was the only known easy to install groupware server. Accessing features took a few seconds per click, and it didn’t seem that users accustomed to using Google or Office 365 would have the patience for Citadel on Raspberry Pi.

FTP server:
Rank: 4.5
Like SSH below, the Raspberry Pi can handle a few connections at once, but may well be limited to less than raw Ethernet speeds due to:
1) CPU: USB-ethernet onboard conversion
2) CPU: encryption (if using SSL/SSH, etc.)
3) CPU: filesystem — if using external HDD with FUSE (nfts,exfat,etc.)
4) CPU: USB HDD — takes some CPU to manage the transfer from USB to external HDD
5) SD card: read/write speed

Web LAMP server:
I have not done this personally, but you can search for people using the Raspberry Pi as an NGINX or WordPress server and it does seem to work live on their Raspberry Pi. example:
dingleberrypi.com

Desktop workstation:
2 – 2.5
With LXDE, as of Aug 2013, with Raspbian the Raspberry Pi is just too painfully slow to be used as a desktop replacement. Web browsing (e.g. Gmail) is painfully slow and only tolerable in desparate situations. The Beaglebone Black on the other hand is just fast enough that one MIGHT be able to use it with LXDE desktop.

SSH server (port forwarding, SSHFS, remote management):
Rank 4 – 4.5
The Raspberry Pi does quite adequately in this regard — you will feel just a bit of the CPU limitation when using say >5Mb/sec, perhaps due to the USB-Ethernet adapter internal to the Raspberry Pi Model B as well as the SSH encryption itself–this shouldn’t be too hard to measure for the curious.

FM transmitter:
Rank 4.5
The remarkable project at:

http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter

works splendidly — the program can be modified to transmit narrowband (~ 5kHz) FM on the 2 meter ham band as well. I can think of some compelling uses for a $25 short-range FM transmitter!

Octave 3.6: getting xlsread() to work fully (via installing java package)

Note this was for octave 3.6. I have not retested this lately.

 

First, from Terminal install Java by typing:


sudo apt-get install openjdk-7-jdk

Now, tell Octave where Java is by typing IN OCTAVE


setenv("JAVA_HOME","/usr/lib/jvm/java-7-openjdk-amd64")

Finally, install octave’s link to java by typing in octave

 


pkg -verbose install -forge java
 

Then restart octave and type in octave


pkg load java
pkg load io

if you get errors about missing jni.h, be sure the JAVA_HOME is specified correctly above.

Note: Some users still have trouble getting xlsread to work — the io developer advised in Aug 2013 of hope to refactor the Java dependency of io “this fall..”

You might consider using a CSV instead of XLS…

Ubuntu: disable Gnome Keyring SSH Agent (make Ubuntu NOT remember SSH private key passwords)

Note: if gnome-agent still seems to be active, be sure you’re running at least gnome-keyring version 3.10.1-1ubuntu4.2, since some earlier versions (e.g. 3.10.1-1ubuntu4.1) make the process below not take effect (SSH keys still remembered on earlier versions of Gnome Keyring.)

———————–

Ubuntu uses Gnome Agent, which has the undesirable default behavior of remembering SSH private key passwords until you log out. I don’t like the remembered private key passwords, since if someone knows my Ubuntu user password, they would then have access to any SSH private keys I loaded during that session (since last logon).

Here’s how to disable the Ubuntu Gnome Keyring SSH Agent (make Ubuntu forget SSH private key passwords).
1) sudo nano /etc/xdg/autostart/gnome-keyring-ssh.desktop
then set
NoDisplay=false

2) In “Startup Application”, you will see “SSH Key Agent Gnome Keyring: SSH Agent” — uncheck this checkbox and click Close.
3) Reboot Ubuntu and test to be sure that your private key passwords aren’t being remembered (every use of SSH private key will require retyping password).

reference: http://dtek.net/blog/how-stop-gnome-keyring-clobbering-opensshs-ssh-agent-ubuntu-1204

Overview of free 2D CAD options for Linux – 3Q2013

As of 3Q2013, there are a few leading choices for 2D CAD software for Linux. In short, if you have a specific need to work natively with DWG (e.g. customer demands DWG, and DXF is not acceptable to them (sigh)), then you can try the free-of-charge but non-libre Draftsight.

If you like libre software, you can consider: QCAD or LibreCAD — then use the free Teigha convertor mentioned below as a first/last step to convert to/from DWG DXF.
I have not tried nanoCAD as nanoCAD is currently free but non-libre.
I didn’t include FreeCAD here as it’s mainly for 3D (and also cannot open DWG at this time).

Draftsight is the “easy” solution that typically just works with most DWG someone sends you — but at the price of being non-libre.

QCAD 3 is a free, GPLv3 solution, and can work with DWG–via a non-libre, non-free DWG package (or use the free, non-libre Teigha DXF – DWG converter)

LibreCAD 2 is a GPLv2 2D CAD solution — but canNOT nativly open DWG files due to the present lack of a suitably GPL’d DWG import/export package — so consider using the free, non-libre Teigha DXF – DWG converter

Draftsight
License: no monetary cost, but NOT libre
Registration: YES: to install AND REregistration at periodic intervals <–annoying
Download: binary 32-bit .deb package
DWG: YES: through R2010 (as of Draftsight V1R3.1)
DXF: YES: through R2010 (as of Draftsight V1R3.1)
Export: several, including: PDF, SVG, EPS, PNG, BMP…

QCAD 3
License: GPLv3 (base package only; the optional packages for DWG, etc. are paid license)
Registration: NO
Download: Source code, or convenient 64-bit or 32-bit binary packages that works on most Linux distros
DWG: YES: via paid proprietary package through R2013 — 15 minute free trial can apparently be used over and over? (or use free Teigha DXF-DWG converter)
DXF: YES: through R2013
Export: several, including: PDF, SVG,PNG,BMP…

LibreCAD 2
License: GPLv2
Registration: NO
Download: Source code, or convenient PPA for Ubuntu (64-bit and 32-bit)
DWG: NO: but you can use free, non-libre Teigha DXF-DWG converter as a first/last step to/from DWG-DXF
DXF: YES: through R2007
Export: several, including: EPS, SVG,PNG,BMP…
===================
There is a free, non-libre “Teigha File Converter” software http://www.opendesign.com/guestfiles/TeighaFileConverter
to convert from DXF to DWG en masse as a first/last step (compatible through R2013 DWG/DXF).
This OpenDesignAlliance is the same organization where QCad gets its non-free non-libre converter from.