Skip to main content


Showing posts from 2010

NHibernate performance issues #4: slow query compilation - named queries

NHibernate provides many approaches how to query the database: HQL (Hibernate Query Language) Criteria Query API Linq Native SQL First three of these querying methods define the body of query in the other than native SQL. It implies that NHibernate must transform these queries into native SQL - according to given dialect, e.g. into native MS SQL query. If you really want to develop all-times fast application the described process can present unpleasant behavior. How to avoid query compilation? Compiled named queries Its ridiculous but everyone met compiled (and named) query. If you have at least once browsed the log which NHibernate produced, you have had to meet similar set of lines: 2010-12-13 21:26:42,056 DEBUG [7] NHibernate.Loader.Entity.AbstractEntityLoader .ctor:0 Static select for entity eu.podval.NHibernatePerformanceIssues.Model.Library: SELECT library0_.Id as Id1_0_, library0_.version as version1_0_, library0_.Address as Address1_0_, library0_.Director as Dire

NHibernate performance issues #3: slow inserts (stateless session)

The whole series of NHibernate performance issues isn't about simple use-cases. If you develop small app, such as simple website, you don't need to care about performance. But if you design and develop huge application and once you have decided to use NHibernate you'll solve various sort of issue. For today the use-case is obvious: how to insert many entities into the database as fast as possible? Why I'm taking about previous stuff? The are a lot of articles how the original NHibernate's purpose isn't to support batch operations , like inserts. Once you have decided to NHibernate, you have to solve this issue. Slow insertion The basic way how to insert mapped entity into database is: SessionFactory.GetCurrentSession().Save(object); But what happen when I try to insert many entities? Lets say, I want to persist 1000 libraries each library has 100 books = 100k of books each book has 5 rentals - there are 500k of rentals  It's really slow! The inser

HD2 + Energy rom - improve battery life

Before a time I criticized battery life of my HD2 flashed by energy rom . Last week I installed new version and it seems that HD2 can simply alive almost four days per one charge! I'm usually read internet at least 30 minutes per day, write a few messages, sync to google exchange, couple of calls. How to improve HD2 battery life? install energy rom :-) definitely switch CHT (Cookie home tab) Editor's lock screen off. Despite it makes your device really unstable , it drains battery a lot - use WM's default because the android version can be simply unlocked in a pocket - significant battery life improve use GPRS instead of 3G - significant battery life improve  lower backlight to 20% - it's enough for almost all cases switch vibration when any virtual key is pressed off install all programs into main memory switch weather animation widget off

NHibernate performance issues #2: slow cascade save and update (flushing)

What's the most powerful NHibernate's feature, except object mapping? Cascade operations , like insert, update or save. What's the best NHibernate's performance issue: cascade saving . Cascade insert, save and update If you let NHibernate to manage your entities (e.g. you load them from persistence), NHibernate can provide all persistence operations for you, it includes automatic: insert update delete All depends only on your cascade settings. What says documentation ? cascade (optional): Specifies which operations should be cascaded from the parent object to the associated object. Attribute declares which kind of operation would be performed for particular case. All this stuff can be adjusted for traditional pattern parent - child . Following code declares specific behavior what happen to children (books) when parent entity (Library) will be affected any of mentioned operations. HasMany(l => l.Books). Access.CamelCaseField(). AsBag(). Inverse().

HD2 Energy rom + CHT editor 2.0 = still unstable

I was really curious about new CHT (Cookie Home Tab) Editor 2.0 . It's UI heart of the whole work with this device. Without undue hesitation I've yesterday installed famous energy rom including final CHT 2.0 into my HD2. My experience is really bad, I fear that it's still really unstable piece of software. CHT Editor brings really great new graphic, no doubt about that, see following screen-shots. The down side of new graphic is unstable device, I was forced to restart my HD2 four times only for today. Why? First restart followed execution of google maps app. I wasn't able to return to today screen. After an hour, I've tried to perform any call. I've chose person, clicked at photo and the call started but I was unable to go to "call screen". The last case was again about music player and today screen, I was again unable to return back. I'm silently waiting to next release of new energy rom version, I hope that it will work, you should

Series of .NET NHibernate performance issues articles

I've spent with NHibernate persistence implementation to our product last four months. I'd like to provide set of articles regarding performance issues of the NHibernate usage. NHibernate team has been releasing huge manual having 189 pages . It contains the basic description allowing the developer to write persistence and not totally mess it up. If you want to develop fast application, you need to read discussions (such as those at ) and solve the problems particularly one by one. According to my experiences, I've decide to write the series of articles regarding NHibernate, especially performance. Prerequsities All following articles will contain examples. I love so it's nonsense to do not use it because it's fine integrated together as well as log4net . All examples which will be described or used in the whole series will use three classes as domain model. According to Domain Driven Design , there are root aggregate Library ,

NHibernate performance issues #1: evil List (non-inverse relationhip)

Lists are evil, at least when using NHibernate. You should re-consider if you really need to use specific List implementation, because it has unsuitale index column owned by parent, not children. List can't be used in inverse relationship which implies few (but major) inclusions: extra sql UPDATE to persist mentioned index value unscalable addition to the list - NHibernate needs to fetch all items and add new item after inability to use fast cascade deletion by foreign keys inability to use IStatelessSession for fast data insertion Basic theorem: you don't need Lists! Furthermore , we'll discuss each bullet in details. What is inverse relation? First of all, it's necessary to clarify what inverse relation means. Reference between parent and child isn't hold by parent but child! See following picture: Here is NHibernate mapping definition for inverse relation with using excellent Fluent NHibernate : HasMany(l => l.Books). Access.CamelCaseFie

Git on Windows: MSysGit

I have started to use Git today. I read a lot of discussions that there is no good tool for Windows platform. After forethought I have decided to used TortoiseGit . I also feared of difficult work related with Git as a lot of articles mentioned many instructions. As I already said, I have decided to use TortoiseGit, because I'm used to work with TortoiseSvn, but for start, MSysGit is enought. So this article is about MSysGit , next will be about TortoiseGit . How to start with MSysgit on local machine? Download and install Git for Windows Create source code directory for your git app Right click the directory at your favorite file browser. Menu should contain item "Git init here". It initializes chosen directory to be git-abled :-) It was your first usage of Git. Commit data to local Git repository Now, you can add any file, your first source code, to created directory. If you are prepared to commit any changes to your local git repository, follow next instruc

HD2 Energy Rom 10/14 steals battery!

I really like energy rom for my HD2 . After month and half I re-flashed HD2 device from later august energy rom to current one - 14.10.2010. I have chose great looking .Sencity theme, see attached screenshot. I love it. But the worst surprise wait for me. After two weeks of using I can say that current energy version consumes two times more of battery. HD2 has drain the whole battery within three days, but current version is out easily in one or one and half day. Consider if you need to move on to new version! I have suspected lock screen of Cookie Home Tab in beta 2 but switching to the normal build-in one didn't improve battery consumption and the only app I have installed is great Twitter MoTweets . Maybe it can be caused by the whole betaversion of CHT. NRG still supports CTH in final 1.8.5 version. So, I'll try it :-)

C#: LINQ and Foreach performance comparison

I'm currently solving performance issues we have programmed within the last milestone. A lot of bugs were already fixed but very interesting issue hasn't. I have liked and preferred LINQ queries over simple foreach command. Mentioned performance issue was based on the following query. Entity e = entities.Where(e => e.Id.Equals(id)).FirstOrDefault(); Our list contains few items, for the worst case the only one. It's necessary to make the search because there can be obviously more items. I was surprised by results raised from simple test which is attached at the bottom of current article. Test simply inserts 1, 50 and finally 100 unique entities to the list. Each entity holds only string identificator (UUID). Each listed algorithm try to find entity placed at the end. I have tried these approaches: LINQ query simple foreach map having entity id as key The result is very interesting as attached table and chart show. The map was included only for the confront

JDownloader: hotfile, rapidshare best downloader

I was used Free download manager to download my favorite TV series (e.g. IT Crowd or new interesting BBC's Sherlock) from well know data storages, like rapidshare or hotfile . I've tried JDownloader and I'm really impressed all those features which the tools provides in comparison with standard lightweight managers. Interesting features you can only copy links to download into the clipboard at your favorite forum, switch the focus back to JDownloader, it automatically use these links as datasource, add them into link grabber and than check their online status (if they are downloadable)! You can see their availability in a few seconds support the usage of huge amount of paid accounts. You simply add your credentials into system, add links and it works - download files - you need obviously possess these accounts :-)  build in extract support - if you add links to the data spread into more rars, the JDownloader's plugin can unrar them after successful download a

Miniwelt - Mini World, Lichtenstein, Germany

Do you want to see the best know buildings in the world ever all together at the large garden? Visit Lichtenstein , the small village near Dresden, east Germany. The miniwelt , means "mini world" in german, allow you to do that during one afternoon. Eifell tower, pyramids, White house, Statue of Liberty, Pisa tower and a more and more. See the image gallery . What else in the west Germany? Lichtenstein is about 80 kilometers far by higway E40 from Dresden . The town, totally destroyed by World War II. The historical center is now, 55 years later, amazingly rebuilt, worth to see . Note that all shopping centers are not opened on Sundays in Germany :-)

How to improve HTC HD2? Use energy ROM!

I'm really satisfied with my cell phone HTC HD2 . I've bought the device in February and I truly like the change, the innovation. Logically, I've started to consider flash HD2 by one of many ROM's developed by guys around xda-developers . There were three main reasons why I did it. the device suffers by child ailment like wrong delivering of SMS. I've no time to watch and search forums and apply released patches there are a lot of handful applications around HD2 there are a lot kinds of settings, it's hard to fine tune the device The most widely known rom is the Energy rom . What do you need to do to flash your device? There are two simple steps described in details within the article . Note that you should make the all flash stuff on the notebook to prevent against the blackout. What the energy ROM brings me? I have got the updated device all the time as I'm flashing it couple times per month. The rom contains almost 40 applications, see the

Hockey arena: Modanovi Hosi RIP

As I declared within my previous article , I have sold out all my players and 30 day dead-line is currently running so my team will be deleted in a while. Hockeyarena is going down as there are no new improvements so I have started to play power play manager . Modanovi Hosi is former first czech league team, the top was the sixth place in there. Here is my history (shorten when my paid account expired) as well as the latest financial state.

HTC HD2 produces terrible photos

I have relied on my HTC HD2 as secondary photo-compact device on vacation. I took also old-school 4mpx samsung too which became later my primary compact. I'm still really disapointed how poor photos HTC HD2 produces. Despite automatic or default settings of HD2's photo-module it looks like the oil paint. See attached images.

Souhrn nejčtenějších zpráv

Když se člověk vrátí po dovolené, rád by si někde přečetl souhrn nejčtenějších zpráv, které se udály za dobu jeho nepřítomnosti. Existuje něco takového na zpravodajských serverech? nabízí archiv , kde je možné zvolit ostrov a datum. Bohužel neumí datumové intervaly ani řadil dle nejčtenějích. jsou nadějnější, mají na své základní stránce box "nejčtenější", bohužel vybírat lze jen za poslední den, tři dny a týden. Zobrazeno je pak jen pět nejčtenějších článků. aktuálně.cz nabízí asi nejlepší archiv , bohužel bez možnosti řazení podle čtenosti Pokud zabrousíme na zahraniční servery, najdeme výrazně zajímavější stránky. BBC nabízí celkem zajímavou most popular sekci , ale bez možnosti specifikace delší doby CNN má most popular také, ale opět bez možnosti řazení  Obávám se tedy, že přečíst si zmeškané zpravodajství za dovolenkovou dobu není tak snadný oříšek. Člověk se opět musí prodírat spoustou nepodstatných zpráv, tak aby se dostal k podstatném

Sell out of all players at

I'm selling out all players right now. One player will go to the market each work day. See the following image to get further informations about them. Here is even their loyalty:

Limited "unlimited" plans available in Czech T-Mobile

Ufff, Czech T-Mobile sux! Czech is the country having the worst set of operators within emerging markets. Before almost two years I have conclude the agreement with T-Mobile. Unlimited whenever minutes to five numbers for 500 czech crowns per month. Looks good. Till next month, T-Mobile is changing the agreement to 300 whenever minutes in the same price. Sounds almost illegal. I don't want to T-Mobile wrong, you can quit your agreement but you have to do it 20 days before new policy will start to serve. I'll bet that 90% of customers let it alone. Honestly, described policy change comes in useful to me. I have consider to leave T-Mobile to Vodafone in four months but I'm (actually was) still under contract so I can legally quit my contract right now. Good for me but I don't understand the arrogance of T-Mobile guys. Beside this issue I'm really disappointed of their mobile internet. I'm paying 10 euro per month to 100MB FUP mobile internet with port res

Google apps and blogger, blogspot

I spent half and hour by searching how to use blogger service within my own website which is powered by Google Apps . How I went through all forums topics, It seemed that Google Apps is not supposed to work and allowed to use. Ok, I created new blog on blogger site and write first article. But I haven't give it up and have tried to search again this evening. So I have been surprised that solution is so simple. Sometimes reading of manual is worth, see How do I use a custom domain on my blog?

Great reading: studying material for Sun' SCJP by Sybex

I have started to read book SCJP: Sun Certified Programmer for Java Platform Study Guide: SE6 (Exam CX-310-065) . This reading is great for huge spectrum of programmers, even senior java one has to find places where he can gain new knowledge. I had to continue reading SCJP book despite I'm currently working on project having .NET behind. It helped me to understand stuff "behind the wall", what compiler allows, how works inheritance. The book covers all materials likely using within technical interviews :-) You couldn't be caught so easy :-)