my taglist settings and taglist hints

My tag list settings (variable changes must be changed in the file .vim/plugin/taglist.vim) :

  • To exit Vim when only the taglist window is opened, set the “Tlist_Exit_OnlyWindow” variable to 1.
  • By default, existing files in the tag list will not be updated unless the tag list is open.  Change “Tlist_Process_File_Always” to 1 if you want it to update all files even when the tag list is not open.
  • You can recursively add multiple files from a directory tree using the “:TlistAddFilesRecursive” command.  This command takes two arguments. The first argument specifies the directory from which to recursively add the files. The second oTheseptional argument specifies the wildcard matching pattern for selecting the files to add. The default pattern is * and all the files are added.  Add this as a shortcut to .vimrc to save time.
  • You can toggle the tag list with “:TlistToggle”.  At first, I thought that “:TlistOpen” which toggles the tag list AND place your cursor inside of it was more convenient, but if you set the “Tlist_GainFocus_On_ToggleOpen” variable to 1, you can get the same effect while retaining the ability to toggle it closed without having to create a new binding to toggle the list closed.
  • Setting “Tlist_Close_On_Select” to 1 will close the Tlist when you’re done with it.  This would be convenient if you have a low-res screen like me.  * After turning on the “Tlist_File_Fold_Auto_Close” setting on, I turned this setting off because they conflict in functionality.  ** After finding about how to close all the trees using ‘=’ I’m not sure how helpful this auto-close thing is…

Some cool hints:

  • When you’re in the taglist window and you want to jump to the tag in a new window, press the ‘o’ key.
  • You can press the ‘p’ key to jump to preview the file, but still keep the cursor in the taglist window itself.
  • Inside the tag list, <Tab> jumps to the next file, and <Backspace> jumps to the previous file.
  • Inside the tag list, ‘zc’ closes trees, and ‘zo’ opens trees.
  • ‘=’ closes ALL trees!
  • ‘x’ maximizes/minimizes the tag list window.

ruby/rails facts

ruby facts:

  • Everything is an object in Ruby–even nil. It just happens to be an object that represents nothing.
  • Hashes return nil when given a key that it doesn’t contain. This is normally useful because nil evaluates to false.
  • Only nil and false evaluate to false.
  • In Ruby, fields and methods are considered identical. This property is known as the Uniform Access Principle.
  • Underscores are ignored in the digit string, and can be used to improve the readability of large numbers.
  • Protected methods can be called by the same instance and by other instances of the class or sub-class.
  • Another way of expressing a double-quoted string literal is %{…}. This is supposedly convenient for use with long strings. Don’t ask me why.

rails facts:

  • rake db:migrate VERSION=0 rolls the database back to the beginning.
  • In order to make a class method, define the method in the model as: self.method
  • Rails keeps a primary key for all tables called id. This is so that your keyspace is completely disconnected from the outside world. You can change the primary key of your Active Record model; however you will still have to refer to the primary key as id whenever you set it. At all other times, you should refer to it as whatever name you set it to. This is really confusing, and will probably be taken care of later on (right?).
  • Rails does not support composite primary keys, but you can probably find support for them as a plugin.

use google to download mp3s

-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(wma|mp3) “search_string”

funny

setting up trac

I started off here: http://trac.edgewall.org/wiki/TracOnUbuntu

- For step 3, I needed to set up a virtualhost, so I did exactly that at everydns.net (host: trac.eugeek.com, value: ipaddress).

- After running into some trouble, I changed “SetEnv TRAC_ENV /var/trac” to “SetEnv TRAC_ENV /var/trac/project_name”.

    - Something was wrong because whenever I went to "http://servername/svn/YourProjectNameHere" I would get a 404 error, whereas: "http://servername/svn/" would show the branch, tags, and trunk.  After looking around, I came across this website: http://gentoo-wiki.com/HOWTO_Apache2_with_subversion_SVN_and_DAV and followed the instructions to change “SVNPath /var/svn/repos” into “SVNParentPath /var/svn”.  Everything was working at this point, and I added “SVNListParentPath on” for good measure.

    - Finally, install sqlite3 before running trac-admin, and let the database connection string should be “sqlite:db/trac.db”.  Wasted a few hours because I entered the wrong connection string!  It assumes you’re in the directory “/var/trac/” so it creates “/var/trac/db/trac.db” automatically.

    You’re done!

    css

    Cascading Style Sheets is a stylesheet language used to describe the presentation of a document written in a markup language.

    It facilitates the separation of content and how that content is presented (e.g. font, color, and layout).

    CSS information can be provided by various sources:

    • external stylesheets – a discrete stylesheet referenced by the document.
    • embedded style – a separate section within the document.
    • inline style – style information local to the element, specified with the “style” attribute.
    • user style – style information provided by the user that overrides all existing styles.
    • user agent style – the default (and often customizable) style applied by the user agent (such as a browser).

    CSS provides a priority scheme that gives conflicting styles different weights that can be used to decide which style to apply.  This is what is implied by the term, ‘cascading.’

    CSS Pros:

    • Reduces redundancy.
    • Results in smaller, easier-to-read files because the presentational markup is separated from the content.
    • Allows easier style modifications because the presentation of a whole document is held in one place.
    • Users can customize their viewing experience by providing their own CSS file.

    Installing Rails

    I followed the instructions from this site.

    The instructions are documented below just in case.
    1. Make sure the universe repository in /etc/apt/sources.list is uncommented:
    deb http://us.archive.ubuntu.com/ubuntu dapper universe
    deb-src http://us.archive.ubuntu.com/ubuntu dapper universe

    2. Make sure you are up to date:
    sudo apt-get update
    sudo apt-get dist-upgrade

    3. Install the ruby base packages:
    sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby

    4. We need to grab the latest ruby gems from rubyforge. You may need to modify this command if a version after 0.8.11 is available.
    sudo wget rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
    tar xzvf rubygems-0.8.11.tgz
    cd rubygems-0.8.11
    sudo ruby setup.rb

    5. Now let’s install Ruby on Rails!
    sudo gem install rails –include-dependencies

    6. We have Rails but we still need lighttpd and mysql. I’ve thrown in PHP too in case you want to manage your database with phpmyadmin like I do. Let’s grab all the packages, shall we?
    sudo apt-get install lighttpd php5-cgi php4-cgi php5-mysql php5-mysqli php4-mysql libfcgi-dev libfcgi-ruby1.8

    7. Modify your /etc/lighttpd/lighttpd.conf file to set up your domains. Be careful because by default Ubuntu maps all the images so that they are taken from /usr/share/images instead of your/rails/root/public/images so if you’re wondering why your rails app is working but your images aren’t being displayed this is why. You can take out the offending code in your lighttpd.conf or just put your images in /usr/share/images.

    8. Time to enable some modules for lighttpd. There are others that you may need but they should be enabled in your lighttpd.conf. Personally, I’m not a fan of enabling modules two different ways but I’m sure this will get cleaned up eventually.
    /usr/sbin/lighty-enable-mod fastcgi
    /usr/sbin/lighty-enable-mod proxy
    /etc/init.d/lighttpd force-reload

    9. Let’s make sure that there are no errors by stopping lighttpd and then starting it manually:
    sudo /etc/init.d/lighttpd stop
    sudo lighttpd -f /etc/lighttpd/lighttpd.conf

    If you have errors there make sure you take a look and try to address them! The output you see will be your best bet in getting help from somebody on one of the forums.

    10. Install some basic gems you might need to run your rails app:
    sudo gem install actionmailer
    sudo gem install activesupport
    sudo gem install actionpack
    sudo gem install actionwebservice

    And now you should have a new, shiny, ready to go Ubuntu Dapper Drake server just waiting for your PHP or Ruby on Rails applications!

    sql notes

    - The only difference between UNIQUE and PRIMARY KEY is that the former allows null values while the latter doesn't.

    inner classes in java

    Java bytecode has no concept of an inner class, so the compiler translates the inner class into an ordinary class that can be accessed by any class in the current package. Since inner classes are supposed to have full access, any fields that the inner class accesses in the container class that are marked private, are silently changed to protected. This is baaaad.

    I don’t really understand why, but this can be corrected by making the inner class private.

    the life of a translated program (in a nutshell)

    The compiler takes in source code and outputs assembly code.

    The assembler takes in assembly code and outputs object code.

    The linker takes one or more object code files, links them together, and outputs binary code.

    The loader loads binary code into memory and it gets executed.

    cool vim features

    guu
    make the whole line lowercase
    gUU
    make the whole line uppercase
    ‘.
    jump to the last line you edited
    ma
    creates a bookmark at the current position
    a
    jumps to the bookmark

    You can make as many bookmarks as you like!

    ga – gives you the ascii value of the char

    B – goes back one space-delimited word

    W – goes forward one space-delimted word

    z<return> – adjusts line to be at the top

    M – jumps to the middle of the visible file

    P – pastes above current line