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  

Lifting for Primitive and Boxed Types and Strings

When we examined the code that was generated for the sparse matrix multiplication benchmark of Mint, we noticed that variables containing loop indices had become cross-stage persistent (CSP) variables, which necessitated an array lookup. This was much more expensive than directly accessing a final local variable.

I have now implemented lifting for primitive and boxed types as well as for strings. For example, the code

final int i = 1;
Code c = <| i |>;

used to generate code that looked like this:

public class $$Code1$$ implements edu.rice.cs.mint.runtime.Code {
private Object [] $csp_table;
public $$Code1$$ (Object [] csp_table) { this.$csp_table = csp_table; }
public Integer run() {
return $csp_table[0];
}
}

Even though the value of i was final, we retrieved the value from the CSP table. Now we lift this value, i.e. we create a code object for it and escape it into the bracket using a edu.rice.cs.mint.runtime.Lift.liftint helper method:

public class Lift {
Code liftint(int value) { ... }
}

The compiler internally transforms

Code c = <| i |>;

into an escape-and-lift that looks like

Code c = <| `(edu.rice.cs.mint.runtime.Lift.liftint(i)) |>;

Now the code that is generated looks as expected:

public class $$Code1$$ implements edu.rice.cs.mint.runtime.Code {
private Object [] $csp_table;
public $$Code1$$ (Object [] csp_table) { this.$csp_table = csp_table; }
public Integer run() {
return 1;
}
}

This has lead to nice performance improvements in the matrix multiplication and loop unrolling benchmarks, and (perhaps more spectacularly) also in the Lint interpreter benchmarks. The staged Lint interpreter benchmarks now run 20 times as fast as the unstaged versions. Matrix multiplication shows a speedup of a factor of 4.8, and loop unrolling has a speedup of 2.3.

There is a new release of the Mint implementation (November 4, 2009) and a new version of DrJava with Mint (drjava-r5128-mint-r14460).

(Re-posted from The Java Mint Blog)

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

DrJava Interactions Pane Output Redirection

We got a question today about how the output of a Java program running in DrJava‘s Interactions pane could be redirected into a file, just like it could be done in a Unix or DOS shell:

java Motion > motion.dat

The Interactions pane supports a simulated java command, but this is merely for convenience. java Motion actually translates to Motion.main(String[] {}), which is a bit unsightly. The Interactions pane is not a Unix or DOS shell, and therefore doesn’t support input/output redirection, nor does the java command support any of the command line options.

However, there is still a way to do input/output redirection in the Interactions pane. Here are instructions on how to redirect the System.out stream:

  1. Compile your program (e.g. Motion.java).
  2. In the Interactions pane, import the classes from the java.io package:
    import java.io.*
  3. Store the old System.out stream in a variable:
    PrintStream oldOut = System.out
  4. Create a new PrintStream that writes to a file:
    PrintStream newOut = new PrintStream(new FileStream("motion.dat"))
  5. Set the new stream as System.out:
    System.setOut(newOut)
  6. Now run your program (but not using the “Run” toolbar button or menu item):
    java Motion
  7. Your program will run, but all output from System.out is written to
    the motion.dat file.
  8. To get the original behavior of System.out back, set the old stream again:
    System.setOut(oldOut)

Perhaps we could support > and < to do this kind of setup automatically (although only when the java or applet commands are used, to avoid ambiguity). There is a feature request for that already: 1506832: Interactions commands.

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Mint Matrix Market Reader for Sparse Matrix Multiply Benchmark

I added a Matrix Market file reader for the MatrixMultiplySparse benchmark and used the 183-by-138 matrix we had picked out.

The reader seems to work, and if I set the heap size to 1.3 GB, then the compiler almost gets through, but it then blows up in Code.checkLimits. I believe the we are hitting the code size limit of 64 kb per method:

The amount of code per non-native, non-abstract method is limited to 65536 bytes by the sizes of the indices in the exception_table of the Code attribute (§4.7.3), in the LineNumberTable attribute (§4.7.8), and in the LocalVariableTable attribute (§4.7.9).

I’m going to try smaller matrices.

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

Funny Feature Request of the Day

Funny feature request of the day: Zoom In Zoom Out

I would like to request you to please kindly add Zoom in Zoom out feature in print preview. Please do it as soon as possible bcz we are having difficulties to view the code clearly as we r having eye problem.

(Emphasis mine.)

I’m afraid this has rather low priority…

Share
Posted in DrJava, Ramblings | Leave a comment

Print This Post Print This Post  

Mint Compile Time Improvement

I just committed a small change as a result of profiling Mint programs: We are now treating all compiler invocations as one long compile session, instead of having many short ones during the execution of a Mint program. This reduces overhead since each symbol only needs to be completed once.

Compile times are cut by a factor of about 3 in our benchmarks. Not as much as I’d hoped, but it’s a start. It seems like my initial estimates were skewed by the presence of the profiler itself.

I’m going to profile again now.

Update:

I got another improvement by a factor of about 1.5 by replacing an O(n) list append with an O(1) list prepend. But I think now it will be difficult to get anything more without major rewrites of the compiler.

Compiling now represents 11% of a profiled run of LintFib, parsing is 1% (keep in mind that profiling skews the percentages).

Share
Posted in Mint | Leave a comment

Print This Post Print This Post  

Legitimate Chase Email?

I received an email from Chase, and it seems to be legitimate, but gmail flags it as suspicious. No wonder, it contains the following link:

www.Chase.com

The domain cardmemberservices.com belongs to JPMorgan Chase as well, but it is not the same domain as visible, www.Chase.com.

I don’t click on links that take me to important account websites at all, but this bothers me nonetheless. Why does Chase do this? They should make their emails simple to vet.

Share
Posted in Uncategorized | Leave a comment

Print This Post Print This Post  

Softpedia “100% Clean” Award for DrJava

DrJava has been included in the Softpedia software database. Furthermore, their staff certifies with their “100% Clean” award that our software is free from malware:

DrJava has been tested in the Softpedia labs using several industry-leading security solutions and found to be completely clean of adware/spyware components. We are impressed with the quality of your
product and encourage you to keep these high standards in the future.

To assure our visitors that DrJava is clean, we have granted it with the “100% CLEAN” Softpedia award. To let your users know about this certification, you may display this award on your website, on software boxes or inside your product.

Of course I’m not surprised by this, but perhaps it may actually reassure some users. There is all kinds of crappy, evil software out there.

Softpedia 100% Clean Award

Softpedia 100% Clean Award

Share
Posted in DrJava | Leave a comment

Print This Post Print This Post  

Paper: Test-First Java Concurrency for the Classroom

Test-First Java Concurrency for the Classroom

41st Technical Symposium on Computer Science Education (SIGCSE 2010)

Concurrent programming is becoming more important due to the growing dominance of multi-core processors and the prevalence of graphical user interfaces (GUIs). To prepare students for the concurrent future, instructors have begun to address concurrency earlier in their curricula. Unfortunately, test-driven development, which enables students and practitioners to quickly develop reliable single-threaded programs, is not as effective in the domain of concurrent programming. This paper describes how ConcJUnit can simplify the task of writing unit tests for multi-threaded programs, and provides examples that can be used to introduce students to concurrent programming.

Share
Posted in Concurrent Unit Testing, Publications | Leave a comment

Print This Post Print This Post  

SIGCSE Paper Accepted!

The paper that I submitted to SIGCSE a month and a half ago, “Test-First Java Concurrency for the Classroom”, got accepted!

That means I’m going to Milwaukee in March.

Update:

I just realized that if my other paper currently under review also gets accepted, it will get a little stressful:

March 9-12, 2010: CSEE&T in Pittsburgh
March 10-13, 2010: SIGCSE in Milwaukee

Share
Posted in Concurrent Unit Testing, Research | Leave a comment

Print This Post Print This Post  

A Repeating Pattern of Hate: SourceForge

I’m hating SourceForge again, and this is a very frequent thing.

This time, I’m hating it for two reasons:

  1. News submission is broken. I made a new DrJava development release, drjava-20091021-r5004, but I can’t post a news release, because the submission website just goes nowhere. I filed a ticket, but as usual, SourceForge just closes it. How about keeping it open until you fix it?
  2. The task manager is gone. Just gone! Apparently there’s a replacement, but I can’t find it, and it’s not documented anywhere. (@ Update: Apparently, because TaskFreak is a hosted app, it’s not documented in the same place, but here. @)

I realize SourceForge is providing a free service to us, but do you have to make it such a huge pain? I honestly don’t care about how nice and glossy the website looks, I want to be able to use it.

Share
Posted in DrJava, Ramblings | Leave a comment

Print This Post Print This Post