Browse Category: Uncategorized

Convert String to PrivateKey

Below code works to convert string to PrivateKey

public static class DecryptionUtil {
    private static final String ASYMMETRIC_ALGO =

    public static byte[] decryptUsingPrivateKey(PrivateKey privateKey, byte[] data)
            throws IOException, GeneralSecurityException {
        Cipher pkCipher = Cipher.getInstance(ASYMMETRIC_ALGO);
        pkCipher.init(Cipher.DECRYPT_MODE, privateKey);
        return pkCipher.doFinal(data);

    public static byte[] decryptUsingSymmetricKey(byte[] symmetricKey, byte[]
            data) throws InvalidCipherTextException {
        PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new
                AESEngine(), new PKCS7Padding());
        cipher.init(false, new KeyParameter(symmetricKey));
        int outputSize = cipher.getOutputSize(data.length);
        byte[] tempOP = new byte[outputSize];
        int processLen = cipher.processBytes(data, 0, data.length, tempOP, 0);
        int outputLen = cipher.doFinal(tempOP, processLen);
        byte[] result = new byte[processLen + outputLen];
        System.arraycopy(tempOP, 0, result, 0, result.length);
        return result;

public static PrivateKey getPrivateKey(String privateString) {

    PrivateKey privateKey = null;

    try {
       // String privateString = getString(key, context);
            byte[] binCpk = Base64.decode(privateString,Base64.DEFAULT);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA","BC");
            PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(binCpk);
            privateKey = keyFactory.generatePrivate(privateKeySpec);

    catch(Exception e){
        String r="";
    return privateKey;

How to Become a Great UI, UX Designer in 5 Easy Steps.

1. Know the basic abilities & responsibilities of UX/UI designers

Almost everyone can become a UX/UI designer by self-taught or training course. However, when it comes to how to become an excellent UX/UI designer, it requires not only basic design capabilities but also some necessary abilities, including the ability of logical thinking, data analysis, empathy, communication, observation and agile execution, etc. To get to know the designer’s responsibilities and skills is the first and foremost thing to some degree.

2. Capture the eyes and heart of your users

Be a UX or UI designer, the final deliverable needs to capture the user’s heart. If a user doesn’t have the desire to use the product, there is no user experience at all, not to mention the user engagement and conversion. For UI designer, it needs to focus on the beauty of the design work; while for UX designer, it needs to care about the user’s demands and product functionalities. Just like an old saying goes that “Practice makes perfect”, to become an excellent UX designer or UI designer requires continuous efforts.

3. Be concerned about the UX/UI design trends

Many job seekers who want to step into the UX/UI design industry will be asked about “how do they think about the current UX/UI design trend” and some other similar questions during the interview. To keep updated with the newest UX/UI design trends can make your design work outstanding and meanwhile let you become a UX design expert.

4. Be proficient in certain design tool

Not a few beginners have their own ideas, innovations, and indulgences, while they tend to ignore the proficiency of design software tool. Undoubtedly, the design tool can be a great helper for designers, and it’s required to make simple icons/pictures in the interview to test the basic design skills of candidates. Below are some tools recommended for those want to become a UI design expert:

  •  Adobe Photoshop:-  A raster graphics editing tool
  •  Adobe Illustrator:-  An vector drawing tool


ERP Software Testing

Testing the ERP (e.g SAP) software application is different than testing the other software applications. ERP applications are domain specific and industry-specific. The common modules like Finance, Accounting, Inventory, Fixed Asset, Sales, Purchase, Human Capital, and Payroll are available in all the ERP systems.

Apart from these common modules, few industrial specific modules are available as per the targeted customers. For example, a “manufacturing ERP” may have a “production planning” module, a “pharma ERP” may have a “doctor-patient” module and an “education ERP” may have a “student” module and so on.

So we can take a example of One Module.

Test Scenario: Find below a sample ERP demonstration.

Module Sales & Distribution
Feature Sales Order Process
Objective To check the sales order is booked and invoiced with proper data entered for sales header and sales details.
Steps to Reproduce 1. Sales & Distribution -> Order Management -> Sales Order List -> New Sales Order.
2. Select Order Date, Select Order Type, Select the Expiry Date, Select Customer ID, Select Shipping ID, Select Warehouse ID, Select Shipping Date, Select Payment Due Date, Select Sales Tax ID, Select Salesman ID.
3. Select New Sales Items and Select Item ID, Select Item UOM, Enter Item Qty, Enter Item Price, Select Ledger Account, Select Project ID and Click OK.
4. Click Book Order button in the main screen.
Input Data
Order Date (01/01/2015), Order Type (Sales Order), Expiry Date (31/09/2015), Customer ID (SABIC), Shipping ID (FedEx), Warehouse ID (NaviMumbaiWH), Shipping Date (03/02/2015), Select Payment Due Date (28/02/2015), Sales Tax ID (ST929), Salesman ID (Anand), Item ID (PolyPropylene), Item UOM (Kilograms), Item Qty (1000), Ledger Account (23499949), Project ID (DueTarget2015)
Input Data
Order Date (01/01/2016), Order Type (Purchase Order), Expiry Date (31/09/2012), Customer ID (DEFAULT), Shipping ID (Blank), Warehouse ID (Blank), Shipping Date (03/02/2013), Select Payment Due Date (28/02/2012), Sales Tax ID (Blank), Salesman ID (DEFAULT), Item ID (DEFAULT), Item UOM (Blank), Item Qty (0), Ledger Account (DEFAULT), Project ID (DEFAULT)
Expected Results
1. Order should be booked and invoiced.
2. Picking Packing slip should be generated.
3. Shipping Order should be generated.
4. General Ledger transactions should be posted.
5. Inventory Ledger should be updated.
6. Debit Memo should be generated.
7. Email should be sent to the Customer and Stores.
Expected Results
• Alert box should be coming for each negative data input as per the alert process and the defined text.
• Sales order should be backordered, if the items are out of stock.
• Sales order should be on hold, if the customer credit limit is low.

A/B Testing Marketing cloud

 A/B Testing Marketing Cloud

 Why A/B Testing :-

We use standard A/B testing to determine which version of your email(Or a subject line)receives the highest click-through rate or highest unique open rate. On the basis of that, we sends the best performing version to the remaining subscribers or Data Extentions.

  • You can test the following elements:
  • Test Type            Description
  1. Subject Line:                     Create two different subject lines and track which email send                                                                                             performs better. Each subject line has a 256 character limit.
  2. Email:                                Select two different emails and track which email send performs                                                                                       better.
  3. Content area:                    Select an email that contains at least two different content areas and                                                                               track which content area performs better.
  4. From Name:                     Create two different from names and track which email send                                                                                             performs better. You can select an existing from name in your account,                                                                           or manually enter a from name to use. To add additional from name                                                                               Select two different dates and/or times to send and track which time                                                                               options to your account, create an additional user.
  5. Send Time:                        performs better.
  6. Preheaders:                     Create two different preheaders and track which preheader performs                                                                  better.


  • IF Tie Happens :

If your A/B Test results in a tie, the system declares Condition A the winner. You can edit the winner criteria to see if one condition performed better than the other using a different winner criteria.

For example, if you ran your test by the highest open rate and your test results in a tie, you can edit the winner criteria to use highest click-through rate.

Or, if you ran your test by the highest open rate and Condition B had a significantly higher click-through rate than Condition A had an open rate, you can edit the winner criteria in order to send Condition B.  You will be able to make this change only if you scheduled the remainder to send at a later time.

  • WE Can Save the Winning Subject Line :

When running a subject line A/B test, you have the option to have the winning subject line save back to the original email. You configure this in the Winner stage of the test creation process.

Different Processes of A/B testing and Useful links.

Following link contain steps to create those processes.

  1. Configure A/B Test

  1. Duplicate A/B Test

  1. Edit A/B Test

  1. Track A/B Test

  1. Cancel A/B Test

Firebase JobDispatcher

The Firebase JobDispatcher is a library for scheduling background jobs in your Android app. It provides a JobScheduler-compatible API that works on all recent versions of Android (API level 9+) that have Google Play services installed.


What’s a JobScheduler?

The JobScheduler is an Android system service available on API levels 21 (Lollipop)+. It provides an API for scheduling units of work (represented by JobService subclasses) that will be executed in your app’s process.

Why is this better than background services and listening for system broadcasts?

Running apps in the background is expensive, which is especially harmful when they’re not actively doing work that’s important to the user. That problem is multiplied when those background services are listening for frequently sent broadcasts ( and android.hardware.action.NEW_PICTURE are common examples). Even worse, there’s no way of specifying prerequisites for these broadcasts. Listening for CONNECTIVITY_CHANGE broadcasts does not guarantee that the device has an active network connection, only that the connection was recently changed.

In recognition of these issues, the Android framework team created the JobScheduler. This provides developers a simple way of specifying runtime constraints on their jobs. Available constraints include network typecharging state, and idle state.

This library uses the scheduling engine inside Google Play services(formerly the GCM Network Manager component) to provide a backwards compatible (back to Gingerbread) JobScheduler-like API.

This I/O presentation has more information on why background services can be harmful and what you can do about them:


There’s more information on upcoming changes to Android’s approach to background services on the Android developer preview page.


The FirebaseJobDispatcher currently relies on the scheduling component in Google Play services. Because of that, it won’t work on environments without Google Play services installed.

Comparison to other libraries

Library Minimum API Requires Google Play Service API1 Custom retry strategies
Framework JobScheduler 21 No JobScheduler Yes
Firebase JobDispatcher 9 Yes JobScheduler Yes
evernote/android-job 14 No2 Custom Yes

1: Refers to the methods that need to be implemented in the Service subclass.
2: Uses AlarmManager to support API levels <= 21 if Google Play services is unavailable.

Getting started


Add the following to your build.gradle‘s dependencies section:

compile 'com.firebase:firebase-jobdispatcher:0.8.5'


Writing a new JobService

The simplest possible JobService:

import com.firebase.jobdispatcher.JobParameters;
import com.firebase.jobdispatcher.JobService;

public class MyJobService extends JobService {
    public boolean onStartJob(JobParameters job) {
        // Do some work here

        return false; // Answers the question: "Is there still work going on?"

    public boolean onStopJob(JobParameters job) {
        return false; // Answers the question: "Should this job be retried?"

Adding it to the manifest

        <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>

Creating a Dispatcher

// Create a new dispatcher using the Google Play driver.
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));

Scheduling a simple job

Job myJob = dispatcher.newJobBuilder()
    .setService(MyJobService.class) // the JobService that will be called
    .setTag("my-unique-tag")        // uniquely identifies the job


Scheduling a more complex job

Bundle myExtrasBundle = new Bundle();
myExtrasBundle.putString("some_key", "some_value");

Job myJob = dispatcher.newJobBuilder()
    // the JobService that will be called
    // uniquely identifies the job
    // one-off job
    // don't persist past a device reboot
    // start between 0 and 60 seconds from now
    .setTrigger(Trigger.executionWindow(0, 60))
    // don't overwrite an existing job with the same tag
    // retry with exponential backoff
    // constraints that need to be satisfied for the job to run
        // only run on an unmetered network
        // only run when the device is charging


Cancelling a job


Cancelling all jobs


For more info please check this link =>

Applying Query in core data

There are few cases when we prefer to use Core data that Sqlite. Core data is faster in fetching records than SQLite. As like sqlite we can fetch data by specifying query in Core data.

Following is the way to set your query for fetch request of core data.

let request = NSFetchRequest()
if #available(iOS 10.0, *)
request.entity = EmpData.entity()
request.entity = NSEntityDescription.entity(forEntityName: “EmpData”, in: context)

let name = “Ram”

request.predicate = NSPredicate(format: “empName == %@”,empName)

let results = try context.fetch(request)




Also Some times we required to fetch only few number of records each time. For example you have large amount of data then we need to fetch data in batches.

Following is the code to do this

request.fetchLimit = 100
request.fetchOffset = recordCount

where fetchLimit is amount of records you want each time to fetch and fetchOffset is from where to start. Here recordCount is the counter to keep track from where to start the fetch for next time.

Rest API Call for GET and POST

global with sharing class MyRestResource {

global static Account doGet() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf(‘/’)+1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
return result;

global static String doPost(String name,
String phone, String website) {
Account account = new Account();
account.Name = name; = phone; = website;
insert account;
return account.Id;


  1. GET – call following URL in workbench rest explorer””
  2. POST -“”

    JSON Format-

“name” : “Wingo Ducks”,
“phone” : “707-555-1234”,
“website” : “”



Reading Mind Technology


Reading Mind Technology

What if Mind reading turns out to be a reality then days are not too far when our Smartphone will not of any use. Because then people would be able to connect with others through their minds. It is not fake but reality that many scientists have been working towards decoding the mind and thoughts of human.

Researchers and scientists have already achieved the success in understanding the Physical structure and chemical workings of the brain and now they are after solving the mysteries to understand the intent of the human, what people dream about and what makes them psychopath. I would like to throw some light on the kind of researches and inventions that have been done past years which are contributing towards decoding the mind and thoughts.


Researchers from University of California, Berkley have invented a Brain Decoder Device. This brain decoder device is able to analyze what you are thinking based on neuron activity inside the brain. Researchers have invited the tests subjects to read a passage of text out loud and then reading the same passage in their mind and then they compared the brain activity to look for the linked patterns.  If the technique gets further improvised then it can become boon for those who have lost their ability to speak.  And with the power of mind working wonders, we will be able to control the devices such as Smartphone, computers and other devices with our mind. “If you’re reading text in a newspaper or a book, you hear a voice in your own head,” the University’s Brian Pasley told New Scientist. “We’re trying to decode the brain activity related to that voice to create a medical prosthesis that can allow someone who is paralyzed or locked in to speak.” Pasley and his team based their work around the hypothesis that hearing words in our head causes the same kind of brain activity as hearing them spoken. The sophisticated hardware is under developmental stage and requires being more accurate so it can be utilized out of the lab. The subject is observed carefully and algorithms underpinning the system vary from person to person.

Even Japanese researchers are not behind in evolving this technology. They have developed the mind reading device as well that decipher words from brainwaves without them being spoken. They were able to identify the words such as ‘goo’, ‘scissors’ and ‘par’ when spoken in Japanese. They can identify the brain waves related with syllables or letters hence ensuring the possibility of decoding entire words and sentences without the need for any of them being physically spoken. Researchers used a method to listen to the unspoken word called Electroencephalogram or EEG. The technology records the electrical activity from the brain using an array of electrodes on the scalp to detect the brain waves. The team focused on a part of the brain known as Broca’s area, which is thought to be involved in language processing and speech. Lead author Professor Yamazaki Toshimasa, an expert in brain computer interfaces at Kyushu Institute of Technology in Japan’s Fukuoka Prefecture, and his team asked 12 men, women and children to recite a series of words, measuring their brainwaves as they did so. They found each syllable produced a distinct brain wave activity from the initial thought to the actual utterance. Activity could be seen up to two seconds before a word was spoken. By compiling a database of different sounds, the researchers found it is possible to match these brainwave patterns to words, even if they are not spoken.

Not only this, scientists are developing the technique to control the channels on your TV. For this, they are developing headsets that can read your brainwaves to change the channels.

Researchers from Birmingham University have devised a way to verify the person’s identity 2 years ago. The researchers observed the brain signals of 45 volunteers as they read a list of 75 acronyms, such as FBI and DVD, and recorded the brain’s reaction to each group of letters, focusing on the part of the brain associated with reading and recognizing words. Turns out, participants’ brains reacted differently to each acronym — so much so that a computer system was able to identify each volunteer with 94 percent accuracy.

Yukiyasu Kamitani and his team at ATR Computational Neuroscience Laboratories in Kyoto, Japan, have been able to identify what subjects were dreaming about. They use fMRI (functional MRI), which measures brain activity by picking up on the magnetic properties of hemoglobin that vary with blood oxygenation. Scientists have made some startling breakthroughs in reproducing our thoughts on a screen and delving into what motivates us to do the things we do. The subjects are put into fMRI machine and woken up just as they were drifting off. They then reported what they had been dreaming about. A database was created from the information, and using machine-learning algorithm and a visual-imagery decoder, scientists were able to identify what the subjects were dreaming about in subsequent scans.

Can you imagine that your imagination can also be traced on the screen? Participants imagine forming letters and recorded the patterns of their brains made while they did it. Researchers used this information along with the algorithms and translated it into Pixels thus they were able to reconstruct the actual images of the Participants imagination.

fMRI technology has even enabled researchers to understand the People’s reaction towards the specific products without even their need of uttering the words. The company uses fMRI to assess their feelings about products, packaging, advertising, and even smell.

Defense Advanced Research Projects Agency (DARPA) is funding an initiative where they can hack the mind of the veterans and service members and help them in treating their mental illness and addictions.

Since reading mind is taking a shape of reality, there are few things that we should consider from right now and even start researching on it. It is security of your thoughts, your imagination. In the near future, we may have to find the potential way to secure our mind from unwanted access to information that we have in our mind. I do not blame on technology as it has many advantages if used in proper way but I can blame those users who can misuse it. The technologies like fMRI enable the researchers to understand patterns of prefrontal cortex activity before they took the action, were able to decode what they were about to do. That means in future someone can understand our intent even before we perform any action. It will more become spying on our secret thoughts and our thoughts will no longer be private. Our mind is full of innovative ideas and one would never want that someone hack or decode those ideas for their own benefit.

I think it’s a high time that techies & researchers must also start thinking about solution that can secure our valuable mind against misuse of such technologies.

Steps to perform Black Box Testing Methodology

Hi, friends today we will learn Black box testing, this is a very useful testing technique in Software testing. In this technique we give input and get output without knowing how the output is generated. Black box testing is also called as Behavioral testing.

Methods of Black box Testing:

Error Guessing:
In this technique we randomly put any values not fixed values, and get output. It is not the best practice to use Error guessing method always since it may not cover all the scenarios of the black box testing, white box testing then comes to play. In this post I won’t be covering the white box testing methods.

Boundary Value Analysis:
In this testing we provide boundary values. Suppose our Input should be range 1 to 10 then we test it with -1 , 1 , 2 and 9,10,11. It reduces our testing scenarios since values ranging from 1 to 10 will always work in the worst case scenario.

Equivalence partitioning
Equivalence partitioning  is a software testing technique that divides the input data of a software unit into partitions of equivalent data from which test cases can be derived. In principle, test cases are designed to cover each partition at least once.


In the next post I will talk about white box testing methodology. If you like this post share it with your friends.

Adding Ion Auth authentication library in a Codeigniter Framework

Ion Auth is a simple and lightweight authentication library for the CodeIgniter framework.


  1. Download the latest version:
  2. Copy the files from this package to the correspoding folder in your application folder. For example, copy Ion_auth/config/ion_auth.php to system/application/config/ion_auth.php.
  3. You can also copy the entire directory structure into your third_party/ folder. For example, copy everything to /application/third_party/ion_auth/
  4. Run the appropriate SQL file from the /sql directory.
  5. You load Ion Auth just link any other library: $this->load->library(“ion_auth”); from your controller.You can also autoload the library from autoload.php:$autoload[‘libraries’] = array(‘database’,’ion_auth’);
  6. You can also autoload the library from autoload.php :$autoload[‘libraries’] = array(‘database’,’ion_auth’);

The default login is:

  • Email:
  • Password: password

Class Function In Ion Auth

1. login()

Logs the user into the system.


  1. ‘Identity’ – string REQUIRED. Username, email or any unique value in your users table, depending on your configuration.
  2. ‘Password’ – string REQUIRED.
  3. ‘Remember’ – boolean OPTIONAL.

2. logout()

Logs the user out of the system.

3. register()

Create a new user.


  1. ‘Identity’ – string REQUIRED. This must be the value that uniquely identifies the user when he is registered. If you chose “email” as $config[‘identity’] in the configuration file, you must put the email of the new user.
  2. ‘Password’ – string REQUIRED.
  3. ‘Email’ – string REQUIRED.
  4. ‘Additional Data’ – multidimensional array OPTIONAL.
  5. ‘Group’ – array OPTIONAL. If not passed the default group name set in the config will be used.

4. update()

Update a user.


  1. ‘Id’ – integer REQUIRED.
  2. ‘Data’ – multidimensional array REQUIRED.

5. delete_user()

Delete a user.


  1. ‘Id’ – integer REQUIRED.


Resets a users password by emailing the user a reset code.


  1. ‘Identity’ – string REQUIRED. (as defined in config/ion_auth.php)

8. forgotten_password_complete()

Final step of resetting a users password. The user comes to this page from their email.


  1. ‘Code’ – string REQUIRED.

9. logged_in()

Check to see if a user is logged in.

10. is_admin()

Check to see if the currently logged in user is an admin.


  1. ‘id’ – integer OPTIONAL. If a user id is not passed the id of the currently logged in user will be used.

11. in_group()

Check to see if the currently logged in user is in the passed in group.


  1. ‘Group ID or Name’ – string, integer or array of strings and integers REQUIRED.
  2. ‘User ID’ – integer OPTIONAL. If a user id is not passed the id of the currently logged in user will be used.

12. username_check()

Check to see if the username is already registered.


  1. ‘Username’ – string REQUIRED.

13. email_check()

Check to see if the email is already registered.


  1. ‘Email’ – string REQUIRED.

14. identity_check()

Check to see if the identity is already registered.


  1. ‘Identity’ – string REQUIRED.

15. is_max_login_attempts_exceeded()

If login attempt tracking is enabled, checks to see if the number of failed login attempts for this identity or ip address has been exceeded. The controller must call this method and take any necessary actions. Login attempt limits are not enforced in the library.


  1. ‘Identity’ – string REQUIRED.

16 User()

Get a user.


  1. ‘Id’ – integer OPTIONAL. If a user id is not passed the id of the currently logged in user will be used.

17. users()

Get the users.


  1. ‘Group IDs’ – array OPTIONAL. If an array of group ids are passed (or a single group id) this will return the users in those groups.

18. group()

Get a group.


  1. ‘Id’ – integer REQUIRED.

19. groups()

Get the groups.

20. messages()

Get messages.

21. get_users_groups()

Get all groups a user is part of.


  1. ‘Id’ – integer OPTIONAL. If a user id is not passed the id of the currently logged in user will be used.

22. add_to_group()

Add user to group


  1. ‘Group_id’ – integer or array REQUIRED.
  2. ‘User_id’ – integer REQUIRED.

23. remove_from_group()

Remove user from group(s)


  1. ‘Group_id’ – NULL, integer or array REQUIRED. NULL will remove the user from all groups.
  2. ‘User_id’ – integer REQUIRED.

24. create_group()

Create a group


  1. ‘group_name’ – string REQUIRED.
  2. ‘group_description’ – string.

25. update_group()

Update details of a group


  1. ‘group_id’ – int REQUIRED.
  2. ‘group_name’ – string REQUIRED.
  3. ‘group_description’ – string.

26. delete_group()

Remove a group. Removes the group details from the configured ‘groups’ table. Users belonging to the group are stripped of this status (references to this group are removed from users_groups), but user data itself remains untouched.


  1. ‘group_id’ – int REQUIRED.

28. errors()

Get the errors.

29. set_hook()

Set a single or multiple functions to be called when trigged by trigger_events(). See an example here:


  1. ‘Event’ – string REQUIRED.
  2. ‘Name’ – string REQUIRED.
  3. ‘Class’ – string REQUIRED.
  4. ‘Method’ – string REQUIRED.
  5. ‘Arguments’ – Array OPTIONAL.

30. trigger_events()

Call Additional functions to run that were registered with set_hook().


  1. ‘Name’ – String or Array REQUIRED.