This is a simple example of how to use xml serialization to make configuration files.In many cases there is no need to use System.Configuration namespace members for application configuration file. This article will focus on XML serialization. The main idea is to create class which holds configuration data and then, serialize it to a file using XmlSerializer. Classes that can be serialized using XML must be declared as public and have a parameterless constructor. Also serialized members must be public. For more information about XML serialization please refer to http://msdn.microsoft.com/en-us/library/182eeyhh.aspxTo serialize and deserialize data use corresponding methods from XmlSerializer class (System.Xml.Serialization). Both of them operate on stream objects. The following code sample demonstrates creating, reading and saving of simple configuration file.Read more: C# Corner
Thursday, February 04, 2010
20+ .htaccess Hacks Every Web Developer Should Know About
Apache's .htaccess(hypertext access) configuration file can be a very powerful tool in a web developer's toolkit if used properly. It can be found in the webroot of your server and can be easily edited using any text editor. In this article I'm going to show you 20 .htaccess hacks and how to use them. Before I start with this article I'd like to start by saying that abusing the .htaccess file will hurt the performance of your website. The .htaccess file should only be used if you have no other way to achieve certain things. Make sure to back up your current .htaccess file before applying any of the following hacks.1. Prevent HotlinkingTired of people using your bandwidth by putting the images hosted on your server on their website? Add the following code at the bottom of your .htaccess file to prevent hotlinking.
view source
print?
1 Options +FollowSymlinks
2 #Protect against hotlinking
3 RewriteEngine On
4 RewriteCond %{HTTP_REFERER} !^$
5 RewriteCond %{HTTP_REFERER} !^http://(www.)?domainname.com/ [nc]
6 RewriteRule .*.(gif|jpg|png)$ http://domainname.com/img/stop_stealing_bandwidth.gif[nc]NOTE: The following article explains better methods to "prevent" hotlinking:
Link building secrets by Maurizio Petrone
2. Block All Requests From User Agents
3. Redirect Everyone Except Specified IPs
4. SEO Friendly 301 Redirects
(more...)Read more: DevMoose
view source
print?
1 Options +FollowSymlinks
2 #Protect against hotlinking
3 RewriteEngine On
4 RewriteCond %{HTTP_REFERER} !^$
5 RewriteCond %{HTTP_REFERER} !^http://(www.)?domainname.com/ [nc]
6 RewriteRule .*.(gif|jpg|png)$ http://domainname.com/img/stop_stealing_bandwidth.gif[nc]NOTE: The following article explains better methods to "prevent" hotlinking:
Link building secrets by Maurizio Petrone
2. Block All Requests From User Agents
3. Redirect Everyone Except Specified IPs
4. SEO Friendly 301 Redirects
(more...)Read more: DevMoose
Embed an Assembly as a Resource
If your application uses another dependent assembly, you have to deploy this assembly also together with your application. In some cases however, you wish you could only deploy your application assembly – and nothing else. To achieve this, you could embed the dependent assembly as a resource into your application assembly. Unfortunately, this is not the whole story. You also need some other things, which I will describe in the following. As an example, I will use the embedding of log4net.dll.I assume you already have an application using log4net. If not, it is a good idea to first create the application with the complete functionality. Not before nearly the end, embed the dependent assembly. Embed the ResourceThe start is quite intuitive: add a folder Resources to your project, add the log4net.dll to this folder, and change its build action to Embedded Resource.
Read more: Codeproject
Read more: Codeproject
Introducing WCF WebHttp Services in .NET 4
Over the next six weeks we are going to be releasing a series of blog posts that will focus on the new features in .NET 4 around WCF WebHttp Services. WCF WebHttp Services is the flavor of WCF that is most appropriate for developers who need complete control over the URI, format, and protocol when building non-SOAP HTTP services—services that may or may not subscribe to RESTful architectural constraints. For the other technologies in the WCF services eco-system and the developer scenarios they best support, see here. For those of you who have used WCF 3.5 or the WCF REST Starter Kit to build non-SOAP services, you’ll find that WCF WebHttp Services is the vehicle that brings these technologies forward to .NET 4. You’ll find the familiar programming model that uses [WebGet] and [WebInvoke] attributes to map an HTTP request to a WCF operation. But you’ll also find a number of new features in WCF WebHttp Services that make it even easier to build operation-centric or RESTful web services over HTTP. Read more: The .NET Endpoint
An Excellent Tutorial on Secure Networking Protocols
Yesterday, while searching for information about related topics, I stumbled across a tutorial on Secure Networking Protocols from RAD University.Although I already knew most of what it covered, I read it all the way through, anyway, just for the sheer joy of reading something so well written, and I learned a few new relevant things, in the process.
Read more: Jack Greenfield's Blog
Official site: Secure Networking Protocols
Read more: Jack Greenfield's Blog
Official site: Secure Networking Protocols
WMI Code Creator

* Executing Methods
* Receiving Event Notification
* Browse WMI names spacesRead more: Ask the Performance Team
Amazing .NET Reference Visualizations
Half the battle when tracking down memory problems in a .NET application is seeing the reference chain so you can see why an object is still in use. You can use SOS and its !gcroot command to track them down, but that can bring new definitions to tedious. If there were only away to see all the data that !gcroot pumps out graphically…. Chris Lovett had a brilliant idea: why not use the cool new Directed Graph Markup Language (DGML) to show the output of !gcroot? Chris recorded a video to show you how to use his GCRootToDGML tool. Being able to see your references opens up all sorts of interesting analysis you can do as to who's holding onto your objects. Not only does DGML make things simple, they are artistic. The last view in Chris' video has a Zen quality to it. Now my mind is spinning on all sorts of other analysis tools we can do with DGML. Read more: John Robbins' Blog
Android, Part I: Welcome To Android
Welcome to Android. We hope you enjoy your stay.So, first off, a bit of an introduction. This is the first part of (hopefully) many tutorials related to the android platform. In this tutorial, we're only going to cover the very basics: how to design your application, and how to utilise the XML layouts to design your user interface. Since this series of tutorials is more directed at the code, I'm not going to cover setup & installation. Instead, here's a link to get yourself set up with the SDK and an emulator.Personally, I've never really been a huge fan of Java. And when I first tried Android, I wasn't too keen. But it's come a long way since it was first released. Once you get into the android SDK, it begins to get really interesting. Plus, the idea of earning a little bit of cash on the side for designing a little app for your phone has quite a nice appeal. :) The market
The market is awesome. It's extremely easy to release and update your applications, and I'll be writing a tutorial all about publishing your apps, how to sign them, how to create a jar keystore, all the fun stuff. Get started already!!1!one!
Okay. Enough intro, let's get to some development! :)...sorry. No programming yet. We're going to be reading the project template, and I'll be explaining it line for line. It's best to take this stuff slow at first, because it's so different to a lot of "regular" projects. But at least there's code! Read more: </dream-in-code>
The market is awesome. It's extremely easy to release and update your applications, and I'll be writing a tutorial all about publishing your apps, how to sign them, how to create a jar keystore, all the fun stuff. Get started already!!1!one!
Okay. Enough intro, let's get to some development! :)...sorry. No programming yet. We're going to be reading the project template, and I'll be explaining it line for line. It's best to take this stuff slow at first, because it's so different to a lot of "regular" projects. But at least there's code! Read more: </dream-in-code>
30 Websites To Download Free Stock Photos
Using stock photos in the design can save us a lot of time. Instead of hiring a photographer, you can instantly access high quality of stock photography by browsing through the stock photo websites.There are a lot of websites offering stock photos. Some of them are free, while most of them aren’t. So, if you are going to use stock photos in your design, you have to be aware of the license and agreement that may be involved. Today, we are going to share 30 websites where you can download free stock photos. If you found any free stock photo website that isn’t in the list, feel free to send me or add through comment.1. stock.xchng
2. Studio7designs
3. Woophy
4. freerange
(more..)Read more: WebDesignBooth
2. Studio7designs
3. Woophy
4. freerange
(more..)Read more: WebDesignBooth
Getting Started with the ASP.NET MVC Framework – Installation and “Hello World”
Why MVC? That is a reasonable question. Model–View–Controller (MVC) is an architectural pattern used in software engineering.This is different from Web Forms (Traditional ASP.NET Web Applications). In ASP.NET applications that do not use the MVC framework, user interaction is organized around pages, and around raising and handling events from the page and from controls on the page. In contrast, user interaction with ASP.NET MVC applications is organized around controllers and action methods. The controller defines action methods. Controllers can include as many action methods as needed.
Think in terms of URLS calling Methods – No mapping to html or aspx or jsp, etcThe breakthrough of Visual Basic 3 is that developers would just respond to events, such as clicks on buttons. You would spend your day doing “event – driven” development by writing code that would execute based on click of a mouse. Read more: Bruno Terkaly - Developer Evangelist
Think in terms of URLS calling Methods – No mapping to html or aspx or jsp, etcThe breakthrough of Visual Basic 3 is that developers would just respond to events, such as clicks on buttons. You would spend your day doing “event – driven” development by writing code that would execute based on click of a mouse. Read more: Bruno Terkaly - Developer Evangelist
What is the maximum length of an environment variable ?
A customer noticed that environment variables were being truncated at 2047 characters and wanted to know what the maximum length of an environment variable is.This is one of those cases where you can answer the customer's question or you can try to answer the question the customer is really asking. If you just answer the question, you're doing the customer a disservice. The theoretical maximum length of an environment variable is around 32,760 characters. However, you are unlikely to attain that theoretical maximum in practice.All environment variables must live together in a single environment block, which itself has a limit of 32767 characters. But that count is the sum over all environment variable names and values, so you could, I guess, hit that theoretical maximum length if you deleted all the environment variables and then set a single variable called X with that really huge 32,760-character value. In practice, of course, you have to share the environment block with all the other variables in the block, so your random call to SetEnvironmentVariable with a 32,760-character string is unlikely to succeed. But that's not your only practical limit. Read more: The Old New Thing
Moonlight 3.0 Preview 1
We have just released our first preview of Moonlight 3.0.This release contains many updates to our 3.0 support, mostly on the infrastructure level necessary to support the rest of the features. In the release: * MP4 demuxer support. The demuxer is in place but there are no codecs for it yet (unless you build from source code and configure Moonlight to pick up the codecs from ffmpeg).
* Initial work on UI Virtualization.
* Platform Abstraction Layer: the Moonlight core is now separated from the windowing system engine. This should make it possible for developers to port Moonligh to other windowing/graphics systems that are not X11/Gtk+ centric.
* The new 3.0 Binding/BindingExpression support is in.
* Many updates to the 3.0 APIs Read more: Miguel de Icaza
* Initial work on UI Virtualization.
* Platform Abstraction Layer: the Moonlight core is now separated from the windowing system engine. This should make it possible for developers to port Moonligh to other windowing/graphics systems that are not X11/Gtk+ centric.
* The new 3.0 Binding/BindingExpression support is in.
* Many updates to the 3.0 APIs Read more: Miguel de Icaza
TeamCity

TeamCity is a continuous integration and build management system. With TeamCity, you can set up a build server within minutes and enjoy out of the box continuous unit testing, code quality analysis, and early reporting on build problems — even without leaving your favorite IDE. TeamCity offers a gentle learning curve, so you can quickly improve your release management practices by gradually adopting its advanced features and capabilities. Read more: TeamCity
QuickUnit
I’m a developer who’s not familiar with unit testing…QuickUnit can help you! We know you don’t really need to learn what NUnit is, what are Mock objects and how to use them all. With QuickUnit you can focus on what you want to test without the “overhead”. And don’t worry about making mistakes – QuickUnit will warn you if you derail from best practices. Read more: QuickUnit
Wednesday, February 03, 2010
Reflection in .NET
In this article I tried to cover all the topics from .NET Reflection with examples. I have stated with definition of .NET Reflection and its road map, list of mostly used classes the System.Reflection namespace provides and importance of Type class in .net Reflection. You will also learn how to get the type information using different ways. Use of properties and methods of Type class in .NET Reflection with examples are interesting in this article. You will also see advance Reflection topic like dynamically loading an assembly and late binding end of this article. Read more: C# Corner
Subscribe to:
Posts (Atom)