1,916 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for William Hemsworth

Heres a snippet that allows you to make your own images by using a mathematical formula. It gives you fast access to each pixel in the bitmap, and then saves the image as a [B].bmp[/B] once its made. You can be creative like this and make images which would be …

Software Development c++
Member Avatar for Prabakar
0
1K
Member Avatar for toraj58

[B]Sometimes it is good to sit back and reflect on life[/B]. More specifically, you can sit back and reflect on yourself. Often you will discover information that you didn’t realize about yourself. [B]it is possible to have a C# program reflect upon itself.[/B] You can use such reflection to learn …

Software Development c#
0
149
Member Avatar for Alex Edwards

Simple program that returns a vector of string elements based on the string argument and the token specified.

Software Development c++
Member Avatar for Alex Edwards
0
183
Member Avatar for William Hemsworth

Heres a snippet that compares the speed of volatile (nonregister) variables, and register variables and display's the average cycle count for each. This shows you exactly how much using registers speeds up loops and calculations. I get the following output, but it may vary: [QUOTE]Cycle count for nonregister integer: 8 …

Software Development c++
0
148
Member Avatar for Kelicula

Ever had to fix auto-generated dates retrieved from MySql databases? I made a really quick fix that displays the date in "human readable" format. Just replace "CST" with GMT, or EST etc... Whatever time zone your mysql server is located. it takes one argument, the date from the database. [B]Usage:[/B] …

Software Development mysql perl
Member Avatar for Kelicula
0
219
Member Avatar for Kelicula

[B]Situation:[/B] Ever wanted to get the size of an image? Possibly to determine new height and width dimensions that DO NOT distort the proportion. Well I have, and I overcame the math like so. [B]Solution:[/B] First you must decide on an image width. The subroutine returns the proportional height equivalent. …

Software Development html-css image perl
Member Avatar for Kelicula
0
167
Member Avatar for Alex Edwards

I'm not sure if it has been done yet or not, but I thought this program might be helpful to those that want to practice SQL in Java, because it sure is helpful for me! =) The assumption is that you're running Java 5+ and that you have a Database …

Software Development java
Member Avatar for newtonorina
0
248
Member Avatar for llemes4011

A program that finds the day of the week you were born on. Once again, this was adapted from a homework assignment, but I rewrote the entire thing from scratch >.< but it was a lot of fun.

Software Development java
Member Avatar for toyi
0
2K
Member Avatar for llemes4011

A program that asks for a number, and uses that number to find the date that many days from today (or whatever day you're using it on). The code was adopted from a homework assignment, so that's why the variable names might not make a lot of sense, I was …

Software Development java
0
98
Member Avatar for sciwizeh

Finds all (integer) the triples from zero to max. won't return duplicates (ie. (3,4,5) and (4,3,5)) prints them demonstrates: nested loops, multiple classes, proper equals(Object) override (no hashcode though), writing to file

Software Development java
0
251
Member Avatar for Fungus1487

Below is code i wrote as a wrapper for the microsoft office interops. It provides ways to establish the instance of the application and cleanup any remaining office processes after use. [I]Note the class I use is alot bigger but i have added the basics as a starting point.[/I] This …

Software Development microsoft microsoft-office vb.net
Member Avatar for BarbaMariolino
0
984
Member Avatar for gsbr

First it is in RosAsm style. Sorry I am addicted to its simplicity of use. The Proc is called from Dialog initiation [CODE] [Counter:D$ 0] ; Call for the first ToolTip Call SetTTip D$hdlg, ; H Dialog Handle of Dialog or Window 1, ; Tool tip number ID 1, ; …

Software Development assembly
Member Avatar for gsbr
0
247
Member Avatar for Gribouillis

If you're not used to work with the standard module logging, this snippet will allow you to incorporate a logger in your application without effort. It gives you a starting point before you try to use more sophisticated features of the logging module.

Software Development python
0
185
Member Avatar for vegaseat

Here is an example how to write a program to convert between units of distance, area, volume, weight, pressure, and energy. The wxPython GUI toolkit's wx.NoteBook() widget is used to make good use of the limited frame/window space available.

Software Development gui python
3
184
Member Avatar for yash301288

Its a simple program giving the demo of intre thread communication based on MovingBalls.java program... Hopng that its Useful For U?

Software Development java
0
145
Member Avatar for Gribouillis

This is a command line utility which lists the names of all functions defined in a python source file with a [icode]def <name>[/icode] statement

Software Development python
2
216
Member Avatar for vegaseat

A variation of the previous bouncing ball code. This time the upper left corner of the image rectangle simply follows the position of each mouse click. Use an image you have, in my case I used a small red ball in a black background. A simple code to experiment with.

Software Development image python
3
3K
Member Avatar for ArkM

CPU Performance Counter based clock and stop-watch classes for Win2K++ were implemented in VC++. Details: see sources (I hope, these classes, especially StopWatch, have well-to-do interfaces;)). Warning: no special precautions for multi-threading/multi-core CPU environment. It's not so hard work to translate these codes in C (or other C++ implementations). This …

Software Development c++
0
175
Member Avatar for JLChafardet

this is the other part of my 2nd semester, first quarter project for programming 2. a simple function to convert from arabic numbers to roman numbers.

Software Development c++
Member Avatar for JLChafardet
0
218
Member Avatar for JLChafardet

This code was part of my first quarter 2nd semester project for a subject called programming 2. its a simple roman to arabic convertion function.

Software Development c++
Member Avatar for JLChafardet
0
309
Member Avatar for teddies

Hey guys. I originally wrote this program as a University assignment. It's basically a simulated game of 'tanks' roaming around a grid blowing eachother up. It isn't intended to be the most exciting game in the universe, infact when you look at the programs' output there will just be a …

Software Development gui python
Member Avatar for Murtan
0
332
Member Avatar for vckicks

Draw animated GIFs in C# in a frame-by-frame basis. Gives you a finer level of control.

Software Development
0
237
Member Avatar for JLChafardet

This code is an example of a simple bubble sort function in C++. the function doesnt receive or returns nothing just for the record, some translations "declaracion de constante" = constant declaration "prototipo de funcion" = function prototype "arreglo" = array "Arreglo en el orden original" = original array order …

Software Development c++
0
207
Member Avatar for iamthwee

Well technically it isn't an anagram finder, more of a word descrambler program. It is useful for games like scrabble etc. All you need is a dictionary file, which you can find readily online. Make sure the file has the words on each line and they are all in lowercase. …

Software Development c++
0
862
Member Avatar for Alex Edwards

Nothing too special, but it was an interesting task.

Software Development c++
0
106
Member Avatar for jesse_gador143

int number; Console.Write("Enter a number: "); number = int.Parse(Console.ReadLine()); int ctr = 2; while(ctr <= number) { if(number % ctr == 0) break; ctr++; } if(ctr == number) Console.WriteLine("Prime"); else Console.WriteLine("Not Prime"); Console.ReadKey();

Software Development
Member Avatar for ddanbe
0
233
Member Avatar for killdude69

This simple command line script is used to pull a prank on one of your buds. What it does is play an anoyying beeping sound over and over again while rendering the computer being used completely unresponsive. The task manager doesnt even respond. The window never loses focus and nothing …

Software Development c++ window-manager
Member Avatar for killdude69
0
137
Member Avatar for killdude69

Put the following code in a C++ Header File. The following function is to make it way more easier to draw text onto the client area of a window. Now the only thing you need to do is include the C++ Header file containing this function into any C++ Source …

Software Development c++
Member Avatar for killdude69
0
308
Member Avatar for William Hemsworth

This snippet shows how to use hooks to stop the cursor from entering a certain area of the screen. This example will stop the cursor from going over 300 pixels away from the centre of the screen by using a bit of maths.

Software Development c++
0
744
Member Avatar for iamthwee

How to sort a class by their various attributes in C++

Software Development c++
0
356
Member Avatar for subcom

[B]Introduction[/B] .NET Remoting provides a rich and extensible framework for objects living in different AppDomains, in different processes, and in different machines to communicate with each other seamlessly. .NET Remoting offers a powerful yet simple programming model and runtime support for making these interactions transparent. In this article we will …

Software Development sql
0
273
Member Avatar for subcom

[B]Introduction[/B] We can use Microsoft SOAP protocol to transfer any files between client and server.It's easy through firewall and also it cross flatform. [B]Background[/B] I was going to develop an mobile software on pocket pc,but I found there were tiny resouces to use on mobile operating system.finally,I was finding Web …

0
544
Member Avatar for subcom

[B]Introduction[/B] We can use INI file to auto generate the database connection string. [B]Background[/B] It can be used in Webform and winForm.

Software Development c#
Member Avatar for sneekula
0
347
Member Avatar for Alex Edwards

This is a program I designed that implements a little bit of vector-math to determine the collision between 2 vectors. Hopefully this program will be useful to those out there designing 2D graphics programs and need a better solution to determining graphical object-to-object collisions when two objects meet, without having …

Software Development c++
0
218
Member Avatar for William Hemsworth

Hey, Here is a program I made which has interested quite a lot of people over the past few weeks, so I figured I would share it :) Using a small amount of trigonometry you can create some very fascinating shapes and effects. But in order to draw anything you …

Software Development c++
0
170
Member Avatar for alpe gulay

.,'this is a simple java codes in w/c will enable to read a txt files.

Software Development java
0
294
Member Avatar for alpe gulay

..'this is a simple program in w/c enables to create a txt file. it ask input from user first then put that in the txt file. :-)

Software Development java
-2
270
Member Avatar for alpe gulay

..this is a simple java code w/c allows to produce a beep sound. timer also is being applied here. hope it will help for any reason it may serve. :-)

Software Development java
Member Avatar for toyi
0
1K
Member Avatar for Radical Edward

One problem with C# is that if you want to modify a collection, you have to manually iterate over it. The generic List class supports ForEach, but there's no method that allows global list changes. C# is kind of restrictive in what changes you can make while iterating, so Edward …

Software Development c++
0
210
Member Avatar for udaywali

Here is some code that will help you connect a LCD module to Parallel port of a computer. Almost any 16x2 LCD module should work. It has complete VB6 code. It works on Windows XP very well. I have used hwinterface.ocx from Logix4u.net that provides basic Inport and OutPort functionality …

Software Development visual-basic
0
563
Member Avatar for Radical Edward

Edward designed this class as a poor man's named property initializer using syntax similar to C99's designated initializers if they worked in a C++ constructor call: [code] Person me( .FirstName="Radical", .LastName="Edward", .Age=23 ); [/code]

Software Development c++
0
268
Member Avatar for Shalvin

Checking whether value is entered into a control and preventing focus to go out if no value is entered.

Software Development
Member Avatar for bruceraymond
0
162
Member Avatar for credford

Returns the power set of the elements of a given list (even if some of those elements are also lists).

Software Development python
0
290
Member Avatar for a1eio

For more information on threading read this [B]excellent[/B] 4 page tutorial: [URL="http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/"]http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/[/URL]

Software Development python
0
398
Member Avatar for mukorera

Iterative and recursive programs.these programs have been tested and run very well.enjoy

Software Development c
0
159
Member Avatar for alpe gulay

.,'this program will simply creates a diamond using asterisk.,' just try out this code i am sure you will be interested.!.. email me about your comment in this simple program!..help me if you know the easiest way to construct this kind of program..'

Software Development java
0
184
Member Avatar for begueradj

Hi from Begueradj, This program written in Turbo C simulates a student data bases using files. Basic operations such as seeking for a given student, deleting, adding and sorting are implemented here. Feel free to give me your points of view. Thanks, Begueradj.

Software Development c
Member Avatar for begueradj
0
161
Member Avatar for vegaseat

Text to speech can be implemented in its simplest form using Microsoft's Component Object Model (COM) connecting to the Speech API (SAPI). The attached Python code shows you how to do this.

Software Development api python
0
4K
Member Avatar for joshmo

The code prompts the user for a student name and the marks then prints out the report with a letter grade..It also asks the user for the file name and stores the data in the file.

Software Development c++
Member Avatar for MPELANE
0
490
Member Avatar for vegaseat

This short Python snippet shows you how to read mouse wheel events with the Tkinter GUI toolkit. Windows and Linux have different bindings and read different events, but can be included in the same program code for use with either operating system.

Software Development gui operating-system python tkinter
0
21K

The End.