Starred Items

Making good tar files on Windows

Sun, 09/05/2010 - 07:13

I work on Windows, and produce Python kits for various projects. Of course one of the kits is a source kit, as a .tar.gz. Python's distutils does a fine job of this, but it uses the native system command to tar up the files, and this means my tar files are from Windows.

The problem is that Windows doesn't know how to make tar files that look native on Unix: the permission bits aren't right, they come out as 0700:

drwx------ batcheln/100      0 2010-08-21 14:13 coverage-3.4b1/
-rwx------ batcheln/100    516 2010-08-08 09:36 coverage-3.4b1/AUTHORS.txt
...

The tar command let me set the mode bits in a command-line switch, which means I could set them in an environment variable, but that would make all the files have the same permission bits, and directories and files should be different.

To fix this problem, I wrote a distutils extension command. It turned out to be not difficult, distutils has good extensibility.

To make a new command, create a new package directory somewhere, I called my "distcmd". To make a command called "fixtar", you you derive a class from distutils.core.Command, name it fixtar, and put it in a file called fixtar.py. You have to provide three methods:

from distutils.core import Command
import shutil, tarfile

class fixtar(Command):
    """A new setup.py command to fix tar file permissions."""

    description = "Re-pack the tar file to have correct permissions."

    user_options = []

    def initialize_options(self):
        """Required by Command, even though I have nothing to add."""
        pass

    def finalize_options(self):
        """Required by Command, even though I have nothing to add."""
        pass

    def run(self):
        """The body of the command."""
        # Put something useful here!

The initialize_options and finalize_options methods are required. It's too bad distutils didn't allow them to be omitted in cases like mine where there are no options to specify. The run() method is the interesting one, that's where all the work will happen. In mine, I read the tar file distutils made, and I create a new tar file just like it, but with the permissions and owner info that I want:

    def run(self):
        """The body of the command."""
        for _, _, filename in self.distribution.dist_files:
            if filename.endswith(".tar.gz"):
                self.repack_tar(filename, "temp.tar.gz")
                shutil.move("temp.tar.gz", filename)

    def repack_tar(self, infilename, outfilename):
        """Re-pack `infilename` as `outfilename`.

        Permissions and owners are set the way we like them.

        """
        itar = tarfile.open(infilename, "r:gz")
        otar = tarfile.open(outfilename, "w:gz")
        for itarinfo in itar:
            otarinfo = otar.gettarinfo(itarinfo.name)
            if itarinfo.isfile():
                otarinfo.mode = 0644
            else:
                otarinfo.mode = 0755
            otarinfo.uid = 100
            otarinfo.gid = 100
            otarinfo.uname = "ned"
            otarinfo.gname = "coverage"
            otar.addfile(otarinfo, itar.extractfile(itarinfo))
        itar.close()
        otar.close()

To invoke my new command, I have to tell setup.py to pull it in with the --command-packages=distcmd switch. Then I can simply use "fixtar" as a command on the line just like any other:

python setup.py --command-packages=distcmd sdist --keep-temp --formats=gztar fixtar

Now I get a tar file that looks right:

drwxr-xr-x ned/coverage      0 2010-09-04 19:44 coverage-3.4b2/
-rw-r--r-- ned/coverage    516 2010-08-08 09:36 coverage-3.4b2/AUTHORS.txt
...

There's a bit more complication to it, because of the --keep-temp switch that I needed to keep the original tarred files around so they could be re-tarred. The real fixtar.py also cleans up that directory.

This was more than I wanted to do to get the right permissions in a tar file, but it was a chance to see how distutils extensions work, and it lets me make all my kits in one place.

Ned Batchelder

Acquire Heap Dump from MAT (Memory Analyzer Tool)

Fri, 09/03/2010 - 12:00

MAT, which stands for Memory Analyzer Tool, is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.
The project got integrated into the release train with Helios and comes with great features. I will highlight one of them, which is pretty useful in debug/development mode. I’m talking about the ability to acquire Heap Dump directly inside MAT.

  1. Starting the processus requires only two clicks. In the menu, choose “File->Acquire Heap Dump…”
  2. The wizard that will guide you prompts. You can see running java processes.
  3. Click on Configure… A new dialog will be displayed. You can specify here which provider to use to make the heap dump.
    You will see that two providers are available by default:
    - jmap tools (for Hotspot VM for instance)
    - an helper IBM VM.
  4. I’m using an Hotspot VM, so I need to specify only the JDK_HOME of my JDK. (This step is required only the first time.)

    Be careful: a JDK is required, a JRE is not enough. Are you really the end user that solves my memory issues?
  5. Apply the configuration of the Heap Dump Provider and click OK
  6. Now you’re back to the first dialog, select the process that you want to analyze.
    You will notice at the bottom that a path is automatically generated for the heap dump file. By the way I recommend to choose a folder containing only dumps. MAT generates a lot of other files aside it (for indexation purpose I assume). So if you don’t want that it pollutes your home folder (which is used by default), you know what you have to do
  7. Click on Finish
  8. Wait for the heap dump to be written to the disk and parsed by MAT. These operations can take some time for huge java heap size.
  9. A new dialog prompts, for a quick overview, keep “Leak Suspects Report” checked.
  10. Click Finish
  11. All right, you have the Heap Dump opened in MAT, ready to be analyzed!

In effect, this way requires that the process is still running. It is a debug/development use case. You still need dumps on OutOfMemoryError for production environment. You can find some information on the way to do that on the MAT wiki.
To learn more things about MAT, I recommend you to follow the MAT webinar which happens on September 8th.

Palm puts webOS 2.0 SDK into limited release starting today

Tue, 08/31/2010 - 15:00
Palm fans, get your party hats on. Today the company is announcing the beta release of its SDK for webOS 2.0, which means we're getting dangerously close to a proper 2.0 release for devices. And who knows... maybe the phone-maker will decide to throw a new device our way to go along with the OS. But let's not get ahead of ourselves. Starting tomorrow, a select (though rather wide, says Palm) group of developers will be able to start toying around with the latest and greatest SDK for the company's mobile operating system, and it looks like the new software brings some tasty morsels to the table that you're definitely going to want to chow down on. We got the scoop directly from Palm on just exactly what kind of changes you'll be seeing in the first version of 2.0, and we've rounded them up in a neatly digestible form below, so read on after the break and get the full story.

Continue reading Palm puts webOS 2.0 SDK into limited release starting today

Palm puts webOS 2.0 SDK into limited release starting today originally appeared on Engadget on Tue, 31 Aug 2010 14:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | CommentsJoshua Topolsky00241996685294250995

Late But Essential Review

Sat, 08/28/2010 - 15:00

I read Michael Lewis’ The Big Short: Inside the Doomsday Machine months ago, and have been feeling guilty about not recommending it, because this material is sort of essential for anyone who would like to understand how our economy ended up in the toilet. Read on, not just for a (spoiler: positive) review, but for potentially time- and money-saving advice.

Sidebar: Michael Lewis

I should disclose that I’m a hopeless Michael Lewis fan; in my review of Moneyball I wrote “I suspect there may not be a greater living writer of reportorial non-fiction” and yes, I still suspect that. So you could either use my admitted bias to discount this review, or alternately join the club and next time you see a Lewis book in the airport bookstore, just grab it.

Sidebar: Maybe Don’t Read the Book

The book has its roots in a November 2008 piece in Portfolio magazine, The End. I’m not actually sure that the book is a better piece of work than the (much shorter) essay; and I am pretty sure that all the really important lessons of the book are there in The End.

Now if you enjoy Lewis’ narrative of this frankly-incredible-even-though-we-all-watched-it-happen story, you probably want to get the book, just because there’s room for more narrative and the rest is mostly just as good.

But considered as a work of the non-fiction writer’s art, I’d have to favor the shorter version for its ruthless focus and pace.

The Story

It’s simple enough; Lewis found individuals and partnerships (three in the book, one in the essay) who decided the mortgage bubble was bullshit far before most others did, and made gobs of money betting it would pop, and he walks us through their experience. Most of their time doing this was pretty stressful, because a lot of apparently-smart people were betting against them every step of the way and taking home millions doing so. Even when it all fell apart and they got paid it was stressful, because they understood the scale of the disaster before anyone else.

Anyhow, they’re interesting people, the financial tools used both for inflating the bubble and betting against it are interesting too, and Lewis can tell a story with the best of them. Unless you’re oblivious to recent economic history, you’ll like it.

Lesson 1

It’s one we should have learned already, long ago: The business of Finance is 100% about making big money for people in the business of Finance. Everything else is irrelevant. The party line is that it’s about routing capital from those who have it to those who need it in a maximally-efficient market-driven way. Hah hah hah.

There’s another legend that it’s about making money for investors. Double hah hah hah. If you’re an investor, it’s about them making bets with your money and if they lose you lose, if they win you get a few scraps and they get a bigger vacation home.

This really should not be surprising. There is apparently no social or ethical force that will cause people to bypass a chance to shovel money into their own pockets, without regard for catastrophic costs to their fellow-humans no matter how predictable. This needs to be an axiom in the thinking of all future regulatory planners.

Lesson 2

Of all the failures that led to the big meltdown, the most aggravating is the failure of the bond-rating agencies. These people took good money for pasting AAA credit ratings on piles of the most implausible shit imaginable, and what’s irritating isn’t that they did it, it’s that apparently they didn’t break any laws and thus there’s little prospect of the long prison terms that anything smelling of natural justice would require.

If you shared my blank, astonished “how could that happen?” reaction, you’ll probably enjoy Roger Lowenstein’s Triple-A Failure, published in April 2008 in the New York Times.

Once again, not surprising: having debt ratings paid for by the people issuing debt creates a huge conflict of interest, and per Lesson 1, any such conflicts will be taken advantage of by Finance insiders to fleece the sheep otherwise known as you and me.

Lesson 3

Finance’s relationship to the economy should best be considered by policymakers as that of a dangerous parasite to its host. Any benefits offered at the margin by its market-making functions are dwarfed by the existential threats it is empirically observed to pose, on a regular basis, to the proper functioning of the real economy.

An earlier draft had the word “real” in the previous sentence enclosed in quotes. I took them away, because it really is real, as opposed to Finance which, on the evidence, is the mostly-toxic product of pure imagination, imagination fevered by a lethal illness that the rest of us are in danger of catching.

I’d say Finance should be regulated into utility status all over the civilized world, and if the community of hard-core financial engineers really wants to go on being a collective pathogen, they’ll be forced to acknowledge that what they do just isn’t civilized behavior, and do it somewhere else. We’ll be way better off without them among us.

Vampires (Programmers) versus Werewolves (Sysadmins)

Fri, 08/27/2010 - 09:26

Kyle Brandt, a system administrator, asks Should Developers have Access to Production?

A question that comes up again and again in web development companies is:

"Should the developers have access to the production environment, and if they do, to what extent?"

My view on this is that as a whole they should have limited access to production. A little disclaimer before I attempt to justify this view is that this standpoint is in no way based on the perceived quality or attitude of the developers -- so please don't take it this way.

This is a tricky one for me to answer, because, well, I'm a developer. More specifically, I'm one of the developers Kyle is referring to. How do I know that? Because Kyle works for our company, Stack Overflow Internet Services Incorporated©®™. And Kyle is a great system administrator. How do I know that? Two reasons:

  1. He's one of the top Server Fault users.
  2. He had the audacity to write about this issue on the Server Fault blog.

From my perspective, the whole point of the company is to talk about what we're doing. Getting things done is important, of course, but we have to stop occasionally to write up what we're doing, how we're doing it, and why we're even doing it in the first place -- including all our doubts and misgivings and concerns. If we don't, we're cheating ourselves, and you guys, out of something much deeper. Yes, writing about what we're doing and explaining it to the community helps us focus. It lets our peers give us feedback. But most importantly of all, it lets anyone have the opportunity to learn from our many, many mistakes … and who knows, perhaps even the occasional success.

That's basically the entire philosophy behind our Stack Exchange Q&A network, too. Let's all talk about this stuff in public, so that we can teach each other how to get better at whatever the heck it is we love to do.

(Sometimes I get the feeling this idea makes my co-founder nervous, which I continually struggle to understand. If we don't walk the walk, why are we even doing this? But I digress.)

The saga of System Administrators versus Programmers is not a new one; I don't think I've ever worked at any company where these two factions weren't continually battling with each other in some form. It's truly an epic struggle, but to understand it, you have to appreciate that both System Administrators and Programmers have different, and perhaps complementary, supernatural powers.

Programmers are like vampires. They're frequently up all night, paler than death itself, and generally afraid of being exposed to daylight. Oh yes, and they tend think of themselves (or at least their code) as immortal.

System Administrators are like werewolves. They may look outwardly ordinary, but are incredibly strong, mostly invulnerable to stuff that would kill regular people -- and prone to strange transformations during a moon "outage".

Let me be very clear that just as Kyle respects programmers, I have a deep respect for system administrators:

Although there is certainly some crossover, we believe that the programming community and the IT/sysadmin community are different beasts. Just because you're a hotshot programmer doesn't mean you have mastered networking and server configuration. And I've met a few sysadmins who could script circles around my code. That's why Server Fault gets its own domain, user profiles, and reputation system.

Different "beasts" indeed.

Anyway, if you're looking for a one size fits all answer to the question of how much access programmers should have to production environments, I'm sorry, I can't give you one. Every company is different, every team is different. I know, it's a sucky answer, but it depends.

However, as anyone who has watched the latest season of True Blood (or, God help us all, the Twilight Eclipse movie) can attest, there are ways for vampires and werewolves to work together. In a healthy team, everyone feels their abilities are being used and not squandered.

On our team, we're all fair-to-middling sysadmins. But there are a million things to do, and having a professional sysadmin means we can focus on the programming while the networking, hardware, and operational stuff gets a whole lot more TLC and far better (read: non-hacky) processes put in place. We're happy to refocus our efforts on what we're expert at, and let Kyle put his skills to work in areas that he's expert at. Now, that said, we don't want to cede full access to the production servers -- but there's a happy middle ground where our access becomes infrequent and minor over time, except in the hopefully rare event of an all hands on deck emergency.

The art of managing vampires and werewolves, I think, is to ensure that they spend their time not fighting amongst themselves, but instead, using those supernatural powers together to achieve a common goal they could not otherwise. In my experience, when programmers and system administrators fight, it's because they're bored. You haven't given them a sufficiently daunting task, one that requires the full combined use of their unique skills to achieve.

Remember, it's not vampires versus werewolves. It's vampires and werewolves.

[advertisement] JIRA Studio - SVN hosting, issue tracking, CI and Google Apps integration. Free trial »

(author unknown)13345519443336942279054495843877525615870591347365873228225704789780218355940157103300030384966378671667545755742622521903911420922383773120061575019810698619630496223524196460909709169809340965372499110424438708058564631720295927381757364209047600930574429815112554872001671708601241160506215811766415599552031804552073159710037071734432930623236970833604934317788135283534745309068276887873606537051274847597774819326910065689251771835886182136322037469030450749141204501697859707197838708203143828029280293025352988770501397612889676772215784045441835069158064650544651970639630042320503005318183708690838890501961878079648010130037786300270003891842945584508915834275668816438059244293389274689781154854662758131139909672041804595895303153985914893534125241583160307057638539403566572875710457118055590628626691732020584567357366249917902587239214294730682033566227243161922180817441402330350937309250466072926724282174521723845679361910459149314368916461110440489522814240470156880410285435052500409156360606579224018023438169920072713112429386897083146501586132108417340191610365744210337260297009644210150436147410444495911601343346600606760471676690516025859887196610230881108575079185030029212739052642024080619183611263934748274940812822188111481838617598174124210320466154935050743706619850295661303121876381002312042911823059098142080629319191311311824919089162414330508079598114896223548146052545730596353851207778696849211367210401255636016345539129945879749058352820845973546279416610212701376001804235794026814134226889397851132096370970992977313698421821838533989011707411986540192751619717314227262659418221096189467971546116047839158262729371806310384309777949007132639796973331865020768849783689785721285859230603858174201135089225884630042053714077557464119790394204119047963778701014446539998601099145666816816852791660178033222270656862205262567316137078845151421051558671679441116729532977400280613079015803360268902109722061571571504190013385711859771772412337431559872980393

Drupal as a URL Shortener

Tue, 08/24/2010 - 10:40
Announcing Lullabot's short URL site: lb.cm

URL shorteners are the bane of the internet. However, for those of us who use Twitter on a regular basis, you know that 140 characters can be limiting. URLs can theoretically be 2,000 characters or more, but most are in the 40 to 80 character range. That's almost half your tweet! So we use URL shorteners to not only shorten the URLs, but (in the case of some services like Bit.ly) to track clicks and get statistics about who clicked on these short URLs.

The problem, however, with the popular URL services is that the more that they are used, the longer their URLs get. Both Bit.ly and Tiny.cc are up to 6 characters in their autogenerated URL paths. Add in the URL protocol (http://), the hostname (bit.ly) and the initial slash, and you've got minimum 20 character URLs.

So why use someone else's short URL service, when you can create your own, branded, shorter short URL service with URLs like lb.cm/a or jen.cm/j? A branded URL shortener can also be a sign of prestige or add a layer of trust. For instance, Flickr's URL shortener, flic.kr only links to Flickr photos. When you click on a flic.kr URL, you know what you're going to get. Google has a similar service with goo.gl and WordPress has recently launched wp.me. Even if you open it up for the public to use, as we have with lb.cm, there's just a certain geek prestige in having your own URL shortener.

Why Drupal?

So why use Drupal as a URL shortener? There are several single-purpose stand-alone Open Source URL shorteners out there already. And Drupal is sometimes criticized as being big and slow. URL shorteners need to be small and fast. On the other hand, we're not really expecting bit.ly-level traffic here, are we? Maybe we can consider Drupal.

jeff

Geodesic tomato suspension dome

Sun, 08/22/2010 - 12:50

Ever since I saw tomatoes growing in a greenhouse that had a suspension system to hoist them up, I’ve wanted to do something like that. I’ve also been wanting to make a structure using Starplate connectors. This year the two ideas came together to create a tomato suspension dome.

The structure

The kit

The Starplate kit is just 11 metal plates that accept 2-by-3s or 2-by-4s on edge, like so:

I used 8-foot 2-by-3s. Around the edge of the pentagonal base I planted peas, pole beans, and morning glories. Inside, it was all tomatoes and basil. Although I used indeterminate vines, they didn’t reach as high as I’d imagined. So I never had to climb a ladder to pick tomatoes.

The big question in my mind was how to hoist the tomatoes. I ended up putting eyehooks into the upper struts, spaced about 18″ apart, and running string through them to form concentric pentagons descending from the peak. Then I could toss the weighted end of a string up and over to make a pulley anywhere in the enclosure.

Suspension

Here’s the suspension method:

It entails:

  1. Wrapping a loop of tomato velcro around the vine
  2. Tying one end of string to the loop
  3. Running the other end up over a skyhook, down through the loop, and back up six inches or so
  4. Hoisting the vine
  5. Tying the end into a slipknot around the pair of strings

Every couple of weeks, as the vines grew, I’d detach the collar, raise it up, reattach, and hoist.

Outcomes

The peas and beans did OK, but were happier in other parts of the garden. The tomatoes rocked. I’m not ambitious enough to do any real canning, but here’s one happy outcome: 6 quarts of fresh salsa and a couple of gallons of juice infused with jalapenos, serranos, and poblanos.

Another outcome: oven-dried tomatoes. These are just like sun-dried except they only take 12 hours in the oven at 200 instead of days in the sun.

The salsa was a ton of work but oven drying is dead easy. I’ve got a lot more tomatoes still to come, and this the future for many of them.

Next year

Things to do differently:

  1. Start the morning glories sooner. When the peas and beans didn’t cooperate, I wanted another use for all the height I’d created, but the morning glories got a late start.
  2. Abandon netting. Part of the problem with the peas and beans was that I hung netting for them to climb. Bad idea. Next time, I’ll just dangle a bunch of strings.
  3. In late winter, dump in manure to generate heat and enclose with plastic to create a greenhouse.
Is this really practical?

Probably not. If you’ve ever been bitten by the dome bug, it’s just something you have to get out of your system sooner or later. Domes are preposterous structures, really, as Stewart Brand pointed out hilariously in How buildings learn. There’s a reason why we build rectangularly: You can use standard materials, you can expand outward, you can use interior space efficiently. Domes create big structures from small amounts of material, but they’re not very practical structures. There are surely easier ways to hoist tomatoes. Still, it’s been fun!


Five Hours

Fri, 08/13/2010 - 02:48

I spent five hours with him once; another scared parent watching his son prepare to go to war. We talked, controlling our feelings, reassuring each other and together my wife, as the men who we saw as boys did what they needed to do. I took some pictures, he snapped one on his cell phone. And they were gone, and we went to our hotels and homes and on with our lives.

And then a line of text on my screen. In my alerts. I've got a dozen of them, alerting me to anything on the web that might be about my son, and my phone shakes or my email box slowly fills up with news, and to be honest not much of it's been good. And then it was very bad as I saw a name that I recognized, a name on a tape on the chest of a young man who wasn't my son but who my son had talked about when we spoke on the satphone.

I swore, I'll admit.

And I went through the channels and got his father's email and sent him one, saying "I remember..." and didn't expect anything back and nothing came. And we got a card and waited, because if it had been me, I'd have been burning the cards for a while until the rage died down. And we waited and sent the card and I put my number on it and said "call me anytime." And he did.

I was in a meeting when my phone buzzed, and I pulled it out to swipe the call away to voicemail and noted the odd area code. And it rang again, same number and I remembered that the area code was from where he lived and I said "sorry" and walked out, turned and went into the bathroom and said "It's me" and he said his name and suddenly I couldn't breathe very well, and just listened.

To be honest, I started to cry, and walked out into the elevator and downstairs into the parking lot and the Beverly Hills sun where we could talk and swear and cry together. Someone from the meeting came out to check on me and I waved them away.

And we talked and made plans to talk again and then I had to go work. And he hung up and I leaned over the trash can and wondered if I was going to throw up.

We spent five hours together a year ago, and suddenly I feel like I have another brother - someone who is tied to me and to whom I'm tied - for the rest of my life.

I straightened myself up and walked back to the elevator and reminded myself that when I'm thinking about politics and theories, and this is what the pieces look like: two fathers, one sad and one in grief, and two sons. And went back to work.
-

Five Hours

Fri, 08/13/2010 - 02:48

I spent five hours with him once; another scared parent watching his son prepare to go to war. We talked, controlling our feelings, reassuring each other and together my wife, as the men who we saw as boys did what they needed to do. I took some pictures, he snapped one on his cell phone. And they were gone, and we went to our hotels and homes and on with our lives.

And then a line of text on my screen. In my alerts. I've got a dozen of them, alerting me to anything on the web that might be about my son, and my phone shakes or my email box slowly fills up with news, and to be honest not much of it's been good. And then it was very bad as I saw a name that I recognized, a name on a tape on the chest of a young man who wasn't my son but who my son had talked about when we spoke on the satphone.

I swore, I'll admit.

And I went through the channels and got his father's email and sent him one, saying "I remember..." and didn't expect anything back and nothing came. And we got a card and waited, because if it had been me, I'd have been burning the cards for a while until the rage died down. And we waited and sent the card and I put my number on it and said "call me anytime." And he did.

I was in a meeting when my phone buzzed, and I pulled it out to swipe the call away to voicemail and noted the odd area code. And it rang again, same number and I remembered that the area code was from where he lived and I said "sorry" and walked out, turned and went into the bathroom and said "It's me" and he said his name and suddenly I couldn't breathe very well, and just listened.

To be honest, I started to cry, and walked out into the elevator and downstairs into the parking lot and the Beverly Hills sun where we could talk and swear and cry together. Someone from the meeting came out to check on me and I waved them away.

And we talked and made plans to talk again and then I had to go work. And he hung up and I leaned over the trash can and wondered if I was going to throw up.

We spent five hours together a year ago, and suddenly I feel like I have another brother - someone who is tied to me and to whom I'm tied - for the rest of my life.

I straightened myself up and walked back to the elevator and reminded myself that when I'm thinking about politics and theories, and this is what the pieces look like: two fathers, one sad and one in grief, and two sons. And went back to work.
-

For more in the "What do they know?" department...

Mon, 08/09/2010 - 15:46
I shared with you last week Google's Social Circle, to demonstrate how Google maps you're social network. You can also see all the data Google keeps on you here. Make of it what you will.

Head Count Fiction

Thu, 07/29/2010 - 15:00

When conference organizers count people, the number they care about most is registered paying attendees; they track that every day as the conference approaches. Suppose you are an outsider, considering attending or sponsoring or exhibiting at the conference, and you inquire as to the likely attendance. You will never be given the real number; instead you will be told a number which is at least twice that, and usually higher. This is justified by including trade-show exhibitors’ staff, the conference organizer’s own people, PR folk and journalists, the food service crew, and is basically pulled out of a monkey’s butt. Just thought you’d like to know.

How to extend Notes 8: coupling text selection to Java action

Mon, 07/26/2010 - 06:23

I get so many question on how to extend Notes 8 that I finally decided to create a series of blog posts on how to do it. All the posts in the series may be found under the extending_notes8 tag. In all of the examples I assume a working knowledge of Eclipse and Java programming and how to work with extension points.

For this first post I'll touch on one of my favorite features of Notes 8 that is MyWidgets and LiveText. From the user interface you may create a number of widget types (web, Notes etc.) that act on selected text but what if you wanted to perform an action that didn't lend itself to one of these widget types? What if you wanted to couple text selection to a Java action? Well look no further. In this post I'll show you how to combine the org.eclipse.ui.popupMenus extension point with a org.eclipse.jface.text.ITextSelection object contribution to do what is transparently done using MyWidgets.

Let me preface this by saying that it's still far easier to do this using MyWidgets but still this isn't rocket science.

To accomplish this task you'll need two pieces. First of you need the code to execute. This is done using an action class that implements org.eclipse.ui.IObjectActionDelegate. This means you need to implement three methods:

  • public void setActivePart(IAction action, IWorkbenchPart part)
    Called when what's called the part is changed in Eclipse. You can leave this method blank.
  • public void selectionChanged(IAction action, ISelection selection)
    Called when you select some text in the Notes client and select your action. The purpose of this method is to extract the selected text and make it available to the run method (see below).
  • public void run(IAction action)
    This is the workhorse of the class and it's called whenever the action is selected from the context menu. The action will act on the selected text you extracted in the selectionChanged method.

The run-method isn't as interesting as it just performs the action. The method is called in the UI thread. The selectionChanged-method is more fun as this is where you extract the selected text. Below is a snippet of code on how to do it.

public void selectionChanged(IAction action, ISelection selection) { StructuredSelection sel = (StructuredSelection)selection; try { IAdapterManager amgr = Platform.getAdapterManager(); Object obj1 = sel.getFirstElement(); Object obj2 = amgr.getAdapter(obj1, ITextSelection.class); if (obj2 instanceof org.eclipse.jface.text.ITextSelection) { ITextSelection txtSelection = (ITextSelection)obj2; this.selection = txtSelection.getText(); } } catch (Throwable t) { this.selection = null; } }

The second piece to the puzzle is to tell the platform when you would like your action to be listed ie. when select is selected. This is done in the plugin.xml using the org.eclipse.ui.popupMenus extension point and by doing an object contribution as shown below. The italic text (the id's and the action label) may be changed to your liking. The bold/italic text is the class name of your action which should be changed to match your action class.

<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.popupMenus"> <objectContribution id="com.lekkimworld.textsel.objectContribution1" objectClass="org.eclipse.jface.text.ITextSelection"> <action class="com.lekkimworld.textsel.SelectionAction" enablesFor="*" id="com.lekkimworld.textsel.action1" label="Perform action from selected text"> </action> </objectContribution> </extension> </plugin>

The next post (which will be published tomorrow) will show you how to act upon LiveText that is couple your Java action to text that the Notes client recognizes and highlights for you. Stay tuned...

(author unknown)

Assembling Pages with Drupal

Sat, 07/17/2010 - 02:00
Blocks vs. Context vs. Panels

As with many facets of Drupal, and coding in general, there are multiple ways to accomplish the same task. A good exmple of this was with the recent additions to the Lullabot team. The expanded team brought together three skilled developers and an amazing designer each with their own methods of site building. On one side we have Jerad Bitner and myself, who for the past few years have been building sites exclusively with Panels module. On the other side we have James Sansbury and Jared Ponchot who also build beautiful sites using the more recent Context module.

Our first collaboration was the redesign of Lullabot.com, since this project was initially designed and scoped by James and Jared, the decision to use Context module was already in place. I was in no rush to learn Context, when I knew the same result could be achieved with Panels. Lucky for me James and Jared are both excellent resources for answering questions and giving great examples. Now that the project is complete I have a better understanding of Context module. This article is intended to identify the similarities, differences, pros and cons of using each module to build a Drupal website.

dave

The growing empire of Stack Exchange

Fri, 07/16/2010 - 21:57

We launched three new Stack Exchange sites this week!

We’ll have three more for you next week, too.

Need to hire a really great programmer? Want a job that doesn't drive you crazy? Visit the Joel on Software Job Board: Great software jobs, great people.

Joel Spolsky1408879050626390430106405729912562463760098177979502426685210581455473148430343903801761260999623005030276774808047905490020795170090824043211877129783530419051035772812907621228681678916573994447203917072657407905682479076992409743403153550344909058573806303110373899759076777721084396694657995141400269596067416318895416716557904205785744003337139735612256111462137315376507677312062102046146266200045898479825849149830609167081937334632512749119725897205467023271954997522281300370435170520915948018221096189467971546052447507238517468440065185516264837899711202780556576183488112772420570333416210548074017483505458717222735332394573116075676011876763333500123388775544362399502516243541824287120093947138659904455481294752560287223933600923267311484067730123374315598729803931166448845922923998013742359704896557530115667897002645250620989878931173629617013251790576554864262183172319674823220351131669497072589421405555732295665518113169413040697063191751008784134274218275918439447457438969707018163609559946098750724560964993263844315641278962218785911

Geertjan's Blog: Eclipse in a NetBeans Tutorial?

Fri, 07/16/2010 - 17:34
I've completed the draft of a small scenario that will form the basis of a new NetBeans Platform tutorial. The tutorial will have, as one of its first steps, the instruction to start up Eclipse! You will then use Eclipse to model a small scenario, creating a Supplier object with multiple Product objects:

Then, you will be told how to import the EMF-related OSGi bundles into a new NetBeans Platform application. As a next step, you will create a new module and copy the classes generated by Eclipse (e.g., the Supplier and Product classes, together with their supporting classes) into the new module. Finally, you'll create a second module where the suppliers and products will be created and displayed:

That tutorial will, in the end, provide full instructions on a very common need—the need of EMF models to be handled within Swing applications. With NetBeans Platform 6.9, that process is now seamless. It's as easy to import an OSGi bundle as it is to import any other JAR file, while Equinox integration into NetBeans Platform applications ensures that the OSGi framework checks all the dependencies between the bundles when the application starts up. Currently I have all the dependencies correctly set up, the above application now deploys without a single problem message being generated by Equinox. Pretty cool.

In other news. If you understand German, take a look at Michael Müller's new review of Heiko Böck's NetBeans Platform 6.

(author unknown)

Big mystery holding back practical superconductors may have been solved [Mad Science]

Thu, 07/15/2010 - 20:40
Superconductors carry electric current with no energy loss. They could revolutionize our electrical grid, but they only work at impractically low temperatures. We just figured out a key reason why – and possibly got a lot closer to room-temperature superconductors. More »


Alasdair Wilkins1070951846444210176806633764103693081724

Adding Eclipse plugins to your Lotus Notes installs

Thu, 07/15/2010 - 08:00

Many may not know this but you can optimize your install kits prior to deploying the new Notes 8.5 client.  Check out the Domino Administrator help for how to use the addToKit tool to have Eclipse features and plug-ins automatically installed when the product is installed.  This is a great way to deploy plug-ins without using things like Widgets or Composite Applications which would require the end user to restart the Notes process.

Link to help here.

BIRT and OLAP

Wed, 07/14/2010 - 11:56
BIRT Introduced OLAP style data cubes and crosstabs in version 2.2 and while they have been around for some time we still get a lot of questions on how to use and manipulate them. Below are just some of the resources that have been posted to BIRT Exchange that should help you with cubes and crosstabs.

Introduction Resources
To get an idea of what a BIRT cube is and how to tie it to a crosstab report item, take a look at this article which provides a detailed write-up of the technology and supplies some examples.

To see a recorded demonstration of a crosstab style report being build see this tutorial video.

Event Based Scripting Resources
BIRT provides event based server side scripting for almost all report items, including crosstabs. A detailed blog post is available here with an example that demonstrates implementing a crosstab with event handler script.



Client Side Crosstab Scripting
BIRT supplies a Text report item that allows formatted HTML to be inserted into BIRT reports. Text elements can also be used to insert client side script that will execute while viewing the report in HTML. The Text element can be used in conjunction with a crosstab to add client side script to the crosstab. As an example of this take a look at these on BIRT Exchange. One of the examples animates the crosstab by iteratively changing the background color of a cell based on its value while the other inserts mouse over events to highlight specific cells.



Using the DE API in conjunction with a Crosstab
The BIRT Project provides the Design Engine (DE API) to construct report, template and library designs. This API is used by the designer when building BIRT content. Not only can this API be used in a Java project but can be called from a Java/Java Script event handler to modify a currently running report. There are many examples of this on BIRT Exchange. A couple of examples that are relevant to cubes and crosstabs are listed below.

This example uses report parameters and a beforeFactory JavaScript event to change the sort order for a crosstab.



Another example of using this approach is located here. This example contains a report with no graphical content, but does contain a datasource, dataset, and data cube. It uses report parameters and a beforeFactory JavaScript event to construct a crosstab based on the parameters.


Building a crosstab with the API
If you are using the DE API to create reports from your Java application and wish to add crosstabs to your reports this example illustrates building a data cube and adding a crosstab to a report using the API.

Extended Capabilities
If you are interested in further capabilities, Actuate 11 which will be released this fall, provides a new feature called the Actuate BIRT Data Analyzer. This product is a zero footprint browser based BIRT cube analyzer. It can be used with existing BIRT reports that contain cubes to add, modify, re-order, or remove dimensions and measures without having to re-execute the report.



In addition to the above, the Data Analyzer can be used to pivot, filter, sort, and add computed measures and aggregates to the crosstab, all from within the browser without re-executing the report.



If you are interested in trying out this feature download the latest milestone build of the Actuate BIRT Report Designer from the milestone build page.

Google App Inventor Eclipse Plugin

Wed, 07/14/2010 - 03:55
Hey, in case you missed it, here it is - the App Inventor plugin for easily making Android apps straight from your favourite IDE.



Together with git, task management and debugger now you can make not only silly kitty apps, but something bigger too :-)

See it in action: (embedded Youtube video below)




..hm so wouldn't that be easy with web plugins?

Flightglobal&#39;s Tree of Communication: What are... pipes?

Thu, 07/08/2010 - 19:00

Flightglobal's Tree of Communication explains how a digital publisher reports news and shows how facts, opinion and analysis can be communicated through the modern web.

Yahoo! Pipes is a web application that provides users with the opportunity to create their own data mashups and RSS feeds that aggregate the web pages, feeds and services of their choice, eg Flickr images, blog posts and latest stories are collated into one RSS feed.

The user can "pipe" these feeds to create something appropriate for their own purposes eg adding it to their Facebook profile page thereby sharing this information with their friends.