Quick Notes

To install Parallels Management Console for Linux, follow these instructions:

   1.

      Download the pmc-4.0.0-185.swsoft.i386.rpm RPM package.
   2.

      Install this package using following command

      # rpm -ihv pmc-4.0.0-185.swsoft.i386.rpm
   3.

      Run following command to launch Parallels Management Console from command prompt:

      # pmc
      or select Applications -> System Tools -> Parallels Management Console from KDE/Gnome menu

To install Virtuozzo Linux, follow these instructions:

   1. Download the file to a computer where you plan to install Virtuozzo.
   2. At the terminal, type:
      su
      Enter the root password.
   3. Change to the directory where the file was downloaded. Type:
      cd 
   4. Change the permission of the file you downloaded to be executable. Type:
      chmod a+x vzinstall-linux.bin
   5. Start the installation process. Type:
      ./vzinstall-linux.bin
   6. Follow the instructions on the screen.

Ruby MetaProgramming

    module Accessor
      def my_attr_accessor(name)
        ivar_name = "@#{name}"
        define_method(name) do
          instance_variable_get(ivar_name)
        end
        define_method("#{name}=") do |val|
          instance_variable_set(ivar_name, val)
        end
      end
    end
    
    class Example
      extend Accessor
      my_attr_accessor :var
    end
    
    ex = Example.new
    ex.var = 99
    puts ex.var

DJango Notes

##### No MySQLdb Module

After enabling MySQL in my Django **settings.py** file I was presented with this error;

    django.core.exceptions.ImproperlyConfigured: 
    Error loading MySQLdb module: No module named MySQLdb

A simple;

    python
    import MySQLdb

Proved I didn't have a MySQLdb module installed, which I can fix.

##### Find MySQL

Now before we do anything we need to add the MySQL path to our **.bash_profile** file

    mate .bash_profile
    
    export PATH=$PATH:/usr/local/mysql/bin

Save and reload Terminal.  

Run **which mysql** to find your MySQL install dir, you want the library location so if it gives you,

    which mysql
    >> /usr/local/mysql/bin/mysql
    ...use
    export PATH=$PATH:/usr/local/mysql/bin

...the **$PATH** bit basically appends this string to the end of your path parameters.

##### Download MySQLdb

Next download the module from [here](http://sourceforge.net/project/showfiles.php?group_id=22307) and extract it.

##### Edit the Source

Next 

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

##### Install the MySQLdb Module

Finally terminal into the module's directory and install MySQLdb;

    cd MySQL-python-1.2.2
    sudo python setup.py build
    sudo python setup.py install

Should go ok, confirm with **import MySQLdb** in a python console.

You should now be able to continue with your Django development.
VMWare Headless

  aptitude install linux-headers-`uname -r` psmisc libxrender1 libxt6 build-essential ia32-libs

  http://wiki.debian.org/VMware

  kernel upgrade

  apt-get update && apt-get install linux-headers-$(uname -r)
/usr/bin/vmware-config.pl
Forcing Firefox for Accept External Requests
-------------------------------------------------------------------

about:config

capability.policy.default.XMLHttpRequest.open
set to = allAccess

https://bugzilla.mozilla.org/show_bug.cgi?id=389508


So I couldn't simply set "capability.policy.default.XMLHttpRequest.open" to
allAccess since that allows not just cross-site requests, but also cross-site
access to the .open method, which is scary.
Git was specifically designed to do was be better at branching/merging than other source control systems

git vs svn comparison
http://git.or.cz/gitwiki/GitSvnComparsion
javascript:

document.images = identify all images on a page

typeof(document.images)=="undefined"

XHR = XMLHttpRequest
Restart Apache Natively on Leopard

sudo /usr/sbin/apachectl configtest
sudo /usr/sbin/apachectl restart

http://remysharp.com/2007/01/06/how-to-setup-your-mac-web-development-environment/#configure_apache
Restart Apache on Leopard

sudo /opt/local/apache2/bin/httpd -k stop
sudo /opt/local/apache2/bin/httpd -k start

sudo /opt/local/apache2/bin/httpd -k restart

$TTL 3600 <--- will set all entries subsequent to this line as having a 1 hour TTL.

$TTL 86400 <--- will set all entries subsequent to this line as having a 1 day TTL.
Terminal - Clear Terminal History

history -c
Ruby Inline

http://www.zenspider.com/ZSS/Products/RubyInline/

sudo gem install RubyInline

..for ImageScience
http://seattlerb.rubyforge.org/ImageScience.html
MacBook - remove odbc driver

sudo rm -r /Library/Receipts/MyODBC*
MacBook clear dns cache

dscacheutil -flushcache
Windows XP - check drive for errors

CHKDSK /r
OpenOffice - odt to word doc bullet points fix

I've had success using the Font Replacement Table, located in the Tools -> Options -> OpenOffice.org ->Fonts 
Enable "Apply replacement table", select "Symbol" in the lefthand FONT drop down, select "OpenSymbol" in the righthand "Replace with" dropdown. Press the checkmark to the right to add the substitution to the table. Make sure you check the Always box.

Once this is set up, opening and saving in MSWord 97/XP format preserves the bullet characters in both directions.

http://user.services.openoffice.org/en/forum/viewtopic.php?f=17&t=10846&st=0&sk=t&sd=a&sid=3cb16ce1ddfdcd229843dd0e090e73df&start=10
backspaces in screen thru osx generates - wuff wuff!

exit screen then add this to .bash_profile & .bashrc to your destination server

nano .bashrc
nano .bash_profile

alias screen='TERM=screen screen'

restart screen and you should be fine

http://htks.kylemilnes.com/2008/04/os-x-screen-wuff-wuff.html
python

..python on the mac
http://docs.python.org/using/mac.html

..python packages
http://pypi.python.org/pypi

..download python package

..install
python setup.py install

..run script
python script.py

..import package
import csv

find dir -exec touch -t yyyymmddhhmm {} \;

..remove file from git history

git filter-branch --index-filter 'git update-index --remove filename' HEAD
git commit -a
git push

http://github.com/guides/completely-remove-a-file-from-all-revisions
install sphinx

    sudo apt-get install build-essential libmysqlclient15-dev

    wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
    tar xvzf sphinx-0.9.8-rc2.tar.gz
    cd sphinx-0.9.8-rc2/
    ./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql

    make
    sudo make install

    script/plugin install  git://github.com/freelancing-god/thinking-sphinx.git
# add github to gem repos

gem sources -a http://gems.github.com
Install Memcached via ports (osx):

sudo port install libmemcached memcached

ruby gem:

sudo gem install memcache-client
require 'memcache'

# ruby checkout quiz solution

class Checkout
       
  def initialize(*args)
    @rules = args      
    @items = []
    
    @prices = Hash.new
    @prices["FR1"] = 3.11
    @prices["SR1"] = 5.00
    @prices["CF1"] = 11.23    
  end

  def scan(item)
    @items.push(item)
  end
  
  def check_sr1(items, prices)
    discount = 0
    tmp = items.select {|v| v =~ /SR1/}
    if tmp.count >= 3
      item_discount = prices["SR1"] - 4.50 
      discount = item_discount * tmp.count 
    end
    return discount
  end

  def check_fr1(items, prices)
    discount = 0
      items.group_by{|val| val}.each{|val, occurs| 
        discount += prices.fetch("#{val}") * (occurs.size / 2) if val == "FR1"          
      }
    return discount
  end  
  
  def total
    i = 0
    d = 0
    @items.sort
    
    #total up shopping cart
    @items.each do |item|
      i += @prices.fetch("#{item}")
    end
    
    #check for rules and apply discounts
    d += check_sr1(@items, @prices) if @rules.index('strawberry_discount') != nil
    d += check_fr1(@items, @prices) if @rules.index('buy_one_get_one_free') != nil

    #puts " discount applied #{d}\n"
    return i-d
  end
end

puts "Tesco Metro! \n\n"

ao = Checkout.new("buy_one_get_one_free", "strawberry_discount")
ao.scan('FR1')
ao.scan('SR1')
ao.scan('FR1')
ao.scan('FR1')
ao.scan('CF1')
price = ao.total
puts "Total : £" + price.to_s + "\n\n"

bo = Checkout.new("buy_one_get_one_free", "strawberry_discount")
bo.scan('FR1')
bo.scan('FR1')
price = bo.total
puts "Total : £" + price.to_s + "\n\n"

co = Checkout.new("buy_one_get_one_free", "strawberry_discount")
co.scan('SR1')
co.scan('SR1')
co.scan('FR1')
co.scan('SR1')
price = co.total
puts "Total : £" + price.to_s + "\n\n"
# ruby filter methods

class String
  def starts_with?(characters)
    self.match(/^#{characters}/) ? true : false
  end

  def is_empty?
    self.strip.length == 0 ? true : false
  end
end
Grab Rails TextMate bundle from GitHub

git clone git://github.com/drnic/ruby-on-rails-tmbundle.git 'ruby on rails.tmbundle'
Set MySQL ROOT password

mysql -u root

SELECT Host, User FROM mysql.user;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
MiniMagick + ImageMagick on Leopard

sudo port install imagemagick
sudo gem install mini_magick
Install MySQL Gem on Leopard

sudo su -
ARCHFLAGS='-arch i386' gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
# redirect one place to another
RewriteRule ^mypage$ /myredir [I,NC,R=302]

$ = used to signify end of url
R = redirect (302 permanent redir)
I = ignore lower/uppercase
NC = no continue
NetBeans - Create Macro

For this use-case follow these steps to create a macro:

1) make whatever selection, e.g. one word
2) Menu | Edit | Start Macro Recording
3) Ctrl-x (Cut)
4) Type "<%#", press Ctrl+v (paste), type "%>"
5) Menu | Edit | Stop Macro Recording
6) Set macro name and shortcut
(undo the changes if you want)

Now whenever you press the short cut when some text is selected it will be wrapped in <%# selected-text %>.
upgrade ubuntu to 8.10 via:
sudo update-manager -d
Step Into: means you will step through the code of the called procedure.

Step Over: means it will execute the called procedure, but you won't have to step through the code being executed.
Visual Studio Debugging
...run as administrator
...debug / attach to 'w3wp.exe'
Bluefish - linux css / html editor
Squid?
.htaccess
FileETags none
sunset clouds + stars linkable, link to other sites
woork
great north run 2009
Event.observe(div, 'load', function() { ... });

Ties in further code to current processes, without overwriting them.
fail2ban
deviantart
ie conditions, when all else fails
clouds shrink & glow, hills scalable circles
.strip <= trim whitespace

<% if cc == 3 -%>

use - to keep ifs on one line in processing, less time in execution
bind9 dnsutils
belstaff
.scroll(x,y);
.focus();
.scrollTo();

when inside iframe use
...parent.window.scroll(0,0);
...e.g. parent.window references the parent of the iframe
mysql
...alter table t alter column c set default null
.innerHTML returns / replaces content within ID's
render :text "55566"
cat
touch
ssh-keygen -t dsa
wget -i -o -nv
wget -r -m user@ip:[dir]
security
...remove or disable rsh, rcp, rexec, rlogin, irdist, telnet, ftp
...use scp, ssh, rsync, sftp
Google Web Toolkit
ECMAScript 4
jQuery ui theme roller
immutable class
logger.info 'hello'
a = 1
b = (a==1 ? true : false)
b = true
as button generator
72photos
function as(execAfter) {
  //do something
  execAfter();
}

as(run);
urlencode
magic toolbox ...flash image tools
start function names in lowercase => myFunc()
puppet
pastie
prototip
Gliffy (visio-like web app)
Dymaxion Chronofile (living time capsule)
Gus Hansen
Alberta
Alaska
Calgary
InterBet (betting software used at races)
Red text on white screen with black sillhoutes figures mountains (end titles to Mummy 3, good designs)
MonoDevelop
Aptana
Jaxer
chown -R [user]:[group] [dir]
chmod -R 755 [dir]
MetaCity theme ubuntu / gimp 2.6
Rimowa Attache Case Silver = £320
Hilburton Zero Case = £550
magicbox phone 39 pounds
MythTV
Via OpenBook laptop
gEdit refactor plugin
fonts
Affiliate Retailer Commission = ARC
.scrollTo();
mysql
...select Length(field) < 200
try {}
catch (e) {}
regexlib.com
roundedcornr.com
Array.join instead of str += value

VAR a = [];
a.push('as');
a.push('bb');
a.join('');

returns asbb
use === and !== instead of != and ==, compares both value & type
flop.hasOwnProperty('number') //true
typeof myobj == 'object'
Visual Studio
...shift+tab to minus indent
,..caps+tab to push out indent
python - django, pylons, turbogears frameworks
perl - catalyst framework
browser cookie limits 30 but no limit in safari
use .innerHTML instead of document.createElement
unless a.blank?
...negates a boolean condition
Elthom Palace
radio_button(:attribute, tag_value)
people.each do |person|
  person.name
end
whitefence.com