2015년 4월 30일 목요일

android:largeHeap

<application android:icon="@drawable/icon"
android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:largeHeap="true"



여려가지 이유에서 android bitmap 처리를 하다보면, 대책없이 dalvic 에서 out of memory 가 나서 app 이 crash 되는 경우가 있다. AndroidManifest.xml 추가

android:largeHeap
Whether your application's processes should be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the first application loaded into a process; if you're using a shared user ID to allow multiple applications to use a process, they all must use this option consistently or they will have unpredictable results.
Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.
To query the available memory size at runtime, use the methods getMemoryClass() orgetLargeMemoryClass().

ref : http://developer.android.com/guide/topics/manifest/application-element.html

2015년 4월 29일 수요일

directory size with linux

du -h --apparent-size /home
or
du -h -s --apparent-size /home

du -hs /home

icon size for android app

Low Density Per Inch (ldpi) - 36 x 36 pixel
Medium Density Per Inch (mdpi) - 48 x 48 pixel
High Density Per Inch (hdpi) - 72 x 72 pixel
eXtra High Density Per Inch (xhdpi) - 96 x 96 pixel
eXtra eXtra High Density Per Inch (xxhdpi) - 144 x 144 pixel

2015년 4월 6일 월요일

install android studio for ubuntu

# jdk
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

# android studio
sudo apt-add-repository ppa:paolorotolo/android-studio
sudo apt-get update
sudo apt-get install android-studio

reboot

gnome with ubuntu 14

sudo apt-get install gnome-session-flashback

reboot

login - (GNOME Flashback (metacity)) select

crontab

yum install crontabs ( for not found with centos )

crontab -l

crontab -e

0  0  *  *  *  mysqldump -u root -ppassword redmine > /home/pointermans/backup/redmine/$(date +\%Y-\%m-\%d)_redmine_db_backup.sql

vi /etc/cron.allow ( add user for allow )

/etc/init.d/crond restart

sample >
0  0  *  *  *  mysqldump -u root -pabwmthvmxm.co.kr redmine > /home/pointermans/backup/redmine/$(date +\%Y-\%m-\%d)_redmine_db_backup.sql
0  0  *  *  *  tar -czvf /home/pointermans/backup/redmine/$(date +\%Y-\%m-\%d)_redmine_file_backup.tar.gz /var/lib/redmine/files
23  15  *  *  0  tar -czvf /home/pointermans/backup/redmine/$(date +\%Y-\%m-\%d)_git_backup.tar.gz /home/git
0  0  *  *  * find /home/pointermans/backup/redmine/ -type f -name "*.*" -mtime +5 -exec rm {} \;


============
stop & disable
============

/etc/init.d/crond stop

mv /var/spool/cron  /var/spool/cron_is_disabled

2015년 4월 5일 일요일

search header file with ubuntu

apt-get install libx11-dev
apt-get install apt-file
apt-file update
apt-file search Xlib.h

X11 lib 사용해서 gcc 로 윈도우 띄우기

apt-get install libx11-dev

int main(int argc , char** argv)
{
    Display *d ;
    Window   w, root ;
   
    d = XOpenDisplay(NULL) ;
   
    root = XDefaultRootWindow (d);
    w = XCreateSimpleWindow ( d, root, 50, 50, 400, 300,
                             2, BlackPixel (d,0), WhitePixel(d,0) );
    XMapWindow (d, w);
    XFlush (d);
   
    getchar();
   
    XCloseDisplay (d);
   
    return 0;
}

gcc -o test test.c -lX11

2015년 4월 4일 토요일

migration adt to android studio

1. adt 로 일단 빌드/실행까지 성공해야, android studio 에서 작업 할 수 있음, 안 그럼 app module 을 load 할 수 없음
2. 소스내에서 android ndk 가 필요한 경우, ndk 를 설치해도 다음과 같은 오류가 발생
Error:(283) *** Android NDK: Aborting . Stop.
Error:Execution failed for task ':app:compileDebugNdk'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/pointermans/Documents/Work/android_ndk/android-ndk-r10d/ndk-build'' finished with non-zero exit value 2
3. build.gradle ( module ) 에 다음을 추가가 ( android 태그 안에 두어야 함 )
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}

2015년 4월 1일 수요일

setting for asterisk cdr record ( mysql )

vi /etc/asterisk/cdr_mysql.conf

[global]
hostname=xxx.xxx.xxx.xxx
dbname=mysqldatabasename
table=cdr
password=mysqluserpassword
user=mysqluser

/etc/init.d/asterisk restart