It'd be nice if this were a general purpose, helpful page on the Internet. I'd have information about various OSes, IDEs, languages, databases. That'd be nice but that's not this page. This page is specific to me, how I set up a development environment, what I like to use, how and where I use it. So if you use Emacs on a Mac to write Ruby code against your Postgres database, this is not your page.
Throughout this document if you see apt <something> it means you can
sudo apt-get install <something>. The links should also automatically
do the install if you're running Ubuntu.
- Ubuntu Linux
- Bash
- ssh
- Firefox
- MySQL
- DB Visualizer
- Generate Diagrams from the command line with SQL Fairy
- Tomcat Servlet Container
- Java
- Python
- Eclipse
- XPath Explorer
- SOAP UI
- VIM
- Maven
- Subversion
- Git
- Trac
- Meld
- txt2tags
Ubuntu Linux
Ubuntu is my preferred development operating system. Stuff just works and you have all the benefits of Linux.
Restricted Drivers
By default Ubuntu doesn't have support for formats that are in legal gray areas. I couldn't rip a (legal) audio CD to MP3s unless I got the restricted drivers.
Run Apps on Start-up or Shut down services you don't need
System -> Preferences -> Session -> Startup Programs
Desktop
Backgrounds
I like to use simple, small non-distracting backgrounds. No sense in having a nice picture because you should be covering up your screen with windows doing actual work. I went to stripe generator to create some simple ones. Here are a couple of patterns, the vertical is more slimming.
Fonts
Red Hat released some good fonts under the GPL. I use them for my consoles, vim, Eclipse, everywhere. https://www.redhat.com/promo/fonts/
Make them look better on LCD screens.
System -> Preferences -> Appearance -> Fonts -> Details -> Hinting None
Install a GDM theme
- find a GDM theme: http://www.gnome-look.org
System -> Administration -> Login Window- or apt gnome-themes-extras
Install a GTK theme
System -> Preferences -> Theme -> Install
Synaptic / APT
First thing after an Ubuntu install you should select a repository that is geographically
closer to you. This should be part of the setup in my opinion.
System -> Administration -> Synaptic -> Settings -> Repositories -> Ubuntu Software -> Download from
Open Office
Now you can get sweet 3D transitions for Open Office just like Keynote has. apt openoffice.org-ogltrans
Other
- gnochm can read compiled HTML (.chm): apt gnochm
- Hydrogen drum machine: apt hydrogen
- QIV command line image viewer: apt qiv
- Adobe Acrobat Reader
Bash
The Prompt
export PS1="____________________\n\t \h:\w>"
...gives me...
____________________ 12:27:16 m60e3:~/.vim/syntax>ls plan.vim txt2tags.vim
CDPATH
CDPATH allows you to go to any directory just like it were a directory in your current directory.
CDPATH='.:~:~/code' export CDPATH
Change Priority of a Running Process
-20 best, 19 worst
sudo renice -10 -p <pid>
FIGNORE
export FIGNORE='.svn'
webshare
Add this to your .bashrc to create a little on-demand web-server. This is great when you want to give someone access to a directory or file momentarily.
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
simpleproxy
A simple proxy for debugging requests/ responses. apt simpleproxy
simpleproxy -L <local port to listen on> -R <remote host>:<remote port> -t <log file to write to> -v
ssh
This is how you create a public key and send it to a remote server such that you don't have to send your password when you ssh or scp to the box.
Accept defaults for the filenames.
cd .ssh ssh-keygen -t rsa cp id_rsa.pub id_rsa_<local host>.pub scp id_rsa.pub <user>@<remote host>:~/.ssh/id_rsa_<local host>.pub ssh <user>@<remote host> cd .ssh cat id_rsa_<local host>.pub >> authorized_keys
Firefox
URL Shortcuts
If you have a page you frequently go to you can create a url shortcut to it.
For example, to get to my RSS feeds I don't have to type in
http://www.google.com/reader/view/, I can just type rss.
- create the bookmark
- Bookmarks
- right click your bookmark
- properties
- add the keyword
Plugins
- Poster for testing your ReST interfaces.
- Selenium
- Firebug
MySQL
MySQL is incredibly easy to work with. Compared to the proprietary databases it's a joy to work with. Compared to Postgres it's just better, albeit with fewer features.
If you're going to use mysql on the command line for any extended period of time
it's worth creating a ~/.my.cnf.
refer to.
[client] user = demian password = secret [mysql] database = my_db
Open up privileges to another computer:
mysql> grant all on <database>.* to '<user>'@'<ip address>' identified by '<password>'; Query OK, 0 rows affected (0.11 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
MySQL Query Browser is a great tool by the MySQL folks. It makes it real easy to try queries, look at tables, etc... To install on Ubuntu: apt mysql-query-browser
DB Visualizer
http://www.minq.se/products/dbvis/
DB Visualizer is a Java tool for visualizing your database. It ships with lots of JDBC drivers, including MySQL.
If you want to create a PDF of your graph.
- File -> Save As -> Specify whatever .gml file name you want
- start up yed (get it here: http://www.yworks.com/en/products_yed_about.html)
- File -> Import -> find the .gml file
- File -> Export -> specify the .pdf file name
Generate Diagrams from the command line with SQL Fairy
This is an alternative way to generate diagrams via a shell script. The layout managers that sqlt-graph uses don't scale as well as DB Visualizer if you have more than 20 tables or so this might not be usable for you. First you need to install SQL Fairy.
apt sqlfairy
Using SQL Fairy you could then create a graph (this is against MySQL).
#!/bin/sh mysqldump <database> --no-data > dump.sql sqlt-graph --show-datatypes --show-sizes --show-constraints --from=MySQL -o=db-graph.png dump.sql
Tomcat Servlet Container
Java
To install Sun Java5 on your Ubuntu box apt [sun-java5* apt:sun-java5*]
Since the man uses Macs then I'm kept back with Java 1.5.
fjar.sh is a script that's useful for finding jar files that contain a specific class. It saves my bacon every few months.
Python
Eclipse
Eclipse is my preferred Java IDE.
- To export your code formatting:
Preferences -> Java -> Code Style -> Formatter -> Edit (the active profile). -> Export - To import a code formatting:
Preferences -> Java -> Code Style -> Formatter -> Import - To check Build automatically, Refresh automatically, Save automatically before build
Window -> Preferences -> General -> Workspace - You can have Eclipse do lots of cool stuff for you whenever you save the current
file.
Window -> Preferences -> Java -> Editor -> Save Actions - To change the colors on the right side of the editor that point you to occurances
Window -> Preferences -> General -> Editors -> Text Editors -> Annotations - Use variables in Eclipse templates to make repetitive tasks fast.
Window -> Preferences -> Java -> Editor -> TemplatesThis template uses a field in the current scope, usually what you want to do.log.debug("${field}: " + ${field});
Spring IDE
If you're doing Spring development with Eclipse Spring IDE is very handy. Here's the install site
XPath Explorer
I'm no XML stud but XPath can be a convenient way to get data out of a hunk of XML. There are plug-ins for Eclipse but I like to dump plug-ins into Eclipse conservatively. This is something I rarely need but it's nice to have in your bag of tricks.
http://sourceforge.net/projects/xpe/
It's an executable jar: java -jar xpe.jar
SOAP UI
This comes in real handy for testing SOAP interfaces. Ideally you'd have unit tests for your entire API but if you want to quickly prove our your security and verify an installation of web-services, this is a good tool.
VIM
You love it or you hate it. It's not the prickly vi you used at the university. One of those tools you can use for 10 years and still learn something new about it.
- .vimrc configuration file, save to
~/.vimrc - plan.vim syntax file for my plan file
- txt2tags.vim syntax file for txt2tags
Here's how I set my color scheme:
demian@shiv:/usr/share/vim/vim71/plugin$ cat setColorscheme.vim colorscheme default
apt vim
Planning
I use Vim to maintain a big honking .plan file. It tracks what tasks I'm doing, what gets done, when, etc... It works great with vanilla Vim but I wrote a quick Vim syntax file that makes it easy to tell what status tasks are in.
Here's the full write-up I did on how to install and use the syntax file: Life in a Text File
Wrangling with VIM & Python
I wrote some Python code to do some handy things in VIM. In vim you can select a portion of your buffer, send it out to an external program and replace that with the output of the program.
To use any of these you have to put the Python scripts in your path. Then you need to add an entry in your .vimrc file so that the Python code maps to a key combination. When you actually need to use it, you have to visually select text to send to your buffer.
Here's how you visually select a portion of your buffer.
<esc><ctrl>-v- navigate around drawing the box around the text you want
- then type in the key you've associated with the command you want (for example
M)
multiply.py
This is kinda cool, I haven't seen it anywhere else. Basically you set up a quick template and other text that you have in a tabular format. When you have this in place you can use this to multiply your code. For example you might get a dump of the attributes in a database table, you could use this to generate setters and getters for a bean.
Put this Python script in your path. multiply.py
Add this to your .vimrc.: map M :!multiply.py<cr>
Set up your data with @ symbols in front. The rest of the selected text is your template.
@ String FirstName 'first name of the user'
@ Long Height 'height (in inches)'
@ String LastName 'surname'
@ int Age 'age (in moon cycles)'
/**
* @param a@2: @3
* */
public set@2(@1 a@2)
{
m@2 = a@2;
}
/**
* @return @2: @3
* */
public @1 get@2()
{
return m@2;
}
lineUp.py
This lines up text in columns. Makes some code easier to read to me. lineUp.py
Add this to your .vimrc. map L :!lineUp.py<cr>
a2s.py
All the words that are in camelCase are turned into SCHEMA_FRIENDLY. The a stands for attribute as in Java attribute.
Add this to your .vimrc. map S :!a2s.py<cr>
s2a.py
All the words that are SCHEMA_FRIENDLY are turned into camelCase.
Add this to your .vimrc. map A :!s2a.py<cr>
Maven
I'm a long time Ant user. If you're coming from that world maven will suck for about 6 hours of heavy use. After that it'll be your new best friend.
Maven can be a chore to initially set up correctly. Archetypes create new project layouts. You can get archetype information here
Once you know the archetype you want to use you just run something like this to create the new project.
mvn archetype:create \
-DgroupId=com.neidetcher \
-DartifactId=javasandbox \
-DarchetypeArtifactId=maven-archetype-quickstart
The other alternative is to use ``mvn archetype:generate ``, this walks you through what you want.
Some common maven commands:
mvn clean mvn test mvn compile mvn site # create one of those cool maven freebie sites mvn eclipse:eclipse # create an eclipse project from this maven pom mvn eclipse:eclipse -DdownloadSources=true # download source too mvn -Dmaven.test.skip=true site # skip tests and create the site mvn install # install this project into the local maven repo for other projects
To pass JVM arguments set an environment variable.
export MAVEN_OPTS=-Xmx1024m
Subversion
Doesn't pass muster with Linus Torvalds but it's my favorite.
svn checkout <url to repository>/svn/trunk/ <local dir name> cd <local dir name> svn update svn status svn diff pom.xml svn log pom.xml
Adding this to your ~/.subversion/config seems to work well for maven projects
and an Eclipse IDE. So when you check status and other commands, log files are
ignored as well as the target directory. It's a minor thing but it cuts down on
the noise when you're trying to figure out what you need to check in.
global-ignores = *.classpath *.project target *.jdt.core.prefs *.log
Git
Just learning git right now.
git status # nice summary of the state of your repo git add <file or directory> # have to explicitly add your changes git commit # LOCALLY commit the stuff you just 'added' git push origin master # push your changes up to server
Trac
Trac is has integrated ticketing, wiki and a convenient front end to version control. I didn't use the ticketing capability but I can say that the wiki and version control view is great.
Meld
Meld is a GUI diff tool. It's also smart enough to know if you're diffing a subversion file it'll compare it to what's in the repository. apt meld
txt2tags
http://txt2tags.sourceforge.net/
txt2tags lets you write in a friendly, ASCII, wiki-ish syntax. Then you can export it to various formats.
I put this site together with a collection of txt2tags, m4 and make. Sounds like some odd technologies but it works out incredibly well. There's good separation of concerns; when I write I don't have to think about formatting. Deploying it all is a breeze, it's all automated inside of a makefile.
I did a write-up on this.
It's amusing how things have gone full circle. There is a recent trend for writers to use a terminal like program, to remove all the distractions of full-blown word processors. When I write for this website, none of it is WYSIWYG. Formatting is an after thought; as it should be.