Friday, January 14, 2011

Facebook-like chat part 2

This is my old blog. You can find the updated version of the Facebook-like chat HERE

It's been a while since my first attempt at creating a facebook-style chat. Unfortunately, the original server where it was hosted was formatted, thus making some disgruntled posters( Sorry guys, I really just didn't have time. But to make up with this, I've made another one. I used codeigniter as the php framework and jquery for javascript.

Big thanks to this post also. It saved me time on creating a bottom menu ala-Facebook.

Here's the demo: Thanks to Jonee of PHPUGPH for hosting the demo.

To test:
login using different usernames on different browsers or different PCs

Download it here:

You may also checkout(SVN) the files here:

Installation instructions:
1. extract to your http folder
2. edit system/application/config/database.php
3. change database parameters as pecified in these config variables:

$db['default']['hostname'] = "";
$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = "";

4. edit system/application/config/config.php
5. change values in the following variables/constants:

$config['base_url'] = "http://yourwebsite/";
define('MAINSITE_URL', 'http://yourwebsite/');
//you may use .htaccess to remove index.php
define('MAINSITE_INDEX', 'http://yourwebsite/index.php/');

6. create the database by uploading the sql dump file under the sql folder
7. to create a new user, run the following query

//password is password with username as its salt, encryption uses Secure Hash Algorithm
INSERT INTO `facebookchat`.`users` (`username`, `password`, `session_id`, `created_date`, `modified_date`) VALUES ('test', SHA1('testtest'), '', CURRENT_TIMESTAMP, '0000-00-00 00:00:00');

8. have fun !

Feel free to suggest any improvements on this application guys!

Sunday, October 10, 2010

Automated Mysql Backup

I've created a routine backup shell script that dumps the database on an sql file. Hope this would be helpful. ;)



# Database Backup
# exports a compressed dump sql file
# author: Ryan Icasiano
# date: 07-19-2010
# Disclaimer: By downloading this script, you agree that the author is not liable for any unintended damage to your database/application
# you may run this manually or via scheduled task in cron

# initalize
datetoday=`date +"%Y%m%d"`
daytoday=`date +"%d"`
# adjust if you wish...
daysago=`date +"%Y%m%d" --date="20 days ago"`

# get current date
echo "["`date +"%Y-%m-%d %H:%M:%S"`"] "
#directory check
if [ ! -d $savedir ] ; then
mkdir $savedir
if [ ! -d $savedir"monthly" ] ; then
mkdir $savedir"monthly"
if [ ! -d $savedir"log" ] ; then
mkdir $savedir"log"

#create dump for today
if [ ! -f $newdatabase ] ; then
echo `time_log`"Dumping new data for today." >> $logfile
mysqldump -u$dbuser -p$dbpassword -h $dbhost $dbname | gzip > $newdatabase
#monthly archiving
if [ $daytoday = "01" ] ; then
echo `time_log`"Creating backup archive for this month." >> $logfile
mysqldump -u$dbuser -p$dbpassword -h $dbhost $dbname | gzip > $newmonthlydatabase
#delete old dumps
if [ -f $olddatabase ] ; then
echo `time_log`"Deleting old dump file("$daysago")." >> $logfile
rm -f $olddatabase
echo `time_log`"Routine backup has finished." >> $logfile

Wednesday, October 28, 2009

facebook-like chat

Note: This is an old post. If you're looking for the updated version, you may go here:

I really wanted to have a facebook-like chat. Unfortunately, I couldn't find one so i made one. Not as fancy as the one in facebook, but this is as close as i could get, functionality-wise...

The problem is i haven't tested its performance on heavy traffic...

I didn't include the avatar feature cause i guess it is trivial once you get the user's id in the chat(to tell you the truth, i just got lazy =P).

here's the link to the demo:

to download:

let me know your thoughts...


Friday, October 23, 2009

Anak ka nang....

Dear Anak,
Naipadala ko na 50 thousand pesos na
tuition fee mo,
pinagbili na namin ang mga kalabaw
Ang mahal pala ng kursong COUNTER

Wala na din pala tayong baboy naibenta
na din
para dun sa sinasabi mo na project nyo
na NOKIA N75,
ang mahal naman ng project nayun.

Kasama din ang 7 thousand dun para sa
field trip nyo sa MALL OF ASIA,
akoy nagaalala baga anak
malayo ba yun mag ingat ka sa
pagbibiyahe mo,

Isasanla pala namin ang palayan natin
para mabili mo
na yung instrumentong I-POD na
kinakailangan mo sa laboratory nyo.
kelan mo ba talaga kelangan yaun

Anak komportable kaba jan sa boarding
house mo
saan ba kamu yan sa VICTORIA COURT
maganda ba dyan di ba mainit jan.
Siguro ay namimiss mo na ang hangin
dito sa bukid

Anak kumusta na pala yung group project
nyo na SAN MIG LIGHT napailaw nyo na
ba? mataas ba nakuha nyo na grado dun.
Anak sana bago pa maubos ang lahat
lahat ng arian natin ay maka gradweyt
walong taon ba talaga ang kurso mo sa
sana paggraweyt mo makakuha ka ng
trabaho kaagad
kagaya ng manager ng kumpanya
para mabawi natin ang mga ari arian
natin sa sanglaan.

ay cya nga pala anak diba
sabi mo sa JOLLIBEE / MAK DONALD ka
palagi kumakain
ok ba naman sayo ang mga ulam dyan
baka hindi masarap kawawa ka naman.
Masarap lagi ang ulam namin ang
paborito mong tuyo at gulay na

Eh yung school bus nyo na TAXI sabihin
mo sa driver mag ingat cya sa pag dri-

Anak hanggang dito na laang at sa
susunod ay ipapadala ko sayo ang pera
na pambili mo ng ALTIS na gagamitin mo

Ang nagmamahal

Itang at Inang
P.S. Anak mag aral kang mabuti.

Thursday, October 22, 2009

Request for Birth, Marriage or Death Certificate Online

I just found out recently the most convenient way to get the Birth, Marriage or Death Certificates in NSO. Simply go to this site and select which document you want to apply. I applied for Birth Certificate online and it costed me at around P315.00. After I have applied online, a request number will be generated. This will be your invoice number/order number, which you will present to the payment centers. I got mine and went to UnionBank, paid the fee and crossed my fingers. Payment centers are Mail & more outlets(not inside SM Buildings, you'll see why), online banking facilities using UnionBank and BDO, and over-the-counter payments in UnionBank and BDO(now you see why...).

To me, it's a steal, as I have computed how much would it cost me if I would go there:

From Paranaque - NSO Office: P50.00
Bottled Water: P15.00
Wait, I forgot my pen P15.00
Apply for Certificate Maybe around P150.00
Lunch Time! P80.00
C2: P24.00
From NSO Office and back: P50.00
Time: 1 hr = .25 ounces of Gold

The advantage i could only see is if you needed the document real bad, but then again, there is no assurance that you will have your certificate on that very same day.

They will deliver it through your doorstep around 6-10 working days after the date of payment. One of their most useful features is the request status. You won't have to call them to follow up the status of the document being applied. To see your document status, have your request number ready, and on their navigation page, go to Request >>> Request Status. Just make sure that you will provide the exact details when filling up the information, otherwise you just wasted 300 bucks on it.

Verify Request Status Link

Now, if SSS, BIR, NBI, Pag-IBIG, Philhealth and other government agencies have this kind of process... hmmm... when would that be...