2,322 Reusable Code Snippet Topics
Remove Filter ![]() | |
If you want to restrict the user to go back or forward from the web browser, you can use the below mentioned javascript. Use this javascript in the script tag. It works on all browsers. For further details: [url]http://dotnetbypulikesi.blogspot.com[/url] | |
This simple code shows to display the form in different shape. Also using the Gradient Brush to add Look And Feel to your form. Moving the form is also possible. Requirements Just draw a Form (Form1) and add Event handler for Load, MouseDown, MouseMove, Paint and DoubleClick for Form1. Then … | |
![]() | A java program which accepts a string from a user, and gives various options to change it case. Options include: [LIST=1] [*]UPPER CASE [*]lower case [*]Sentence case [*]Title Case [*]tOGGLE cASE [/LIST] |
This shows how to get the size of all the files in a folder, and all its sub-folders on MS-Windows operating system. It uses recursion to transverse all the directories, and return a 64-bit integer. It was compiled with VC++ 2008 Express and Code::Blocks Version 8.02 with MinGW compiler. | |
This is it, I've completed my forum script and I'm sharing it with you!!!!!!! :O Hope you like it, if you find any bugs, please post it here Oh yea, and the first registered person will be the admin | |
This is an update of an earlier version. In this version the string containing the approximated pi value is created directly from the iteration of the generator. This way the program is simplified and can be used with Python2 and Python3 ... | |
This is a [inlinecode]strtol[/inlinecode] version of [url=http://www.daniweb.com/code/snippet353.html] Read an Integer from the User, Part 2[/url]. | |
This tutorial shows how to greet your visitors depending on what time of day it is. If it's morning, it greets your visitor with "Good Morning!" If it's afternoon, it greets them with "Good Afternoon!" Magic? Noooo! Just PHP! We will start by looking at the entire script and then … | |
This code demonstrates how age might be calculated and filtered using the DateDiff method in SQL. Also, note that both the parameters are set to NULL by default, hence making them 'optional' to a certain limit. | |
Python uses the Mersenne Twister as the core random generator. The module random contains a fair number of methods (or functions) that help you to do random things. Here are some examples ... | |
If you are on school and you are taking algebra like me or just want to find the missing length of one side of the triangle than this program should help you out. Pythagorean Theorem Calculator is great and extremely essay to use thanks to this little program I pass … | |
The module tkSnack from our friends at KTH in Stockholm, Sweden allows you to play a variety of sound files using the Tkinter GUI. Supported sound files are WAV, MP3, AU, SND and AIFF formats. | |
Thought someone might like this little script. Its an animated wallpaper. You'll need to draw the frames though. I used Windows paint to make the frames. I drew two stick people fighting. You'll need to know the basics about animation. I saved each picture as .bmp It worked with .jpg … | |
You can place the game "Blackjack" by adding the following script to your website. All the information is included within the script, please do not remove the warranty or information. If you don't want such a big lap of code on your website, you can also place the following, as … | |
In the simplest of terms, a Class is like a cookie cutter. It describes what members and methods an object should have. You use the cookie cutter (class) to make (instantiate) one or more cookies that are all the same shape. The cookies are called objects. The same way that … | |
[COLOR="Red"]Note two things: First off, I don't guarantee that it works well. Writing to files, if done wrong can always break things. Be careful. I mostly participate in this forum (the Python part) for fun, and my code is written like that. Second: this script is about copying things. I … | |
This program takes two decimal number from the user and a operator for addition or substraction.it displays the binary equivalent of both number and also the added or substracted binary number . | |
Ok. So. Who doesn't know how to convert on paper or in their head decimal numbers ==» binary number, or vise-versa? Well. I've successfully programmed a conversion calculator for those who just never took the time to learn, for those who don't care to learn, and for those who've got … | |
Here we apply the module difflib to compare two texts line by line and show the lines of the first text that are different from the second text. | |
Compile this with NASM16 (Must be compiled in .COM format!) It will display all 256 colors usable by the BIOS in a neat rectangle that contains 16 columns, 17 rows (Just counted, it may be different). KNOWN BUGS: If you enter FULLSCREEN or run this program from a DOS operating … | |
This is a bare-bones search and replace script that uses perls in-place editor and the File::Find module to get the job done quickly. It will search in all sub directories of the start directory and find and replace the text you specify in the type of file you specify. Keep … | |
Whenever you hear the word recursion, factorials or Towers of Hanoi are never far away. Well here they get mentioned, because we are not going to talk about these guys at all! Iteration and recursion are in fact quite similar: they both loop until a certain condition is met. As … | |
This script can be used for star ratings on for example forum or music sites. The scriptinformation is included within the script. ~G | |
This snippet defines a function [b]chmod[/b] which uses symbolic strings to represent the mode (eg [b]u+rwx[/b]) like the shell command 'chmod'. | |
This is a very basic implementation of a Julia Set Fractal Generator. All of the variables are coded in, so feel free to change them to experiment with different results. I give an explanation of Complex Numbers and the Complex Plane, but you should look it up for your self, … | |
Joining together ordered sample points (xi, yi) when ths xi's are different yields a piecewise linear continuous (P1) function. This snippet defines a handy class to manipulate these functions. It allows computing the value and the slope of the function at each point, arithmetic operations, absolute value, truncation and linear … | |
This program uses the Python win32 extension module to get information on disk or flash drives for Windows machines. Specify the drive with its letter. If no drive letter is specified, the current drive is applied. | |
This program was written and tested in unix/linux environment (in EMacs editor )with a GCC compiler. | |
How to Handle Events Event handlers make up a large portion of Windows Form Coding. There have been a lot of questions on the C# forum of late that stemmed from people creating Event Handlers incorrectly. First lets look at how an event and its event handler works: Each event … | |
This code snippet shows you how to sort more complicated objects like a list of lists (or tuples) by selecting an index of the item to sort by. | |
[B]Overview:[/B] Oddly enough, MS never created a TreeViewDrowDown or equivalent. What I mean, is a control that looks and acts like a [icode]ComboBox[/icode], but contains a [icode]TreeView[/icode] instead of just a list when in the expanded drop-down mode. I've never understood why they haven't, but I always seem to want … | |
Hello everyone i'm a new member , i need ur help with this code , i want to write a for loop that assigns the 3rd row of the array to 0,, and then print out the array after setting the 3rd row to 0. | |
[B]This is just a linked list program for those who need help understanding the fundamentals. Put comments if you find some bugs. The program is about maintaining a student database (their roll number and their age) I've used Turbo C++ 4.5 as the compiler[/B] :icon_cool: | |
This procedure dispatches application defined event handlers and alternately executes default process for both standard or sub/super classed windows. Map is defined as follows. In most cases I define this table in .data, but in can be in .const also. I choose writeable memory as application can redefine characteristics. [code] … | |
This snippet defines a context to execute a block of statements in a different working directory (with the help of the with statement). After the block is exited, the initial working directory is restored, even if an exception has occurred in the with block. | |
Hi Folks the game runs. jippie, but i have a small problem i cant get the board to get drawn from left to right, its drawn from upwards to downwards hope anyone can help me Sincerly elomanias | |
[B]fseek()[/B] and [B]ftell()[/B] work only for files < 2,147,483,647 bytes [B]fseeko64()[/B] and [B]ftello64()[/B] from [B]<stdio.h>[/B] can deal with files up to 18,446,744,073,709,552,000 bytes the printf format for unsigned long long val is [B]%I64d[/B] eg. Obtaining the file dimension (this code was tested with [B]GNU GCC compiler[/B] (MinGW/Cygwin) from code::blocks) | |
This is a simple code-snippet that can be used to parse dates with javascript. It's setup to use European dates (dd.mm.yyyy | dd/mm/yyyy | dd,mm,yyyy), but it can easily be setup to use american dates as well (mm/dd/yyyy etc), to do so simply replace "$1" with "$2" and "$2" with … | |
The function adds two large numeric string together, like "12345667" + "12345678" = ? It does not have complete error checking, I'll leave that up to you. It should work but I am prone to bugs, so do advise if bugs are found. Included are also helper function that helps … | |
#ifndef _READFILE_H_ #define _READFILE_H_ #include<string> #include<vector> #include<map> using namespace std; class Readfile{ private: string str; vector <string> goArray; vector <string> strArray; vector <string> phyIntArray; vector <string> subArray; vector <string> proArray; /* member function */ void processString(string str); void processGoId(string); void processPhysicalInt(string); // void processMetabolicInt(string); public: typedef struct Info{ string uniprotID; … | |
Hello i am a musician and not a programmer. i assume this is completely obvious to you by now. do listen to my music if you please. something to do while you read my long enquiry. [URL="http://roon-salzman.com/MP3/tracking/JewellerySpot/Samantha_WIlls.mp3"]samantha.mp3[/URL] I am attempting my first c++ program to create a program for a … | |
Well, I don't think I can make this any simpler. I hope newbies in the C# language can learn from it. | |
The famous Tower Of Hanoi with graphics and animations. | |
I am given the class definition of stack and queue classes where I have to write a templated function called reverseQueue(?) that takes a pointer to queue as a parameter and uses stack object to reverse the given queue. The function call to reverseQueue should reverse the data of the … | |
PlugIns in their simplest form can be just python modules that are dropped into some designated directory and dynamically loaded by the main application. This snippet can be used to do just that. [B][U]Usage[/U][/B] To load plugin modules: [CODE]>>> plugins = importPluginModulesIn('mypackage') >>> plugins {'foo': <module 'foo' from 'mypackage\foo.py'>, 'bar': … | |
What will be the value of "++n" in the above code? Pls help.. | |
This is a [B]toupper[/B] and [B]tolower[/B] implementation for whole c-strings, without making use of the existing [B]toupper[/B] and [B]tolower[/B] functions for characters :) [U] example:[/U] [CODE=C]char s[]="Hello, beautiful world!"; stoupper(s); // s now contains: `HELLO, BEAUTIFUL WORLD!´ stolower(s); // s now contains: `hello, beautiful world!´[/CODE] | |
[CODE]#! /usr/bin/env python #filename:pwd.py # development environment:python2.51 import getpass usr=getpass.getuser() while True: pwd=getpass.getpass("passwd:%s:" % usr) if pwd=='123': print "welcome to python!!!!" break else: print "The password you entered is incorrect" [/CODE] |
The End.