1,916 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Narue

Some languages are hard to get started in. FASM appears to be one of these languages because the documentation is not detailed enough for a beginner. That's a shame because FASM is (in my opinion) one of the better assemblers. The following snippet is a simple Hello, world! program which …

Software Development assembly
0
1K
Member Avatar for vegaseat

Just in time, a short Python code snippet to calculate the date of Easter Sunday of a given year. This can be expanded to calculate the important date of Mardi Gras too.

Software Development python
0
4K
Member Avatar for vegaseat

I took the data of an old State Trivia game and applied it to Python. The data forms a series of lists with matching indexes. One example of how to ask a trivia question, present four possible answers, and how to evaluate the correct answer is given. You can expand …

Software Development python
0
744
Member Avatar for Lord Soth

--- Basic Datatypes --- --- Form Management --- --- Data Access --- --- Component model ---

Software Development c# delphi pascal
0
744
Member Avatar for Lord Soth

You can use any of the commented constants to perform the explained function. You might need to adjust the process privilege on NT based OSes.

Software Development pascal
0
213
Member Avatar for Lord Soth
Member Avatar for Lord Soth
Member Avatar for Lord Soth

In case there are mote than one NIC (Network Interface Card) the coe gives the MAC of the first adapter. You can change the 0 on the line qoted below to take the MAC of other NICs if present. "Result := GetAdapterInfo(AdapterList.lana[0]) "

Software Development pascal
1
1K
Member Avatar for Lord Soth

This code disables font smoothing for a TLabel component. Can easily be converted for other VCL controls. Loren Soth

Software Development pascal
0
347
Member Avatar for Vagabond

Beginner C++ - A simple calculator writen in C++, compiled on Tubo C++ v4.5 & Borland C++ 5.5. The user inputs numbers & chooses '+','-','*'/' The operator is tested. If correct the appropriate sum is preformed.

Software Development c
0
154
Member Avatar for mnemtsas

Uses the API to get the regional short date format from the PC

Software Development api visual-basic
Member Avatar for tzatziki
0
279
Member Avatar for bumsfeld

Question of wordcount program similar to Unix wc came up in the forum and I worked on a solution. Program shows number of lines, number of words, number of characters and text file's name. Good learning for commandline, file and string handling.

Software Development python unix
1
3K
Member Avatar for Comatose

The Relative of push is pop. Pop removes the last item in an Array, and returns the value into a single (scalar) variable. Again, due To VB Limitations, this one works on strings.

Software Development visual-basic
0
202
Member Avatar for Comatose

Simple Function To Simulate The Push Command, due to VB's limitations, This one is Specific To Strings. (Simple enough to modify for integers or variants, etc)

Software Development visual-basic
0
208
Member Avatar for kharri5

This is a little code for a shell that allows for simple redirection and multiple yes! MULTIPLE piping abilities. It is slightly glitched for background processes, and this is only my second program written with C/C++ so it looks to be quite inefficient, but the piping works pretty nicely. The …

Software Development c++ unix
Member Avatar for ZeRo 00
0
224
Member Avatar for bumsfeld

The little program allows eye patients to test their color skills. They are given a random color rectangle by the computer and are then asked to match the color as closely as they can using sliders of the three basic colors. An evaluation button examines the closeness of the results.

Software Development python
0
418
Member Avatar for Rajnesh

This prog uses SQL Server's Master Databases xp_cmdshell stored procedure (Shell Commands) to send messages in a LAN.Make Sure the driver name is 'netsend' and it points to Master Database. Check and change the username and passwords in the Java Program also.Make sure you have sufficient priviledges to execute stored …

Software Development java java-swing sql
Member Avatar for Antony Prabu
0
188
Member Avatar for vegaseat

A list comprehension derives a new list from an existing list, and was adopted by Python from the Haskell language. This snippet tries to explain the development of list comprehension and shows a number of uses, including nested list comprehension. The benefits are simplicity (after an initial learning bump) and …

Software Development python
1
315
Member Avatar for vicky_dev

This program calculates the determinant of a square matrix of any order using a recursive function. Uses a square matrix struct and related functions.

Software Development c
Member Avatar for royujjal
0
394
Member Avatar for Eng. theFOX

count the number of occurrences of a sub-string in another string. a good example for learning how to make your own functions like strcpy, strlen and strcmp

Software Development c
0
172
Member Avatar for tayspen

Playing a wave file just got a whole lot easier.

Software Development
0
204
Member Avatar for Dave Sinkula

Yet another angle at this same topic. [i]See also [url=http://www.daniweb.com/code/snippet318.html]Parsing a String into Tokens Using strcspn, Part 1[/url] and [url=http://www.daniweb.com/code/snippet443.html]Parsing a String into Tokens Using strcspn, Part 2[/url].[/i]

Software Development c
0
728
Member Avatar for Dave Sinkula

This snippet is a variation of the code in [url=http://69.93.117.133/code/snippet318.html][i] Parsing a String into Tokens Using strcspn, Part 1[/i][/url]. It uses canned strings rather than reading from a file. [i]See also [url=http://www.daniweb.com/code/snippet444.html]Parsing a String into Tokens Using strcspn, Part 3[/url].[/i]

Software Development c
0
747
Member Avatar for roverphoenix

Regular expression pattern match in a string, I only checked with * as wild card, other wild card characters are easy implement but I havent done that. any problems you can email me @ [email]rramaswa@usc.edu[/email] platform - Unix/Linux, havent tested in windows, should'nt be a problem unless some standard header …

Software Development c unix
Member Avatar for ~s.o.s~
0
172
Member Avatar for Dave Sinkula

How might I write an implementation in C of a case-insensitive version of the standard library function [inlinecode]strcmp[/inlinecode]? Here's how I might. This this is often available as a nonstandard function that may be called [inlinecode]stricmp[/inlinecode], [inlinecode]_stricmp[/inlinecode], [inlinecode]strcmpi[/inlinecode], or [inlinecode]strcasecmp[/inlinecode]. [i]See also [url=http://69.93.117.133/code/misc.php?action=edit&codeid=316]Strings: Comparing[/url].[/i]

Software Development c
0
356
Member Avatar for tayspen

Code to empty the windows recycle bin

Software Development
0
233
Member Avatar for vicky_dev

This program outputs a given string word-wrapped to N columns in console. The program can also handle words whose length is greater than N.

Software Development c
0
131
Member Avatar for ShawnCplus

I created a bowling game, Which for the most part works correctly. I toiled for hours trying to figure out how to do the scoring so i gave up. Its fairly simple code so not much of a description needed.

Software Development c++
Member Avatar for ShawnCplus
0
2K
Member Avatar for tayspen

Shows how to create a simple 'Process Manager'. and control processes

Software Development
Member Avatar for VinhBrao
0
170
Member Avatar for vegaseat

The lowly soundcard in your PC has fascinating capabilities. All you need is a module that can handle the Musical Instrument Digital Interface (MIDI). Tell the soundcard which instrument to play, specify the musical note, the duration, the beat and other things. The sound chip makes 127 instruments available and …

Software Development python
Member Avatar for caribedude
1
682
Member Avatar for comwizz

Heres a precise and short way to permute any word without pointers

Software Development c
0
218
Member Avatar for vegaseat

Boo is new, well at least relatively new. If you are familiar with Python and C#, you can feel right at home. Most of Boo is written in C# by a Python devotee. Boo has static typing, but also mimics dynamic typing by inference. This way you are not in …

Software Development ide open-source python
Member Avatar for vegaseat
3
445
Member Avatar for Puckdropper

So you want random numbers with negative values... How do you get them? This is a simple method to do so.

Software Development c++
Member Avatar for todd.sifleet
0
249
Member Avatar for Dave Sinkula

Break down an amount into units of dollars and cents.

Software Development c
0
150
Member Avatar for pierreth

This class implements a mechanism to encapsulate a selector. A selector is method signature descriptor. It is an easy way to create what may be called function pointers like in C language. I took my inspiration from Objective-C.

Software Development java objective-c
0
126
Member Avatar for vicky_dev

A very versatile, fully customizable graph drawing program using the TurboC++ graphics library. The DrawGraph() functions does the actual graph drawing. It can be used to draw graphs of BOTH CARTESIAN AS WELL AS POLAR functions. You'll need to pass the math. function to the program. The main() demonstrates the …

Software Development c c++
0
996
Member Avatar for Puckdropper

This is an Ada package that simply waits for the user to press the enter key. (If they enter anything else it's simply ignored.)

Software Development
0
173
Member Avatar for Puckdropper

The first of a few examples I'd like to contribute.

Software Development
0
117
Member Avatar for vicky_dev

Program to demonstrate pattern-searching of strings. This program interactively builds a list of words and searches for words in the list that match a specified pattern. The pattern can include wildcard chars * and ?. Eg : The query s* gives the words in the list which start with s. …

Software Development c user-interface
0
129
Member Avatar for Ene Uran

Powers of 2 are closly linked to the position values of binary numbers. The most right position is 2 to the power 0 = 1 then goes to the left with 2 to the power 1 = 2, 2 to the power 2 = 4 and such. If you want …

Software Development c
1
149
Member Avatar for ShawnCplus

Well its fairly self explanatory, its a program that shows that calculates the hypotenuse using the pythagorean theorum, It displays the values of the sides and shows a crappy ascii art right triangle with the values input and the later found values

Software Development c++
Member Avatar for manutd
0
215
Member Avatar for vegaseat

The wx.ComboBox is a combination of an editbox and a (dropdown) listbox. It let's the user slect an item from the listbox and puts it in the editbox. In this snippet we use two comboboxes, each used to select an area unit of measurement. Once selected, an area value can …

Software Development python
1
2K
Member Avatar for ShawnCplus

Ok I greatly modified a tutorial to have a completely different interface, a highscore list and a little tiny really rare easter egg. to get the highscore list. I want to figure out how to sort the highscore list if it is possible. And dont worry about it freaking out, …

Software Development c++
0
167
Member Avatar for vegaseat

Not much excitement in that standard wxPython empty window icon. It's time you put a more picturesque icon up there. This snippet shows you how to use an embedded icon or your own icon you have as an icon file in your working folder. Actually, the embedded icon is written …

Software Development python
0
1K
Member Avatar for vegaseat

In this experiment we call the paint event and establish a device context to draw a rectangle and fill it with the color set by the brush. Actually, we will draw 99 random sized and random colored rectangles with a small time delay. Don't worry, it will be faster than …

Software Development python
0
837
Member Avatar for Dave Sinkula

How might I write an implementation in C of the standard library function [inlinecode]strcat[/inlinecode]? Here's how I might.

Software Development c
0
296
Member Avatar for vegaseat

The wxPython widget wx.Gauge is commonly called a progress bar. In this code snippet I have bound the wx.Gauge to a wx.Slider, as you move the slider so do the indicating bars of the gauge. A second method is explored too, here the gauge indicates the progress of a timed …

Software Development python
0
416
Member Avatar for vegaseat

Using a wxPython GUI program to find the position of the mouse when clicked within the frame/window. Also sets the color of the frame and changes the cursor to a pencil. The title bar of the frame displays the coordinates of the mouse position.

Software Development gui python
1
2K
Member Avatar for G-Do

Suppose you are a medical researcher studying diabetes. Your boss has given you a big chart of data from diabetes patients. Each row of the chart has information for one patient. Each column of the chart is a health-related statistic, such as height, weight, age, blood pressure, cholesterol level, etc. …

Software Development algorithm python
2
1K
Member Avatar for vegaseat

Create a dictionary with char:count pairs, change the dictionary to a list of (char, count) tuples, sort the list by character and display the result. That's all there is to counting and displaying the characters in a given string. Just a few lines of Python code.

Software Development python
0
886

The End.