The other day I was refactoring one of our apis. We were removing some of the columns as they were not required. I believe in this exercise dropping the column was the most easy part. After that I removed the corresponding fields from the associated ORM and it was fine for the business related code. But !! the big one, was my code was not compilable, as the object was being used in a lot of tests and thus my project was all painted RED.
While I was fixing all the required tests I realized most of the tests were on similar lines. We were pushing some data in tests, creating some required resources and then destroying them after the tests were done. Now we have blatantly copied the stuff in every testcase with total disregard to the DRY principle. Continue reading →
We have a application which has gone through a short developments sprints. Things got added and then some got modified or removed etc. During this phase a number of service URLs got added/removed/modified. Now if such an application is getting crawled by Google, the you have a mess to clear about. Clearing such a mess is not easy, some URLs should give 301 to a relevant page which some should show 404 and 500 status errors. More over there can be other requirements from the application like domain/sub-domain redirections eg making http://www.myapp.com to myapp.com, ver1.myapp.com to ver2.myapp.com etc. Continue reading →
Every application has some user information which it displayed to the logged-in user. My application also has the same information, but at few places it needs to be converted to JSON format as well, besides being displayed. Now either I can pass this JSON information from my Controller or I can somehow reuse the existing information that is being passed. I choose the second route, but then the next question comes to your mind is how to convert this on server-side ? on client side etc. ? Since we already had a static method to do such conversions so I needed to figure out a way how I can call the same static method which could do the conversion on JSP ?
Answer : Spring EL, is the way to do this. Using this you can access any static method of a class or an Enum on the JSP.
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %> <s:eval expression="T(com.rahul.devlearnings.MyClass).callStaticMethod()" var="data1" /> <s:eval expression="T(com.rahul.devlearnings.MyEnum).enum.call(data)" var="data2" />
I was pretty much convinced that Mongo db is not the best choice for an application. But a recent incident makes me believe that it is a silent killerof the application. As you work with it and increase the amount of data/ concurrency you realize its one or more pain points.
Our application was working fine, and one fine day one of the bugs got reported signup is not working as expected. It was creating user but could not login them. The app was not updated from quite some time, no changes to the schema how could this happen. So then we searched for logs, and it was sparkling clean !!! But still no user creation and other db operations, for some reason. After some debugging we realized that saves are getting called but data is not available in mongo after the operations and surprisingly it does not throw errors. WTF !!!
Continue reading →
In the recent past, I seen a few applications which have taken the NoSQL route. These apps dumped RDBMS as it did not sound good for the job. They took one of the NoSql stores. Then evolved a complete schema there. The schema had concepts of foreign keys / constraints and thus realized the sore points of NoSQL. At some point in time these applications started to play with RDBMS in a new fashion which I call “Not only SQL“. Continue reading →