Friday, October 25, 2013

Phonegap Installation with plugins

Used to installe it with PhoneGap 3.0 version, but problem happens, the plugins can be downloaded but not working at all. Give it a try again today, seems all working fine now.

3.1.0

Follow this guide

http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html

Sample to use Camera

http://docs.phonegap.com/en/2.4.0/cordova_camera_camera.md.html


Some commands updated on 3.1

phonegap local plugin list

phonegap local plugin remove org.apache.cordova.dialogs


phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git

Tuesday, July 2, 2013

BB10 debug log


t is documented, it's just not obvious.

It's mentioned in the release notes as the first item under Known Limitations.


The qDebug() function
  • In this release, the qDebug() function does not work the same way as it did in previous releases. Previously, when you used this function in your JavaScript/QML code, the function sent the debug information to the console, and you could view the information in the Console view in the IDE. Now, this function does not send output to the console. Instead, this function sends debug information to the slogger2 log.

    To see debug information that is output from qDebug(), you need to access the slogger2 logs as follows:

    1. In the IDE, in the Target Navigator view, right-click the device target. Click Launch SSH Session.
    2. In the terminal that appears, do one of the following:
         a. To view the current slogger2 logs, type slog2info.
         b. To view real-time output for the processes that are being debugged (for applications that are running in development mode), type slog2info -w.
         c. To view help information on slogger2, type slog2info -h.

    You can also access the log files directly in the /tmp/slogger22 on the device and run these logs through slog2info at a later time.

Tuesday, April 30, 2013

what is a csr file

In public key infrastructure (PKI) systems, a certificate signing request (also CSR or certification request) is a message sent from an applicant to a certificate authority in order to apply for adigital identity certificate. The most common format for CSRs is the PKCS#10 specification and another is the Signed Public Key and Challenge Spkac format generated by some web browsers.

You may display the information contained in csr


openssl req -text -in request.csr



Actually PKCS #12 is the successor to Microsoft's "PFX".[6] But confusingly the terms "PKCS #12 file" and "PFX file" are sometimes used interchangeably.[4] [5] [7]
Microsoft's "PFX" has received heavy criticism of being one of the most complex cryptographic protocols.[7]

Many different file types are produced and consumed when creating an SSL certificate.
  • .csr file is a certificate signing request which initiates your certificate request with a certificate provider and contains administrative information about your organization.
  • .key file is the private key used for your site’s SSL-enabled requests.
  • .pem and .crt extensions are often used interchangeably and are both base64 ASCII encoded files. The technical difference is that .pem files contain both the certificate and key whereas a .crt file only contains the certificate. In reality this distinction is often ignored.
  • .cer - certificate stored in the X.509 standard format. This certificate contains information about the certificate's owner... along with public and private keys.
    .pvk - files are used to store private keys for code signing. You can also create a certificate based on .pvk private key file.
    .pfx - stands for personal exchange format. It is used to exchange public and private objects in a single file. A pfx file can be created from .cer file. Can also be used to create a Software Publisher Certificate.

Export private key pem from p12

openssl pkcs12 -nocerts -out private_key.pem -in abc.p12
Export public key pem from p12
openssl pkcs12 -in abc.p12 -out myPublicKey.pem -clcerts -nokeys

KISS - keep it simple or stupid

Design pattern is abused using everywhere now, and KISS is not mentioned recently.


List of software development philosophies

From Wikipedia, the free encyclopedia
This is a list of approaches, styles, and philosophies in software development. It contains also software development processessoftware development methodologies and single practices, principles and laws.

Monday, April 29, 2013

xcode ant build


        Compiling...
failonerror="true">



An XCode build from the command line looks like:
xcodebuild -configuration ${BUILD_TYPE} -target ${TARGET_NAME} -arch ${CPU_ARCHITECTURE} -sdk ${SIMULATOR_OR_IOS_SDK} 
BUILD_TYPE is something like "Release" or "Debug" (those are the defaults, you may have added others to the project)
TARGET_NAME is the name of the target you are building (by default the same name as your project)
CPU_ARCHITECTURE is the CPU you are building for, one of:
i386armv6armv7
Use i386 for simulator builds, and use either armv6 or armv7 for device builds - note that some other devices cannot run armv7 code, so usually when building libraries it's a good idea to build all of these architectures and then glue them together using lipo.
SIMULATOR_OR_IOS_SDK is what you are looking for, it's either iphoneos or iphonesimulator. Those values use the latest version of the SDK that the installed XCode supports, you can get a list of supported SDK's with:
xcodebuild -showsdks
Which returns a list like:
Mac OS X SDKs:
    Current Mac OS                  -sdk 
    Mac OS X 10.6                   -sdk macosx10.6

iOS SDKs:
    iOS 4.2                         -sdk iphoneos4.2

iOS Simulator SDKs:
    Simulator - iOS 3.2             -sdk iphonesimulator3.2
    Simulator - iOS 4.0             -sdk iphonesimulator4.0
    Simulator - iOS 4.1             -sdk iphonesimulator4.1
    Simulator - iOS 4.2             -sdk iphonesimulator4.2
xcodebuild has more flags than that, but those are the ones you'd commonly use after using XCode to set up the build properties. You don't have to use all of them, but it's probably a good idea to be clear about what you are building - otherwise I believe your last settings are used.


Thursday, March 28, 2013

interview


Preparing for Your Interview
 we’re looking for talented engineers that can apply the knowledge that they’ve learned in school and in industry to solving some of the world’s most complicated software problems.  As such, our interviews are mainly focused on how well you can use your acquired knowledge to solve real world (or in some cases not so real world) problems.  Below is a list of broad areas that we expect people to be familiar with.  It’s certainly not required that you memorize all of the information outlined below, but this should serve as a helpful reference guide for the types of things you might want to brush up on before interviewing.
Programming Languages
We do not require that you know any specific language before interviewing for a technical position, but familiarity with a prominent object oriented language is generally a prerequisite for success.  Not only should you be familiar with the syntax of a language like C++, Java, or C#, you should also know some of the language nuances such as how memory management works, what some of the most commonly used collections or libraries are, etc.  You should be able to compare languages and talk about the tradeoffs between using language X vs. language Y.
Additionally, it’s considered a plus to be familiar with some scripting language such as perl, ruby, awk, etc.  It’s also nice to know the basics of regular expression as they are now a mainstay in both the object oriented and scripting worlds.
Here is a good site talking about regular expression with examples
http://www.regular-expressions.info/index.html

Data Structures
Most of the work we do involves storing and providing access to data in efficient ways.  This necessitates a very strong background in standard data structures.  You should know what each of these data structures is and how they’re implemented; what their runtimes are for common operations; and under what circumstances it would be beneficial to use one.  The below are in no particular order.
Here is a good link 
http://en.wikibooks.org/wiki/Data_Structures
Array
Linked List
Tree (Tree, Binary Tree, Binary Search Tree, Red-Black Tree, etc.)
Heap
Hash Table
Stack
Queue
Trie
Graph (both directed and undirected)
Algorithms
It’s also important to know efficient ways manipulate data.  One great way of doing this is brushing up on some common algorithms.  We’ll expect that you can apply and discuss the tradeoffs between some commonly used algorithms.
Sorting
Bubble Sort
Merge Sort
Quick Sort
Radix/Bucket Sort
Traversals (On multiple data structures)
                Depth First Search
                Breadth First Search
Coding
Expect to be asked to code syntactically correct code – no pseudo code.  If you’re a bit rusty coding without an IDE or coding in a specific language, it’s probably a good idea to dust off the cobwebs and get comfortable coding with pen and paper.  The most important thing a software engineer does is write performant, stable, robust, and well tested code.  These are going to be the main criteria by which your code will be evaluated, so make sure that you check for edge cases and common error inputs as well as the “happy paths” through the code.
Object Oriented Design
Good design is paramount to extensible, bug free, and long living code.  It’s possible to solve a software problem in an almost limitless number of ways, but when software needs to be robust and extensible, it’s important to know some common techniques that help with this.  Using object oriented design best practices is one way to build lasting software.  You should have a working knowledge of a few common and useful design patterns (singleton, factory, adapter, bridge, visitor, command, proxy, observer, etc.) as well as know how to write software in an object oriented way with appropriate use of inheritance and aggregation.
Databases
Most of the software that we write is backed by a database somewhere.  A lot of the challenges we face come in to play when interfacing with existing data models and when designing new data models.  You should know the basics of how relational databases work, how to design relational database schemas, as well as how to write basic SQL queries against a database.
Distributed Computing
Our systems usually have to work under very strict tolerances at high load.  While we have some internal tools that help us with scaling it’s important to have an understanding of a few basic distributed computing concepts.  Having an understanding of topics such as map-reduce, service oriented architectures, distributed caching, load balancing, etc. will help you in formulating answers to some of the more complicated distributed architecture questions you might encounter.
Internet Topics
we’re an online company and we expect our engineers to be familiar with, at least, the basics of how the internet works.  You might want to brush up on how internet browsers do what they do, DNS lookups, what TCP/IP and HTTP are, sockets, etc.  We’re not looking for network engineering types of qualifications, but a solid understanding of the fundamentals of how the web works is a requirement.
Operating Systems
You won’t need to know how to build your own operating system, but you should be familiar with some OS topics that can affect code performance, such as memory management, processes, threads, synchronization, paging, multithreading, deadlocks (causes, detection, avoidance).


Tuesday, March 26, 2013

keystore, pem, p12


You can extract a private key from a keystore with Java6 and OpenSSL. This all depends on the fact that both Java and OpenSSL support PKCS#12-formatted keystores. To do the extraction, you first usekeytool to convert to the standard format. Make sure you use the same password for both files (private key password, not the keystore password) or you will get odd failures later on in the second step.
keytool -importkeystore -srckeystore keystore.jks \
    -destkeystore intermediate.p12 -deststoretype PKCS12
Next, use OpenSSL to do the extraction to PEM:
openssl pkcs12 -in intermediate.p12 -out extracted.pem -nodes
You should be able to handle that PEM file easily enough; it's plain text with an encoded unencrypted private key and certificate(s) inside it (in a pretty obvious format).

export private key:
keytool.exe -importkeystore -srcstoretype JKS -srckeystore my-release-key.keystore -deststoretype PKCS12 -destkeystore keys.pk12.der
openssl.exe pkcs12 -in keys.pk12.der -nodes -out private.rsa.pem
edit private.rsa.pem and leave "-----BEGIN PRIVATE KEY-----" to "-----END PRIVATE KEY-----" paragraph, then:
openssl.exe base64 -d -in private.rsa.pem -out private.rsa.der
export public key:
keytool.exe -exportcert -keystore my-release-key.keystore -storepass <KEYSTORE_PASSWORD> -alias alias_name -file public.x509.der
sign apk:
java -jar SignApk.jar public.x509.der private.rsa.der input.apk output.apk