Code Complexity


Working on software solutions is a difficult task and you can get stuck anywhere. Experience surely matters but sometimes even the most skilled professionals can face problems resulting in the pauses in projects. If you are willing to grow and get some experience then you should dive into complexities instead of avoiding them. Finding yourself stuck in some problem is an absolutely normal thing; the thing that matters most is whether you want to skip the problem and become a failure or whether you want to find the solution at any cost.

To overcome software complexities and to find solutions for new problems, the most important thing is consistency. The solution in solving code complexity is never more than a single verse which means whoever is trying to win the game can propose solutions.

If you work in Software Company and are tired of software complexities, then the list below can really help you out

  1. Collaborate Within Your Team

If you are the owner of the software company then it is better you should arrange multiple meetings in order to analyse and discuss the need to address and resolve software complexity. It happens most of the time that developers do not share the complexities of the software on which they are working. It is your responsibility to arrange meetings and collaborate with your team and discuss on what code they are working on currently. Compile a list of issues that any one or more members are facing and then try to find solutions.

  1. Arrange Formal Meetings

Once you are provided with the list of problems by all the members, now you can arrange a formal meeting and endeavor to find solutions. This is the time when you can approach code base to find solutions. The most important way to solve the problems would be addressing cause and effect relationships.

  1. Prioritize

Making a priority is a very essential thing because this way, you wouldn’t even miss the minutest problem. Since you have the list of all your problems now, therefore, it is better to prioritise that which solutions must be found instantly depending on your needs and project requirement. This is the most efficient way to handle the bugs in an efficient manner without missing anything crucial.

  1. Delegation of tasks

This is the point when – having identified all the complexities – you can assign one code complexity to one individual. It is a tiring task because before assigning you will have to thoroughly examine the performance of the individual. Another important factor is motivation; how motivated your team members are to deal with the code complexities.

Solving code complexities is not an instant process, rather it is an extended one in which the person you assign the task will have to write codes again and again. In this process, you will have to keep an eye on his performance. If you think there are problems that your team can resolve on its own then there is no need for extra interference; also give your team a little space.

  1. Results

Now as all the complexities are stated, individuals are assigned with multiple tasks and all the bugs are sorted out, this is the time when you can devise a regular monitoring of the code quality which will save you from any further problems. Checking your work on regular basis will save you from many complexities.

These were the simple and most practical ways to resolve software complexities.

This article is written by Lisa Myers, who works at Rebateszone. She is a software engineer by profession.


Android Multipicker Library

Android Multipicker Library
Android Multipicker Library

Similar to image-chooser-library, but has some new features. Re-written from scratch. Android Multipicker Library is an open-source project which has the following objectives.

Makes it easy and simple to integrate “Attach that file” feature into your android apps.
  • Don’t worry about various devices/OS variations.
  • Don’t worry about out-of-memory errors.
  • Don’t worry about creating thumbnails to show a preview.
  • Picking up any file for your app, and it’s details.
  • Picking up audio files.
Code less for capturing images/videos/files
  • Choose images from device or take a photo
  • Choose videos from device or record one
  • Choose files available on your device
  • Choose audio files available on your device
  • Choose a contact from the phonebook
  • Works with almost all content providers
  • Get all metadata about the media that you would probably need
  • Similar code base to implement irrespective of Android version of device.
Media types supported
  • Pick images.
  • Capture a still photo.
  • Pick videos.
  • Record a video.
  • Pick/Record an audio.
  • Pick files.
  • Pick a contact (Display name, phones and emails).
Post Processing
  • Generate metadata of file (Size, MimeType, Extension)
  • Generate metadata of images (Width, Height, Orientation + metadata of files)
  • Generate metadata of videos (Width, Height, Orientation, Duration + metadata of files)
  • Generate metadata of audios (Duration + metadata of files)
  • Generate thumbnails of images (Big and Small)
  • Generate preview image of a video and it’s thumbnails.
Other features
  • Multiple file/image/video selection.
  • Configurable storage location of all files.
  • Easy handling for incoming share intents.

The implementation code is more concise and meaningful. Do give it a try.

Why Android Multipicker Library?

A little bit of background:

Get it on Google Play
Multipicker Library Demo

Picking images/videos on Android is not that straight-forward. It might be easy if you want to pick media from a specific app or the phone’s gallery. But it becomes very tricky when you have to deal with all kinds of apps. ex. Dropbox, Google Drive, various File Manager applications, different types of camera applications and so on. Android Multipicker Library makes it super easy for you to deal with all these scenarios, with a single codebase. So that you don’t have to keep writing code to handle all these scenarios differently.

You can try out this sample app and see how it works. Let us know your feedback or suggestions.

Checkout the Wiki Pages on Github for code snippets.

File Upload from Webview on Android

You have a form on WebView, with input type as “file”, and want to allow the user to upload a file from his device. Prior to Lollipop, this was not very straightforward, and you had to resort to using private APIs, which has always been discouraged. But, you had to do it. With Lollipop, there’s a new public API, which still isn’t very straight-forward to use, but at-least, should be reliable and compatible with newer Android/WebView versions. So, how do you implement File Upload from WebView on Android with the new public API? 

This has been a long pending request, and people have implemented workarounds by using various versions of some private API’s for various older versions of Android.

Steps to Implement (3 steps)

  • Attach WebViewChromeClient, and override method callback for a click event on and input field of type file.
mWebView.setWebChromeClient(new WebChromeClient() {

         public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,              FileChooserParams fileChooserParams) {
                 mFilePathCallback = filePathCallback;
                // Launch Intent for picking file
                return true;
  • Launch Intent for picking the file
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, PICKFILE_REQUEST_CODE);
  • Pass the Uri of the selected file to WebView
protected void onActivityResult(int requestCode, int resultCode,
     Intent intent) {
     if (requestCode == PICKFILE_REQUEST_CODE) {
          Uri result = intent == null || resultCode != RESULT_OK ? null
              : intent.getData();
          Uri[] resultsArray = new Uri[1];
          resultsArray[0] = result;


I have created a small sample project with all the required code to achieve a simple input field taking in an image. You can get the source on Github.

Script for compressing images with tinypng API

TinyPng is a nice service which provides you 500 free image compressions a month. And this is nice, since in a typical Android project, you wouldn’t have more than 500 images in any given month :). I have a simple script that scans through all your images, and tries to compress them using the tinypng api. All you need to do is to copy the script, put it in the root folder of your project and run it.

Head over to TinyPng website to checkout how it works.

What does TinyPNG do?

TinyPNG uses smart lossy compression techniques to reduce the file size of your PNG files. By selectively decreasing the number of colors in the image, fewer bytes are required to store the data. The effect is nearly invisible but it makes a very large difference in file size!

Advanced lossy compression for PNG images that preserves full alpha transparency.

Let’s jump into it. This script will search for all the images(pngs) in your Android project, pick each one, call the API, and overwrite the images, with a compressed version. And since this is a lossless compression, you won’t notice any change in quality. The overwriting part is probably a bit dangerous. So, with a little modification, you could change the script so that it creates a copy of the files.

The initial script for tinypng was taken from this gist by rakuishi. Thanks :).

Image Crush Savings Report
  1. The first thing you would need to do is to get an API key here.
  2. Copy this file to the root of your android folder.
  3. Replace your API key in this file on the top.
  4. Run “ruby imgcrush.rb”
  5. View the generated HTML report. (Link to sample report)

That’s it. For an example above, you could see, the script reduced the size to almost half for each image. And the total savings is somewhere about a whooping 53%.

Note: There are other image compression APIs/tools which I haven’t tried yet. Android build system itself has a pngcrusher which tries to optimize all your assets.

Windows 10 Review – First impressions

This slideshow requires JavaScript.

I have a laptop, 1 year old, HP Pavillion, with an Intel i5 processor (quite a recent one), with 8 GB RAM. It used to run Windows 7 before. And it was slow. I kept it as a backup incase my MacBook Pro failed (it never has). Well, I also have an octa-core AMD desktop running on Windows 8.1, which again is a backup when the first backup fails, or frustrates me enough.

The laptop, running Windows 7 was too slow to even use it just for browsing. And I tried all tricks to make it faster. Even then, it was only marginally better, which wasn’t good enough. So, I rarely used the laptop. Today, it prompted me that Windows 10 has arrived. I thought to myself, in worst case scenario, after the upgrade, I might stop using this laptop, and I pressed the “Download” button, anxiously. After a good 1 hour, it was up and running Windows 10. Read on for Windows 10 review and my first impressions.

The upgrade process was rather smooth. No problems at all.  All hardware seem to be working fine. And it didn’t lose any of my data, even my Wi-Fi passwords. All applications I checked worked fine.

After logging in for the first time, it wasn’t any better than Windows 7. I was just browsing through all parts of the OS, restarted it a few times, and it started showing signs of improvement.

Windows 10 promises very fast boot times. On this laptop, I didn’t notice much of an improvement than Windows 7. I did try to restart it a few times, but the boot time, and the logging in time seemed to take longer than I would have liked. From powering it on to getting to see the desktop, it was a good 3 minutes on this machine.

Interface: The whole UI has been refreshed, but I think, it could have been a little better. For now I am using the default theme. May be I should try a different theme. At first, you might get a little confused. As with all major OS upgrades, I shouldn’t be complaining about this.

  • The PIN login is something new on a desktop OS. You can enable this (4-digit PIN), after you verify your account ( or with which you would be logging in to the system.
  • The window styles have been refreshed with a minimalistic and less colorful theme (default).
  • The Task Bar, Start buttons are a welcome change from Windows 8. People coming from Windows 7 might be a tad more comfortable than those upgrading from Windows 8.
  • There are no hidden slide outs from all sides (as in Windows 8).
  • The controls at the right bottom corner of the Task bar looks nice.
  • Almost every icon on Windows 10 is more 3D-ish. You might find it a bit difficult at recognizing the familiar icons.
  • The start menu is definitely more cluttered than Windows 7, but a lot better than how it worked on Windows 8.
  • The new Task View is nice. I really liked it. It’s easier than ever to work with multiple desktops on Windows finally.

Coming to performance, for now, I am quite surprised with it. It’s fast and snappy as compared to Windows 7. Apart from the boot times, everything else starts up faster than before, and suddenly makes me feel using a brand new laptop. I am glad that I upgraded. Soon, I would be upgrading my desktop to Windows 10, but unfortunately, I have got no notification there. Probably because, that’s a custom built machine (AMD), and it would take some more time for Microsoft to support all kinds of hardware to ensure a smooth upgrade.

Microsoft Edge: The new browser is hell of an upgrade from the aeging Internet Explorer. Now, you won’t bang your head if you accidentally click on the browser from Microsoft. It starts up very very fast, and responds to clicks just like any other browser. Although I haven’t used it extensively, it’s definitely an welcome upgrade from IE. Bye Bye IE.

Cortana: Well, again, we have to see how it works, but at least, they made a start. The concept is like Google Now on Android and Apple’s Proactive Assistance. On the face of it, it seems very useful.

These are my first impressions of Windows 10 running on my laptop. So far, I would give it a thumbs up. However, I would probably wait for some more weeks before I give my final verdict.