Tuesday, February 16, 2016

Load Fonts From Cross-Domain

For maximum performance, we all know we must put our assets on CDN (another domain).  Along with those assets are custom web fonts.  Unfortunately custom web fonts via CDN (or any cross-domain font request) don't work in Firefox or Internet Explorer (correctly so, by spec) though they do work (incorrectly so) in Webkit-based browsers. They actually require custom CORS configurations to display properly.  Here's the code you'll need to make that happen.

If your server use apache

Add this code to your .htaccess of your cdn in top-level (root)
<FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
     <IfModule mod_headers.c>
          Header set Access-Control-Allow-Origin "*"
     </IfModule>
</FilesMatch>

Then enable mod header On your apache:
sudo a2enmod headers
sudo service apache2 restart

Setup Finish

To ensure the header is set properly, you can check using the curl utility:
curl -I http://cdn.dev/fonts/font.eot
If you see Access-Control-Allow-Origin: * in the response, you're exelent!

Good Luck !!!

Thursday, January 28, 2016

Running WhatsApp With PHP

Now you can integrated whatsApp with your website/ script. Here the tutorial:
  • Download Scripts From https://github.com/mgp25/Chat-API
  • Install Requirement 1: https://github.com/allegro/php-protobuf
  • Install Requirement 2: https://github.com/mgp25/curve25519-php
  • Install Requirement 3: sudo apt-get install sqlite php5-sqlite

After you download Requirement 1 and 2, here the installation of both:
cd to each directory, then chmod -R 777 on that directory
phpize
./configure
makesudo make install


Then Add Both Extention to Apache/Cli On PHP

echo -e "; configuration for php curve25519 module\nextension=curve25519.so"| sudo tee -a /etc/php5/apache2/conf.d/curve25519.ini

echo -e "; configuration for php curve25519 module\nextension=curve25519.so"| sudo tee -a /etc/php5/cli/conf.d/curve25519.ini

echo -e "; configuration for php protobuf module\nextension=protobuf.so"| sudo tee -a /etc/php5/apache2/conf.d/protobuf.ini

echo -e "; configuration for php protobuf module\nextension=protobuf.so"| sudo tee -a /etc/php5/cli/conf.d/protobuf.ini

sudo service restart apache2


Now You can run scripts WhatsApp From PHP

To Register New Number, Use: /Chat-API-master/examples/registerTool.php

To Try All Of Feature, Use: /Chat-API-master/examples/WA CLI Client/client.php




Good Luck !!!

Tuesday, September 15, 2015

Install Caps Lock Indicator in Ubuntu 14.04

For a laptop without LED indicators, it’s good to have an indicator applet on system tray area that displays your lock keys status. indicator-keylock is the simple tool to do that.

indicator-keylock indicates you lock keys status with applet icons and notification bubbles, see the picture:

Install Indicator-keylock:

sudo add-apt-repository ppa:tsbarnes/indicator-keylock
sudo apt-get update
sudo apt-get install indicator-keylock




Saturday, August 8, 2015

Install Telegram Purple plugin for Pidgin

Telegram Purple is a Pidgin (and other Libpurple-based messengers) plugin which adds support for Telegram. Add Telegram repo to your list:

sudo add-apt-repository ppa:nilarimogard/webupd8

Update package:

sudo apt-get update

Install Telegram pluggin:

sudo apt-get install telegram-purple

Your pidgin should have Telegram Plugin in list.


Using Telegram Purple with Pidgin





Good Luck !!!

Saturday, May 9, 2015

Touchpad Not Working On Ubuntu 12.04

  1. Install dconf-tools :
    sudo apt-get update && sudo apt-get install dconf-tools
    
  2. Open dconf Editor by pressing Alt+F2 and running dconf-editor (Or run it in a terminal.) or search for it in the Unity Dash.
  3. Go to:
    setting → org → gnome-settings-daemon → peripherals → touchpad
  4. Set the key touchpad-enabled to true.


Saturday, January 10, 2015

Using WhatsApp Throught Pidgin (New)

Add WhatsApp repo to your list

deb http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main
deb-src http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main


Update package:

sudo apt-get update

Install WhatApp pluggin:

sudo apt-get install pidgin-whatsapp

Your pidgin should have WhatsApp Plugin

Next, We use third party to get WhatApp username and password

# sudo apt-get install python python-dev python-protobuf python-dateutil python-argparse python-setuptools python-pip
# sudo pip install python-axolotl
# sudo pip install --upgrade protobuf

# wget https://github.com/tgalal/yowsup/archive/master.zip
# unzip master.zip
# cd yowsup-master
# sudo chmod +x yowsup-cli


Request code:
'cc' = Your country code without (+),  'phone' = your phone number with country code. 'mcc' and 'mnc' can found at https://en.wikipedia.org/wiki/Mobile_country_code, find your prefered provider

# ./yowsup-cli registration --mcc 510 --mnc 01  --phone 6281555666777 --cc 62 --requestcode sms

status: sent
retry_after: 3605
length: 6
method: sms


After you receive an code on your phone, Then confirm your code. Example the code is 123-456

./yowsup-cli registration --mcc 510 --mnc 01  --phone 6281555666777 --cc 62 --register 123-456

status: ok
kind: free
pw: GXGL6Xyf52JUOEvLEz3LvkOqNog=
price: Rp9500
price_expiration: 1423868871
currency: IDR
cost: 9500.00
expiration: 1452446921
login: 6281567770768
type: new


"login:" is your username. "pw:" is your password.
try to login via pidgin.


If you found error message "Server closed the connection" while trying to login, You must update your 'yowsup' to last update package, and then request password again.

Note:
To avoid crashes on the client side, make your status to "away" do not use "available"crashes occur usually on android device.

Here detail provider from Indonesia:

Friday, December 27, 2013

How To Flush (Clear) DNS Cache Under Ubuntu 12.04

To be able to flush (clear) DNS cache under Ubuntu 12.04/11.10, try one or more of these methods:

Method 1

Install first the nscd daemon with this command from the terminal:

sudo apt-get install nscd

Then clear your DNS data with this command:

Tuesday, December 17, 2013

Different include and require Statements

In PHP, you can insert the content of one PHP file into another PHP file before the server executes it.
The include and require statements are used to insert useful codes written in other files, in the flow of execution.
Include and require are identical, except upon failure:
  • require will produce a fatal error (E_COMPILE_ERROR) and stop the script
  • include will only produce a warning (E_WARNING) and the script will continue
So, if you want the execution to go on and show users the output, even if the include file is missing, use include. Otherwise, in case of FrameWork, CMS or a complex PHP application coding, always use require to include a key file to the flow of execution. This will help avoid compromising your application's security and integrity, just in-case one key file is accidentally missing.
Including files saves a lot of work. This means that you can create a standard header, footer, or menu file for all your web pages. Then, when the header needs to be updated, you can only update the header include file.

Syntax

include 'filename';

or

require 'filename';

Friday, November 15, 2013

Using WhatApp Throught Pidgin (Expired)

Add WhatApp repo to your list

deb http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main
deb-src http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main


Update package:

sudo apt-get update

Install WhatApp pluggin:

sudo apt-get install pidgin-whatsapp

Or you can download manually the WhatsApp Plugin here:

http://web.davidgf.net/nightly/whatsapp-purple/
For 32bit choose 386 folder
For 64bit choose X64 folder


Copy files with extension .so to folder:

~/.purple/plugins/

Your pidgin should have been WhatsApp

Next, We use third party to get WhatApp username and password

# apt-get install python python-dateutil python-argparse
# wget https://github.com/tgalal/yowsup/archive/master.zip
# unzip master.zip
# cd yowsup-master/src
# cp config.example yowsup-cli.config


Edit yowsup-cli.config, cc = Your country code without (+), phone = your phone number with country code, id and password leave blank.

# vim yowsup-cli.config
cc=62
phone=628578945612
id=
password=


Change permission

# sudo chmod +x yowsup-cli

Request code

# ./yowsup-cli --requestcode sms --config yowsup-cli.config
status: sent
retry_after: 3605
length: 6
method: sms


Or you can request code via website

http://whitesoft.dyndns.org:2222/whatsapp_sms

After you receive an code, Then confirm your code. 123-456 is an code

# ./yowsup-cli --register 123-456 --config yowsup-cli.config
status: ok
kind: free
pw: S1nBGCvZhb6TBQrbm2sQCfSLkXM=
price: 0,89
price_expiration: 1362803446
currency: EUR
cost: 0.89
expiration: 1391344106
login: 628578945612
type: new


"login:" is your username. "pw:" is your password.
try to login via pidgin.

Note:
To avoid crashes on the client side, make your status to "away" do not use "available"crashes occur usually on android device.

Adding extra Repositories on Ubuntu

sudo vim  /etc/apt/sources.list

add your repo to new line

Example of repo:

deb http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main
deb-src http://ppa.launchpad.net/whatsapp-purple/ppa/ubuntu quantal main


Once you are done adding the repositories, you’ll need to run this command:

sudo apt-get update

Thursday, November 14, 2013

Running DBus in Crontab

Just create an sh file to execute your script. example chat.sh. See below:

#!/bin/bash
xhost +
export DBUS_SESSION_BUS_ADDRESS=$(cat /home/iben/.dbus/session-bus/f49d2a1187871a80e2a3bb640000000a-0|grep unix|cut -d= -f2-4)

ps -ef | grep -v grep | grep chat.php
# if not found - equals to 1, start it
if [ $? -eq 1 ]
then
/usr/bin/php /home/iben/www/tes/dbus/chat.php&
else
echo "eq 0 - chat.php found - do nothing"
fi
Note:
xhost + is required

export DBUS_SESSION_BUS_ADDRESS=$(cat /home/iben/.dbus/session-bus/f49d2a1187871a80e2a3bb640000000a-0|grep unix|cut -d= -f2-4) ==> is required to inform cron of session location.

f49d2a1187871a80e2a3bb640000000a-0 ==> is a long name that is different with your. Usually have pattern like *a-0, a file in directory /home/username/dbus/sessiom-bus/*a-0. Find your.

Sintax after it is your own script. Here I use script to check existing process. if not exist then run the php script. Else don't do anything.

chat.php is a script that use DBus class.

Simply add to cron like this:
* * * * * sh /home/iben/www/tes/dbus/chat.sh > /home/iben/www/tes/dbus/chat.log

It will check process every minute. It better than use 'php flock'.

Wednesday, November 13, 2013

How To :: Install PECL on Ubuntu

Hw To :: Install PECL on Ubuntu

sudo apt-get php-pear php5-dev
sudo pear install PEAR

How To :: Install DBus for PHP on Ubuntu

First you need to install pkg-config package.sudo apt-get install pkg-configNow you need to install DBus package. This will manage all background actions needed by the PHP extension.sudo apt-get install dbus libdbus-1-dev libxml2-devNow we can install the PECL DBus extensionsudo pecl install DBus* if you do not have PECL installed click here * if you get an error like "Failed to download pecl/Dbus within preferred state stable, latest release is version 0.1.1, stability 'beta', use ..... install failed" you need to install the version it says it's the last. For example :sudo pecl install DBus-0.1.1add the extension to PHPecho -e "; configuration for php DBus module\nextension=dbus.so"| sudo tee -a /etc/php5/conf.d/dbus.ini
Note:
If you update your PHP VERSION or find error like this :
PHP Warning:  PHP Startup: dbus: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525

Or you find error like this :
Can not load dinamic library... blablablabla

You can resolve with this:
sudo pecl install -f DBus

Friday, October 25, 2013

Make VIM as default editor in terminal

  • cd (cd to your home directory)
  • vim .bashrc (Edit bashrc file)
  • add this export EDITOR=vim to bottom of lines
  • This will affected to new terminal

Monday, September 2, 2013

Backup and Restore Tomboy Notes

Backup
Copy tomboy file at here: /.local/share/tomboy to your backup directory

Restore
Just Copy the backup file to directory :  /.local/share/tomboy . Then chmod your file into 775.

Friday, July 26, 2013

Import and Export Database via terminal

IMPORT

  • mysql -u root -pasdf dbname < db.sql (import .sql ke database bisa berupa per-table atau)
  • gunzip < db.sql.gz | mysql -u root -pasdf dbname (import .gz file ke database. ukuran lebih kecil)

EXPORT

  • mysqldump -u root -pasdf --extended-insert --add-drop-table dbname > dbname.sql (export ke .sql)
  • mysqldump -u root -pasdf --extended-insert --add-drop-table dbname | gzip > dbname.sql.gz (export ke .gz)
  • mysqldump -u root -pasdf --extended-insert --add-drop-table dbname tablename | gzip > tablename.sql.gz (export tabel ke .gz)

Install Nginx ubuntu

Nginx sebagai pengganti Apache2 dengan keamanan lebih tinggi.
  • sudo apt-get install python-software-properties
  • sudo add-apt-repository ppa:nginx/stable
  • sudo apt-get update
  • sudo apt-get install nginx

Install PHP 5.4 dan Plugin untuk NGinx

Agar NGinx bisa berjalan dengan normal pada symfony maka harus diinstall php5 beserta pluginnya:

  • sudo add-apt-repository ppa:ondrej/php5-oldstable
  • sudo apt-get update
  • sudo apt-cache showpkg php5
  • sudo apt-get install php5 php5-common php5-cgi php5-cli php5-curl php-pear php5-fpm php5-gd php5-mysql php-apc php5-

Wednesday, July 24, 2013

Sublime Text 2 Installation Guide:

1. Install Sublime Text 2

Open terminal
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

[Resolve] Partition Not Detected While Ubuntu Installation

This is a simple method to solve your problem about your problem (Partition Not Detected While Ubuntu Installation):

  1. Run ubuntu with live usb
  2. Open terminal
  3. Be sure your PC is connected to internet.
  4. Install gdisk: sudo apt-get install gdisk
  5. After it installed use this command : fixparts /dev/sda (replace sda with ur harddrive letter)
  6. Then press "p"  (to print the partition)
  7. Then press "s" ( to sort the partition table)
  8. Then press "p" again (to make sure nothing bad happended)
  9. Then press "w" (to write changes)
  10. Then press "y" (to accept. Don't worry this is just change partition table, your data is not affected)
  11. Then reboot your PC
  12. Finish. Try again to install your ubuntu.