Pencils Down

This weblog is about my experiences in software development

Browsing Posts tagged Software Tools

FindBugs is a program which uses static analysis to look for bugs in Java code.

It is offered as an Eclipse plugin. So, just like any other plugin:

  • right click on the item(s) you want to check,
  • click on “FindBugs” and
  • off you go.

Some of the issues that have come up for me:

  • use of static SimpleDateFormat – it’s not thread safe – who knew?
  • new coding did not have a setter for a dao – hopefully testing would have shown the error
  • compares on different object types – the code looked correct, but oh oh…

I love things that just work

Just saw that Java 8 fixes the date problem – http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html

Share

VerbalExpressions

No comments

VerbalExpressions is a library available on GITHUB for Java,C++,PHP…

It allows you to build an expression using a VerbalExpressions object.  The example from this site is below (showing Java but very similar in other languages).

VerbalExpression testRegex = new VerbalExpression ()
                                 .startOfLine()
                                 .then("http")
                                 .maybe("s")
                                 .then("://")
                                 .maybe("www.")
                                 .anythingBut(" ")
                                 .endOfLine();

// Create an example URL
String url = "https://www.google.com";

// Use VerbalExpression's testExact() method to test if the entire string matches
// the regex
testRegex.testExact(url); //True

testRegex.toString(); // Ouputs the regex used:
                      // ^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$

VerbalExpression testRegex = new VerbalExpression ()
                                 .startOfLine()
                                 .then("abc")
                                 .or("def");

String testString = "defzzz";

//Use VerbalExpression's test() method to test if parts if the string match the regex
testRegex.test(testString); //true
testRegex.testExact(testString); //false
Share

How many programming tools have you tried using that really didn’t quite do what they were supposed to do?  Well, you are in luck!  BlazeMeter works!

You can sign up for a 7 day free trial at blazemeter.com.  Just upload you JMX file and you can be running in minutes.  We had a particular problem where the test script was running on a developer machine and was hampered by whatever happened on that machine: memory swaps, priority alerts coming up, developer doing something useful – while the test was running.

With blazemeter your script is distributed amongst a set of cloud servers with ultimate bandwidth and memory and you see none of the issues.  In our case we ran across a consistent 30% failure rate dropping down to 1%.

The only trick is that you have NO interaction with jmeter.  Everything your script needs has to be in the local directory with the JMX file.  In our case we had a CSV file for user ids.  A small change to the script to not specify the path of the CSV file worked easily.

More interesting was providing the jks file and the password to access.  Using the user interface you would normally just specify the jks file using the menu option.  There is no jmeter UI when your script runs.  All that info has to be provided using a system.properties file (in the local directory), like:

javax.net.ssl.keyStore=keystore.jks
javax.net.ssl.keyStorePassword=password

The site/tool does provide a really interesting graphical display of the characteristics of your test.  You can dynamically change the axes displayed using buttons on screen.

I have to tell you: when I first ran my script I really couldn’t believe it worked so easily.  Such a treat to do the expected steps (above) and the thing just works.

If you decide to go forward and pay for use it’s very affordable.  Again, just the ease of use makes life so much easier.

Share

In depth view of tumblr here.  Short overview:

- 15 BILLION page views a month

- 500 MILLION page views per day

- Some parts of architecture running at 40 THOUSAND requests per SECOND.

Humbling.   Of course the author sounds as calm as can be.

Share

Working with a client where the designer they hired produced a nice looking design.  However, even though promising to just use standard fonts there are a couple of very conspicuous parts of the design that use non-standard fonts.  Sound familiar?

Google to the rescue! (I don’t know how they control what people spend time/money developing)  I saw a reference to Google Fonts in a HN post the other day.  What’s that?

Google Web Fonts provides high-quality web fonts that you can include in your pages using the Google Web Fonts API.

Just like everything else you can use google for, (especially CDN access to includes and the like) you can make reference to some non-standard font in the Google font set and then use it pretty much like any other font in CSS (have to quote the font name versus plain text(=standard font)).  Again, with their simple example:

<html>

<head>

<link rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=Tangerine”>

<style>

body {

font-family: ‘Tangerine’, serif;

font-size: 48px;

}

</style>

</head>

<body>

<div>Making the Web Beautiful!</div>

</body>

</html>

So, next time you are graced with a design present you can just smile.

Share

http://www.chengyinliu.com/whatfont.html

Simple: point and click

Share

Codify is used to develop apps for the iPad on the iPad!  The integration of touch with the editor is astounding.  If only Eclipse did something even close to this for us mere mortals…

Oh, I forgot, one more thing: price is $7.99.

Share

Neato company has a patent pending process for re-compressing JPEG files. Looks like 75% or better reduction in size for average JPEGS with no loss. Hopefully companies like GIMP will sign up.

http://www.jpegmini.com/main/home

Share

EasyMock, like other JUnit mock testers, allows you to set expectations for method calls on the mocked object.  However, the expect() method wants to see a return type from the method call.  So, what to do?

A built-in mechanism of EasyMocks is to just “call” the void method in question.  For example a commonly mocked object is the HttpSession:

    expect(request.getSession()).andReturn(session);
    expect(session.getAttribute(name)).andReturn(null);
    session.setAttribute(eq(name), isA(InSession.class));
    replay(session);
    //whatever you are really trying to test
    verify(session);

Could only be easier if the doc told you this clearly.

Share

WebDAV Rules

No comments

I guess I have been living under a rock for several years and never noticed WebDAV.  Or maybe I heard about it and thought yet-another-web-standard.  WebDAV is Distributed Authoring and Versioning.  Techie speak for keeping versions of stuff on a simple web server.  Yes, just builds on top of everyday HTTP.  It’s everywhere: Microsoft SharePoint, several hundred independent share-ware vendors, and more than a few version control systems use it as a base.

Of course you need something to talk to the server.  Click on a document under WebDAV control and down comes the document with a MIME type.  If the associated editor is WebDAV-enabled it will take immediately attempt to talk back to the server to see if it is a WebDAV server.  Again, Microsoft to the rescue with the entire Office suite and many of your other favorites.

Then some smart guys looked at the V in WebDAV and decided to take a gamble.  Presto, a version control system sitting there with almost no work.  (Yes, I know there is more to it)

WebDAV should be a favorite of IT staff everywhere: they can toss whatever home-grown CMS that gives them nightmares and just install SharePoint.  I think MS is being treated as an enterprise player these days.  Maybe.

Lastly are the developer shops with a proprietary product that kinda, sorta does WebDAV things.  Maybe they have been living under a rock as well.  More likely the idea of ripping apart their product and replacing it with something from Microsoft gives them nightmares.

I think I need to look at job descriptions for other things that should be in my toolkit versus just keyword match on stuff I already know.

Share