Category: "Programming"
Inconsistency between windows by NHibernate.
I am writing a library management system for church. This is using Spring.Net and NHibnerante. But I faced a problem. After the user updated in a record window, the record in the main window did not get updated. I have read Spring.net Tutorial. That is nothings wrong. Even I forced the session flush. But that did not work. In the session of the record edit window, the fields are updated. When I jumped back to Main Window, the session is updated. Finally, I found the problem in the Transaction attribute. In the DAO, the code should be written like this:
Code
[Transaction(ReadOnly = true)] | |
public IList<TEntity> GetAll() | |
{ |
And the update method
Code
[Transaction] | |
public void Save(TEntity entity) | |
{ |
C# in iPhone
I found that actually you can develop iPhone app in C#. There is an application from Novell, MonoTouch. I read the documentations, it seems to be directly interface with the native iPhone OS. That sounds quite nice and it supports iPhone OS. Although it sounds powerful, it is not a freeware. Even the professional edition costs $399!
TableLayoutPanel can hold only one control
I was tried to drop two buttons into TableLayoutPanel(Winforms). I can't do it. I thought TableLayoutPanel should works very similar with GridPanel in WPF. It should hold multiple controls. I thought that should be the problem my SharpDevelop. So, I tried to upgarde my SharpDevelop to the latest, version 3.2. It still doesn't. Thus, I believe TableLayoutPanel can hold only one control.
To solve this issue, the solution is very similar, just dropping a panel inside the cell of TableLayoutPanel. That works! Panel control can multiple controls.
Center aligning the buttons in a Windows Form
I was trying to align some buttons in the center of a windows form. I was tried to find any properties in a button can set it to be center aligned. But there is no such property! I tried to use layout controls. The table layout control can be very similar stuff. That is still not what I want. Of course, I can do it in the windows resizing, changing the button positions by codes. But that is too complex! Finally, I found a simple way. I just drop a panel at the center position and set no achor. I think that makes it flow at the center.
And then, you can drop buttons in the panel and set their achor property to "Top, Bottom, Left, Right"
Then it will move to the center position when the windows is resized.
Sqlite is good for a standalone system
I have been asked to build a library management system for my church. That is very very simple system. The system only needs to track the borrow records. I don't think that even needs a database. Orginally, I planned to use serialization for storing the records. But if in future, they want the records to be viewable on our church website as well. Then I need to port the records to the database and change the application to use a database. OK, maybe, that is good to install mySQL in the computer. Well, that is too over-kill the resources. So, I found Sqlite. It can relpace the flat system to store the record. Moreover, it has an ADO.Net driver and is fully supported by NHibernate. In the future, I can port the codes to another database technology by changing database driver in NHibernate. Finally, I chose Sqlite as the data storage.