2,322 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for FlamingClaw

Many people says 'Don't use the GoTo statement,because your code will be unreadable....'.I say,can be use

Member Avatar for FlamingClaw
0
1K
Member Avatar for FlamingClaw
Member Avatar for serkan sendur

By calling this function from the header row of your table, you can make your table collapsible.

0
195
Member Avatar for serkan sendur

Sometimes, you need to see what properties does that object have and what values are assigned to them. This snippet does that.

0
181
Member Avatar for serkan sendur

in the previous snippet i compared two tables having columns as name and value pairs. this new one compares two tables of any number of columns(as long as it is the same number on both tables).

Member Avatar for serkan sendur
0
148
Member Avatar for surender_kumar

Hello friends here i present a simple address diary program that store name, phone number,sunsigh,best moment date of birth and place,and also hobby of a person.... When you run this u must fill password and password is "hello"... I think you will enjoy it..............

0
122
Member Avatar for surender_kumar

Hello friends, I am new participant in daniweb Here is the fantastic coding of SHEEL SORT..

0
179
Member Avatar for FlamingClaw
Member Avatar for serkan sendur
Member Avatar for serkan sendur

converts the html tables which are created by string concatenation to dom table objects

0
140
Member Avatar for serkan sendur

very simple very powerful tab menu, it can be used as a switch menu or to hide-show associated panels.

0
91
Member Avatar for serkan sendur

I saw that in some xml files, child numbers are not the same for the elements which will correspond to our table rows. So i created a more smart version which is error tolerant.

0
158
Member Avatar for serkan sendur
Member Avatar for serkan sendur

I have searched for a tab menu script for a long time but none of them was flexible enough,then i created one for me. The algorithm is nice so the script is not too long although being flexible. your tab menu is in an html table row as follows :

0
93
Member Avatar for banders7

Here are 2 pieces of code. The first makes a hidden partition accessible by creating a path to it and assigning a drive letter. The second removes the path definition, effectively rehiding the partition. It is advised that caution be taken in the use of this code. The core to …

Member Avatar for banders7
0
600
Member Avatar for serkan sendur
Member Avatar for serkan sendur
Member Avatar for hastingo

// Displays a file in either upper- or // lowercase depending upon a user request. #include <fstream> #include <iostream> #include <string> #include <ctype.h> using namespace std; // Display(): display text stream using ToFunc // modification void Display(ifstream &fin, int (*ToFunc)(int c)) { // extract and display characters one-at-a-time char CurrentChar; …

0
105
Member Avatar for sahasrara
Member Avatar for subtercosm

C# delegates make it really easy to implement the visitor pattern. Instead of making an abstract class and Visit methods that accept a single argument of that class's type, let your Visit methods accept multiple arguments. So instead of a visitor class with N abstract methods, your Visit methods take …

0
137
Member Avatar for subtercosm

You could implement recursive algorithms in ways that avoid risking stack overflow, i.e. by manually implementing a stack of variables or a stack of states. It is better to implement combinators that take pieces of recursive definitions and do this work for you. It is particularly easy to do in …

0
108
Member Avatar for serkan sendur

This is something very simple but very hard to find in google, it took me 30 minutes to solve it out. You have a value of type string and you want to get index number of that value in your enumeration, and now you can use that index number for …

0
3K
Member Avatar for Freaky_Chris

This is a sample code snippet of a quicksort that uses templating and function pointers to allow the user to sort an array of anything from numbers to strings to structures. The idea is, that the coder writes a small function thats return type is bool, It should return true …

0
227
Member Avatar for sahasrara

Hi friens Linear search is a way of finding an element in the array that we made it . Binary search is quicker than Linear search . in this code if key was found , it is removed from array and then sorted array is shown again. Good Luck!

0
145
Member Avatar for sahasrara

Dear all This code shows, look for an integer number in the array of this type that we used from Binary search. It was wrote by Borland 5.02 . Good Luck!

Member Avatar for ddanbe
0
120
Member Avatar for seeniya
Member Avatar for Freaky_Chris

This snippet can be used to convert from bases between 2 & 16 to base between 2 & 16. This is an extension on converting decimal to any base snippet found here: [url]http://www.daniweb.com/code/snippet1067.html[/url] (By no means is this the best method of doing this, but provides rather a nice way)

0
683
Member Avatar for shital3144
Member Avatar for sahasrara
0
188
Member Avatar for kameshwar

Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle. The rows of Pascal's triangle are conventionally enumerated starting with row zero, and the numbers in odd rows are usually staggered relative to the numbers in even rows. A simple construction of the triangle proceeds in the …

0
147
Member Avatar for sciwizeh
Member Avatar for sciwizeh
0
548
Member Avatar for sahasrara

Dear entourage Here is a solution that read two matrix of complex numbers ( including imaginary an real ) and add and multiply these together. I wrote it by Borland 5.02 . Do joy !!!

0
2K
Member Avatar for sahasrara

Dear all This code first read a string then shows number of repetition of each character . I wrote it by Borland 5.02 . Good Luck !

Member Avatar for tux4life
0
136
Member Avatar for slate

A brute force method. Finds the FIRST and SHORTEST periodicity in the input list.

1
164
Member Avatar for dileepkumar235

This program displays all possible permutations of the string entered. say if u enter "abc" as input string the possible permutations would be displayed as ......................... abc acb bca bac cab cba ..........................

Member Avatar for dileepkumar235
0
176
Member Avatar for digital-ether

This class allows you to use the Google AJAX Translation API to translate arbitrary text to the many languages supported by the Google API. Source versioning added to: [url]http://code.google.com/p/php-language-api/[/url]

0
1K
Member Avatar for William Hemsworth

This snippet shows how you can manually split up a sentence using multiple delimiters. In this example, I split up this sentence: [ICODE]"Hello, my name is william!"[/ICODE] into the following: [ICODE]"Hello"[/ICODE] [ICODE]"my"[/ICODE] [ICODE]"name"[/ICODE] [ICODE]"is"[/ICODE] [ICODE]"william"[/ICODE] As you can see, the delimiters are not included ([ICODE]" ,!"[/ICODE])

Member Avatar for William Hemsworth
0
277
Member Avatar for Gribouillis

This snippet defines a cachedProperty decorator. A cached property differs from a property in that it's value is only computed the first time that the property is accessed and then stored in the object's dict for later use. If the object's attribute is explicitely deleted, it will be computed again …

0
497
Member Avatar for serkan sendur
Member Avatar for serkan sendur
Member Avatar for Gribouillis

This snippet defines a function [icode]patfilter(pattern, rule, sequence)[/icode] which implements filtering a sequence of strings according to various criteria. The output is either a subsequence of strings, or a sequence of match objects.

Member Avatar for Gribouillis
0
402
Member Avatar for sahasrara

Hi my friends In this part you can see a link list that sort when you add your number. First number set as the first node. next number that you will enter , is compare with first node. if it was less than first , it set as first . …

Member Avatar for sahasrara
0
163
Member Avatar for sahasrara

Dear all This program takes from you a alphabetic character and shows all of characters before it .(ascending or descending) I wrote it by Borland 5.02 . DO JOY!!!!

0
88
Member Avatar for sahasrara

Dear my friends This code take base of time details as second , minute and hour . it also take base of date details as day , month and year . Then it take length of time and date details . Finaly these information is process by program and it …

0
95
Member Avatar for sahasrara

This code converts decimal number to hexadecimal number I wrote it by Borland 5.02 . Good Luck

0
163
Member Avatar for sahasrara

Hi Hi Hi this solution is inverse of other solution that changed Decimal number to hexadecimal . It changes hexadecimal number to Decimal ! There is the other way to change characters to numbers. Good Luck!

Member Avatar for sahasrara
0
193
Member Avatar for sahasrara

Hi ladies and gentlemen This program is a sample of data structure for information of students . this data structure is Linked List that include public & private filds. Its private has the other class which i named it node. node builds physical structure of linklist class. node class consist …

0
175
Member Avatar for sahasrara

Dear programmer This program get 2 (simply) numbers in 10 radix , then changes them to 16 radix and add together and finally shows result. I wrote it by Borland 5.2 C++ . Good Luck!

0
141
Member Avatar for essential

In for the latest addition to my code snippets, here's one you'll trully appreciate. This validation tools is packed with the W3Cs (x)HTML Markup validator, CSS validator, MobileOK tester and Semantics Extractor. hope you'll enjoy this newest addition of snippets'...

1
244
Member Avatar for serkan sendur

Accepts number as input, writes the prime numbers up to that number to the screen.

0
161
Member Avatar for KevinADC

This code snippet will produce strings of numbers (1 thru 49) with no repeated numbers in the same string and no duplicated string of numbers in the list of strings. To change the range of numbers the script generates change 49 in the code to your requirements. Please feel free …

Member Avatar for KevinADC
0
652

The End.