April 5th, 2017 by Gia

PROCEDURE :

DROP PROCEDURE IF EXISTS `p_terbilang`;
DELIMITER ;;
CREATE PROCEDURE `p_terbilang`(IN angka bigint, OUT retval TEXT)
BEGIN 
  -- @rgiapratama - 2017
	DECLARE tmp1 TEXT;
	DECLARE tmp2 TEXT;
	
	SET max_sp_recursion_depth := 20;

	IF(angka = 0) THEN 
		SET retval = '';
  ELSEIF(angka < 12) THEN 
		SET retval = ELT(angka,'satu','dua','tiga','empat','lima','enam','tujuh','delapan','sembilan','sepuluh','sebelas');
  ELSEIF (angka < 20) THEN
		CALL p_terbilang((angka-10),tmp1);
		SET retval = CONCAT(tmp1,' belas');
  ELSEIF (angka < 100) THEN 
		CALL p_terbilang(FLOOR(angka/10),tmp1);
		CALL p_terbilang((angka%10),tmp2);
		SET retval = CONCAT(tmp1,' puluh ',tmp2);
  ELSEIf (angka < 200) THEN 
		CALL p_terbilang((angka-100),tmp1);
		SET retval = CONCAT('seratus ',tmp1);
  ELSEIF (angka < 1000) THEN
		CALL p_terbilang(FLOOR(angka/100),tmp1);
		CALL p_terbilang((angka%100),tmp2);
		SET retval = CONCAT(tmp1,' ratus ',tmp2);
  ELSEIF (angka < 2000) THEN
		CALL p_terbilang((angka-1000),tmp1);
		SET retval = CONCAT('seribu ',tmp1);
  ELSEIF (angka < 1000000) THEN
		CALL p_terbilang(FLOOR(angka/1000),tmp1);
		CALL p_terbilang((angka%1000),tmp2);
		SET retval = CONCAT(tmp1,' ribu ',tmp2);
  ELSEIF (angka < 1000000000) THEN
		CALL p_terbilang(FLOOR(angka/1000000),tmp1);
		CALL p_terbilang((angka%1000000),tmp2);
		SET retval = CONCAT(tmp1,' juta ',tmp2);
  ELSEIF (angka < 1000000000000) THEN
		CALL p_terbilang(FLOOR(angka/1000000000),tmp1);
		CALL p_terbilang((angka%1000000000),tmp2);
		SET retval = CONCAT(tmp1,' milyar ',tmp2);
  ELSE SET retval = 'GIA';
  END IF;
END
;;
DELIMITER ;

FUNCTION :

DROP FUNCTION IF EXISTS `f_terbilang`;
DELIMITER ;;
CREATE FUNCTION `f_terbilang`(angka BIGINT) RETURNS text CHARSET latin1
BEGIN
-- @rgiapratama - 2017
    DECLARE v_result TEXT;
    CALL p_terbilang(angka, v_result);
    RETURN REPLACE(v_result,'  ',' ');
END
;;
DELIMITER ;

Hasil :

mysql> SELECT f_terbilang(19048500);
+----------------------------------------------------------+
| f_terbilang(19048500)                                    |
+----------------------------------------------------------+
| sembilan belas juta empat puluh delapan ribu lima ratus  |
+----------------------------------------------------------+
1 row in set (0.07 sec)

mysql>
Tags:
Posted in Database, MySQL | Comments Off on Fungsi & Prosedur Terbilang di MySQL
November 25th, 2015 by Gia

When I upgraded my laptop from Windows 7 to Windows 10, my GSM modem (Huawei E272) not detected by system. Try this steps to solved the problem :

  1. Uninstall your existing Mobile Partner application.
  2. Download Mobile Partner (for Mac10.9&win8.1) from Huawei website (bit.ly/1jjasQF).
  3. Install that.
  4. Download DataCard Client Software to upgrade your GSM modem (bit.ly/1P8rO0M).
  5. Run that.
  6. Finish.
Tags: , , ,
Posted in Gadget, Windows | Comments Off on Huawei E272 on Windows 10
June 11th, 2015 by Gia
[[email protected] ~]$ zmcontrol -v
Release 8.6.0_GA_1153.RHEL7_64_20141215151110 RHEL7_64 FOSS edition, Patch 8.6.0_P2.
[[email protected] ~]$ /opt/zimbra/bin/zmcertmgr createcsr comm -new -keysize 2048 -subject "/C=ID/ST=Jabar/L=Bandung/O=rgiapratama/OU=IT/CN=mail.rgiapratama.net" -subjectAltNames "mail.rgiapratama.net"
[[email protected] ~]$ vi /opt/zimbra/ssl/zimbra/commercial/commercial.csr

Submit commercial.csr to Comodo, after approval process you’ll get email from Comodo with your EssentialSSL Certificate in zip file. After download, upload zip file to your mailserver and extract it.

[[email protected] ~]$ unzip mail_rgiapratama_net.zip
[[email protected] ~]$ cat AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt > ca_chain.crt
[[email protected] ~]$ /opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key mail_rgiapratama_net.crt ca_chain.crt
** Verifying /opt/zimbra/mail_rgiapratama_net.crt against /opt/zimbra/ssl/zimbra/commercial/commercial.key
Certificate (/opt/zimbra/mail_rgiapratama_net.crt) and private key (/opt/zimbra/ssl/zimbra/commercial/commercial.key) match.
Valid Certificate: /opt/zimbra/mail_rgiapratama_net.crt: OK
[[email protected] ~]$ /opt/zimbra/bin/zmcertmgr deploycrt comm mail_rgiapratama_net.crt ca_chain.crt
[[email protected] ~]$ /opt/zimbra/bin/zmcertmgr viewdeployedcrt
[[email protected] ~]$ service zimbra stop
[[email protected] ~]$ /opt/zimbra/bin/zmcertmgr addcacert /opt/zimbra/ssl/zimbra/commercial/commercial.crt
[[email protected] ~]$ service zimbra start
Posted in Zimbra | Comments Off on Comodo EssentialSSL on Zimbra 8.6
September 10th, 2014 by Gia
[[email protected] /]# vi /etc/selinux/config  ## disable selinux
[[email protected] /]# reboot
[[email protected] /]# yum remove postfix
[[email protected] /]# yum -y update
[[email protected] /]# yum -y install wget perl nmap-ncat libaio unzip perl-core sysstat net-tools
[[email protected] /]# wget http://files2.zimbra.com/downloads/8.5.0_GA/zcs-8.5.0_GA_3042.RHEL7_64.20140828204420.tgz
[[email protected] /]# wget http://files2.zimbra.com/downloads/8.5.0_GA/zcs-patch-8.5.0_GA_3043.tgz

[[email protected] /]# vi /etc/hosts     ## add this line -> 127.0.0.1 mail.rgiapratama.net mail

[[email protected] /]# tar -zxvf zcs-8.5.0_GA_3042.RHEL7_64.20140828204420.tgz 
[[email protected] /]# cd zcs-8.5.0_GA_3042.RHEL7_64.20140828204420
[[email protected] /]# ./install.sh
[[email protected] /]# cd ..

[[email protected] /]# tar -zxvf zcs-patch-8.5.0_GA_3043.tgz
[[email protected] /]# cd zcs-patch-8.5.0_GA_3043
[[email protected] /]# ./installPatch.sh
Tags: ,
Posted in centOS, Linux, Zimbra | Comments Off on Zimbra 8.5 (+patch) on CentOS 7
January 6th, 2014 by Gia
[email protected]:~# apt-get update
[email protected]:~# apt-get install git-core curl build-essential openssl libssl-dev
[email protected]:~# apt-get install daemon
[email protected]:/var/tmp# cd /var/tmp
[email protected]:/var/tmp# git clone https://github.com/joyent/node.git
[email protected]:/var/tmp/node# cd node
[email protected]:/var/tmp/node# git tag (to show all version of node)
[email protected]:/var/tmp/node# git checkout v0.10.15
[email protected]:/var/tmp/node# ./configure
[email protected]:/var/tmp/node# make
[email protected]:/var/tmp/node# make install
[email protected]:/var/tmp/node# node -v
[email protected]:/var/tmp/node# cd ..
[email protected]:/var/tmp# curl https://npmjs.org/install.sh | sudo sh
[email protected]:/var/tmp# npm -v
[email protected]:/var/tmp# npm install -g jsbin
[email protected]:/var/tmp# vi /usr/local/lib/node_modules/jsbin/config.default.json (change url:host value from localhost to IP public address)
[email protected]:/var/tmp# daemon /usr/local/bin/jsbin
Tags:
Posted in Linux, Programming, ubuntu | Comments Off on JS Bin in local computer (Ubuntu)
November 27th, 2013 by Gia
  • Access your Openfire server (ex. http://54.254.190.215:9090/)
  • Click Continue
    Openfire - 01
  • Input a domain or IP AddressOpenfire - 02
  • Click ContinueOpenfire - 03
  • Input a Database settings
    Openfire - 04
  • Click ContinueOpenfire - 05
  • Input Administrator account email and password
    Openfire - 06
  • Setup Complete !
    Openfire - 07
  • Login to Administration Console (Access your domain/IP Address using port 9090 in your browser)Openfire - 08
  • Administration Console
    Openfire - 09
Posted in centOS, Linux | Comments Off on Openfire 3.8.2 on CentOS 6.4 (64bit minimal) – 2
November 14th, 2013 by Gia
*Disabled SELinux
[[email protected] ~]# vi /etc/selinux/config
change SELINUX=enforcing to SELINUX=disabled
[[email protected] ~]# reboot (to affect SElinux config)

*Download and install Openfire
[[email protected] ~]# yum -y install wget mysql-server glibc.i686
[[email protected] ~]# wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-3.8.2
2-1.i386.rpm
[[email protected] ~]# rpm -ivh openfire-3.8.2-1.i386.rpm
Preparing...                ########################################### [100%]
   1:openfire               ########################################### [100%]
[[email protected] ~]# service openfire start
Starting openfire:
[[email protected] bin]# service openfire status
openfire is running
[[email protected] bin]# chkconfig --level 2345 openfire on

*Disabled firewall for temporary :
[[email protected] ~]# service iptables stop
iptables: Flushing firewall rules: [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]
[[email protected] ~]# chkconfig --level 2345 iptables off

*Setup MySQL
[[email protected] ~]# service mysqld start
[[email protected] ~]# mysql_secure_installation
[[email protected] ~]# mysqladmin -uroot -p
mysql> create database openfire;
Query OK, 1 row affected (0.06 sec)
mysql> grant all privileges on openfire.* to 'openfire'@'localhost' identified by 'openfirepassword';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[[email protected] ~]# chkconfig --level 2345 mysqld on

If get error like this (or Openfire can’t start) :

[[email protected] bin]# ./openfire.sh
./openfire.sh: /opt/openfire/jre/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
./openfire.sh: line 165: /opt/openfire/jre/bin/java: Success

Install a glibc.i686 using YUM

[[email protected] ~]# yum -y install glibc.i686
Tags: , , ,
Posted in centOS, Linux | Comments Off on Openfire 3.8.2 on CentOS 6.4 (64bit minimal) – 1