66 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Dimal

Hi there! This is a simple pascal program I wrote for a cashier. Please note that this is only a basic level program code and can't actually be used for commercial use. Thanks for reading!

Member Avatar for wwwalker
0
814
Member Avatar for FlamingClaw

Our text file contains 10 words,and located in C:\ drive,we will read this data into an array and write out the results to the screen Created by FlamingClaw 2009.04.26.

Member Avatar for gurisa
1
3K
Member Avatar for pritaeas

This snippet shows how you can get the headers for an URL, for example to detect a redirect. I had to use the ANSI functions to ensure correctly returned headers. Manual entry for [HttpQueryInfo](http://msdn.microsoft.com/en-us/library/windows/desktop/aa385373(v=vs.85).aspx). Let me know if you have any questions/remarks.

Member Avatar for vrkiro
1
356
Member Avatar for vegaseat

Just a few more explorations using a Python class to mimic a C Structure or Pascal Record. Loading the record from a csv type data file, displaying the data and sorting and searching the data in various ways.

Member Avatar for hughesadam_87
3
366
Member Avatar for pritaeas

The `ReplaceStrings` function replaces all strings in `APatterns` found in `ASubject` with the value in `AReplacement`. As an example, I added the `RemoveStrings` function which replaces everthing with an empty string, thus deleting all strings found. Usage examples are in the XMLDoc comments. A good test will be to rewrite …

Member Avatar for pritaeas
0
283
Member Avatar for ashine80
Member Avatar for ashine80
Member Avatar for Morten Brendefu

There are many places on internet for great help regarding many things. Proper implementation of really fast routines for sorting data however is not common. I am not claiming these routines to be the fastest around, but their ease of implementation and use may make them welcome. As a thank …

0
247
Member Avatar for vegaseat

Python does not have a type like struct in C or record in Pascal, but it can be easily implemented with a class. This little code snippet shows you how to do it.

Member Avatar for Gribouillis
0
4K
Member Avatar for FlamingClaw
Member Avatar for Morten Brendefu
0
255
Member Avatar for vegaseat

The function Delay() allows access to other events during the delay. For instance a certain key could be used to interrupt a lenghty delay. The Win32 API function Sleep() ignores events, maybe it should be called DeepSleep().

Member Avatar for Duoas
0
1K
Member Avatar for TrustyTony

There was question about encryption in Delphi/Pascal forum and a guy was suggested reversing the bits as additional step (I do not know if he in reality meant XOR 255, that is making 0's 1's and vice versa). As it keeps still same distribution of letters I suggested as better …

0
635
Member Avatar for Lord Soth

ShowDriveSerialNo shows it with ShowMessage GetDriveSerialNo returns a string. You don't need both.

Member Avatar for hingman
1
1K
Member Avatar for TrustyTony

The code demonstrates running program limitted time by following going over endtime expressed in seconds since midnight, so might fail for playing just midnight (add check that endtime is less than 24*60*60 if you want to be sure). Exciting action :) of the program is that it shows remaining time …

0
447
Member Avatar for Beat_Slayer

Well, it bothers me to build menus for every shell application that needs one. So, I've written a module to handle that, like in the good old turbo pascal times. :) Here it is, the module comments are pretty explainatory, I think, and the sample usage if run as script …

Member Avatar for Beat_Slayer
0
3K
Member Avatar for TrustyTony
0
791
Member Avatar for TrustyTony

I did this code to compare to Delphi code in Delphi forum [URL="http://www.daniweb.com/software-development/pascal-and-delphi/threads/357771"]TListBox and sorting[/URL] which ran in my computer compiled in free Lazarus environment at time 7,235 s for generate and insert to listbox, 13,265 s sorting the listbox.

0
586
Member Avatar for ReaperUser101

Hi guys The just of what i whant to do is read lines of text from a file until it reaches a delimiter and then execute that text in a query and repeat the process till there is no more text. I am using Delphi 6(don't have a choice) and …

Member Avatar for ReaperUser101
0
221
Member Avatar for FlamingClaw
Member Avatar for EAnder
Member Avatar for alenturuskovic
Member Avatar for Wolfgan
0
177
Member Avatar for Black Magic
Member Avatar for TrustyTony
0
235
Member Avatar for FlamingClaw
Member Avatar for Daaave

This snippet shows how to open, read, write and close text files. This skeleton can be modified to handle any type of file, from untyped to text to typed files.

Member Avatar for Deffcon
0
482
Member Avatar for vegaseat

A function that takes a string and returns the number of words in the string. An example of using pointers in Pascal.

Member Avatar for BitFarmer
0
2K
Member Avatar for FlamingClaw

This small program shows that how we can arrange strings by alphabet in a vector.By FlamingClaw

Member Avatar for sobari
0
1K
Member Avatar for Lord Soth

Note that the angle is in 1/10 of degrees. Any attempt to manipulate font.size or font.color will reset the angle to zero degrees.

Member Avatar for Vector Khanal
0
239
Member Avatar for FlamingClaw

I want to show a simple example about writing record to a file,and for checking,read back from that file. Created By FlamingClaw

0
258
Member Avatar for FlamingClaw

This algorithm will add the searched element's place in an array This works only when there is so element what we're searching for. By FlamingClaw

0
155
Member Avatar for FlamingClaw

This algorithm will decide that is there a serched element in the array.If it finds one then the loop halts.If the loop halts cause we're stepping over the last element of the array then there is not searched element. By FlamingClaw

0
2K
Member Avatar for FlamingClaw

Counts that how many propertied elements are in the array example:negative numbers By FlamingClaw

0
176
Member Avatar for FlamingClaw
0
802
Member Avatar for FlamingClaw

Prime or not?This little program will show prime numbers with green color from 0 to 100.By FlamingClaw;

0
293
Member Avatar for FlamingClaw

I want to show you some rules about bit operating like Not,And,Or,Xor,Shl,Shr... By FlamingClaw

0
199
Member Avatar for FlamingClaw

I've seen,there are guys that did not know,where to use a unit... See it just reference By FlamingClaw

0
783
Member Avatar for FlamingClaw

This little program a solution for putting a string into an array. The method is that the string is divided for chars.... By FlamingClaw

0
214
Member Avatar for FlamingClaw
0
199
Member Avatar for FlamingClaw
0
974
Member Avatar for FlamingClaw

Often there is a case when we want to fill an array with record,and this program will demonstrate it...

0
218
Member Avatar for FlamingClaw
Member Avatar for FlamingClaw
Member Avatar for FlamingClaw

Many people says 'Don't use the GoTo statement,because your code will be unreadable....'.I say,can be use

Member Avatar for FlamingClaw
0
1K
Member Avatar for FlamingClaw
Member Avatar for FlamingClaw
Member Avatar for kameshwar

Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle. The rows of Pascal's triangle are conventionally enumerated starting with row zero, and the numbers in odd rows are usually staggered relative to the numbers in even rows. A simple construction of the triangle proceeds in the …

0
147
Member Avatar for ddanbe

Blink and you will see them appear in a Console window. This is a translation to C# of a Modula-2 implementation by N.Wirth, the inventor of Pascal. The tested integers are obtained by incrementing alternatively by 2 and 4, thereby avoiding multiples of 2 and 3 in the first place. …

Member Avatar for ddanbe
0
97
Member Avatar for Jx_Man
Member Avatar for darkscript

This program generates lines of pascal's triangle, numbers after 23 generate weird output.

Member Avatar for technogeek_42
0
204
Member Avatar for JJarvis
Member Avatar for mumble bee
0
111
Member Avatar for Lord Soth

Based on [url]http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/[/url] Converted to Delphi by Lord Soth

Member Avatar for Zajoma
0
768

The End.