File Snippets


05 July, 2012   

Backup MySQL Database to SQL File with mysqldump

22 February, 2016   

C/C++ source code for euler approximation method

13 October, 2015   

This function removes all duplicated lines of the given text file.

This is a PHP Class that calculates the size, number of files & folders of a specific directory.

Print variables with file and line number for debugging source code

Usually when you try to download something from a web server you get a request asking whether you want to save the file or open it. To avoid that you can use the below code on your .htaccess file

23 January, 2012   

How to create a text file named newtest.txt . here shown an example ASP code

The IsFileInUse Delphi function will return true if the file is locked for exclusive access. False is returned if the file does not exist. Code "flow": Two things need to be checked here: A) Is the file a READ-ONLY file? and B) Is the file in use? The main point of the excercise is to check the files attributes for the READ-ONLY...

The IsFileInUse Delphi function will return true if the file is locked for exclusive access. False is returned if the file does not exist. Code "flow": Two things need to be checked here: A) Is the file a READ-ONLY file? and B) Is the file in use? The main point of the excercise is to check the files attributes for the READ-ONLY flag...

16 April, 2011   

There are times when you need to split a large file into several smaller ones (for whatever the purpose is). The following two methods use Delphi TStream objects to break a file into several files with predefined size; and to merge those files back to the original.

Essentially the trick is to draw the panel/frame/etc. into a BufferedImage and use the ImageIO class to write it to an image file.

I had to scan a bunch of paper documents (one image per page), and upload them all to a web site that would accept only one PDF file containing the whole set.

26 April, 2015   

Recursively determines the size of a directory

18 July, 2012   

HTML code for flash player to play FLV files

This Applescript take the selected file in Finder and open it with Sublime Text 2 (~/bin/subl). Using Alfred you can bind a global hotkey for this script, so you can edit your files with just a keypress, without worrying about the default editor.

In order to add a splash screen to your black berry app, you need to create an XML file, name it "blackberry-tablet.xml" and place it at root level --With your Application descriptor file.

To get a user count the code below goes in your "global.asa" file which needs to go in the root of your web site. You web site must be properly set up as an application in IIS for this file to fire and do it's thing.

A custom Delphi function, FormatByteSize, converts a byte value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size.

18 March, 2013   

This code permits you to extract files from your resource file.

Two objects are included here, a reader and a parser. All you need to do is instantiate the xmlParser object and let it do the job for you. nextToken() will return the next token, which can be a tag or the text between 2 tags. the isTag() will determine if this is a tag so you can do something smart with it. Lastly you can jumpTo($tagname) if...