Thursday, February 20, 2014

SSH to transfer files from remote server to local directory

Note to self.

local_machine: > scp username@host:/path/to/somefiles* ~/some/local/dir/


Friday, December 27, 2013

OSX Mavericks 10.9 + OpenCV 2.4.7 + Eclipse Juno WITHOUT CUDA

Note to self, note to self, note to self

Setting up

1) Download OpenCV2.4.7
2) Extract the file
3) mkdir build inside the directory (where you extract openCV2.4.7 to)
4) cd build
5)

cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -D CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_CXX_FLAGS:STRING='-stdlib=libc++ -std=gnu++11' -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_legacy=NO -D CMAKE_OSX_ARCHITECTURES=x86_64 -D WITH_CUDA=OFF  ..

6) make -j4
7) in Eclipse Juno, create a user library, Eclipse > Preferences > Java > Build Path > User Libraries > New > [Type OpenCV2.4.7] > Add External JARS
8) a) for jar file, browse to opencv-247.jar (usually in build/bin/opencv-247.jar)
8) b) also for native library location, browse to the lib directory (usually in build/lib)

Testing the linkage (in Eclipse Juno)

1) Create a new project
2) Link to OpenCV2.4.7 library by

Right Click your project > Properties > Add Library > User Library > Select OpenCV2.4.7

3) Create a class file with a main function > and duplicate the following codes
//opencvimport org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class Tester {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("mat= "+mat.dump());
}
}

4) Look at the *beaut* in the console now.

*DISCLAIMER*
Unfortunately, i am still figuring out to make this work with CUDA.  Until then .. until then..

Thursday, November 21, 2013

Mavericks OSX 10.9, HTTPS proxy, infinite loop of authentication boxes

If you are behind an obnoxious and thick-as-a-brick proxy, you will quickly find that an upgrade to 10.9 from 10.8 (or any earlier versions) will break your Safari, OSX software update, iTunes etc...

This is largely because of a semi-known bug with HTTPS proxy in KeyChain.   This blog post serves as a summary of what you can do in order to fix the problem (at least, let you get a decent OSX software update from App Store and see what happens there)

I have sorted the potential fixes in the order of likelihood to fix the problem.  For every fix, please open up Safari and see if the fix works(go to any of your favourite *internet* websites).  If yes, stop and go to Software Update.  If no, proceed with the next fix or leave me comments.

Fix #0

Before we proceed, you must make sure that you are comfortable with configuring proxy connections in OSX.  [System Preferences > Network > Network Interface > Advanced > Proxies]
Make sure, where necessary, you have your information input correctly in one or all of the followings:

  • Automatic Proxy Configuration
  • Web Proxy (HTTP)
  • Secure Proxy (HTTPS)
  • other proxies if applicable



Fix #1

As mentioned earlier, if you are like me that likes to dig in, search and look for the one thing that I want to see, you can actually go to [ Utilities > Console ] and you shall see the error messages that Mavericks complains every time it tries to look for the HTTPS key in the Key Chain

1) Open Utilities > KeyChain Access.app
2) In [login], you should see your proxy entries



3) Right click and select copy
4) In [system], if you see something similar, i suggest you remove those entries first (we will add them again in the next step)
5) In [system], right click and click paste (if it asks for your credentials, just enter your credentials and click ok)
6) Make sure one entry is for HTTP and one entry is for HTTPS and make sure the Account Name and Password are correct (you can check this by double clicking the entry)
7) For every one of the entries you just pasted, double click (enter credential if necessary) and go to Access Control
8) Select Allow all applications to access this item, click save changes and restart computer
9) Some applications might still ask you for permission to use the key in KeyChain, just say yes and enter the necessary credential

Fix #2

1) Open Utilities > Terminal.app > Type the following 2 commands.
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.UserNotificationCenter.plist
sudo launchctl load - w /System/Library/LaunchDaemons/com.apple.UserNotificationCenter.plist
2) Restart computer

Fix #3
1) Open Utilities > Terminal.app
2) sudo vi /etc/hosts
3) make sure the ip address to your proxy is set there (ie. 192.168.0.1 proxy.abc.org) and press shift+: and type wq.
4) Restart computer


References
Just poke google with keywords like mavericks 10.9 https secure proxy safari app store



Friday, May 10, 2013

Watch Pronunciation

Audemars Piguet:OH-duh-MAHR PEA-GAY
A. Lange & Sohne:AH Lung-Geh Oohnt Sew-neh
Baume & Mercier:bohm AY mer-SEE-AY
Bedat:bid-UT
Breitling:brEYE-tling
Bulgari:bull-gar-EE
Carl F. Bucherer:Carl F BOOK-er-er
Cartier:Car-TEA-AY
Chanel:Shan-el
Chopard:Show-Par
Concord:Con-cord
Corum:Core-oom
Cvstos:COUS-toss
De Witt:Dah-Wit
Dior:DEE-oar
Ebel:AY-bell
Franck Muller:Fronk MEW-ler
Girard-Perregaux:Jee-rar Pear-ago
Hublot:OOH-blow
IWC:EYE-DOUBLE-YOU-SEE
Jaeger-LeCoultre:YAY-ger Le-Cool-ter
Movado:Moe-vah-doh
Oris:Oris
Panerai:Pun-a-rye
Parmigiani:Par-mi-GEE-ah-NEE
Patek Philippe:Pah-tek Fee-LEAP
Philippe Charriol:Fee-LEAP Shar-ee-ole
Piaget:PEE-ah-JAY
Raymond Weil:Ray-mand WHILE
Richard Mille:REE-Shar MEAL
Rolex:Row-Lex
TAG Heuer:Tahg Hoy-er
Ulysse Nardin:YOU-lis Nur-den
Vacheron Constantin:Va-sher-own Cone-Stun-tuhn
Zenith:ZEE-nith

Reference: http://www.gemnation.com/base?processor=getPage&pageName=watch-pronunciation

Monday, April 22, 2013

Unit Axes of a Cube



UnitAxes = ...
    [1 1 -1;...
    1 1 0; ...
    1 1 1; ...
    0 1 1; ...
    -1 1 1; ...
    -1 1 0; ...
    -1 1 -1; ...
    0 1 -1; ...
    
    1 0 -1;...
    1 0 0; ...
    1 0 1; ...
    0 0 1; ...
    -1 0 1; ...
    -1 0 0; ...
    -1 0 -1; ...
    0 0 -1; ...
    
    1 -1 -1;...
    1 -1 0; ...
    1 -1 1; ...
    0 -1 1; ...
    -1 -1 1; ...
    -1 -1 0; ...
    -1 -1 -1; ...
    0 -1 -1; ...
    
    0 1 0;...
    0 -1 0];
    

Thursday, September 13, 2012

Rotating 3D Figures in Octave

When Octave.app is executed, input the followings
> close all 
> setenv ("GNUTERM", "x11") 

There you go.

I'm sharing this original post from http://octave.1599824.n4.nabble.com/rotate-3d-graphics-td1638659.html

Delaunay Triangulation and a Plane

When reconstructing a surface especially in three dimensional, its almost inevitable that you need to generate planes based on a set of vertices. In the case, when the facets are unknown, we basically have a cloud of three dimensional points. Based on the cloud of points, our eyes may be able to tell us what the sillouette or the contour of the three dimensional model in question is; however it is quite difficult or this is not trivial and it is a well-studied problem in computational geometry.

Certainly, there are a lot of recently proposed and well-developed methodologies for estimating or reconstructing a surface based on a given cloud of points. This post is written just to provide an idea of one of the basics: delaunay triangulation.  In short delaunay triangulation is to create a triangular mesh for a set of vertices that meets the Delaunay conditions(the main idea is to prevent any surface-within-a-surface).

In matlab, it is fair easy to follow the example (provided by Matlab).  Or if you want to explore further, you can try to make a cube. Basically you just need to write down the vertices and let Matlab do its job. I will leave the readers to do this on your own.

X, Y, Z are the column vectors of a cube(meaning all the x coords, y coords and z coords, say you have 2 vertices (0,0,0) and (0,0,1), X=[0 0]; Y=[0 0]; Z=[0 1];).

> dt = delaunay(X,Y,Z); 
> trimesh(dt,X,Y,Z); 

Now, that's pretty straightforward. However, if you have a problem similar to mine, when you only want to create a 3D plane with delaunay(you have your own reasons, i don't have to tell you mine). In the above example, if you only specify one of the faces of the cube, Matlab will probably tell you that they cannot proceed because all vertices are on a plane or are co-linear.

In order to do so, you need to trick Matlab into thinking the plane is no longer a plane; basically you just have to 'extrapolate' the plane in the perpendicular direction

Originally 
X =[0 1 1 0];
Y =[0 1 1 0];
Z =[0 0 1 1];

Perturbed 
X =[ 0 1 1.01 1.01 1 0];
Y =[0 1 0.99 0.99 1 0];
Z =[0 0 0 1 1 1];

Running the same command in the previous section should give you the following rendering.