private ProgressDialog mProgressDialog;
    private String unzipLocation = Environment.getExternalStorageDirectory() + "/";
    private String zipFile = Environment.getExternalStorageDirectory() + "/xxx.zip";
                unzip();
        public void unzip() throws IOException {
            mProgressDialog = new ProgressDialog(MainActivity.this);
            mProgressDialog.setMessage("Please Wait...Extracting zip file ... ");
            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mProgressDialog.setCancelable(false);
            mProgressDialog.show();
            new UnZipTask().execute(zipFile, unzipLocation);
        }
      
        private class UnZipTask extends AsyncTask<String, Void, Boolean> {
            @SuppressWarnings("rawtypes")
            @Override
            protected Boolean doInBackground(String... params) {
                String filePath = params[0];
                String destinationPath = params[1];
                File archive = new File(filePath);
                try {
                    ZipFile zipfile = new ZipFile(archive);
                    for (Enumeration e = zipfile.entries(); e.hasMoreElements();) {
                        ZipEntry entry = (ZipEntry) e.nextElement();
                        unzipEntry(zipfile, entry, destinationPath);
                    }
                    UnZipUtil d = new UnZipUtil();
                    d.unZip(zipFile, unzipLocation);
                    } catch (Exception e) {
                    return false;
                }
                return true;
            }
            @Override
            protected void onPostExecute(Boolean result) {
                mProgressDialog.dismiss();
            }
            private void unzipEntry(ZipFile zipfile, ZipEntry entry, String outputDir) throws IOException {
                if (entry.isDirectory()) {
                    createDir(new File(outputDir, entry.getName()));
                    return;
                }
                File outputFile = new File(outputDir, entry.getName());
                    if (!outputFile.getParentFile().exists()) {
                    createDir(outputFile.getParentFile());
                }
                // Log.v("", "Extracting: " + entry);
                BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry));
                BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
                try {
                } finally {
                    outputStream.flush();
                    outputStream.close();
                    inputStream.close();
                }
            }
            private void createDir(File dir) {
                if (dir.exists()) {
                    return;
                }
                if (!dir.mkdirs()) {
                    throw new RuntimeException("Can not create dir " + dir);
                    }
            }
        }
        public class UnZipUtil {
            public boolean unZip(String zipFile, String ToPath) {
                InputStream is;
                ZipInputStream zis;
                try {
                    String filename;
                    is = new FileInputStream(zipFile);
                    zis = new ZipInputStream(new BufferedInputStream(is));         
                    ZipEntry ze;
                    byte[] buffer = new byte[1024];
                    int count;
                    while ((ze = zis.getNextEntry()) != null) {
                        // zapis do souboru
                        filename = ze.getName();
                        // Need to create directories if not exists, or
                        // it will generate an Exception...
                        if (ze.isDirectory()) {
                           File fmd = new File(ToPath + filename);
                           fmd.mkdirs();
                           continue;
                        }
                        FileOutputStream fout = new FileOutputStream(ToPath + filename);
                        // cteni zipu a zapis
                        while ((count = zis.read(buffer)) != -1) {
                            fout.write(buffer, 0, count);           
                        }
                        fout.close();             
                        zis.closeEntry();
                    }
                    zis.close();
                } catch(IOException e) {
                    e.printStackTrace();
                    return false;
                }
                return true;
            }
        }
    }
2013년 8월 26일 월요일
MD5SUM string in Java
    public static String createChecksum(String filename) throws Exception {
InputStream fis = new FileInputStream(filename);
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
if (numRead > 0) {
complete.update(buffer, 0, numRead);
}
} while (numRead != -1);
fis.close();
byte[] digest = complete.digest();
StringBuffer sb = new StringBuffer();
for (byte b : digest) {
if ((int)(b & 0xff) <= 0xf)
sb.append(Integer.toHexString(0));
sb.append(Integer.toHexString((int) (b & 0xff)));
}
  
return sb.toString();
}
InputStream fis = new FileInputStream(filename);
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead;
do {
numRead = fis.read(buffer);
if (numRead > 0) {
complete.update(buffer, 0, numRead);
}
} while (numRead != -1);
fis.close();
byte[] digest = complete.digest();
StringBuffer sb = new StringBuffer();
for (byte b : digest) {
if ((int)(b & 0xff) <= 0xf)
sb.append(Integer.toHexString(0));
sb.append(Integer.toHexString((int) (b & 0xff)));
}
return sb.toString();
}
2013년 8월 12일 월요일
cheapcast on ODROID
chromecast 없이 android 디바이스로 chromecast emulator 해주는 재밌는 어플이 나왔네요.
ODROID에 올려서 사용하면 딱 일 것 같아 시도 해 봤는데 연결이 원할하지 못 하네요.
https://plus.google.com/u/0/107130354111162483072/posts/bc1TZChjhRE
아래 이미지는 Galaxy Nexus에서 ODROID-XU로 Chomecast를 시도한 모습니다.
https://play.google.com/store/apps/developer?id=Sebastian+Mauer
ODROID에 올려서 사용하면 딱 일 것 같아 시도 해 봤는데 연결이 원할하지 못 하네요.
https://plus.google.com/u/0/107130354111162483072/posts/bc1TZChjhRE
아래 이미지는 Galaxy Nexus에서 ODROID-XU로 Chomecast를 시도한 모습니다.
ODROID-XU의 화면
https://play.google.com/store/apps/developer?id=Sebastian+Mauer
2013년 8월 5일 월요일
ODROID-XU와 big.LITTLE
오드로이드 포럼에 Exynos5410의 big.LITTLE의 문제에 대해서 글이 하나 있습니다.
http://forum.odroid.com/viewtopic.php?f=65&t=1884
IKS(In-Kernel Switcher)가 동작하는 CPU 마이그레이션과 클러스터 마이그레이션은 차이는 DVFS에 의해 특정 clock으로 올라가면 전체가 A15로 동작하지만 Core별로 A7과 A15를 선택적으로 동작 시킬 수 있다는 것입니다. 따라서 클러스커 마이그레이션과 달리 4개의 core가 다 A15로 동작할 필요가 없기 때문에 전력 효율이 높다는 장점이 있습니다. 하지만 big.LITTLE 설명한 것 처럼 저전력과 관련된 설계이고 오드로이드와 같이 A/C 전원이 항상들어가는 시스템에서는 아무런 의미가 없습니다.
Exynos5250은 A15 dual-core이고 Exynos5410은 A15 quad-core라 생각하시면 간단 할 것 같습니다.
물론 Exynos5420이 더 높은 clock과 GPU 성능이 높습니다. 하지막 아직 상용 제품에 출시 되지 않았습니다. 개발 보드로 나오기 위해서는 더 많은 시간이 필요할 것입니다.

big.LITTLE의 최후 목표인 MP모드는 커널의 scheduler의 재설계의 문제 이기 때문에 CCI의 버그와는 무관한 것으로 이해하고 있습니다. 아직 MP모드로의 실제 동작은 먼 얘기로 알고 있습니다.
Apple에서도 다음 CPU에 big.LITTLE을 사용하다고 합니다. Apple이야 자체 커널이 있으니 잘 해결하겠죠??? Apple의 big.LITTLE의 행보가 기대 됩니다.
참고한 사이트 입니다.
http://gamma0burst.tistory.com/m/613
http://forum.odroid.com/viewtopic.php?f=65&t=1884
Exynos5410의 CCI-400 버그로 big.LITTLE의 클러스트 마이그레이션밖에 동작하지 않습니다. 그래서 이번에 수정되어 나온 Exynos5420과 비교하며 많은 개발자들이 아쉬워하고 있습니다.
IKS(In-Kernel Switcher)가 동작하는 CPU 마이그레이션과 클러스터 마이그레이션은 차이는 DVFS에 의해 특정 clock으로 올라가면 전체가 A15로 동작하지만 Core별로 A7과 A15를 선택적으로 동작 시킬 수 있다는 것입니다. 따라서 클러스커 마이그레이션과 달리 4개의 core가 다 A15로 동작할 필요가 없기 때문에 전력 효율이 높다는 장점이 있습니다. 하지만 big.LITTLE 설명한 것 처럼 저전력과 관련된 설계이고 오드로이드와 같이 A/C 전원이 항상들어가는 시스템에서는 아무런 의미가 없습니다.
Exynos5250은 A15 dual-core이고 Exynos5410은 A15 quad-core라 생각하시면 간단 할 것 같습니다.
물론 Exynos5420이 더 높은 clock과 GPU 성능이 높습니다. 하지막 아직 상용 제품에 출시 되지 않았습니다. 개발 보드로 나오기 위해서는 더 많은 시간이 필요할 것입니다.
big.LITTLE의 최후 목표인 MP모드는 커널의 scheduler의 재설계의 문제 이기 때문에 CCI의 버그와는 무관한 것으로 이해하고 있습니다. 아직 MP모드로의 실제 동작은 먼 얘기로 알고 있습니다.
Apple에서도 다음 CPU에 big.LITTLE을 사용하다고 합니다. Apple이야 자체 커널이 있으니 잘 해결하겠죠??? Apple의 big.LITTLE의 행보가 기대 됩니다.
참고한 사이트 입니다.
http://gamma0burst.tistory.com/m/613
bluez on ODROID-XU(Android-4.2.2)
ODROID-XU에  USB Bluetooth 가 동작합니다.
아래 소스를 기반으로 merge 하였습니다.
git에서 안 받아 지시면 아래 patch를 적용해 보세요.
https://drive.google.com/file/d/0B5aZmgmqP9rORG1ZbWFIMG9wYU0/edit?usp=sharing
2013년 8월 2일 금요일
Android Multi User on ODROID-XU
ODROID-XU
The world’s first big.LITTLE architecture based bare-board computer.| • Exynos5 Octa Cortex™-A15 1.6Ghz quad core and Cortex™-A7 quad core CPUs • PowerVR SGX544MP3 GPU (OpenGL ES 2.0, OpenGL ES 1.1 and OpenCL 1.1 EP) • 2Gbyte LPDDR3 RAM PoP • USB 3.0 Host x 1, USB 3.0 OTG x 1, USB 2.0 Host x 4 • HDMI 1.4a output Type-D connector • eMMC 4.5 Flash Storage | 
Android 4.2.2
device/hardkernel/odroidxu/overlay/frameworks/base/core/res/res/values/config.xml
<!-- Maximum number of supported users -->
<integer name="config_multiuserMaximumUsers">3</integer>
피드 구독하기:
덧글 (Atom)
 










