String.removeCharAt





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

« Previous 1 2 3 4 5 6 7 8 9  ...  14 15 Next »
5
Date Submitted Sat. Jun. 16th, 2007 6:07 AM
Revision 1
Scripter Fordiman
Tags Class | HTML | JavaScript
Comments 1 comments
Simple set of functions for capturing and manipulating the className member of an HTMLElement
5
Date Submitted Thu. Sep. 27th, 2007 8:02 AM
Revision 1
Scripter Fordiman
Tags JavaScript | PHP | Prototype | serialize
Comments 2 comments
This is the final version of my Javascript serializer targetted at PHP.

The point:
Objects are most easily passed over the network as serialized strings. Between serialization and unserialization, serialization is by far the easier of the two. Since object passing can sometimes be a process-hungry thing, we want to do things as quickly as possible.

My solution is to always do the hard part in compiled code, while doing the easy part in script. That is, whichever way you're passing an Object, you want to pass it in a natively decoded format for the target.

Since I work mostly in PHP, this meant writing a module that would be able to generate a string that can be decoded with PHP's unserialize() function into a PHP Associative Array (or other applicable type).

Notes:
This lib REQUIRES the Prototype lib. You can hack prototype out of it, of course (by replacing the references to Object.extend() with explicit assignments), but I can't imagine why you'd want to bother; it's used mostly with Ajax.Request anyway.

Previous versions of this code would add the .toPHP() member to the Object prototype. After trying to enumerate things, I found that this is a REALLY bad thing to do, as toPHP springs up where it's not wanted in ALL objects. As a result, I've opted to go the Prototype route and apply it as a member of the Object object.

Please note that if you pass a serialized string to PHP via GET or POST, you'll need to stripslashes() before unserialization.



Javascript sample of use:

var myObject = {
name:'value',
test:['Array','of','strings'],
bool:false,
timestamp: new Date(),
float: 3.1415926539,
number: 42,
func: function () {
alert('Member functions are always omitted from serialization');
}
}
alert(Object.toPHP(myObject));

Output:
a:7:{s:4:"name";s:5:"value";s:4:"test";a:3:{i:0;s:5:"Array";i:1;s:2:"of";i:2;s:7:"strings";}s:4:"bool";b:0;s:9:"timestamp";i:1190897619824;s:5:"float";d:3.1415926539;s:6:"number";i:42;s:4:"func";null}


Sample of subsequent unserialization in PHP (passed via POST as 'myobject')

$myObject=unserialize(stripslashes($_POST['myobject']));
var_dump($myObject);

Output:
array(7) {
["name"]=>
string(5) "value"
["test"]=>
array(3) {
[0]=>
string(5) "Array"
[1]=>
string(2) "of"
[2]=>
string(7) "strings"
}
["bool"]=>
bool(false)
["timestamp"]=>
int(1192296601)
["float"]=>
float(3.1415926539)
["number"]=>
int(42)
["func"]=>
NULL
}
5
Date Submitted Mon. Dec. 24th, 2007 2:34 AM
Revision 1
Scripter Fordiman
Tags "data hidng" | Class | JavaScript | Prototype
Comments 3 comments
Ok, so I was getting frustrated with the inability to hide data in javascript, as well as a number of other concerns with existing class structures (the requirement to use this.constructor in lieu of self, for example).

As a result, I've thrown together a nice little class constructor that accepts a class definition, as well as a class extender that allows you to build a new class from an existing one, with full access to all that private stuff.
5
Date Submitted Wed. Oct. 11th, 2006 7:58 AM
Revision 1
Scripter ctiggerf
Tags PHP | String
Comments 3 comments
Two very usefull functions to have around.

(note: dollarfy requires commify to work)
5
Date Submitted Mon. Oct. 30th, 2006 1:03 AM
Revision 1
Scripter SCoon
Tags C | CPlusPlus | Java | Ruby | String
Comments 3 comments
This class intended to collect TODO comments from java/c++/etc source files.

Example:

protected readFileData (String path) throws IOException {
// TODO: add try...catch block for IOException
InputStream is = new FileInputStream(path);
...
}


See also DirectoryScanner class.
5
Date Submitted Thu. Nov. 29th, 2007 12:46 PM
Revision 1
Helper HRCerqueira
Tags images | JavaScript | sl
Comments 0 comments
This is a simple fade in / fade out javascript slideshow, search engine friendly with low resource usage.

More info here.

Cheers
5
Date Submitted Fri. Oct. 14th, 2005 4:49 PM
Revision 1
Helper lilleman
Tags PHP | Random | String
Comments 1 comments
Random String Generato
5
Date Submitted Thu. Nov. 3rd, 2005 7:10 PM
Revision 1
Helper ses5909
Tags "SQL Server" | Portion | SQL | String
Comments 0 comments
Return a Portion of a Character String
5
Date Submitted Mon. Oct. 22nd, 2007 8:43 AM
Revision 1
Beginner richard123
Tags JavaScript | PHP | resolution
Comments 3 comments
This detects screen resolution using javascript and makes it available to php by way of cookies.
5
Date Submitted Tue. Sep. 5th, 2006 8:05 PM
Revision 1
Beginner MovingParts
Tags FileStream | StreamReader | String | String.Split | VB
Comments 0 comments
One of best and unknown built in string function included in .NET is String.Split(). It has come in quite handy for my in the last 2 years that I thought I'd share. Pretty basic example here...and for my first post, I thought I'd throw in a little File IO (for free of course)! This was written in .NET 2.0 and it will take little to no modification to make it work in 1.0/1.1.
« Previous 1 2 3 4 5 6 7 8 9  ...  14 15 Next »