OS

Solve Windows 8 Disk 100%

7 Sep , 2014  

After using Windows 8 for nearly 9 months, i realized Disk 100% usage for very long time was unusual. Here is solution to solve this issue.

1. Press Windows + R and type “services.msc”

Services.msc

2. Disable BITS

Right click on BITS and select “Properties”:

Capture

Disable it by :

Capture

Reboot and you can see that disk usage back to normal!

,

OS

Solve .gitignore not ignoring .classpath & project.properties in Windows

23 Aug , 2013  

I have this small problems when Git not obeying .gitignore in Windows. It’s keep adding .classpath and project.properties.

To solve this problem:

1
git update-index --assume-unchanged <file>

OS

Mysql drop all databases

13 Aug , 2013  

Here is a quick mysql script to drop all databases except test and information schema :

Go to mysql command-line and execute this :

1
select group_concat(concat('drop database `',SCHEMA_NAME,'`;') SEPARATOR ' ' ) from information_schema.schemata where SCHEMA_NAME !='mysql' and SCHEMA_NAME !='information_schema';

,

OS

Solve Java Application killed / closed in Ubuntu 13.04 Raring

13 Aug , 2013  

After update Ubuntu 13.04 Raring, suddenly all Java based application like LibreOffice, Aptana, Eclipse, Netbeans get killed / closed without any-reason.

To solve this :

1
sudo apt-get remove libwebkitgtk-1.0-0

Kudos to :
http://daddycat.blogspot.com/2013/05/when-eclipse-is-killed-after-ubuntu.html

OS

Solve php fpm upstream sent too big header while reading response header from upstream

22 Jul , 2013  

When your php5-fpm and NGINX got this errors:

1
2013/07/22 09:55:20 [error] 10446#0: *5 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: www.yodi.biz, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.yodi.biz"

That’s meaning you need to resize your fastcgi buffers in our nginx.conf. In Ubuntu or Debian it’s located at /etc/nginx/nginx.conf.

1
2
3
4
5
http {
        ....
        fastcgi_buffers 8 16k;
        fastcgi_buffer_size 32k;
         ...

Restart your NGINX service and the problems should be gone.

,

OS

Solve Thunderbird 100% CPU on Ubuntu 13.04

15 Jul , 2013  

I hate when Thunderbird consume 100% CPU usage when I launch it. There is some simple trick to reduce that become 20-30% by disabled Status Bar.

OS

Solve Nvidia on Lenovo z500

14 Jul , 2013  

This is quickfix how to get rid of errors : “You are not currently using a display attached to an Nvidia GPU”. Make sure you already install the latest Nvidia Driver (use updates) from Nvidia (not Lenovo).

Then, checkout on Bios settings for graphics to use “switchable mode”. If everything is fine, now first step we should do is uninstalling Intel4000 VGA driver.

1
Window Key + X -> Device Manager -> Display Adapters -> Uninstall Intel

Then reboot. After we re-logged, then try open Nvidia Control Panel in systray. If the errors still occurs, re-install your Nvidia drivers. That’s will solved the problem.

Later, we realize that brightness doesnt works here. All we need just go to regedit. (Window Key + R) and type “regedit”. find key “EnableBrightnessControl” inside “HKEY_LOCAL_MACHINE/SYSTEM/”. Also, install Intel4000 driver to make it’s works. Reboot to see the results

, ,

OS

Ubuntu 13.04 Raring installation on Macbook Pro 7.1

13 Jul , 2013  

For the very first time, i’m very happy that Macbook Pro can works 100% on Linux (Ubuntu 13.04). I used to use Fedora 18 & 19, but there is problem in VGA (Nvidia 320M) installation. Also the driver nouveau can’t works well and gave bad influence in game development with OpenGL.

But today, Nvidia 320M works fine, no overheat, low heat, fast OS and yes, it’s Ubuntu 13.04. Let me start with first installation.

1. Ubuntu Installation dual-boot with Mac OS X Mountain Lion
We just need to choose format disk manually. Now here is kind partitions that we need :

1
2
3
1. Bios reserve (50MB)
2. /boot (200MB)
3. / and /home

After installation, we just need to hold “options” when your mac just started (hear that start sound? hold option now!)

2. Configuration Broadcom Wireless and Nvidia
Nothing specials here, just go to software update -> additional. We just need to install Linux STA Drivers and Nvidia-310 (proprietary and tested)

Use color and macbook pro display ICC to calibrate display monitor. Just select calibrate / add profile, choose display.

3. Overall installation
Follow this Ubuntu official for the rest installation : https://help.ubuntu.com/community/MacBookPro7-1/Quantal. It’s also works with Raring 13.04.
More…

OS

Outlook Custom Domain IMAP / POP3 Configuration

12 Jul , 2013  

Here is a quick configuration IMAP and POP3 for Outlook custom domain email.

Incoming Settings

1
2
3
4
5
Username: username@domain.com
Password: password
Port: 995
Security: Enable SSL
Server: pop3.live.com

Outgoing Settings

1
2
3
4
5
Username: username@domain.com
Password: password
Server: smtp.live.com
Port: 587
Security: Enable TLS

Done!

OS

Solve Skype libQtWebKit.so.4 problem

20 Jun , 2013  

When install Skype 4 on Fedora 18, I got errors :

1
2
error: Failed dependencies:
        libQtWebKit.so.4 is needed by skype-4.1.0.20-fc16.i586

To solve this problem, I just need to install:

1
sudo yum install qtwebkit.i686

,

OS

Install Fedora 18 Medialess Macbook Pro Mountain Lion

20 Jun , 2013  

Fedora 18 can’t be installed via CD / DVD or USB boot if you’re Mac OS X is mountain lion. Luckly, we still can use medialess. If you don’t have Fedora or Linux installed, you can start with Fedora 17 boot CD which it’s works perfectly (you need to install this first).

Using medialess meaning, we already have DVD / CD ISO. For instance, I have “fedora.iso” in /home/. Using ‘df -hT’, I know that my “/home” pointed into “/dev/sda8”. This can be vary depend on where you put the ISO. Then, we need to mount the ISO (in this example, I have fedora.iso in /home) :

1
mount -o loop /home/fedora.iso /tmp/mnt

More…

,

OS

Development Debian Wheezy on Amazon EC2

19 Jun , 2013  

Here is complete guide to setup debian wheezy server in Amazon EC2. Remember to login using “admin” user, since “root” is not allowed by default.

1. Install software
Add backports on “/etc/apt/sources.list :

1
deb http://ftp.debian.org/debian/ wheezy-backports main
1
2
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install nmap vim bind9 mysql-server mysql-client apache2  php5 php-pear php5-mysql python-software-properties python g++ make python-dev nginx php5-common phpmyadmin apache2 zip unzip unrar-free imagemagick rsync python-pip dnsutils libxml2 libxml2-dev libxslt1-dev libbz2-dev libssl-dev p7zip-full unzip unace unp bzip2 gzip patch htop rsync php5 php5-fpm php-pear php5-common php5-mcrypt php5-mysql php5-cli php5-gd python-mysqldb libapache2-mod-wsgi haproxy libmysqlclient-dev redis-server git

2. Enabled haproxy
by edit “/etc/default/haproxy” and “ENABLED = 1”

Example haproxy configuration :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

frontend public
    bind *:80
    option forwardfor       except 127.0.0.0/8
    default_backend nginx

    acl is_pongmobnode_backend hdr_end(host) -i socket.pongmob.com
    use_backend pongmobnode_frontend if is_pongmobnode_backend
   
#nginx
backend nginx
    option forwardfor       except 127.0.0.0/8
    balance roundrobin
    server nginx 127.0.0.1:87 weight 8 maxconn 1024 check  

backend pongmobnode_frontend
    timeout server 8000s
    timeout connect 10s
    server server1 127.0.0.1:4005 weight 1 maxconn 1024 check

3. PHP FPM
Change PHP5-FPM listen into socket in “/etc/php5/fpm/pool.d/www.conf”:

1
listen = /var/run/php5-fpm.sock

4. Install NodeJS

1
2
3
4
5
6
sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev checkinstall
mkdir ~/src && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v*
 ./configure --openssl-libpath=/usr/lib/ssl
checkinstall #(remove the "v" in front of the version number in the dialog)

5. Install Django Development

1
2
sudo pip install virtualenv
sudo pip install virtualenvwrapper

Now, we need to add this into “~/.bash_profile” :

1
2
3
4
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME # Tell pip to create its virtualenvs in $WORKON_HOME.
export PIP_RESPECT_VIRTUALENV=true # Tell pip to automatically use the currently active virtualenv

Then, we are ready to create new virtualenv :

1
mkvirtualenv --no-site-packages --distribute django

Here is example NGINX configuration for Django

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
server {
    listen 82;
    server_name pongmob.com;
    rewrite ^ http://www.pongmob.com$request_uri? permanent;
}

server {
    listen 82;
    server_name www.pongmob.com;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    root /var/yodi/pongmob;

    client_body_timeout  460;
    client_header_timeout 460;
    send_timeout 460;
    client_max_body_size 10m;
    keepalive_timeout 300;

    index  index.php index.html index.htm;

    # Check if a file exists at /var/www/domain/ for the incoming request.
    # If it doesn't proxy to Apache/Django.
    try_files $uri @django;
       
    # Setup named location for Django requests and handle proxy details
    location @django {
            proxy_pass         http://localhost:8010;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }

}

And this is for Apache

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<VirtualHost *:8010>
    ServerName pongmob.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/yodi/pongmob

    WSGIScriptAlias / /var/yodi/pongmob/mobilegame/wsgi.py

    <Directory /var/yodi/pongmob/>
        <Files wsgi.py>
        Order deny,allow
        Allow from all
        </Files>
    </Directory>

    # Django settings
    WSGIDaemonProcess pongmob user=www-data group=www-data processes=1 threads=10 python-path=/root/.virtualenvs/django/lib/python2.7/site-packages/
    WSGIProcessGroup pongmob

    # Non-Django directories
    Alias /static/ /var/yodi/pongmob/static/
    Alias /media/ /var/yodi/pongmob/media/

    <Directory /var/yodi/pongmob/static/>
        Allow from all
    </Directory>

    <Directory /var/yodi/pongmob/media/>
        Order deny,allow
        Allow from all
    </Directory>

    Alias /robots.txt /var/yodi/pongmob/robots.txt
    Alias /favicon.ico /var/yodi/pongmob/static/favicon.ico

    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

Install LXML Dependencies

1
2
sudo apt-get install python-dev libxml2 libxml2-dev libxslt1-dev libbz2-dev libssl-dev p7zip-full rar  unrar unzip unace unp bzip2 gzip patch
pip install lxml

OS

Windows mysql command line

19 Jun , 2013  

To enable mysql command line in DOS or PowerShell in Windows 8, we just need update System Environment Variable and put MySQL bin folder into the PATH.

1
C:Program FilesMySQLMySQL Server 5.6bin

OS

Set Java 7 on Mac OS X Mountain Lion

19 Jun , 2013  

We can use Java 7 JDK as default JavaVM in our OS X Mountain Lion. First, we need to install JDK 7 from Here.

Check installed java by “java -version”. If we got this errors :

1
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/bin/java" (-1)

Then, we need to fix path by editing ~/.bash_profile :

1
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home

To make this JAVA path works globally (Eclipse, Aptana, Android IDE need it), then please edit “/etc/launchd.conf” and put :

1
2
setenv PATH /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin
setenv JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/

OS

Solve MySQL can’t be opened because it is from an unidentified developer.

19 Jun , 2013  

When we install MySQL on MacOSX Mountain Lion, we might have this errors when clicking on MySQL pkg:

1
“mysql-5.6.12-osx10.7-x86.pkg” can’t be opened because it is from an unidentified developer.

To solve this problems, go to “Settings” and “Security Settings”. Unlock to make a change and select “Allow applications downloaded from” into “anywhere”.

OS

Solve configure: error: no acceptable C compiler found in $PATH

19 Jun , 2013  

When we need to compile or configure in Mac OS X, this errors might be occurs.

1
configure: error: no acceptable C compiler found in $PATH

To solve this problem, make sure we already have XCode installed in our Mac OS X. Then, launch XCode and click on “Preferences” menu. Go to “Download” Tab and Install “Command Line Tools”

Now we can start compiling 🙂

OS

Rsync linux to exfat partition Function not implemented

18 Jun , 2013  

Solving rsync function not implemented on EXFAT partition :

1
rsync -rltDv [SRC] [DESTINATION]

OS

Convert WebM into WMV to play in Windows Media Player

17 Jun , 2013  

Webfm is the movie format if we downloaded this from Youtube. In Fedora, we can convert this file into WMV using FFMPEG. Here is example command :

1
ffmpeg -i Billboard.flv -vcodec libvpx -acodec libvorbis Billboard.wmv

But if we got errors libvpx like thie:

1
Unknown encoder 'libvpx'

We can solve this “Unknown encoder ‘libvpx'” by remove the ffmpeg first. Then we install :

1
2
3
sudo yum remove ffmpeg
sudo yum install libvpx libvpx-utils libvpx-devel libvorbis libvorbis-devel
sudo yum install ffmpeg ffmpeg-devel

,

OS

Debian wheezy amazon can’t ssh on EC2

17 Jun , 2013  

When we already start new EC2 instance with debian wheezy, we realize that we can’t do SSH to server with SSH connection that offered by Amazon.

1
Permission denied (publickey).

SSH example:

1
ssh -i east-micro.pem root@1xx.20.xx2.xx

So, apparently in Debian Wiki, instead of using “root”, we should use “admin” to login into server.

1
ssh -i east-micro.pem admin@1xx.20.xx2.xx

,

OS

Install Python 2.7 Debian 6.0. Squeeze

10 May , 2013  

Here are guide to install Python 2.7 into Debian 6.0 Squeeze

1. Add new repo into “/etc/apt/sources.list”

1
deb http://ftp.uk.debian.org/debian/ testing main contrib non-free

2. Update and Upgrade

1
apt-get update && apt-get upgrade -y

3. Install python 2.7 and set as default

1
2
3
apt-get install libc6-dev
apt-get install python2.7
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10

OS

Setup git server with Amazon EC2

6 May , 2013  

We can setup git server on amazon ec2 intances using gitolite. Here is step to do:

1. Configure SSH config
Create new file “~/.ssh/config” which contains your amazon EC2 hostname, user and PEM key location.

1
2
3
4
Host amazon
Hostname 23.21.1xx.xxx
User root
IdentityFile /home/yodi/my-ec2-micro.pem

With this configuration, we can login into EC2 instance with : “ssh amazon”

2. Copy our SSH public keys into Amazon EC2

1
2
3
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub /tmp/local.pub
rsync -avr /tmp/local.pub -e "ssh -i /home/yodi/my-ec2-micro.pem" root@23.21.1xx.xxx:/tmp/local.pub

3. Login into EC2 and setup gitolite
Install gitolite :

1
sudo apt-get install git gitolite git-daemon-run

Create new git account for gitolite:

1
2
3
4
5
sudo adduser --system --shell /bin/bash --gecos 'git version control' --group --disabled-password --home /home/git git
su git
cd /home/git
echo "PATH=$HOME/bin:$PATH" > .bashrc
gl-setup /tmp/local.pub

Back to your local machine and clone admin gitolite repo:

1
git clone git@amazon:gitolite-admin.git

Voila! now we can start add new repository! 🙂

Create new repository by editing “gitolite-admin/conf/gitolite.conf”, eg :

1
2
3
4
5
repo gitolite-admin
RW+ = @all

repo insurances
RW+ = @all

Then you can try to commit this repo :

1
2
git commit -am 'create new repo'
git push origin master

Then you can clone new repo by :

1
git clone git@:insurances

,

OS

Setup BitCoin on Fedora Linux

14 Apr , 2013  

Here is tutorial on how to setup bitcoin and start mining on Fedora 18 (Linux). First thing first, we need to download dependencies.

1. Install QT
Since we will using Bitcoin client, it’s need QT to make it run.

1
sudo yum install libQtGTL

2. Download BitCoin client for Linux
Go to Bitcoin Download and pick linux packages. Extract and copy the bin folder into “/usr/local/bin”. For me, I use 64bit version.

1
2
cd ~/bitcoin-0.8.1-linux/64
sudo cp bin/* /usr/local/bin

3. Start Bitcoin QT
Just execute “bitcoin-qt” from your terminal. First time it’s run, it’s need to retrieve hash blocks which meaning it will download 9 GB data. Just leave your laptop for a day and it will finish.

4. Start solo mining
After our bitcoin download blocks already completed, we can stat doing solo mining. But, we need to install dependencies here :

1
2
3
4
sudo yum install opencl wxPython git pyserial
git clone https://github.com/Kiv/poclbm
cd poclbm
python guiminer.py

You can start doing solo mining or join with pooling mining website like deepbit.net, slush, etc.

,

OS

Fix slow update query MySQL in Django Session table

5 Mar , 2013  

After using new relic, i found there is query that took more than long time to finihed. After investigate, I found that “update query” on django session is the most expensive and slowest query. Here is the query:

1
UPDATE `django_session` SET `session_data` = %s, `expire_date` = %s WHERE `django_session`.`session_key` = %s

I’m wondering what the reason that queries need a lot of time to be finished. Fyi, there is a million records under this table. Since i don’t have deep understanding on how MySQL works, then I start reading a few stuff that related with this problem.

1. Internal Locking
There are 2 action of locking, read and write locking. First case, we want to make select query on a table which mean “read”. MySQL will check if there is lock on selected table or not. If no lock found, then MySQL will put “read lock” on this table. But, ff there is a lock on this table, then this “read lock” will put into queue.

Same thing with “write”, for instance we want to update records. MySQL will looking for lock on table, if no lock, then it will put “write lock” on this table or put into queue if lock found. The difference here that “write lock” have higher priorities than “read lock”.

Detail : http://dev.mysql.com/doc/refman/5.0/en/internal-locking.html

2. Primary Indexes and Data Type
In django session, it will match the “session_key” and update it’s value. Fyi, “session_key” is the primary key in django session table which that’s mean this column is being used as pointer. Primary key can be INT, CHAR and VARCHAR. Is that the data type of this primary key is matter? My answer is yes it is. In this cases, i’ll refering for MyISAM engine.

When we make query, then MyISAM will retrieve the primary keys, put this list of primary keys into index blocks (to minimize disk I/O) and arrange them into Binary tree. For instance, 1 index block have 1024 byte. If our primary keys is INT (4 bytes) (http://dev.mysql.com/doc/refman/5.0/en/integer-types.html), that’s mean each single index can hold 256 items. Meanwhile, for varchar that have 11 character, it’s have size about 12-13 bytes which need 1-2 bytes as prefix that contain length of value. That means 1 index block only can hold about 85 items.

Based on this two documentation about how MySQL works, I’m understand why “update” query on session table takes long time. Then I start to thinking about solution :

1. Reduce records
“Session” table might have the most requests in Django Apps. Because mostly each action need to be validated and that’s mean requests on this session table. Since I see more than million records on this table, reduce it into 100K records will give a big difference. Better run clean-up scripts from session that expired since one days ago. Some documentation related with this clean-up:
https://docs.djangoproject.com/en/dev/topics/http/sessions/#s-clearing-the-session-store

2. Optimize MySQL
MySQL configuration have options that we can tune and increasing performance by configure it correctly. Also use MySQL query cache wisely ( http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/ )

Anyway, if our session table is too big, then we can delete it manually from MySQL-client by :

1
delete from django_session where expire_date <= NOW();

,

OS

Solve Permission denied (publickey) EC2 to New Server

2 Mar , 2013  

I use Debian AMI for this example. Suddenly, I can’t SSH into new server that created. Even worse, i can’t made SSH connection from one server to another server in Amazon EC2. Apparently, the problem is the way of make SSH connection.

This is what Amazon EC2 suggestion:

1
ssh -i my.pem root@<my-ip-address>

And it give me result:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: east-micro.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

How about :

1
ssh -l root -i my.pem <my-ip-address>

And it works! I say that it’s weird!

,

OS

Solve MySQL Incorrect key file for table /tmp repair it in EC2

2 Mar , 2013  

Today i got this errors while installing MySQL in my Debian :

1
ERROR 126 (HY000) at line 1: Incorrect key file for table '/tmp/#sql_45cf_0.MYI'; try to repair it

This errors usually refering for out of space in our server. I just replace server with new EBS which have more space. Then after doing “df -hT”, i found something wrong here :

1
2
3
4
5
6
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/xvda1    ext3    5.0G  1.1G  3.7G  23% /
tmpfs        tmpfs    306M   12K  306M   1% /lib/init/rw
udev         tmpfs    285M   28K  285M   1% /dev
tmpfs        tmpfs    306M  4.0K  306M   1% /dev/shm
overflow     tmpfs    1.0M     0  1.0M   0% /tmp

There is overflow on filesystem which supposed to be not happen. So, what the solution? Is easy! just reboot your server and overflow will gone and “/tmp” will come back to your /dev/sda1.

OS

Ec2 fix ebs volume space

2 Mar , 2013  

When creating new EBS from Snapshot in EC2, this EBS will using the old space. For instance, snapshot was 1GB and we launch new EBS with 5GB capacity. After attaching into EC2 server, we’ll find out that the space still the old one (1GB). To fix this EBS volume space, just use “resize2fs”:

1
resize2fs /dev/xvda1

OS

Top showing wrong amount of memory usage in server

20 Feb , 2013  

“Top” (Go to console and type top) became a handy tools to track what applications that currently running in our server. But, if we’re using it for showing how much actual memory usage in server, that’s WRONG!
Why?

First, see this screenshot of my Fedora with my total RAM is 3.6 GB:

Top results (Free: 1.6 GB)

System Monitor: (Usage: 1.1GB)

See a different here? Well, if you google, actualy you can find a few articles already share about this. But for your information, Linux kernel use available memory for disk cache. Meaning, if you have 4GB RAM, your application ate 1GB, then for 3GB will be used for disk cache. Why disk cache? Because hardisk is slow here (SSD is pretty fast anyway). By cache them on memory, it will make the process became faster. But, you’re opening new application, then immediately Linux kernel will give this available memory to your new application.

Reference:
http://linuxtoolkit.blogspot.sg/2010/02/understanding-memory-usage-from-top-and.html
http://vivekrajendran.wordpress.com/tag/linux-incorrect-memory-usage/

OS

How to draw cirle / ball objects in PyGame

3 Feb , 2013  

There is a lack documentation about how to draw circle or ball in Pygame. Here is an example taken from my game source code:

1
2
3
4
5
6
self.ball = pygame.Surface((25, 25))
self.ballrect = pygame.draw.circle(self.ball, (0, 255, 0), (15 / 2, 15 / 2), 15 / 2)
self.ball = self.ball.convert()
self.ball.set_colorkey((0, 0, 0))
self.ballrect.topleft = [0, 0]
self.screen.blit(self.ball, self.ballrect)

,

OS

Synergy between Mac and Linux and solve connection refused problem

30 Jan , 2013  

To make Synergy works in both Mac (as client) and Linux (as server), we should do this things:

1. Make sure have same version
If synergy version on client and server different, then connection problem will be occur.
So make sure we installing same version on both client and server.

2. Use Version 1.3.7
I found problem when using the latest version, then i rollback into 1.3.7 version and the connection problem is gone. Fyi, I use Mac OS X Snow Leopard and Fedora 18.

3. Configuration
There no special configuration here. For Fedora, I use this “/etc/synergy.conf”:

1
2
3
4
5
6
7
8
9
section: screens
    fedora:
    mac:

section: links
    fedora:
        left = mac
    mac:
        right = fedora

In this case, fedora is my hostname. So I just add “mac” in “/etc/hosts”:

1
192.168.1.3 mac

4. Run
In Fedora, i run synergys by :

1
synergys -f

In Mac OS X, i run synergyc by:

1
 ./synergyc -f 192.168.1.4

Which 192.168.1.4 is my Fedora IP address. Now we can share screen between Mac OS X and Linux 😀

,

OS

Setup httpd conf virtualhost apache in Fedora 18

24 Jan , 2013  

Configuring apache / httpd in Fedora 18 to works with custom folder like “htdocs” and do the directory listing index is a bit irritating. Here is the errors that you might be facing like:

1
2
3
4
AH01630: client denied by server configuration
htaccess: allow not allowed here
AH01276: Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
AH00035: access to / denied (filesystem path '/home/yodi/htdocs') because search permissions are missing on a component of the path

Here is the clue how to fix httpd virtualhost problem in Fedora 18

1. Custom /var/www/ path for virtualhost
To make custom folder works, we need to set that User/Group apache can access that folder. Or we can change into our user. For instance in “/etc/httpd/conf/httpd.conf”:
More…

,