Skip Navigation LinksHome > Spider Portal > Spider Blogs

Spider Portal

Spider Blogs

9/1/2010

Grant Rettke

Ready for Service

Yesterday I got the Clymer’s service manual in the mail from Murph’s, so with the Kawasaki service manual already in handy I’m ready for servicing my bike!


ocamlnet-3.0.0

I’m very proud to announce Ocamlnet 3.0.0, a completely overhauled version of Ocamlnet. Wish I had some problems that needed solving with ocamlnet! (via caml-list)


Easy Ways to Fail a Ph.D.

Here is one person’s top ten list of ways to fail to obtain a PhD. Interesting quotes: Ph.D. school seems to be a magnet for every kind of procrastinator. Advisors expect near-terminal Ph.D. students to be proto-professors with intimate knowledge of the challenges in their field. They should be capable of selecting and attacking research [...]


8/30/2010

Grant Rettke

Updated DrSync to Racket

Just posted the updated version of DrSync for Racket on PlaneT.


Installed tailbrights on my Connie

Buck Sport Touring sells reflective stickers called Tailbrights that stick to the rear and side portions of the hard bags. Tonight I installed them. Installation was pretty simple; only had one or two bubbles on each of the stickers. I guess that you could make these yourself; but Buck Sport figured out the right shape, [...]


8/29/2010

Deep Shah

How to accept only strict dates using javascript validations


How to fix "OutOfMemoryError: PermGen space" errors when running Cobertura from Maven2


How to mock/stub void static methods using PowerMock


How to mock/stub void methods using PowerMock


8/26/2010

Grant Rettke

Barcamp Milwaukee 5 approaches

Barcamp Milwaukee 5 will be held from Saturday October 2, 2010 at 10AM through Sunday October 3, 2010 at 4PM. Mike plans to present on Clojure, which should be pretty fun to attend.


Virtual Gravel Rash

Tonight after removing some of the caked-on dust from under the seat, I decided to investigate the gravel rash on the right of the lower fairing of the bike. Getting down on my hands and knees to take a look, expecting deep grooves, I was shocked to instead find something like silver paint stuck to [...]


8/25/2010

Grant Rettke

Okasaki’s Purely Functional Data Structures in Typed Racket

A library of purely functional data structures in Typed Racket. Data structures in the library are based on Chris Okasaki’s book Purely Functional Data Structures, work by Phil Bagwell and others (via racket)


8/24/2010

Grant Rettke

Wrapping up the 2009-2010 School Year

This past May, I completed the Simulation and Parallel and Distributed Systems class that I was attending. While taking two classes while working full time was challenging; the pure fun of it all more than made up for the challenge! I will have fond memories of that semester for a long time. I can’t wait [...]


8/23/2010

Grant Rettke

Pondering repairing this rust

Options: Sand. Use light grit paper and paint. Seal. Use something like POR-15 to seal it and paint over that.


8/8/2010

Geoff Lane

MongoDB Replication is Easy

Database replication with MongoDB is easy to setup. Replication duplicates all of the data from a master to one or more slave instances and allows for safety and quick recovery in case of a problem with your master database. Here … Continue reading


7/24/2010

Deep Shah

How to use custom argument matchers using PowerMock


7/19/2010

Lalit Bhatt

Why projects fail?

This is somehow getting stuck in me for sometime now that the number one reason for a software project or for that matter any projects fail when they fail to listen to the users. In context of software projects, when the projects are done by the developers for the developers there is a high chance that it's doomed to fail. It might have adopted best of the breed of technologies and frameworks but it failed to do the thing it was supposed to do for the end user. Put the greatest framework, best of processes and the ultra smart developer and you will get a super masterpiece. Unfortunately no one need it because it did not do what it was supposed to do.

The world has again and again realized that any attempt to super automation has failed again and again because finally people look for that human insight into issues and not an insight generated by a complex algorithm. I think there are two categories of problem which decides if automation is going to be successful or not. One are the problem which can be mapped into a flow diagram. (Yes, the same diagram that we learned in our school), and another once are which we cannot. The first categories of problem can be fitted nicely for automation possibility and not the second one. Still people are looking for the dream machine which can predict the stock market may be just 5 minutes ahead of its time.

Let me put a disclaimer also at the end. Be sure of that your customer knows what they need and their want is in congruent with the same. At times, it's often the case that customers are not clear of their requirements. It's important than to understand their need and convert it into right kinds of wants.






7/17/2010

Deep Shah

How to use argument matchers using PowerMock


How to suppress static initializers using PowerMock


How to suppress fields with PowerMock


How to fix the OutOfMemoryError when writing tests with PowerMock - Part - 2


7/3/2010

Deep Shah

How to fix the OutOfMemoryError when writing tests with PowerMock


6/22/2010

Geoff Lane

Password Strength Validation with Regular Expressions

Regular Expressions are both complex and elegant at the same time. They can be made to look like someone was just randomly hammering on their keyboard. They are also an incredibly efficient and elegant solution to describing the structure of … Continue reading


6/17/2010

Geoff Lane

MongoDB and Java: Find an item by Id

MongoDB is one of a number of new databases that have cropped up lately eschewing SQL. These NoSQL databases provide non-relational models that are suitable for solving different kinds of problems. This camp includes document oriented, tabular and key/value oriented … Continue reading


5/28/2010

Lalit Bhatt

Don't hide complexity if it cannot be handled in a robustway

Human mind has a tendency to simplify everything, which is a good thing. But than there is a tendency to oversimplify by wrapping it up in such a manner that it just looks simple on the face. At present, there are many frameworks which has come up promising the paradigm of rapid application development. They are useful, in many sense that they do remove a lot of drudgery out of the development work. Especially drudgery related to repeated task. The problem comes up when these frameworks promise the panacea for all the issues related to application development. Most of the benchmark against the number of minutes they take to build a shiny and neat CRUD applications. I would sincerely ask them to put a benchmark against how many minutes they survive after the initial honeymoon. How long they stand when the real world problems start appearing. Many of them make a choice which are hard to unroll and actually become a bottleneck.

Suppose we camouflage an aeroplane and make it to look like a car. Now if we expect that any car driver will be able to fly the plane is a foolhardy thing. What these rapid applications development tool provide and almost all of them:

  • CRUD development. But the domain world is not a one to one mapping with the relational world. And it's hardly happens that we have a simple relation between user interfaces and relational table.
  • Generating default project structure. I like this as it saves me the initial boot up time but to claim this as a state of the art feature.
  • Providing internationalize, localized and accessible features.

Beyond this you are on your own. And again the tougher part of the application development is not how to do it, but what to do it. Putting too much emphasis on frameworks is not a great strategy. Softwares are developed by people and not by frameworks. Human has always tried to make a machine which can replace human. A machine which can do cognitive thinking and not depends on the zillions of logic embedded in its transistor to figure out what to do in a situation. The day we will invent such a machine we will find the solution to the automatic application development problems.


4/17/2010

Geoff Lane

Random but Evenly Distributed Sets of Numbers

Let’s say one is a computer programmer and let’s say one’s wife (or roommate; or significant other) does social science research (a totally hypothetical scenario of course). When doing social science research one needs to create randomized groups of participants. … Continue reading

Himanshu Trivedi

Question your guesses and assumptions

It’s fare to guess or assume, in fact it helps moving forward in at least one direction, and is inevitable many a times. But started believing that a guess or assumption is truth, can be really harmful. Eventually questioning guesses and assumptions is important, and that also helps being open for multiple perspectives.


4/14/2010

Lalit Bhatt

Future of Java

With the recent aquisition of Sun by Oracle, the future of Java is getting debated vigorously. It's also getting clear that Oracle's interest on Sun is more on the hardware stack than on the software products (Takes them closer to IBM). With the recent resignation of James Gosling it has given further suspicion to the intentions of Oracle and its commitment on Java.

But does Java depends on the survival of Sun or I would say survival of Sun Java inside the umbrella of Oracle. There is an old saying that the effectiveness of the leadership is decided by the fact that the absence of leadership doen not impacts the functioning of the group. In that regard, we should congratulate to James Gosling and the initial set of people in Sun, who mentored Java. They have done a wonderful job of building an ecosystem around Java and let the ecosystem drive the future. In that context, I think Java is going to survive and thrive, no matter what happens to individual companies. The pillar of this process is JCP (Java Community Process). Yes they are political in nature and do tend to slow the process but than at the end of the day, humankind has realized that democracy is the best way to govern inspite of its inefficiencies. And we have seen that the Java as a language and as an ecosystem has become better only with time.

Considering the strong ecosystem in which Java exists today, it seems difficult that the indifference of Oracle will harm Java. Though I feel that Oracle does not have that kind of intentions, considering the business focussed company Oracle is. They know that the Java is one of the most important language in which major work is getting done. (ok..ok...Please accept my respect for all the other languages, I am just quoting http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html(external link).

If at all Java language will go out of fashion or for that matter any language it has to be a pradigm shift that will makes these languages obselete. Than no amount of marketing/politiking is going to make it survive. Considering the momentum that is behind the Java, it seems that it still has a bright future ahead.


4/12/2010

Lalit Bhatt

How important are frameworks?

Not only in Java world but in all the econsystems of programming we have zillions of framewrok which provide the notion that if that particular framework is used, than applications will get done quickly. The marketing machinery works overtime to further these ideas. So are the frameworks panacea to all the problems of the development. This is unfortunatley very far from truth. I am not saying that framewroks are not important. Let me say that, I do like frameworks and do use a lot of framework to do my job. In fact given a problem statement, I do look around to figure out if some framework can do the job in a better way, rather me writing all the low level stuffs. Framework do bring a lot of advantages and important of them is to force the developers to follow industry proven practices and patterns. Another important advantage I see with frameworks is that, the popular framewroks carry with them a big community and strong knowledge base. At times there are applications in open domain to study.

What I am trying to say here is to challenge the underlying notion that framework are the most important part in the software development process. Frameworks are seen as panacea to all the issues. Especially popular with this notion are frameworks which can generate CRUD applications in a snap. But in reality, the real world starts after these CRUD applications. The CRUD applications are good to get a good feeling but the moment one tries to do something useful, it starts hitting into rocks and worse the generated code may actually hinder it in terms of understanding and fitting to new set of situations.

In the software world the easier question is how to do it. The more difficutl and the important question is what to do? And the fact is that development team tends to spend a lot of time debating and discussing the suitability of a framework over other. It's not that the debate is not useful, but the danger is to get into an endless loop in trying to achieve the perfection. And the problem is that it becomes a self defeating exercise. The team tends to debate on this aspect with the underlying notion that the time spent here will automatically translate in bringing more productivity and better application. And there the catch lies. The more time is spent on this debate, the harder it becomes to justify the value for dollar spent. (For a better developer, it's strongly recommended to align every action of yours to the impact it will bring on the balance sheet.)

So are frameworks not at all important? It's also not true. The choice of a framework will certainly impact you but the bigger impact comes from not understanding the requirements. Basically not understanding what we want to achieve.

So how much time to spend in choosing a framework. Some of the simple steps that can be taken to reach a quick decision.

  • Build a timebound plan in choosing the framework. The time may depend on the complexity, performance and scalability of what you are trying to achieve. ( Be very clear that the decisions here are very important in terms of cost and time you are going to incur in future, but be careful about the "going round and round" ).
  • Understand the present skills of your team. It's the people and not the frameworks who make softwares and programs. Let me put it in a different way. It's the carpenter and not the chisel and saw who makes the furniture.
  • Check which has a strong community around it at the moment.
  • Check the licenses and dollars investments. Also while building the finance apsect, just don't count the visible upfront cost. Factors in the cost that might get incurred because of the research people will have to do in understanding and fixing things, if the framework is in open space.
  • Search in forums and web what people are saying about certain set of frameworks. If not found anything useful, post a question in some of neutral forums (Linkedin) and see that how people react. I usually wait for 1 week when most of the reactions are done. After that it's usually repeatitions.

And in the last let me repeat again. It's the people and not the frameworks who build softwares.

(Technorti claim token - DF3NYG8MNJUQ )


2/22/2010

Lalit Bhatt

The confusion of Design Patterns

I purchased the Gang of Four Design Pattern book almost ten years back when I was just a novice in the field of programming. At that time someone suggested me to have a look into this book. In last so many years, I have purchased tons of books and retired them because of the technology being obsolete or newer versions coming up. However this book has survived and still is one of the book which invariably appears on my desk regularly.

In technical discussions, it is very common to throw names of the pattern from this book and build the discussion around them. I have seen so many so called architects popping the names of patterns before even listening and understanding the problem that is at hand. I would confess today, that I always felt I am missing something in that discussion. I have tried to go through this book many times but let me confess, I always got backfired because of its terse language and its dryness. Of course I am not expecting a technical book to be titillating, but I always found this book difficult than Bjarne Stroustroupe C++. I envy all those guys who I have seen look so comfortable in popping terms from this book.

I have gone through the book many times and I would say that it's a great effort by the writers. The one thing it brought to the fore is to identify the best practices and document them for re usability. One questions though always nags me is that if I do my job of understanding abstraction, encapsulation and inheritance properly, whether or not I will reach to same set of solutions or not. I do not know the answer of this question in this life now as I now understand this patterns a little bit so I would force my solution.

The pattern world has not stopped here and there are zillions more patterns still appearing everyday. It looks that the moment one writes a piece of code twice, and pulls the repetition at a common place, a pattern is declared. It has become a fashion to put the pattern understanding as an important requirement for interviews. And there are people who know the class diagrams of all patterns but still don't have the feel for abstraction, inheritance encapsulation or polymorphism. I am using the word feel as I think this is the word that separates out the coders and the designers.

Now I would delve little deeper into the patterns and would like to bring out the confusion that I always get into. One of the confusion that I always have is that do we really need to have such a lot of patterns. For me whenever the number of concepts I have to deal with is more than five or six, I get nervous. The four concepts of abstraction, inheritance, polymorphism and encapsulation are good for me. It still keeps the fifth and sixth for the Visitor and Observer pattern.

We have creational patterns. We have a factory and we put some more level of indirection and we have an abstract factory. Singleton looks like a factory where I always go to the factory to get my object. Sometimes Singleton looks to be a facade or a proxy to me, where the facade hides the details from me. A builder looks similar to abstract factory with the abstraction removed. It can even be a factory with one more level of indirection in terms of the steps of object creation. Put one more level of indirection it's probably an abstract factory. Prototype is like a factory to create the same type of object. Proxy, Director, Adapter, Facade all look similar to me. Everything is at one level of indirection so we reduce the coupling. Believe me or not State and Strategy also look similar to me. Here the logic is captured somewhat in classes and in Proxy and all, the logic is captured somewhat in methods. And than not sure how different template is from a facade. In template we have to do some pre and post processing so we put the common pre and post processing at a common location and keep changing the state of the actual implementation or change the strategy that is required to call the things in the middle. Chain of responsibility and Iterator are different in intent but in terms of usage, in Chain of responsibility we worry about what the sequence is going to do and in iterator how we are moving in the sequence. And what we do is governed by the command. Interpreter looks a state to me and flyweight is a map. Do I need a heavyweight pattern terminology to save the state of my object at any given point of time. I can just copy the state in a data structure and make sure that the logic of copying is properly encapsulated. Observer and Visitor is something which I think would not be easy to come with if I don't know the GOF book.


2/20/2010

Lalit Bhatt

Reduce the concepts

The biggest problem to a developer today is not the lack of choices but the overwhelming number of choices. The choices exist at all levels right from the choice of platform to programing languages and than the choices of frameworks in the programming language. And it's not simple to make a choice. The primary reason of confusion is the fear of getting it wrong. For example, take web application. You want to do it in Microsoft, Java, Php, Python, Scala(Lift), Ruby on rails and other zillions way. If you happen to choose Java than Struts, Spring, JSF etc for front end and similar choices existing for other layers. A tough nut to crack.

Lately I am coming to conclusion that for 95% (or may be 98%) of the cases, it does not matter which one is chosen. Everything will work equally good, give or take small differences. The difference lies in the craftsmanship of the individuals building the application. Toss a coin and you should be fine. Another important indicator for choice would be the availability of the developers. Just a word of caution, that one might want to choose the latest in the same lineage. For example put php and Java next to each other. But if you happen to choose Java, than you might want to avoid Struts 1+ version. There are huge numbers of developers comfortable in Struts 1+. Also you might want to avoid plain JSP. Look what is best in the same lineage. In Struts lineage, look from Struts 2+ or may be Spring MVC. In JSP lineage, JSF would be a better choice. Make your requirements clear and than figure out the framework and not the other way round.

Another important choice that is important is to reduce the concepts in the application development environment. Try to strive as low number of frameworks as possible. Human brain is limited to the number of things it can handle at a time. Somewhere I have read that a human brain can handle 7 dimensions at a time. Couple of them already take by your family and personal matters. So reduce the number of frameworks. If you are using Spring, use it all the way up to down. Introduce a new framework, only when it is really needed. Donot introduce the framework, and later defend it. Try to use a homogeneous environment as far as possible. At times it even possible to convince customers on the same line. Customers are interested in doing there business and not in fancy frameworks.


2/4/2010

Lalit Bhatt

Book review : JBoss AS 5 Development

This book is a good reference if you are working with JBoss. The book can be accessed here(external link). The book is written in simple style and easy to read. It touches the things to an average depth and can be a good companion, if anyone are using JBoss as their deployment environment. It has lots of tips and trick between those black lines. The book is practical in nature and written in a tutorial style.

The book at times tends to get too deep into other technicalities related to JavaEE standard technology which tends to remove the focus, if you are already comfortable with JavaEE stuff and looking for Jboss specific stuff. Another thing missing is a more detail treatment of the new microcontainer architecture.

Overall a good companion for JBoss based environments.



2/3/2010

Lalit Bhatt

The gold rush to Annotation

Human nature has a tendency to take things to extreme. A good day to day example is the Stock market and this behavior is rampant in other areas of life also. I feel we are doing the same thing with annotations. We are probably stretching it too far, much more than it warrants. Unfortunately I feel Spring is falling in the same trap. I do say that there are places where annotation makes complete sense, but I think there are places where annotation does not make sense and is introducing extra complexity in terms of readability and understanding. We are putting more burden on building complex mental models and moving things away from written artifacts, which was easier to understand. A lot of implicit understanding is not good for developers. Not all developers are intelligent. There are a lot of developers who do programming so that they can feed their family. They have no interest in understanding the complex programmatic models. EJB2.1 is a failure and still people struggle to do Hibernate the right way.

Taking further my argument on annotation, I would like to divide the whole issue in two parts. One part where annotations makes sense and other part where annotation dos not make sense.

  • Mapping stuff that is inherent to class
  • Mapping stuff that is not inherent to class

Mapping stuff that is inherent to class

Here annotation shines. No doubt about it. Good examples are hibernate or JPA mapped classes, JAXB based mappings, Servlet mappings, Controller mappings in Spring. Here we are putting all information about a class at one place. The information sitting is XML was an integral part of this class. If one looks into a hibernate mapped class, the next question comes how it is related to my data model. The argument that goes against it is that, the class cannot be reused, which I find is more for the sake of argument. On the contrary I think these classes should be written with mapping, so their purpose and reason for existence is clear.

Mapping stuff that is not inherent to class

When the stuffs are not inherent to class, annotations are a bad choice. Those places are nicely handled at XML level. When I see the configuration XML in Spring, I know a lot about the application. Now with annotations, I have to hunt around to understand something. There is an article on CDI at Server Side(external link), which has an example of Logger factory. Now I have to understand, who produced this logger factory and than I have to understand injection point and than somehow, how they are connected together. We might have an argument that we are depending on interface only, but again I am not sure if that is such a big advantage to introduce a complex programming model. There is an interesting statement in the above article in first part. I quote "Finally, Java EE 5 developers will likely feel that CDI is much more complex at first glance but will see that most of the complexity is well justified and can be ignored when not needed." This is the same argument we heard when EJB2.1 came. Of course, tool can come up to help in visualizing the relationship, but than I have to switch between my tool and code to see the things. It's worser than switching between XML and code.

After EJB2.1, the Java world geared itself towards reducing the programming constructs. One of the major argument against EJB2.1, was lot of boiler plate code of no use. Spring did hit the sweet spot and became popular. But on the way, we forgot the need of a simple mental model. At this moment, I think we need another wave which reduces the mental model complexity or better to say which strives to bring both of programming simplicity and mental model simplicity. Not all are Einsteins in the world and Let's make it simpler but no simple. Scoring on all front will help better.


2/2/2010

Himanshu Trivedi

Ignorance is not bliss. EventWaitHandle.OpenExisting throws WaitHandleCannotBeOpenedException

My development computer got upgraded to Windows 7, Windows 7 is good experience. For one of our client, I needed to setup mechanics such that admin users should be able to initiate a process in Windows Service using GDI based .NET application. We had also developed the windows service in .NET. As both of them are [...]


1/21/2010

Lalit Bhatt

Mocks vs Stubs - Importance in Testing?

In testing, Mocks and Stubs are really two very important conceptual confusions and there are camps on both sides. Which one to use and when? IMHO, when one is building testing infrastructure, there are two concerns in that, which needs to be taken care of.

  • Test behavior
  • Testing artifacts

The question of mocks or stubs relate to the testing artifacts concern and nothing to do with the Test behavior. If I draw an analogy, than let's say we want to make a software based on certain requirements. And than I have to choose a language/platform to build that software. The behaviour of my software is independent of which platform I choose (Java,.Net, PHP). And the choice of a language is not going to help me a lot in lessening my effort towards thinking process that I have to put to understand the behaviour of my software. The choice of technology will have an impact on performance, maintainability, cost,actual implementation but the behavior is not going to be impacted by that.

Let's take a concrete case to understand it better. Let's say we have a class which we want to test. One of the method that we want to test is responsible for saying whether a user, when passed to it is credit worthiness or not. The user should have a pending amount of less than 2500, to remain credit worthiness. In real application, the data of user is fetched from the database. However in testing scenario, putting a real database and than populating with right set of records is in itself a task. Our testing will be slowed down a lot. Note that in this para, we are still not concerned about stubs or mocks. We are purely concerned about the test behavior. This is a harder skill to achieve and this is the more important skill to achieve. Once you have decided your testing behavior, than comes the question of using Mocks or Stubs.

I would not show here how to write stubs or mocks as there are plenty of things on it. Regarding the choice of stub or mock, the yardstick is that if the stubbed (or mocked) object do not have a lot of different variation, go for stub otherwise go for mock. Ask the question of variation at a project level. It's better to use one strategy for the whole project, the mock way or the stub way. If my user is supposed to return the same pending amount of 2500 or smaller number of variation to it, for checking the various behavior in the system stub is a good choice. However if the user object has to return a whole lot of different values in different scenarios, mock would be better. It' what you want to achieve is more important than how you want to achieve.


12/14/2009

Lalit Bhatt

Speeding up the data transfer.

In the Indic thread conference, I had an opportunity to listen to Pramod about an efficient data transfer mechanism. The performance result that he presented was amazing. For 1 GB file transfer it was showing a 65% improvement. The idea behind the whole approach is that once the application knows about the source and destination socket, it makes them to talk to each other and avoids the application buffer in between. In Java this can be used by using SocketChannel class. Right now as per the paper it is present in Linux and Uniz System.

This seems to open up the possibility for doing efficient data transfer. Also other language can also use this concept as it finally uses the function available in the operating system. Also other possibility is that if web framework people can somehow use it for sending static content. In web we need to put a header on the traffic. If the framework can push the header part from application and than the file transfer can happen using this capability.

The detail paper can be accessed at Efficient data transfer(external link).


11/12/2009

Himanshu Trivedi

Extending code readability by extension methods

If you haven’t noticed, note that extension methods can also be called on null objects. Meaning, there can be extension method which checks whether an object is null or not. So, public void Operate(InputType inputObject) { if (null != inputObject) { . . [...]


10/26/2009

Geoff Lane

Announcing Grails Constraints Custom Domain Constraint Plugin

I’ve released my first public Grails Plugin today. The Grails Constraint plugin gives you the ability to create custom Constraints that you can apply to your Domain classes to validate them. These are applied and act just like the built … Continue reading


9/2/2009

Geoff Lane

DRYing Grails Criteria Queries

When you’re writing code, Don’t Repeat Yourself. Now say that 5 times. *rimshot* One of the things that I find myself repeating a lot of in many business apps is queries. It’s common to have a rule or filter that … Continue reading


7/2/2009

Geoff Lane

Struts2 Map Form to Collection of Objects

The Struts2 documentation contains examples that are often basic at best which can make it challenging to figure out how to do things sometimes. I was working on creating a form that would allow me to select values from a … Continue reading


5/15/2009

Himanshu Trivedi

Sending email message having embedded image (.NET)

Does your .net application send email messages? Does it send formatted email messages? I think applications should always send formatted email messages instead of text only. (Are asking why? Simple, formatted messages are much more capable, presentable, …). Counter argument: Some user uses email client that are not capable to show HTML messages. Or someone is [...]


4/27/2009

Geoff Lane

Scala and Adding New Syntax

One interesting thing about some languages is their support for adding new syntax. While all languages have the ability to add new functions or types some have specific properties that make it easy to add what looks like new built-in … Continue reading


4/23/2009

Geoff Lane

Grails Embedded Classes ClassCastException

Using ORM tools allow you to map the data to a database independently of how your object model looks. Grails supports one-to-many and one-to-one relationships if you want to have the data in different table. But what about when you … Continue reading


3/28/2009

Geoff Lane

Update Table Data in Grails using Ajax Calls

Using Ajax for simple forms can offer users a very clean, simple and fast way to input data. I came across a situation recently where I was looking into replacing a document based workflow with an application. The documents themselves … Continue reading


1/13/2009

Himanshu Trivedi

Changing version of .net framework dependency for setup and deployment project in visual studio 2008

Its easy to do, but not obvious to locate, at least to me. It took a while for me to find, so I thought let’s log it, in case if I need it in future, or someone else might need it. I need to create setup that depends on .NET framework 2.0. instead of 3.5 [...]


1/10/2009

Himanshu Trivedi

Knowing memory usage from Compact Framework application

For any handheld device application, memory usage is an important element to observer. .NET Compact framework have very less code that gives information about physical or virtual memory. But using native libraries – by doing pInvoke, one can retrieve memory usage statistics. There can be more than one level of report that can be captured. Today, [...]


11/21/2008

Himanshu Trivedi

Navigate and injecting C# code using visual studio macro

Visual studio macros are great, probably I will write this in all posts that I write for macros . Sometime back, I need to change a fairly big CF.NET application such a way that it will log a line on each function entry and on function exit. We were tracing for cause of intermittently [...]


8/6/2008

Himanshu Trivedi

OpenID, myOpenID Rocks!

I have been using openID from last 5-6 months as and when I got chance to use it. It’s getting popular more and more now a days. I see more and more sites supporting it. When first time I learned about it, first thing that came to my mind was to support openID login for [...]


8/5/2008

Himanshu Trivedi

Paging of SQL Server records

In one of my ASP.NET, SQL Server project, we were expected to provide paging in the ASP.NET GridView. Microsoft’s very common sample will do this using Dataset filled with all records. If someone is doing GridView paging, s/he is doing it not waste server’s or client’s precious resources, Isn’t it? To me, it make more sense [...]


7/24/2008

James Roome

You have an iPhone, without a phone plan?

"You have an iPhone, without a phone plan?"
"Why, yes I do"

I guess if there is one nice thing about having a first gen iPhone, it was relatively easy to buy one and never sign up for a two year contract.

Why??

I think of the iPhone like an iPod Touch but with: Camera, Mic, Speaker, External volume control, bluetooth. Oh, and it happens to be a phone, if you want to use it for that.

So what applications does this non-phone iPhone user use?

WeDict WeDict
If there was one application I would of predicted these would be twenty of on the day of launch, it was a dictionary application. There where two, one costs $29.99, the other is free and is just fine.

Stanza Stanza
Reading a book on the small iPhone screen seems intuitively doomed to awkwardness. I have been reading one of the supplied eBooks for the last three evenings without any discomfort at all.

Jott Jott
If there is one application that has intrigued and frustrated me this is it. You talk, it record, sends to server, transcribes and sends back. Makes we want Dragon Dictate for the iPhone, also makes me want copy and paste.

Dobot Todos Dobot Todos
There a quite a few TODO apps, this one is adequate, it breaks from the application norms by instead of deleting an item by "edit"->"click on minus sign"->"select delete" it just wants a swipe across the offending row and a "select delete".

AccuFuel AccuFuel
I want to prove to the world (well Dan who has a hybrid) that I can regularly get 42mpg in my car.

Tap Tap Revenge Tap Tap Revenge
If I want to show off what the iPhone is capable of, this is the app I fire up, and then challenge to a "Tap off" (and CRUSH, yes Rachana I'll take you on any day).

Chopper Chopper
Game has a nice use of the accelerometer, lean the phone back/forward/left/right.

Phone Saber Phone Saber
Hard for any self respecting X-gen'r not to get this.

Restaurant Nutrition Restaurant Nutrition
For the guys that eat fast food in the office, I can instantly see just how bad their food is for them, and inform them of it.

Pandora Pandora
Interesting enough to make me look in detail at the Apple licensing agreements to see what they say about streaming music over the cell network, apparently not much. They mention VOIP and not 'burdening the cell network' and that's about it.


7/23/2008

Himanshu Trivedi

Creating a windows shortcut using AutoIt

AutoIt library do have function to create windows shortcut, FileCreateShortcut. AutoIt script to create new shortcut of specified target in specified file/folder. Once compiled and created executable, use it in following way. Usage: shortCut.exe  [] First parameter is required and should be path of file/folder for which to create shortcut Second parameter is optional [...]


9/26/2007

James Roome

Most of programming is routine, and that's a problem.

While coding, I always have this nagging feeling that someone has already done what I'm doing, and done a lot better job of it than I. Heck, its more than a feeling, I just know it! It frustrates me, knowing there is this useful information that could save me time, just beyond my grasp.


At the end of the day I am interested in building programs with interesting functions, that I know about Java or SQL is purely a side effect of creating these interesting programs. If I could get away with knowing a lot less about Java and SQL, I would!


I'm not saying that aren't a lot of benefits from knowing low level systems, I think there is a huge advantage from knowing low level systems well. Just look at Skype, an application that is only so amazingly useful because the creators knew a lot about NAT traversal and P2P networking. But the creators of Skype also had to program a lot of routine things as well, things that ARE well understood, and that is where the wasted effort is.


If only we could spend a majority of our time working on the things that WEREN'T well understood, the interesting things. The mundane things, well, they are just as mundane to program as well.



This isn't a comment about OO in general, its more a comment about everything we do in software development in particular.


There are lots of things we (software developers) do, that are well understood:

1. If you need data for twelve rows of data, don't do twelve queries to get the data, do one.
2. When displaying read only data, no need to marshal all the objects, just load the relevant data.
3. In Swing programming don't do long running operations on the AWT-EventQueue thread.
4. Etc...


There are many rules that people apply for each situation that arises. The frustrating part is that when you encounter a new technology/framework you have to discover all of these rules of thumb, even though chances are that you are walking down well trodden path.


To me a great example is the email lists, where 90% of the time people are asking about the same 10 things. This is how the FAQ was born. But the FAQ has really gone no further, its not in an actionable form, we can't reason with it, we aren't able to programatically derive semantic meaning from it.

So? How do you design a system to have the smarts to know what to do?

Well I promise to post about it as soon as I figure that out :)


5/10/2007

James Roome

Project Euler

Grant has been trying to bully me into writing some Haskell code. The straw that broke the camel's back was the challenge to solve "Project Euler: Problem 1", well really the problem was not that interesting, but we had a good spread of languages in the office everyone wanted to solve the problem in, so this is a fun opportunity to compare writing the solution in our own pet languages. Grant used Scheme, Geoff: Ruby, Kartik: C++, Dan: Delphi, Chris was out sick, but I bet he'll do it in C#. Me, I'm going to use Haskell.


We had already discussed earlier in the day that there is an equation to give you the sum, but in the spirit of all following the same approach, I won't be using it.

The plan is for everyone to post the implementation in their blog, so without further delay, here is mine:
sum [n | n <- [1..999], mod n 3 == 0 || mod n 5 == 0 ]]


11/17/2006

James Roome

Video Conferencing on a budget.

Holding our monthly company wide meetings have always been problematic, one problem is half the team is in India and the other half in Milwaukee. Other problems include 512kbps bandwidth for the team in India, also the lack of will to spend $10k (per location!) on a Polycom solution.

Having two groups of people in their respective conference rooms and trying to hold a discussion has proven to be very different than sitting in front of your computer, wearing a headset and chatting over Skype. The microphone has problems picking up individuals in the room, the use of external speakers causes horrendous feedback, and the low video resolution that didn't matter before, matters now because we can't make out individuals in the room.

So I was appointed to do a little research into solving this issue. Had I been given a budget of $20,000 it would of been quite a simple job, buy a couple of Polycom systems and be done with it, however my budget was in the 'something reasonable' range.

I decided to try out iChat on the Mac, mainly because I have family in Scotland and Australia and have a lot of experience with using it for video conferencing, and swear by it. The biggest problem with iChat would be firewall configuration, but since we have an inter-office VPN, it's not a problem at all. To make this choice even easier, we already had a Mac Mini in the office in India.

Setting up a test was simply getting Geoff to bring in his MacBook Pro to our next company meeting. Setup was quite painless, we did get a 'insufficient bandwidth' error, but solved that by dialing down the speed from 'unlimited', and then it was up and running.
The results were very positive, the video was by far the best quality we have ever had, nice high resolution, we could see everyone in the room very clearly. The audio was more of a mixed bag, on the up side the feedback/echo was very slight, but on the downside the mic had trouble picking people up in the room and speakers were quiet even with the volume maxed out to ten, I think it's the first time I've really wished that we could turn speakers up to eleven.

Since then I have researched external speaker/microphones and was able to locate a higher end combo made by ClearOne, called the Chat 50, its quite pricey at $130, but if it solves our sound problems it will be worth every penny.

Since the test went so well we will be purchasing a Mac Mini and iSight for the Milwaukee office, and also a Chat 50 to try out.

All in all the total cost will be about $900, with maybe some potential cost savings by getting a refurbished Mac Mini.

Definitely something reasonable.


8/28/2006

James Roome

Differences between meta-programming and intentional programming

In an effort to post something to this blog, here are some current thoughts:


After some reflection I have decided that meta-programming and intentional programming are two very different things.

Meta-programming is just about using/creating custom programming languages. The only intent meta-programming provides is just that which occurs due to the domain specificity of the languages in use. The actual code generated is still very mundane. Nothing special here.

Intentional programming to me means doing much more than just this. To me it is about leveraging the intent as much as is possible. Part of getting the intent is raising the level, and meta-programming is a great way to do this. But intentional programming can be some much more than writing software at different levels.

If intent has been encoded in such a way that we can leverage it, then the possibilities are huge.
For Example:
When about to perform a lower level db query we can, at this point in time, look and see what the higher level intent(s) is. Is the intent to just display this data on the UI? Is the intent to do X with the data?

We seem to have got into this rut of having very low expectations of what we can do, creating static code that's very dumb that doesn't know much. And them doing a huge amount of work to make up for all these deficiencies.

When we (the developer) write the code we are taking into consideration the intent and the implementation of many many layers. But what we create is this code that doesn't know the big picture, and couldn't but help be brittle and prone to errors. Heck a person given three parameters and an algorithm in isolation couldn't do much better either.


6/3/2006

James Roome

IMPLEMENTATION MATTERS contiuned

I was just working with java collections the other day and it got me thinking....

From the JavaDoc:
ArrayList
The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking).

LinkedList
All of the operations perform as could be expected for a doubly-linked list. Operations that index into the list will traverse the list from the begining or the end, whichever is closer to the specified index.



This speaks to my previous comment "Interacting components will not only be able to interface with each other through a well defined contract but also have a conversation about each others implementation details."
Why do we determine what data structures and implementations to use at design time? For a dynamic system this is not really a decision you can make at compile time, becuase (as you can see above) so much of the performance depends on the actual implementation.
Using metadata and metaprogramming we could provide this information along with our module/component/call-it-what-you-will and then the system as a whole can make a call as to what is the best way to format the data for maximum performance.

Same for my games programming / graphics card example, the graphics card can let the calling program know what types of data result in what types of performance, then the system as a whole can determine which way to format which data and even decide at runtime which underlying implementations to use (ArrayList or LinkedList).


5/27/2006

James Roome

IMPLEMENTATION MATTERS

Conventional programming techniques tell us when creating a large software system that we should isolate components from each other using the ‘black box’ technique.

This idea behind this is simple, “why expose all the complexity of the system to third parties?”, instead you can define an abstraction for the complex system and enable interaction through this. Utilizing the abstraction provides us with many advantages; the most relevant advantage is the ability to interact with this component without understanding everything about it.

But the technique of abstracting out a complex system generates problems of it own; problems I believe cripple our ability to move (the engineering of) software forward. The following are some of my thoughts (ramblings) on this:

MONOLITHIC SOFTWARE

We cannot engineer software that doesn’t depend on implementation.

Even though we create systems that may have hundreds or thousands of interactions through approximate interfaces, this software still only works when treated as a single piece of unchanging code.

We can only engineer software we are confident works if at some point of time we lock down all codebase and make it monolithic.

While some systems (like Firefox or Eclipse) do support plug-ins at runtime, these changes are cosmetic at best, these components typically don’t have other (unexpected) components depending on them, these are simply plug-ins at the extremities of the dependency graph.

IMPLICIT CONTRACT

When we work with interfaces, we are really working with the implementation.

The myth is that if we define an interface completely enough, then the implementation doesn’t matter.

However during the development and testing cycles we are testing against an implementation of the contract, and by doing this we really no longer working with a black box system we are working with an implementation, so we are working with a contract implicitly derived from the implementation. This is sometimes referred to as a leaky abstraction.


COMPLETE CONTRACT

There is a way to define a contract so completely that its implementation will be unambiguous.

The only time you can successfully interact with a system without caring what the implementation of a black box, is if the contract is defined so completely that there is no ambiguity in the implementation. The good news is that there is such a contract! The bad news it that this contract is the implementation itself!

Even a logically equivalent implementation would not be sufficient, i.e. code that for every possible combination of inputs would give the same outputs as a different implementation. Since there could be different internal failure points and dependencies.

MINOR FLAWS MILTIPLED

Inconsistencies in implementations create flaws, which become magnified in dynamic systems.

Currently we have no way to create software that can be truly assembled at runtime with differing implementations, because it would just not work.

Imagine if using today’s technology we defined a contract for 100 different components, and all these components interact and leverage each other. We then give these 100 different components to 2 different groups of people to implement, these implementations fulfill the contract.

If we then try to run the system and for each component randomly choose which of the two implementations to use for each component, this system would never work.

SPECIFICATIONS

Speicifcations are just a contract.

Specifications are really another face to the same problem, just another way to try to define a contact without defining the implementation.

A great example of this is the attempt by Sun Microsystems to try to define the J2EE spec to make EJBs vendor neutral. The idea was that you could build an EJB for IBM’s WebSphere Application Server and then you could then deploy it on BEA’s Weblogic Server and it ‘would just work’.

In practice this was simply just not the case, even the hugely increased detail in the subsequent EJB specifications has not made them portable.

INTENTIONAL PROGRAMMING

DSLs have implementations too.

The current metaprogramming technologies also have this problem. A metaprogram is eventually implemented, the DSL itself can and will be implemented in an ambiguous way as well.

However there is good news, capturing intent on many different levels (layers) gives us the potential to have so much more information to work with.

IMPLEMENTATION MATTERS

And it’s ok! We should stop trying to pretend that everything works the same.

Thanks to all this extra information we now have a broader semantic description of a programmer’s intent.

Once we have entire systems written this way, we will then be able to do so much more.

Interacting components will not only be able to interface with each other through a well defined contract but also have a conversation about each others implementation details.

If we think of the optimizations that a game programmer typically does to get high performance rendering, even though the programmer is interacting through a generic interface (like DirectX) she is only able to truly achieve great performance if she knows a lot about the implementation of the graphics card behind the generic API.

While critical to high performance these optimizations are typically not some great insight they are just the application of gained knowledge. There is nothing here that couldn’t be automated, if the graphics card could communicate to the calling program the most performant way to structure its graphics data (texture size, byte alignment, etc…) then this system could be as fast as one coded by hand.

FUTURE

This is what I see in the future thanks to metaprogramming technologies like intentional programming, this will be one of the first times where a new technology will actually be able to run faster that the previous one. Think of a complex system which runs as fast as if it had been completely coded by hand at every level. No only this but also a system that would truly be dynamic, since it would be able to change implementations behind abstractions without the loss of stability or performance.


4/7/2006

James Roome

RAD using 1 GB of RAM

I used to think have a couple of gigs of ram was enough. Then I met my new friend Rational Application Developer!

Back