Month: May 2014

  • Solve orientation layout glitch StaggeredGridview / Gridview in Android

    Just remember to remove this part 123android:configChanges="keyboardHidden|screenSize|fontScale" android:exported="true" android:windowSoftInputMode="adjustResize|stateHidden" From your activity in AndroidManifest.xml

  • Solve navigationdrawer back arrow for detail fragment

    Here is the solution for navigationdrawer back arrow for detail fragment : http://stackoverflow.com/questions/17258020/switching-between-android-navigation-drawer-image-and-up-caret-when-using-fragme

  • 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 […]

  • 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

    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 […]

  • 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

    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. […]

  • 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 […]

  • 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’   […]

  • 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 […]

  • 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);