Thursday, August 15, 2013

Linux & Windows partition changes, boot fun

To remove GRUB from the MBR on primary disk in the laptop that hold Windows 7:

  • boot with recovery DVD
  • get to a command window
  • issue commands to re-write the MBR

To write GRUB to the external HD containing Linux Mint:
  • Boot Machine off Mint Live DVD (can't use virtual box for this)
  • Launch GPARTED to determine disk and partition holding Mint
  • Open terminal window
  • sudo mount   /dev/sdb1   /mnt
  • sudo grub-install /dev/sdb  --root-directory=/mnt
grub probe does report some errors but installation of grub works.


to refresh the grub menu on the external drive (if it needs updating...):
  • sudo update-grub

to add an entry for linux into the Windows boot menu (otherwise one needs to get the boot list (f12 at startup)):


Tuesday, August 6, 2013

Powershell (Windows... ugg)

Powershell ISE

Powershell 2.0 was loaded on my Win7 SP1 machine so...

Windows Management Framework 3.0 (includes PS 3.0)
http://www.microsoft.com/en-us/download/details.aspx?id=34595



How to determine what version of PowerShell is installed:
PS C:\> $psversiontable

To Update help in PS, start an elevated PS session (not the ISE!) and enter:

PS> Update-Help






Thursday, July 4, 2013

A Basic Node.js site

A basic Node.js site using:

  • Mongoose - object data modeling (ODM) library to access a mongoDB data store
  • Express web app framework
  • Jade template engine
  • Connect middleware (cookies, favicon, static files, session management, etc) Note: This is installed by NPM as a dependency for Express.
  • twitter bootstrap front end framework
  • tbd - login using Google, Facebook, etc (passport?)
  • best practices for packages.json (support dev & prod, proper dependency version wild-carding etc.)
Steps:

$ cd ~/dev          (assumes ~/dev exists)
$ express appName   (pick any valid app name)
$ cd appName

edit package.json to include following dependency line
"mongoose": "*"

$ npm install     (install all dependencies)
$ npm start       (just test the server starts and works the ^c out of it)

$ mkdir model     (create a dir to hold model related files)
$ cd model

edit db.js to contain:


var mongoose = require( 'mongoose' );
var todoSchema = new mongoose.Schema({
 item: String,
 complete: Boolean,
 date: { type: Date, default: Date.now }
});
mongoose.model( 'Todo', todoSchema );
mongoose.connect( 'mongodb://localhost/todoDB' );



add to app.js:
, db = require('./model/db')


Tuesday, July 2, 2013

PyCharm - bought it.



Yes its great and all the free IDE options were lacking somehow so I bought a license. I like it for python and javascript. Lots of useful add-ins for MongoDB, Jade, etc etc.

PyCharm !


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.



Thursday, May 30, 2013

Customize Places Folder in Linux "Start menu" or short-cuts in Nemo file browser


  • Open Nemo (the file browser) and drag and drop directories to the short cut list in the left pane under "My Computer". 
  • Right Click->Remove any items you want to delete from the list. 
  • Right Click-> rename to rename items. 
  • List within the Start Menu->Places will now reflect your changes.

Customize the Mouse Cursors in Linux Mint


  1. Download cursor packs (from here for example, X11 Mouse Themes section)
  2. Expand into ~/.icons (create dir if required)
  3. Menu -> System Tools -> System Settings -> Themes -> Other Settings [tab]  -> Mouse Pointer [pull down]


Upgrade to Linux Mint 15

Steps to Upgrade to Linux Mint 15

This process assumes you have an existing Linux installation on a disk that has enough free space to create a new partition for version 15. In this way you can boot 15 and copy over items from the other Linux environment.
  1. While running Windows 7, Download the ISO image for Linux Mint 15, 64 bit, Cinnamon from here.
  2. Use UNetbootin to create a bootable USB Memory Stick with the ISO image just downloaded.
  3. Reboot off the USB Memory stick (F12 at boot to get a hardware boot menu)
  4. Run Install Linux Mint
    1. select installation type "Something Else" in order to manage which HD and partition Mint is installed to.
  5. Reboot Mint from Hard disk
  6. Activate recommended NVidia video drivers
    1. Menu -> Preferences-> Driver Manager
  7. Apply any pending updates
    1. $ sudo apt-get update
    2. $ sudo apt-get upgrade 
  8. Using Firefox, Install Google-Chrome
    1. Download and run the 64 bit Ubuntu-Debian DEB file
    2. Note: the Google install updates software sources so later runs of apt-get upgrade will get updated versions of chrome.
  9. Install MongoDB
    1. Instructions here.
  10. Install Pycharm
    1. su
    2. mkdir /opt/pycharm
    3. cd /opt/pycharm
    4. mv /home/gbiglow/Downloads/pycharm-2.7.2.tar.gz .
    5. tar xfz pycharm-*.tar.gz
    6. rm pycharm-2.7.2.tar.gz
    7. Run pycharm.sh from the bin subdirectory
      1. do this in a shell once to see if pycharm complains about the wrong JDK
      2. note: look in following log to see if pycharm is logging any start-up errors
        1. /home/gbiglow/.PyCharm20/system/log/idea.log
  11. 'Install' Oracle JDK (pycharm wants the official Oracle one - too bad)
    1. Background
      1. Some notes on installing Oracle JDK - here.
      2. Some other notes on JDK - here (note remove OpenJDK step!)
    2. I took the KISS approach which requires manual repeats to update Oracle Java but does not screw with the official Linux Mint installed OpenJDK
      1. download jdk-7u21-linux-x64.tar.gz from Oracle
      2. expand it into /opt/java
      3. add following to ~./bashrc
        1. export PATH=/opt/java/jdk1.7.0_21/bin:$PATH
  12. Install tools using $ sudo apt-get install <tool-name>
    1. Development tools:
      1. python-pip
      2. python-virtualenv
      3. git
      4. terminator
      5. meld
      6. ipython
    2. Sys Admin tools:
      1. gparted
      2. htop
      3. hardinfo (shows in start menu as "System Information")
  13. Install Heroku Toolbelt
    1. $ sudo wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
    2. $ heroku login

Still Todo:
  1. Fully Copy home dir from old linux installation...
  2. Fix up GRUB and Windows boot menu

Tuesday, May 28, 2013

stockticker (flask/mongodb) on Heroku

Creating an App

1. Create ~/.gitconfig (if not already there)

$ git config --global user.name "My Name"
$ git config --global user.email emailname@mailhost.com

2. Set-up Project Specific Development environment:

$ mkdir ~/dev/stock-fh
$ virtualenv venv
$ work stock-fh
$ git init
$ gedit .gitignore
$ gedit README.md
$ git add .
$ git commit -m "initial commit"
$ mkdir static static/css static/js static/img static/ico templates

create favicon.ico file at favicon.cc and add to static/ico

add any necessary css, js, and img files, html goes in templates dir


3. Go to bitbucket.org and create a new repo called stock.fh and then:

$ git remote add origin ssh://git@bitbucket.org/gbiglow/stock-fh.git
$ git push -u origin --all

4. install required python components and generate requirements.txt

$ pip install flask
$ pip freeze > requirements.txt
$ git add requirements.txt
$ git commit -m "added initial requirements.txt"
git push origin master

5. create a Procfile for heroku and foreman

$ echo "web: python app.py" > Procfile
$ git add Procfile
$ git commit -m "added initial Procfile"
$ git push origin master

6. Create heroku app (this also creates a heroku remote for git)

$ heroku create stock-fh
git push heroku master

7. use mongoDB on heroku




todo:
  • pip add pymongo etc. update requirements.txt
  • twitter bootstrap
  • investigate flask app generator. code. (possible automation of steps 2-6 above into a single command. hmm...

Notes:
  • This is all based on this great article.
  • The command 'work' (above) is a local script to activate a virtualenv
  • I use bitbucket rather than github as bitbucket has unlimited private repos as part of a free account.









Monday, May 27, 2013

Realy good linux reading

http://www.thegeekstuff.com/2010/11/50-linux-commands/
http://www.thegeekstuff.com/2010/12/50-unix-linux-sysadmin-tutorials/
http://www.thegeekstuff.com/2011/12/linux-performance-monitoring-tools/

htop - linux process viewer

htop

A terminal based real time process viewer. Better than the basic linux top command.

To install:

$  sudo apt-get install htop

To run:

$ htop

Read More:

http://www.thegeekstuff.com/2011/09/linux-htop-examples/

http://www.howtogeek.com/howto/ubuntu/using-htop-to-monitor-system-processes-on-linux/





Terminator - Terminal Emulator

Terminator is a very flexible terminal emulator for linux.

Installation of latest version: (taken from here)

$ sudo add-apt-repository ppa:gnome-terminator
$ sudo apt-get update
$ sudo apt-get install terminator

Note: by adding in the gnome-terminator repository (above) you will ensure you get the latest version.

Read more:


Thanks to Kuldeep for the pointer to this tool!


Sunday, May 26, 2013

Meld - a graphical DIFF tool

How to install Meld

$ sudo apt-get update
$ sudo apt-get install meld

Stay tuned for how to configure Meld in Pycharm

Using Bitbucket with Pycharm

Pycharm (the python IDE) has built in support for Github. That's nice as I want to use git for source code management. Codeschool by the way has a nice free git intro course in their electives area. Enough to get one going with git.

The free Github plan however is restrictive compared to Bitbucket's free plan.

Github: no private repos, limited to just yourself.
Bitbucket: unlimited private repos, up to 5 team members

So how does one configure Pycharm to use Bitbucket?

  1. Create a free bitbucket account
  2. Launch Pycharm and go to Settings->Plugins
  3. Click on Browse Repositories
  4. Enter Bitbucket into the search field
  5. Highlight the Bitbucket pluging and click on the "dowload & install" icon
  6. Close all windows and re-start Pycharm (required after a plug-in installation)
  7. Relauch Pycharm
  8. Return to settings and select the new Bitbucket option in the IDE section
  9. Enter Bitbucket userID and password.
  10. Click on Add SSH Key button and navigate to the SSH key you used for Bitbucket




Friday, May 17, 2013

How to install Software on Linux Mint

Read this:
http://forums.linuxmint.com/viewtopic.php?f=90&t=97158

Carefully follow the advice for : checkinstall

$ sudo apt-get install checkinstall

and then use it when building packages from source code.

https://help.ubuntu.com/community/CheckInstall

Linux Mint Update Manager no longer runs

Update Manager asks for SU passwork but fails to run when launched from the start menu. $ sudo mintupdate results in the following: (gksudo:5105): GConf-CRITICAL **: gconf_value_free: assertion `value != NULL' failed No module named gtk No module named pygtk Traceback (most recent call last): File "/usr/lib/linuxmint/mintUpdate/mintUpdate.py", line 59, in gettext.install("mintupdate", "/usr/share/linuxmint/locale") NameError: name 'gettext' is not defined Is the resent installation of Python 2.7.4 to blame? 2.7.4 is in /usr/local/bin and is the default to current user. /usr/bin/python is the old 2.7.3 $ python Python 2.7.4 (default, May 15 2013, 21:25:05) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk Traceback (most recent call last): File "", line 1, in ImportError: No module named gtk >>> import pygtk Traceback (most recent call last): File "", line 1, in ImportError: No module named pygtk >>> $ /usr/bin/python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk >>> import pygtk >>>


mucking with python (adding a newer version into /usr/local/bin) broke mintupdate as it requires a python with pygtk access. I will update this posting once that is resolved......

Thursday, May 16, 2013

My System

Unless otherwise noted, all the posts in this blog are related to working in the following environment.

Hardware

  • Lenovo T510 Laptop
    • 8GB memory
    • internal 500GB HD for Windows 7
    • internal 750GB HD for Linux
    • eSATA port for connecting external SATA drives (great feature when one want to have 3 HDs available or swap in other HDs for special purposes)
  • Thermaltak BlackX HDD docking station (ST0005U)
    • takes a single 2.5" HD or a single 3.5" HD
    • USB 2.0 or eSATA connection to host
    • press F12 at system startup to get a boot menu that sees this device
    • both Windows 7 and Linux Mint see this device
Software
  • Windows 7 Professional edition, 64 bit
  • Linux Mint 14 Nadia, 64 Bit, Cinnamon
    • Based on Ubuntu Quantal (12.10)

Tuesday, May 14, 2013

Install latest PostgreSQL on Linux Mint


PostgreSQL

Installation


create /etc/apt/sources.list.d/pgdg.list containing:

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

Import the repository signing key, and update the package lists

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -

Update repository indexes

$ sudo apt-get update

Install postgreSQL (run all these cmds as root)

# apt-get install postgresql-9.2
# apt-get install postgresql-contrib-9.2
# apt-get install pgadmin3

Set OS password for user 'postgres'

$ sudo passwd postgres

Set DB password for user 'postgres'

$ psql
psql> ALTER USER postgres WITH PASSWORD 'jessie123';
psql>\q

(note: the new password above is enclosed in double quotes)

Create a .bashrc in home dir of user 'postgres' containing:

PATH=$PATH:/usr/lib/postgresql/9.2/bin
export PGDATA='/var/lib/postgresql/9.2/main/'
export PGCONF='/etc/postgresql/9.2/main'



psql commands

\q
Quit out of psql
select name, setting from pg_settings where category = 'File Locations';
Show settings & file locations


























Key directories

/etc/postgresql/9.2/main
Configuration files
/var/lib/postgresql/9.2/main
Data dir (env var $PGDATA)
/var/lib/postgresql
Home dir for user postgres






Key files

/etc/postgresql/9.2/main/pg_ident.conf
Mappings of OS logins to postgreSQL user
/etc/postgresql/9.2/main/postgresql.conf
General settings, where data is stored, where logs are etc
/etc/postgresql/9.2/main/pg_hba.conf
Host based authentication, security and authentication settings
/var/log/postgresql/postgresql-9.2-mail.log
Log file for postgreSQL server







Environment Variables

PGDATA
Location of postgres data
PGCONG
Location of postgres config files (gcb use only)


Server Control

Start the service
/etc/init.d/postgresql start
pg_ctl start
Stop the service
/etc/init.d/postgresql stop
pg_ctl stop
Know the status
/etc/init.d/postgresql status
pg_ctl status
Restart the service
/etc/init.d/postgresql restart
pg_ctl restart
Reload config without restarting server
pg_ctl_reload








apt-get notes (package management)

List all installed packages (pipe to grep to search for a specific pattern):
$ dpkg --get-selections | grep <pattern>


remove all libreoffice packages:

$ sudo apt-get purge libreoffice-*

remove orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer. Use this after removing a package which had installed dependencies you're no longer interested in:
$ sudo apt-get autoremove

see what packages are available to install matching a  pattern
$ apt-cache search <pattern>

To see all the files installed by a package like 
python-kivy-examples:
$ dpkg-query -L  <package name>


apt-get commands:

update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. An update should always be performed before an upgrade or dist-upgrade.


upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no
circumstances are currently installed packages removed, or
packages not already installed retrieved and installed. New
versions of currently installed packages that cannot be upgraded
without changing the install status of another package will be
left at their current version. An update must be performed first
so that apt-get knows that new versions of packages are available.

dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the general settings for individual packages.