In the PHP, there are filters which can determine IPv4 and IPv6: FILTER_VALIDATE_IP, FILTER_FLAG_IPV4, FILTER_FLAG_IPV6.Below code shows how to determine the client protocol:This code snippet checks whether the client's IP address is IPv4 or IPv6 using fil...
Given an array of 10 words. Some words are repeated twice, we need count such words.Output:Print the count of the words which are repeated twice in the string.Constraints:1<=no of words<=10^51<=length of each word<=10^5Example Input 1)hate love peace love ...
This code will test whether a printer is connected to your system or not. It works with USB and network printers (haven't tested LPT printers yet). Some printers (like my HP DeskJet 930c) is detected online even though I press the OFF b...
In order to get My Videos folder, you need to call SHGetSpecialFolderPath(). But I recommend you to use below wrapper for easy control.function GetSpecialFolderPath(Folder: Integer; CanCreate: Boolean): string;// Gets path of special system folders//// Cal...
The TPrintDialog component displays a standard Windows dialog box for sending jobs to a printer. Unfortunately, the TPrintDialog does not expose the Title property. By handing the OnShow event of a print dialog you can specify the text for the dialog’s tit...
KMP String Matching Algorithm is well-known algorithm for faster string search. KMP is, as you know, Knuth, Morris, and Pratt. It's complexity is O(n). n is the length of target string and O is big-O notation.Here's the implemented algorithm.//////////////...
Without complex programming, you can print document by ShellExecute function.use ShellAPI;...ShellExecute(Handle, 'print', PChar('c: est est.doc'), nil, nil, SW_SHOW);
If you have developed C or C++ program, you may know below examples.// printf( "a.out");/* printf( "b.out");*/Above code have no bug, but no code will be compiled, because it's all declarations.In JSP, you can make declarations as well. In some docum...
The following procedure will list all the devices on your computer. You can then extract the com ports and printer ports by looking for the 'COM' and 'LPT' characters in the list.Add a Memo and a Button and place this code in the OnClick of a button...proc...
The time () function generates a long string of numbers representing how many seconds have passed since January 1, 1970. It is possible to add and subtract time by adding and subtracting seconds.
By using the SHBrowseForFolder Windows API function and Delphi we can invoke a Windows system dialog used to browse for files and folders on users hard drive as well as network computers and printers. First, let's look at what SHBrowseForFolder needs. Here...
Nice calendar for Web page display. Highlights the date and the day of the week. Well-documented code to help you customize any font,color,or size you want.Javascript & Cookie based Visitor Application (created at Aug 28, 2007) 101 This cookies records how many times the visitor has visited the page and writes to the page accordingly.visits.jsfunction GetCookie (name) { var arg = name "="; var alen = arg.length; var clen = document.cookie.length; var i ...
My company needed me to programmatically add a custom paper size (a printer form) to the default printer and set the printer to use the custom paper size. After looking around,the best alternative we could find was to make use of the printing and print spo...
Printing with the web browser control in .NET platform is not hard work. But the challenge for me was to navigate to a specific URL and then print the document with a single click event. There was another challenge I had to face,when I tried to print an HT...
At least once,in the life of a programmer,it succeeds that the moment arrives to print a text document. The task is quite simple for a .NET programmer,but even more with PrintTextDocument class. This class was written to help in printing text documents,add...
This is a .NET approach to Simplified Printing in which,we are going to use a RichTextBox to cache all of our text for printing in printDocument.// Form Loadprivate void Form1_Load(object sender,System.EventArgs e){
If you want to use MultipadPrintDocument in your own code,it's best to rename the class and its constructor to something more appropriate. Then add a variable of type XXXPrintDocument to your form and implement the menu items as follows:void OnFilePrint(Ob...