2,322 Reusable Code Snippet Topics
Remove Filter ![]() | |
I wanted to make something for beginners, to show and easy way of creating and using a class and it's methods. So here is a customer class, and a Console application that takes advantage of the class. It is mainly set, and get methods, with one or two extra methods … | |
![]() | The program accepts a sentence, stores each word in it as a separate element in an array, then asks you for a word, and return whether or not the word is present in the sentence you entered. ![]() |
Example of how to get a random number in the range of six and return a value based upon it. Please Rate/Comment/Report Bugs | |
If you need to execute SQL Statements\Stored Procedures\UDFs which return\don't return results, Here I've developed this class to be used in Data Access Layer. | |
This is a javascript code to fix any element in any browser. Simply add "fixed" to the classes of the desired element. Examples: [icode] <div class="fixed">FIXED</div> <div class="someClass fixed">FIXED</div> [/icode] Though it's a little rough when scrolling I hope it will do the job. The way it works: - By … | |
![]() | A code snippet which accepts a word or a sentence from a user, and then sorts it, and displays the sorted list. |
![]() | The user enters their first, middle and last names and the program prints their full name. |
Here's I wrote some code to say binding not means control and data from database, it may be class holds some data | |
Here's I wrote some code to create login on SQL Server. 1- Add references (Microsoft.SqlServer.Smo, Microsoft.SqlServer.SqlEnum and Microsoft.SqlServer.ConnectionInfo) to your project. 2- Call method CreateLogin which takes to some arguments (documented) | |
Here's I wrote some code to backup your database 1- Add references (Microsoft.SqlServer.Smo and Microsoft.SqlServer.ConnectionInfo) to your project. 2- Call method BackupDatabase which takes to arguments database name and backup file path with extension .bak (preferable) | |
This is a portable implementation for converting a character or an integer to its binary text equivalent. It makes use of the [B]CHAR_BIT[/B] constant (which is defined in the header file [B]climits[/B]) to get the number of bits a byte consists of on the implementation where you compile this code … | |
The matrix class in .NET is not a full featured matrix class as mathematicians would like to see it, still you can do amazing things with it. Create a new windows form application. Fill in the code and you are ready to experiment. In the code I do something with … | |
Sometimes you might need to have checkboxes for each row in a GridView control (like Inbox in Gmail). This code snippet helps to select/unselect all checkboxes in the GridView control by clicking the header checkbox. The selectUnselectCheckboxes() javascript function handles this fuctionality. This function is called in the CheckBox in … | |
I didn't know what to do and I thought: why not try writing an interpreter, I've never done this before and it seemed quite challenging, so I started writing code.... The code which you can find below is only a simple base upon which you can start implementing your own … | |
This is a query aggregator that stacks up queries and parameters until you hit the hard limit of 2010 set by the SQL Server/Driver, or you call .RunQuery() Scott Knake [URL="http://www.apexsoftware.com"]Custom Software[/URL] Apex Software | |
This is another sorting algorithm called heap sort that I wrote using Java programming language. The heap sort code is quiete complex but i tried my best to write it | |
| |
I'm sure this has already been done, but to practice understanding Data Structures better I decided to try making one of my own, given only an idea of what type of functionality I want, a pencil and some paper (as well as .txt file, modified into a .java file =p … | |
three lines of code to check MS Excel is installed on PC | |
A simple tool that provides easy navigation in your site using a Combo box. It lets you jump to different location on the Web and also included with text display, which provides short details about the site. If you have comments, suggestions or request — don't hesitate to post back … | |
This is the Dialogs.h part from the WGCL C++ Compiler Library I created. This creates classes for dialogs, it could cut the amount of code for dialogs you need to write in half, while still having the same amount of functionality. This library is licensed under the GNU General Public … | |
Two version that do exactly the same thing! | |
[B]INTRODUCTION[/B] The W3C's [URL=http://www.w3.org/TR/Window]Window Object 1.0[/URL] specification (Working Draft dated 07 April 2006 at the time of writing) defines in it's [URL=http://www.w3.org/TR/Window/#location-attributes]Location Interface[/URL] section a set of attributes (or fragments) by which a Location object may be addressed. Despite the draft status of this document, many implementations of javascript have … | |
Cheap, dirty code for Windows and *nix. | |
My implementation of the [ICODE]strcmp[/ICODE] and [ICODE]strncmp[/ICODE] functions. I don't think that it is very efficient, but have managed to get both the functions' execution times to [ICODE]0.01 s[/ICODE] (At least, this is the value my profiler gives me). Enjoy! :) | |
I answered a question a few days ago on Yahoo! Answers where I helped (did all the work for) the question asker. They were asking for a way to parse text from a <textarea> and search for HTML-like elements that were named in a database (or an array, in my … | |
This snippet allows you to convert a text representation(*) of a [B]binary[/B] number [B]to[/B] a [B]decimal[/B] number :) (*): With 'text representation' I mean for example a string containing "1001" or "10001110011", etc. ... | |
This script simply preload's images inside (x)HTML document. [b]<<<INSTRUCTION>>>[/b] — Simply attached these preloader.js in your document, were you want your images to be preloaded. — You can simply referenced it using [icode]<script type="text/javascript" src="path/preloader.js"></script>[/icode] block. — if you have any suggestions, comments or request, please feel free to post … | |
This script is capable of handling multiple iframes inside your page. Which allow you to specify [b]fixed[/b] [color=red]Width[/color]/[color=red]Height[/color] with your iframes' to ensure layout stability in your page and also it comes with an auto-fit feature. [b]<<<INSTRUCTION>>>[/b] — [color=green]The[/color] iframeFixer.js [color=green]must be included in your[/color] iframe page [color=green]including all pages … | |
[U]Usage::[/U] [ICODE][B]ir_strcpy[/B]( [I]destination[/I], [I]source[/I], [I]range_begin[/I], [I]range_end[/I]);[/ICODE] [U]example:[/U] [CODE=c] char test[] = "Hello World!!!"; char test2[20]; ir_strcpy(test2, test, 1, 3); /* test2 now contains 'ell' */ [/CODE] | |
This is how mine [B]strlen[/B] function would look like if I'd to implement it from scratch :) | |
Make regex creation easier! Enter regex, test string, select from various function to run, then see the output. | |
These functions, to some, may seem trivial, but many people have queried in the forums on this topic numerous times. The functions are templated, so that it can accommodate any data-type that the user wishes to use (For example, the same function can be used for converting variables of type … | |
This is how mine [B]strcat[/B] would look like if I'd have to write it from scratch :) | |
This is how mine [B]strcpy[/B] would look like if I'd have to write it from scratch :) | |
This prime number generator is based on Eratosthenes' sieve, the found prime numbers are written to a file (you can specify it's name as a command line argument, as well you can specify the prime number upper bound (e.g: if you specify 500 as upper bound, the program will find … | |
This version is more precise and accurate compared to my first posted version of this script. | |
Instead of creating a new folder in users application folder under program files and putting there some visible resources, embedding those resources to single executable is better. in this snippet i will show playing an embedded sound file. | |
{-='Display the numbers and compute it using Dev-C LaNGuaGe'=-} | |
{-='Ask for the Student Name & Compute the grade using Dev-C LaNGuaGe'=-} | |
{-='Read a number series and print it reversed using Dev-C LaNGuaGe'=-} | |
{-='Number of Rows (Reverse) using Dev-C LaNGuaGe'=-} | |
{-='Converting Fahrenheit-Celsius & Vice-Versa using Dev-C LaNGuaGe'=-} | |
{-='Display the number of letters in each word typed using Dev-C LaNguaGe'=-} | |
{-='Calculate the average of ten numbers using arrays'=-} | |
The End.