The other day, I wanted to find out if a function had ever existed in a file I was looking at. So, I brought up the history view, and started browsing through the various versions.
After the 3rd one, I figured there must be a better way…. then I remembered the DataMine feature of TortoiseHG (which I imagine is using Mercurial’s grep command).
So, enter my search criteria, and a file search patter. Do a search and up pops a list of files, lines and changesets that contain that information, throughout the entire history.
Obviously, this could be slow with a really broad search, but generally, it’s quite quick. Definitely much faster than manually searching throough all the revisions of a file.
The conference was excellent.
The VMWare acquisition seems like it will be good for SpringSource. They want it to broaden their product offerings, and don’t have anything that directly competes. Beginning entry into Cloud computing with Cloud Foundry. You can either use it hosted by them, or install it in your own server room. All attendees will receive 48 hours of credit for use of Cloud Foundry, so I will definitely be experimenting.
Rolling out more developer editions of tools to entice us developers to use their tools. SpringSource Tool Suite is now free, and incorporates additions for their entire line. It even has a deployment tool for Cloud Foundry.
They are actively developing the Groovy/Grails Eclipse plugin as well, and are making great headway here. At the conference, the developer had a very interesting presentation on the difficulties of integrating the Groovy compiler with the Eclipse JDT compiler.
tc Server now has a developer’s edition too. In combination with the SpringSource Tool Suite, and Spring Insight, allows for digging into the actions an app took, and how long each step took. Have to do some investigation to see how well this works with a minimally Spring based app, as they used a Grails app for the demo.
Spent most of my time on the 2GX side of the conference. Decided to take the opportunity to learn more about this. Very interested in Groovy, especially since it interacts very nicely with Java. Several presentations on using Groovy to write tests for Java code, and some of the benefits possible as a result. Groovy (like other languages that are dynamic, and support closures and meta-programming) are very powerful and flexible. Groovy also requires less typing to achieve the same result as Java.
Attended 2 sessions on Gradle. The developers of Gradle developed it because of frustrations with the limitations of Maven. The developer presenting was obviously very familiar with Maven, as evidenced by his responses to questions by attendees that knew Maven very well. It leverages Maven and its central repository, and adopts Maven’s philosophy of convention over configuration BUT if you don’t like it’s convention, or want to extend it’s definitions, it is easily accomplished. Yay to a distinct integration test task, with its own classpath and dependencies!
Overall, an excellent conference, and I will post additional details as time permits.
Day 1 was mostly about registration, checking-in and the keynote. Here’s a great summary of what was covered in the keynote. KeyNote summary.
I’ve mostly been looking at Groovy sessions, and can see a lot of potential here. Will keep providing updates as the conference progresses.
Definitely want to look more at the tc Server. SpringSource/VMWare are hopeful companies will use it instead of Jboss/Websphere/…
They demo’d the new developer’s edition with Groovy and Grails, and were able to dig into all the queries. Great way to find bottlenecks when performance isn’t working well. Don’t know if it can do it with Java/Tapestry/Hibernate, but likely no reason it can’t. Obviously they’re leveraging the HtpericHQ acquisition for aspects of this.
In a previous post, a colleague was venting about having to manage the version control system with a commit token. Basically, the token is held by someone while they’re doing there commit, so that no other developer is supposed to commit, and potentially create conflicts. As a number of us are using CVS, this is a real issue. CVS handles each file individually, so it may stop the commit of only 1 file, thus leaving the repository in a broken state.
But this is only one of the reasons for having the commit token. The other major reason is ensuring that developers have tested their code with the latest version in the repository before committing. A process is in place once a developer recieves the token.
This is done to reduce the chances that broken code ends up in the central repository, thus impacting the other developers, and their productivity.
To reduce queue sizes, various guidelines can be used, such as no retrieving the token unless you’ve recently done an update and run the tests.
Bottom line, it can be managed….. BUT as others have said, is there a better way? Do we need an artificial, external locking mechanism?
The answer would appear to be no, as long as you’re willing to move to a new VCS. Of course, this has it’s own potential issues, but I’m currently spearheading an initiative on my team to start using Mercurial for our development.
Mercurial is a distributed VCS. It uses atomic commits (Subversion was one of the early implementors of this feature), and tracks renames. It also makes branching AND merging very easy.
Doing a quick experiment, if 2 developers were to commit, one would succeed, and the other would be warned that they’re attempting to create a new head. So, developer 2 would know someone else committed, and that they need to do the update/merge/test/commit cycle. So, theoretically, there would no longer be a need for an explicit commit token.
Even if the token concept is persisted, or I’m waiting for other developers to complete a large commit, I can commit my changes locally, do some more work, do another commit, and then when I’m allowed to ‘commit’ to the central repository, I merely update, test and push.
If I’m in the middle of something, I can shelve my outstanding changes to update/test/push, and then unshelve to return to where I was at.
There are many more advantages of Mercurial, and as my team starts using it next iteration, I’ll keep posting updates.
A colleague was working on a unit test the other day, and couldn’t figure out why it wasn’t working correctly. At a high level, here’s the testing code.
and this is the code in the class under test:
and the above method gets called twice during execution of the method being tested.
On the second call to listObject.iterator(), the for loop doesn’t do anything.
JMock ‘caches’ the result of the returnValue option, and returns the same object each time that method expectation is reached. The first time it’s called, strings.iterator() is at the beginning.
The next time it’s called, the iterator is now at end, so the for loop doesn’t process anything.
JMock2 has a built-in return Action for handling this case. There are several others defined (look at implementors of Action), and shortcut methods defined on Expectations. Taking advantage of this results in the following:
The returnIterator constructs a ReturnIteratorAction. The ReturnIteratorActions stores the collection, and then calls strings.iterator() everytime the mocked method is called.
I was working on a page recently that displayed a number of items for a user to choose. Visually, it displays as a long list, with checkboxes and descriptive text.
The user has the option to select/deselect all items on the page. I was doing stress testing of the page, as the client had told us there could be up to 4000 entries on the page. Don’t worry, this page will be re-designed, but for now…
I was testing in Firefox, and selecting/deselecting all items was very quick. I then tested in Internet Explorer, as our client’s mandated browsers are Internet Explorer 6 and 7 and Firefox 2.
I have IE 8 installed, and it was taking 10-12s to select/deselect all. I then asked one of my co-workers to attempt it with IE6. IE6 timed out!
Needless to say, this is unacceptable performance.
Here’s the original code:
The page doesn’t have much code outside of the long list, but I had to do something, so the only thing I could see was getting the ul that contains the list items, rather than searching the entire document. So, here’s the modified code
Basically, retrieve the ul, and then search within it.
That one minor change made it so that even in IE6, the select/deselect all on 3000 items has a negligible delay.
Moral: Be as specific as possible as soon as possible, even if it doesn’t seem like it should make a difference.
When browsing through some code on one of our pages, I noticed the following:
Here’s the modified code.
This way, if the process of getting checkboxes can be improved, the code only has to be changed in one place.
Just read that a recent update pushed out by MS adds a serious vulnerability to Firefox. The Microsoft .NET Framework 3.5 Service Pack 1 also installs an add-on in Firefox. You may have noticed the add-on if you’ve recently looked in your Firefox add-ons dialog.
Just read an article that I unfortunately don’t have difficulty believing. This add-on adds ‘One-Click support and the ability to report installed .NET framework versions to the web server’.
Reading the article linked below, it appears this really means ‘a web page can install something without notifying the user’.
Here’s the article explaining the risks, and how to uninstall the add-on.
And I found an interesting comment at the bottom of the article…
(And if you're thinking, "Why not just use a Mac," may I remind you of the MobileMe junk recently installed on so many Windows machines without their owners' permission!)
Some very interesting pictures from way back in 1981…
The following table outlines how you can modify the passed parameter.
|%1||The normal parameter.|
|%~f1||Expands %1 to a fully qualified pathname. If you passed only a filename from the current directory, this parameter would also expand to the drive or directory.|
|%~d1||Extracts the drive letter from %1.|
|%~p1||Extracts the path from %1.|
|%~n1||Extracts the filename from %1, without the extension.|
|%~x1||Extracts the file extension from %1.|
|%~s1||Changes the n and x options’ meanings to reference the short name. You would therefore use|
|%~sn1||for the short filename and %~sx1 for the short extension.|
The following table shows how you can combine some of the parameters.
|%~dp1||Expands %1 to a drive letter and path only.|
|%~sp1||For short path.|
|%~nx1||Expands %1 to a filename and extension only.|