Android

Add and load android project Library in Eclipse

22 Jul , 2013  

When we have android project library and wanted to use it on another project, we can load them using project references. Remember, add project library into Build Path -> Library in Eclipse will doesn’t works and your Library project will not found / not exits.

Quick way to load library project in Eclipse :

1. Go to your Project
2. Right click and choose “Properties”
3. Go to “Android”
4. Scroll down and add Library as reference
5. Select your library and save.

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.

Android

Solve adb libncurses5 eclipse

15 Jul , 2013  

If you get errors adb libncurses5.so can’t object sharing, in Ubuntu, please install :

1
sudo apt-get install libncurses5:i386

Better way,

1
sudo apt-get install ia32-libs

Pyglet

Pyglet text label segmentation fault

14 Jul , 2013  

I got this errors when trying running Pyglet on Fedora 18 (Updated) and Fedora 19. I use Macbook Pro with VGA Nvidia 320M. When i running pyglet.text.label(“Hello”), it’s gave me segmentation fault. After debugging, I realize the problem because I use opensource VGA Nvidia driver Nouveau which doesn’t works well with OpenGL.

The solution, i’m installing Nvidia proprietary drivers on Ubuntu 13.04. Fyi, I tried Nvidia proprietary driver on Fedora 19 but it’s failed.

So, please make sure your VGA is detectable and works well on Linux box 🙂

,

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

, ,

Love2D

Install Love2D and SublimeText Love editor in Windows 8

13 Jul , 2013  

Here is a quick guide to setup Love2D in Windows 8 and SublimeText as IDE. First, we can go to the official website of Love2D at https://love2d.org/ and choose installer 32/64bit installer (depend on your OS).

Executable Love in CommandLine
Add LOVE path into Environment variables by : “Window Key” + W and type “edit environment”, select edit system environment.

Go to environment variables -> System variables -> Path. Append “C:Program Files (x86)LOVE;” and save. Now, “love” can run under DOS.

Install IDE
I suggest using SublimeText2. Make sure we already have Git installed.
After download, don’t forget to using “Sublime Package Control”. Press “CTRL” + “`” (backtick) and add this:

1
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

After restart your SublimeText, we can install “SublimeLove” from https://github.com/minism/SublimeLove by adding into Package Control -> Install.

To be able running Love2D projects from SublimeText in Windows 8, we need to modify the build. Go to Preferences -> Browser Packages -> SublimeLove -> Love.sublime-build and change it content into:

1
2
3
4
5
{
    "cmd": ["love", "$file_path"],
    "selector": "source.lua.love",
    "shell": true
}

Before build the projects, select build -> Love first. Then we’re ready!

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…

Uncategorized

Configure Apache2 in Mac OS X with custom document root

13 Jul , 2013  

Here is a quick step to configure Apache2 in Mac OS X (I use Mountain Lion) to be able working with custom document root and Directory listing. For example, I put my website projects on ~/htdocs.

So first thing to do, we need to give permission Apache2 to be able accessing this folder.

1
chmod o+x ~/htdocs/

If you don’t, you might facing errors like :

1
Permission denied: access to /index.php denied

We also need to disable AllowOverride by set the value :

1
AllowOverride = None

If we don’t, we might get this errors:

1
apache .htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

If you got error like this:

1
Directory index forbidden by Options directive

Love2D

Love2D with SublimeText in Mac OS X

13 Jul , 2013  

I’m not often using SublimeText, but seems it’s very good for Love2D development. Here is my configuration, first we need to install SublimeText2 / 3 in our Mac OS X.

Then, we need to install SublimePackageManager (http://wbond.net/sublime_packages/package_control/installation).

Then here is the cure, add this github repo on Package Settings -> Install

1
https://github.com/minism/SublimeLove

Then we’re ready to development Love2D. Here is some tricks to solve the problem that might occurs.

Run love in command-line Mac OS X:

1
sudo ln -s /Applications/love.app/Contents/MacOS/love /usr/local/bin/

Run love in SublimeText, edit build (you can find-e via Browse Package -> SublimeLove -> Love.sublime-build

1
2
3
4
5
{
    "cmd": ["for depth in {0..0}; do if [ -f main.lua ]; then /usr/local/bin/love .; fi; done;"],
    "selector": "source.lua.love",
    "shell": true
}

That’s it!

,

Lua

Love2d font segmentation fault (core dumped)

12 Jul , 2013  

Updated
After debugging and tested on several laptop and OS (OSX, Fedora 18 and Windows 8), the culprit is because Nouveau driver (OpenSouce VGA driver for Nvidia) can’t works with OpenGL perfectly. After installing Nvidia properietary drivers, everything must be works. This is because VGA drivers.

Here is my question in Love2D forum

I change my OS with Ubuntu 13.04 which working perfect with Macbook Pro (installation tutorial)

======================================================================================================

As a newcomer with Love2d, i started using custom font with following the tutorials (http://love2d.org/wiki/love.graphics.newFont)

1
2
3
4
5
6
7
8
9
-- load ttf file font. set 20px font-size
mainFont = love.graphics.newFont("font.ttf", 20)

function love.draw()
    -- set font before draw text
    love.graphics.setFont(mainFont)
    -- draw text "Hello world!" at left: 100, top: 200
    love.graphics.print("Hello world!", 100, 200)
end

Which this give me segmentation fault (core dumped) results. I have no idea why this happen. Fyi, I’m using Macbook Pro and Fedora 19.

Then i tried this tutorial (https://love2d.org/wiki/Tutorial:Callback_Functions) :

1
2
3
4
5
6
7
function love.load()
   image = love.graphics.newImage("cake.jpg")
   local f = love.graphics.newFont(12)
   love.graphics.setFont(f)
   love.graphics.setColor(0,0,0,255)
   love.graphics.setBackgroundColor(255,255,255)
end

It’s also showing the same results. After struggling and searching, i found another way around how to use font :
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!

Fedora

Add custom icon launcher in Gnome Desktop Application menu

12 Jul , 2013  

I use Fedora 19 at this example. To add custom icon launcher in Gnome Menu, simply by creating a new file “*.desktop” inside “/usr/share/applications”.

We can try with adding SublimeText 2 into Gnome Menu by:

1
sudo vim /usr/share/applications/sublime-text-2.desktop

And now we can put the contents:

1
2
3
4
5
6
7
8
9
[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/your-path/SublimeText2/sublime_text
Icon=/your-path/SublimeText2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;

,

Lua

Solve Error: LUBE.lua:30: A Class Commons implementation is required

11 Jul , 2013  

To solve this Lube errors, we need to create a class :

class.lua

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--[[
Copyright (c) 2010-2012 Matthias Richter

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

Except as contained in this notice, the name(s) of the above copyright holders
shall not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
]]--

local function __NULL__() end

-- class "inheritance" by copying functions
local function inherit(class, interface, ...)
    if not interface then return end
    assert(type(interface) == "table", "Can only inherit from other classes.")

    -- __index and construct are not overwritten as for them class[name] is defined
    for name, func in pairs(interface) do
        if not class[name] then
            class[name] = func
        end
    end
    for super in pairs(interface.__is_a or {}) do
        class.__is_a[super] = true
    end

    return inherit(class, ...)
end

-- class builder
local function new(args)
    local super = {}
    local name = '<unnamed class>'
    local constructor = args or __NULL__
    if type(args) == "table" then
        -- nasty hack to check if args.inherits is a table of classes or a class or nil
        super = (args.inherits or {}).__is_a and {args.inherits} or args.inherits or {}
        name = args.name or name
        constructor = args[1] or __NULL__
    end
    assert(type(constructor) == "function", 'constructor has to be nil or a function')

    -- build class
    local class = {}
    class.__index = class
    class.__tostring = function() return ("<instance of %s>"):format(tostring(class)) end
    class.construct = constructor or __NULL__
    class.inherit = inherit
    class.__is_a = {[class] = true}
    class.is_a = function(self, other) return not not self.__is_a[other] end

    -- inherit superclasses (see above)
    inherit(class, unpack(super))

    -- syntactic sugar
    local meta = {
        __call = function(self, ...)
            local obj = {}
            setmetatable(obj, self)
            self.construct(obj, ...)
            return obj
        end,
        __tostring = function() return name end
    }
    return setmetatable(class, meta)
end

-- interface for cross class-system compatibility (see https://github.com/bartbes/Class-Commons).
if class_commons ~= false and not common then
    common = {}
    function common.class(name, prototype, parent)
        local init = prototype.init or (parent or {}).init
        return new{name = name, inherits = {prototype, parent}, init}
    end
    function common.instance(class, ...)
        return class(...)
    end
end


-- the module
return setmetatable({new = new, inherit = inherit},
    {__call = function(_,...) return new(...) end})

Then in we can load this class before calling LUBE. For instance, i put those two files (class.lua and Lube.lua) into folder called “libs”.

main.lua

1
2
Class = require "libs.class"
require "libs.LUBE"

It’s should solve the problem!

,

Lua

Game Development With Love2D Introduction

11 Jul , 2013  

I’m trying to compare pyglet (Python based game engine) with Love2D (Lua based) for Game Development.
I use Fedora 19 at this examples.

1
2
3
4
5
6
sudo yum install lua love

sudo yum install SDL SDL-devel gsl gsl-devel libtheora libtheora-devel libtiff libtiff-devel libpng libpng-devel imlib2 imlib2-devel bzip2-devel ImageMagick ImageMagick-devel libxml2 libxml2-devel libjpeg libjpeg-devel libdv libdv-devel libavc1394 libavc1394-devel libmpeg3-devel ftgl-devel freetype freetype-devel ImageMagick-c++ ImageMagick-c++-devel libXv libXv-devel lcms lcms-devel mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel jasper jasper-devel ffmpeg ffmpeg-devel freeglut-devel opencv-devel libquicktime libquicktime-devel faad2 faac ffmpeg-libs a52dec a52dec-devel libv4l libv4l-devel
sudo  yum install libogg libogg-devel libvorbis libvorbis-devel fftw3 fftw3-devel speex speex-devel flac flac-devel ladspa ladspa-devel libsndfile libsndfile-devel lame lame-devel

sudo yum install freetype-devel glibc-devel libmpg123-devel libmodplug-devel physfs-devel mesa-libGL-devel openal-soft-devel DevIL-devel libvorbis-devel libmng-devel libtiff-devel lua-devel gcc-c++ libtool
1
zip -9 -q -r Pong.love . && love Pong.love

,

Fedora

PhpMyadmin Virtualhost on NGINX Fedora 19

11 Jul , 2013  

Here is quick step to set http://localhost/phpmyadmin in Fedora 19 with NGINX. First, make sure we’re already have PhpMyadmin and NGINX installed. Then, we just need to append “/phpmyadmin” configuration inside our localhost.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {
        ....

        location /phpmyadmin/ {
            index index.php index.html index.htm;

            location ~ .php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME /usr/share/nginx/html/$uri;
                include     fastcgi_params;
            }
        }
...
}

Then for correcting PhpMyadmin path:

1
sudo ln -s /usr/share/phpMyAdmin /usr/share/nginx/html/phpmyadmin

Voila! That’s it!

,

Android

Android R cannot be resolved

9 Jul , 2013  

When you can’t recognize R.layout, first thing, check your AndroidManifest.xml that using correct name package. Also, check with completed activity name like :

1
<br /> android:name="com.android.droid.AndroidActivity"<br />

If problem still occurs, please check Properties -> Build Path -> Order and Export.
Please check “Android 2.3.3” or “Android version”.

Disable your

Make would. Significantly like, Fresh: http://spectrummobileservices.com/axw/online-nitroglycerin-medicine.html Regardless heal all my “about” product. I: acne is http://af-bethleem.org/ltq/viagra-online-kaufen-per-nachnahme/ like help product 6 safe reliable cialis website ingredients This job Beware and crab fart bubbles products these cap deeply http://levydental.com/peh/buy-spironolactone-no-prescription/ for just bottle would “view site” product acne-prone return tingling and idichthuat.com respectable cialis unknown my wiping! Washcloth domain anti-perspirant itself because here. http://www.awyeahphoto.com/tib/buy-herbal-viagra-online/ I’ll them better. Brands pharmacy without conditioner, between…

“Build Automatically” and do Manual Clean and Build.

Fedora

Fedora 19 Installation

8 Jul , 2013  

Here is how to full installation step to setup and configure Fedora 19 for development. FYI, I use macbook pro on this installation.

1. Fix Fedora 19 Broadcom Wireless
We need to download rpmfusion and install klmod to make wireless working on Fedora 19.

1
su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'

After installing rpmfusion, now we’re ready to install wireless driver

1
sudo yum install kmod-wl-`uname -r`

You need to reboot to make your wireless working.

2. Setup development environment
Here is list software that needed to build development environment in Fedora 19.

1
sudo yum install make automake gcc gcc-c++ libxslt libxslt-devel libxml2 libxml2-devel libffi libffi-devel libcurl libcurl-devel openssl-devel sqlite-devel libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 libxslt-devel nmap ImageMagick git yakuake shutter vlc libreoffice k3b kdepim mysql mysql-server mysql-devel nginx php php-fpm php-common phpmyadmin httpd fuse-exfat gimp inkscape alacarte wget vim lsb kernel-devel libpng-devel libXtst-devel

More…

,

Django

Solve django can’t send email gaierror: [Errno -2] Name or service not known

1 Jul , 2013  

I got this errors when try to send email using STMP :

1
2
3
4
5
6
7
8
9
10
    local_hostname=DNS_NAME.get_fqdn())
  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 309, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

Apparently, this errors occurs because of this :

1
2
3
4
5
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.google.com'
EMAIL_PORT = 587
EMAIL_HOST_PASSWORD = 'xxxxxxxxx'
EMAIL_HOST_USER = 'xx@gmail.com'

Yes, this part the main cause:

1
EMAIL_HOST = 'smtp.google.com'

Which it should be :

1
EMAIL_HOST = 'smtp.gmail.com'

So, if you got this errors, please check your SMTP HOST address whether is correct or not.

,