Switch On The Code RSS Button - Click to Subscribe
Jul
28

C# Snippet Tutorial - Comparing IP Addresses

Comparing two IP Addresses is something that has caused me frustration on more than one occasion. Simply put, I always assume the default == operator will tell me if the addresses contained in the objects are equal, and as always, it does not.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | No Comments »

Jul
25

C# Snippet Tutorial - The Web Browser Control

Ok, so you may be thinking to yourself “Why do I need a browser control when I have Firefox or IE?”. Well, considering it has all the power of Internet Explorer, you can use it for lots of things. You can use it to show a website in your application or even just load in an HTML file from the local computer. The greatest thing is that it is quite easy to use and control.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | No Comments »

May
8

C# Snippet Tutorial - Dictionary Collections

So, we have all used arrays, and even sometimes a nice HashTable to get things sorted and organized. There are so many uses for an array, and even more for a nice HashTable. But, have you ever noticed that a HashTable is all objects? The Key in each Key/Value Pair is an Object, along with the value itself. But what happens if you don’t need something so generic as an object? Well, you can get really specific and really crazy with a collection called Dictionary.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 2 Comments »

Feb
22

C# Snippet Tutorial - Using the FileSystemWatcher Class

There are several reasons why an application might want to monitor for changes to specific files or folders. .NET’s FileSystemWatcher class makes doing this incredibly easy. This C# snippet tutorial will introduce you to the FileSystemWatcher class and walk you through the basic usage.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 1 Comment »

Dec
13

Flex Snippet - Duplicating a Vector (Movieclip) Image

Problem Summary

You need to duplicate/clone a image that is loaded from a swf (a vectored image). This could be for any reason, but one situation would be for caching images.

Solution Summary

The Flex Image class will store the data representing the image in the content property. When a swf image is loaded into the Image the content, this will be a Movieclip which has a loaderInfo property which gives you access to the actual byte array behind the data that is loaded. Now to solve the problem you need to copy/load the bytes from one image into a new loader and set the source of the new image equal to the new loader.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 4 Comments »

Dec
6

C# Snippet Tutorial - Performance Timers

Every once in a while, there comes a time when some chunk of code that you have written isn’t performing quite as well as you think it should. And when that time comes, you need to have a way of figuring out what parts of your code are causing those performance problems. For the heavy duty cases, there are full blown code profiler programs out there, but for the simpler cases you probably just want to time some segments of code manually. And that is what we are going to take a look at today.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 6 Comments »

Dec
4

C# Snippet Tutorial - Static Constructors

I’m going to guess that pretty much everyone who reads this blog knows about constructors and how they work. And I bet everyone knows about static variables and functions as well. But did you know that there is such a thing as a static constructor in C#? Yup, a static constructor. And that’s what we are going to take a look at today.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 8 Comments »

Nov
22

C# Snippet Tutorial - The Params Keyword

We are going to take a quick look at another C# keyword today - the params keyword. This keyword is another one of those not well known keywords in C#, but it makes life a lot easier in certain situations - and code a lot cleaner. What does the params keyword do, you ask? Well, lets take a look.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 5 Comments »

Oct
16

Flex Snippet Series - State Transitions

This is going to be a quick tutorial over using transitions when changing states. It is going to build off the states basics from this tutorial. Again states are very useful in almost all applications and using transitions can put some nice eye candy on your application. This will show some cool transition effects.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 3 Comments »

Sep
21

Flex Snippet Series - States Part One

One main feature in Flex that has many many uses is States. This tutorial is the first in a multi-part series on how to use States and what they are. States are defined as a collection of changes to a view. With the changes you can do multiple things including adding and removing child components, change component properties, and add effects. This first tutorial will give a quick rundown of changing the view by adding components depending on the state.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 1 Comment »

Sep
17

C# Snippet Tutorial - How to get an Enum from a String

Earlier, we posted a tutorial on how to get an enum from a number. In this tutorial we’re going to show you how to use a similar technique to get an enum from a string.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 4 Comments »

Aug
30

Flex Snippet Tutorial - Bindable Meta Tag Part 3

This is the third piece in a snippet tutorial series about the Bindable meta tag. This time I am going to go through how to use custom events with your bindable objects. Part 1 of the series can be found here and part 2 can be found here, they cover the basics of the meta tag and how to use it in simple situations.

 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 3 Comments »

Aug
23

C# Snippet Tutorial - How to Draw Text on an Image

In this snippet tutorial we’re going to be adding on to our series of C# image editing tutorials. This tutorial is going to provide the code required to do basic text drawing including anti-aliasing and text aligning.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 9 Comments »

Aug
21

C# Snippet Tutorial - Editing the Windows Registry

In this tutorial, I’m going to go through the code required to edit the Windows registry using C#. This will include creating new keys and values as well as modifying existing ones.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 3 Comments »

Aug
14

Flex Snippet Tutorial - Using The TextRange Class

The guys over at Adobe have provided us with a lot of classes that simply make our job as developers very easy. Today I am going to go over one of this classes, TextRange. This class allows us to bind to one of several components and get/set properties about the text in that selection. The properties that can be modified include the text itself and the styles for the text. The namespace for this class is mx.controls.textClasses and the Adobe documentation page can be found here for further info.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 8 Comments »

Aug
6

Flex Snippet Tutorial - View Stack Component

The Flex framework has a few different components to modify the layout on the page. This small tutorial is going to go over one of those options, the ViewStack component. This component is a fairly simple component that lets the programmer have multiple ui layers on one panel, but flip between which one is visible cleanly and easily.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 2 Comments »

Aug
1

C# Snippet Tutorial - How to Get an Enum from a Number

To continue our snippet tutorial series, here’s a quick tutorial on how to convert an integer to an enum. This is useful when you’ve got a number, either from a file or transfered over a socket, and you want to convert that number to an enum.
 
Read More »

Posted in Snippet Tutorials, C#, All Tutorials | 4 Comments »

Jul
31

Flex Snippet Tutorial - Bindable Meta Tag Part 2

This short tutorial is part two in an ongoing series of tutorials about the Bindable Meta Tag in Flex. If you need a refresher check out the first part.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 8 Comments »

Jul
24

Flex Snippet Tutorial - Bindable Meta Tag Part 1

o heres a quick rundown of a very cool way to bind data in Flex. The way you can do this is a very simple meta tag called Bindable. First, you probably want to know what exactly a meta tag is. Meta tags are pieces of information you use in your code to tell the compiler certain things.
 
Read More »

Posted in Snippet Tutorials, Flex, All Tutorials | 6 Comments »