Last week, I stumbled upon the following piece of code:
IList<double> doubles = new List<double> {22.123, 400.12, 100.22}; foreach (int number in doubles) { Console.WriteLine("The Current Number Is : {0}", number); }
Can you see the bug in that code? We convert all of the doubles in the list to integers, truncating them. I was very surprised that the compiler didn’t warn me about this issue, especially because the compiler would not let me write this code:
Suppose you have several objects in your WPF application filled with similar Brushes which differ in brightness only. Like in this image:
The nine rectangles use the same RadialGradienBrush but each rectangle is a little darker than previous. You can create these 9 different brushes in your favorite design tool (Expression Blend, etc.). But what if you need to change the base color later or you just need to make the brush user-configurable? Like in these samples:
Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. As such, it is not just a method for building "web services." The terms "representational state transfer" and "REST" were introduced in 2000 in the doctoral dissertation of Roy Fielding,[1] one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification.
REST is a method of managing resources over HTTP. There are a number of methods of interacting with resources via REST.
| HTTP | CRUD |
| POST | Create |
| GET | Read |
| PUT | Update, Create |
| DELETE | Delete |
Systems which follow Fielding’s REST principles are often referred to as "RESTful".
Hey all
I am sorry for the long absence but I just got married and went on a great honeymoon, so I was not around!
I hope things will start to pick up from now.
Just wanted to let you all know that we are back online, and to tell you that we have updated the Write [...]
Let me share you with one of the weirdest errors I ever encountered. Recently, I have been working on a distributed application which is built from a server and some clients. The clients are Windows Forms applications. Yesterday, I spent a whole day chasing a very weird and strange error - I was getting an exception at the main method (unhandled exception) of the client application. Here is what I got:
The error description was:
Tab menus are a fairly common thing that I use in a lot of my applications. I like tabs because they help break up large chunks of, usually, related information.
At work we use RadControls for Telerik and they have a pretty nice tab menu control that is easy to use and looks good too. The only problem with these controls is that they only work in WebForms like even the default ASP.NET controls. So when I started playing with MVC I quickly realized I would need to spend some time building some of these controls myself.
Hi
I wanted to show the usage of these two very useful debugger attributes. If you don’t know them keep on reading, they are very useful.
This attribute allows you to customize the way an object is displayed. lets look at the following example:
p>Hey all.
This weekend I typed Dev102 on google just to see what I will get and guess what? We have joind the big league
We have site links!! This is what you get when you type Dev102 in Google:
Now all we have to do is get the links to point to the interesting stuff.
Well we’ve arrived at the last part of our series on ASP.NET MVC. In this post we’ll be looking at Views, ViewData, and HTML Helpers. We’ll be discussing how to call Views from Controllers and how to use HTML Helpers to create your markup.
Suppose we receive the following request; http://yourdomain.com/Task/Show/23. The request would map to the following controller.
1: public class TaskController : Controller
2: {
3: public ActionResult Show()
4: {
5: return View();
6: }
7: }
Hi
A while ago Shahar wrote an article about whether WPF Data Binding is Thread safe. Shahar’s findings were that Even if you change a property from a different thread the PropertyChanged event will be called on the UI Thread making Binding Thread Safe.
I have created a Window with 2 TextBlocks, one of them is binded to a Dependency Property and the other is binded to a regular property:
The Window:
1: <StackPanel>
2: <TextBlock Text="{Binding DpTxt}" Width="100" Margin="5"></TextBlock>
3: <TextBlock Text="{Binding Txt}" Width="100" Margin="5"></TextBlock>
4: <Button Content="Change Text" Margin="5" Click="Button_Click"></Button>
5: </StackPanel>
We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution
Learn More