Out-of-Office Auto-Replies

Great. I’m starting to get flooded by out-of-office auto-replies from the AP CS mailing list again.

I keep monitoring that mailing list for mentionings of DrJava, so I can make sure we help high school teachers with potential problems. I just posted a reply, reminding a user to also install the JDK when installing DrJava. Unfortunately, it’s past the end of the semester at most institutions now, and that means that a bunch of people won’t be reading their email now.

And they think they need to tell people that they won’t be reading their email. So they set up out-of-office auto-replies that reply to every message they receive. Including posts from the mailing list they chose to subscribe to. At least the AP CS mailing list is set up to list the individual post writer as sender, and not the entire mailing list, so the auto-replies just go to me and don’t cause a vicious cycle of auto-replies to auto-replies, and so on.

Still: These people chose to subscribe to the mailing list. I’m not writing to them personally. Can’t they have the decency and foresight to unsubscribe or except the mailing list from the auto-replies? Are out-of-office auto-replies really necessary?

Share
Posted in Ramblings | Leave a comment

Print This Post Print This Post  

Cygwin, Subversion and End of Lines

I got myself into a bit of a problem when I tried to set the automatic end-of-line style property for our text files in Subversion. I wanted to use “native”, because that should automatically convert all line endings to LF (“\n”) on Unix and Mac, and to CR LF (“\r\n”) on Windows.

This seemed to work, but unfortunately the language level tests started breaking. It was pretty clear that this had to be a line ending issue. I couldn’t figure out why, though, and I went back and forth and changed the eol-style, ran dos2unix or unix2dos, and because the failures were only appearing after an update or checkout on another system, all of this went into the repository. All in all, it took me from revision 5144 to revision 5163 to get this right. This is shameful.

In retrospect, I should have done this in a branch, but svn was behaving very strangely, and I was worried that I might get it to work in the branch, but then something would go wrong when copying the files back into the trunk. I think there were two things that confused me:

  1. On Windows (or perhaps on Cygwin), Subversion seems to be line-ending insensitive. I can take a file that had Unix line endings, run unix2dos on it, the file had changed, but Subversion would not list it as modified.
  2. On Cygwin, Subversion’s “native” line ending is not the Windows default of CR LF, but LF, just like on Unix systems. That meant that the files with the “expected” outcome still contained LF line endings, but the files we were generating contained CR LF line endings. This is not well documented.

I was close to forcing LF line endings everywhere, but then decided to stick with “native”. If someone actually has a non-Cygwin Windows Subversion client, this may work, and I had to make the unit tests line ending-insensitive anyway.

There was another issue that gave me a hard time for an hour or so: The unit tests use some class files and make sure that they are newer than the source files. I had touched the source files when I changed the line endings, but the class files had not been recompiled. This caused the a couple of unit tests to fail with a nondescript error message. I had to trace the execution of the test to get to the following line to understand the problem:

if (sourceFile.lastModified() > classModTime) {

As a hack, I just Unix-touch the class files to give them a more recent time stamp. I tried to recompile the class files, but that wasn’t possible:

  1. Some of the class files (B.class, Doh.class, TestWeirdStuff.class) don’t have any associated source (it’s missing).
  2. Wow.dj0 contains the public keyword, which is not permitted in the elementary level.
  3. The classes Tom.dj1 and Jerry.dj1 contain a cyclic inheritance graph, so they cannot be compiled, yet their class files exist.

I kept the class files. I didn’t want to re-engineer or understand the unit tests more than I had to. Considering that I had another sudden failure with the unit tests a few weeks ago, I don’t think they are well engineered.

As a side note: I love bash. I don’t know if it’s actually helping or hurting me (kind of like LaTeX), but writing something like this is cool every time:

find . -type f -not -path "\*.svn\*"|xargs -n 1 -I {} -i bash -c 'if [ "`svn propget svn:eol-style {}`" == "LF" ]; then echo {}; fi'| xargs -n 1 dos2unix

Or perhaps a Unix guru out there has a better way to run dos2unix on all files that have been marked with the “LF” end-of-line style property in Subversion?

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Submitted Publication Version of SIGCSE 2010 Paper

I just submitted the publication version of our SIGCSE 2010 paper, Test-First Java Concurrency for the Classroom.

Now I’m waiting for the copyright form to be sent, and I’m wondering why that’s not done automatically…

Share
Posted in Concurrent Unit Testing | Leave a comment

Print This Post Print This Post  

Snow

As someone who knows what snow actually is, I’m picky about what I call snow. When my fellow Houstonians say “it’s snowing”, I tend to say “no, this is sleet (@Apparently sleet is known as partially melted snow in the US.@).” But I have to agree with them now: It is definitely snowing in Houston right now. It is also colder in Houston than in Bremen.

Houston Doppler Radar

Houston Doppler Radar

Update

Now it is colder in Houston during the day than it is in Helsinki, Finland, at night.

Houston Doppler with Lots of Snow

Houston Doppler with Lots of Snow

Update

Snow Day at Rice University, click for Flickr ste

Snow Day at Rice University, click for Flickr site

Share
Posted in Uncategorized | Leave a comment

Print This Post Print This Post  

Another Sample Bug for Yield

I coded up two more examples to test the yield strategy. The “split synchronized” example doesn’t work that well (yet), because it fails even without the added yields. I’m looking for common bugs that aren’t obvious.

Thread remover = new Thread() {
public void run() {
while(l.size()>0) {
l.remove(0);
}
}
};
Thread reader = new Thread() {
public void run() {
for(int i=0; i<10; ++i) { if (l.size()==0) { break; } int e = l.get(l.size()-1); // l.size and l.get not atomic } } };

The important thing here is that the calls to l.size() and l.get may get interrupted by the other thread performing an l.remove(0). I know that this happens quite frequently and is not always as obvious as here (in DrJava, this happened when we tried to append text to a document; append was implemented "insert text at index", and the length was used as index), but right now I'm unable to reproduce that in a short example.

However, I have another example from my COMP 402 course last semester that benefits from the inserted yields:

class WaitRunnable implements Runnable {
public void run() {
sleep(1000);
while(true) {
synchronized(_lock) {
if (_flag) break;
}
// lock dropped here!
synchronized(_lock) {
try { _lock.wait(); }
catch(InterruptedException ie) { /* ignore */ }
}
}
}
}

The problem here is that the condition _flag is checked, but before wait() is called, the lock is dropped. Therefore, another thread may call notify() and change _flag and allow the first thread to enter a wait() from which it will not be woken up.

Share
Posted in Concurrent Unit Testing | Leave a comment

Print This Post Print This Post  

Getting Back on That Concurrency Horse

After a lot of work on Mint, I’m now focusing on the concurrent unit testing project again. I had to fight some apparent code rot, which was probably caused by changes from Java 5 to Java 6, but now everything is working again.

I have a nice example that shows that double-checked locking is broken. With a yield probability of 0.5 and yields in all places (thread start, thread run, thread exit, thread join, before notifies, after notifies, before waits, after waits, before synchronized and after synchronized), it usually shows up in under 10 iterations.

It would be nice to have a simpler way of setting these parameters, e.g. by using an annotation on the test:

@Test(yieldProb=0.5, beforeSynchronized=false)
public void testFoo() { ... }

Share
Posted in Concurrent Unit Testing | Leave a comment

Print This Post Print This Post  

Double.equals for NaN and -0.0

I just fixed two bugs in DrJava that had to do with boxed floating-point comparisons of NaN and -0.0.

Both bugs had the same cause, a difference between the behavior of primitive == and the equals method in Double and Float.

According to IEEE 754, any NaN isn’t equal to anything, not even itself. Therefore, Double.NaN==Double.NaN should evaluate to false. On the other hand, positive and negative zero are the same (even though they have different encodings), so 0.0==-0.0 should evaluate to true. This is the case for the primitive types double and float, but not for the boxed types Double and Float.

This may be surprising, but the boxed types had additional contracts to fulfill regarding the behavior of equals and hashCode in hash tables. It was decided that it was more important to successfully look up floating-point values in hash tables, so new Double(Double.NaN).equals(new Double(Double.NaN)) returns true, and new Double(0.0).equals(new Double(-0.0)) returns false. Try it.

In Dynamic Java, the interpreter in DrJava, we internally used boxed types when comparing primitives, just because that way, we could write the equals method more easily. Now I created special cases for floating-point numbers that unboxes the values and eschews the equals method.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

CSEE&T Paper Not Accepted

As expected, the paper I submitted for CSEE&T back in October did not get accepted. But that was a long shot anyway, and I already have something else for it in mind.

Share
Posted in Research | Leave a comment

Print This Post Print This Post  

Happy Thanksgiving

Happy Thanksgiving, everyone! I was fortunate to spend a wonderful day with Walid, Corky and Corky’s family. Thank you.

Share
Posted in Uncategorized | Leave a comment

Print This Post Print This Post  

Remembered Number Significance

Memories can be strange. A lot of people around me are probably now having memories triggered by (turkey) smells. I have memories triggered by numbers.

Our Hudson build server just notified us of a unit test failure after a recent commit. It was a:

java.lang.NullPointerException
      at edu.rice.cs.drjava.model.definitions.CompoundUndoManager$1.run(CompoundUndoManager.java:216)

The line number, 216 immediately hat a strong meaning for me: general protection fault, some kind of protected mode error (to plug my first programming website)!

Of course, that was ages ago, when I worked with Borland Pascal 7, but somehow the number 216 has retained its significance to me.

Share
Posted in DrJava, Ramblings | Leave a comment

Print This Post Print This Post  

Mac OS X Race Condition in DrJava Start-Up

A few days ago, I noticed that double-clicking on a *.java file in Windows Explorer caused an AssertionError in DrJava. This wasn’t a huge issue, because it only shows with assertions enabled (i.e. -ea in the JVM Arguments for the Main JVM).

It’s still something I wanted to fix, because under some circumstances, opening a file this way could violate the convention of accessing certain Swing data structures only in the event thread and cause problems down the road. So, after being done with our Mint paper and taking the weekend off, I made the simple change of moving code into an invokeLater.

But when testing it, I discovered that Finder integration on the Mac wasn’t working anymore. It turned out this was also an effect of having assertions enabled with the -ea argument: When a file is opened from the Finder, the ApplicationListener.handleOpenFile method is called, but when we have Main JVM arguments like -ea, we need to restart DrJava, and the second instance doesn’t get another call to handleOpenFile anymore, so we need to change the file from that method into a command line parameter.

Whether this works or not depends on when the call to handleOpenFile arrives: Does it arrive before or after the restart? This is a race condition.

Unfortunately, fixing this properly is difficult. It seems like it is guaranteed that handleOpenFile will be called eventually if the file was opened from the Finder, but we don’t know when. How long do we wait before we decide to not wait any longer and restart? It would have been nice to get a handleOpenFileComplete call after all events (there can be multiple) have been processed. That method should be called as well if no calls to handleOpenFile are generated. But that’s not how Mac OS X does it.

I restart now whenever DrJava gets ready, and then uses the DrJava remote control to open files that arrive too late. Of course, that only works if remote control is enabled and if the new instance of DrJava can is actually running a remote control server.

Some big ifs, but I think this is the best I can do now without a lot of re-engineering.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Huzzah for Sleeping In!

Today I slept in for the first time in a while. It’s been a tough fortnight, but we finished our PLDI 2010 submission. I feel it is considerably stronger than our previous submissions. Let’s home my confidence is justified.

Share
Posted in Mint, Research | 1 Comment

Print This Post Print This Post  

Open Source: Don’t Steal What You Can Have for Free

Open source is not the same as public domain material. It is not content that is not owned by anyone.

The fact that we give something away for free does not allow you to just steal it.

DrJava is an open source project, made available under the BSD license. We freely distribute our source code and hope that others can use it and build on it. But we have not abandoned ownership of the code.

All we ask is that you follow the BSD license agreement, which can be found very easily on our website, in the “About DrJava” dialog of the program, and at the top of every source file:

  • We ask that you keep our license and copyright notice in the source files that you use.
  • We ask that you display our license and copyright in your running program.
  • We ask that you do not use our names (DrJava, JavaPLT, Rice University, and the names of the developers) to promote your product.

These are very simple rules. It doesn’t cost you anything. You can even still sell your product. Your product does not have to be open source like ours. We just ask that you give credit were credit is due.

In this particular case, we receipt a DrJava support request (and later another one) from a student at the Instituto Tecnologico de Ciudad Guzman in Mexico, who registered himself at SourceForge as francisco javier sainz ozegueda. I didn’t quite understand what he was trying to do, but I was assuming he was using DrJava as an IDE. I didn’t understand that he was writing his own IDE based on DrJava source code, and that’s why he was contacting us.

I wouldn’t have had any objections to this and would have tried to help, but when I looked at the source code he sent us, I discovered that he was using our source code, but had removed our license and copyright statement.

That means he is stealing something that we give away for free. Why?

I am going to chalk this up to the language barrier for now and hope that he will follow my request to adhere to our license.

Because otherwise this would be a dick move of him.

Share
Posted in DrJava, Ramblings | Leave a comment

Print This Post Print This Post  

Halting Problem in the Style of Dr. Seuss

I found a proof in verse of the undecidability of the halting problem, in the
style of Dr Seuss, written by Geoffrey K. Pullum (@ I’m delighted that I have a reason to cite Pullum on my blog here, because he is a contributor to one of my favorite reads on the web, the Language Log.@). Amusing and clear at the same time.

SCOOPING THE LOOP SNOOPER: A proof that the Halting Problem is undecidable

If P warns of infinite loops, Q will quit;
yet P is supposed to speak truly of it!
And if Q’s going to quit, then P should say ‘Good.’
Which makes Q start to loop! (P denied that it would.)

Found via Philip Wadler’s blog.

Share
Posted in Uncategorized | Leave a comment

Print This Post Print This Post  

New Mint Release

I just created a new release of Mint and DrJava with Mint.

There were some dramatic performance improvements in the Mint compiler thanks to base type lifting instead of performing cross-stage persistence for them. I also fixed a bug that didn’t allow escaping into bracket statements. And DrJava with Mint now has a simple logo (mostly so I don’t get confused if I’m working with DrJava with Mint or with regular DrJava).

(Re-posted from The Java Mint Blog)

Share
Posted in DrJava, Mint | Leave a comment

Print This Post Print This Post  

Boring Backport

I’m in the process of porting some scientific code originally written in Fortran, which was then ported to Java, which was then ported to Habanero Java, back to Java, while maintaining a Habanero Java feature called array views. It’s incredibly frustrating… I wish I could replace myself with a short shell script.

Update

Wow, I wish Java had operator overloading right now… Habanero Java has a primitive complex64 datatype, Java doesn’t. a+b*c becomes add(a,multiply(b,c))… in 5,000 lines.

Share
Posted in Mint, Ramblings | Leave a comment

Print This Post Print This Post  

In the Thresher!

In light of the upcoming registration period for the Spring 2010 semester, the Rice Thresher (our university newspaper) has published last spring’s course evaluations. It’s kind of cool to be listed in there, even though I probably won’t offer COMP 402 again.

Thresher Course Evaluations Spring 2009 (pdf)

Thresher Course Evaluations Spring 2009 (lower is better, pdf)

Update

The Thresher incorrectly listed the Statistics (STAT), Computational and Applied Mathematics (CAAM), and Computer Science (COMP) departments as part of the School of Natural Science. At Rice, they are in the School of Engineering.

Also, I find it interesting that COMP is listed as #1 in the “Top 10 Hardest Majors” list.

Share
Posted in COMP402 | Leave a comment

Print This Post Print This Post  

Wikipedia and the Right to Know vs Right to Privacy

Sometimes it’s interesting to compare Wikipedia articles in different languages. I just read something about the last school shooting in Germany, the one in Winnenden in March 2009, and decided to search the web for it. The English Wikipedia article came up first, probably because I am located in the US.

I expected the German version to be longer, because obviously Germans should care more, right? To my surprise, the English version actually has more details. It lists the full names of the victims, for example!

This is emblematic for the US-American “public’s right to know” and the German “right to privacy”.

After the Ft. Hood shooting last week, for example, I overheard people saying “Nidal Malik Hasan… Hasan, well no surprise there.” The name was released, and because it was Muslim-sounding, the suspect was prejudged to be guilty. German media would not have released the name, or used first name and last initial only.

It would have been prudent to wait with the release until after being pronounced guilty at his trial (or death). In this particular case, it is highly unlikely that he will go free, but other cases may be less clear. Also, remember the flood of incorrect information that was released in the immediate aftermath of the Ft. Hood shooting: (1) The shooter was dead; (2) the female police officer was dead; (3) two or three other suspects were detained. With all of these mistakes being made, it is easy to imagine that someone may have been mistaken about the shooter’s identity, too, and thus subjected an innocent person completely unrelated to the incident to unwanted media attention.

Innocent until proven guilty is the fundamental tenet of the US justice system. Justice trumps the “people’s right to know”, and justice includes the right to privacy for suspects. And in the case of shooting victims’ identities, that “right to know” does not exist (@ I realize Wikipedia gathered these identities from other publicly available sources; I nonetheless wonder what purpose listing the victim’s names serves.@).

Share
Posted in Ramblings | Leave a comment

Print This Post Print This Post  

Twenty Years Ago

Twenty years ago, on 9 November 1989, the Berlin Wall came down.

I remember the day, but the TV coverage doesn’t belong to my most intense childhood TV memories: It feels like this event is bracketed by stronger memories of the Challenger disaster and Chernobyl in 1986 and Desert Shield/Desert Storm in 1990/91.

The German radio station that I listen to, NDR2, is playing music that was popular during Die Wende (“the turning point”, as the end of East Germany and the beginning of a reunified Germany is often called in German), and people are calling in their memories of the day.

One story was particularly funny:

I woke up with daddy standing naked in my room, yelling ‘the wall is open, the wall is open!’ I didn’t know which wall. Was there a hole in our house?

Share
Posted in Ramblings | Leave a comment

Print This Post Print This Post  

Ridiculous Texas Bureaucracy That Doesn’t Make Anyone Safer

Last Tuesday I went back to the DPS to renew my drivers license — temporary visitors now have to do that once a year. I took exactly the same documents with me that allowed me to get a drivers license last year (passport, visa, I-20 immigration form, I-94 immigration form, current drivers license, enrollment verification, tuition payment receipt), but this time I was denied.

Last year, the item that I absolutely needed to show was the tuition payment receipt–which I fortunately kept. This year, I made sure to carefully set the tuition payment receipt aside, only to find out that there’s nothing the DPS can do with it or with the regular enrollment verification that Rice issues via the National Student Clearinghouse, a third-party non-profit organization that handles enrollment and degree verification for 3,300 colleges in the US.

Contrary to Houston Metro, for example, where the National Student Clearinghouse verification is accepted, the DPS requires a special hand-signed enrollment verification on Rice letterhead, which I then had to get prepared. There are two problems with this: First, nowhere did it state that Rice’s regular enrollment verification was not acceptable, which means I had to wait longer and pay additional fees. Second, and more importantly, I almost would not have received the hand-signed enrollment verification in time.

Processing for the hand-signed document takes two to five business days at Rice. This Wednesday, my student visa will expire within six months, and when the expiration date is within six months, the DPS will not issue a drivers license or ID card at all! I assume when that happens, students are expected to finish their studies without being able to drive.

Fortunately, the Registrar’s Office at Rice was able to issue the hand-signed enrollment verification by closing time on Friday (they promised it would be done on Thursday, and I had to tell them on Friday that I am not leaving without it).

This morning I went back to the DPS and got my license renewed, but again, just like last year, I am shocked by how arbitrary the DPS handles these matters for legal non-residents, while I am sure that illegal immigrants are not affected by these procedures at all. This doesn’t make anyone safer, it is merely a hassle for foreigners who are here legally.

Share
Posted in Ramblings | Leave a comment

Print This Post Print This Post