27 Haziran 2012 Çarşamba

html vertical line

Unfortunately, there is no explicit element in html in order to draw a vertical line .. However, there are 3 ways to achieve this:
<td width="5%"style="border-left: 1px solid black; padding: 5px;">   </td>
2) With 1-pixel image
3) With css (div) 


Another option is to draw very thick and short horizontal line: http://forum.yola.com/yola/topics/vertical_lines_using_html

25 Haziran 2012 Pazartesi

error : The underlying connection was closed: The connection was closed unexpectedly.

If the error
{"The underlying connection was closed: The connection was closed unexpectedly."}
blows up for some of the web service methods, while others work correctly, the reason may be the return objects refer to each other in a recursive manner. 
In my condition, i got the error while returning Sentence.
Paragraph() {
     List<Sentence> Sentence;
}
Sentence() {
  List<Paragraph> SomeText;
}
When the type of SomeText is changed from Paragraph  to Sentence, everything works fine!

error: LINQ to Entities does not recognize the method ...Last

The complete error message is as follows :


{"LINQ to Entities does not recognize the method 'Core.Sentence Last[Sentence (System.Collections.Generic.IEnumerable`1[Core.Sentence])' method, and this method cannot be translated into a store expression."}

and the causing line is:


retList = (dal.Paragraph.Include("Sentence").Where(p => p.Sentence.Last().Topic.ID == topic.ID)).ToList();

This is because Last and LastOrDefault are just not supported by the LINQ to SQL query translator.
http://forums.asp.net/t/1480557.aspx/1

The solution is ordering Sentence in descending order and use FirstOrDefault instead of Last:

 retList = (dal.Paragraph.Include("Sentence").Where(p => p.Sentence.OrderByDescending(s => s.ID).FirstOrDefault().Topic.ID == topic.ID)).ToList();


codefirst inheritance strategies

I am in the .net world  for a while and bumped into several technical problems so far. I plan to post the problems with their solutions when i have time for this. I also want to write a post comparing .net and java platforms. For now, it is enough to state that i am a java fan..

http://romiller.com/2010/09/29/ef-ctp4-tips-tricks-code-first-inheritance-mapping/  is an article about how codefirst handles inheritance during table generation. To sum up, default table generation strategy is Table-per-Hierarchy (TPH) which keeps all data in one table created for the base type and automatically creates a Discriminator field in order ro discriminate different types. Table-per-Type (TPT) creates a table for the base type with shared columns and different tables for each derived type whereas Table-per-Concrete Class(TPC) creates an entirely different table for each class.. However, when the table generation strategy is modified, previously working code may start to blow up.. Moreover, performance is best when the default strategy (TPH) is used: http://blogs.msdn.com/b/adonet/archive/2010/08/17/performance-considerations-when-using-tpt-table-per-type-inheritance-in-the-entity-framework.aspx

29 Mayıs 2012 Salı

trac on windows

Trac (http://trac.edgewall.org/) is my favorite issue tracking tool. However, installing trac on windows is not a straightforward task. The easiest way to achieve this is by using bitnami.. .http://bitnami.org/download/files/stacks/trac/0.12.3-0/bitnami-trac-0.12.3-0-windows-installer.exe
Just run the exe, specify a port for trac, specify a project name and enjoy yourself..