2013년 12월 31일 화요일

Fix iOS 7 trust device problem on ubuntu 12.04

I think libimobiledevice's developer will give better solution than this guide, soon.
In developer homepage, easy way will be adopted  on 1.1.6.

This guide is just compile and update the newest version of the libimobiledevice and the ifuse.

So, I assume that a reader has a knowledge about using make, cmake, automake, git .. etc which are using widely on developing.

And I also do follow things on my ubuntu 12.04 before update binary.

  1. Install libimobiledeivce-1.1.5 and related libraries.
     http://www.libimobiledevice.org

  2. Disable automount on desktop.
     http://askubuntu.com/questions/89244/how-to-disable-automount-in-nautiluss-preferences
 
Before to do this guide, you must find your original binaries on your system. In my system, it was "/usr", so I add "--prefix=/usr" when configuration. 

Now, lets go.

1. update libimobiledevice
 - git clone https://github.com/libimobiledevice/libimobiledevice
 - cd libimobiledevice
 - autoreconfig
 - automake --add-missing
 - ./configure --prefix=/usr
 - sudo make install

2. update ifuse
 - git clone  http://cgit.sukimashita.com/ifuse.git
 - cd ifuse
 - ./autogen.sh
 - ./configure --prefix=/usr
 - sudo make install

 * I also manually update the libfuse as 2.9.3.

After finished, following command works fine.

- idevicepair pair
  -- success
- idevicepair validate
  -- paried deivce införmation
- ifuse /media/iphone --root
  -- it works fine

Trust message does not bother me after update.

Happy new year.


2013년 12월 21일 토요일

ANT building on android development

If you want to make a script for building, installing and rebooting device, ant build is needed.
Next steps may can help you do make a script or batching.

1. install jdk on your system

2. install ant on your system

3. If you have a custom library or want to just reference jar files, do modify android-sdk/tools/ant/build.xml likes follow. In this example, library added ordered by XXX, YYY, ZZZ.
I remove two lines from original code because do not include jar on my code.

<!-- Compiles this project's .java files into .class files. -->
    <target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile">
        <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
            <!-- merge the project's own classpath and the tested project's classpath -->
            <path id="project.javac.classpath">
                <path refid="project.all.jars.path" />
                <path refid="tested.project.classpath" />
                <path path="${java.compiler.classpath}" />
            </path>
            <javac encoding="${java.encoding}"
                    source="${java.source}" target="${java.target}"
                    debug="true" extdirs="" includeantruntime="false"
                    destdir="${out.classes.absolute.dir}"
                    verbose="${verbose}"
                    fork="${need.javac.fork}">
                <src path="${source.absolute.dir}" />
                <src path="${gen.absolute.dir}" />
                <compilerarg line="${java.compilerargs}" />
                <classpath>
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="XXX.jar" />
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="YYY.jar" />
                          <fileset dir="/User/kwangjo/ANTBUILD" includes="ZZZ.jar" />
                </classpath>   
            </javac>


This code is same thing on your eclipse menu as follow.



4. you can make build script like as follows
 android update project --name YOURPROJECT -p ./

5. you can implements keystore file on ant.property, next is just sample. you input your own string matching with your keystore. This step is just optional.

key.store=YOUR keystore path
key.alias=YOUR keystore alias
key.store.password=password

key.alias.password=password

6. build your project, you can also do "ant debug"
ant release

Note for installing emacs on mac

Install GNU emacs on your mac.

1. compile emacs


# ./configure --with-ns
# make
# make install
# install nextstep's Emacs.app to Application folder


2. ecb install

- download latest version of ecb on this site
http://ecb.sourceforge.net
- unarchive the downloaded file to ~/.emacs.d/ecb folder
-add follow script to ~/.emacs file

if you encounter some ecb version error add follow text on .emacs
(custom-set-variables '(ecb-options-version "2.32"))



(add-to-list 'load-path "~/app/ecb-2.32/")
(require 'ecb)
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(ecb-fix-window-size (quote width))
 '(ecb-layout-name "left1")
 '(ecb-layout-window-sizes (quote (("left9" (0.32857142857142857 . 0.9791666666666666)))))
 '(ecb-options-version "2.32")
 '(ecb-windows-width 0.33))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

;; customize the keys for ECB
(define-key ecb-mode-map (kbd "M-1") 'ecb-goto-window-directories)
(define-key ecb-mode-map (kbd "M-2") 'ecb-goto-window-sources)
(define-key ecb-mode-map (kbd "M-3") 'ecb-goto-window-methods)
(define-key ecb-mode-map (kbd "M-4") 'ecb-goto-window-history)
(define-key ecb-mode-map (kbd "M-5") 'ecb-goto-window-compilation)
(define-key ecb-mode-map (kbd "M-0") 'ecb-goto-window-edit1)

;; auto ecb mode
(setq ecb-auto-activate 'true)
(put 'scroll-left 'disabled nil)
script form http://poongbek.blogspot.kr/2011/06/emacs_04.html
  • "C-c s s": search symbol
  • "C-c s d", "C-c s g": search symbol defines
  • "C-c s G": move to symbol defines
  • "C-c s c": search function caller
  • "C-c s C": search function callee
  • "C-c s t": search string pattern
  • "C-c s e": search egrep pattern 
  • "C-c s f": search files
  • "C-c s i": search files which include the file
  • "C-c s b": show *cscope* 
  • "C-c s n": search a next symbol
  • "C-c s p": search a previous symbol
  • "C-c s N": search to next file
  • "C-c s P": search to pevious file
  • "C-c s a": set cscope database directory 
  • "C-c s A": resolve cscope database directory


3. Install autocomplete

http://www.emacswiki.org/emacs/AutoComplete

AutoCompleteScreenshot

git clone https://github.com/auto-complete/auto-complete
-git submodule init; git submodule update
- make install
- input directory name as ~/.emacs.d/auto-complete
- move libs folder such as popup, fuzzy and ert from auto-complete's source directory to ~/.emacs.d

add follow script to .emacs

;;auto-complete
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/auto-complete")
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/popup");
(require 'auto-complete-config)
(require 'popup)
(ac-config-default) 


4. Install CSCOPE

 - cscope should be installed using brew or make binary
 - Download source file from http://cscope.sourceforge.net
- you should make cscope.files on project directory
find . -name "*.java" > cscope.files
- emacs command using like below

5. using eTags

 - you can make navigate tags (like ctag with vi) using following command
find /usr/src/linux -name '*.[csSh]' | xargs etags

you can using follow script, navigate like vi.

(fset 'find-next-tag "\C-u\256") ; macro for C-u M-. 
(fset 'find-prev-tag "\C-u-\256") ; macro for C-u - M-. 
(global-set-key "\M-]" 'find-next-tag) (global-set-key "\M-[" 'find-prev-tag)

You can find tag using M-. and navigate using M-[ and M-]


6. customise emacs setting

I do not complete this setting. I write just reference pages as follow.

  you can customise colour and font on emacs
-http://www.emacswiki.org/emacs/ColorTheme

  you can customise font.
-http://www.emacswiki.org/emacs/SetFonts

 you can customise indentation.
- http://www.emacswiki.org/emacs/IndentingJava
-http://www.emacswiki.org/emacs/IndentingC



my .emacs setting file
(set-language-environment "Korean")
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq-default file-name-coding-system 'utf-8)

(add-hook 'eshell-mode-hook
          'lambda nil
          (let ((bashpath (shell-command-to-string "/bin/bash -l -c 'printenv PATH'")))
            (let ((pathlst (split-string bashpath ":")))
              (setq exec-path pathlst))
            (setq eshell-path-env bashpath)
            (setenv "PATH" bashpath)))


;;auto-complete
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/auto-complete")
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/popup")
(require 'auto-complete-config)
(require 'popup)
(ac-config-default)


;;ECB
(custom-set-variables '(ecb-options-version "2.40"))
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/ecb")
(require 'ecb)

;; customize the keys for ECB
(define-key ecb-mode-map (kbd "M-1") 'ecb-goto-window-directories)
(define-key ecb-mode-map (kbd "M-2") 'ecb-goto-window-sources)
(define-key ecb-mode-map (kbd "M-3") 'ecb-goto-window-methods)
(define-key ecb-mode-map (kbd "M-4") 'ecb-goto-window-history)
(define-key ecb-mode-map (kbd "M-5") 'ecb-goto-window-compilation)
(define-key ecb-mode-map (kbd "M-0") 'ecb-goto-window-edit1)

;; auto ecb mode
(setq ecb-auto-activate 'true)
(put 'scroll-left 'disabled nil)

;;CSCOPE
(add-to-list 'load-path "/Users/kwangjo/.emacs.d/xcscope")
(require 'xcscope)
(add-hook 'java-mode-hook (function cscope:hook))
(add-hook 'html-helper-mode-hook (function cscope:hook))


;;ETAG hook
(fset 'find-next-tag "\C-u\256") ; macro for C-u M-.
(fset 'find-prev-tag "\C-u-\256") ; macro for C-u - M-.
(global-set-key "\M-]" 'find-next-tag)

(global-set-key "\M-[" 'find-prev-tag)

RPI is not good handling DHT11

Hello? This is failure story about converting c code to python. There is GPIO controlling library on Python such as RPI, wiringPI. But...