TODOs collector





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

« Previous 1 2 3 4 5 6 7 8 9  ...  14 15 Next »
21
Date Submitted Fri. Nov. 11th, 2005 2:51 PM
Revision 1
Beginner Possibility
Tags Paragraph | PHP | String
Comments 0 comments
Proper Paragraphs
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.

14
Date Submitted Mon. Oct. 10th, 2005 11:05 AM
Revision 1
Coder mattrmiller
Tags HTML | PHP | String | Strip
Comments 2 comments
Strip HTML
13
Date Submitted Tue. Jul. 11th, 2006 10:34 PM
Revision 1
Coder mattrmiller
Tags Generator | Number | PHP | Random | String
Comments 2 comments
Generate a random number or string in PHP.
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.
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.
12
Date Submitted Thu. Mar. 9th, 2006 4:02 AM
Revision 1
Scripter TimYates
Tags Java | String | Word
Comments 1 comments
If you have ever written a website or java application where people paste stuff in from Word, you are likely to have hit the problem of Word using high ascii chars for "open quotes", "close quotes", reg symbol, etc...

This java class (with a single static method) can replace the most prevalent of these with normal ascii values

Hope it helps someone...
12
Date Submitted Thu. Oct. 12th, 2006 5:34 PM
Revision 1
Scripter wiz1705
Tags C | stdin | termios
Comments 0 comments
Using the Termios library, we can have the user enter a character on the keyboard, without it being displayed on the screen.
12
Date Submitted Tue. May. 9th, 2006 9:36 AM
Revision 1
Helper jpinkham
Tags Email | Java | Validate
Comments 1 comments
Another solution recommends using a text match pattern.
This works, but as long as you've got mail.jar in your classpath anyway, you might as well use this technique instead. (Plus, I think it works with older JDK 1.2+, whereas pattern.compile is 1.4+)

Note that it also accepts a comma-separated list of emails, just like a To: or CC: address line would.
12
Date Submitted Mon. Oct. 2nd, 2006 11:59 AM
Revision 1
Beginner drench
Tags escape | HTML | JavaScript | String
Comments 0 comments
Similar to Perl's CGI::escapeHTML(), though (because we can!) this adds it as a method to all String objects.
« Previous 1 2 3 4 5 6 7 8 9  ...  14 15 Next »