2015년 10월 3일 토요일

Write to NTFS on Mac OS

1. csrutil disable:
To enable writing to /sbin you need to run curtail disable in a recovery mode terminal. csrutil enable will re-lock the system directories.
To get to recovery mode you can hold command+R during the boot process, and you can run a terminal from the menu.

2. Install the latest version of osxfuse:
Get the latest osxfuse dmg from github https://github.com/osxfuse/osxfuse/releases, and install it.

3. Install rtfs-3g:
 1) Install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 2) Update Homebrew formulae:
brew update
 3) Install ntfs-3g:
brew install rtfs-3g

4. Create a symlink for mount_nfs:
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/Cellar/ntfs-3g/2015.3.14/sbin/mount_ntfs

5. Reboot:

6. csrutil enable:

2015년 1월 28일 수요일

Using SQLite Browser in Android Studio

1. Go to:
https://code.google.com/p/android-sqlite-browser-for-eclipse/wiki/HowTo

2. Download Android_SQLiteBrowser_x.x.x.jar

3. Move the downloaded jar file to [Android SDK folder]/tools/lib/monitor-x86_64/plugins/

4. Restart Android Device Monitor

2014년 11월 2일 일요일

Eclipse Navigation Shortcuts

Windows shortcut (Mac shortcut)

1. Ctrl+Shift+R (Command+Shift+R): Open Resource

2. Ctrl+Shift+T (Command+Shift+T): Open Type

3. Ctrl+O (Command+O): Show inherited members

4. Ctrl+L (Command+L): Go to line

5. Ctrl+Q: Go to the last edit location

6. Ctrl+T (Command+T): Go to supertype/subtype

7. Ctrl+E (Command+E): Go to open other editors

8. Ctrl+. (Command+.): Move to the next problem in a file

9. F3 (Fn+F3) or hold Ctrl (Command) down and click the hyperlink: Go to a type declaration

10. Alt+←,  Alt+→ (Command+Alt+←, Command+Alt+→): Go back and forth through files you visited

11. Ctrl+H (Ctrl+H): Search

2014년 9월 13일 토요일

Java does NOT support unsigned type.

ref: http://www.gotw.ca/publications/c_family_interview.htm

You can find the reason why Java does not include unsigned type in the Gosling's comment in the interview with Dennis Ritchie, Bjarne Stroustrup,  and James Gosling:

Gosling: For me as a language designer, which I don't really count myself as these days, what "simple" really ended up meaning was could I expect J. Random Developer to hold the spec in his head. That definition says that, for instance, Java isn't -- and in fact a lot of these languages end up with a lot of corner cases, things that nobody really understands. Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.

Failed to load the JNI shared library jvm.dll

ref: http://wiki.eclipse.org/Eclipse.ini

Eclipse may fail to start saying "Failed to load the JNI shared library C:\Program Files ...\jvm.dll."
When this error occurs, you should check the OS, JDK, and Eclipse. The working pairings of OS, JDK, and Eclipse are:

  • 32bit OS - 32bit JDK - 32bit Eclipse
  • 64bit OS - 64bit JDK - 64bit Eclipse
  • 64bit OS - 32bit JDK - 32bit Eclipse

2014년 5월 29일 목요일

Conversion between Uri and file path

1. Conversion of Uri to file path
public String getPathFromUri(Uri uri){
Cursor cursor = getContentResolver().query(uri, null, null, null, null );
cursor.moveToNext(); 
String path = cursor.getString( cursor.getColumnIndex( "_data" ) );
cursor.close();

return path;
}

2. Conversion of file path to Uri
public Uri getUriFromPath(String path)
String fileName= "file:///sdcard/DCIM/Camera/2013_07_07_12345.jpg";
Uri fileUri = Uri.parse( fileName );
String filePath = fileUri.getPath();
Cursor c = getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, 
null, "_data = '" + filePath + "'", null, null );
cursor.moveToNext()
int id = cursor.getInt( cursor.getColumnIndex( "_id" ) );
Uri uri = ContentUris.withAppendedId( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id );

return uri;
}

2014년 5월 7일 수요일

vi Commands

General Startup
 To use vi: vi filename
 To exit vi and save changes: ZZ   or  :wq
 To exit vi without saving changes: :q!
 To enter vi command mode: [esc]

Counts
  A number preceding any vi command tells vi to repeat that command
 that many times.

Cursor Movement
  h   move left (backspace)
  j   move down
  k   move up
  l   move right (spacebar)
  [return]   move to the beginning of the next line
  $   last column on the current line
  0   move cursor to the first column on the current line
  ^   move cursor to first nonblank column on the current line
  w   move to the beginning of the next word or punctuation mark
  W   move past the next space
  b   move to the beginning of the previous word or punctuation mark
  B   move to the beginning of the previous word, ignores punctuation
  e   end of next word or punctuation mark
  E   end of next word, ignoring punctuation
  H   move cursor to the top of the screen
  M   move cursor to the middle of the screen
  L   move cursor to the bottom of the screen

Screen Movement
  G   move to the last line in the file
  xG  move to line x
  z+  move current line to top of screen
  z   move current line to the middle of screen
  z-  move current line to the bottom of screen
  ^F  move forward one screen
  ^B  move backward one line
  ^D  move forward one half screen
  ^U  move backward one half screen
  ^R  redraw screen (does not work with VT100 type terminals)
  ^L  redraw screen (does not work with Televideo terminals)

Inserting
  r   replace character under cursor with next character typed
  R   keep replacing character until [esc] is hit
  i   insert before cursor
  a   append after cursor
  A   append at end of line
  O   open line above cursor and enter append mode

Deleting
  x   delete character under cursor
  dd  delete line under cursor
  dw  delete word under cursor
  db  delete word before cursor

Copying Code
  yy  (yank)'copies' line which may then be put by the p(put)
     command. Precede with a count for multiple lines.

Put Command
  brings back previous deletion or yank of lines, words, or
 characters
  P   bring back before cursor
  p   bring back after cursor

Find Commands
  ?   finds a word going backwards
  /   finds a word going forwards
  f   finds a character on the line under the cursor going forward
  F   finds a character on the line under the cursor going backwards
  t   find a character on the current line going forward and stop one
     character before it
  T   find a character on the current line going backward and stop
     one character before it
  ;   repeat last f, F, t, T

Miscellaneous Commands
  .   repeat last command
  u   undoes last command issued
  U   undoes all commands on one line
  xp  deletes first character and inserts after second (swap)
  J   join current line with the next line
  ^G  display current line number
  %   if at one parenthesis, will jump to its mate
  mx  mark current line with character x
  'x  find line marked with character x
  NOTE: Marks are internal and not written to the file.

Line Editor Mode
  Any commands form the line editor ex can be issued upon entering
 line mode.
  To enter: type ':'
  To exit: press[return] or [esc]

ex Commands
  For a complete list consult the UNIX Programmer's Manual

READING FILES
  copies (reads) filename after cursor in file currently editing
  :r  filename

WRITE FILE
  :w  saves the current file without quitting

MOVING
  :#  move to line #
  :$  move to last line of file

SHELL ESCAPE
  executes 'cmd' as a shell command.
  :!'cmd'

Installing MySQL on Mac

ref: http://hoyanet.pe.kr/1942