Nov 19, 2012

PostgreSQL, Rails and Heroku

rails new blog -d postgresql

Aug 7, 2012

The performance of SAMSUNG 830 Series 2.5-Inch 256GB on Mountain Lion

Here is the result from Xbench:


Results 565.10
System Info
Xbench Version 1.3
System Version 10.8 (12A269)
Physical RAM 8192 MB
Model MacBookPro8,2
Drive Type SAMSUNG SSD 830 Series
Disk Test 565.10
Sequential 374.59
Uncached Write 593.36 364.31 MB/sec [4K blocks]
Uncached Write 598.18 338.45 MB/sec [256K blocks]
Uncached Read 164.58 48.17 MB/sec [4K blocks]
Uncached Read 803.01 403.59 MB/sec [256K blocks]
Random 1149.93
Uncached Write 847.69 89.74 MB/sec [4K blocks]
Uncached Write 967.11 309.61 MB/sec [256K blocks]
Uncached Read 2547.83 18.05 MB/sec [4K blocks]
Uncached Read 1146.40 212.72 MB/sec [256K blocks]


After trim enabler:


Results 563.27
System Info
Xbench Version 1.3
System Version 10.8 (12A269)
Physical RAM 8192 MB
Model MacBookPro8,2
Drive Type SAMSUNG SSD 830 Series
Disk Test 563.27
Sequential 373.48
Uncached Write 583.23 358.09 MB/sec [4K blocks]
Uncached Write 596.24 337.35 MB/sec [256K blocks]
Uncached Read 164.58 48.17 MB/sec [4K blocks]
Uncached Read 804.85 404.51 MB/sec [256K blocks]
Random 1145.28
Uncached Write 1268.14 134.25 MB/sec [4K blocks]
Uncached Write 705.85 225.97 MB/sec [256K blocks]
Uncached Read 2562.21 18.16 MB/sec [4K blocks]
Uncached Read 1114.80 206.86 MB/sec [256K blocks]


Almost the same, as expected.

Apr 25, 2012

HOWTO: use pathogen to manage vim plugins

I am now using pathogen and GitHub to manage my vim plugins.
They are not difficult to use, but you need a few git commands to set it up, which I found very annoying.

To init .vim folder in Linux (or vimfiles for Windows), type:


mkdir .vim
cd .vim
git init
wget https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim -P ~/.vim/autoload
git add .
git commit -m 'initial commit'


To install each vim plugin, type: (here I use neocomplcache-snippets-complete as an example)


git submodule add https://github.com/Shougo/neocomplcache-snippets-complete.git bundle/neocomplacahe-snippets-complete
git add .gitmodules bundle/neocomplcache-snippets-complete
git submodule init



Apr 16, 2012

iOS errors


/* FoundationErrors.h
Copyright (c) 2004-2011, Apple Inc. All rights reserved.
*/

#import <Foundation/NSObject.h>

/* NSError codes in NSCocoaErrorDomain. Note that other frameworks (such as AppKit and CoreData) also provide additional NSCocoaErrorDomain error codes.
*/
enum {
    // File system and file I/O related errors, with NSFilePathErrorKey or NSURLErrorKey containing path or URL
    NSFileNoSuchFileError = 4,     // Attempt to do a file system operation on a non-existent file
    NSFileLockingError = 255,     // Couldn't get a lock on file
    NSFileReadUnknownError = 256,                           // Read error (reason unknown)
    NSFileReadNoPermissionError = 257,                      // Read error (permission problem)
    NSFileReadInvalidFileNameError = 258,                   // Read error (invalid file name)
    NSFileReadCorruptFileError = 259,                       // Read error (file corrupt, bad format, etc)
    NSFileReadNoSuchFileError = 260,                        // Read error (no such file)
    NSFileReadInapplicableStringEncodingError = 261,        // Read error (string encoding not applicable) also NSStringEncodingErrorKey
    NSFileReadUnsupportedSchemeError = 262,     // Read error (unsupported URL scheme)
#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    NSFileReadTooLargeError = 263,     // Read error (file too large)
    NSFileReadUnknownStringEncodingError = 264,     // Read error (string encoding of file contents could not be determined)
#endif /* MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED */
    NSFileWriteUnknownError = 512,     // Write error (reason unknown)
    NSFileWriteNoPermissionError = 513,                     // Write error (permission problem)
    NSFileWriteInvalidFileNameError = 514,                  // Write error (invalid file name)
#if MAC_OS_X_VERSION_10_7 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    NSFileWriteFileExistsError = 516,     // Write error (file exists)
#endif
    NSFileWriteInapplicableStringEncodingError = 517,       // Write error (string encoding not applicable) also NSStringEncodingErrorKey
    NSFileWriteUnsupportedSchemeError = 518,     // Write error (unsupported URL scheme)
    NSFileWriteOutOfSpaceError = 640,                       // Write error (out of disk space)
#if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    NSFileWriteVolumeReadOnlyError = 642,     // Write error (readonly volume)
#endif

    // Other errors
    NSKeyValueValidationError = 1024,                       // KVC validation error
    NSFormattingError = 2048,                               // Formatting error
    NSUserCancelledError = 3072,     // User cancelled operation (this one often doesn't deserve a panel and might be a good one to special case)
    
#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    // Executable loading errors
    NSExecutableNotLoadableError = 3584,                    // Executable is of a type that is not loadable in the current process
    NSExecutableArchitectureMismatchError = 3585,           // Executable does not provide an architecture compatible with the current process
    NSExecutableRuntimeMismatchError = 3586,                // Executable has Objective C runtime information incompatible with the current process
    NSExecutableLoadError = 3587,                           // Executable cannot be loaded for some other reason, such as a problem with a library it depends on
    NSExecutableLinkError = 3588,                           // Executable fails due to linking issues
#endif /* MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED */
    
    // Inclusive error range definitions, for checking future error codes
    NSFileErrorMinimum = 0,
    NSFileErrorMaximum = 1023,
    
    NSValidationErrorMinimum = 1024,
    NSValidationErrorMaximum = 2047,

#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    NSExecutableErrorMinimum = 3584,
    NSExecutableErrorMaximum = 3839,
#endif /* MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED */

    NSFormattingErrorMinimum = 2048,
    NSFormattingErrorMaximum = 2559,
    
#if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
    NSPropertyListReadCorruptError = 3840,                  // Error parsing a property list
    NSPropertyListReadUnknownVersionError = 3841,           // The version number in the property list is unknown
    NSPropertyListReadStreamError = 3842,                   // Stream error reading a property list
    NSPropertyListWriteStreamError = 3851,                  // Stream error writing a property list

    NSPropertyListErrorMinimum = 3840,
    NSPropertyListErrorMaximum = 4095
#endif /* MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED */
    
};

Apr 13, 2012

How To: Install TouchXML for ios

1. download TouchXML from github
2. add the sources to your project
3. In project->build settings->header search paths:
add /usr/include/libxml2
4. In project->targets->build phases->link library with binaries:
add "libxml2.2.7.3.dylib"

Mar 30, 2012

How To: Install lxml on Ubuntu

sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python2.6-dev
easy_install --allow-hosts=lxml.de,*.python.org lxml

List of commands for MySql and Django


mysqladmin.exe -u root -p create myapp
python manage.py syncdb
mysql -u root -p
sudo /etc/init.d/apache2 restart

 
TEMPLATE HACKS AND TWEAKS BY [ METAMUSE ] BLACKCAT 1.1
/scripts/shBrushJScript.js'/>