Month: May 2014

SwipeRefreshLayout and StaggeredGridView Android

SwipeRefreshLayout and StaggeredGridView Android

Merging between SwipeRefreshLayout and StaggeredGridView is not easy. To make it works together, we need to do few things. Here is the way : 1. Set listener and topindex variable 123456private int topIndex = 0; public class HomeFragment extends Fragment implements AbsListView.OnScrollListener,         AbsListView.OnItemClickListener, OnRefreshListener { } Fyi, we need topIndex for …

+ Read More

Solve launching android on Device very slow

Solve launching android on Device very slow

Today, i found the culprit why launching / deploy app into devices takes about 5 – 10 seconds. Apparently it’s because external folder. Here is the fixes : 1. Right click on your project 2. Select Build Path -> Configure Build Path 3. Go to Libraries tab 4. Remove source attachment Problem solved! 😀

Django request POST very slow

Django request POST very slow

When develop http://rahasiaku.com using Django and Android, i found that Django POST is very slow. After few debugging, i got the culprit : 12345678MIDDLEWARE_CLASSES = (     ‘django.contrib.sessions.middleware.SessionMiddleware’,     ‘django.middleware.common.CommonMiddleware’,     ‘django.middleware.csrf.CsrfViewMiddleware’,     ‘django.contrib.auth.middleware.AuthenticationMiddleware’,     ‘django.contrib.messages.middleware.MessageMiddleware’, #     ‘django.middleware.clickjacking.XFrameOptionsMiddleware’, ) Yes, it’s because clickjacking middleware. Disable it will solve …

+ Read More

Solve VSFTPD error retrieving directory Ubuntu

Solve VSFTPD error retrieving directory Ubuntu

Suddenly i got this “error retrieving directory, connection timeout ..” when accessing ftp EC2 server. Then, the solution just change my FTP client from “passive mode” into “active mode”. Weird but works!

Setup latest UWSGI + Django in Production Ubuntu 14.04

Setup latest UWSGI + Django in Production Ubuntu 14.04

It’s very hard to find article to help setup UWSGI and Django 1.7 in production. I use EC2 with Ubuntu 14.04. The only reason why I need to use uwsgi because Apache mod-wsgi can’t run together with gevent. It’s always throw LoopExit exception. Here is solution. First, we need to install required softwares : 1. …

+ Read More

The right way to use setTimeout in inifite loop Javascript

The right way to use setTimeout in inifite loop Javascript

When we using setTimeout, actually it will assigned into some parameters with ID of task. To avoid memory leaks, we should comes with this strategy. First, declare global variable. 1var timeOutClose; Let say we have infinite loop function contains : 1234// Run timer to close box timeOutClose = setTimeout(function() {     $(".md-close").trigger("click"); }, animationClose …

+ Read More

Beware with jquery animate in infinite loop Javascript caused memory leaks

Beware with jquery animate in infinite loop Javascript caused memory leaks

After do Check memory leak javascript in Chrome, i found that animate and delay in Javascript quite consume memory. And it’s end up with memory leaks. Here are my code : 1234567891011121314151617181920for (var i = 0; i < split; i++) {     …     $("tr.cmp_tr").css({         ‘display’ : ‘none’   …

+ Read More

Find Memory Leak in Javascript Looping

Find Memory Leak in Javascript Looping

Always carefull when building html pages that contains looping function using Javascript. I have bad experience when building looping html that running for 24/7. Memory leaks force browser crashed and not working. Luckily, Chrome is powerfull browser that let us to analyze memory. Every 10 minutes, memory increased 1MB which is disaster. How to solve …

+ Read More

Solve burger icon not showed in actionbar

Solve burger icon not showed in actionbar

Usually, we have burger icon in top left of actionbar. When it’s disappear, it probably because several issue. First thing, make sure Fragment have : 12((ActionBarActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle(menu_title);