안드로이드/포팅2013. 12. 1. 08:36

안드로이드에서 settings에 저장되는 여러 값에 대해 궁금하다면 다음과 같이 보면 된다.

우선 settings에 관련된 value들은 db에 저장되는 이는 다음의 위치에 있다.


/data/data/com.android.providers.settings/databases/settings.db


이 db를 접속하려면 console에서 다음과 같이 하자.

#sqlite3 settings.db



그러면 sqlite 콘솔이 뜨는데, 여기서 다음과 같이 해보자.

sqlite>.table



그러면 현재 query가능한 table들이 나온다.

android_metadata system bluetooth_devices secure



여기서 secure의 값들을 보고 싶으면 아래와 같이 하면 된다.

sqlite>select * from system;



해당 sqlite3 명령어에 대해서는 인터넷에 검색하면 잘 나온다.

참고로 sqlite3 에서 나오는 명령어는 .quit이다.


Posted by code cat
안드로이드/포팅2013. 11. 28. 16:59

system 파티션을 RW으로 remount하기 위해서는 다음과 같이 콘솔에서 실행하면 된다.

(system 파티션에 대한 path는 각자 다르니 사용하는 디바이스에 맞추면 된다.)


mount -o rw,remount /dev/block/.../by-name/system


'안드로이드 > 포팅' 카테고리의 다른 글

안드로이드 adb 명령어 리스트  (0) 2013.12.01
안드로이드 settings 데이터 알아보기  (0) 2013.12.01
Android Build System 용어  (0) 2013.10.16
GGLContext 에 대하여  (0) 2013.03.24
pthread_cancel()  (0) 2013.02.04
Posted by code cat
프로그래밍/JAVA2013. 11. 25. 22:12

이제 대충 프로그램이 동작하기 시작한다. 재구조화는 후우...

어쨌든 현재 동작하는 기능은 다음과 같다.

  • OTA Package 정보
  • checksum 생성 및 체크

DB 메뉴까지는 만들었는데 이걸 어떻게 구현할지는 아직 미정이다.

'프로그래밍 > JAVA' 카테고리의 다른 글

Swing desiginer LookAndFeel 종류  (0) 2013.11.19
Java Generics  (0) 2012.10.01
WindowBuilder Pro for Eclipse 3.7(Indigo) 설치 오류  (0) 2012.08.06
ant 빌드가 안될 때  (0) 2011.10.19
Posted by code cat

Encryption은

openssl aes-256-cbc -in input.txt -out output.enc



Decryption은

openssl aes-256-cbc -d -in output.enc -out input.txt

 

 

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

[screen] detached된 세션 죽이기  (0) 2014.02.17
[Makefile] 다른 makefile 포함  (0) 2013.12.30
GDB  (0) 2013.09.24
[Makefile] overriding target 관련 warning 메세지  (0) 2013.09.02
[byobu] vertical line 없애기  (0) 2013.09.01
Posted by code cat
리눅스2013. 11. 25. 08:17

ext4 파일 시스템에 대한 커널 documentation에는 noauto_da_alloc에 대해서 다음과 같이 기술하고 있다.


auto_da_alloc(*)	Many broken applications don't use fsync() when 
noauto_da_alloc		replacing existing files via patterns such as
			fd = open("foo.new")/write(fd,..)/close(fd)/
			rename("foo.new", "foo"), or worse yet,
			fd = open("foo", O_TRUNC)/write(fd,..)/close(fd).
			If auto_da_alloc is enabled, ext4 will detect
			the replace-via-rename and replace-via-truncate
			patterns and force that any delayed allocation
			blocks are allocated such that at the next
			journal commit, in the default data=ordered
			mode, the data blocks of the new file are forced
			to disk before the rename() operation is
			committed.  This provides roughly the same level
			of guarantees as ext3, and avoids the
			"zero-length" problem that can happen when a
			system crashes before the delayed allocation
			blocks are forced to disk.


쉽게 풀어 얘기하자면, rename혹은 truncate같은 operation을 fsync()없이 행했을 경우, auto_da_alloc이 켜져 있으면 data=ordered 모드일 때, 다음 journal commit 시에 강제로 delayed 된 allocation 블럭들을 allocate 한다는 얘기다. (말이 쉽게 풀어 얘기지, 그냥 번역이네..)


따라서 ext3에 있던 "zero-length" 문제(delayed alloction 블럭이 disk에 쓰여지기 전에 시스템이 crash되는 문제)를 해결 할 수 있다.


noauto_da_alloc은 위와 같은 옵션을 꺼버리는 것이다.  이는 퍼포먼스 향상을 가져오지만 위에서 서술한 이점에 대해서는 포기하게 되는 것이다.

Posted by code cat
리눅스2013. 11. 24. 16:51


출처:http://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/writebarr.html

Chapter 16. Write Barriers

write barrier is a kernel mechanism used to ensure that file system metadata is correctly written and ordered on persistent storage, even when storage devices with volatile write caches lose power. File systems with write barriers enabled also ensure that data transmitted via fsync() is persistent throughout a power loss.
Enabling write barriers incurs a substantial performance penalty for some applications. Specifically, applications that use fsync() heavily or create and delete many small files will likely run much slower.

16.1. Importance of Write Barriers

File systems take great care to safely update metadata, ensuring consistency. Journalled file systems bundle metadata updates into transactions and send them to persistent storage in the following manner:
  1. First, the file system sends the body of the transaction to the storage device.
  2. Then, the file system sends a commit block.
  3. If the transaction and its corresponding commit block are written to disk, the file system assumes that the transaction will survive any power failure.
However, file system integrity during power failure becomes more complex for storage devices with extra caches. Storage target devices like local S-ATA or SAS drives may have write caches ranging from 32MB to 64MB in size (with modern drives). Hardware RAID controllers often contain internal write caches. Further, high end arrays, like those from NetApp, IBM, Hitachi and EMC (among others), also have large caches.
Storage devices with write caches report I/O as "complete" when the data is in cache; if the cache loses power, it loses its data as well. Worse, as the cache de-stages to persistent storage, it may change the original metadata ordering. When this occurs, the commit block may be present on disk without having the complete, associated transaction in place. As a result, the journal may replay these uninitialized transaction blocks into the file system during post-power-loss recovery; this will cause data inconsistency and corruption.

How Write Barriers Work

Write barriers are implemented in the Linux kernel via storage write cache flushes before and after the I/O, which isorder-critical. After the transaction is written, the storage cache is flushed, the commit block is written, and the cache is flushed again. This ensures that:
  • The disk contains all the data.
  • No re-ordering has occurred.
With barriers enabled, an fsync() call will also issue a storage cache flush. This guarantees that file data is persistent on disk even if power loss occurs shortly after fsync() returns.


'리눅스' 카테고리의 다른 글

sysroot  (0) 2014.03.14
[EXT4] noauto_da_alloc 옵션에 대해서  (0) 2013.11.25
[Mint Linux] gnome shell emulation  (0) 2012.09.08
우분투 remote 로 접속해서 X 서버 돌리기  (0) 2012.04.17
ext4분석  (0) 2012.04.10
Posted by code cat
프로그래밍/C2013. 11. 24. 00:11

자 아래를 보자

void DLL_PrintNodes(Node* head){

 Node* current;
 current = head;
 int idx = 0;

 while(current->NextNode != NULL) {
  printf("[%d] %d\n", idx++, current->Data);
  current = current->NextNode;
 }
}

 

문제가 보이는가? 실행하면...

 error C2143: 구문 오류 : ';'이(가) '형식' 앞에 없습니다.
 error C2065: 'idx' : 선언되지 않은 식별자입니다.

 

응???

linux에서 gcc 툴체인으로 작업하는 사람들은 위와 같은 반응을 보일텐데...

 

MSDN에서는 다음과 같이 말하고 있다.  C에서는 함수나 블록의 시작점에 지역변수들은 선언되야 하며, 함수가 선언이 아닌 명령어들을 실행하고 나서는 선언이 들어 올 수 없다고...

 

예) 

// C2143j.c
int main() 
{
    int i = 0;
    i++;
    int j = 0; // C2143 에러
}

 

그럼 왜 GCC에서는 괜찮은가? 그건 GCC가 위와 같은 코드를 GNU확장으로 허용하기 때문이다.  만약 ANSI나 C89등에 맞추어서 컴파일 되길 원한다면, -pedantic을 flag로 넘겨주면 된다.

'프로그래밍 > C' 카테고리의 다른 글

함수포인터 & typdef를 이용한 함수포인터  (0) 2014.05.07
ternary operator  (0) 2014.04.13
c precedence table  (0) 2013.11.23
typedef struct 안에서 스스로를 참조 할 때 주의점  (0) 2013.11.19
symbol visibility  (0) 2013.08.07
Posted by code cat
프로그래밍/C2013. 11. 23. 23:29

Level Symbol Description Associativity
1 ++
--
( )
[ ]
->
.
Prefix increment
Prefix decrement
Function call and subexpression
Array subscript
Structure pointer
Structure member
left to right
2 !
~
-
+
(type)
*
&
sizeof
Logical negation
1's complement
Unary negation
Unary plus
Type cast
Pointer dereference
Address of
Size of
right to left
3 *
/
%
Multiplication
Division
Modulus (integer remainder)
left to right
4 +
-
Addition
Subtraction
left to right
5 <<
>>
Bitwise left shift
Bitwise right shift
left to right
6 <
<=
>
>=
Less than
Less than or equal to
Greater than
Greater than or equal to
left to right
7 ==
!=
Equal test
Not equal test
left to right
8 & Bitwise AND left to right
9 ^ Bitwise exclusive OR (XOR) left to right
10 | Bitwise inclusive OR left to right
11 && Logical AND left to right
12 || Logical inclusive OR left to right
13 ?: Conditional test right to left
14 =
+=
-=
*=
/=
%=
<<=
>>=
&=
^=
|
Assignment
Compound add
Compound subtract
Compound multiply
Compound divide
Compound modulus
Compound bitwise left shift
Compound bitwise right shift
Compound bise AND
Compound bitwise exclusive OR
Compound bitwise inclusive OR
right to left
15 ,
++
--
Sequence point (list separator)
Postfix increment
Postfix decrement
left to right

Posted by code cat
프로그래밍/JAVA2013. 11. 19. 23:57

참고사이트: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html#available


SystemLookAndFeel 종류

PlatformLook and Feel
Solaris, Linux with GTK+ 2.2 or laterGTK+
Other Solaris, LinuxMotif
IBM UNIXIBM*
HP UXHP*
Classic WindowsWindows
Windows XPWindows XP
Windows VistaWindows Vista
MacintoshMacintosh*


LookAndFeel 세팅 방법은 다음과 같다.

public static void main(String[] args) {
    try {
            // Set System L&F
        UIManager.setLookAndFeel(
            UIManager.getSystemLookAndFeelClassName());

//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //직접 타이핑해서 넣어도 된다.

} catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } new SwingApplication(); //Create and show the GUI. }


'프로그래밍 > JAVA' 카테고리의 다른 글

OTA Package Utility  (0) 2013.11.25
Java Generics  (0) 2012.10.01
WindowBuilder Pro for Eclipse 3.7(Indigo) 설치 오류  (0) 2012.08.06
ant 빌드가 안될 때  (0) 2011.10.19
Posted by code cat
프로그래밍/C2013. 11. 19. 22:57

typedef struct g_struct {

  int value;

  struct g_struct *next;  //OK

  //gStruct *next  //WRONG!

} gStruct;



알겠지만, 적어도 C에서는 typedef struct 정의 안에서 typedef 된 개체 자체를 reference할 수 없다. 

'프로그래밍 > C' 카테고리의 다른 글

[visual studio] 에러 C2143 로컬변수 선언 위치  (0) 2013.11.24
c precedence table  (0) 2013.11.23
symbol visibility  (0) 2013.08.07
typedef 와 static 을 동시에 사용 못하는 이유  (0) 2012.11.24
인라인 어셈블리  (0) 2012.09.25
Posted by code cat