1,916 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for mmiikkee12

Seriously, what is any programming language without a HelloWorld app?

Software Development java
Member Avatar for javaAddict
1
157
Member Avatar for vegaseat

Tired of the Tk icon in the corner of the form. It's easy to replace with any fancy icon you have. Here is the code ...

Software Development python
Member Avatar for The-IT
0
1K
Member Avatar for ddanbe

Start a new Forms application. Drop a Panel and a Timer control on it. Set up a Timer_Tick, Form_Load and a Panel_Paint eventhandler and fill in the code. Run the app and watch the string rotate.

Software Development
Member Avatar for Diamonddrake
2
1K
Member Avatar for DdoubleD

Quite a few people have been asking how they can get their applications to talk to each other. More specifically, they have been wanting to know how to access information from another running application using .NET Remoting. Not having done this before, I decided to take up the challenge and …

Software Development asp.net
Member Avatar for ddanbe
2
1K
Member Avatar for vegaseat

An example of a range generator that handles floating point numbers, appropriately called frange(). The function range() or the generator xrange() can only be used for integers. Note that xrange() now is range() in Python3.

Software Development python
3
734
Member Avatar for Freaky_Chris

The following code snippet can be used to convert a decimal integer into any base from 2-16. This is a simple piece of code and I hope t proves useful to people. I see many people posting Decimal to Hex. or Decimal to binary, non any better than the next. …

Software Development c++
Member Avatar for hehehe01
0
3K
Member Avatar for tux4life

As the title says: a C function for detecting anagrams. Returns [B]true[/B] if both strings are anagrams, returns [B]false[/B] otherwise.

Software Development c
Member Avatar for Dave Sinkula
1
908
Member Avatar for tux4life

A roman to decimal converter, no validity checking, so inputting an invalid roman number will certainly just yield a wrong result.

Software Development c++
0
308
Member Avatar for mrnutty

It uses the idea of Seive of Eratosthenes. The code is basically does the following to find Prime Numbers : 1) Populate Array from 0 - > MAX 2) Find 1st Prime, which is 2 3) Delete all Multiple of 2, i.e set it to false 4) Find next prime, …

Software Development c++
0
378
Member Avatar for god0fgod

I've created a few functions to be used with pygame which are based on anti-aliased curves. At the moment and likely forever, it has two useful functions: aacircle(s,x,y,r,colour): Draws an anti-aliased circle on the surface s at the starting point x and y with the radius r. The circle will …

Software Development python
0
786
Member Avatar for Arman Majumder

A program that creates a grid panel of desired [FONT=&quot]dimensions [/FONT]and changes the colour randomly of each grid box upon dragging the mouse over the selected region.

Software Development gui java
Member Avatar for amos wang
0
198
Member Avatar for sneekula

If you own a stopwatch, here is your chance to benchmark the various versions of Python on recursion performance. The Ackermann function gives the old computer quite a workout.

Software Development python
0
234
Member Avatar for KevinADC

Code snippet to generate random passwords. Avoids using confusing characters such as lower case L (l) and the number one (1), the letter 'O' and the number zero. Upper-case alpha characters could be added to the character set if mixed-case passwords are desired.

Software Development perl
Member Avatar for Prakash_8111
-1
432
Member Avatar for lllllIllIlllI

This code shows an example of using recursion to simply solve a problem. Note though, it can take a long time to do larger numbers such as the 50th fibonacci numbers this way. Hope this helps! :)

Software Development python
Member Avatar for sneekula
0
211
Member Avatar for SAINTJAB

the code tries to export the table memberinfo to excel.

Software Development
Member Avatar for jatin24
0
388
Member Avatar for vashek

Hi All, this is my first C code in my professional life. I wanted to write a common function to retrieve file content. I do not know whether below code is upto the mark or not. any Suggestions/modifications/tips are greatly appreciated. [CODE] #include <stdio.h> #include <stdlib.h> /* Function Name: get_file_content …

Software Development c
Member Avatar for wildgoose
0
431
Member Avatar for Tom Gunn

This is an example of how to turn numbers into words. 1473 would get translated to "one thousand four hundred seventy three", for example. The class has a simple interface and can handle any value representable by unsigned int. The implementation recursively processes groups of 3 digits using table lookups …

Software Development c++
Member Avatar for William Hemsworth
3
512
Member Avatar for Gribouillis

When several producer threads put items in a queue.Queue, and a consumer thread gets items from the queue, there is no way for the consumer thread to tell the producers that they should stop feeding the queue. This snippet defines a subclass of Queue with a close method. After the …

Software Development multithreading python queue
Member Avatar for Gribouillis
0
320
Member Avatar for jhouns

compile using A86 assembler however you can adapt it for any other one easily... It just draws out a 3D like shape. It was annoying to get the angles right but suggestions on improvement to code is appreciated. :) Adequately commented so it is understandable not fully as it is …

Software Development assembly image
Member Avatar for jhouns
0
2K
Member Avatar for mrnutty

Convert string to other datatypes via template. See below.

Software Development c++
0
333
Member Avatar for mrnutty

Random number generator under its own namespace. Its a sample program.

Software Development c++
0
301
Member Avatar for sravan953

This program converts any number that you enter to a binary number. For more information on binary numbers, visit: [url]http://www.math.grin.edu/~rebelsky/Courses/152/97F/Readings/student-binary[/url] :)

Software Development java
0
230
Member Avatar for warbird43

Link List for the beginners of cpp, who want to get the idea about link list before starting OOP. its implemented by struct for best teaching the design standards to beginners.

Software Development c++ oop
Member Avatar for warbird43
-1
240
Member Avatar for sravan953

The user enters the full location of a file and the program determines whether the file is a sound file or an application and opens it after a user specified time. Example: Location: C:\Where ever\file.mp3 OR C:\Another Where Ever\prog.exe TIme(in mins): 10

Software Development python
Member Avatar for sravan953
0
285
Member Avatar for sravan953

A program which accepts a sentence from a user, and uses a [I]'for loop'[/I] and determines the longest word in the sentence entered.

Software Development python
0
523
Member Avatar for tux4life

This is how I would write the standard library function [B]strstr[/B] if I had to implement it from scratch.

Software Development c++
Member Avatar for tux4life
0
581
Member Avatar for ddanbe

The Sort method of the List class sorts everything the default way : ascending. You can use the Reverse method of this class to get what you want or you could implement the IComparer interface like in this snippet.

Software Development
0
730
Member Avatar for sknake

This generates a random number string. I needed to post this code to link to it :P

Software Development
0
218
Member Avatar for sravan953

This code snippet displays any word that the user enters in descending order, each time, removing the last charcter. So, [I]sravan953 [/I]in descending order would be: [I]sravan953 sravan95 sravan9 sravan srava srav sra sr s[/I]

Software Development java
1
351
Member Avatar for sravan953

Word: '[B]trouble[/B]' First vowel encountered: '[B]o[/B]' Therefore, the Piglatin version: '[B]oubletray[/B]' [I](From the first vowel till the last letter, concatenated with the first few letters which(or were not) left out, which concatenated with a standard 'ay')[/I] So, the Piglatin form of '[B]sravan953[/B]' would be: '[I]avan953sray[/I]'

Software Development java
0
139
Member Avatar for sravan953

This code snippet accepts a user-defined set of numbers, then accepts those many numbers, and displays the highest and lowest number.

Software Development java
0
155
Member Avatar for mypicturefaded

I haven't really used Lists very much in the past so I wanted to mess around with them today and see if I could do anything that was neat. In this snippet I create a list from a text file. In my case I used names of people I know. …

Software Development
0
174
Member Avatar for mypicturefaded

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 …

Software Development
Member Avatar for ddanbe
1
141
Member Avatar for sravan953

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.

Software Development java
Member Avatar for sravan953
0
246
Member Avatar for athlon32

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

Software Development c++
Member Avatar for MosaicFuneral
0
135
Member Avatar for Ramy Mahrous

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.

Software Development sql
0
476
Member Avatar for sravan953

A code snippet which accepts a word or a sentence from a user, and then sorts it, and displays the sorted list.

Software Development python
0
163
Member Avatar for sravan953

The user enters their first, middle and last names and the program prints their full name.

Software Development python
0
117
Member Avatar for Ramy Mahrous

Here's I wrote some code to say binding not means control and data from database, it may be class holds some data

Software Development
Member Avatar for Ramy Mahrous
0
2K
Member Avatar for Ramy Mahrous

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)

Software Development sql
Member Avatar for Ramy Mahrous
0
436
Member Avatar for Ramy Mahrous

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)

Software Development
0
250
Member Avatar for tux4life

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 …

Software Development c++
Member Avatar for MosaicFuneral
0
244
Member Avatar for ddanbe

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 …

Software Development
0
898
Member Avatar for tux4life

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 …

Software Development c++
Member Avatar for tux4life
0
840
Member Avatar for sknake

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

Software Development sql
Member Avatar for serkan sendur
0
196
Member Avatar for srvstv.prnc

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

Software Development algorithm java
1
196
Member Avatar for rhoit
0
206
Member Avatar for Intrade

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 …

Software Development data-structure java mathematics
Member Avatar for Intrade
0
129
Member Avatar for serkan sendur

three lines of code to check MS Excel is installed on PC

Software Development microsoft-office
Member Avatar for serkan sendur
0
469
Member Avatar for wavsyntax
0
149

The End.