School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 306,729 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,467 people online right now. Registration is fast and FREE... Join Now!



's Contributions
Below are the tutorials, code snippets, and resources has submitted to dream.in.code. For more information on Kudos and contributing to dream.in.code visit: http://home.dreamincode.net/?p=about#kudos.
Tutorials
SQL Basics in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 36,531)
System.IO in C# Part II in C# Tutorials (Last Comment: PsychoCoder, Views: 20,793)
System.IO in C# Part I in C# Tutorials (Last Comment: PsychoCoder, Views: 9,017)
System.IO in C# Part 1.5 in C# Tutorials (Last Comment: PsychoCoder, Views: 7,811)
Basic Calculator in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 37,206)
OleDb Data Objects in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 21,606)
Using SQL-DMO in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 12,803)
Taking a screen shot in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 12,346)
Serial Port Communication in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 135,580)
Working with enums in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 19,331)
Using WMI Class in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 23,736)
Printing in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 30,388)
Control Arrays in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 5,938)
Controlling sound volume in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 13,493)
Using the Ping Class in C# in C# Tutorials (Last Comment: PsychoCoder, Views: 3,565)
Using LINQ in C# Part I in C# Tutorials (Last Comment: PsychoCoder, Views: 4,501)
CAPTCHA in VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 9,889)
Using Generics in VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 6,970)
SQL Basics In VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 31,833)
Basic Calculator in VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 54,035)
OleDb Basics in VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 26,131)
Printing in VB.Net in VB.NET Tutorials (Last Comment: PsychoCoder, Views: 15,285)
Code Snippets
Submitted: July 6, 2009        Views: 606
You may or may not know but this isn't set when running on IIS, so thanks to this snippet found at http://fyneworks.blogspot.com/2007/08/php-documentroot-in-iis-windows-servers.html we can set it
Submitted: January 23, 2008        Views: 6416
This is a snippet to add an additional node, say you have a document that has a primary root of Users, then the individual nodes are named User, under that you have separate element string, with this method you can add a new element string during runtime
Submitted: May 2, 2008        Views: 2713
This is a snippet I use for padding a string. The spaces are encoded so they will show up in something like a DropDownList as well.
Submitted: December 21, 2007        Views: 1992
When you type a URL into your address bar it is stored in the registry, this snippet opens that key, retrieves all the URL's in it, then adds them to a list then returns them to the calling method. Great for a web browser project
Submitted: December 1, 2008        Views: 1132
This is a useful JavaScript snippet to perform auto-tabbing in for fields, especially in phone number and ssn fields
Submitted: September 11, 2009        Views: 487
Snippet for performing the backup of the specified database using Microsoft.SqlServer.Management.Smo
Submitted: August 18, 2007        Views: 3088
This is a function to bind a control to an enumeration by taking the values in the enumeration and adding them to an ArrayList
Submitted: August 18, 2007        Views: 3452
A method for binding a control to an enumeration. I posted the VB.Net version, so I figured Id post the C# version
Submitted: August 7, 2008        Views: 963
This is a snippet that will perform a BubbleSort on a string (char) array
Submitted: December 13, 2008        Views: 1333
This is a snippet to demonstrate performing a bucket sort on an array in integers
Submitted: March 8, 2008        Views: 7019
This is a snippet to mimic VB6's Val() function. It will string all non-numeric characters from a string and return the numeric
Submitted: July 28, 2007        Views: 7971
This is a simple Temperature Converter function in C#. It not only converts between Celsius and Fahrenheit but it also does Kelvins conversions as well. I've posted the VB.Net version in the VB.Net Snippets section
Submitted: March 11, 2008        Views: 6112
This is a snippet (for a console application) for calculating if a number is a Palindrome number.
Submitted: May 14, 2008        Views: 1662
This is a snippet for calculating the distance between 2 points. Each "point" is represented by the longitude & latitude for that location
Submitted: May 15, 2008        Views: 700
This is a snippet done in VBScript that can be used to determine the distance between 2 points. The two points being represented by the Longitude/Latitude of each point
Submitted: December 30, 2007        Views: 1690
This C# code snippet calculates a Fibonacci number using recursion, i.e., the Fibonacci method calls itself when necessary.
Submitted: December 30, 2007        Views: 1658
This C# code snippet takes the principal and interest passed to it and calculates the simple interest for the loan
Submitted: September 28, 2008        Views: 2195
This is a user defined function to search for a particular character in a string and count how many times it appears in the string
Submitted: January 1, 2008        Views: 960
This snippet checks if the current thread is part of a ThreadPool Thread referencing the IsThreadPoolThread property of the current thread.
Submitted: February 29, 2008        Views: 10812
This is 2 functions in JavaScript to see if the user selected at least one CheckBox in a Repeater or DataGrid
Submitted: March 1, 2008        Views: 15097
Since the ASP.Net FileUpload control doesn't have a Filter property this script will limit the extensions a user can upload
Submitted: August 23, 2009        Views: 639
Snippet showing how to detect if the current system us running a 64-Bit OS
Submitted: March 19, 2009        Views: 1264
This is a snippet used to check for an internet connection by using the WebRequest class
Submitted: December 26, 2007        Views: 10207
This is a snippet I use to check for an available internet connection , useful when you application requires a connection.
Submitted: January 31, 2009        Views: 853
This is a snippet to check if a year is a valid leap year
Submitted: May 2, 2008        Views: 6300
This is a snippet I use for testing whether a session has timed out. In this snippet it's in the OnInit method of a page (I create a BasePage class to inherit all my pages from) But you could make it it's own function and use it that way
Submitted: December 16, 2008        Views: 6922
This is a snippet I use to make sure the user is providing only valid alpha numeric values
Submitted: February 26, 2008        Views: 1537
This is a snippet I use for making sure a page request is coming from my domain, and that someone isn't trying to hijack my site or page.
Submitted: July 8, 2009        Views: 407
A snippet to determine if a folder is empty or not. Comes in handy to determine if a folder is empty before deleting the folder
Submitted: March 2, 2008        Views: 9372
This is a snippet for checking if a file exists in VB6
Submitted: March 19, 2009        Views: 4279
This is a snippet (spurred from a question in the C# Forum) that checks if a file is already opened, or if it's a read only file
Submitted: December 21, 2007        Views: 24150
This is a snippet I use often to check and see if a certain process is running. It loops through all the processes in your Task Manager looking for the name your provide it
Submitted: January 1, 2008        Views: 1559
This is a snippet I use to check if a thread (usually the current thread) is a background thread or not. You could also pass a Thread to the method and check that thread as well
Submitted: March 6, 2009        Views: 558
Snippet to check and see if the provided extension is registered on the system
Submitted: November 9, 2008        Views: 4007
This is a snippet that has 4 methods, 1 enum and 1 Win32 API that will first check to make sure the "pinger" has an actual connection, then it sends the ping 4 times to the pinged host and returns the results
Submitted: December 30, 2007        Views: 5065
This is a snippet used to check if a provided string is all uppercase or not.
Submitted: December 30, 2007        Views: 1278
This is a function I use to check to see if any CDROM's on a system are already loaded
Submitted: December 30, 2007        Views: 5001
This is a snippet for checking to see if the currently logged in user is in the Administrator's group of that computer.
Submitted: January 1, 2008        Views: 1693
This is a snippet I use to check the status of the current thread by referencing the ThreadState property of the current Thread
Submitted: August 2, 2007        Views: 5234
This is actually 2 snippets in one: 1) Function to determine if your application is currently open 2) Method for restoring and activating the already open instance, then closing the 2nd instance
Submitted: March 28, 2008        Views: 2184
This is a snippet to check and uncheck all CheckBoxes in a form
Submitted: February 24, 2009        Views: 627
This is a function I use for cleaning all input provided from the end user
Submitted: September 6, 2007        Views: 16160
This is a snippet I use to clear a form. Right now it clears: TextBox, RichTextBox, ComboBox, CheckBox and RadioButton. More can be added if needed
Clear a form in JavaScript by PsychoCoder
Submitted: July 26, 2008        Views: 644
This is a JavaScript to clear the elements of a form
Submitted: December 30, 2007        Views: 6937
This is a snippet used to clear the cache folder for Internet Explorer, or really any browser
Submitted: August 14, 2008        Views: 5257
This is the proper way to close all the forms in your application. Some say to just call End but that just crashes the program without raising an error
Submitted: November 20, 2008        Views: 1834
This code must be placed in it's own Module
Submitted: August 21, 2009        Views: 150
Demonstration of the Cocktail Sort using C# (see http://en.wikipedia.org/wiki/Cocktail_sort)
Submitted: August 21, 2009        Views: 93
This is a snippet demonstrating the CombSort algorithm in C# (http://en.wikipedia.org/wiki/Comb_sort)
Submitted: August 6, 2009        Views: 474
This snippet demonstrates comparing 2 images to see if they're the same. We use GetPixel (http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.getpixel.aspx) to compare each pixel
Submitted: April 16, 2009        Views: 1168
Snippet to compare 2 integer arrays to see if they hold the same values
Submitted: January 7, 2009        Views: 5453
This is a snippet to compare 2 images to see if they are the same. This method first converts each Bitmap to a byte array, then gets the hash of each array. We then loop through each in the hash to see if they match
Submitted: February 1, 2008        Views: 4392
This is a snippet that can be used to calculate interest compounded annually, semi-annually or quarterly.
Submitted: February 1, 2008        Views: 1535
This is a snippet that can be used to calculate compound interest.
Submitted: February 5, 2008        Views: 6766
This consists of 2 methods, one for compressing the ViewState, one for Decompressing the ViewState
Submitted: February 26, 2009        Views: 2267
Snippet for compressing a file using the System.IO.Compression.GZipStream Class
Submitted: January 20, 2008        Views: 16492
This is a bit of code that can be used to connect to a mySQL database, but you need the connector, located at url=http://dev.mysql.com/downloads/connector/net/1.0.html
Submitted: March 9, 2008        Views: 9131
This is a function to convert a 64 bit number since base_convert will choke on a number that size
Submitted: September 9, 2008        Views: 4431
This is a small snippet I use to convert a provided string to Pascal Casing
Submitted: August 29, 2007        Views: 14872
I posted this originally as a VB.Net snippet, but decided to convert it to C# as well for the C# users
Submitted: August 13, 2007        Views: 6370
I came up with this little snippet in the current application I'm working on. With one report the user can enter unlimited search parameters in 8 different categories. So I needed a way to store this (ArrayList) then convert it before sending it to the database (So I could do "WHERE Value IN(MyList)"
Submitted: July 17, 2008        Views: 5373
This a snippet for converting ASCII to it's binary equivalent (thanks baavgai for helping me)
Submitted: January 25, 2009        Views: 2365
This is 2 snippets, one for converting ASCII to binary, and one for converting binary back to ASCII
Submitted: November 8, 2007        Views: 1110
This is a snippet I use for converting a delimited file to a populated DataSet.
Submitted: September 1, 2007        Views: 3048
This is a small snippet showing how to convert a delimited file to an XML document
Submitted: May 31, 2008        Views: 9006
This is a snippet for converting an enum to a string array
Submitted: February 23, 2008        Views: 5085
This is a snippet to convert the first letter of a word to uppercase.
Submitted: March 9, 2008        Views: 1348
Snippet for converting a value from base 256 to integer
Submitted: March 9, 2008        Views: 1728
This is a snippet for converting an integer to it's base 256 value
Submitted: August 8, 2007        Views: 4890
This is a function that you pass a number of meters and it converts it to feet (or inches) or both
Submitted: December 8, 2007        Views: 6592
This is a snippet I use whenever I need to convert a string value to a value in an enum
Submitted: June 30, 2008        Views: 9527
Snippet to convert a DateTime value to a UNIX Timestamp
Submitted: March 9, 2009        Views: 2642
This is a snippet used for making a Bitmap out of text at run-time
Submitted: June 30, 2008        Views: 6863
This is a snippet to convert a UNIX timestamp to a readable System.DateTime value
Submitted: August 9, 2007        Views: 1539
This is 2 snippets: 1) Function to set a cookie, pass it the name of the cookie, the value and the days its valid (until expiration) 2) Function to get the cookie by the name
Submitted: June 10, 2008        Views: 3538
Here is a snippet (1 Stored Procedure, 1 User Defined Function) for copying stored procedures between databases
Submitted: March 18, 2009        Views: 977
This is a snippet (goes hand in hand with the one located at: http://www.dreamincode.net/code/snippet3230.htm This snippet counts the total number of non-vowel characters in a given string
Submitted: January 29, 2009        Views: 3158
This is a snippet to count the number of CheckBoxes that have been checked in a form
Submitted: March 18, 2009        Views: 704
This is a snippet for returning the vowel count in a given string
Submitted: November 2, 2008        Views: 5919
This is a snippet to count the occurrences of each word in a string. It utilized a SortedList and IDictionaryEnumerator
Submitted: July 8, 2009        Views: 455
This is a snippet for creating a zip file with PHP using the ZipArchive class
Submitted: September 27, 2008        Views: 1177
This is a small snippet to create a cookie then send it to the header using the header() method. Then we turn right around and get the cookie so we can read it's contents
Submitted: May 24, 2008        Views: 9762
This is a snippet for cropping an image. You could set this up with a draggable square so the user can chose where to crop. Values in here are hardcoded for my use
Submitted: July 3, 2009        Views: 405
Snippet to take the contents from a CSV file and insert it into a MySQL database table.
Decode a URL in JavaScript by PsychoCoder
Submitted: March 9, 2008        Views: 2669
This is a snippet to decode a URL, goes perfectly with the Encode a URL snippet: http://www.dreamincode.net/code/snippet1828.htm
Submitted: March 9, 2008        Views: 5744
This is a snippet to decode a URL that has Unicode characters in it
Submitted: March 1, 2009        Views: 2130
Function for decompressing a compressed file using the GZipStream class
Submitted: April 6, 2009        Views: 1020
This snippet is for deleting IE's temporary internet files
Submitted: March 6, 2009        Views: 1890
A method for deleting a specific key value in the HKEY_CLASSES_ROOT registry hive
Submitted: February 17, 2008        Views: 1313
This is a method used to prevent a circular reference when dragging and dropping a node from a TreeView. A circular reference occurs when you try to drop a node onto one of the nodes child nodes
Submitted: September 28, 2008        Views: 1286
This is a User Defined function to determine if a given year is a leap year
Submitted: March 9, 2008        Views: 2848
This is a snippet for displaying the contents of an array in a "tree" format
Submitted: July 18, 2009        Views: 975
Snippet that gets the users IP address and displays a Google Map based on their location. If no location can be generated a default image is shown (expected as one of the function parameters) EDIT: Changed to use GeoBytes.Com for more accurate results
Submitted: August 2, 2007        Views: 906
This little snippet checks the features that are available in the browser that is viewing the site, so the developer know what he can do
Submitted: February 19, 2008        Views: 3456
This is a snippet that will allow dragging from one TreeView and dropping on another TreeView, and vica versa.
Submitted: February 21, 2008        Views: 3261
This is a snippet that you can use to dynamically load a ComboBox with a set number of years, starting with the current year, then specify how many years to go back
Submitted: January 1, 2008        Views: 3353
This is a snippet for embedding a font into an application, which ensures if the user doesn't have the font file installed, it really doesn't matter
Submitted: December 30, 2007        Views: 1745
This is a snippet using Interop & DllImport to empty the Windows recucle bin. It consists of an Enum to hold the recyclebin flags, the DllImport and the actual method
Submitted: October 17, 2008        Views: 1405
This is a snippet (for ASP.NET) used to enable HttpCompression in your web application.
Encode a URL in JavaScript by PsychoCoder
Submitted: March 9, 2008        Views: 1211
This is a snippet for encoding a given URL
Submitted: October 6, 2008        Views: 2098
This is a snippet you can use the encrypt a certain section of your web.config file, along with a method to decrypt it
Submitted: July 9, 2008        Views: 1519
This is a snippet to exit your application the proper way. Some say to use End but that isn't a very good way of exiting your application as it simply crashes the program without displaying any error messages
Submitted: December 30, 2007        Views: 1528
This is a snippet used to enumerate a multidimensional array with the IEnumerator Interface's GetEnumerator Method. There are many ways this can be implemented, for ease of showing this was in a console app
Submitted: August 21, 2009        Views: 342
This snippet uses Regular Expressions to extract the domain from a URL. Example: http://www.google.com will return google (Utilizes my valid URL snippet to check for valid URL)
Submitted: March 11, 2008        Views: 3440
Snippet for Fibonacci calculations. This was written for a console application, but can easily be ported to a Windows application
Submitted: January 23, 2009        Views: 1409
This is a snippet for a simple file upload. It has limitations for the file types and file size (change these to fit your needs)
Submitted: April 10, 2009        Views: 787
2 functions: Find and replace, find and replace all used for a Find & Replace option in your application
Submitted: January 15, 2008        Views: 11604
This is a snippet for recursively finding a certain control based on its ID
Submitted: December 20, 2007        Views: 18843
This little snippet will return a list populated with all the classes in the Namespace you provide it
Submitted: December 13, 2008        Views: 941
This snippet uses recursion and the Euclidean Algorithm to find the greatest common denominator of 2 numbers
Submitted: August 31, 2008        Views: 4415
This is a snippet I use to find specified text in a RichTextBox. I use it as a part of a Find And Replace system
Submitted: March 11, 2008        Views: 15576
This is a snippet to help find the largest and the smallest number in an integer array. It was originally written for a console application, but can easily be ported to a Windows application
Submitted: July 8, 2008        Views: 8755
This is a snippet for checking the active directory to find what groups a user is a member of
Submitted: April 16, 2008        Views: 9688
This is a snippet I use when needing to format a US phone number into the format (555) 555-1212
Submitted: December 1, 2008        Views: 3056
This is a snippet I use often to see if a value provided is a whole number or not
Submitted: February 27, 2008        Views: 1989
This is a function to return only a portion of a string. This function uses the indexOf() method to search for the character where you want to stop, then uses the substring() to return the string
Submitted: August 21, 2008        Views: 3658
This is a snippet used to produce an MD5 hash of the string provided
Submitted: August 22, 2008        Views: 1442
Submitted: January 16, 2009        Views: 1420
This is a snippet to generate random strings of the length the user wishes to have. Great for random passwords and such
Submitted: August 11, 2009        Views: 993
Snippet for getting the MD5 hash of a file, say for a checksum validation
Submitted: January 1, 2008        Views: 748
This is a snippet that uses the Priority Property of the Thread class to retrieve the priority of the provided thread (or the current thread if you wish)
Submitted: May 31, 2008        Views: 3797
This is a snippet I needed recently to find all assemblies installed in the GAC
Submitted: August 4, 2007        Views: 1403
This is a function that retrieves all the child sub keys of a specified sub key and puts them into an ArrayList
Submitted: July 26, 2007        Views: 12986
This is a small snippet I use to retrieve all the IP addresses on a lan (without Active Directory)
Submitted: March 6, 2009        Views: 1064
This is a snippet to retrieve all registered file extensions on a system (they are stored in the HKEY_CLASSES_ROOT Hive in the Registry)
Submitted: January 1, 2008        Views: 4170
This is a snippet for retrieving all the attributes for an Assembly using Reflection in C#.
Submitted: March 18, 2009        Views: 979
This is a snippet that can be used to get an application's default icon
Submitted: September 27, 2008        Views: 1134
This snippet will show how to get a cookie by it's name using Perl/CGI with the CGI.pm module
Submitted: March 23, 2008        Views: 18676
This is a snippet I use to get the checked items in an ASP.Net GridView and store them in the session for later retrieval. I use this so I don't lose track of the checked items during paging
Submitted: August 2, 2007        Views: 27839
I use this function in my applications to retrieve the connection string from the app.config file. It is especially handy in the application I'm working on now as there are 2 databases it can connect to.
Submitted: January 20, 2008        Views: 42666
This is a snippet I use to retrieve my database connection string I store in the web.config file.
Submitted: April 2, 2009        Views: 349
This is a snippet used to retrieve the specified HDD's serial number
Submitted: January 1, 2008        Views: 2344
This snippet obtains the NetBIOS and DNS computer names of the local computer.
Submitted: November 12, 2009        Views: 129
This is a snippet that demonstrates getting the name of all shared folders on the local system using WMI
Submitted: September 5, 2008        Views: 4420
This is a snippet used to retrieve the WI-FI signal strength of all WI-FI cards attached to your system. Can be used to tell if you are near a WI-FI connection
Submitted: January 1, 2008        Views: 1972
This snippet gets the name of the current thread by examining the Name property of the current thread.
Submitted: March 20, 2009        Views: 545
This snippet is for finding what service pack is installed on the current system
Submitted: August 2, 2007        Views: 1341
A simple function for returning a BindingSource, used for things like binding a DataGridView. Pass this function your SqlCommand and it populates a DataTable and binds it to a BindingSource.
Submitted: August 21, 2009        Views: 84
Demonstration of the Gnome Sort algorithm in C# See: http://en.wikipedia.org/wiki/Gnome_sort
Submitted: July 8, 2008        Views: 1491
This is a snippet I use for hashing a string using the Capicom.dll
Submitted: July 8, 2008        Views: 1467
This is a snippet I created for hashing strings that had to match the value hashed using CAPICOM in Classic ASP
Submitted: October 23, 2008        Views: 3242
This is a snippet utilizing Win32 API to select (scroll to) a specified line in a RichTextBox given the line number
Submitted: June 15, 2009        Views: 647
This is a snippet for doing image rollovers with JQuery. Check "Instructions for what is needed
Submitted: March 17, 2008        Views: 2783
This is a snippet for performing an insertion sort of an integer array. This code was originally written for a console application, but can easily be ported to a Windows application
Submitted: March 8, 2008        Views: 4834
I created my own IsNumeric function because from time to time the legacy IsNumeric function available in VB.Net will return false positives or false negatives
Submitted: March 8, 2008        Views: 4637
This is a snippet that is used to check if a value is of numeric value
Submitted: December 8, 2008        Views: 3254
This is a snippet to determine if a provided value is a numeric value using Regular Expressions
Submitted: December 30, 2007        Views: 5586
This snippet is being used in a console application to show how the IList Interface can be used to iterate through an array
Submitted: April 10, 2009        Views: 1206
This is a snippet that can be used to kill processes associated to a certain user
Submitted: December 21, 2007        Views: 26830
This is a snippet I use to search for and kill a process if it is found in the list of running processes.
Submitted: January 25, 2009        Views: 2177
This snippet will allow only numeric values to be entered into a TextBox
Submitted: March 5, 2008        Views: 1168
This is a snippet that can be used to limit the number of items a user can submit. Lets say you have a form where someone can enter multiple email addresses, delimited with a comma, and you only want them to enter 10, this snippet will accomplish that.
Submitted: December 10, 2007        Views: 9611
This is a snippet I use to load a DropDownList from an enum, since I use enum's and struct's often in my programming.
Submitted: January 8, 2009        Views: 2726
This is a snippet to load an image from a URL into a PictureBox on a Windows form
Submitted: August 18, 2007        Views: 6657
This is some code for "securing" your pages using Sessions in PHP. By securing I mean pages that can only viewed by a logged in user This "snippet" actually consists of 3 snippets, first is what to put in login_check.php, second is what to put in login.php, third is what to put in each page in your site that must be secured (only a logged in user can view)
Submitted: January 1, 2008        Views: 3986
This is a snippet used to measure the execution time of a task or process. It uses the System.Diagnostics.StopWatch to measure the time
Submitted: August 5, 2007        Views: 1167
This is an implementation of mod_rewrite that allows you to change the URL www.yoursite.com?index.php?u=Something to www.yoursite.com/Something. Makes for much cleaner readable URL's, also they are way more search engine friendly
Submitted: May 20, 2008        Views: 1404
This is a snippet I use for "de-duping" a table (removing all duplicate entries". This process doesn't use temporary tables or cursors, adding to it's efficiency
Submitted: July 9, 2008        Views: 2278
This is a MSSQL stored procedure used for calculating a persons age
Submitted: December 27, 2008        Views: 1863
This is a snippet I've used quite often for copying a table from one database to another (generally from production to development so I'm working with fresh data)
Submitted: March 28, 2008        Views: 4375
This is a stored procedure (for Microsoft SQL Server) that will retrieve all the blocked users/processes and who/what is blocking them
Submitted: December 1, 2008        Views: 784
Thins is an invaluable UDF in MSSQL I created in SQL 2005 to remove the time part of a DATETIME datatype. Even is no time is passed SQL stored 0:00:000 to the end of the date
Submitted: December 27, 2008        Views: 1125
This is a snippet to find the first weekday of any given month
Submitted: March 21, 2008        Views: 3177
This is a snippet to create a User Defined Function to split a comma delimited string
Submitted: July 14, 2008        Views: 711
I had to create a function to validate a Canadian postal code for a project I'm working on, this is what I came up with
Submitted: May 2, 2008        Views: 1139
This is a MSSQL user defined function for converting words to proper case
Submitted: December 21, 2008        Views: 5500
As you know there really isn't an easy way to retrieve files from an extension with one of multiple extensions, say jpg, gif and png. This snippet does exactly that by using a string array of valid extensions and ArrayList to hold the files found
Submitted: May 12, 2008        Views: 1952
This is a snippet for applying a one way hash to a string using the CAPICOM.dll.
Submitted: May 12, 2008        Views: 4391
This is a snippet I use for applying a one way hash utilizing the SHA1CryptoServiceProvider class in .Net. I use Encoding.Unicode.GetBytes() so it will be compatible with systems already using the CAPICOM version. The CAPICOM views all input as UNICODE not text
Submitted: January 24, 2008        Views: 3598
This is a method that can be used to open and close a CD tray in code. It required a Win32 API Call
Submitted: January 2, 2008        Views: 798
This is a snippet to show one of the many ways to parse an XML document with PHP.
Submitted: March 11, 2008        Views: 4865
This is a snippet for performing a bubble sort. Though it was originally written for a console application it can easily be ported to a Windows application
Submitted: March 11, 2008        Views: 2320
This a snippet to perform a selection sort on an array. Though it was originally written for a console application it can easily be ported to a Windows application
Submitted: August 1, 2007        Views: 10676
This is a short snippet that performs an XCOPY in C# (Similar to the System() Function in C++)
Submitted: March 11, 2008        Views: 6060
This is a snippet to perform a binary search. This was written for a console application but is easily adapter to a Windows application
Submitted: March 11, 2008        Views: 3471
This is a snippet for performing a linear search
Submitted: December 16, 2008        Views: 697
This is a snippet performing performing title casing on a string, which is capitalizing each word in a string
Submitted: April 6, 2009        Views: 306
Snippet for performing a WHOIS lookup on a domain
Submitted: July 28, 2007        Views: 2423
This is a small snippet that will load all the drive types into a TreeView
Submitted: February 29, 2008        Views: 819
Here is a snippet to populate an ArrayList with the logical drives on the system
Submitted: February 16, 2008        Views: 4495
This is a snippet used to populate a TreeView with your music library, based on the path provided.
Submitted: April 18, 2008        Views: 1309
This is a user defined function for setting a string (or sentence) to it's proper case
Submitted: March 16, 2009        Views: 856
This is a snippet that takes the log name, machine and event id and searches for all events for the specified ID
Submitted: August 17, 2009        Views: 260
Snippet to randomize a Generic list of type T
Submitted: November 9, 2009        Views: 101
Snippet to randomly sort an ArrayList using the Random Class
Submitted: February 28, 2008        Views: 13679
This is a method for reading a the contents of a text file into a DataSet
Submitted: February 28, 2009        Views: 684
Snippet to read the contents of a file into a byte array using BinaryReader & FileStream
Submitted: December 30, 2007        Views: 2737
This is a snippet used to read the free space on all network drives attached to the system
Submitted: November 8, 2007        Views: 5157
I use this snippet to read from an Excel spreadsheet, then take the data from the sheet and populate a DataSet with it. This uses the System.Data.OleDb Namespace
Submitted: September 5, 2008        Views: 2963
This is a snippet to read the pixels of an image into an int array.
Submitted: August 15, 2009        Views: 1199
This snippet demonstrates reading a specified line from a text file
Submitted: February 29, 2008        Views: 3045
This is a snippet that can be used to read the contents of a text file into a ListBox.
Submitted: January 22, 2008        Views: 40716
This is a snippet you can use to read a certain value from a resource file you have in your application (.resx extension)
Submitted: March 11, 2009        Views: 6179
This is a snippet for reading an XML file into a DataTable
Submitted: March 25, 2008        Views: 7871
This is a snippet (used in conjunction with the snippet found at http://www.dreamincode.net/code/snippet1858.htm) that will take your selected items in your GridView (which was stored in an ArrayList then applied to a Session value) and reselect them if the user pages back to that page
Submitted: December 25, 2007        Views: 6101
This is a snippet I use to recursively delete files in a directory. Once again, Microsoft didnt offer a recursive delete function (that I know of) so I had to create a snippet to use.
Submitted: March 5, 2008        Views: 9481
Snippet to recursively delete all files in a given directory
Submitted: December 25, 2007        Views: 9636
This is a snippet I use to recursively copy files from one directory to another. VB.Net, unlike VB6 failed to offer a recursive copy function so I had to put one together
Submitted: March 5, 2008        Views: 10338
This is a snippet to recursively copy all files from a given directory to a new directory
Submitted: January 16, 2008        Views: 5854
This is a method used to recursively return a directory structure based on a given directory
Submitted: May 2, 2008        Views: 5968
This is a snippet for removing all whitespace from a string
Submitted: May 2, 2008        Views: 5237
This is a snippet I use for removing leading and trailing whitespace in a string
Submitted: April 18, 2008        Views: 2497
This is an example of how to remove vowels from a string the user inputs into your console application
Submitted: July 8, 2008        Views: 5890
This is a snippet for removing whitespace from a given string using regular expressions
Submitted: March 21, 2009        Views: 2945
This snippet is used for replacing text in a file
Submitted: November 6, 2007        Views: 9690
This is a method for resizing a multi dimensional array. In VB.Net you have ReDim, in C# you can use Array.Resize, but theres nothing to resize a multi-dimensional array in C# TEST
Submitted: May 23, 2008        Views: 11381
This is a snippet for resizing an image based on a percentage. If the user wants the image to be 75% of the original then pass the number 75
Submitted: August 27, 2009        Views: 227
Snippet demonstrating how to resize the desktop icons
Submitted: September 11, 2009        Views: 235
A snippet for restoring a SQL database from a backup file (.BAK file)
Submitted: November 7, 2007        Views: 7725
This snippet takes advantage of the new List< > available to us in C# 2.0 to populate a list of all known colors
Submitted: November 7, 2007        Views: 2416
This snippet takes advantage of the new List() available to us in VB.Net 2.0
Submitted: November 8, 2007        Views: 1466
This is a snippet I use to retrieve a users active directory login based on their first and last name
Submitted: August 4, 2007        Views: 1425
This is the C# version of the snippet I offered in VB.Net for retrieving all the child sub keys for a given sub key
Submitted: November 12, 2009        Views: 170
This is a snippet demonstrating how to get all the computer names on the network
Submitted: July 8, 2008        Views: 2095
This is a method I use when screen scraping to retrieve all hyperlinks from the generated HTML from a WebClient call
Submitted: December 30, 2007        Views: 1553
This is a snippet I use to retrieve all the sub-directories of a given directory. It returns the values in a single HashTable so remember the first entry is the initial root directory
Submitted: July 8, 2008        Views: 3722
This is a snippet that will take a valid URL and return all the information from that URL
Submitted: July 8, 2008        Views: 3738
This is an alternative way to retrieve data from a URL (alternate to my snippet at http://www.dreamincode.net/code/snippet2140.htm
Submitted: July 2, 2009        Views: 548
This is a snippet that first randomizes a Generic List, then retrieve N number of items
Submitted: July 8, 2008        Views: 4360
This is a snippet for retrieving a populated DataTable by passing a "pre-loaded" SqlCommand object
Submitted: March 27, 2008        Views: 16029
Here is a snippet I use quite often. It is designed to return a DataTable populated with the data you're trying to retrieve
Submitted: February 18, 2008        Views: 1312
This is a snippet to retrieve a list of songs from a music CD in the CDROM Drive. This is used in conjunction with the AxWindowsMediaPlayer (wmp.dll). This snippet uses the IWMPPlaylist Interface to gain access to the playlist on the CD
Submitted: December 31, 2007        Views: 3107
This is a snippet that can be used to retrieve various information about the current system your application is running on
Submitted: January 23, 2008        Views: 12755
This is a snippet that can be used to retrieve the value of a ChildNode of the note you specify
Submitted: November 11, 2007        Views: 10409
I, alike many developers, use Enum's to store small, related data items. Trouble is, once you start referencing said Enum's you always get the Integer index value, not the string value, which most are looking for. So I took the time to write a small snippet I include in every application, whether it be web of Windows, just for that purpost
Submitted: November 11, 2007        Views: 2317
This is a snippet I use to retrieve the Integer value of an enumeration. AN enumerations is usually setup like Item1 = 1 Item2 = 2 and so on. This snippet will return the integer value assigned with that selection
Submitted: September 8, 2008        Views: 2745
This is a snippet to retrieve the sub-domain from a provided URL
Submitted: January 1, 2008        Views: 1279
This snippet displays the version number of the specified component.
Submitted: December 5, 2007        Views: 9866
This is a snippet I use to retrieve the integer value from an enumeration
Submitted: December 5, 2007        Views: 1040
This is a sniet I use to retrieve the values form an enum, and populating a Collection with the returned values
Submitted: August 5, 2008        Views: 1069
This is a snippet for reversing a string
Submitted: August 5, 2008        Views: 1849
In this snippet we will be using XOR to reverse the string provided
Submitted: December 16, 2008        Views: 1257
This is a snippet showing how to reverse a string provided by the user
Submitted: March 21, 2009        Views: 599
This shows how to reverse an array using Generics in C#
Submitted: October 22, 2008        Views: 7549
This is a snippet used to rotate an image in C#. Pass the method your Image and the angle you wish to rotate it
Submitted: January 1, 2009        Views: 5410
These are 2 snippets: One for saving an image to an Access database and one for retrieving the image
Submitted: August 17, 2008        Views: 11746
This is a snippet to scale an image to fit within a PictureBox's current dimensions. It is two methods, one for generating the proper dimensions and one for resizing the image properly (including setting the InterpolationMode to clean the image up)
Submitted: November 8, 2008        Views: 4909
This is a snippet I use to determine the encryption status of the connectionStrings section of the app.config file. If the section is already encrypted I remove the encryption so I can get the connection string, otherwise I encrypt it because I'm finished
Submitted: March 6, 2009        Views: 1243
This is a snippet to see if a registry key exists for the provided Programmatic Identifier (http://c2.com/cgi-bin/wiki?ProgrammaticIdentifier)
Submitted: March 8, 2009        Views: 6252
Recently someone asked how to select distinct values from a DataTable, so this snippet was born
Submitted: September 10, 2009        Views: 532
Snippet for setting security settings for a specified directory
Submitted: January 1, 2008        Views: 732
This snippet is a snippet I use when I need to set the name of the current thread
Submitted: August 27, 2009        Views: 450
Snippet demonstrating how to hide & show the desktop icons using Win32 API calls
Submitted: August 27, 2009        Views: 483
This is a snippet demonstrating how to hide and show the Windows Taskbar with Win32 API
Submitted: August 17, 2009        Views: 382
Snippet for shuffling a random list of type T with C#. Requires .Net Framework 3.5+. This is based on the Fisher-Yates shuffle - http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
Submitted: March 8, 2009        Views: 783
This is a demonstration of a simple two way encryption in PHP. Keep in mind all (or most) encryption can be broke, so this is by no means expected to be "ultra" secure
Submitted: September 28, 2008        Views: 998
This is a User Defined Function to perform simple encryption on an input string. This is performed by transposing the ASCII value of each character in the string by the increment value (@increment in the parameter list)
Submitted: August 5, 2007        Views: 4583
Method for converting bytes to either kilobytes, megabytes or gigabytes.
Submitted: February 29, 2008        Views: 7502
Here is a snippet to sort the items in a DropDownList alphabetically.
Submitted: July 5, 2009        Views: 948
Since the ListBox control has no built in functionality for sorting the items I came up with this little method for sorting the items
Submitted: February 2, 2008        Views: 2653
This is a stored procedure to help with record paging. With the advent of SQL 2005 a new function was added, ROW_NUMBER, that can help with paging records for you database applications. ROW_NUMBER returns a sequential number, starting at 1, for each row returned in a result set.
Submitted: January 31, 2009        Views: 482
Here are three functions for string trimming in JavaScript. trimLeft will remove all spaces from the left side of a string, trimRight will trim all spaces from the right of a string and trimAll will remove both leading and trailing spaces
Submitted: December 15, 2008        Views: 896
This is a snippet demonstrating how to remove all non-vowels from an input string
Submitted: May 1, 2008        Views: 5831
This is a snippet to strip all HTML tags from a given string
Submitted: December 30, 2007        Views: 7581
This is a snippet I have used often to strip all HTML characters from a string before putting the data into the database
Submitted: December 14, 2008        Views: 1726
This is a snippet demonstrating how to remove vowels from an input string. In this snippet we also get an introduction t0 Generics
Submitted: April 6, 2009        Views: 1772
This is a snippet used to take a screenshot from within your web browser control
Submitted: July 26, 2007        Views: 3218
This is a temperature converter function in VB.Net. Not only does it do Celsius & Fahrenheit but it also does Kelvins conversions as well
Submitted: February 11, 2009        Views: 1753
Snippet to use FTP to transfer file from one server to another
Submitted: March 21, 2009        Views: 806
Ever had a long path and wish you could eliminate some of (for display purposes) it and replace with ellipses (something like C:\Program Files\Microso…\gacutil.exe) then this snippet is for you
Submitted: May 1, 2009        Views: 665
This is a snippet for truncating text (such as with a blog post) and add trailing ellipses. Useful for long blog posts, and can add a "Read More" link
Submitted: December 13, 2008        Views: 1663
This is a snippet demonstrating turning an array into a string. Each item of the array will be put onto it's own line, with no empty line after the final item
Submitted: July 13, 2009        Views: 326
This snippet takes 2 parameters: Name of the zip file and directory to unzip in
Submitted: February 15, 2009        Views: 3043
This is a snippet that allows you to upload a file to an FTP server using Win32 API's
Submitted: December 12, 2008        Views: 1200
This is a snippet used to uploading a file to a specified folder on a FTP server. Pass the method the parameters it's looking for and it will either upload the file of let you know what went wrong
Submitted: November 9, 2008        Views: 1816
This is a snippet that utilizes Generics to retrieve a random line from a text file
Submitted: January 5, 2009        Views: 2660
This is a snippet to convert a Hashtable to a DataSet using the IDictionaryEnumerator Interface
Submitted: February 12, 2009        Views: 2178
Snippet to download a file from a URL with the Inet control
Submitted: April 4, 2009        Views: 1160
This is a snippet that utilizes iterators to recursively get all files in a provided directory (created for an application I'm working on)
Submitted: November 5, 2008        Views: 1530
This is a snippet that will use recursion to get the total size of the files in a given directory, including that directories sub-directories. The size is returned in megabytes
Submitted: January 15, 2009        Views: 4147
This is a snippet that can be used to populate a ComboBox with a list of countries (say for registering). It uses the System.Globalization Namespace to get all the cultures that are not only native on the system, but also all the ones installed with the .Net Framework
Submitted: September 16, 2008        Views: 2105
Pass the drive letter you wish to get the information from
Submitted: February 10, 2008        Views: 8332
This is a snippet that can be used to retrieve the serial number of a HDD
Submitted: February 10, 2008        Views: 2407
This is a snippet to retrieve the size of a selected HDD
Submitted: February 10, 2008        Views: 11487
This is a snippet that can be used to retrieve the MAC address of a network adapter
Submitted: February 10, 2008        Views: 7750
This is a snippet using the WMI class to retrieve processor information. In this snippet I only retrieve a few of the items, there are many more you can retrieve
Submitted: September 16, 2008        Views: 3080
This is a snippet that utilizes Windows Management Instrumentation to access various properties of local hard drive, including the serial number of the HDD
Submitted: September 16, 2008        Views: 1991
This snippet uses WMI to get the available free space available on the HDD
Submitted: March 29, 2009        Views: 654
This is a snippet used to kill processes owned by the specified user
Submitted: February 10, 2008        Views: 5230
This is a snippet that can be used to retrieve the CPU ID in VBScript
Submitted: January 24, 2008        Views: 1664
This is a snippet, utilizing the System.Management Namespace and Generic Dictionary to retrieve the free space, capacity and total used space of a CD-ROM
Submitted: February 10, 2008        Views: 3675
This is a snippet to retrieve the free space of the provided HDD
Submitted: April 18, 2008        Views: 1877
This is a user defined function for formatting US phone number in Microsoft SQL Server
Submitted: April 18, 2008        Views: 610
This a user defined function I created for trimming leading & trailing spaces off a value. It's easier and simpler for me than using RTRIM(LTRIM(@value))
Submitted: April 20, 2008        Views: 2689
This is a snippet to format currency values. This function takes a decimal data type and returns a varchar formatted as currency
Valid date format in Regular Expressions by PsychoCoder
Submitted: April 17, 2009        Views: 551
Regular expression pattern for validating a date input in the format ##/##/####, though month & day can be a single digit and year can be 2
Valid GUID value in Regular Expressions by PsychoCoder
Submitted: April 4, 2009        Views: 442
Regular expression pattern for validating a GUID value
Valid IP range in Regular Expressions by PsychoCoder
Submitted: April 3, 2009        Views: 482
Regular expression pattern to validate a valid IP address range
Valid money format in Regular Expressions by PsychoCoder
Submitted: April 17, 2009        Views: 430
Regular expression patter for matching valid money format. Allows for a $ and a + or - in it as well. Allows for only 2 decimal places
Valid time format in Regular Expressions by PsychoCoder
Submitted: April 9, 2009        Views: 787
Regular expression patter for valid time format. Seconds (in the time) is optional, but if present must be 2 digits. AM/PM is also optional (and not case sensitive)
Submitted: April 9, 2009        Views: 1072
Regular expression pattern for matching a valid US social security number
Valid URL in Regular Expressions by PsychoCoder
Submitted: April 18, 2009        Views: 343
Regular expressions pattern for matching a valid URL. The url can be http, https or ftp
Valid US zip code in Regular Expressions by PsychoCoder
Submitted: April 9, 2009        Views: 574
Regular expression pattern for matching a valid US zip code. Accepts either the standard 5 digit or extended 9 digit (5 numbers, dash, then 4 numbers)
Submitted: August 18, 2008        Views: 1394
This is a snippet I use to validate that a GUID passed in a QueryString is a valid GUID (as in structure)
Validate absolute file path in Regular Expressions by PsychoCoder
Submitted: April 4, 2009        Views: 686
Regular expression pattern for determining if an absolute file path is a valid path
Submitted: December 1, 2008        Views: 1771
This is a useful snippet for validating an email address on the client-side. Difference with this snippet is it allows for an IP address instead of a domain name
Submitted: March 13, 2009        Views: 676
This is a snippet for validating, then formatting a US phone number.
Submitted: March 15, 2009        Views: 1683
This is a snippet that takes a delimited string of values (in this case Canadian Postal Codes) and checks them to see if they're valid postal codes
Submitted: April 2, 2008        Views: 780
This is a snippet for validating a credit card number using the Luhn Check (or Mod 10) formula
Submitted: April 16, 2008        Views: 4847
This is a snippet used to validate a credit card number. It searches for a series of numbers that follow the set pattern for the 4 big cards: Visa, Mastercard, Discover and American Express
Validate currency values in Regular Expressions by PsychoCoder
Submitted: June 15, 2009        Views: 541
This pattern will validate valid currency values, either negative or positive values. If a decimal is present then 2 numbers are required after it
Submitted: October 31, 2007        Views: 13467
This is a snippet I use to validate an email address using regular expressions. Returns true is the address provided is true, otherwise returns false
Submitted: November 3, 2007        Views: 10412
This is a snippet I use for validating an email address in VB.Net using Regular Expressions
Validate Emails in JavaScript by PsychoCoder
Submitted: August 1, 2007        Views: 1766
This email validations allows for IP addresses (joe@[123.124.233.4]), allows for joe.user@domain.com, has the option to check for valid TLD's (Top Level Domains, .com, edu, .info, etc) checks to make sure there are no invalid characters, and so on.
Submitted: March 20, 2009        Views: 1926
Here is a snippet that will validate whether an absolute path is a valid path
Submitted: October 31, 2007        Views: 6415
This is a snippet I use (in C# 2.0) using the TryParse Method of the IPAddress Class
Submitted: November 3, 2007        Views: 2925
This is a snippet I use for validating an IP address in VB.Net 2.0. In 2.0 the introducts the TryParse method of the IPAddress Class.
Submitted: October 31, 2007        Views: 29979
This is a snippet I use to validate IP address using regular expressions. I use this when working in .Net 1.1 as the TryParse method isnt available until 2.0
Submitted: November 3, 2007        Views: 3995
This is a snippet I use to validate an IP address using regular expressions. I use this when working on .Net 1.1 as the IPAddress.TryParse method wasn't available until 2.0
Submitted: January 31, 2009        Views: 877
This is a snippet that will verify signed integers utilizing Regular Expressions
Submitted: April 18, 2009        Views: 4464
This is a snippet for validating a url uytilizing regular expressions. This pattern allows for https, http, and ftp
Validate US phone number in Regular Expressions by PsychoCoder
Submitted: June 15, 2009        Views: 469
Regular Expression pattern for validating a US phone number. The following formats will be valid: (425) 555-0123 425-555-0123 425 555 0123 1-425-555-0123
Submitted: April 16, 2008        Views: 3375
This is a snippet I use whenever I need to validate a US zip code. The pattern allows for 1) 5 digit zip codes 2) 5 + 4 digit zip codes 3) 9 digit zip codes
Validate US zip codes in Visual Basic by PsychoCoder
Submitted: March 14, 2009        Views: 556
This will validate a US zip code, allowing for either the short format (XXXXX) or the long format (XXXXX-XXXX)
VB.Net XCOPY in VB.NET by PsychoCoder
Submitted: September 2, 2007        Views: 3651
I posted a C# version of this, so I thought Id create a VB.Net version
Submitted: November 7, 2007        Views: 2427
This is a snippet I use to validate a users active directory login credentials. Included is a small snippet that strips the network name off the ad login
Submitted: December 25, 2008        Views: 1246
This is a snippet that takes a min value, max value and how many random numbers from the user then, after it checks to make sure it's not already in the list, adds the new random number to a List
Submitted: August 31, 2007        Views: 3817
Here are 3 snippets for reading text files in C#. 1 to write to a text file, one to read a single line of a text file anf one to read the whole file, place it into a variable
Submitted: January 1, 2008        Views: 2588
This is a snippet that can be used to write a registry key. NOTE: Working with the registry can be dangerous and cause sever problems for your computer. Use this snippet at your own risk
Submitted: July 28, 2007        Views: 4985
This is a small snippet I use to write events to the Systems Event Log (I also posted the VB.Net version as well)
Submitted: July 26, 2007        Views: 6105
This is some simple code used to write to the systems event log. This has came in handy for error recording and such for applications I have written
Deleted: XCopy in VB.Net in VB.NET by PsychoCoder
Submitted: August 2, 2007        Views: 3475
This is a little function for performing an XCOPY in Vb.Net. I initially created the C# version for a member who was needing help and decided to share it with the VB.Net world as well
Submitted: August 6, 2009        Views: 353
This is a snippet demonstrating the zig zag cipher (also known as the Rail Fence Cipher)
Submitted: February 11, 2009        Views: 1870
This is a snippet for zipping files with the WinZip executable. It expects an array of file names, their directory and the name you want the zip file named as parameters. It then loops through each file adding them to your zip file
Submitted: August 16, 2008        Views: 4081
This is a snippet for zooming an image