Thursday, March 31, 2016

Operating systems topics


Process, thread differences, PCB, TCB concepts

Deadlocks, scheduling, context switching

Virtual memory, physical memory, paging

Data sections (Text section, data section, BSS, Stack, Heap etc..) – Linker, Compiler jobs
Interrupts, polling, DMA etc..

Memory management, best fit, first fit etc...,

Processors and bus widths (data and address sizes)

Software engineering topics

basic definitions of CMM levels

Software Dev Life Cycle (SDLC) steps (requirements, design, implementation testing etc..)
Water fall, prototype, Iterative

basics of OO concepts (inheritance, encapsulation, asociation, aggregation polymorphism etc..)

Tools used for various phases of SDLC (static, run time analysis tools etc..)

Different kinds of testing (block-box, white-box, unit testing, integration testing etc..)

Tuesday, March 15, 2016

Android Testing

  • JUnit 4 framework and tools provided by Google
Local Unit Tests
  • These tests are compiled to run locally on the Java Virtual Machine (JVM) to minimize execution time. Use this approach to run unit tests that have no dependencies on the Android framework.
Instrumented Tests
  • runs on an Android device or emulator.
  • can be used for unit, user interface (UI), or app component integration testing.
  1. Building Instrumented Unit Tests: 
  2. Automating User Interface Tests:
    • Testing UI for a Single App
    • Testing UI for Multiple Apps
  3. Testing App Component Integrations: Verify components such as Service, Content Provider

Espresso:  UI testing frameworks, allows you to programmatically simulate user actions and test complex intra-app user interactions.
  • can run on devices running Android 2.2 (API level 8) and higher.

Mockito: 




Friday, March 11, 2016

Graph - Update In Progress

Dijkstra's algorithm:
  • solves the single-source shortest-paths problem in edge-weighted digraphs with non-negative weights using extra space proportional to V and time proportional to E log V (in the worst case).
DAG: (acyclic edge-weighted digraph)
  1. Single-source shortest paths: O(E + V)
    • solves the single-source problem in linear time.
    • handles negative edge weights.
  2. Single-source longest paths: O(E + V)
Shortest paths in general edge-weighted digraphs:
  • the concept of a shortest path is meaningless if there is a negative cycle.
 Bellman-Ford:
  • solves the single-source shortest-paths problem from a given source s
  • finds a negative cycle reachable from s
  • time proportional to E V and extra space proportional to V
 Floyd-Warshall algorithm:
  • Solve all-pairs shortest path problem.
  • Time proportional to V^3 and space proportional to V^2
MST(minimum spanning tree)
  • A MST of an edge-weighted graph is a spanning tree whose weight (the sum of the weights of its edges) is no larger than the weight of any other spanning tree.

Thursday, March 10, 2016

RxJava/ RxAndroid

  • Sample Code sample which replaces AsyncTaskLoader to load db data
SampleCode
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    private void loadDBData() {
        Observable.defer(new Func0<Observable<List<String>>>() {
            @Override
            public Observable<List<String>> call() {
                Log.d(TAG, "call " + Thread.currentThread().getName());
                List<String> stringList = DBHelperUtil.getPasswordEntries();

                return Observable.just(stringList);
            }
        })
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(this);

    }

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@Override
public void onCompleted() {
}

@Override
public void onError(Throwable e) {
}

@Override
public void onNext(List<String> strings) {
}

Tuesday, March 8, 2016

Wednesday, March 2, 2016

Securely store user credentials

  • security is always a problem with rooted devices. 
  • always use encryption to store user’s credentials like User-name/Email Id or passwords
  • AES Encyption can be done using below java packages
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

Ex: To Be Updated... 

Tuesday, March 1, 2016

Popular Opensources used in Android

 

HTTP client vs HttpUrlConnection

Android provides two HTTP clients to perform network operations.
  1. Apache HTTP client
  2. HttpUrlConnection
Apache HTTP client
  • Large and extensive API's
  • Supports cookie handling, authentication and connection management
  • Suitable for web browser and other web applications
  • Does not support HttpResponseCache mechanism, hence leading to increased network usage and battery consumption
HttpURLConnection
  • Light weight HTTP client
  • Suitable for mobile applications
  • Response caching reduce network use, improve speed and save battery.
  • HttpURLConnection supported in Android from GB.
  • HttpURLConnection is the best choice for Android.