Use Notepad++ to edit files on VM

Very similar to the previous post on working with GoPiGo files. This example is for the Robotics Nanodegree VM on VirtualBox and VMWare.

1) Install openssh-server on the VM.

robond@udacity:~$ sudo apt-get install openssh-server

2-VMWare) Open a terminal in the VM and use ifconfig to find inet addr.

2-VirtualBox) Add a port forwarding rule in the Oracle VM VirtualBox Manager.

  1. Select the VM and click settings.
  2. Select Network and click Port Forwarding.
  3. Set new rule with the following values:

Screenshot 2017-07-22 23.36.04.png

3) Open Notepad++ and add NppFTP plugin if you don’t already have it.

  1. Plugins -> Plugin Manager -> Show Plugin Manager
  2. Find NppFTP and install it.

4) “Show NppFTP Window” in the Plugins dropdown.

5) Click the gear symbol and then “Profile settings”

6) Add a new profile. Call it “Robo-ND-VM” or any other name and edit the following fields (Use inet addr for Hostname on VMWare):

Hostname: 127.0.1.1   (or VMWare inet addr)
Connection type: SFTP
Port: 2222
Username: robond
Password: robo-nd (or your new password)

Screenshot 2017-07-22 23.42.22.png

7) Connect and click yes on the warning pop-up and you are ready to edit. You might need to chmod the file permissions on the VM first.

 

Online backup try outs

I tried MediaFire and BitCasa recently and after a few days of waiting for them to back up a couple gigabytes of data I decided to give up. There was no indication that a single file was uploaded, so forget it. Delete.

Then I found a deal with box.net that gives you an extra 5 GB if you download the iPhone app. That’s a total of 10 GB with folder syncing. This deal ends at the end of Oct 2012.

So now I’ve added another 10 GB of free syncing to my other services:

  • 9.25 GB on Dropbox (+25 GB “temporary” SpaceRace space)
  • 25 GB on SkyDrive (previous user bonus)
  • 5 GB on Google Drive
  • 5 GB on SpiderOak
  • 10 GB on Box

I’ve been using Dropbox the longest and save my programming work and GitHub folders there. The version history/recovery has already saved me a couple times when a program file I’m working on blanked out during a crash. And they give extra space to students – https://www.dropbox.com/spacerace?r=NTQ5NzIyNjg4OQ

I use SkyDrive for photos mostly. I like the look of the online image viewer. I also use hotmail, so it is easy to send friends a link to my photos. Service comparisons that I’ve seen online don’t mention that SkyDrive’s versioning is only for MS documents. It doesn’t store old versions of any other documents.

SpiderOak allows you to sync any folder so I have it backing up my desktop and a couple program config files.

I haven’t found a specific use for Google Drive yet. I like Google’s online spreadsheet more than MSN’s online Excel just because it will auto-scroll if you are highlighting cells while dragging the mouse off the page. It’s a subtle but important feature that MSN overlooked.

I don’t know what I will do with Box yet. (I think the best way to use multiple syncing services is to have a different purpose for each one.)

These are all syncing services. I decided to stay away from the backup services for now, especially the free unlimited space variety. You have to actively manage your backups and you never know when they may delete your account due to inactivity or a change in their payment policy, because they don’t declare that any space is permanently yours like the other services I use. If I really need a lot more space, I will probably go with SkyDrive and just use the extra space for pictures anyway. Also, SkyDrive had the best pricing the last time I compared services.

Sudoku game generator

I wrote a Sudoku game generator based on what I know from playing Sudoku.

it is on ActiveState.com http://goo.gl/FbDQ0

I think it’s possible that some games may have more than one solution. I don’t feel like working with it more, but one way to prevent multiple solutions is have the computer play the game a few times and throw out those that do have more than one solution. I would have to randomize the order in which play options are done. It takes me awhile to solve one by hand, so I haven’t tested it too much, but it’s good so far.

cv2.triangulatePoints

X = cv2.triangulatePoints(P1, P2, x1, x2)
	• P1: Camera projection from X to x1; x1 = dot(P1,X)
	• P2: Camera projection from X to x2; x2 = dot(P2,X)
	• x1: 2xN normalized points
	• x2: 2xN normalized points

The projection matrices have the same origin. If camera one is set as the world origin, then P1 = eye(4)[:3]. The program crashed when I tried integer point arrays.

Complete example:

# Camera projection matrices
P1 = eye(4)
P2 = array([[ 0.878, -0.01 ,  0.479, -1.995],
            [ 0.01 ,  1.   ,  0.002, -0.226],
            [-0.479,  0.002,  0.878,  0.615],
            [ 0.   ,  0.   ,  0.   ,  1.   ]])
# Homogeneous arrays
a3xN = array([[ 0.091,  0.167,  0.231,  0.083,  0.154],
              [ 0.364,  0.333,  0.308,  0.333,  0.308],
              [ 1.   ,  1.   ,  1.   ,  1.   ,  1.   ]])
b3xN = array([[ 0.42 ,  0.537,  0.645,  0.431,  0.538],
              [ 0.389,  0.375,  0.362,  0.357,  0.345],
              [ 1.   ,  1.   ,  1.   ,  1.   ,  1.   ]])
# The cv2 method
X = cv2.triangulatePoints( P1[:3], P2[:3], a3xN[:2], b3xN[:2] )
# Remember to divide out the 4th row. Make it homogeneous
X /= X[3]
# Recover the origin arrays from PX
x1 = dot(P1[:3],X)
x2 = dot(P2[:3],X)
# Again, put in homogeneous form before using them
x1 /= x1[2]
x2 /= x2[2]

print 'X\n', X
print 'x1\n', x1
print 'x2\n', x2
X
[[  1.003   2.008   3.012   1.003   2.011]
 [  4.012   4.009   4.017   4.029   4.019]
 [ 11.019  12.023  13.041  12.089  13.057]
 [  1.      1.      1.      1.      1.   ]]
x1
[[ 0.091  0.167  0.231  0.083  0.154]
 [ 0.364  0.333  0.308  0.333  0.308]
 [ 1.     1.     1.     1.     1.   ]]
x2
[[ 0.42   0.537  0.645  0.431  0.538]
 [ 0.389  0.375  0.362  0.357  0.345]
 [ 1.     1.     1.     1.     1.   ]]

It would be nice if the cv2 function could accept 4×4 transformation and 3xN homogeneous point matrices and also return a homogeneous array.

def triangulatePoints( P1, P2, x1, x2 ):
    X = cv2.triangulatePoints( P1[:3], P2[:3], x1[:2], x2[:2] )
    return X/X[3]

Udacity

I signed up for two courses on Udacity; CS373 Programming a Robotic Car, which is in its second phase self-paced incarnation, and CS253 Web Application Engineering. I signed up for the web app class initially because I think it could lead to a great occupation and also because I believe I have a great idea for a facebook rival and an idea for a research oriented ‘timeline’ application.

I wanted to sign up for the robotic car because it sounds very interesting, but I wasn’t sure if it would take time away from my schoolwork. I decided it doesn’t have to be a serious commitment because it seems that a lot of people don’t finish it. Turns out that it is very applicable, I’m already understanding the machine learning concepts from a class I was sitting in on. That class was a second part to a previous class that I missed and too difficult, but Thrun is so much clearer and takes it in easy steps. Now I have a better grip on Bayes theory, which it not all that complicated and something that I was already naturally doing. It’s just a formal definition of obvious logic.

Now I’m installing the Google App Engine (v1.6.4 for windows) for Python. It said it found Python 2.5 while installing. I hope that won’t be a problem since I use 2.7 mostly.

Thrun’s use of Python seems a little backwards and doesn’t use the special nuances of Python. I don’t know if he thinks it’s easier for the students or because he is use to it from other languages. There is no NumPy in the online Python IDE. I have to learn how to manipulate lists in ways that would be so simple with arrays. Although I think it is pointless since array processing is computationally faster than lists. All this time I’ve been trying hard to avoid for loops, especially nested for loops, and now I am forced to write them, haha, but that’s okay.

OpenCV install

I can finally use OpenCV in Python after several attempts over the last few months. Previously, I could not import or use it even though it appeared to be installed along with Python XY.

In a nutshell:
1) Installed PythonXY 2.7.2.1
2) import cv2.cv as cv (for running older cv examples)

I tried searching for a simple solution but all I found were complicated install instructions involving ‘builds’ or ‘building’ on your system and other sources that made this all seem easy.
Finally, I came across the revision listing for Python XY and found that the newest version solves some issue with it. So I updated from 2.6 to 2.7.
But no where did I see anything about having to ‘import cv2.cv’. All of the code snippets I’ve seen just ‘import cv’. I finally came across a code that had ‘import cv2.cv’ and tried it and everything finally worked, the door was finally unlocked. Except for having seen that import statement in some code, how was I to know that I needed to import cv2 instead of cv?