2,322 Reusable Code Snippet Topics
Remove Filter ![]() | |
HEy:) Buddies in early morning i want to calculate that exchange during download & you very well known that it is shown in byte so just i am g with c++ and play a game for writing this. thanks enjoy it. It's very easy and handy with simple logic. | |
The code below captures the screen and saves it. Depending on your need, you can modify it to do just what you want [code] import java.awt.AWTException; import java.awt.Robot; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; class ScreenCapture { public static void main(String args[]) throws AWTException, IOException { … | |
/* difference between %i ad %d %i reads the value and it recognizes the value as what base it is when we read the value as 023 (base 8) it is 19 (base 10) and 0xa(base 16) it is 10 in (base 10). */ OUTPUT: /* Enter a number:023 Out … | |
this php n html code is supposeed to allow editting of property info/details | |
The source of my COPYRIGHTED tictactoe java game. It shows how to use multiple classes, methods, etc. | |
Here's possibly the single most useful function that I use. It simply takes an ADO record set and dumps the column names and row values into an Excel worksheet. To use it make sure you have Excel marked in your project references. | |
This is somewhat a simple project I wrote by getting help from google groups I always recommend. assemble this code using this command: [QUOTE]nasm -o 1.com 1.asm[/QUOTE] | |
This code draws different shapes to the screen,(in this version, only a square or a cross. It will be updated soon!!). This code was written by a beginner, for the beginners!! | |
[I]The FileSystemWatcher class is phenomenally powerful—and staggeringly simple.[/I] Start up a new Windows Forms application. Then drop FolderBrowserDialog, FileSystemWatcher, label, listbox, and button controls onto the form. [B]Setting up Properties:[/B] Set up the name properties of the controls; the button is called chooseButton, the label is folderLabel, the list box … | |
Seriously, what is any programming language without a HelloWorld app? | |
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 ... | |
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. | |
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 … | |
Here is simple example of static image to be displayed as logo on the start-up/splash screen. This can be improved by creating animation out of series of images or use of flash file through [URL="http://developer.sonyericsson.com/site/global/newsandevents/latestnews/newsapr08/p_project_capuchin_announcement.jsp"]Project Capuchin[/URL] library. As for location of image file this was placed in new folder called … | |
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. | |
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. … | |
As the title says: a C function for detecting anagrams. Returns [B]true[/B] if both strings are anagrams, returns [B]false[/B] otherwise. | |
A roman to decimal converter, no validity checking, so inputting an invalid roman number will certainly just yield a wrong result. | |
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, … | |
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 … | |
A program that creates a grid panel of desired [FONT="]dimensions [/FONT]and changes the colour randomly of each grid box upon dragging the mouse over the selected region. | |
Here's a script I worked up to convert binary code into ASCII. Didn't work out an ASCII to binary conversion yet. | |
Displays the html tags without rendering on a webpage. | |
Overview this is a fast way to delete Records from your mysql datebase without loading the page . this jquery code can Delete a Record with animation fade-out effect using jQuery and Ajax. <FAKE SIGNATURE> | |
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. | |
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. | |
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! :) | |
| |
Got bored and made a function that handles filling strings similar to mysqli bind_param. It actually gets used a lot in my code. Figured someone else might find it useful. Example usage: Using question marks as place holders [code] $str = 'Hello, my daniweb user name is ? and my … | |
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 … | |
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 … | |
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 … | |
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 … | |
Convert string to other datatypes via template. See below. | |
Random number generator under its own namespace. Its a sample program. | |
![]() | 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] :) |
1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> [ICODE]<HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function ViewImage(ifile,ix,iy,ititle) { var win; var sWidth; … | |
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. | |
A simple domain name checker. This script use service from who.is Usage: ruby domainchecker.rb <domain_name> | |
![]() | 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 ![]() |
![]() | 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. |
Hi there peoples, This is a currency converter, built with a combination of javascript and php, which uses an XML feed from [url]http://www.ecb.int/[/url] to get up to date exchange rates. I know the xml handling is not very elegant, but it is functional :) Additions/comments/corrections welcome | |
This script will lists all available methods, properties, values, and types, supported inside your browser. This is useful when you are creating script and you want to see a full reference lists of methods supported on the browser that you are working on - then you can simply run the … | |
This is how I would write the standard library function [B]strstr[/B] if I had to implement it from scratch. | |
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. | |
This generates a random number string. I needed to post this code to link to it :P | |
![]() | 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] |
![]() | 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]' |
![]() | This code snippet accepts a user-defined set of numbers, then accepts those many numbers, and displays the highest and lowest number. |
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. … |
The End.