My NetBeans Favorite Five

NetBeans 8.2 is out, multiple cursors and all, so it’s a fitting occasion to post my five favorite features. First, some background to avoid making a just-downloaded-an-went-a-bloggin’ impression: I’ve been working daily with NetBeans since version 6 (so this post has been brewing for a while). I mostly work with Java (core, Java EE and some Swing) and with HTML/Javascript. I’ve also used NetBeans for Markdown, Scala, PlantUml, Sphinx, Python, Ruby, and making coffee. OK, forget the Ruby part.

When joining the data science team at the Institute of Quantitative Social Science at Harvard, I was happy to see they were using NetBeans as well. Dataverse, our institutional data repository system, is based on Java EE and is developed with NetBeans. It’s currently more than 97K lines of open-source code*. So you can see I have some milage using this tool.

BTW, I’ve worked with the common alternatives (both paid and free) but somehow I always come back to NetBeans. I guess I just don’t like my code being eclipsed.

OK, OK, no need to throw a BadPunException. Let’s get to it:

Little Comforts/Going the Extra Mile

Such as the suggested variable names, auto-pasting traces to the stack trace analyzer, the fact that the stack trace analyzer exists, “view differences” in the Unit testing result pane, get + code-completion generates the proper getter (there’s also a setter, of course).
And then there are the top-of-block popup and the file-too-long label. Love these.

top-of-block extended-label

Additionally, NetBeans includes the required stuff out of the proverbial box. JUnit, Git etc. No need to install manually and decide between various conflicting versions of third party plugins.

Project Groups

Switch quickly between groups of projects. Or, really, working contexts. Since I have a few separate contexts I’m working on in parallel, this feature is a huge timesaver.

Great Java (+EE) and Javascript Support

Great language support for Java (including the next version). Very good Javascript support as well. The code warnings are useful, and the “convert to functional operation” refactoring had taught me some new Java 8 features I was not aware of.

Good support for Java EE features, such as integration and plugins (JPQ modeler etc.). Integration with application servers etc. is easy. There’s also Docker integration, I hear. I’m not using Docker currently. I hope I can still keep my developer license.

Not reinventing the wheel

For example, using Apace ant at the core of the native project type make these projects useful outside of NetBeans too (an anti-vendor-lock-in vendor!).

It Just Works

It does. Srsly. It’s a very dependable tool. And I’m looking forward to seeing it graduating from its Apache incubator.

 

 

*  Count generated using David A. Wheeler’s ‘SLOCCount’.

Lessons learned by a frugal hacktivist

There’s a compulsory biometric database being built in Israel. It’s bad, but it’s not the point of this post. I’m taking part in some civilian effort to stop it, and part of this is having a website. So we built one. For free. Here it is. And here is what I learned, divided to non-technical and rather technical points.

Non-technical:

  • We wanted a good looking, fast website. As the government employes paid commenters, we didn’t want any talkback options.
  • We have some people that can build websites (me, but not just me). However, we’re all busy.
  • The website had to be updated periodically, but not too often.
  • We are a voluntary organization, and we don’t have any money.

While we were aware of standard options, such as opening a wordpress blog or a Facebook page, we decided to go with a static web site, hosted as a github project page. The motivation was that this would generate a very fast website, and we could get all the design flexibility we need (canned solutions are not that flexible, really).

However, keep in mind that github project pages come with some strings attached. The website has to be open-source, or pay for the hosting, and no server-side processing can occur. This means any updates to the site require some technical skills.

For hacktivism, the open source string may be a real issue. If you spend a lot of time creating a web site, and you don’t want the other side to just fork it and create their own version. You may want to keep your source closed. We didn’t have this issue, as the biometric database already has web presence, as well as TV commercials, posters, etc.

So far, which is not very far really, the choice for static website seems good. Here are the technicalities. The main goal was to get something done fast, but at a high quality.

Site generator

We went with harp.js. While jekyll looks like a more natural choice for github, it is not as flexible as harp. Jekyll assume you are writing a blog. Harp has a more holistic approach, and also supports lesscss (and many other languages). I already had experience with jekyll (earned while doing this site) but decided to try harp and have jekyll as a “plan b”. All in all this worked.

Front end

Bootstrap3. You can’t beat the king.

Content Generation

Here’s where Jekyll is better than Harp – we wanted to generate a list of links, display a list of them and give each one a page. Jekyll would have done this out of the box, if we would have treated each link as a post. Harp requires having a file for each page in the site, which meant we had to maintain the json map and a set of files, and make sure each key in the map has a file named after it. Not fun and error prone. Well, bash to the rescue:


cat _data.json | jq keys | grep \\w | cut -d\" -f2 | xargs -I{} touch {}.md

This line ensures that each key has a file with corresponding name. If the file already exists, it is not overridden, which is important if someone wanted to add additional data to the to a link’s page.

Issues

  • Contact forms require a back-end to process the input, and static sites don’t have any back-end. There are ways of doing them, e.g. using google forms. We address this soon, but currently we’re happy to use github issues, which also works. Also, you can use a mailto link, but you’ll be facing another set of issues there.
  • As always, collaborating using github is a pleasure.
  • When other people fork your site, they shouldn’t call their branch “gh-pages” – it makes the CNAME files collide. Only have a single branch with this name.

Conclusion

When needing a website that does not take data from users, static websites may be a good choice. If you can keep your source open, hosting them as github project pages is a fast solution that’s free and easy, as long as you have people with technical skills available. If you have some cause you’re trying to push, you can fork us on gihub.

Oh, and if you want to learn about the biometric data base in Israel and you don’t read Hebrew – we have a site for this.

Draw More, Work Less

Below are the slides for a talk I gave at IQSS about software tools that generate diagrams. Two examples are shown – GraphViz and PlantUML.
I was hoping to show that focusing on the semantic level of the diagram (e.g. structure, relations) and letting the computer decide on the actual layout can make life easier. I know I use these tool quite often.

Anyway, the slides are below. The files for most diagrams can be found here.

Geek Dad #12FFA: Cowsay

The summer vacation is upon us, and with it, the need for kids to not be bored (or is it the need for the parents to have kids that are not bored?). Coloring pictures is a nice pastime, and you can always find a lot of coloring images by going to google images and limiting the search to line art only.

But, does it educate your kids to be better geeks? Does it tickle their imagination? Not really, no. Well, what is a geek dad to do?

 _________________________ 
< Lets color ascii art!!  >
 ------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Cowsay is a lovely little program written by Tony Monroe. It allows you to quickly create ascii art of cows saying things. And it’s not limited to cows, there is also tux, a bunny, a koala and various other images, which can be listed with cowsay --list. Do not pipe the --list result to a loop and create all the images, as some are NSFW, (or, NSFK, in this case).
Also, it’s not limited to saying things either: there’s also cowthink.

And thus:
10 Kid: Dad, can I color a cow?
20 Dad: cowsay please color me\! | lpr
30 Kid: <coloring happily>
40 GOTO 10

cowsay is available for most platforms. On linux it’s available through the package manager. On OS X, it’s available through brew.