Monday, August 1, 2011

OSX Lion

Library folder not visible, changed by the operating system.

Instructions to change this behavior
http://gregferro.com/osx-lion-library-folder-not-visible/

Open the Terminal and type:
chflags nohidden /Users/[username]/Library/

Wednesday, July 6, 2011

gitosis

osx how to install gitosis
http://sitaramc.github.com/gitolite/doc/1-INSTALL.html
back on the gitolite track

as root do the following:

root method

On your workstation:

copy your ~/.ssh/id_rsa.pub file to /tmp/YourName.pub on the server
On your server, as root:

git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
# defaults to being the same as:
# src/gl-system-install /usr/local/bin /usr/local/share/gitolite/conf /usr/local/share/gitolite/hooks

# to upgrade gitolite, repeat the above commands. Make sure you use the
# same arguments for the last command each time.

# create your "hosting user" if not already created
useradd git

su - git

# (now as git)
gl-setup /tmp/YourName.pub
On your workstation:

git clone git@server:gitolite-admin

Note: things to look for:

The git user has to have ssh login ability, you may have to turn that on in the GUI, system preferences --> Sharing remote access

had to add a file for the git user:
.bashrc

containing:
$ cat .bashrc
export PATH=:/usr/bin:/usr/local/bin:$PATH:
#export PATH=$(git --exec-path):$PATH

export GIT_EXEC_PATH=/usr/libexec/git-core

# get the path with $ git --exec-path





6July2011

needed help from this source too
http://www.justlogged.com/Question/1/5041067/4e549dc7aa65302b9e71c9941b815058/show

ran the following command (running google's binary install of git:
$ git --exec-path
/usr/libexec/git-core


my .bashrc file now looks like this

$ cat .bashrc
export PATH=:/usr/bin:/usr/local/bin:$PATH:
#export PATH=$(git --exec-path):$PATH

export GIT_EXEC_PATH=/usr/libexec/git-core


also important, I used the GUI in Snow Leopard 10.6.8 to create the git user. The git user is not an administrator, therefore they were blocked from ssh, I had to manually add them to the users who could ssh in system preferences sharing.


instructions that worked from this source
http://lukhnos.org/blog/en/archives/162

  1. create in system preferences a user git, make the user an admin for a short while, undo this later
  2. create a group git, and add the user to the group
  3. for convenience, I also created a gitosisadmin admin user. (why? was this needed? perhaps to avoid making the git user admin and then removing it requiring a reboot.)

  4. login as the gitosisadmin user and download gitosis.

    ssh -l gitosisadmin localhost
    $ which python
    /usr/bin/python
    $ which git
    /usr/bin/git
    $ pwd
    /Users/gitosisadmin


    $ git clone git://eagain.net/gitosis.git
    $ cd gitosis/
    $ sudo python setup.py install


  5. create key if you don't have one

    ssh-keygen -t rsa


  6. copy key to a temp location so git user can read it
    cp ~/.ssh/id_rsa.pub /tmp/my_key.pub

  7. $ sudo -H -u git gitosis-init < /tmp/eabolden.pub Initialized empty Git repository in /Users/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /Users/git/repositories/gitosis-admin.git/






  8. may need this:
    make sure post update hook is executable.

    sudo chmod 755 /Users/git/repositories/gitosis-admin.git/hookspost-update







  9. from a different account clone the admin repository

    $ git clone git@your.server.com:gitosis-admin.git
    Cloning into gitosis-admin...
    bash: gitosis-serve: command not found
    fatal: The remote end hung up unexpectedly



    tried reinstalling...
    saw this error:
    Searching for setuptools==0.6c12dev-r85381
    Reading http://pypi.python.org/simple/setuptools/
    Reading http://peak.telecommunity.com/snapshots/
    No local packages or download links found for setuptools==0.6c12dev-r85381
    error: Could not find suitable distribution for Requirement.parse('setuptools==0.6c12dev-r85381')


    used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools

    wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
    $ tar xfvz setuptools-0.6c11.tar.gz
    $ cd setuptools-0.6c11
    python setup.py build
    sudo python setup.py install






  10. Notes


    The following can be done with the osx gui

    list users and uid
    $ sudo dscl . list /Users kid
    list groups and group id
    $ sudo dscl . list groups did
    delete user username
    $ sudo dscl . -delete /Users/username
    delete group groupname
    $ sudo dscl . -delete /groups/groupname

    manually create group commandline
    sudo dscl . create groups/git
    sudo dscl . create groups/git did 401

    manually create user commandline
    sudo dscl . create users/git
    sudo dscl . create users/git uid 401
    sudo dscl . create users/git NFSHomeDirectory /Users/git
    sudo dscl . create users/git gid 401
    sudo dscl . create users/git UserShell /bin/bash
    sudo dscl . create users/git Password '*'

    create home directory
    sudo mkdir /Users/git
    sudo chown git /Users/git
    sudo chgrp git /Users/git






    ********************
    not sure if this next part is necessary

    $ cat .bashrc
    #export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:$PATH

    export PATH=/usr/local/bin:/usr/local/git/bin:$PATH

create in system preferences a user git, make the user an admin for a short while, undo this later create a group git, and add the user to the group for convenience, I also created a gitosisadmin admin user. login as the gitosisadmin user and download gitosis. ssh -l gitosisadmin localhost $ which python /usr/bin/python $ which git /usr/bin/git $ pwd /Users/gitosisadmin $ git clone git://eagain.net/gitosis.git $ cd gitosis/ $ sudo python setup.py install create key if you don't have one ssh-keygen -t rsa copy key to a temp location so git user can read it cp ~/.ssh/id_rsa.pub /tmp/my_key.pub $ sudo -H -u git gitosis-init < /tmp/eabolden.pub Initialized empty Git repository in /Users/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /Users/git/repositories/gitosis-admin.git/ make sure paths work correctly with remote connections $ echo "export PATH=$PATH" > ~/.bashrc add to the .bashrc file, export PATH=$(git --exec-path):$PATH it should look like: export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin export PATH=$(git --exec-path):$PATH make sure post update hook is executable. sudo chmod 755 /Users/git/repositories/gitosis-admin.git/hookspost-update from a different account clone the admin repository $ git clone git@your.server.com:gitosis-admin.git Cloning into gitosis-admin... bash: gitosis-serve: command not found fatal: The remote end hung up unexpectedly tried reinstalling... saw this error: Searching for setuptools==0.6c12dev-r85381 Reading http://pypi.python.org/simple/setuptools/ Reading http://peak.telecommunity.com/snapshots/ No local packages or download links found for setuptools==0.6c12dev-r85381 error: Could not find suitable distribution for Requirement.parse('setuptools==0.6c12dev-r85381') used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz $ tar xfvz setuptools-0.6c11.tar.gz $ cd setuptools-0.6c11 python setup.py build sudo python setup.py install wget wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010 tar xfvz setuptools-0.6c8.tar.gz cd setuptools-0.6c8 python setup.py build sudo python setup.py install OLD Tries side note, gitolite next try use from here: https://github.com/sitaramc/gitolite/blob/pu/doc/1-INSTALL.mkd sudo /usr/bin/python setup.py install had the following error: ImportError: No module named setup tools used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools wget wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010 tar xfvz setuptools-0.6c8.tar.gz cd setuptools-0.6c8 python setup.py build sudo python setup.py install Notes The following can be done with the osx gui list users and uid $ sudo dscl . list /Users kid list groups and group id $ sudo dscl . list groups did delete user username $ sudo dscl . -delete /Users/username delete group groupname $ sudo dscl . -delete /groups/groupname manually create group commandline sudo dscl . create groups/git sudo dscl . create groups/git did 401 manually create user commandline sudo dscl . create users/git sudo dscl . create users/git uid 401 sudo dscl . create users/git NFSHomeDirectory /Users/git sudo dscl . create users/git gid 401 sudo dscl . create users/git UserShell /bin/bash sudo dscl . create users/git Password '*' create home directory sudo mkdir /Users/git sudo chown git /Users/git sudo chgrp git /Users/git

installing Chilliproject offshoot of Redmine

I am hoping to link Chilliproject with gitosis to manage a git repository with web uploads of keys.

https://www.chiliproject.org/projects/chiliproject/wiki/Installation

needed to update to a specific version of rails

$ sudo gem update rails --version='2.3.12'


get a copy of ChiliProject

git clone git://github.com/chiliproject/chiliproject.git
cd chiliproject
git checkout stable


After getting the code, needed to install supporting gems using the following, after installing postgressql83 with macports, could have avoided some of this, by specifying I was not using postgressql.


$ sudo port install postgresql83
$ env ARCHFLAGS="-arch x86_64" bundle install


other notes:


$ sudo port install postgresql83

http://www.icoretech.org/2009/08/how-to-install-pg-postgresql-gem-on-snow-leopard-64-bit/
Install PostgreSQL from source/port for this, does not currently build against binary package.
PATH should be /usr/local/pgsql.

export PATH=/usr/local/pgsql/bin:${PATH}
env ARCHFLAGS="-arch x86_64" gem install pg
Or if you are using macports:

export PATH=/opt/local/lib/postgresql83/bin:${PATH}
env ARCHFLAGS="-arch x86_64" gem install pg


$ sudo gem install rmagick
Password:
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...
~ $ irb -rubygems -r RMagick
>> puts Magick::Long_version
This is RMagick 2.13.1 ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter
Built with ImageMagick 6.6.9-1 2011-05-07 Q16 http://www.imagemagick.org
Built for ruby 1.8.7
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org

$ rake db:migrate RAILS_ENV="production"

fix for generate session store problem.

$ rake generate_session_store


Monday, July 4, 2011

OS X print to PDF functionality

Print to a pdf file, going to a known location, acting as a default printer.


https://bitbucket.org/codepoet/cups-pdf-for-mac-os-x/downloads


Download and install this software:
https://bitbucket.org/codepoet/cups-pdf-for-mac-os-x/downloads/CUPS-PDF%202.5.0%20Installer.zip

Create a printer, selecting the cups pdf printer.

This works very well.

Thursday, June 23, 2011

gitolite - couldn't make it work with more than one person, switching to gitosis

I wanted github, but I need to keep my repository local, so I needed to roll my own. My last experiment with this used gitosis, but it looks like gitolite is a little more active now, and I hope has better documentation.

If you do something wrong and need to reinstal git.
https://github.com/sitaramc/gitolite/blob/pu/doc/1-INSTALL.mkd

uninstalling


cleaning out a botched install
When people have trouble installing gitolite, they often try to change a bunch of things manually on the server. This usually makes things worse ;-) so here's how to clean the slate.

client-side
edit ~/.ssh/config and delete the paragraph starting with host gitolite, if present.
remove ~/gitolite-admin
server-side
edit ~/.ssh/authorized_keys and delete all lines between # gitolite start and # gitolite end inclusive.
remove ~/.gitolite, ~/.gitolite.rc and ~/repositories/gitolite-admin.git

uninstalling gitolite completely
There's some duplication between this and the previous section, but uninstalling gitolite is described in great detail in doc/uninstall.mkd


I installed gitolite and then used bits from the following to configure and start using it.

Some References
upgrading to gitolite from gitosis

fix for error No refs in common and none specified doing nothing

I grabbed a copy of the admin repository

git clone ssh://git@SERVER:gitolite-admin


and I edited the file

gitolite-admin/conf/gitolite.conf

git status from within the gitolite-admin directory on my machine, showed the modifed file
git add .
git commit -m "added repo ericnotes"
git push

this modified the file, added the changes and committed them to the local git repo, then pushed them to my remote repository.


I added an ericnotes repository

repo gitolite-admin
RW+ = eabolden

repo testing
RW+ = @all

repo ericnotes
RW+ = eabolden


I then went to clone the new repository to give myself a local copy

git clone git@yourserveraddress:ericnotes


I them made some changes (added a file to the empty directory, git add ., then git commit -m "initial file commit" to save to local git repository

I then tried to push the file, and it failed, with a few different error messages.

the fix was to use the following.

git push --all



Repeat steps to practice again.

added the following to the gitolite.conf file
repo playarea
RW+ = eabolden

~/work $ cd gitolite-admin/
~/work/gitolite-admin(master) $ ls
conf keydir
~/work/gitolite-admin(master) $ git status
# On branch master
# Changes not staged for commit:
# (use "git add ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# modified: conf/gitolite.conf
#
no changes added to commit (use "git add" and/or "git commit -a")
~/work/gitolite-admin(master) $ git add .
~/work/gitolite-admin(master) $ git commit -m "added playarea repo"
[master 06adde2] added playarea repo
1 files changed, 3 insertions(+), 0 deletions(-)
~/work/gitolite-admin(master) $ git push
Warning: No xauth data; using fake authentication data for X11 forwarding.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 369 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: creating playarea...
remote: Initialized empty Git repository in /Users/git/repositories/playarea.git/
To git@yourserver:gitolite-admin
29e077c..06adde2 master -> master

$ git status
# On branch master
nothing to commit (working directory clean)

~/work $ git clone git@yourserver:playarea
Cloning into playarea...
Warning: No xauth data; using fake authentication data for X11 forwarding.
warning: You appear to have cloned an empty repository.
~/work $

$ touch testdoc.txt
~/work/playarea $ git add .
~/work/playarea $ git commit -m "initial commit"
[master (root-commit) 8a7328b] initial commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 testdoc.txt
~/work/playarea(master) $ git status
# On branch master
nothing to commit (working directory clean)
~/work/playarea(master) $ git push --all
Warning: No xauth data; using fake authentication data for X11 forwarding.
Counting objects: 3, done.
Writing objects: 100% (3/3), 214 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@yourserver:playarea
* [new branch] master -> master


Now things should be working as expected:


~/work/playarea(master) $ touch document2.txt
~/work/playarea(master) $ git add .
~/work/playarea(master) $ git commit -m "added second doc"
[master c8cf756] added second doc
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 document2.txt
~/work/playarea(master) $ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
~/work/playarea(master) $ git push
Warning: No xauth data; using fake authentication data for X11 forwarding.
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 246 bytes, done.
Total 2 (delta 0), reused 0 (delta 0)
To git@yourserver:playarea
8a7328b..c8cf756 master -> master
javascript:void(0)

Thursday, May 19, 2011

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.

How to get rid of the error message:


NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.


after doing a:

sudo gem update --system


I just ran the following manually,

gem -v 2>&1 |grep called


and then for each gem returned ran the command,


$ sudo gem pristine rcov -- -build-arg


The sudo part may not be required, I was using an upgraded basic install from Apple.

Example:

~ $ gem -v 2>&1 |grep called
Gem::Specification#has_rdoc= called from /Library/Ruby/Gems/1.8/specifications/actionmailer-2.3.5.gemspec:14.

$ sudo gem pristine actionmailer -- -build-arg
...
Restored actionmailer-3.0.7



#!/usr/bin/env bash
#

brew install gnu-sed
sudo gem pristine --all --no-extensions
gems=$(gem -v 2>&1 | grep called | gsed -r -e 's#^.*specifications/##' -e 's/-[0-9].*$//')

for gem in $gems
do
echo Fixing $gem...
sudo gem pristine $gem -- -build-arg
done


install a specific version of a gem

gem install rake --version=0.8.7


Thanks to the postings at:
http://stackoverflow.com/questions/5949521/how-do-i-fix-rubygems-recent-deprecation-warning

Friday, May 13, 2011

ebooks converting to epub format notes

Convert almost any document format to the epub format for reading on an iPad.

http://calibre-ebook.com/ Donation supported project. works


http://www.juliansmart.com/ecub#mac have not tested this one yet.

Sunday, February 13, 2011

old notes git

listing git branches.
git branch -a

20 Jan 2009
http://blog.kortina.net/post/71935540/fix-git-not-currently-on-any-branch-problem

Fix git “Not currently on any branch” Problem

This is quite geeky (goodies linked later :), but I want to post so I can find this fix later and because I didn’t see a whole lot of others posting about this problem, so others may find it useful as well.

I did a
git svn rebase
To update a local repo with changes from the master svn repository.

There was a conflict, and after resolving I ended up in the “Not currently on any branch” state.

To resolve,
git commit -a -m “commit merge with svn to head”
git checkout -b merged_with_svn
git checkout original_branch
git merge merged_with_svn

Hopefully someone else will find this useful. Otherwise, fear not—goodies!

Listen:
http://bit.ly/oMaria
http://bit.ly/ericsTrip


also, http://bit.ly/cheatGit

Thursday, January 20, 2011

Ruby Simple Statistics adding standard deviation

Ruby Simple Statistics - Standard Deviation





>> data
=> [1, 2, 3, 4, 5, 6]
>> data.class
=> Array


An array of numbers in ruby, (an Array object), can return the size/length, minimum (min) value, maximum (max) value. Missing methods are average, sample_variance, standard_deviation. These can added using an Enumerable module mixins.


Enumerable module mixins - add standard deviation to all arrays etc.


# Add methods to Enumerable, which makes them available to Array
module Enumerable

# sum of an array of numbers
def sum
return self.inject(0){|acc,i|acc +i}
end

# average of an array of numbers
def average
return self.sum/self.length.to_f
end

# variance of an array of numbers
def sample_variance
avg=self.average
sum=self.inject(0){|acc,i|acc +(i-avg)**2}
return(1/self.length.to_f*sum)
end

# standard deviation of an array of numbers
def standard_deviation
return Math.sqrt(self.sample_variance)
end

end # module Enumerable



Example Useage


# enter an interpreted ruby session to play with this:

$ irb
# create a new array called data with six numbers in it

>> data = [1, 2, 3, 4, 5, 6]
=> [1, 2, 3, 4, 5, 6]

>> data.class
=> Array

# try running the following commands. Some will work, some require the module from above.

>> data.sum
=> 21

>> data.size
=> 6

>> data.min
=> 1

>> data.max
=> 6

>> data.average
=> 3.5

>> data.sample_variance
=> 2.91666666666667

>> data.standard_deviation
=> 1.70782512765993



References

  1. ruby inject blogbackground on inject.
  2. see notes for mixins for Enumerable adding standard_deviation to Enumerable
  3. ruby core documentationSee Module Enumerable and Class Enumerable::Enumerator

mysql notes

reminders for some mysql tasks.

Dump a database to a file and compress it.

mysqldump -u root study_manager_development > study_manager_development.sql

gzip -v study_manager_development.sql


Select to outputfile

select id,sku, from line_items where sku LIKE '%u123%' into outfile '/tmp/u123.txt';

Saturday, January 8, 2011

OS X, iOS, MacOS X - PDF Documents in Teaching Annotations and Full Screen Viewing

in progress 8Jan2011...

Want to be able to teach from a PDF document, click on links in the document, add annotations while presenting, have the PDF displayed full-screen. I am looking at those options now.


  1. Preview - included with MacOS X, you can present a pdf document full-screen in slideshow mode. View --> Slideshow. Editing is not available in this mode.
  2. Skim - Presentation and full-screen menu options are available.
  3. PDF Studio
  4. PDFPen
  5. Keynote - You can't present and edit at the same time, However you can place and resize several different pdfs at the same time, adding highlights, building out a page and presenting full screen with different themes available.
  6. iOS iPad GoodReader is an option with a VGA cable.
Preview Menu:



Skim Menu: