How to Enable USB Debugging & Developer Options in Android 4.2 Jelly Bean

The USB Debugging and Developer Options are hidden in latest Android 4.2 Jelly Bean. If we want to use that options, manually activate it. Google has rolled out latest Jelly Bean OTA update for their nexus mobiles. After the updating process, the developer option is not there in settings. Here is the guide to enable USB debugging on Android 4.2 Jelly Bean running mobiles and tablets.

Developer Options have many features for app developer to test an app on their device from PC via ADB. After enabling the debugging mode only, access the mobile from PC. ADB is used for users if they want to quickly access and run commands on their device from their PC or Laptop. In gingerbread it is placed in Settings >  Applications  >  Development  >  USB Debugging. And ICS it is placed in Settings  >  Developer Options  >  USB Debugging. But, after upgrading it to 4.2 it is missing. After a long time to search around, we found the way how to activate it.

How to Enable USB Debugging and Developer Options on Android 4.2 Jelly Bean:
  1. Go to – Settings > About phone.
  2. Then move on to Build number option
  3. Tap on Build number repeatedly about 7 times.
  4. This is enough.
  5. After touching 7th time you will see a message that, “you are now a developer”.

Now the option will be placed in Settings menu. Normally it placed under System in Settings menu. Then you can enable it in Developer Options and Android Debugging.

5 class design principles [S.O.L.I.D.] in Java

Classes are the building blocks of your java application. If these blocks are not strong, your building (i.e. application) is going to face the tough time in future. This essentially means that not so well-written can lead to very difficult situations when the application scope goes up or application faces certain design issues either in production or maintenance.

On the other hand, set of well designed and written classes can speed up the coding process by leaps and bounds, while reducing the number of bugs in comparison.

In this post, I will list down 5 most recommended design principles, you should keep in mind, while writing your classes. These design principles are called SOLID, in short. They also form the best practices to be followed for designing your application classes.
  1. Single Responsibility Principle
  2. Open Closed Principle
  3. Liskov’s Substitution Principle
  4. Interface Segregation Principle
  5. Dependency Inversion Principle

Lets drill down all of them one by one.

Single Responsibility Principle

The name of the principle says it all:

"One class should have one and only one responsibility"

In other words, you should write, change and maintain a class for only one purpose. If it is model class then it should strictly represent only one actor/ entity. This will give you the flexibility to make changes in future without worrying the impacts of changes for another entity.

Similarly, If you are writing service/manager class then it should contain only that part of method calls and nothing else. Not even utility global functions related to module. Better separate them in another globally accessible class file. This will help in maintaining the class for that particular purpose, and you can decide the visibility of class to specific module only.


Open Closed Principle

This is second important rule which you should keep in mind while designing your application. It says:

"Software components should be open for extension, but closed for modification"

What does it mean?? It means that your classes should be designed such a way that whenever fellow developers wants to change the flow of control in specific conditions in application, all they need to extend your class and override some functions and that’s it.

If other developers are not able to design desired behavior due to constraints put by your class, then you should reconsider changing your class. I do not mean here that anybody can change the whole logic of your class, but he/she should be able to override the options provided by software in unharmful way permitted by software.

For example, if you take a look into any good framework like struts or spring, you will see that you can change their core logic and request processing, BUT you modify the desired application flow just by extending some classes and plugin them in configuration files.


Liskov’s Substitution Principle

This principle is a variation of previously discussed open closed principle. It says:

"Derived types must be completely substitutable for their base types"

It means that the classes fellow developer created by extending your class should be able to fit in application without failure. I.e. if a fellow developer poorly extended some
part of your class and injected into framework/ application then it should not break the application or should not throw fatal exceptions.

This can be insured by using strictly following first rule. If your base class is doing one thing strictly, the fellow developer will override only one feature incorrectly in worst case. This can cause some errors in one area, but whole application will not do down.


Interface Segregation Principle

This principle is my favorite one. It is applicable to interfaces as single responsibility principle holds to classes. It says:

"Clients should not be forced to implement unnecessary methods which they will not use"

Take an example. Developer Alex created an interface “Reportable” and added two methods generateExcel() and generatedPdf(). Now client ‘A’ wants to use this interface but he intend to use reports only in PDF format and not in excel. Will he achieve the functionality easily.

NO. He will have to implement two methods, out of which one is extra burden put on him by designer of software. Either he will implement another method or leave it blank. So are not desired cases, right??

So what is the solution? Solution is to create two interfaces by breaking the existing one. They should be like PdfReportable and ExcelReportable. This will give the flexibility to user to use only required functionality only.


Dependency Inversion Principle

Most of us are already familiar with the words used in principle’s name. It says:

"Depend on abstractions, not on concretions"

In other words. you should design your software in such a way that various modules can be separated from each other using an abstract layer to bind them together. The classical use of this principle of BeanFactory inspring framework. In spring framework, all modules are provided as separate components which can work together by simply injected dependencies in other module. They are so well closed in their boundaries that you can use them in other software modules apart from spring with same ease.

This has been achieved by dependency inversion and open closed principles. All modules expose only abstraction which is useful in extending the functionality or plugin in another module.

These were five class design principle which makes the best practices to be followed to design your application classes. Let me know of your thoughts.

Happy Learning !!

How to root your Android phone or tablet

Android Root Unloack


Is the allure of being a superuser tempting you? Android rooting opens up a world of possibility, but it can also void your warranty, or even leave you with a bricked device. The important thing is to be careful. Read up about what you are going to do before you begin. Make sure that you backup your data. Follow the instructions to the letter. Manufacturers and carriers have a vested interest in dissuading you from rooting. If you’re careful, the risk is minimal, and the potential benefits are impressive. Let’s take a closer look.

What is rooting?

If you’re an Administrator on a Windows machine, you have access to the entire operating system and you can do whatever you like. That’s essentially what happens if you root your Android device. With root access, you can get around any restrictions that your manufacturer or carrier may have applied. You can run more apps; you can customize your device to a greater degree; and you can potentially speed it up in a variety of ways.
The process involves backing up your current software and then flashing (installing) a new custom ROM (modified version of Android).

Why would you root?

One of the most obvious incentives to root your Android device is to rid yourself of the bloatware that’s impossible to uninstall. You’ll be able to set up wireless tethering, even if it has been disabled by default. You can also access your entire file system, install special apps that require a root, and flash custom ROMs, which can add extra features and streamline your phone or tablet’s performance. A lot of people are tempted by the ability to completely customize the look of their phones. You can also manually accept or deny app permissions.
You won’t find a lot of amazing must-have apps when you root, but there are enough to make it worthwhile. For example, some apps allow you to automatically backup all of your apps and all of their data, completely block advertisements, create secure tunnels to the Internet, overclock your processor, or make your device a wireless hotspot.

Why wouldn’t you root?

There are essentially three potential cons to rooting your Android.
  • Voiding your warranty: Some manufacturers or carriers will use rooting as an excuse to void your warranty. It’s worth keeping in mind that you can always unroot. If you need to send the device back for repair, simply flash the original backup ROM you made and no one will ever know that it was rooted.
  • Bricking your phone: Whenever you tamper too much, you run at least a small risk of bricking your device. This is the big fear everyone has. The obvious way to avoid it happening is to follow instructions carefully. Make sure that the guide you are following works for your device and that any custom ROM you flash is designed specifically for it. If you do your research and pay attention to feedback from others, bricking should never occur.
  • Security risks: Rooting may introduce some security risks. Depending on what services or apps you use on your device, rooting could create a security vulnerability. For example, Google refuses to support the Google Wallet service for rooted devices.

How to root your Android

Before you actually try to root your device, make sure that you do some reading. The best place to find discussions about rooting, guides, and custom ROMs is definitely the XDA Developers Forum. Look for a thread on your specific device and you’re sure to find a method that has worked for other people. It’s worth spending some time researching the right method for your device.

Preparation for root

You’ll want to ensure that your device is fully charged before you begin. You’ll also need to turn USB debugging on. On the Galaxy S3 you’ll find it in Menu > Settings > Developer options and then check the box next to USB debugging. You will likely be plugging your device into your computer in order to root it.
Most Android rooting methods require you to install some software on your computer. It’s likely you’ll need to install the Android SDK. You may find other software is required. Make sure you follow the instructions and install all of it before proceeding.

One-click rooting

One of the easiest methods of rooting, which also supports a long list of devices, is SuperOneClick. You’ll find clear instructions, including a video, on how to use it at this XDA Developers SuperOneClick thread.
You will need to install some software to prepare, but the actual rooting process is one click. It will only take a few minutes to complete and then you’ll need to restart your Android device.
There is software out there that claims to provide one click rooting with no extra installs, but you should not have to pay to root your device and it’s very important to be wary about the method you choose. If in doubt, do more research. The XDA Developers forum is the most trustworthy source for rooting guides.

Your specific device

The reason rooting isn’t more straightforward is that all Android devices are not created equal. There are significant differences between Android smartphones, between manufacturers, and even between carrier specific versions of the same phone model. Make sure that any rooting guide or custom ROM you intend to use does support your specific device or you are asking for trouble.
Once you have found the right guide for your phone or tablet, it’s simply a case of working through the listed steps methodically. It can be a complicated procedure and it can take a while. Here’s an example guide for rooting the Samsung Galaxy S3. It can appear intimidating at first glance, but provided you follow it step-by-step, it should be a pain-free process. You can post questions in the XDA Developers forum if you run into trouble.

To root or not to root

Gaining full root access to your Android device can be thrilling, especially if you want to tinker with settings and customize your device. How much it changes your experience depends largely on the device you have. If you have a shuttered device, like a Kindle Fire tablet, then it’s a great way to get the full Android experience.
The potential benefits for all Android users include improved battery life, root-only apps, custom ROMs, overclocking, an end to bloatware, improved performance, and the ability to upgrade your phone when you want. If you aren’t excited at the prospect of any of these things, rooting probably isn’t for you.
Have you tried rooting your Android? Did you have a positive experience? Would you recommend rooting to others, or do you think it’s pointless? Post a comment and share your thoughts.

How to Remove the Background from a Picture


how to remove background from image



Looking to cut out the background from an image, but aren’t quite sure how to do it? Well, no matter if you have Photoshop or not, you’ve come to the right place. In this article we’ll cover two different methods that will get the job done: one that uses Photoshop, and one that relies on a browser-based Web app.
We’ll start with the simplest option – the Web app. Even if you’re partial to full-featured programs like Photoshop or GIMP, we highly recommend checking out Clipping Magic. We like it because the learning curve is insanely low, it doesn’t require any downloads or installs because it runs in your browser, and it doesn’t cost a single cent. The program is currently in alpha, but it still works like a charm. Here’s a quick rundown of how to use it: 
If you’re fortunate enough to have a copy of Photoshop and prefer to use that,  we’ve also included a quick tutorial for that on page two. 

1. How to remove backgrounds with Clipping Magic

So let’s say you want to Photoshop a mustache onto your boss’s face, but you don’t have Photoshop and all of the gloriously curly mustaches you find have annoying white backgrounds on them. In order to strip out the background and get a PNG image of the mustache by itself, follow these steps:
1. Download/save the image to your computer.
2. Head over to ClippingMagic.com.
3. Click the big blue Choose File button or just drag and drop your image into the dotted box.
4. Draw a green line on the parts of the image you want to keep.
5. Draw a red line on the parts of the image you want to remove, i.e., the background. Zoom in as needed for more precision.
Mustache background removal
6. If the image preview on the right looks correct, go ahead and click save. 

Removing complex backgrounds

Looking to remove the background from an actual photograph, not just some clip art with a white background? Don’t worry – Clipping Magic can handle this too, but it’ll take a little extra work. To get the job done, just follow the same steps as above, but get a little bit more precise with the red and green markings. For example, this picture of my coworker Brandon Widder is pretty good, but the background just doesn’t do him justice. I want to replace it with something a bit more badass.
Brandon with background
When I first dropped the image into Clipping Magic, the software’s edge-finding algorithm did a decent job of finding Brandon, but needed a little extra help catching his majestic, flowing locks.
Brandon background removal
So, to make it more accurate, I needed to zoom in and get more precise with my green markings. You can change the size of your brush in the top menu, but I’ve found that’s it’s much easier to just zoom in really far. Once you’re close enough to see where the algorithm missed the edges, drop a few green marks to help it straighten out. 
Brandon hair background
Once you’re done with that, just zoom back out too see if the finished product looks all right. Mine’s not perfect, but it’ll do.
Brandon no background

Now I can add a newer, more appropriate background…
Brandon with T-Rex background
Perfect!
If you have any questions, feel free to post them in the comments section below and we’ll see if we can help!

2. How to remove a background with Photoshop


Photoshop is a pretty amazing program, and with such a massive selection of tools, the program offers a number of different ways to strip backgrounds from images. We’ll start with the easiest method. If you’re dealing with a background that’s a solid color, you can strip it away with these simple steps:
1. Open the image in Photoshop.
2. Select the Magic Wand tool.
photoshop interface magic wand tool
3. Click on the background and hit Delete. It’ll magically disappear.
4. Save your image, and make sure it’s in PNG format.

Removing complex backgrounds

To strip away a more complex background in Photoshop, you’ll need to dig a bit deeper into your toolbox. Photoshop is an incredibly full-featured program, and as such, it supplies you with a myriad different ways to remove backgrounds. Some of these methods carry far steeper learning curves than others, so for this tutorial we’ll go over a method that’s fairly straightforward. Here’s how it’s done:
1. Open your photo in Photoshop.
2. Select the Background Eraser tool.
photoshop screenshot
3. Adjust the brush size to your liking.
4. Set the Sampling to Continuous.
5. Set the Limits to Find Edges.
6. Adjust the Tolerance. Lower is generally better since a high setting will remove more colors. It’s generally a safe bet to opt for a setting in the 20-30 range.
7. Hover your brush over an area of the background that’s near your object. Click and it will magically be removed.
photoshop screenshot 2
8. Continue this process until you’ve created a background-free border around your entire object. Feel free to adjust the tolerance as needed where your image gets lighter/darker around the edges.
photoshop screenshot 3
9. Once you’ve got a solid border around your object, you can switch over to the regular Eraser tool to remove the rest and put on the finishing touches before you save
That’s it! if you have got any questions, feel free to post them in the comments section below and we’ll see if we can help!