Saturday, 31 March 2007

Apple gets it right...mostly (Fun with Apple pt V)

So I guess I get to eat a little crow. As it turns out my mouse wasn't broken in fact my battery had swollen to the point that it was preventing the mouse from being clicked. Although my battery wasn't one of the recalls, it was nonetheless defective. Now the good in this is that the Apple "genius" was good, he acknowledged my quickly and then when I showed him the problem, he flipped it over and saw the battery had swollen and demonstrated that w/o the battery the laptop was fine. Following this he (while helping someone else) got me another battery. The bad in this is that Apple is apparently aware that there are batteries that have metal shards in them that are swelling and are a potential hazard -- but they have not recalled them. So my laptop is back.

Technorati Tags:

Posted by acoliver at 6:55 PM in Tech tips

Apple !$!@ pt IV

I whined to a fellow LUG member who works at the Apple Store the other night about my really "fun" Apple experiences. He explained the whole $250 isn't enough, they need another $100 to not suck. I knew this. It only reinforces my bad attitude. So today because I was bad mouthing my Laptop's parent company...my mouse button broke. Now it it just wasn't working, no big deal hook up an external mouse...take it in as you have time... However, it broke in a stuck down position. You can imagine my pure pleasure at this. I think I need a backup laptop, to quote Q-Bert: "#!$!@#".

So this is probably how this will roll. It is futile to call Apple because they feel I might be wrong that the mouse button that is physically stuck down (apparent to any moron who attempts to press it) is broken. It will require a "genius" to attempt to press it and realize that indeed it is stuck down. Next, the "genius" after 10 minutes of dorking with the computer, will realize that they do not have the part and I must bring the laptop back in for repair. It will take a number of days. Then they have me come back in...wait at the counter well past my appointment type just to print out a sheet of paper and take the laptop into the back room. I will mumble to myself and plot their deaths. I'll go catch a movie, and get the laptop back. In three weeks another key will break.

Mike, I changed my mind. Marc was right about Apple...even the magnet power isn't worth all this.

Technorati Tags:

Posted by acoliver at 1:03 PM in Tech tips

Sunday, 18 March 2007

Meldware In Washington DC at DCLUG and Running MS Windows with Pride

Mark your Meldware-based calendar off for March 21, I'm flying up to D.C.(DCLUG) to give a similar talk to the one Calendar whiz Aron Sogor gave to much accord at CSUEB.

Aron Sogor
Aron Sogor

This is the announcement for my DC LUG talk:

The March 2007 meeting of Washington DC Linux user group will take place on Wednesday, March 21, 2007 at 7pm.

Andrew Oliver from buni.org will talk about their Linux groupware software "Meldware Communication Suite". He'll discuss front-end and back-end issues, and do a quick tour of installation and features, and discusses integrating their software with popular organizer tools such as webcal and Thunderbird. Under duress, Andrew will break and admit that they even integrate with Outlook.

The meeting location is our usual 2025 M street, NW in downtown DC. There will be signs in front of the building. The location is within 3 nearby Metro stops, both on the red (Dupont, Farragut North) and blue/orange (Farragut West, Foggy Bottom [a bit of a hike]) lines.

Parking in the area is available for approximately $5; there's even parking in the building itself. Street parking is free after 6:30pm, but scarce. There's a parking lot at 23rd St. between M and L that is not enforced after 7pm (people have successfully parked there for years---no one we know was ticketed or towed yet, but it could happen).

The meeting dates for the rest of the year 2007 are: Apr 18, May 16, Jun 20, Jul 18, Aug 15, Sep 19, Oct 17, Nov 21 and Dec 19.

For other details, see our home page

http://dclug.tux.org

...except I'm proud of our integration efforts. I will come right out and say with glowing pride. Not only does Meldware work with Outlook but the server runs fine on Windows too....maybe I'll tone my pride down on the "Works on Windows" talk for the LUGs huh? I can still flirt with Solaris, OS X and BSD though right? Okay no...stick to message. Meldware: Groupware for Linux baby!

click here for google map

Technorati Tags:

Posted by acoliver at 11:27 PM in Buni.org

Friday, 16 March 2007

Bring on the Blue: Java port of Nagios

I just found Rich Friedman's blog. Rich was head of management stuff at JBoss and moved to doing the overall thing at Red Hat. I just read in his archives that he is writing a Java version of Nagios. I fell in love with Nagios when Nicholas Whitehead demoed it at JBossWorld a few years back. The results those ADP boys were able to achieve were incredible. However, I've never run it...it requires Windows. That is why I say "GO RICH GO!" I can't wait to see this one.

Just one suggestion..."Blue" is such a generic name. Pick a better project name. For instance, I offer you conclusive evidence that Spring is a bad brand name whereas JBoss is a good brand name as is Meldware. Blue is a terrible brand name for many reasons. In fact this project was unofficially codenamed "Blue" for a little while.

Posted by acoliver at 1:01 AM in Tech tips

Is JBoss your friend?

Is JBoss your friend? Maybe it is just me, but some days I think it is my friend. Other days I think it is out to make me loose my mind. If you're a good bit younger than me, and JBoss is your friend, maybe you can add JBoss to your friends list on MySpace. If JBoss is not your friend today, maybe JIRA is a better place to start.

Posted by acoliver at 1:00 AM in Tech tips

Thursday, 15 March 2007

Belated Pi Day post

I saw this:

and thought I'd share.

Posted by acoliver at 12:59 PM in Tech tips

How to pronounce Buni -- in pictures or "I hate cute furry animals"

So I heard Buni featured on this week's Flex Show. I appreciated the mention...but...they pronounced Buni like "Bungee"? So Buni comes from Swahili. It means "to put together" and is also a type of coffee bean. We have one customer who pronounces it "bunny"...the cute little furry things. Well Buni developers are fairly macho and we have one thing to say about that:

I don't know how "buni" is actually pronounced in Swahili, but here is a hint on how WE pronounce it:

Notice that our ghost isn't one of those cute little Casper types. He is BAD-ASSED. Boo-Knee. Get it?

Anyhow, thanks to the Flex Show guys - all in good fun. If you're not interested in our Groupware Server or Client (the Flex part) but are a mere Flex developer looking for a calendar control, you might want to check this out and if you also happen to be in the East San Francisco Bay area (Hayward), you can ask him more about it at his Linux Users Group talk about Meldware.

Posted by acoliver at 12:59 PM in Buni.org

Tuesday, 13 March 2007

Server-side mail filters

Do you use mail filters in your client to route mail between folders? This way you can differentiate between mails sent to a mail list and mails that require your immediate attention or things you are only "sorta" interested in and things you are very interested in. In Thunderbird you do this by going to Tools->Mail Filters.

As useful as those are, they kind of suck with IMAP as it has to get at least the headers and then move the mail between folders. Wouldn't it be nice if this told the server where to put the mail rather than having to match the conditions on the mails and move them one by one?

Well I just committed such a thing to Meldware. You do have to configure it (click Filters at the top of the screen) via the Webmail interface, but it will affect mails as they are delivered on the incoming queue. At the moment there is no way to apply them after the fact, I'm sure we'll handle that eventually, but you can at least filter mail based on headers into various folders and delete mail as appropriate. Thanks to Buni Developer, James Ward for all of his help in getting the UI to work.

Technorati Tags:

Posted by acoliver at 11:22 PM in Meldware

Monday, 12 March 2007

Design Issues in High-Performance Transactional Applications using Java and Linux

I have another article on Java performance on Red Hat's 108 site. This article focuses at the persistence layer.

Posted by acoliver at 1:00 AM in Tech tips

Friday, 9 March 2007

Fun with Apple's part III

So last week I did get my keyboard replaced. An apple person called and told me it was there. I went in the morning and dropped my laptop off and they replaced the keyboard. Then they called and told me it was ready. I had to assail someone going back and forth and shove my work order down their throat after about 30 min of standing there unacknowledged by the "genius"es or various employees walking by. They were like "not my job but I'll try"..

So my MagSafe power cord shorted out. Apple's cords are really pretty and really flimsy. Granted this is still better than ripping a power coupling out, but after wrapping and unwrapping the cord between home and office for some months the cord had come unglued from the plug (or more accurately the cord came unglued from the sheath that is connected to the plug).

So I saw this was happening and ordered a new one from the Apple Store Website. Notice all of the negative reviews (Mine is AO from Durham) saying similar things "right idea, poor construction". Of course it shorted out before the new one arrived (the plastic melted as the exposed wires touched the sheath at an angle). So I drove back to the actual Apple Store and bought a new one. Of course you know what happened...I unpacked it, used it at the cafe while I ate lunch and had a quick con call at the office...when I got home of course the other one had arrived (despite using the cheapest shipping option).

update: after writing this entry and clicking on the magsafe Technorati tag...I discovered this entry. Indeed my new cord seems to have the improved sheath. I'll probably wrap electric tape around it as well and keep both just in case. I also forgot to mention how fun it was when I handed a business credit card to the counter wonk who immediately tried to get me to fill out for their business card (like it was procedural) and as a chief selling point they would give me business consultation. I probably sounded really snobby when I said "I'm a software developer and run Linux on it" but I find the whole marketing experience of the Apple Store kind of annoying. Aside from the "you bought a Mac and therefore must be stupid" assumption -- the iPodization has them catering to a crowd who don't scoff at the "put some music on" fashion ads. I guess as a "genXer" -- in marketing terms -- I want to delete those screen savers and then kick the cardboard cut outs in their androgynous girl-boy parts.

Posted by acoliver at 1:00 AM in Tech tips

Thursday, 1 March 2007

Removing AOP magic with Java Closures and Java Closure method assignment

So I love VMs and I don't think Java is a great language (it is an "OK" language), but the JVM is the most productionable VM to date! Java doesn't make your mail server slow, your storage strategy makes your mail server slow :-). You will live or die by IO, not the few extra microseconds in Java's type system or the time between not-JIT and JIT or 1-10 line to instruction ratios or anything that the uninformed would complain about...Though it will suck air if you invoke the RMI subsystem anywhere and don't do this. Most professional C programmers use memory pools rather than malloc and free because they recognize that they are not indeed infalliable. Most of today's professional C programmers also use a sort of home-grown type system. So we're really not even talking about garbage collection or typing we're talking magic pixy dust (the same ASM out of the C compiler is just FASTER than the same ASM from Hotspot) or "load time". Don't "be a man"...just grow up and get some facts. I'd rather have a spot for you next to one of the world's best software developers and not at the kiddy table. But I digress...

I don't really love AOP very much (and if you aren't an AOP/EJB buff bear with me, this isn't REALLY about either, I'm using this as a demonstration for some candy I'd like to eat). I regard it as a lot of academic BS wrapped around some dirty hacks for what Java should do anyhow. You do hear about AOP in other languages but they're mostly talking about the runtime system to apply advice selectively (complete with academic gobbledy-gook language meant to complicate simple things), but not even 1/10th as much as in Java. They just don't need it as much.

Java's static typing coupled with missing features are why so much Majick is needed. The first things is closures. Closures as specified for JDK 7 more or less let you extend the language as follows:

public Currency transferMoney(Account from, Account to, Currency amount) {
    Currency transferred = null;
    transaction.required {
       Currency withdrew = withdraw(from, amount);
       Currency deposited = deposit(to, amount);
       if (!withdrew.equals(deposited)) {
          throw new CurrencyException("The amount withdrawn did not equal the amount deposited in transfer money (amount,withdrew,deposited)", amount, withdrew, deposited);
       }
       transfered = new Currency(amount);  //copy constructor
    }
    return transferred;
}

In EJB3, you would do this with the @TransactionAttribute(TransactionAttributeType.REQUIRED) annotation. I would argue that in many cases closures are more appropriate. On one hand pervasive imperatives such as is required with "Bean Managed Transactions" in EJB and JTA is horrible. BTW Ruby on Rails's transaction support looks more like BMT in EJB/JTA than any of the above ;-). On the other hand EJB transaction tags are rather limited too (as described below).

The weakness of closures is that a lot of things really do have inherent transactional natures. Closures capture the above case where depending on the transaction you might do a withdrawl REGARDLESS of a deposit, but in this case you want them both in the same transaction. Doing this right means doing it in a way that is both simple and flexible. However, *not* having a default transactional nature is dangerous. Developers may forget something especially if 99% of the time it is repetitive template code (indeed EJB defaults to "REQUIRED"). A good API, language or whatever is designed for use by fallible programmers to use.

With EJB3+ this isn't a big deal. Since EJB3 maintains the same calling semantics. If I did this:

SomeEjb {
   @TransactionAttribute(TransactionAttributeType(TransactionAttributeType.REQUIRES_NEW)
   public void requiresNew() {...}

   @TransactionAttribute(TransactionAttributeType.REQUIRED)
   public void required() {
      doStuff();
      this.requiresNew();
      doOtherStuff();
   }

}

and called "required", I would ONLY have one transaction and not the expected 2. EJB3 maintains the call by proxy semantics of EJB2. Meaning if I want the transactional nature of the method I must get the local or remote interface and not just do a Java-to-Java call. This is where the legacy of EJB2 infects EJB3. It isn't intuitive even though you may understand that IBM isn't going to stick byte code manipulation in WebSphere. You can solve this unintuitiveness by using something like JBossAOP @Tx(TxType.REQUIRED) annotation that actually does require/use bytecode manipulation:

SomeEjb {
   @Tx(TxType.REQUIRES_NEW)
   public void requiresNew() {...}

   @Tx(TxType.REQUIRED)
   public void required() {
      doStuff();
      this.requiresNew();
      doOtherStuff();
   }

}
 

Now I get two transactions because I either used JBoss's bytecode weaving at deploy time or I used "aopc". However, aren't you uncomfortable with bytecode manipulation in the classloader or a post compilation process in your build that forever ties each build to that version of the appserver or JBossAOP? I know I am. On the other hand a pre-compilation process sucks even more.

The closure version (with "inherent transactional nature") might look like this:

SomeEjb {
   
   public void requiresNew() { 
      Transaction.requiresNew {
      ...
      }
   }

   public void required() {
      Transaction.required {
          doStuff();
          this.requiresNew();
          doOtherStuff();
      }
   }

}

But boy it is easy to screw that up huh? And worse the caller can't override it. Maybe the original implementor thinks it has an inherent transactional nature and maybe 99.9% of the time it does. Ideally I want both annotations AND closures but NO bytecode magic. The cool thing is that if you're happy with the special proxy calling rule, then all you need to do is add it to your InvocationHandler or in the container code itself (WebSphere doesn't use dynamic proxies) and you're done!

However I'm not happy with the special proxy calling rule are you? That's cruddy and inherently confusing. What we need to round this out is a way for the deployer to assign a closure to a method. Meaning it would reflect on the bean, see that it had an annotation, then assign a closure to the method. "whenever you see this, then assign this closure to it".

  Class clazz = ...;
  Object bean = ...;
  Method method = ...;

  if (methodHasTransactionRequired(method)) {
     method.setClosure(bean, required);
  }

Meaning whenever that method is called on that bean on that instance...wrap it in the closure. However there can be only one closure in the above code. Really we want to allow at least 32767 of them, give or take. So we could just do method.addClosure(bean, required)...but I'd like to be able to manipulate them really.

  Class clazz = ...;
  Object bean = ...;
  Method method = ...;

  if (methodHasTransactionRequired(method)) {
     InstanceCallStack stack = method.getInstanceCallStack(bean);
     if (!stack.contains(required)) {
         stack.add(required);
     }
     //method.setInstanceCallStack(bean, stack); ?
  }

Where InstanceCallStack subclasses Stack and contains closure objects. You can then inspect, add, and remove them. Obviously there are other uses for this. My point is that it accomplishes much of what AOP does (AOP advocates would say it is just a replacement for a method of implementing AOP rather than AOP itself meaning the closure is the encapsulated advice).

At the lower level there would have to be a similar switch as was done in the jit for contended and uncontended locks (syncronized) [pdf] to avoid needless dispatches for the 99.999% of all methods that have a null instance callstack. Indeed initial callstack creation wouldn't be entirely thread safe (meaning any instances about to go into it might get the null instance call stack) and therefore the instance call stack itself might be better off semi-immutable (instead rely on a semi-atomic "set" and any "getInstanceCallStack" is merely a copy thereof). If done correctly this means no or immesurable performance decrease for invocations on methods with a null call stack and stack.size() * methodDispatchPerformance degredation for those with a call stack (excepting what work is actually done in the closures).

So right now as I read the closure spec there is nothing like this and Java still has no runtime meta-model. This would be a first step in my mind towards mutators on Method objects (add a method to an object) and optional dynamic typing (maybe a DynamicObject obj = Class.getDynamicType(object)), but at least it removes the need for 99% of AOP precomplation and postcompilation code magic :-). Sadly except for the first code snip with closures...this all only exists in this blog entry :-).

I'm interested in what people think about this and the Java closures proposal itself so I'm putting it in my semi-spam protected Buni tech tips blog...which was originally going to just be a continuation of my "stupid shell tricks" and "how to" type stuff (which is the ultimate search engine optimization ;-) )...but it has evolved I guess into "stuff I want to say about technology but don't want on the front page" ;-). If you haven't watched the GoogleEDU video on closures you probably should. Might also make the above parse better.

Posted by acoliver at 1:50 PM in Tech tips