Wednesday, December 10, 2008
Save CPU Usage! Dont Use StringIO
After enabling the python profiler, I noticed that StringIO adds about 500 CPU usage to your process so ignoring the use of it will save a bit of cpu usage.
After enabling the python profiler, I noticed that StringIO adds about 500 CPU usage to your process so ignoring the use of it will save a bit of cpu usage.
While I am not on a so busy moment, I did a bit of research about the browser market share for web 2.0 applications. IE certainly controls major slice of the market but I got curious about how the pie will look like when it comes to web 2.0 and/or social networking applications.
The following article: http://www.kryogenix.org/days/2008/08/27/facebook-doesnt-really-support-ie6, shows that facebook, one of the largest social networking platform on earth, doesn't support IE6. Could this mean that IE6 is not anymore an attractive browser for this kind of application?
This one: http://www.teknobites.com/2008/11/06/firefox-hits-20-browser-market-share/ shows that Firefox dominates IE. More people visiting teknobites (a popular website that mostly talk about web 2.0) is using Firefox.
IE is obviously dropping but It might take long before Firefox and other browsers take away that large market share from IE. I hope that one day I'll wake up not anymore worrying if my app is working or not working on IE.
The past few months, I've been a very big fan of integration testing because It removes the process where I have to create mock objects for each dao or services and the creation of object and all of its nested objects.
While at work, I realized that integration tests that uses or retrieves an entity from database first, couples the test to the developers database. After getting my test to work on my machine and then move it to another computer with a different database, I'll get a different record or even retrieve a non-existing record which will definitely cause serious problem.
I guess this is the part where unit test becomes useful but the work will be a bit longer since i need to create mock objects, objects and all nested objects.
Earlier today, my website went out because I exceeded the quota limit. After using memcache on several parts of my page, I noticed a big difference. The application runs a lot faster while using a much lesser CPU.
Another thing I added is the RSS feed section. I noticed that I'm receiving around 40 unique request a day trying to access the rss section which was removed after migrating to app engine.
While at work, I had a problem and I need to project my query to look like this:
CONCAT(CONCAT(YEAR(documentDate), "_"), MONTH(documentDate))Since hibernate doesnt support mysql or database specific queries, I needed to use Project.sqlProjection to customize my projection list. Anyway the code looks like this:
final Criteria c = session.createCriteria(JobServiceBill.class);
final ProjectionList projectionList = Projections.projectionList();
final StringBuilder sb = new StringBuilder();
sb.append("CONCAT(CONCAT(YEAR(documentDate), \"_\"), MONTH(documentDate)) AS yearMonth");
final Projection distinctYearMonthProj = Projections.distinct(Projections.sqlProjection(sb.toString(),
new String[] {"yearMonth"}, new Type[] {Hibernate.STRING}));
projectionList.add(distinctYearMonthProj);
c.setProjection(projectionList);
return c.list();
| <Page 1 of 6> | Next Page |
