Mar
21st | 2008

Ajax ScriptManager Error BC30560

Posted by Amit |
Filed under ASP.Net |

A few days ago I was working on a web application and when I added a ScriptManager and a ScriptManagerProxy  to the Master Page and Although the compilation was successful. I got the following error on the designer:
‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’,
I said to my self: ah, probably another one of the Visual [...]


Continue Reading...
Mar
19th | 2008

How to Use HttpWebRequest over SSL

Posted by Shahar A |
Filed under C#, Web Development |

If you try to use HttpWebRequest for calling secured sites, and you are getting the following exception: “The underlying connection was closed: Could not establish trust relationship with remote server” here is what’s happening and how you can (hopefully) solve it:
When browsing to a secured site with your web browser, you get a dialog asking if you [...]


Continue Reading...
Mar
19th | 2008

Why Convert.ToInt32 Might be Dangerous

Posted by Shahar A |
Filed under C# |

Casting float to int is interesting. Not only it causes the value to get truncated, but it also changes binary representation. When you want to cast float to int you have two options:
1) If you came from c/c++, there are several ways to do cast operations but the natural thing would be to use (int).
2) You [...]


Continue Reading...
Mar
18th | 2008

How to convert Minutes to Hours With PHP

Posted by Amit |
Filed under PHP |

I know that when you read the title you said “What is he talking about? Its easy”. Well it turns out that its not that easy. It took me a while to collect and create this, but here it is: a PHP code that converts minutes to hours.
<?php function ConvertMinutes2Hours($Minutes)
{
if ($Minutes [...]


Continue Reading...
Mar
17th | 2008

Find Controls in an ASP.NET Page with A MasterPAge

Posted by Amit |
Filed under ASP.Net |

As we all know whenever we build an ASP.NET application with a MasterPage, all the controls receive a prefix such as “ctl00$<ContentPlaceHolderID>$<NameYouGaveToControl>”  to their names according to their place in the page hierarchy. That is done in order to prevent from two controls to have the same ID on the same page.
We encounter a problem [...]


Continue Reading...
Mar
16th | 2008

A .NET memory leak you did not think about

Posted by Amit |
Filed under .Net |

Although the .NET Framework takes the memory management task out of your hands, there are still a few things that you must pay attention to when disposing of an object in order for the Garbage Collector to do its work properly.
You would think that once you remove the reference from an object it will eventually [...]


Continue Reading...
Mar
14th | 2008

How to Get Visual Studio to Create New Classes Public by Default

Posted by Amit |
Filed under .Net, C#, Visual Studio |

This is a good one!
Every one knows that when you add a new class to a project it is private by default, but still when you compile for the first time, the compilation fails and only then you remember to add the “public” before the class name. Tired of this? Here’s what you do in [...]


Continue Reading...
Mar
14th | 2008

My New Theme

Posted by Amit |
Filed under Utilities |

Hi everyone.
 I am proud to present my new theme. It took me some time to build it but i think it is great. it is base uppon the o2 theme by eches so thanks to him for releasing it.
And many thank to my girlfriend Nitzan who gave me much help in the design process.
I would love [...]


Continue Reading...
Mar
11th | 2008

A Simple Example of Extention Methods in C# 3.0

Posted by Amit |
Filed under C# |

Extention Methods are a very useful tool we just got in C# 3.0. We could define them as static methods that extend existing classes, Even System classes!!!
If we wanted to do something like that in the past we had to derive from the selected class and extend it with whatever we wanted. But what if [...]


Continue Reading...
Mar
10th | 2008

How to Sort Elements in a Content Control Without Touching The Data.

Posted by Amit |
Filed under C#, WPF |

Often we want to display a list of elements and allow the user to sort them in various ways. There are many ways to do it and I wanted to show you how to use a SortDescription Object. What is a SortDescription object you ask? It receives two parameters in its constructor: the first is [...]


Continue Reading...

Search Dev102