Author Archives: Raymond

About Raymond

I'm a Christian web developer from the Philippines. Sometimes I write also.

Bash: getting confirmation to continue or exit

  #!/bin/bash while true do read -r -p ‘Are you sure? ‘ choice case “$choice” in y|Y) echo “Processing…” break ;; n|N) echo “Canceled.” exit ;; esac done echo “Complete.”

Posted in Linux | Tagged | Leave a comment

Currency Internationalization (i18n), Multiple Currencies and Foreign Exchange (FX)

Currency Internationalization (i18n), Multiple Currencies and Foreign Exchange (FX)

Posted in web | Tagged | Leave a comment

Multibyte PHP Functions

Source: Using Multi-Byte Character Sets in PHP (Unicode, UTF-8, etc) The following list details the PHP string functions which could cause problems when handling multi-byte strings. The multi-byte safe alternative is given when available: mail() Try mb_send_mail() instead. strlen() Try mb_strlen() instead. strpos() Try mb_strpos() instead. … Continue reading

Posted in PHP | Tagged , , | Leave a comment

Force secure browsing https

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} dir RewriteRule ^(.*)$ https://www.example.com/dir/$1 [R,L]

Posted in Uncategorized | Tagged , | Leave a comment

Vim: set Caps Lock as Ctrl, set Pause as Caps Lock, let Esc be Esc

raymond@ubuntu:~$ cat .Xmodmap remove Lock = Caps_Lock remove Control = Control_L keysym Caps_Lock = Control_L keysym Pause = Caps_Lock add Lock = Caps_Lock add Control = Control_L

Posted in Linux | Tagged , , , | Leave a comment

PHP i18n using gettext

Localizing PHP web sites using gettext Setup i18n gettext in your PHP application Benchmarking PHP Localization – Is gettext fast enough?

Posted in Useful links | Tagged , | Leave a comment

Inserting a troublesome string from PHP to Javascript

<script type=”text/javascript”> alert(“<?php echo preg_replace(“/\r?\n/”, “\\n”, addslashes($message)); ?>”); </script>  Passing variables to Javascript

Posted in PHP | Tagged | Leave a comment

Javascript Show Caller Function

arguments.callee.caller.toString()

Posted in Programming | Tagged | Leave a comment

I Thank You Lord

I thank you Lord for all your blessings to me I thank you Lord for all the trials that comes my way I thank you Lord for all the strength when my weakness puts me down I thank you Lord … Continue reading

Posted in Inspirational, Poetry, Worship | Tagged | Leave a comment

How to get next MySQL insert id

function getMysqlInsertID($tablename) { $next_increment = 0; $qShowStatus = “SHOW TABLE STATUS LIKE ‘$tablename’”; $qShowStatusResult = mysql_query($qShowStatus) or die ( “Query failed: ” . mysql_error() . “<br/>” . $qShowStatus ); $row = mysql_fetch_assoc($qShowStatusResult); $next_increment = $row['Auto_increment']; return $next_increment; }

Posted in MySQL, PHP | Tagged , | Leave a comment