Simple Emacs Mark Completed Function

October 23, 2008

I’ve been in the habit of keeping track of things in todo lists using Emacs’s outline-mode. This works great to organize things but I needed a better way to mark completed items. I have the files in source control so I could delete them and still know of them using a diff with a previous version but this is clumsy. Otherwise, I could mark items with a date or a DONE but this gets ugly. instead I have this simple emacs function that takes the current line as moves it to the bottom of the file with the date prepended.

Simple.

(defun mark-completed ()
"Move the current line to the bottom of the file and prepend the date."
(interactive)
(save-excursion
(progn
(move-beginning-of-line nil)
(kill-line 1)
(end-of-buffer)
(if (not (eq 0 (current-column)))
(newline))
(insert-date)
(insert " - ")
(yank))))

Continue reading →

Bash Function To Download A Web Site

October 23, 2008

Remembering all the options for wget is the reason for the following function. Add it your .bashrc and then run ‘wget-site URL’ and you’ll get a copy of the site locally for offline browsing

function wget-site {
wget -v -m -w 2 -p -E -k $1
}

Continue reading →

This Driver Is Not Configured For Integrated Authentication

October 22, 2008

Scenario:

You are trying to access a SQL Server database. It has been setup for integrated authentication. You know this because when you login via a tool like DBArtisan you don’t need to enter a user name or password. Authentication is through Windows itself.

Step 1:

You figure out that you need a specific JDBC url.

For example,

sqlserver.jdbc.url=jdbc:sqlserver://SERVERNAME;databaseName=DBNAME;integratedSecurity=true;

Step 2

You try this and get an error message like “This driver is not configured for integrated authentication.”

Solution:

  • Find the DLL
  • SQL Server

Continue reading →

Zipexception Error In Opening Zip File

October 21, 2008

Scenerio:

Using ant to call a taskdef that I created. It should log but needed to get the task to see my log4j.properties files.

In the path definition i put a pathelement who’s location pointed directly at the log4j.properties file. This causes the problem as it seems that Ant tries to open any file on the classpath that isn’t a jar.

Solution

Just put the directory where the log4j.properties file is located on the path definition.


Continue reading →

Problem With Ant And The Scp Task

October 20, 2008

Recently resurrected a project and updated the latest dependencies. When trying to release via the SCP task in Ant it just hung.

I found that the best combination of Ant and Jsch is for now (Oct 08) to be

Ant 1.7.0 and Jsch 0.1.29.

Remember to put Jsch’s jar file in ant’s lib directory.

To find Jsch 0.1.29 follow this link:

http://sourceforge.net/project/downloading.php?groupid=64920&usemirror=easynews&filename=jsch-0.1.29.jar&96256293


Continue reading →

Bash One-Liner To Unpack Directory Of Tar Gz Files

October 20, 2008

In the directory where you have a collection of tar.gz files.

for FILE in $(ls); do tar -zxvf $FILE; done

Continue reading →

Set The Comment Syntax For A File In Emacs

October 13, 2008

The other day I was editing a httpd.conf file and wanted to comment a large section. On the server I was using the comment syntax wasn’t setup for these types of files.

So, to quickly accomplish I just needed to set the comment-start variable to “#”.

For example,

M-: (setq comment-start "#") RET

Then with the block marked, a comment-region worked perfectly.


Continue reading →

Mail Contents Of File

October 13, 2008

A tip:

If you have a file ‘names.txt’ and want to mail the contents to yourself.

$ mail -s “My subject here” myself@foo.com < names.txt

Continue reading →

Congratulations You Could Survive For 60 Seconds

September 24, 2008

I could survive for 60 seconds chained to a bunk bed with a velociraptor


Continue reading →

Cure For Reddit Addiction

July 29, 2008

If you find that you are reading reddit far too much and need something to help you stop try the following.

  1. Install the Redirector Firefox plugin.

https://addons.mozilla.org/en-US/firefox/addon/5064

  1. Select Tools -> Redirector and set up a redirection as follows

Example URL: http://www.reddit.com/

Include Pattern: http://www.reddit.com/*

Redirect to: http://some-other-site.com

Wildcard selected

  1. Get back to work :-)

Continue reading →

Simple Log4j Properties File

July 8, 2008

log4j.debug=true

# Set root logger to DEBUG and add an appender called A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout
log4.appender.A1.layout-org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Continue reading →

Local Browseable Copy Of Sicp

June 13, 2008

Instructions

  1. create a directory where you want to download into
$ mkdir ~/sicp

$ cd ~/sicp
  1. Use wget to mirror the site to your local directory
wget -v -m -w 2 -p -E -k http://mitpress.mit.edu/sicp/full-text/book/book.html
  1. Load the following file in your browser
~/sicp/mitpress.mit.edu/sicp/full-text/book/book.html

Continue reading →

To Use Wget Through An Authenticating Proxy

June 11, 2008

Create an environment variable http_proxy using the following syntax

http_proxy=http://USER:PWD@PROXY-SERVER:PORT

Continue reading →

Full Cygwin Install

June 11, 2008

I am a big fan of cygwin and have been using it for years. If you’ve installed it and choosen the default install you’ll at some point run into a missing command and will have to run the setup program again. After a few iterations of this you’ll wonder about installing the whole thing. If you have the space it certainly makes your life easier in the long run.

A couple points to consider.

I just did a full install on a machine and it looks like cygwin has taken 3.21 gig of space.

Also, when you do install you should pick a time to just let it run. Also, it may take a few retries as you may have a “download incomplete” message after a time.


Continue reading →

Fix For Drscheme Under Windows Hang

June 18, 2007

After installing DrScheme and playing with it for a few minutes I was able to get it to hang with an error similar to the following error. standard-module-name-resolver: collection not found: “texpict” in any of: ()

=== context ===
cloop
temp1229
c:\program files\plt\collects\drscheme\private\rep.ss:1276:17

The fix is to go under C:\documents and settings\Your username\Application Data\PLT Sheme and remove the file pref.ss

If I figure out what I did to produce this file in such a state and post that as well.


Continue reading →