bikle.com /Opinions/Tech Tips

Howto: AngularJS, Node.js App deployed to Heroku

Dan's AngularJS Learning Club (DALC)

Stock Market Predictions via MADlib Logistic Regression

Split Date Adjustments of Stock Market Data For Machine Learning

Stock Market Backtest with PostgreSQL 9.2 and LibSVM

Video Conferencing via Gmail

Join bikleTech!

Install Cygwin X-Windows and OpenSSH on Windows8

VirtualBox, Vagrant, Linux on Windows8

Linux 101

gem install pg: debugged

Ubuntu 12.04.3 Libraries needed by Ruby 2.0 and Rails 4.x

Selenium Can Test H2O Web UI

Understand Confusion Matrix via SQL

Call Java HelloWorld from JRuby

Deploy 0xdata H2O 10 Node Cluster on Hadoop on EC2

0xdata H2O on Linux Laptop

Stock Market/MADlib Linear Regression

Node.js For Rails on CentOS 6.4

Heroku Toolbelt

NOT IN to Left Outer Join

Install MADlib on Postgres 9.2 on CentOS 6.4

Install Postgres 9.2.4 on Ubuntu 12.04.2

Access Windows 8 BIOS on HP ENVY TS 15 Notebook PC
Page Top

Video Conferencing via Gmail

I like how Google has implemented Video Conferencing.

Google has branded this technology as 'Google Hangouts'.

The software behind it is available at this URL:

https://www.google.com/tools/dlpage/hangoutplugin

Of all the Video Conferencing choices available to me, the typical web consumer, I think Google offers the cleanest use-case scenario:

  • Given that I am logged into Gmail
  • And my 2 friends are logged into Gmail
  • And I click on their names and start a chat-session with each
  • And I click on the tiny-video-camera icon in the chat window
  • When they accept the request sent by that click
  • Then we have a Hangout video conference

I have worked with many video conference products in the past, and my feeling is they have too many steps and hurdles to make it seem, 'easy'.

Also, once the Hangout is established, the controls are easy to understand. They don't seem cluttered or confusing.

And Hangouts has screen-sharing and other valuable features which other products try to add-on for a fee.

The Hangout software behaves the same on Windows, Mac, and Linux.

One wrinkle with Linux was the installation.

After I pressed the installation button at this URL: https://www.google.com/tools/dlpage/hangoutplugin

the browser downloaded this file which landed in my ~/Downloads/ directory:

-rw-rw-r-- 1 dan dan 12766698 Nov 14 03:34 google-talkplugin_current_amd64.deb

I then logged in as root and installed the file with this shell command:

dpkg -i ~/Downloads/google-talkplugin_current_amd64.deb

Windows was similar. I downloaded a dot-exe file and clicked it and it did what I wanted.

A Demo

I've collected some screen-shots and some comments for those of you who have not yet tried Google Hangouts Video Conferencing.

I started this demo by logging into dan.bikle@gmail.com.

I used a chrome-browser on windows8.

Then I logged into dan.bikle2@gmail.com using a chrome-browser running on Linux.

In the windows-browser I saw this:

In the linux-browser I saw this:

In the windows-browser I clicked on the Dan who was on the Linux box:

In the Linux-browser, a small chat-window popped up. I circled the text message sent from the windows-browser:

This chat-window contains the next step towards setting up a video conference.

In the image below, I circled the area containing the control I used to establish the video connection. It looks like a grey-tiny video camera:

I clicked that grey-tiny video camera.

The google-hangout software came to life on the Linux host:

Notice that the web-cam (and the microphone) on the Linux host was turned off.

The windows-browser started ringing like a telephone.

The chat-window there prompted me to accept the video-call:

I accepted the call.

The google-hangout software came to life on the Windows laptop:

Since the Linux web-cam was off, the windows-hangout-window showed only a static photo of the caller.

The web-cam on the Windows-laptop was working well though.

The Linux-hangout-window displayed live video sent from the laptop:

On the windows-laptop I moved the mouse to the left-edge which brought some controls into view:

I experimented with the controls and found them easy to understand.

The green-box control is useful if you want broadcast a series of screens from your desktop to an audience.

The blue-camera control is useful if you are in the audience and you want to capture interesting screens from the presenter.

It's obvious how to use the other controls so I assign you homework to study them.

I think Google-Hangout is useful for some types of collaboration over the web and I look forward to Hangout with you!




Page Top

Join bikleTech!

I setup bikleTech as a community of people who write software: https://groups.google.com/forum/#!forum/bikleTech

I see this group as a place to share events, URLs, Git-Repos, tips, techniques, and opinions.

To keep away spammers I made this an invite-only forum.

I invite you to join. Please send your join-request to dan.bikle@gmail.com.

The world wants to know what you know.




Page Top

Install Cygwin X-Windows and OpenSSH on Windows8


This tech-tip describes how I installed Cygwin X-Windows and OpenSSH on Windows8.

Before I discuss the how, I'll explain the why.

Most current laptop software-development environments fall into three categories:

  - Windows
  - Linux
  - Apple

Most current server software-deployment environments fall into two categories:

  - Windows
  - Linux

I develop software on a Windows8 laptop and deploy it to Linux servers
running in data centers owned by companies like Amazon, Rackspace,
Google and my favorite, NephoScale.

Why do I develop software on a Windows8 laptop?

I do it for three main reasons.

First, compared to Apple laptops, Windows8 laptops are cheap.

Today, 2013-11-08, I can buy a 15 inch Apple laptop for about $2000:

http://store.apple.com/us/buy-mac/macbook-pro




I can buy a 17 inch Windows8 laptop with 16G of ram, 1TB of disk, 
and an Intel i7 CPU for about $1000:


http://www.google.com/search?q=17+inch+laptop+i7+site:costco.com






Secondly, a new Windows8 laptop with 16G of ram, 1TB of disk, and an i7 CPU,
is a powerful machine.

Third, for software development, I want a large 17 inch screen.

Apple has discontinued manufacturing 17 inch laptops.

One problem with Windows8 laptops is the OS is poorly suited 
for developing Linux software.

That is easy to change though, and that is why I wrote this tech-tip.

Enhancing a Windows8 laptop boils down to two main ideas:

First, install software, Cygwin, on the laptop which makes it easy 
to communicate with linux servers.

Second, install more software, VirtualBox and Vagrant, on the laptop 
which allows me to run linux servers inside the laptop.

How I installed Cygwin

I searched:
  goog: cygwin download

I landed here:


http://cygwin.com/install.html



Avoid this link, do not download it:
  http://cygwin.com/setup-x86.exe

I downloaded this and clicked it.
  

http://cygwin.com/setup-x86_64.exe






The UI is not initially friendly.

Once I understood it though, I liked it.

Usually the default options are okay.

I clicked through until:
  Choose A Download Site

My favorite sites:
  ftp://mirrors.kernel.org
  http://mirrors.kernel.org



In UI I searched for:
  xorg-server
  
I clicked X11.

I clicked xorg-server.






I ignored others.

I clicked Next; I kept clicking through.




I checked boxes to create/add icons.



That completed the install of xorg-server.

I use it as a demo of a typical install.

Cygwin is full of many types of useful software for your Windows8 laptop.

Next, I started an install of xinit.

I clicked this again:
  setup-x86_64.exe



I clicked through until I was presented the search box.

I typed in xinit.



I kept clicking through as I had done before.

I checked boxes to create/add icons.
I doubt it is necessary, the icons already exist, but I did it anyway.



That completes the install of xinit.

I searched for the XWin Server via the Windows8 magnifinder.

It sent me to the Start-Menu folder.



I clicked the icon and Cygwin gave me a bare-bones xterm window 
with a shell prompt in it.



I wanted an xterm with a scroll-bar so I asked for one via a simple shell command:

xterm -sb &



I wanted a mintty terminal so I asked for one via a simple shell command:

mintty &



Next I started on the task of installing cygwin software called OpenSSH.

I clicked this again:
  setup-x86_64.exe



I clicked through until I was presented the search box.

I typed in openssh.



I kept clicking through until it was installed.

That completes the install of openssh.

Next, I tested it by using the ssh-shell-command to connect to 
a Linux server on my LAN:



It worked, I was happy:



I tested an X-Windows feature that allowed me to run X-Window software
on the Linux server, but display on my laptop:



It worked perfectly and I was happy.

The next tech-tip, part 2, describes how I installed both VirtualBox 
and Vagrant on my Windows8 laptop:


  Part2: VirtualBox, Vagrant, Linux on Windows8



That software combination allows me to run many Linux servers inside my laptop.

This is useful when I need to develop software for cluster technology like Hadoop.




Page Top

VirtualBox, Vagrant, Linux on Windows8


I started my effort to install VirtualBox on my Windows8 
laptop by drilling down into the laptop BIOS interface
and enabling virtualization.

This was a multistep procedure which required some finesse.

It is difficult to show you how I did this because I had
to deal with an area of Windows8 which cannot be easily 
screen-captured.

So in order to explain how I did this,
I'll use a lot of English and some poor quality photos
from an actual digital camera.

I started by right-corner-mouse-hover.

I searched for "BIOS"

I clicked Advanced Startup Options:



I clicked through and saw this page:



I scrolled the right window all the way to the bottom.

It is difficult to read but the text in the image says:

Advanced startup
And the button under the description says:
Restart now

I pressed the button and it led me down a path to reboot my laptop.

In the next screen I clicked 'Troubleshoot'.

I could not capture the screen so I took a photo with my camera:




I clicked Advanced Options:



I clicked UEFI Firmware Settings:




I clicked through and was shown Startup Menu.

I pressed F10 to gain access to BIOS Setup:



I saw the main BIOS screen:



I found the Virtualization Setting and enabled Virtualization:



I saved the new settings, and exited the BIOS interface 
and Windows8 rebooted:




I continued my effort to install VirtualBox on my Windows8 
laptop by searching google which lead me to a download page:


http://www.virtualbox.org/wiki/Downloads




After I downloaded the installer, I saw it in my Downloads folder:



After I walked through the install, I imported some virtual-boxes
I had built on another laptop.

I clicked the VirtualBox startup icon,
and the VirtualBox GUI appeared:



With VirtualBox installed, I started on the task of installing Vagrant.

Before I describe that effort I'll insert a short opinion about both
VirtualBox and Vagrant.

VirtualBox is very useful software.

On a usefulness scale of 1 to 10, I give it a 9.

In the old days, before VirtualBox and VMware, if I wanted a new
Linux server in my office, I would order an actual desktop
computer from zareason.com at a cost of about $700.
After a few days, UPS would deliver it.  Then I would spend
an hour or three getting it configured.

Now, when I want a new Linux server in my office I use
VirtualBox to create a new one inside my laptop.

The incremental cost is $0; I really like VirtualBox.

I have a lower opinion of Vagrant, not because I dislike it.
It is because I'm not very dependent on it.

On a usefulness scale of 1 to 10, I give it a 4.

When Vagrant is working correctly, it saves me time
because it provides an elegant interface to VirtualBox.

I've worked with several versions of Vagrant and sometimes
I could not get it to work as I expected.

I suspect the problems were due to my attempt to run 
VirtualBox 4.1.x on Windows8.

I got it to sort of work but that combination is not
officially supported.

That lack of compatibility caused problems for Vagrant.

Anyway, if my problems with Vagrant are too severe, I just stop using
it for a few weeks/months and do all my virtualization activities via
the normal interfaces to VirtualBox.

If you have problems with Vagrant, I suggest you just wait for a newer
version to come out and see how that works.

Currently I have this combination of software:

Vagrant 1.3.5
VirtualBox 4.3.2
Windows8

The above combination is working well for me.

With that opinion behind us, I now describe how I installed vagrant.

I used google to find the Vagrant download page:


http://downloads.vagrantup.com









After the download and install, I used a bash shell to look for the
vagrant command.

A little knowledge goes a long way here.

A typical Windows-person usually expects new software to be visible
as a click-able icon.

Vagrant though, has a command line interface so the place to
look for it is in either a DOS command line or a Cygwin bash shell:



Next, I used Vagrant to create a specification for a new Linux
server in the following directory inside my Cygwin account:

~/vagrants/ubuntuDemo/

Screen Captures:





Then, I used the 'vagrant up' command to transform the
specification (a file called Vagrantfile) into a running
Linux Server:




Then I verified the server was indeed up:




Next, I used 'vagrant ssh' to login to the vagrant account on the
new Linux server from my Cygwin account.

Once in, I connected to the root account using the command:

sudo bash

From the root account, I changed the password of root.

Then, I created an account called 'dan'.

Next, I changed the password of dan.

Then, I verified that I could ssh into the new dan account:




So that concludes this tech-tip.

Typically what I do next is configure the Linux server so that
it can be used as a software development environment.

That is a rather large topic so I shy away from it now.

I can say that most configuration in Linux is automated
with the help of sophisticated tools.

My favorite configuration tool is Chef:


https://github.com/opscode/chef





Page Top

101

If you are a Windows person, I wrote this page for you.

Some people want to use Linux as a platform to run software. I call this type of person an 'Operator'. If that describes you, the Linux you need to learn is both easy and minimal.

The next step up, is deploying software on a Linux host. I call this type of person a 'Deployer'.

Learning to deploy is about as difficult as baking pie, which is not that hard unless you want to do something like build a pie factory.

If you pick up deployment skills, the next higher level is 'Developer'. Developing software on Linux mostly requires diligence.

In the old-days you needed strong problem solving skills, knowledge, training, and a mentor.

Now you only need three things: persistence, an ability to breakdown complex English questions into several simple questions, and access to Google.

Aside from 'Developer', another role is 'Administrator'.

I have picked up a few administrative skills. The ones I've found most useful are related to networking, adding diskspace, adding accounts, and troubleshooting malfunctioning software.

Operator

As an Operator, I need to login to my Linux box. Sometimes the box is on my LAN. Other times the box is in a datacenter far away. Sometimes the box is inside VirtualBox or VMware which is inside my laptop somewhere.

In all three of these cases, the best way to login is via software called SSH. If you are on an Apple laptop, you are in luck. I'll take a minute to describe SSH on Apple, then I'll take the discussion back to Windows.

On Apple just find the terminal application. Then find the IP address (or hostname) of your Linux box. Then type in something like this:

ssh -YA dan@192.168.1.42

The above command logs you into the dan account on a Linux box at IP address: 192.168.1.42

Actually this would work also:

ssh dan@192.168.1.42

Enough about Apple. On Windows, I have no terminal application like I find on Macs. So, I install one.

The best terminal application for Windows is xterm which is inside of Windows software called Cygwin.

Installing Cygwin is easy. I describe it here:

http://bikle.com/techtips/cygwin#cygwin

After I install Cygwin, and thus xterm, I do the same as I would on a Mac:

ssh dan@192.168.1.42

Actually, I'd probably do this:

ssh -YA dan@192.168.1.42

This second way allows me to run software on the Linux box such that it appears to actually be running on my laptop.

For example, I like to run Firefox on a Linux box and have it act as running on my laptop.

Firefox running on Linux (but displayed on Windows) is less vulnerable to virus-bearing images served by evil websites.

But, I digress, back to teaching you to be a Linux Operator.


Once you are logged in to Linux via SSH,
you should see a thing called a shell prompt.

For example:


Shell prompts look different on different hosts.

Usually though, a shell prompt ends with a dollar sign.

The idea is simple, if linux shows you a shell prompt, 
it wants you to type in a shell command.

The first command you should learn is:

dc

The dc command does: Desk Calculator

The dc command will replace the shell prompt with, nothing.

You need to know how to get back to the shell prompt.

You return to the shell prompt by typing in q.

For example:

dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ dc
q
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 

The dc command is not very useful to me.

You need to know about it though, because it is only a matter of time
before you type in dc by mistake.

More information:


http://en.wikipedia.org/wiki/Dc_%28computer_program%29







The next command you should learn is cd.

For example:

dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ dc
q
dan@ub97hp_scikit ~ $ cd
dan@ub97hp_scikit ~ $ cd /
dan@ub97hp_scikit / $ cd /usr
dan@ub97hp_scikit /usr $ cd /tmp
dan@ub97hp_scikit /tmp $ cd
dan@ub97hp_scikit ~ $ cd ..
dan@ub97hp_scikit /home $ cd .
dan@ub97hp_scikit /home $ 
dan@ub97hp_scikit /home $ 

The cd command does: Change Directory

A directory is the same as a folder; it is a container of files.

If you understand what a Windows folder is, then you understand a directory.

If you want to go to your home-directory, type in just cd.








The next command you should learn is ls.

For example:

dan@ub97hp_scikit /home $ 
dan@ub97hp_scikit /home $ 
dan@ub97hp_scikit /home $ cd
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ ls
bak	  Desktop    hostname  hosts_bak.txt  libsvm	 readme.txt  sg
bikle400  Downloads  hosts     ks	      madlibsvm  scikit_gbm
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 




The ls command does: List

The idea is simple, ls lists files and directories inside your current directory.

It is similar to how the folder utility works in Windows excpect ls only
shows characters instead of icons.

In Windows when you look at a folder, sometimes Windows will hide
files from you.

Linux has this same 'feature'.

If you want to see ALL the files, type ls -a, for example:


dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ ls
bak	  Desktop    hostname  hosts_bak.txt  libsvm	 readme.txt  sg
bikle400  Downloads  hosts     ks	      madlibsvm  scikit_gbm
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ ls -a
.	       bikle400   .fontconfig  hosts	      .profile	     sg
..	       .cache	  .gconf       hosts_bak.txt  .psql_history  .ssh
.aptitude      .config	  .gem	       ks	      .pulse	     .thumbnails
bak	       .dbus	  .gemrc       libsvm	      .pulse-cookie  .Xauthority
.bash_aliases  Desktop	  .gitconfig   .local	      .rbenv
.bash_history  Downloads  .gnome2      madlibsvm      readme.txt
.bash_logout   .emacs	  .gvfs        .mozilla       scikit_gbm
.bashrc        .emacs.d   hostname     .pki	      .screenrc
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 




In Windows sometimes you want to see details about files like size and date.

The command ls -al will show you ALL the files, LONG format:

dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ ls -al
total 176
drwxr-xr-x 27 dan  dan  4096 Nov 11 20:36 .
drwxr-xr-x  4 root root 4096 Oct 31 06:16 ..
drwx------  2 dan  dan  4096 Nov 11 08:25 .aptitude
drwxrwxr-x  2 dan  dan  4096 Nov 11 07:33 bak
-rw-rw-r--  1 dan  dan  2828 Nov 11 09:17 .bash_aliases
-rw-------  1 dan  dan  1807 Nov 11 20:36 .bash_history
-rw-r--r--  1 dan  dan   220 Apr  3  2012 .bash_logout
-rw-r--r--  1 dan  dan   871 Nov 11 07:26 .bashrc
drwxr-xr-x 14 dan  dan  4096 Nov 11 09:00 bikle400
drwx------  6 dan  dan  4096 Nov 11 03:23 .cache
drwx------  6 dan  dan  4096 Nov 11 03:23 .config
drwx------  3 dan  dan  4096 Nov  6 05:28 .dbus
drwxr-xr-x  2 dan  dan  4096 Nov 11 03:25 Desktop
drwx------  2 dan  dan  4096 Nov 11 03:25 Downloads
-rw-rw-r--  1 dan  dan  1614 Oct 31 07:31 .emacs
drwx------  3 dan  dan  4096 Oct 31 07:42 .emacs.d
drwxr-xr-x  2 dan  dan  4096 Oct 31 07:40 .fontconfig
drwx------  2 dan  dan  4096 Nov 11 07:46 .gconf
drwxrwxr-x  3 dan  dan  4096 Nov 11 08:05 .gem
-rw-rw-r--  1 dan  dan   256 Oct 31 07:31 .gemrc
-rw-rw-r--  1 dan  dan   466 Oct 31 07:31 .gitconfig
drwxr-xr-x  3 dan  dan  4096 Nov 11 03:23 .gnome2
drwx------  2 dan  dan  4096 Nov 11 03:25 .gvfs
-rw-r--r--  1 dan  dan     8 Nov 11 07:41 hostname
-rw-r--r--  1 dan  dan  2018 Nov 11 08:46 hosts
-rw-r--r--  1 dan  dan   222 Nov 11 08:47 hosts_bak.txt
drwxr-xr-x 14 dan  dan  4096 Nov 11 20:36 ks
drwxr-xr-x  8 dan  dan  4096 Nov  6 06:50 libsvm
drwxrwxr-x  3 dan  dan  4096 Nov 10 20:53 .local
drwxr-xr-x  3 dan  dan  4096 Nov  6 07:09 madlibsvm
drwx------  4 dan  dan  4096 Nov  6 05:31 .mozilla
drwx------  3 dan  dan  4096 Nov 10 20:54 .pki
-rw-r--r--  1 dan  dan   675 Apr  3  2012 .profile
-rw-------  1 dan  dan  7631 Nov 11 08:04 .psql_history
drwx------  2 dan  dan  4096 Nov 10 20:54 .pulse
-rw-------  1 dan  dan   256 Nov  6 05:31 .pulse-cookie
drwxr-xr-x 10 dan  dan  4096 Nov 11 08:02 .rbenv
-rw-rw-r--  1 dan  dan   168 Nov  3 02:23 readme.txt
drwxrwxr-x  3 dan  dan  4096 Nov  7 23:57 scikit_gbm
-rw-rw-r--  1 dan  dan  3306 Oct 31 07:31 .screenrc
lrwxrwxrwx  1 dan  dan    10 Nov  6 05:34 sg -> scikit_gbm
drwx------  2 dan  dan  4096 Nov 10 20:45 .ssh
drwx------  3 dan  dan  4096 Nov 11 03:23 .thumbnails
-rw-------  1 dan  dan   216 Nov 11 20:36 .Xauthority
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 




In Windows you can sort files in a folder by date.

The command ls -alt will show you ALL the files, LONG format, TIME sorted:

dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ ls -lat
total 176
-rw-------  1 dan  dan  1807 Nov 11 20:36 .bash_history
drwxr-xr-x 14 dan  dan  4096 Nov 11 20:36 ks
drwxr-xr-x 27 dan  dan  4096 Nov 11 20:36 .
-rw-------  1 dan  dan   216 Nov 11 20:36 .Xauthority
-rw-rw-r--  1 dan  dan  2828 Nov 11 09:17 .bash_aliases
drwxr-xr-x 14 dan  dan  4096 Nov 11 09:00 bikle400
-rw-r--r--  1 dan  dan   222 Nov 11 08:47 hosts_bak.txt
-rw-r--r--  1 dan  dan  2018 Nov 11 08:46 hosts
drwx------  2 dan  dan  4096 Nov 11 08:25 .aptitude
drwxrwxr-x  3 dan  dan  4096 Nov 11 08:05 .gem
-rw-------  1 dan  dan  7631 Nov 11 08:04 .psql_history
drwxr-xr-x 10 dan  dan  4096 Nov 11 08:02 .rbenv
drwx------  2 dan  dan  4096 Nov 11 07:46 .gconf
-rw-r--r--  1 dan  dan     8 Nov 11 07:41 hostname
drwxrwxr-x  2 dan  dan  4096 Nov 11 07:33 bak
-rw-r--r--  1 dan  dan   871 Nov 11 07:26 .bashrc
drwx------  2 dan  dan  4096 Nov 11 03:25 .gvfs
drwxr-xr-x  2 dan  dan  4096 Nov 11 03:25 Desktop
drwx------  2 dan  dan  4096 Nov 11 03:25 Downloads
drwx------  3 dan  dan  4096 Nov 11 03:23 .thumbnails
drwx------  6 dan  dan  4096 Nov 11 03:23 .cache
drwx------  6 dan  dan  4096 Nov 11 03:23 .config
drwxr-xr-x  3 dan  dan  4096 Nov 11 03:23 .gnome2
drwx------  2 dan  dan  4096 Nov 10 20:54 .pulse
drwx------  3 dan  dan  4096 Nov 10 20:54 .pki
drwxrwxr-x  3 dan  dan  4096 Nov 10 20:53 .local
drwx------  2 dan  dan  4096 Nov 10 20:45 .ssh
drwxrwxr-x  3 dan  dan  4096 Nov  7 23:57 scikit_gbm
drwxr-xr-x  3 dan  dan  4096 Nov  6 07:09 madlibsvm
drwxr-xr-x  8 dan  dan  4096 Nov  6 06:50 libsvm
lrwxrwxrwx  1 dan  dan    10 Nov  6 05:34 sg -> scikit_gbm
-rw-------  1 dan  dan   256 Nov  6 05:31 .pulse-cookie
drwx------  4 dan  dan  4096 Nov  6 05:31 .mozilla
drwx------  3 dan  dan  4096 Nov  6 05:28 .dbus
-rw-rw-r--  1 dan  dan   168 Nov  3 02:23 readme.txt
drwx------  3 dan  dan  4096 Oct 31 07:42 .emacs.d
drwxr-xr-x  2 dan  dan  4096 Oct 31 07:40 .fontconfig
-rw-rw-r--  1 dan  dan  1614 Oct 31 07:31 .emacs
-rw-rw-r--  1 dan  dan   256 Oct 31 07:31 .gemrc
-rw-rw-r--  1 dan  dan   466 Oct 31 07:31 .gitconfig
-rw-rw-r--  1 dan  dan  3306 Oct 31 07:31 .screenrc
drwxr-xr-x  4 root root 4096 Oct 31 06:16 ..
-rw-r--r--  1 dan  dan   220 Apr  3  2012 .bash_logout
-rw-r--r--  1 dan  dan   675 Apr  3  2012 .profile
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 





So, I have just shown you some Linux shell commands:

ssh
dc
cd
ls

Once you master those commands, you know enough to follow
one of the thousands of Linux tutorials on the web:


https://www.google.com/search?q=Linux+tutorial


Here is some homework:


https://www.google.com/search?q=In+Linux+How+I+create+a+directory


https://www.google.com/search?q=In+Linux+How+I+copy+a+directory


https://www.google.com/search?q=In+Linux+How+I+rename+a+directory


https://www.google.com/search?q=In+Linux+How+I+remove+a+directory




https://www.google.com/search?q=In+Linux+How+I+create+a+file


https://www.google.com/search?q=In+Linux+How+I+copy+a+file


https://www.google.com/search?q=In+Linux+How+I+rename+a+file


https://www.google.com/search?q=In+Linux+How+I+remove+a+file



After you finish your homework and walk through some tutorials,
you need to learn how to operate an editor on Linux.

I suggest you start with an editor which 
runs on Windows, Apple, Cygwin, and Linux:


https://www.google.com/search?q=How+I+install+Emacs+on+Windows


https://www.google.com/search?q=How+I+install+Emacs+on+Cygwin


https://www.google.com/search?q=How+I+install+Emacs+on+Linux





Next, you might like this editor:


http://www.sublimetext.com/


http://en.wikipedia.org/wiki/Sublime_Text





Eventually, you need to learn vi or its sibling, vim.

The vi editor is the default editor installed on linux.

It's UI is both terse and unique so the vi editor 
forces you to climb over a learning curve:


https://www.google.com/search?q=Linux+vi+editor+tutorials


That concludes the Linux 101 tech-tip.




Page Top

gem install pg: debugged


Today I moved one of my Rails sites from a development box running Centos6.4
to a development box running Ubuntu 12.04.3.

I bumped into a problem when I tried to install the pg Ruby Gem.

It was easy to fix though.

I just needed to add a library to Ubuntu:


dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ gem install pg -v 0.16.0
Fetching: pg-0.16.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
	ERROR: Failed to build gem native extension.

    /home/dan/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/dan/.rbenv/versions/2.0.0-p247/bin/ruby
	--with-pg
	--without-pg
	--with-pg-config
	--without-pg-config
	--with-pg_config
	--without-pg_config
	--with-pg-dir
	--without-pg-dir
	--with-pg-include
	--without-pg-include=${pg-dir}/include
	--with-pg-lib
	--without-pg-lib=${pg-dir}/


Gem files will remain installed in /home/dan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pg-0.16.0 for inspection.
Results logged to /home/dan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pg-0.16.0/ext/gem_make.out
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 


The fix was easy:

dan@ub97hp_scikit ~ $
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ aptitude search libpq
p   libpq-dev                       - header files for libpq5 (PostgreSQL librar
p   libpq-dev:i386                  - header files for libpq5 (PostgreSQL librar
i A libpq5                          - PostgreSQL C client library               
p   libpq5:i386                     - PostgreSQL C client library               
p   libpqxx-3.1                     - C++ library to connect to PostgreSQL      
p   libpqxx-3.1:i386                - C++ library to connect to PostgreSQL      
p   libpqxx-3.1-dbg                 - C++ library to connect to PostgreSQL (debu
p   libpqxx-3.1-dbg:i386            - C++ library to connect to PostgreSQL (debu
p   libpqxx3-dev                    - C++ library to connect to PostgreSQL (deve
p   libpqxx3-dev:i386               - C++ library to connect to PostgreSQL (deve
p   libpqxx3-doc                    - C++ library to connect to PostgreSQL (docu
dan@ub97hp_scikit ~ $
dan@ub97hp_scikit ~ $
dan@ub97hp_scikit ~ $

dan@ub97hp_scikit ~ $ su
Password: 
root@i97host:/home/dan# aptitude install libpq-dev
The following NEW packages will be installed:
  comerr-dev{a} krb5-multidev{a} libgssrpc4{a} libkadm5clnt-mit8{a} 
  libkadm5srv-mit8{a} libkdb5-6{a} libpq-dev 
0 packages upgraded, 7 newly installed, 0 to remove and 3 not upgraded.
Need to get 974 kB of archives. After unpacking 3,150 kB will be used.
Do you want to continue? [Y/n/?] 
Get: 1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libgssrpc4 amd64 1.10+dfsg~beta1-2ubuntu0.3 [57.5 kB]
Get: 2 http://apt.postgresql.org/pub/repos/apt/ precise-pgdg/main libpq-dev amd64 9.3.1-1.pgdg12.4+1 [618 kB]
Get: 3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libkadm5clnt-mit8 amd64 1.10+dfsg~beta1-2ubuntu0.3 [38.7 kB]
Get: 4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libkdb5-6 amd64 1.10+dfsg~beta1-2ubuntu0.3 [37.5 kB]
Get: 5 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libkadm5srv-mit8 amd64 1.10+dfsg~beta1-2ubuntu0.3 [54.4 kB]
Get: 6 http://us.archive.ubuntu.com/ubuntu/ precise/main comerr-dev amd64 2.1-1.42-1ubuntu2 [42.7 kB]
Get: 7 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main krb5-multidev amd64 1.10+dfsg~beta1-2ubuntu0.3 [125 kB]
Fetched 974 kB in 3s (286 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libgssrpc4.
(Reading database ... 164488 files and directories currently installed.)
Unpacking libgssrpc4 (from .../libgssrpc4_1.10+dfsg~beta1-2ubuntu0.3_amd64.deb) ...
Selecting previously unselected package libkadm5clnt-mit8.
Unpacking libkadm5clnt-mit8 (from .../libkadm5clnt-mit8_1.10+dfsg~beta1-2ubuntu0.3_amd64.deb) ...
Selecting previously unselected package libkdb5-6.
Unpacking libkdb5-6 (from .../libkdb5-6_1.10+dfsg~beta1-2ubuntu0.3_amd64.deb) ...
Selecting previously unselected package libkadm5srv-mit8.
Unpacking libkadm5srv-mit8 (from .../libkadm5srv-mit8_1.10+dfsg~beta1-2ubuntu0.3_amd64.deb) ...
Selecting previously unselected package comerr-dev.
Unpacking comerr-dev (from .../comerr-dev_2.1-1.42-1ubuntu2_amd64.deb) ...
Selecting previously unselected package krb5-multidev.
Unpacking krb5-multidev (from .../krb5-multidev_1.10+dfsg~beta1-2ubuntu0.3_amd64.deb) ...
Selecting previously unselected package libpq-dev.
Unpacking libpq-dev (from .../libpq-dev_9.3.1-1.pgdg12.4+1_amd64.deb) ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Processing triggers for install-info ...
Processing triggers for man-db ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Setting up libgssrpc4 (1.10+dfsg~beta1-2ubuntu0.3) ...
Setting up libkadm5clnt-mit8 (1.10+dfsg~beta1-2ubuntu0.3) ...
Setting up libkdb5-6 (1.10+dfsg~beta1-2ubuntu0.3) ...
Setting up libkadm5srv-mit8 (1.10+dfsg~beta1-2ubuntu0.3) ...
Setting up comerr-dev (2.1-1.42-1ubuntu2) ...
Setting up krb5-multidev (1.10+dfsg~beta1-2ubuntu0.3) ...
Setting up libpq-dev (9.3.1-1.pgdg12.4+1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
                                         
root@i97host:/home/dan# 
root@i97host:/home/dan# 
root@i97host:/home/dan# exit

dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ gem install pg -v 0.16.0
Building native extensions.  This could take a while...
Successfully installed pg-0.16.0
1 gem installed
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 
dan@ub97hp_scikit ~ $ 



Page Top

Ubuntu 12.04.3 Libraries needed by Ruby 2.0 and Rails 4.x


Here is a list of libraries which I add to Ubuntu 12.04.3 
before I attempt to install Ruby 2.0 and then Rails 4.x.

apt-get install build-essential \
openssl 			\
libreadline6 			\
libreadline6-dev 		\
curl 				\
git-core 			\
zlib1g 				\
zlib1g-dev 			\
libssl-dev 			\
libyaml-dev 			\
libsqlite3-dev 			\
sqlite3 			\
libxml2-dev 			\
libxslt-dev 			\
autoconf 			\
libc6-dev 			\
ncurses-dev 			\
automake 			\
libtool 			\
bison 				\
nodejs

Page Top