Author Archives: ronaldpringadi

Adding New VirtualHost in Apache2

On linux Ubuntu 1. If your apache has /etc/apache2/sites-available directory then just create a new file “dev.newwebsite.com.conf” with the following content: 12345678910111213<VirtualHost *:80>     ServerName dev.newwebsite.com     DocumentRoot "/var/www/www.newwebsite.com"     # Error handlers     ErrorDocument 500 … Continue reading

Posted in Operating System, PHP, Ubuntu | Comments Off on Adding New VirtualHost in Apache2

Memcache test connection script

12345678910111213<?php error_reporting(E_ALL); $memcache = new Memcache; // Connect to memcached server $memcache->connect(’127.0.0.1′, 11211) or die ("Could not connect"); // Add it to memcached server // The parameters are: KEY, VALUE, USE COMPRESSION, EXPIRY IN SECONDS $memcache->set(’MyKey1′, ‘The value of My … Continue reading

Posted in PHP, Web Development | Comments Off on Memcache test connection script

Redis connection test script

1234567891011121314151617181920212223242526<?php require "../predis/autoload.php";  // Update with your location to predis Predis\Autoloader::register(); try {     $redis = new Predis\Client();     // Uncomment the following lines and adjust them accordingly if you have a non-default redis configuration /*     … Continue reading

Posted in PHP, Web Development | Comments Off on Redis connection test script

SVN Tricks in Linux

To show colorized svn diff 1sudo aptitude install colordiff Then on your home directory there is a hidden file called .bashrc. Edit it. 1vim ~/.bashrc Append the following code at the end of the file 1234svndiff() {   svn diff … Continue reading

Posted in Linux, Operating System, Version Control | Comments Off on SVN Tricks in Linux

Introduction to Logging and Tracing in PHP

If you still tracing variable in php using print_r() or var_dump() then you’ll see them directly in the screen or the web page that you’re working on. This is easy to see, but also prone to problems: What if visitors … Continue reading

Posted in PHP, Web Development | Comments Off on Introduction to Logging and Tracing in PHP

Robocopy – Automate Your Windows Copy

I backup my files regularly using the Windows scheduler. For example, several folders from my Windows preferences folder on drive C (C:\Users\dellxps\AppData\Roaming) to another drive, D:\Users\Ronald\AppData\Roaming. There is a built-in smart copier in Windows that not many people know about, … Continue reading

Posted in DOS, Operating System | Comments Off on Robocopy – Automate Your Windows Copy

Displaying Linux Distro Version and Showing 32Bit or 64Bit OS

Checking whether you have 32bit linux or 64bit linux. From the code below we can see that it is a 64 bit linux. 12[user1@ubuntu 17:14:37 ~/dev]$ uname -mrs Linux 3.2.0-30-generic x86_64 Checking which distro you’re using: 123456[user1@ubuntu 17:14:48 ~/dev]$ lsb_release … Continue reading

Posted in Linux, Operating System | Comments Off on Displaying Linux Distro Version and Showing 32Bit or 64Bit OS

Find and Replace File Content using Linux Command Line

1find . -name "*.pgsql" -print | xargs sed -i ‘s/STRINGTOREPLACE/REPLACERSTRING/g’

Posted in Linux, Operating System | Comments Off on Find and Replace File Content using Linux Command Line

How To List All Users or Groups in Linux

To list all users in Linux: 1cat /etc/passwd See only the first word before double colon (:) for exampple, user “root” will look like: root:x:0:0:root:/root:/bin/bash And to list all groups do the following 1cat /etc/group

Posted in Linux, Operating System | Comments Off on How To List All Users or Groups in Linux

How Big is The Big Apple?

Do you know how much bigger is Apple compared to the other big companies in the US? http://www.greenandredmarket.com/menu/biggestcompanies.htm And scroll to the lower part of the page. I’m not an apple fan boy but I can see that our society … Continue reading

Posted in Investment, Stock Market | Comments Off on How Big is The Big Apple?