The Source for Java Technology Collaboration
User: Password:



Masood Mortazavi's Blog

Programming Archives


Favorite Software Products!

Posted by mortazavi on December 07, 2007 at 08:03 AM | Permalink | Comments (0)

I hear developer.com is hosting a favorites' vote.

It takes a moment to vote for your favorite software products of the year!



Derby and Java ME

Posted by mortazavi on November 30, 2007 at 09:40 AM | Permalink | Comments (0)

John Embretsen of Sun's Java DB team has just posted a thorough wiki page on using Derby on Java ME platforms. He also shows how to test Derby with IBM's J9 and Sun's phoneME implementations. The tips and tricks section has some good pointers. Embretsen's wiki is a good place to start. Another good place is Mayuresh Nirhali's weblog on "JavaDB on JavaME."

Where was I?

Posted by mortazavi on November 30, 2007 at 01:31 AM | Permalink | Comments (0)

While I was away for meetings at Sun Microsystems's India Engineering Center, Eileen Alan of SDN channel posted a recent conversation I had with Kuldip Oberoi about Java DB and Apache Derby. I think Kuldip and I touched on a number of important topics about the technology, the business and Sun's general strategy behind Sun's Java DB work, and it is certainly very exciting to see the uptake by the user and developer community. It would be even more exciting as we see Java DB used for more and more database courses. I know Sun's Java DB (Apache / Derby) engineers are coming up with some very cool features and applications, too ... For a glimpse of what might be coming up, take a look at Rick Hillegas' "Saucer Separation" presentation given at ApacheCon (Atlanta, Nov. 2007) ... You might also want to check out the upcoming JavaME conference (Santa Clara, Jan. 2008) and check out JavaPolis (Anwerp, Dec. 2007), where there may be up to 4 Java DB related talks, Francois Orsini tells me. So, stay tuned, and in the meantime, don't forget to check out Orsini's blog!


Sony Ericsson P1i and Java

Posted by mortazavi on October 21, 2007 at 08:54 PM | Permalink | Comments (0)

Sony Ericsson P1i covers some amazing Java ground. It is also relatively easy to use and configure, and has some good documentation for development work.

FLOSS on PostgreSQL

Posted by mortazavi on August 20, 2007 at 06:09 PM | Permalink | Comments (0)

Randal Schwartz and Leo Laporte talk to Josh Berkus on FLOSS, about PostgreSQL, Perl, Python, PHP, Java, etc., and various PostgreSQL related projects.

PostgreSQL and License Fees

Posted by mortazavi on August 16, 2007 at 09:56 AM | Permalink | Comments (0)

Check out this result to understand how you can save tons of money using PostgreSQL on Solaris on ULtraSparc T1 CoolThreads Server!

Very similar performance at a fraction of the cost!

(Licensing fees ==> Oracle on HP: $80,000. PostgreSQL on SunFire: $0.)



jMaki

Posted by mortazavi on August 13, 2007 at 12:20 AM | Permalink | Comments (0)

Project jMaki mixes and matches just about everything in Web 2.0 sight.

My highlight of this year's O'Reilly's OSCon was when Arun Gupta (and here) gave me a 15 minute tutorial on jMaki at one of the Sun booths. It was great to have such a wonderful, succinct and intelligent tutorial from Arun, with whom I worked at Java Software many years ago. Thanks Arun (and keep running :-) !

To learn more, you can take this course or check out Greg Murray's blog. (I believe Greg invented jMaki to outdo the scratch and scrounge bubbling in the midst of Web 2.0, Ajax and Javascript libraries.)



JavaOne 2007 -- Java DB for Web Client

Posted by mortazavi on May 04, 2007 at 03:22 PM | Permalink | Comments (0)

Check out Francois Orsini's "Enabling Offline Web Applications with Java DB," where he previews his upcoming JavaOne talk with Zimbra's Kevin Henrikson.

Previously posted: If you're interested in playing soccer just after the closure of JavaOne 2007, see here.



Arrays, Variables, [ and {

Posted by mortazavi on September 11, 2006 at 01:48 PM | Permalink | Comments (2)

Variable initialization, assignments and use in array construction can be tricky to varying degrees in different programming languages.

When a variable is used during initialization of an array, some may assume that assignment to that variable will be carried to the array, too.

In this short note I want to give a couple of examples to note the difference between "{ }" and "[ ]" which are used when it comes to array assignments and initialization in Java. In fact, "{" and "[" distinctively mark assignment during innitialization or later.

I'm just going to give the code fragments and leave it there. I give two examples. One from Java and one from Ruby. My purpose here is not to be correct style-wise but simply to make a point that you probably already know but might forget once in a while. Try to run them on your own, fix any bugs and see what the difference is.

Here is the Java fragment:


public class TestVariableMeaningInArrays{
  public static void main(String args[ ])
  {
    String[ ] x={"Iran", "US"}, y={"Tehran", "Washington DC"};
    String[ ][ ] z={x,y};
    print2By2(z);
    y[0]="Isfahan";
    y[1]="Chicago";
    print2By2(z);
    y=new String[ ]{"Shiraz", "Santa Barbara"};
    print2By2(z);
  }
  private static void print2By2(String[ ][ ] z){
    System.out.println(z[0][0]);
    System.out.println(z[0][1]);
    System.out.println(z[1][0]);
    System.out.println(z[1][1]);
  }
}


And, here, is the rough Ruby equivalent:

  x=["Iran", "US"]
  y=["Tehran", "Washington DC"]
  z=[x,y]
  puts z
  y[0]="Isfahan"
  y[1]="Chicago"
  puts z
  y=["Shiraz", "Santa Barbara"]
  puts z


So, what's the point? Not much, really.

Ruby seems a little vaguer here because it does not sharply (in a marked way) distinguish between "new"-ing and element assignments. It is partly because in both cases, we have "[ ]". Please don't get me wrong. I don't want to criticize Ruby here. For a discerning programmer, it should be obvious that there's a difference between the assignments occuring on lines 5 and 6 and that occuring on line 8 of the Ruby program above.


A More Open Java Community

Posted by mortazavi on August 15, 2006 at 10:57 AM | Permalink | Comments (0)

Expect to find yourself in a more open Java community soon.

Mark Reinhold and Simon Phipps have written about the significance of new steps Sun has taken to create even a more open Java community.

Sun engineers already participate in various open source activities, from Apache (witness the Beta release of Derby 10.2) to Open Solaris.

So, now, java.net collaboration environment will host the open JDK community, and "Java ME code (CDC and CLDC) will also be open source around the end of the year," says Phipps.



Off To The Races

Posted by mortazavi on May 17, 2006 at 11:16 PM | Permalink | Comments (0)

Earlier today, I had a chance to talk to Sun Distinguished Engineer Greg Bollella while we both gleefully watched the 2006 Slot Car Race in action.

Greg, who has been behind Real Tim Java for the past 10 years, graciously shared some insights about the race and how participants were doing.

If you want to participate and if you want to learn more about Real Time Java and mechatronic control through first-hand experience, you can check out Slot Car Programming Challenge or even better, just walk over to the area near the entrance of the JavaOne 2006 Pavilion and talk to Greg himself. James Gosling has also written a blog about it.

Remember - Confucius said something to this effect: What you read about, you forget. What you see, you remember. What you do, you learn.

The best way to get engaged and going in the race is just show up at the entrance area of the JavaOne 2006 Pavilion — "Half of life is showing up," said the sage of Manhatan. To make your showing up even more useful, review the information regarding how to participate in the race.

Folks, this is really not that hard. The programming tools and platform are available on machines near the race tracks, and you still have time to participate, meet Greg in person instead of just reading about him, and write a bit of code to drive a slot car on a relatively challenging track.

The control mechanisms are simple. Greg has made it really easy for those who want to focus only on the control aspects.

A map of the track is available, sensors are evenly spaced along the tracks, and you're allowed pretty much as many experimental runs with your code as you like and as you update the code. Greg seems to be right there almost throughout the hours of the show to give you some encouragement and advice.

Digital real-time control was never meant to be easy in practice. That's why for hundreds of years people have relied on dynamic (read physical) control of mechanical objects. The case in point is the steam engine and its pressure control mechanisms. However, participating in this little game, you can get your hands into the mud of digital control and start shaping it to win a race!

I should end this by saying that RTSJ has attracted the attention of many others in a wide range of industries from manufacturing to telecommunications.

Last summer, while visiting the R&D centers of some of Sun's best mobile communications partners in Europe, I noticed a real interest in RTSJ, in particular in the mixed programming model. Most telecom (mobile or otherwise) service apps are composed of parts that are hard real-time, other parts that are soft real-time, and some other parts that are just good with basic best-effort.

RTSJ tells you how to mix these programming paradigms in a rational and useful manner.



Recursive Programming in Java

Posted by mortazavi on August 03, 2005 at 08:18 PM | Permalink | Comments (6)

I've done a lot of recursive programming in Java.

I like recursion. That's my weakness. Why? I don't know. Perhaps because I spent a good many years of my life studying logic and methodology of science at Berkeley. There's just a certain beauty to it. So, after many years of logic, when I took a course in LISP, I grew an admiration for it. However, that didn't stop me there. I moved to implement much of CORBA's Relationship Service some 8 years ago in Java, using a lot of recursion. In implementing parts of the POA policy system some 6 years ago here at Sun, I used recursion again.

Here's a snippet of code from Lewis & Chase's book on programming in Java which shows recursion in a mischievous but fun manner in their TowerOfHanoi.java.

   private void moveTower 
   (int numDisks, int start, int end, int temp)
   {
      if (numDisks == 1)
         moveOneDisk (start, end);
      else
      {
         moveTower (numDisks-1, start, temp, end);
         moveOneDisk (start, end);
         moveTower (numDisks-1, temp, end, start);
      }
   }

So, revel in the power of recursion.

It is not always easy to deploy it but when it is, take advantage of it.



Excellent Java Book of 2005

Posted by mortazavi on August 03, 2005 at 08:15 PM | Permalink | Comments (0)

Lewis & Chase's (not Lewis and Clark's) Java: Software Structures—designing & using data structures, 2nd edition seems like an excellent book. If you want to take another look at Java, this no-nonsense book demands a peak, and I'm puzzled why they have received such a low rating by Amazon readers.

By the way, I've written a bit about programming on my blogs.sun.com page.





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds