Ken (Chanoch) Bloom's Blog

1st May 2006

DeSolaPool

This is Rabbi David de Sola Pool's formuation of the prayer for the State of Israel, found in the Sephardic Siddur he compiled. (This page contains shemot, so be careful with printouts).

מי שברך אבותינו, אברהם יצחק ויעקב משה ואהרן, ודוד ושלמה, הוא יברך את מדינת-ישראל את-שריה את-יועציה ואת-יושביה׃ מלך מלכי המלכים ברחמיו יתקנם בעצה טובה מלפניו׃ וישרה אל שוכני אדמת-הקדש, ריח דעת ויראת-יהוה׃ שם חסד ואמת יפגשו לכל-בני אדם כי מלה הארץ דעת את יהוה׃ ויקים בנו מקרא שכתוב ״כי מציון תצא תורה ודבר יהוה מירושלים״ וכן יהי רצון ונומר אמן

Permalink | torah.
21st May 2006

SelfCleaningResultSet

The SelfCleaningResultSet class is a proxy for JDBC that uses delegation to delgate to a ResultSet, but also calls close() on a Statement when the ResultSet is closed.

import java.lang.reflect.*;
import java.sql.ResultSet;
import java.sql.Statement;

public class SelfCleaningResultSet implements java.lang.reflect.InvocationHandler{
   private ResultSet rs;
   private Statement s;
   public static ResultSet wrap(ResultSet rs, Statement s){
      return (ResultSet) Proxy.newProxyInstance(
     rs.getClass().getClassLoader(),
     rs.getClass().getInterfaces(),
     new SelfCleaningResultSet(rs,s));
   }

   private SelfCleaningResultSet(ResultSet rs,Statement s){
      this.rs=rs;
      this.s=s;
   }

   public Object invoke(Object proxy, Method m, Object[] args) throws 
      Throwable{
        Object result;
        try {
            result = m.invoke(rs, args);
        if (m.getName().equals("close"))
           s.close();
        } catch (InvocationTargetException e) {
            throw e.getTargetException();
        } catch (Exception e) {
            throw new RuntimeException("unexpected invocation exception: " +
                                       e.getMessage());
        }
        return result;
   }
}
Permalink | java.
31st May 2006

AcmSigPaperSize

The ACM SIG documentclasses interact badly with the use of the geometry package for getting the paper size right. They also print very badly when in A4 papersize, sent to letter paper. To solve this problem, put this in your LaTeX preamble. (You should probably remove it before submitting the paper electronically to the conference)

\documentclass{sig-alternate}

%remove these lines before submitting
\usepackage{ifpdf}
\ifpdf
\setlength{\pdfpageheight}{11in}
\setlength{\pdfpagewidth}{8.5in}
\else
\special{papersize=8.5in,11in}
\fi

This handles both LaTeX with the dvips driver, and pdfLaTeX.

Permalink | linux.
My Website Archives

Tags