Author:
erics, Posted on Friday, January 27th, 2012 at 1:58:30pm
The PHP
1
2
3
4
5
6
7
8
9
| $sql = 'select * from yourTable';
$result = mysql_query($sql);
$rows = array();
while ($row = mysql_fetch_assoc($result)) {
$rows[] = $row;
}
$page = new Smarty();
$page->assign('rows', $rows);
$page->show('yourTemplate.php'); |
$sql = 'select * from yourTable';
$result = mysql_query($sql);
$rows = array();
while ($row = mysql_fetch_assoc($result)) {
$rows[] = $row;
}
$page = new Smarty();
$page->assign('rows', $rows);
$page->show('yourTemplate.php');
The Smarty Template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| {if $rows}
{section name=row loop=$rows}
{foreach from=$rows[row] key="Key" item="Value"}
{$Key}: {$Value}
{/foreach}
{/section}
{else}
<h1>NO OFFERS FOUND</h1>
{/if} |
{if $rows}
{section name=row loop=$rows}
{foreach from=$rows[row] key="Key" item="Value"}
{$Key}: {$Value}
{/foreach}
{/section}
{else}
<h1>NO OFFERS FOUND</h1>
{/if}
Categories: How-To's, Technology Tags: howto, mysql, php, select, Smarty, tips |
No comments
Author:
erics, Posted on Friday, January 20th, 2012 at 11:06:14am
Stop the instance first…YMMV:
1
2
3
4
5
| yourHost# ec2-describe-images describe-images -o amazon --filter "manifest-location=*pv-grub-hd0_1.02-i386*" --region us-east-1
IMAGE aki-805ea7e9 ec2-public-images/pv-grub-hd0_1.02-i386.gz.manifest.xml amazon available public i386 kernel instance-store paravirtual xen
yourHost# ec2-modify-instance-attribute --kernel aki-805ea7e9 --region us-east-1 i-39764XXX
kernel i-39764XXX aki-805ea7e9 |
yourHost# ec2-describe-images describe-images -o amazon --filter "manifest-location=*pv-grub-hd0_1.02-i386*" --region us-east-1
IMAGE aki-805ea7e9 ec2-public-images/pv-grub-hd0_1.02-i386.gz.manifest.xml amazon available public i386 kernel instance-store paravirtual xen
yourHost# ec2-modify-instance-attribute --kernel aki-805ea7e9 --region us-east-1 i-39764XXX
kernel i-39764XXX aki-805ea7e9
http://aws.amazon.com/amazon-linux-ami/latest-release-notes/
Categories: How-To's, Technology Tags: AMI, Amzaon, Attribute, AWS, CentOS, ec2-modify-instance-attribute, GRUB, howto, Instance, instance-attribute, Linux, pv-grub, pvgrub, release, release notes, tips, update, upgrade |
No comments
Author:
erics, Posted on Thursday, January 19th, 2012 at 11:12:55am
1
2
3
4
5
6
7
8
9
| public function valid($function = '') {
$methodVariable = array($this, $function);
if (is_callable($methodVariable)) {
return $this->{$function}();
} else {
$this->msgs[] = "Validation method $function is unavailable!";
return 0;
}
} |
public function valid($function = '') {
$methodVariable = array($this, $function);
if (is_callable($methodVariable)) {
return $this->{$function}();
} else {
$this->msgs[] = "Validation method $function is unavailable!";
return 0;
}
}
Categories: How-To's, Technology Tags: Dynamic functions, Function, howto, php, tips, Valid, Validation, Variable, Variable function |
No comments
Author:
erics, Posted on Wednesday, January 18th, 2012 at 10:28:34am
Procedure
1
2
3
4
5
6
7
8
9
| 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 |
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:
1
2
3
4
| [10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0 |
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
For 32-bit:
1
2
3
4
| [10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0 |
[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, Posted on Wednesday, January 11th, 2012 at 7:39:54pm
You must use all three lines together for it to work…YMMV:
1
2
3
| $escaped = str_replace(chr(10),'\n',$original_value);
$escaped = str_replace(chr(13),'\r',$escaped);
$escaped = preg_replace("/(\r?\n)/","\n",$escaped); |
$escaped = str_replace(chr(10),'\n',$original_value);
$escaped = str_replace(chr(13),'\r',$escaped);
$escaped = preg_replace("/(\r?\n)/","\n",$escaped);
Categories: How-To's, Technology Tags: Backslash, break, carriage return, control-m, Escape, javascript, JS, line break, Newline, php, Return |
No comments
Author:
erics, Posted on Saturday, December 31st, 2011 at 6:07:01pm

Categories: Holidays Tags: New Year's Eve, New Years |
No comments
Author:
erics, Posted on Friday, December 30th, 2011 at 12:35:12pm
1
2
3
| yum --enablerepo=epel install perl-Net-Amazon-EC2 perl-File-Slurp perl-DBI perl-DBD-MySQL perl-Net-SSLeay perl-IO-Socket-SSL perl-Time-HiRes perl-Params-Validate ca-certificates
wget -O /opt/aws/bin/ec2-consistent-snapshot http://bazaar.launchpad.net/~alestic/ec2-consistent-snapshot/trunk/download/head:/ec2consistentsnapsho-20090928015038-9m9x0fc4yoy54g4j-1/ec2-consistent-snapshot
chmod 0775 /opt/aws/bin/ec2-consistent-snapshot |
yum --enablerepo=epel install perl-Net-Amazon-EC2 perl-File-Slurp perl-DBI perl-DBD-MySQL perl-Net-SSLeay perl-IO-Socket-SSL perl-Time-HiRes perl-Params-Validate ca-certificates
wget -O /opt/aws/bin/ec2-consistent-snapshot http://bazaar.launchpad.net/~alestic/ec2-consistent-snapshot/trunk/download/head:/ec2consistentsnapsho-20090928015038-9m9x0fc4yoy54g4j-1/ec2-consistent-snapshot
chmod 0775 /opt/aws/bin/ec2-consistent-snapshot
http://alestic.com/2009/09/ec2-consistent-snapshot
http://www.thatsgeeky.com/2011/05/ec2-consistent-snapshot-on-amazons-linux-ami/
http://www.thatsgeeky.com/2011/06/rotating-ebs-snapshots-ec2-prune-snapshots/
Categories: How-To's, Technology Tags: Amazon, Amazon Linux, AWS, CentOS, chmod, consistent-snapshot, EC2, ec2-consistent-snapshot, EPEL, howto, Linux, perl, Repo, Snapshot, tips, wget, Yum |
No comments
Author:
erics, Posted on Thursday, December 29th, 2011 at 1:06:52pm
If the spam comes from an actual phone number you can report the number directly to AT&T…
- Tap and hold the body of the text message, then choose Copy.
- Create a new text message to 7726 (SPAM on the keypad).
- Paste in the spam message you just copied and send it.
Note: Sending this message won’t cost you anything, nor will the replies from AT&T.
- AT&T will send you a thank-you message and ask you to reply with the phone number of the sender.
- Type in the phone number that sent the spam in the first place and hit Send.
Original Post on CNET: http://reviews.cnet.com/8301-19512_7-20102542-233/how-to-block-text-message-spam-on-your-iphone-at-t/
Categories: How-To's, Technology Tags: AT&T, howto, iphone, SMS, Spam, Text message, tips |
No comments
Author:
erics, Posted on Saturday, December 24th, 2011 at 11:20:28am
Categories: Holidays Tags: Solstice, Yule |
No comments