Work Laptop
At my old job, we had to beg to get an old laptop to trade among the 3 of us who were on-call. That way we could VPN into the system from home to fix any problems. Occasionally the on-call person wouldn’t be available and one of the others would have to drive into work (usually at 4 AM) to fix the problem.
At my new job, I’ve been given a laptop. A brand new high-end laptop. With all sorts of expensive development tools that I might not even need. And, of course, a leather laptop bag. (It’s the little things, you know.)
Last Day
Today I developed the framework for a caching mechanism that I’ll never see to completion. I hope it works.
Today I deleted every last byte of personal data from my computer.
Today I met with an HR representative and explained why I’m leaving. I had to re-affirm (with a signature) my contract to keep company secrets in confidence. And I had to promise to give my security badge to my manager before I left.
Today I left all the company logo-emblazened trinkets I’ve accumulated on a shelf in my cubicle. The next occupant won’t know what to do with them either.
Today I dusted a part of my desk I haven’t seen in years.
Today I realized that my filing cabinet has never been used.
Today I stocked my cubicle with an unopened box of Kleenex. Nobody wants a half-used box.
Today was a long day.
Secret Verifiable Dated Information
I’ve been puzzling over how a person could prove that he had certain information at some date in the past, without publishing it until later. In the movie Quiz Show, one of the contestants sent the answers to himself in registered mail to be able to later prove that the show had been rigged. (This really happened.) That seems like a fairly clever way, assuming the USPS is rigorous in ensuring that the mail is sealed. I wonder whether it would be possible to send an envelope with registered mail and then insert a paper after it was received.
What other way is there to prove that information existed at a certain time in the past? It seems like you’d have to have some trusted authority for dating information. The postmark date is the authority in the above example. How about data encrypted with pgp and cached by The Internet Archive? Any other suggestions?
Swing Example
Nearly a year ago, I posted some ideas for best practices for swing I neglected to add any examples, but today someone finally asked for one. So I threw together an example of a dialog window that uses composition rather than inheritance. Whew — there sure is a lot of boilerplate code just to get a simple dialog!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SampleDialog {
private JFrame parentFrame;
private JDialog dialog;
private JTextField field;
private JButton okButton;
private JButton cancelButton;
public SampleDialog(JFrame parentFrame) {
this.parentFrame = parentFrame;
}
private void init() {
this.field = new JTextField();
this.okButton = new JButton("OK");
this.okButton.addActionListener(new OkButtonListener());
this.cancelButton = new JButton("Cancel");
this.cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
close();
}
});
this.dialog = new JDialog(this.parentFrame, "Sample", true);
this.dialog.getContentPane().add(createPane());
this.dialog.getRootPane().setDefaultButton(this.okButton);
setEscapeKeyMap();
this.dialog.pack();
this.dialog.setLocationRelativeTo(this.parentFrame);
}
private Container createPane() {
JPanel topPanel = new JPanel(new FlowLayout());
topPanel.add(new Label("Something"));
topPanel.add(this.field);
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.LINE_AXIS));
bottomPanel.add(Box.createHorizontalGlue());
bottomPanel.add(this.okButton);
bottomPanel.add(Box.createRigidArea(new Dimension(10, 0)));
bottomPanel.add(this.cancelButton);
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(9,9,9,9));
mainPanel.add(topPanel, BorderLayout.CENTER);
mainPanel.add(bottomPanel, BorderLayout.PAGE_END);
return mainPanel;
}
private void setEscapeKeyMap(){
String CANCEL_ACTION_KEY = "CANCEL_ACTION_KEY";
int noModifiers = 0;
KeyStroke escapeKey = KeyStroke.getKeyStroke(
KeyEvent.VK_ESCAPE, noModifiers, false);
InputMap inputMap = this.dialog.getRootPane().getInputMap(
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(escapeKey, CANCEL_ACTION_KEY);
AbstractAction cancelAction = new AbstractAction(){
public void actionPerformed(ActionEvent e){
close();
}
};
this.dialog.getRootPane().getActionMap().put(
CANCEL_ACTION_KEY, cancelAction);
}
public void show() {
if (this.dialog == null) {
init();
}
this.field.setText("Initial value");
this.dialog.show();
}
private void close() {
this.dialog.hide();
}
private class OkButtonListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
// Do work
close();
}
}
}
How Not to Cook Popcorn
Tara bought some popcorn, and I decided to try to make a batch. Everyone else was upstairs; Tara was reading and the kids were sleeping. I’ve never made popcorn on a stovetop before. I read the instructions on the bag:
Put 1/4 cup of vegetable oil in a pan on medium-high heat.
Add one kernel.
Cover.
Wait for it to pop.
Add the rest. (I’m paraphrasing here.)
So, I put in the oil and the kernel and waited. Well, I know that microwave popcorn can take a while to start popping, so I went to the study to work on the computer.
After a while, it dawned on me that I hadn’t heard that pop yet. I returned to the kitchen. The pot has a clear top, but I couldn’t see in it very well, so I started to lift the lid. Ah! I quickly replaced the lid. I couldn’t see in it well because it was filled with smoke. I turned off the burner and considered how to prevent setting off the smoke alarm.
The first thing that popped into my head (no pun intended) was that I should let the smoke out outside. Note to self: don’t always do the first thing that pops into your head. It was cold and snowy out, so I opened the storm door a crack, held the pot outside, and lifted off the lid. Being safety-conscious, and recalling my 7th grade Home Economics class, I tilted the lid away from my face.
Let’s pause here and talk a little bit about basic chemistry. Does anyone remember what is required for oxidation (aka combustion)? How about heat (smoking ember), fuel (1/4 cup vegetable oil) and oxygen? What do you think entered the pot as the the smoke went out? Let’s see if you can guess from the rest of the story…
Boom! The initial explosion blackened my hands with soot. I dropped the pot. (Really, really stupid.) It landed upside down over most of the oil and smothered the fire after a few seconds. (Really, really lucky.)
The storm door slamming shut in my initial retreat woke Anna, but she went back to sleep. Tara wasn’t happy that I’d ruined a good pot, but I did mostly salvage it with some scrubbing. Daniel missed out on a great chemistry experiment, but I bet I could reproduce it… (just kidding).
Stein Home
Family Notes
Poetry Corner
Jeremy's Journal