If you’re reading this post, then that means notsoevil.net has finished getting moved to a new server. I decided to go with Linode since I’ve been needing and wanting a little more horsepower from my web host than Dreamhost was providing, and as far as I can tell everyone who uses Linode loves them. So far everything has gone very smoothly. Anyhow, I do have some more changes planned for this site that will hopefully be available soon. More updates are coming soon!
I love Vim – 4 Tips when using Vim
I love Vim. It is my favorite text editor. In fact, there are times where it makes editing code a lot of fun. It is difficult to learn at first, but there are a ton of great resources to get you started. A few can be found at:
- Efficient Editing with Vim
- Vim Tutorial Videos – The author also has a pretty good Vim config to start with
- Vim Recipies
- Vim Tips Wiki – This has been the most useful to me after I got started, and I still check on it from time to time to learn new tips.
The first two links will help you get started moving around and editing within Vim. The other two will give you tips and hints to do common tasks quickly. Here are a few tips that I find myself constantly using these days when working. I also think these are good tips for people who are starting out with Vim.
1) Use the Wildmenu
set wildmenu
When this option is turned on the using tab for command-line completion will also display all the possible matches on your status line. You can then tab through those matches and select the one you are looking for. It can match on just about anything you can type as a command. For example type “:col” and hitting tab will display colder and colorscheme. Typing “:colorscheme a” and hitting tab will list all the colorschemes that start with a. This gets really handy when typing out long directory paths as it will list files and directories of the current path you are typing (and save you from having to type the entire thing out yourself).
2) Easily open files in the same directory
cabbr <expr> %% expand('%:p:h')
This will make %% expand to the current path of the file you are editing. This keeps you from having navigate the full path when the files you are editing are not in the current directory, but are in the same directory as each other. Take a look at the Vim Tips Wiki for more details about this.
3) Enable Ctrl-V and Ctrl-C for the clipboard
map <C-V> "+gP
cmap <C-V> <C-R>+
vnoremap <C-C> "+y
This makes it easy to cut and paste to and from Vim to other applications using the standard Ctrl-C and Ctrl-V shortcuts
4) Extensions to make life better
Mini Buffer Explorer – This extension will list your open buffers in a window for you allowing you to glance at the buffer number and ‘:b#’ to change the current file you’re editing. This extension alone has reduced my reliance on the mouse more than any other. Before I started using this extension I would open all of my files in tabs and use the mouse to switch to different tabs.
SuperTab – Autocomplete is about the only feature I would say that I miss from not using a “true” IDE. Fortunately this extension provides very similar functionality, and for my purposes it improves on it. Whenever you are typing a word/variable if you hit tab it will find the nearest match and/or display a list of possible completions. It quick, stays out of my way unless called upon, and does not require some crazy indexing/tracking of all files in my current project to work.
These are probably the most important things I use beyond the basic movements and commands already provided in Vim. Hopefully they will help out anyone who is new to Vim or for anyone looking on how to make Vim easier to work in.
Of introspection
At the beginning of the year I usually put off making resolutions or doing any real soul searching. Part of it is I am lazy and another part thinks none of it matters. This year is very different than any other I’ve known! I have a kid to whom I get to impart wisdom and character to. I began thinking about the things that are really important to me. Things that when I follow closely in my own life I am happier for, and the people around me are happier for it too. In particular things that if my daughter learns early will hopefully help her through the hardest parts of growing up and give her a happy childhood. So without further ado, here are 9 things that deeply resonate within me:
- No one can help you unless you are willing to help yourself. Along with this is that no one can love you if you cannot love yourself.
- You should strive to always be a net positive to other people. In all relationships strive to make the other person feel good.
- You are never all alone. There is always someone out there that understands exactly what you’re going through – they probably have a web page even…
- Respect is earned and you begin to earn respect for yourself by being respectful to others.
- Never under any circumstance make someone feel bad about being themselves. We need the world to feel less restrained when it comes to individual expression.
- It is okay to feel angry/sad/blah/other “negative” emotion – we’re made to feel these things. Sometimes it means everything is working correctly. It is not, however, okay to take these feelings out on someone else.
- You should accept every apology and act as if you’ve forgotten the offense. There are many times this rule does not apply, but if this is not a repeat offender and they’re not being willfully malicious towards you: forgive and forget. In other times try to stay out of situations where the person would have to apologize to you.
- There is no reason to ever stop playing, growing and making.
- Seeing a problem clearly will often times present the answer. Applying this clarity of thought in other aspects of life will keep you focused and always moving forward.
These are core beliefs and guidelines for me. They are also things I feel most people would agree are true. Personally all of these have been reaffirmed with the birth of Sera. I never want her to feel weird or embarrassed because she’s just being herself. I want her to be happy and feel free to be herself especially when she is at home. Anyhow I needed to write these out. It helps me to have a clearer understanding of who I want to be. Hope everyone has had a good start to the new year.
I like birds
It’s been another long break here in notsoevil.net land. However, this time I can happily admit that I’ve not been neglecting the place. I have been working on making this quiet place on the net a useful place to keep updated on new music. I realized earlier this year that I am very bad at keeping track of my favorite bands and their new releases. So I started to think about what could be done to fix this.
Naturally, I decided to try and make a website to take care of it for me. And I had a very simplistic mockup all done in php that actually seemed to work (for vague values of “work”). While I was goofing off on the parts I knew how to do, I started looking at frameworks to use for the site. It’s a simple site, so hopefully a framework would help greatly. Initially I looked at CakePHP, and while it looks like a great framework, I realized: I hate php syntax. It’s obnoxious at best. So I decided to go with python and Django. I’m still a long ways from being a python guru, and I have a feeling that a few places of my code are not very in sync with the “best practices” for python. However, it has been pretty easy going. I am very impressed with Django, and python is enjoyable enough I plan on doing some other projects to improve my skill with it.
Anyhow, I’m not trying to be secrative about the new site, but I don’t feel it is quite ready yet for more than just a few eyeballs looking at it. If you happen to be *really* interested, shoot me an email or IM, and I can send you to the right place. I am excited to get it done though. My goal is to get it going by the end of this month at the latest, so hopefully you’ll hear back from me soon.
ps Meet the Eels: Essential Eels 1996-2006 is a great cd!
Lighttpd and gitweb
I’ve begun playing around with git, and so far I’ve really liked it. I wanted a way to start sharing my repository and also be able to browse through it via a web browser. The answer turns out comes shipped with git: gitweb. It’s nothing fancy like gitorious or github but it is 100% functional and is exactly what I wanted. And since I know I’ll be setting this up again someday here’s what I did:
Assumptions: You run Lighttpd, you have a project you’ve been keeping track of with git, and you are not a grue.
First, grab the latest version of git and extract it, then run the following commands to install gitweb to your cgi-bin folder.
$ cd git-someVersion ;# as yourself
$ make prefix=/usr gitweb/gitweb.cgi ;# as yourself
# cp gitweb/git* /var/www/cgi-bin/ ;# as root
Next edit the /var/www/cgi-bin/gitweb.cgi file – basically I needed to change some paths to get the resources loading correctly. At around line 85:
#URI of stylesheets
our @stylesheets = ("gitweb.css")
our $logo = "git-logo.png"
our $favicon = "git-favicon.png"
Change these to be:
#URI of stylesheets
our @stylesheets = ("../gitweb.css")
our $logo = "../git-logo.png"
our $favicon = "../git-favicon.png"
There are other settings that you will probably want to change in this file such as $home_link_str, but they are not required for gitweb to function correctly. The cgi file is documented well enough to figure out what changes will do what. So next up is the lighttpd.conf:
Make sure cgi.assign is enabled and set to use perl:
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl" )
Next setup the redirects and aliases for gitweb (still editing in lighttpd.conf):
url.redirect += ( "^/gitweb$" => "/gitweb/" )
alias.url += (
"/gitweb.css" => "/var/www/cgi-bin/gitweb.css",
"/git-logo.png" => "/var/www/cgi-bin/git-logo.png",
"/git-favicon.png" => "/var/www/cgi-bin/git-favicon.png",
"/gitweb/" => "/var/www/cgi-bin/gitweb.cgi",
)
$HTTP["url"] =~ "^/gitweb/" { cgi.assign ("" => "") }
This will let you go to http://servername/gitweb and view your now empty code repository (be sure to restart the server first!). To populate this repository (or add a new project) do the following on the server:
cd /var/git
mkdir project_name.git
cd project_name.git
git init
Now you if you refresh your browser you should see one project, that has no commits and a description that says “Unnamed repository; edit this…”. To change the description edit .git/description from the project_name.git directory. Now there are two things left to do. Back on your development machine (the one with your local git project) we need to tell it that the project is stored on our server:
git remote add origin ssh://servername/var/git/project.git
And lastly, commit to the server:
git push origin master
Now your gitweb should have some files and revisions histories. You can also share your project with other developers now by pointing them to your webserver.