2 Temmuz 2012 Pazartesi

clean code

While looking for coding best practices, i discovered this book: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 . It is very easy to read with funny drawings..
The guidelines in  http://csharpguidelines.codeplex.com/ are worth sharing as well..

29 Haziran 2012 Cuma

get ID of an entity before SaveChanges()

Unfortunately, when using automatically generated ID s in database, it is not possible to get the ID before doing SaveChanges().

http://stackoverflow.com/questions/6029711/id-of-newly-added-entity-before-savechanges/6029864#6029864

how to write content of dictionary to file

In order to write the content of a dictionary to a file:


        public static void writeDictToFile(Dictionary dict, string filename) {
            File.WriteAllLines(filename + ".txt",
            dict.Select(x => "[" + x.Key + " " + x.Value + "]").ToArray());
        }

http://stackoverflow.com/questions/3067282/how-to-write-the-content-of-a-dictionary-to-a-text-file

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!