Monday, December 12, 2011

Build Mencoder from source on Debian Wheezy

su
apt-get install subversion
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

apt-get install build-essential
apt-get install git
apt-get build-dep mplayer

[install debian-multimedia]
apt-get install libfaac-dev

cd mplayer
./configure
    [press enter]
make
make install

mencoder -oac help

Friday, September 30, 2011

Setup Apache2 on Debian

Apache2 works great on Debian, but you need permissions set properly...

Add yourself to the www-data group.
sudo usermod -a -G www-data [username]
Change the group that owns /var/www/
sudo chgrp www-data /var/www/
Change the folder permissions

sudo chmod 2775 /var/www/

Friday, July 8, 2011

Debian Sudoer Group

Everybody wants to sudo.
Debian wants you to sudo.
It's just not as easy as it should be.

Here's the simple way to do it.
aptitude install sudo
usermod -G sudo <username>

Monday, May 9, 2011

Slimbox Previous Next Buttons Always On

I wanted Slimboxes Previous and Next Buttons to be always on, always visible, so people who haven't used lightbox style image displays can fully understand how things work.  Nobody had much worthwhile, so I had to dig in.

Turns out it's pretty easy.
Just replace the lbPrevLink and lbNextLink codes with the contents of the :hover and delete the :hover psuedo class.

#lbPrevLink {
left: 0;
background: transparent url(./slimbox/prevlabel.gif) no-repeat 0 15%;
}


#lbNextLink {
right: 0;
background: transparent url(./slimbox/nextlabel.gif) no-repeat 100% 15%;
}

Thursday, February 10, 2011

Making a New Remote Branch with Git

This works for me at work.  I can't guarantee it'll work for anybody who doesn't work with me.  We'll be creating a new branch called "new-feature."

First checkout the branch you want to branch from.
$ git checkout master

Make sure ever thing is updated (fix any problems that might happen here).
$ git pull

Check you are in the right branch (note the asterisks).
$ git branch
* master
  staging
Create new local branch
$ git branch new-feature

Checkout the new branch
$ git checkout new-feature

Double check you are in the right branch and the remote branches are good
$ git branch -a
* new-feature
  master
  staging
  origin/HEAD
  origin/master
  origin/staging
Push local branch to create remote branch
$ git push origin new-feature

Triple check your branches to make sure everything shows up as expected.
$ git branch -a
* new-feature
  master
  staging
  origin/HEAD
  origin/master
  origin/new-feature
  origin/staging

Other developers who might also want to use the new branch can now easily do so.  If they do git branch -a the new branch will show up on the list as a remote branch.  If they want to actively work with the branch they need to check it out to their local machine.
$ git checkout -tb new-feature origin/new-feature

Friday, January 21, 2011

Setting Up Tomcat and Eclipse in Ubuntu Tutorial

This had me scratching my head for several days, but I finally put all the pieces together. If you want to get around to building some JSP stuff in Tomcat using Eclipse on Ubuntu (or some other Linux) you might run into some problems like I did and just complete a simple Hello World tutorial. Here's the problems and the solutions.

Problem: You don't have an option to create a new "Dynamic Web Project"
Cause: You don't have the Web Tools Platform installed.
Solution: Download WTP.  If you already have Eclipse you can update installation here.

Problem: You are getting any slurry of errors about permissions or can't write or can't find or can't configure errors. They are all varied and confusing and difficult to google. So you probably won't find this page by looking for them.
Cause: You are using the default Tomcat installation from apt. This saves you from worrying about the installation, but it isn't setup the way Eclipse wants you to.
Solution: Run the commands found here. I've archived them incase the forum ever dies or changes drastically.

sudo apt-get install tomcat6
cd /usr/share/tomcat6
sudo ln -s /var/lib/tomcat6/conf conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat6 log
sudo chmod -R 777 /usr/share/tomcat6/conf

Problem: You get an error about port 8005 and 8080 already in use.
Cause: Tomcat is already running on those ports so they are of course in use.
Solution: Tell Eclipse to start it's Tomcat on a different port. Use the directions found here. I've archived the text incase the page ever dies or changes drastically.

Click on servers tab in eclipse and then double click on the server listed there
Then when the config page opens change the port by clicking on the numbers and typing over them

Problem: You are getting weird Java errors about objects not found or classes or something.
Cause: The Hello World you are attempting to run is way over your head.
Solution: Try something simpler to make sure your Tomcat and Eclipse setup is working properly.  The example from IBM is old but simple.  I'm not going to archive it for you.

Tuesday, January 4, 2011

Compiling Class Files to Java Files for Tomcat

I'm going through some tutorials and teaching myself some JSP Struts stuff from scratch.  I decided to go the classic route and just use whatever Debian Lenny includes in apt so I don't have to worry about new exciting features, just old reliable stuff.

One of the first things you'll need to do with JSP is compile your Class Files to a Java File so it can be properly loaded.  You can't run a JAVA file in Tomcat.  It just won't work.

I figured since I used apt to install all the goodies it would work perfectly so I tried to compile the first example java file from the tutorial I was following.

So I ran:
javac RegisterAction1.java

I got an error about servlet stuff not found.

import javax.servlet.http.*;
The import javax.servlet cannot be resolved

So I tracked down the servlet stuff jar file and ran:
javac -classpath /usr/share/tomcat5.5/common/lib/servlet-api.jar RegisterAction1.java


It fixed the servlet not found error, but now I got an error about org.apache stuff not found.


import org.apache.struts.action.*;
The import org.apache cannot be resolved


So I tracked down the struts stuff jar file and tried:
javac -classpath /usr/share/tomcat5.5/common/lib/servlet-api.jar:/usr/share/struts1.2/struts.jar RegisterAction1.java


Hooray! It Worked.

I'm not a sucker though, I don't want to have to add all that every time I want to compile a java file relating to Tomcat or Struts though.  So in Debian I just go track down and vim my /etc/profile file and add the text:

export CLASSPATH=.:/usr/share/tomcat5.5/common/lib/servlet-api.jar:/usr/share/struts1.2/struts.jar

(Right before the "umask 022")


Now when you log out and log back in, you can run:
javac RegisterAction1.java and it'll work perfectly!

Monday, January 3, 2011

Tomcat and Struts and Debian

I decided I need to learn some JSP to get back in the JAVA game.
Just for stability and old school cool, I'm using Debian Lenny and the Tomcat that it installs.
You can apt-get install tomcat5.5 and tomcat5.5-admin and tomcat5.5-webapps to get everything you need.
It installs struts 1.2 by default so you don't have to go looking.

The Tomcat Default folder is /usr/share/tomcat5.5/