June 30, 2004

June 25, 2004

June 16, 2004

Joel has a good article on the demise of the win32 api

Here is proof that Win32 programming sucks the life out of developers.

June 14, 2004

JCA Links

http://jboss.org/index.html?module=bb&op=viewforum&f=136 http://www.onjava.com/pub/a/onjava/2004/03/24/j2eeca.html https://www6.software.ibm.com/developerworks/education/j-jca/j-jca-ltr.pdf OR https://www6.software.ibm.com/developerworks/education/j-jca/index.html?x=71&y=11 http://www.java201.com/resources/redirect/1625.html http://jboss.org/index.html?module=bb&op=viewtopic&t=19732 http://jboss.org/index.html?module=bb&op=viewtopic&t=46930

JBoss Performance Links

http://dev.simblogg.is/archives/cat_jboss.html http://jboss.org/index.html?module=bb&op=viewforum&f=121&topicDays=0&start=0 http://linuxintegrators.com/jbossBlog/bburke/?permalink=Optimizing+JBoss%3A+Experiences+with+SPECj2002.html http://www.javablogs.com/ViewEntry.jspa?id=88770 http://www.myj2ee.com/Members/Firedragon/jbosstuning

June 03, 2004

// Slashdot Your Printer

// Sends an rss feed to the lcd on your printer

package com.mike;

import java.net.*;
import java.io.*;
import java.util.*;

/**
 *
 */
public class PrinterNews {
    static String rss=/*"http://slashdot.org/index.rss";//*/"http://rss.news.yahoo.com/rss/topstories";
    static String printer="";
    static int updateFrequency=30*1000*60;
    static int scrollDelay=300;//ms
    static String msg="";
    static String blank="                ";
    static OutputStream out;
    static ArrayList headlines;
    static boolean nice=true;//otherwise, it locks the printer

    public static void main(String[] args){
        try{
            if(!init(args))
                return;
            readHeadlines();
            connect();
            long startTime=new Date().getTime();
            while(true){
                scroll();
                if(new Date().getTime()-startTime>updateFrequency){
                    readHeadlines();
                    startTime=new Date().getTime();
                }
            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    public static boolean init(String[] args){
        if(args.length < 2){
            usage();
                return false;
        }
        for(int i=0; i<args.length; i=i+2){
            System.out.println("param "+i+" ="+args[i]);
            String parm=args[i];
            if(!parm.startsWith("-") || parm.length()!=2){
                usage();
                return false;
            }
            switch(parm.charAt(1)){
                case 'p':
                    printer=args[i+1];
                    System.out.println("set printer to "+printer);
                    break;
                case 'u':
                    rss=args[i+1];
                    System.out.println("set rss to "+rss);
                    break;
                case 'f':
                    try{
                        updateFrequency=Integer.parseInt(args[i+1])*1000*60;
                        System.out.println("set frequency to "+updateFrequency);
                    }catch(Exception e){
                        usage();
                        return false;
                    }
                case 'd':
                    try{
                        scrollDelay=Integer.parseInt(args[i+1]);
                        System.out.println("set delay to "+scrollDelay);
                        break;
                    }catch(Exception e){
                        usage();
                        return false;
                    }
                default:
                    usage();
                    return false;
            }
        }

        return true;
    }

    public static void usage(){
        System.out.println("\nUsage:\n");
        System.out.println("java com.mike.PrinterNews -p printer");
        System.out.println("                         [-u rss_url]             url of rss feed");
        System.out.println("                         [-f rssUpdateFrequency]  minutes between rss refresh");
        System.out.println("                         [-d scrollDelayMS]       ms between lcd update");
        System.out.println("defaults to -u http://rss.news.yahoo.com/rss/topstories -f 30 -d 300");
        System.out.println("NOTE: slashdot will blacklist you for -f<30 !\n");
    }

    public static void connect() throws Exception{
        Socket s = new Socket(printer, 9100);
        out =s.getOutputStream();
    }

    public static void scroll() throws Exception{
        for(Iterator it=headlines.iterator(); it.hasNext();){
            sendMsg((String)(it.next()));
            if(nice){
                out.flush();
                out.close();
                Thread.sleep(1000);
                connect();
            }
        }
    }

    public static void sendMsg(String msg) throws Exception{
        msg=blank+msg+blank;
        //OPMSG, RDYMSG, STMSG
        for(int i=0; i<msg.length(); i++){
            byte[] b;
            if(msg.length()> i +15){
                b=msg.substring(i, i+15).getBytes();
            }else{
                b=msg.substring(i).getBytes();
            }
            out.write("\033%-12345X@PJL RDYMSG DISPLAY = \"".getBytes());
            out.write(b);
            out.write("\"\r\n\033%-12345X\r\n".getBytes());
            Thread.sleep(scrollDelay);
        }
    }

    public static void readHeadlines() throws Exception{
        headlines= new ArrayList();
        BufferedReader i = new BufferedReader(new InputStreamReader(new URL(rss).openStream()));
        while(true){
            String nextLine=i.readLine();
            if(nextLine==null)
                break;
            int start=nextLine.toLowerCase().indexOf("<description>");//<title>
            if(start!=-1)
                headlines.add(scrub(nextLine.substring(start+13, nextLine.indexOf("</")>start+13?nextLine.indexOf("</"):nextLine.length()))); //+7
        }
    }

    private static String scrub(String s) throws Exception{
        int start=s.indexOf("&");
        int end=s.indexOf(";",start>0?start:0);
        if(start!= -1 && end != -1)
            return scrub(s.substring(0, start) +s.substring(end+1));
        else
            return s;
    }
}

May 18, 2004

Some Fedora Issues: NVidia driver issues. dual boot issues.

This is a really good article about a guy studying virtual economies in muds

May 06, 2004

This is the first article in a series of 12 on the theory of classification. An excellent read for anyone interested in object oriented design.

April 15, 2004

I don't know why I couldn't find one out there, but anyway... pipe a find to it to operate over a directory structure: #!/bin/bash fname=start count=0 total=0 echo "getfile" while [ "$fname" != "" ] do read fname if [ -f $fname ] then count=`grep -v --count xyzzy $fname` echo "$fname = $count" let "total=total + count" fi done echo "total= $total"

March 23, 2004

IntelliJ gets hosed on Fedora, and other 2.6 kernels: If you add jar files to a project, they appear to imported correctly, but then aren't visible, and browsing through them in the package explorer shows unnamed classes. Workaround: Close IntelliJ Edit your idea.lax in the bin directory, find the lax.nl.java.option.additional property, and append -Didea.jars.nocopy=true to the end of arguement list. Then delete the contents of $intellij/system/jars and $intellij/system/caches Restart, and you may need to recreate your project.

March 19, 2004

This is a really cool post about 80's vinyl with computer games encoded.

March 01, 2004

Cheapest DVD rewinder

Every cell tower in america

NYTimes, February 27, 2004 For Exercise in New York Futility, Push Button By MICHAEL LUO or years, at thousands of New York City intersections, well-worn push buttons have offered harried walkers a rare promise of control over their pedestrian lives. The signs mounted above explained their purpose: To Cross Street Push Button Wait for Walk Signal Dept. of Transportation Millions of dutiful city residents and tourists have pushed them over the years, thinking it would help speed them in their journeys. Many trusting souls might have believed they actually worked. Others, more cynical, might have suspected they were broken but pushed anyway, out of habit, or in the off chance they might bring a walk sign more quickly. As it turns out, the cynics were right. The city deactivated most of the pedestrian buttons long ago with the emergence of computer-controlled traffic signals, even as an unwitting public continued to push on, according to city Department of Transportation officials. More than 2,500 of the 3,250 walk buttons that still exist function essentially as mechanical placebos, city figures show. Any benefit from them is only imagined. "I always push," said Réna, an employee at Long Island College Hospital in Cobble Hill, Brooklyn, who was too embarrassed to give her last name after she pushed a button on Atlantic Avenue and was told the truth. "The sign says push, so I push. I think it works." Most of the buttons scattered through the city, mainly outside of Manhattan, are relics of the 1970's, before computers began tightly choreographing traffic signal patterns on major arteries. They were installed at a time when traffic was much lighter, said Michael Primeggia, deputy commissioner of traffic operations for the city's Transportation Department. The first "semi-actuated signal," as they are called by traffic engineers, is believed to have appeared in the city in 1964, a brainstorm of the legendary traffic commissioner, Henry Barnes, the inventor of the "Barnes Dance," the traffic system that stops all vehicles in the intersection and allows pedestrians to cross in every direction at the same time. Barnes was also instrumental in completing the one-way conversion of major avenues in New York. Typically, they were positioned at intersections of a major thoroughfare and a minor street. The major road would have a green light until someone pressed the button or a sensor in the roadway detected a car on the minor street. Then, after 90 seconds or so, the light would change. The goal, Mr. Primeggia said, was to make traffic flow on the major artery more efficient. The buttons made sense when traffic was generally minimal on the minor street. But as traffic grew steadily, their existence became imperiled. In 1975, about 750,000 cars entered Manhattan daily; this past holiday season, there were more than 1.1 million. The other boroughs have gone through similar growth, Mr. Primeggia said. As even minor streets became congested, the need for the semi-actuated signal largely disappeared, because they were constantly being tripped anyway by cars rolling up to the intersection. Many walk buttons also interfered with the computer-programmed coordination of lights that is now the rule in the city to facilitate traffic flow. By the late 1980's, most of the buttons had been deactivated, their steel exteriors masking the lie within. But city officials say they do not remember ever publishing an obituary, and the white and black signs stayed up, many of them looking as new and official as ever. "I don't always push, but I do it in the off-chance that I might save two seconds," said Joanne Downes, 63, a retired nursing professor, after pushing a broken button to cross the West Side Highway from Chelsea Piers on West 23rd Street yesterday morning. "I have guessed that they don't work, but why are they there?" There are 750 locations where the buttons actually do work, Mr. Primeggia said. Some of them have been installed more recently, while others are holdovers from two decades ago. The working buttons are only at intersections where the walk signal will never come unless the button is pushed or a car trips the sensor, Mr. Primeggia said. He cited two examples, one at Hicks and Summitt Streets in Brooklyn and the other on Flatbush Avenue just south of the Belt Parkway exit ramp. But other working push buttons are hard to find. A random survey of more than 30 intersections in Brooklyn, Queens and Manhattan found one, at Marathon Parkway and 51st Avenue in Little Neck, Queens, that worked. At $300 or $400 per intersection, it would cost about $1 million to remove the disconnected mechanisms, Mr. Primeggia said. About 500 have been removed during the course of major reconstruction projects. But city officials over the years decided it was not worth the cost for the rest, given other needs like rebuilding roads or installing new traffic signals. "We think of this from time to time," Mr. Primeggia said. "But there's always a better need for the money." And in the bigger scheme of things, he said, it doesn't really matter if people push a working button. "The public is going to get the walk signal regardless," he said. "I guess that's the point. There's no harm in having it at the locations." Many veteran New Yorkers have long learned to ignore them. They have never made sense, said Maryam Ceesay, 24, standing at a downtown Brooklyn push-button intersection. If pedestrians could simply push them and always get a walk signal, "cars would never cross," she said. "Traffic would stop." But Ms. Ceesay was at that moment baby-sitting 4-year-old Benjamin Miles. Despite his baby-sitter's explanations that the buttons "never work," Benjamin still pushed away at the intersection of Atlantic Avenue and Henry Street. Why? His explanation may be the best reason for the continued existence of the buttons. "Because," he said, "it's fun."

Utah actually got one right.