2,322 Reusable Code Snippet Topics
Remove Filter ![]() | |
Just to give you an idea what Delphi can do, here is a plot of the ever popular sin(x). I have put enough information into the code comments so you can build the form. The PaintBox Paint Event takes care of the plotting. | |
This is Delphi code, just testing if there is some interest. | |
This simple program will draw several randomly sized and colored lines on the screen. Makes a good screensaver! | |
A singly (sp) and a Doubly Linked list class to create linked lists. Can be used to make dynamic arrays and could also be templated to work with any data type (this is old code and i didnt know how to at the time). Has been extremely useful to me … | |
The Standard Template Library (STL) vector is tempting. The burden of dimensioning an array is removed, and there are many wonderful functions to explore. The learning curve is a little steep, it will make your head swell, but in the end it's all worthwhile. Take a look at some of … | |
Let's expand the decimal to binary converter to include, amongst others, octal and hexadecimal conversions. Also shows how to exert some input control. Simple stuff! | |
Let's say you worked in the White House and had to keep two lists, one for the friends and one for the enemies. The boss came to you and said: "The Almighty talked to me out of a burning bush last night, telling me that I shall make my enemies … | |
Another experiment with the Standard Template Library (STL). This time we are taking a look at map. Map is a Sorted Pair Associative Container (a mouthful). The pair is -- const Key, Data --, where Key has to be unique. It is Key that is sorted. In this code sample … | |
Using the C++ Standard Template Libraries (STL) can be easy, once you know how to do it. No need to putz around with doubly linked lists anymore! Here is code showing how a STL list allows you to add, insert, remove, sort, splice, merge, display, and clean-out-duplicate strings. | |
Get simple information like serial number, bytes/sector, sectors/cluster, free and total disk space of your hard drive using Windows API calls. | |
This program finds the solution of system of simulataneous equation Using GAUSS SEIDEL METHOD. This method is very popural among the students who studies Numerical Techniques.Though this program cant find the solution of every equations,it is widely used.This can only found the solutions of those equations which are Digonally dominant. | |
What is so easy to do in HTML gets quite involved in C. Once you learn to look past the standard GUI overhead it becomes more obvious. This example shows the effect of the mouse cursor moving across a label by changing foreground and background colors. | |
This program shows how to display a JPEG (also GIF,BMP,WMF etc.) image using some Windows Graphical User Interface C code. The program uses the uuid.lib file that comes with many C compilers. | |
This snippet shows how to draw a red circle on a Windows form. Original code via BCX, modified to compile with Dev C++. The GUI code looks a little complex. Gets simpler, once you get past the required overhead. For those who need some hand holding with the Dev C++ … | |
This code demonstrates AVL insertion and deletion. The code was originally written in C by myself a little while back for a tutorial. The translation to Java was fairly trivial, and to add a little excitement I even threw in a few generics. Yes, I'm aware of this line: tree.data … | |
This small program simply allows the user to call two different methods passing along an interger value to each. One method will output numbers from zero utnil that integer value using iteration. The other method outputs numbers from zero to that integer using recursion. | |
Insertion sort, Selection sort, Bubble sort, Shell sort, Quicksort, and Heapsot. All optimized and ready to be experimented with. This is the framework for a Java application that speed tests various sorting algorithms (because there's usually little need to write one's own in production programs). Several popular algorithms were left … | |
This is Similar to the Previous Snippet, but it puts indivdual pixels of different colors randomly on the screen. Also makes a nice screensaver! | |
Ok, this is about as simple as it gets. This is a hit counter for your page that stores the count in a simple text file of your choosing. No need for a database, MySQL or otherwise. No complicated rubbish. Just one single function and one single file to store … | |
Use a Windows API call to add some color to your text output. A rewrite of an earlier C++ snippet for the C crowd. | |
Well like my previous snippet but completing the collection i suppose, this snippet counts how long it takes to parse the page and displays it somewhere.. | |
You've seen those sites that say how many seconds it took to parse the page and how many database queries comprised the page. Well heres the database query bit... | |
The continued fraction expansion gives us the answer to life's most persistent questions, like what is sin(x) or even tanh(x). This surprisingly short code allows you to estimate SIN, COS, TAN, EXP, SINH, COSH and TANH fairly accurately. Careful, this code is not for the usual TV crowd! You should … | |
This quicksort implements the basic recursive algorithm with three improvements. The first improvement is choosing the pivot based on the median of three values in the list to be sorted. This minimizes the chances of a worst case scenario. The second improvement speeds up the algorithm by termination when subfiles … | |
| |
this is a wrapper around the AnimateWindow API. this allows random animations in a dialog. I just call it in the dialog's OnInitDialog() handler. The 'fade' effect has not been implemented because I didn't like the idea of having to call RedrawWindow or something like that because sometimes the borders … | |
Returns the name of a folder in a CString after allowing user to browse for it. This is just a wrapper around the SHBrowseForFolder API, but it's great for only allowing a user to browse for folders! | |
Put it in you footer at Admin CP->Board Wrappers, and underline will disappear for username links. This code only makes sense when you have underline enabled for links in your CSS. | |
Have you ever wanted an arcade for your forum? Well now you can! The best part is you can play the games from x arcade at your forum, and not at some site! The instructions are easy to understand, and in no time you will have an arcade! Unlike If … | |
Add to....Board Wrappers: Footer No need to really change anything in the code, if you want to select a different default URL just change the variable in the top of the script. It's there so that at least some URL is added to the website url field. You can't add … | |
This programme can find the dimensions of cuboid and cylinder. In cuboids it can find missing dimensions also. Eg. if length is missing and volume is given it will find the length. | |
Adding this because it took literally an hour of searching before I found a code sample using fscanf that read more than just the first line of a file. This code assumes you're reading a file line by line that has the angle (int) followed by the Sine Value of … | |
If query is called getResults and your field name is called myField To change to 2-across or 3-across, or whatever, just change the MOD 4 to 2 or 3 or whatever number you wish. | |
Change Your_Query to match your query name, Your_data to match your field name(s), and change the colors (ffffff and dadada) to match the colors you want. | |
Change the yourActionPage.cfm to the name of the page you want to open, and adjust the sizes and other parameters as you need. | |
Learn how to take the Now() command and format it in a bunch of differnt ways. [B]Code from: [URL]http://www.iportalx.net[/URL][/B] | |
Alrighty! My goal here is to add the specified information into a MySQL database, but then also include a script that goes back and checks to make sure that the entrie given does not already exist. If you have any corrections, or any ideas on how to do this, I'd … | |
Hi, this is my first post here, just wanted a place to post some PHP code for a Savant2 plugin I created. I hope that's ok. If you've never heard of Savant/Savant2, you should definitely visit its website. Savant is a very elegant template solution for PHP that stands out … | |
Clearing Controls & Forms in Access (VBA) | |
| |
There are probably a few different version of this...here's the one I use which I find pretty simple: | |
Simple CLS for Resizing CTLs on a FRM | |
A simplistic program to compute the volume of a cylinder when its radius and length are input via MyInput.class | |
A simple demonstration of how MyInput.class can be used to input data from the keyboard. Computation is then done to compute the interest rate on a mortage. | |
A short example of passing variables between methods (functions). | |
An example of method overloading. The program calls a function to get the square root of a number. The appropriate function (integer or double version) is executed. |
The End.