Format Duration





ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

10
Date Submitted Thu. Mar. 16th, 2006 10:01 PM
Revision 2
Coder mattrmiller
Tags Bytes | Format | Java | String
Comments 0 comments
Format Bytes
13
Date Submitted Thu. Mar. 16th, 2006 10:49 PM
Revision 1
Coder mattrmiller
Tags Compression | File | GZIPOutputStream | GZIPOutputStreamEx | Java | Stream
Comments 0 comments
in the normal GZIPOutputStream you can not et the compression level. I came across this little script tonight that allows you to set the compression level for GZIPOutputStream.
7
Date Submitted Thu. Mar. 16th, 2006 11:17 PM
Revision 1
Coder mattrmiller
Tags File | Java | Move
Comments 1 comments
Move a file quickly in java.
13
Date Submitted Mon. Mar. 20th, 2006 4:52 PM
Revision 1
Coder mattrmiller
Tags Delete | Extension | File | Folder | Java
Comments 0 comments
Deletes all files of a certain extention from a folder.
14
Date Submitted Wed. Mar. 22nd, 2006 6:10 PM
Revision 2
Beginner nev3rm0re
Tags PHP | String
Comments 1 comments
This function calculates how many lines will text occupy.
Example (simple):


$string = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus tincidunt posuere dolor";

$num_lines = how_many_lines(10, $string);

It accepts a third, optional, parameter $options, that allows you to change behaviour. $options should be array. Following configuration options are available:

'white_spaces' - default: array(' ', "\t") - array of chars, that should be treated as whitespace.

'new_lines' - default: array("\r\n", "\n") - array of strings, that should be treated as newlines. For example, for HTML you can set 'new_lines' => array('');

'force_line_breaks' - default: true - force wrapping, when the token is longer than width, or not. If set to false, and token cannot be fitted into $width, function will return false;

'callback' - default: null - callback function for determining character width. Must accept at least one parameter - $char

'callback_params' - default: array() - optional additional callback parameters

'char_widths' - default: null - associative array in a form $char => $width, which contains char width. If $char is not found in the array, it's width is defaulted to 0.

11
Date Submitted Wed. Mar. 29th, 2006 12:04 PM
Revision 1
Coder mattrmiller
Tags Delete | Directory | Java | Recursive | REMOVE
Comments 1 comments
Recursively delete a directory, emptying all contents.
7
Date Submitted Mon. Apr. 3rd, 2006 10:33 AM
Revision 1
Helper jpinkham
Tags Date | intersect | Interval | Java
Comments 1 comments
A handy class I use all the time to encapsulate the idea of whether two events coincide. For example, given a time period representing a shift, and a list of time periods representing transactions or sessions or whatever, find which ones are either totally or partially within the time period. This class make it a bit easier.
9
Date Submitted Mon. Apr. 3rd, 2006 10:41 AM
Revision 1
Helper jpinkham
Tags debug | Java | toString
Comments 1 comments
Do you find yourself implementing toString on your objects all the time, and wondering why (the debugger seems to do a pretty good job of it all by itself)...well, here's a bit of introspection applied to the problem. This is for all those quick debug sessions where you just want to do System.out.println(myComplexObject).

Instead, just do System.out.println(DebugPrint.toString(myComplexObject));
6
Date Submitted Fri. Apr. 7th, 2006 9:50 AM
Revision 1
Helper jpinkham
Tags CLASSPATH | DOS | Java
Comments 2 comments
Here's a nifty trick I often use for testing.

Lets say you have a c:\foo\lib directory full of jarfiles for log4j, javamail...whatever.

Modern J2EE containers do a nice job of letting you deploy a jarfile with your code and have a lib directory full of jarfiles like this, but what if you just want to run a quick client from the command line?

Here's what you do:
9
Date Submitted Tue. Apr. 11th, 2006 9:53 AM
Revision 2
Coder mattrmiller
Tags Java | Read | Stream | URLConnection | Write
Comments 0 comments
Reading and writing to a URL connection, thanks to Java.