Author:
erics , December 10th, 2021
I use the httpful library from https://phphttpclient.com The website has not defined the Httpful\Response keys anyplace easy to find, so I have documented them here:
body
raw_body
headers
raw_headers
request
code
content_type
parent_type
charset
meta_data
is_mime_vendor_specific
is_mime_personal
Categories: How-To's , Technology Tags: Body , Code , httpful , Httpful Response , Httpful\Response , Object , php , Response
| No comments
Author:
erics , February 2nd, 2012
Inside class “yourClassA” calling “yourClassB”:
class yourClassA {
$ classObject = new yourClassB ;
$ classObject -> setClass ( $ this ) ;
}
Inside class “yourClassB” getting the call from “yourClassA”:
class yourClassB {
public function setClass ( $ object = NULL ) {
if ( is_object ( $ object ) and $ object instanceof yourClassA ) {
$ this -> RefToClassA = $ object ;
$ this -> yourVar = $ RefToClassA -> otherVar ; // etc, etc, etc...
}
}
}
Categories: How-To's , Technology Tags: Class , Classes , Function , Object , Object Oriented , OO , php , Reference , Var , Variable
| No comments
Author:
erics , January 18th, 2012
Procedure
vim / etc / yum . repos . d / 10gen.repo
yum install mongo - 10gen mongo - 10gen - server
vim / etc / mongod . conf - set dbpath variable
mkdir / volumes / data / mongo
chown mongod : mongod / volumes / data / mongo
chmod 2775 / volumes / data / mongo
chkconfig mongod on
service mongod start
pecl install mongo
/etc/yum.repos.d/10gen.repo For 64-bit:
[ 10gen ]
name = 10gen Repository
baseurl = http : //downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck = 0
For 32-bit:
[ 10gen ]
name = 10gen Repository
baseurl = http : //downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck = 0
Resource Links http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages http://www.if-not-true-then-false.com/2010/install-mongodb-on-fedora-centos-red-hat-rhel/ http://devzone.zend.com/1730/getting-started-with-mongodb-and-php/
Categories: How-To's , Technology Tags: Amazon , AWS , Database , howto , Linux , Mongo , MongoDB , Object , OOPS , Persistant Store , tips
| No comments
Author:
erics , May 15th, 2011
Coming from the Perl world, I wanted to emulate the following code in JavaScript:
my $ myHash = {
'foo' = > 'Hello' ,
'bar' = > 'World' ,
} ;
foreach my $ myKey ( keys % $ myHash ) {
print $ myKey , '=' , $ myHash -> { $ myKey } ;
}
What I found is that JavaScript uses “Objects” to contain hash-style data:
// Define the hash object on the fly
var myHash = {
foo : "Hello" ,
bar : "World"
} ;
// loop through all keys
for ( var myKey in myHash ) {
alert ( myKey + '=' + myHash [ myKey ] ) ;
}
// access a key individually
alert ( 'foo=' + Hash . foo ) ;
alert ( 'bar=' + Hash . bar ) ;
Also, one may use variables as key names by using the square-bracket notation, which evaluates variables first:
var myVar = 'test' ;
//These two lines are equivalent as long as myVar is 'test':
myHash [ myVar ] = 'theValue' ;
myHash . test = 'theValue' ;
Categories: How-To's , Technology Tags: array , Hash , Iterate , javascript , Keys , Loop , Object , perl
| No comments