Friday, June 28, 2013

Thursday, June 27, 2013

node.js supervisor

Node Supervisor is used to restart programs when they crash.
It can also be used to restart programs when a *.js file changes.

Installation:
$ sudo npm install supervisor -g

Usage:
$ supervisor [options] <program>

jshint

JSHint

Installation:
$ sudo npm install -g jshint

Why?
use it for JavaScript and node.js

(works within pycharm as well)

Wednesday, June 26, 2013

"Unable to connect to dbus" when run some gnome apps when su to root in a terminal window

T510 ~ # xhost
access control disabled, clients can connect from any host
SI:localuser:gbiglow

T510 ~ # xhost local:root
non-network local connections being added to access control list

T510 ~ # xhost
access control disabled, clients can connect from any host
LOCAL:
SI:localuser:gbiglow
T510 ~ #

Tuesday, June 25, 2013

Color Theme for Geany Editor

https://code.google.com/p/geany-vibrant-ink-theme/wiki/HowToSetupVibrantInkTheme

https://github.com/codebrainz/geany-themes/tree/master/colorschemes

https://github.com/codebrainz/geany-themes/downloads

Add Custom Actions to Nemo file manager in Linux

https://github.com/linuxmint/nemo/issues/207


Linux Commands Cheat Sheet

https://github.com/WilliamHackmore/linuxgems/blob/master/cheat_sheet.org.sh

Right Click -> Create New Document, New Templates

How to add templates:

just add files to your ~/Templates directory. Name them so the name without the extension makes sense as that is all you will see in the pop up menu.

I went further as I like to "hide" dirs I rarely use.

rename ~/Templates to be ~/.templates

edit ~/config/user-dirs.dirs so that TEMPLATES line reads:

XDG_TEMPLATES_DIR="$HOME/.templates"

Logoff & back on to see the change.

Note:

  • If you create subdirs within the template directory you pop-up menu will show the groupings.
  • If you had previously deleted the Templates dir (as I did) the XDG_TEMPLATES... will just be pointing at $HOME
References:

Sunday, June 23, 2013

Pycharm colors

After playing with Sublime Text for a while I realized:

  • I still want the power and functionality of Pycharm and this is where my $ is going.
  • The "look" of Sublime Text and color schemes make Pycharm look dated and ugly.


So, the hunt begins for better color themes for Pycharm.

  1. https://github.com/sevas/pycharm-color-schemes, ugg xml errors and I am in no mood to debug that.
  2. https://github.com/d1ffuz0r/pycharm-themes
  3. https://gist.github.com/brianly/1622286
    • put the xml file in ~/.Pycharm20/config/colors
    • restart Pycharm if its running
    • File->Setting-> Colors & Fonts
      • Pick the Dark Solarized theme, do a save as if you want to pick a different font as well.

Note: File->Settings->Appearance lets one pick an overall look for Pycharm. The steps above just muck with the look of the editor component only.

After all of the above I ended up just using the builtin Darkula theme with the font size increased just a little. Fun learning experience anyway.

Linux Firewall

http://net.tutsplus.com/tutorials/other/the-linux-firewall/

Friday, June 21, 2013

node.js Notes

Good advice re: learning node.js is here.


$ npm shrinkwrap   is like   $ pip freeze   Explanation here.


Connecting to local mondoDB server or a cloud mongoDB is simply a matter of creating the connection URL properly. Do A or B below.

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var url;

module.exports.mongoose = mongoose;
module.exports.Schema = Schema;

// (A) Connect to cloud database (like mongolab)
var username = "user";
var password = "password";
var address = '@dbh42.mongolab.com:27427/nockmarket';
url = 'mongodb://' + username + ':' + password + address;
connect(url);

// (B) Connect to DB called chapter1 on local mongoDB server
url = 'mongodb://localhost/chapter1';
connect(url);

// Connect to mongo
function connect(u) {
  mongoose.connect(u);
}

function disconnect() {mongoose.disconnect()}


Thursday, June 20, 2013

Monday, June 17, 2013

Install Dropbox on Linux Mint

Download Ubuntu (.deb) 64-bit from here.

Review previous post on dealing with deb files.

$ cd <dir-you-downloaded-deb-file to>

$ sudo dpkg -i dropbox_1.6.0_amd64.deb

run dropbox from the start menu, it will download other DB components.


Apache Benchmark

$ sudo apt-get install apache2-utils

utility programs for webservers

Provides some add-on programs useful for any webserver. These include:

  •  ab (Apache benchmark tool)
  •  logresolve (Resolve IP addresses to hostname in logfiles)
  •  htpasswd (Manipulate basic authentication files)
  •  htdigest (Manipulate digest authentication files)
  •  dbmmanage (Manipulate basic authentication files in DBM format, using perl)
  •  htdbm (Manipulate basic authentication files in DBM format, using APR)
  •  rotatelogs (Periodically stop writing to a logfile and open a new one)
  •  split-logfile (Split a single log including multiple vhosts)
  •  checkgid (Checks whether the caller can setgid to the specified group)
  •  check_forensic (Extract mod_log_forensic output from Apache log files)

ab can be used to look at performance issued of node.js

Working with node.js

Show installed packages in node.js

$ npm list

Install mongodb driver for node.js

$ npm install mongodb

Install Mongoose

$ npm install mongoose




HTML, CSS, JavaScript Tutorials

Some nice simple on-line free tutorials for HTML, CSS, and JavaScript. Great for beginners.
Thanks HTML DOG.


Another good looking on-line free teaching site for these topics is W3Schools.

Pancakes

Okay, why buy commercial pancake mix full of extra crap when one can just...

  • 1/2 cup of Mike or Butter Milk or Yougurt
  • 3 eggs
  • 1/2 Teaspoon Salt
  • 2 Teaspoons Baking Powder
  • 3/4 Cup Whole Wheat Flour (may need more than this or less, add to get workable consistency)


Mix up
Fry

Output = 2 big pancakes.

Saturday, June 15, 2013

How to display lots of system info about your Linux Machine

Commands to show lots of info about your Linux system.

$ cat /etc/*release

$ cinnamon --version


$ uname -a 

$ lscpu 

$ ifconfig -a 

$ dpkg --list | more

Kivy

$ su
$ add-apt-repository ppa:kivy-team/kivy
$ apt-get update
$ apt-cache search kivy
$ apt-get install python-kivy
$ apt-get install python-kivy-examples

examples go into: /usr/share/kivy-examples



http://kivy.org/docs/installation/installation-ubuntu.html

http://kivy.org/docs/gettingstarted/examples.html




Startup Engineering

A very promising free on-line course.

Startup Engineering from Stanford is offered by coursera. 10 weeks, starts June 17 2013.

This technical course builds on an early Stanford course that was more theory.


Startup Engineering requires one to have (free) accounts with:

  • Amazon Web services (AWS)
  • Github
  • Heroku

Install node.js on Linux Mint 15

Install node.js on Linux Mint 15 (based on here):

$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs

Notes:

  • There is a "node.js" in first sudo line above but only "nodejs" in third sudo line! Careful.
  • As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.


node.js doc is here.

node.js into video tutorial. into on-line book.


Log of the apt-get install step:

T510 ~ # apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  rlwrap
The following NEW packages will be installed:
  nodejs rlwrap
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 6,012 kB of archives.
After this operation, 17.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ppa.launchpad.net/chris-lea/node.js/ubuntu/ raring/main nodejs amd64 0.10.11-1chl1~raring1 [5,926 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ raring/universe rlwrap amd64 0.37-3 [85.7 kB]
Fetched 6,012 kB in 3s (1,724 kB/s)                             
Selecting previously unselected package rlwrap.
(Reading database ... 181805 files and directories currently installed.)
Unpacking rlwrap (from .../rlwrap_0.37-3_amd64.deb) ...
Selecting previously unselected package nodejs.
Unpacking nodejs (from .../nodejs_0.10.11-1chl1~raring1_amd64.deb) ...
Processing triggers for man-db ...
Setting up rlwrap (0.37-3) ...
update-alternatives: using /usr/bin/rlwrap to provide /usr/bin/readline-editor (readline-editor) in auto mode
Setting up nodejs (0.10.11-1chl1~raring1) ...
T510 ~ # 

Tuesday, June 11, 2013

Quest for a "good" Python IDE

Continue the quest for the best Python IDE

1. WingIDE 101 (free)

Download 64 bit deb file from here

Install enscript as WingIDE needs it but is not smart enough to pull it down

$ sudo apt-get install enscript

$ sudo dpkg -i wingide-101-4.1_4.1.13-1_amd64.deb 

Conclusion. I don't like this IDE. Faster to start than pycharm but this free version is just too basic. So:

$ sudo apt-get remove wingide-101-4.1
$ sudo apt-get remove enscript

2. Ninha IDE (free)

$ sudo apt-add-repository ppa:ninja-ide-developers/ninja-ide-stable
$ sudo apt-get update
$ sudo apt-get install ninja-ide

3. Pycharm ($99)

I keep coming back to this one.

Geany Plugins

$ sudo apt-cache search geany

$ sudo apt-get install geany-plugin-debugger


Use plugin manager menu option of geany to activate a plug-in

Note: the debugger supported with this plugin does not work with Python

Winpdb - Python debugger

Search for winpdb:
$ sudo apt-cache search winpdb


Install winpdb:
$ sudo apt-get install winpdb

https://code.google.com/p/winpdb/wiki/DebuggingTutorial

Modify Geany "set build commands" to include a "debug" option which would execute "winpdb %f"

nvidea Driver choice and impact on Linux Mint 15 Suspend/Resume

Hmm...

When I use the nvidia-310 (recommended) driver, Suspend and Resume work fine.

When I use the xserver-xorg-video-nouveau driver, Suspend work but Resume spits out lots of errors and basically hangs.

The 310 drivers seem fine now, they were causing some issues a few weeks back. Strange....


Dealing with DEB files

.deb files are Debian packages. The package files associated with Ubuntu have the .deb suffix because of Ubuntu's close relations with the Debian GNU/Linux distribution. You will need administrative privileges to install a .deb file.

To install a .deb file, simply double click on it, and then select Install Package.

Alternatively, you can also install a .deb file by opening a terminal and typing:

$ sudo dpkg -i package_file.deb

To uninstall a .deb file, deselect it in your package manager, or type:

$ sudo dpkg -r package_name

Python GUI

Sometimes you just want to throw together a very basic python program and you would like a decent GUI rather than a command line interface or a web page interface. Note: I am using Python 2.7.4

1. Tkinter

Tutorial, Another Tutorial

If you get "please install the python-tk package" when you try to > import Tkinter in a python shell, you need to install python-tk

$ sudo apt-get install python-tk



2. Kivy

Hmm??? Works on Android....









The following packages have been kept back

sudo apt-get dist-upgrade

http://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it




Upstart on Linux Mint

Controlling scripts to automatically execute as part of the Linux boot process.

Boot Log files...



http://beginlinux.com/server/ubuntu/how-to-run-scripts-at-ubuntu-startup

http://forums.linuxmint.com/viewtopic.php?f=60&t=112410

Python Debugger

pdb

winpdb

Kayak time?

Are there white-caps out there?

Where is the tide?

Why walk 2639 feet to go look when one can check online!

Ruby on Rails (RoR)

It raining so I can't paint the house or go for a nice bike ride along the ocean. Hmm... why not investigate Ruby on Rails???

Option 1:

Option 2:




Saturday, June 8, 2013

Day Pack

Knife
Compass
Map
Fire Starter
Whistle
GPS
First Aid
Water
Jacket/Shell
Wind Pants
Snack
Hat
Gloves
Extra Socks
Bug Head Net
Bug Spray
Sun Screen
Emergency Blanket
Rope
Air Horn
Sun Glasses
Head Lamp
Bear Spray
Cell Phone
Batteries
Tarp
Parachord
TP
Camera

Nexus 7 Hiking/Biking GPS

Can the Nexus 7 serve as an effective GPS for hiking and bilking?


App requirements

  • offline maps (with efficient storage methods)
  • readable maps and controls (zoomable)



Candidates

The Web stack

Hosting
  • Heroku
Web Server
  • Heroku server
Framework

  • Flask (python)
  • Django (python)
  • Rails (ruby)

Database

  • MongoDB
  • PostgreSQL
HTML

CSS

jquery (javascript)




Inspired by this.

Friday, June 7, 2013

ipython qtconsole

To install the qtconsole:

$ sudo apt-get install ipython-qtconsole

To run:

$ ipython qtconsole



Official Doc

YouTube overview


Sunday, June 2, 2013

Windows 8 on a Lenovo U410

Quite a nice machine once:

  • One removes some of the crapware Lenovo loads on it
  • One adds a start Button program to deal with the bizarre Windows 8 interface

I think this would be a very nice machine if it was running Windows 7 or Linux.

Saturday, June 1, 2013

Restart Hung Desktop (Cinnamon) in Linux Mint

To restart Cinnamon (if desktop appears to hang)

Option 1

Alt-F2
r

Option 2

Or, Try pressing Alt+F2 and at the prompt type cinnamon --replace and then press Enter.

Option 3

Use the Cinnamon settings applet (it looks like a "^" in your panel) and under "Troubleshoot" you'll find "Restart Cinnamon".

Option 4

If that's not possible for you, then you can exit to a console and restart using the same instructions as for gnome-shell: http://community.linuxmint.com/tutorial/view/641 (use cinnamon --replace instead as shown below).

Switch to the console using CTRL+ALT+F1 (to switch back to the DISPLAY use CTRL+ALT+F7).

Then, find out which display you're using by using the "w" command:

$ w
 15:23:19 up 23:42,  5 users,  load average: 0.03, 0.11, 0.38
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
clem     tty1                      11:32    8:03  16.14s  0.01s /usr/lib/gnome
clem     pts/0    :1               11:13    4:07m  3.17s  9.61s gnome-terminal
clem     pts/1    :1               11:26    3:52m  2:17   0.27s bash
root     pts/2    :1               12:03   21:53   0.36s  0.36s /bin/bash -i
clem     pts/3    :1               14:56    0.00s  0.39s  0.00s w

In the FROM column you'll see your display. Most of the time it's ":0". In our example above it's ":1".
Export that display from the console using the following command:

$ export DISPLAY=:1.0

(replace 1 with the value of your display of course).
And then restart Gnome Shell from there:

$ cinnamon --replace

Switch back to the DISPLAY using CTRL+ALT+F7 and voila...

Boot and Shutdown issues - Linux Mint 15 Olivia

Started seeing some hanging in system shutdown and issues booting up.


  1. Removed modemmanager package
    1. sudo apt-get --purge remove modemmanager
  2. Enabled KVM support in bios
  3. Returned to xserver-org-video-nouveau video drivers (had been using the recommended nvidia-310 set.
System now much more stable and shut downs and boots appear faster.