PDF operations using Apache PDFBox without stings

Standard

PDF is a convenient way of printing the output and sharing the data with application users. Its ability to scale as per display without distorting the contents, is considered to be the strongest feature over other output formats. As per application requirements, it also becomes necessary to generate PDF at runtime. There are many options, available to do so. Either use reporting tools like Jasper and then using reporting API generate the output in PDF OR if you wish to have finer controls over PDF generation use programming API like iText. iText uses AGPL for Open Source, and it can be pretty fatal, if you really don’t understand its legal terms. Contact someone who understands Open Source licenses. Most of the time, developers forget to pay attention to the licensing model. Developers usually don’t understand what Open source really means, most of them feel its free like air they breath and ignorantly fall into the trap of License violation. Usage of any Open Source software without paying attention to License, can result into lawsuit against development company or hefty payments to the governing company of Open source software. Unfortunately the Illiteracy rate is way too high. Why, I am bragging about all of this, simply the reason is – if you are using iText, be ready to either Open Source your software or pay for use (Once again pay attention to details, don’t just buy any license). OK! so is there really any other option, than just paying bucks. Yes, there is and as usual, Apache is here for your rescue – Apache PDFBox.

Continue reading

Free SSL / HTTPS Certificate with Lets Encrypt

Standard

Are you hosting a Web site, which will manage customer data? Is there any sensitive information getting captured on your Web site? If Yes, you must definitely protect your Web site and the trust of your customers by enabling secured, encrypted communication. As a first step towards enabling HTTPS is to install valid certificate from Certification Authority (CA). It has been a tedious process to configure secure channel and a recurring fee also makes people think about the cost of overall process. But thats not a problem anymore, if you wish to enable basic security, LetsEncrypt is here. I came across, LetsEncrypt few days back and found its the most easiest and hassle free approach to enable encryption for a website. And with few steps, I had a website with HTTPS mode ON. Throughout the process of configuring and hosting a sample website, I made use of Vultr, Dot.tk and LetsEncrypt offcourse. You can follow this entire process, without spending a penny. Lets start.
Continue reading

REST API – How to design?

Standard

Are you developing web application? OR building mobile app? what you commonly require is a backend providing the ability to save user data and provide meaningful insight. In addition to storage and retrieval of the data, a secured access control mechanism is required to ensure data integrity. There are multiple approaches to handle the requirement and the implementation varies based on the chosen programming language. Usually, the concepts used to solve this problem fall into following broad categories

  • Proprietary Implementation (Servlets, MVC Controller, Remote Object etc.)
  • SOAP services
  • API development using REST

The intention of this article is to suggest some of the concepts that must be considered while designing REST API. Most of the time, my interactions with Developers and even some of the architects, led me to a realization that most people have limited or no knowledge of REST API design. Some refer merely exposing a data using either XML/JSON is REST, while some think just using HTTP methods is sufficient to build REST based API. But that’s not the entire truth.
Continue reading

NodeJS dependency injection – Zander

Standard

Having worked on Java and Spring for almost a decade, my programs are naturally inclined towards using dependency injection. Recently, I started using NodeJS for developing one of our initiative and I felt modularizing my code instead of building one monolithic program. Soon, I realized that in order to keep my modules loosely coupled with each other, I need to use dependency injection and I started searching for framework. While I tumbled across many frameworks, which claims to provide Dependency Injection, none of them really fit to the expectation that I had. Also I came across many posts emphasizing that NodeJS programs do not require separate Dependency Injection frameworks and one can easily tweak require method to achieve desired results. I personally, didn’t like the suggestions and hence I thought of developing one of my own – Zander.

Continue reading

Swagger – REST documentation made easy

Standard

Up until now, REST service documentation was really painful job (believe me, I have burnt my hands with JAX-RS, JAX-WS). So called XML generated by REST hosted servers was partially helpful to understand the operations and skeleton of data structure. Beyond that, the separate documentation in order to understand the sample values and detailed information about operation was still required. Well that’s not all, even if one wants to try out the API, there was need of having separate client. Well, for all this time we continued to create beautiful documentation manually, which definitely was plagued with problems like syncing, version maintenance etc. Luckily, the problem seems to be fading away with the framework, I came across in recent times – Swagger.
Continue reading

Android – Sliding overlay

Standard

While, I was working on one of the Android App, I needed a layout which offers overlay layer and provides a semi-transparent effect to view controls beneath it. In addition to the look & feel, I was also looking for a smooth transition effect to bring overlay in the view. It should also offer responsive touch to slide it out. The requirement seems to be very simple and my hunt began to implement such control. While I could able to locate many references for transition effect, none of them were perfect and had some flaws in it. The major flaw, I noticed with the implementation was that – Once an overlay view is displayed, sliding it to the right, will sometimes cause controls beneath it receiving events and yielding weird results. The rationale behind it was simple, the usage of setOnTouchListener doesn’t provide enough control over the touch lifecycle of a control and hence the touch event was getting leaked to the controls, visible one layer below.
Continue reading

BuddyShare – Ride sharing for corporate

Standard

Back in June 2015, when I left my job and thought of going for my dream, I tumbled across many ideas. As a continuation of “Selfie-social” post, I am sharing one more idea that I had – Building Ride sharing app for corporate employees. There are many ride sharing Apps are available in the market, but most of them are focused on general people coming together and planning for ride. Based on my personal experience, I always felt that the hubs where many professionals come together to work, have to go through lot of pain while commuting. Though most of them prefer to have personal vehicle, many still depend on the Public transport, taxi, trains etc. Before getting into the details about my thoughts, lets see what problems I want to put forward.

Continue reading

From brain to digital – Visualize without being stuck to technology (Telekinesis)

Standard

Laying on bed, eyes shut but not sleeping, a mind at peace and on the verge of building a chain of words. May be he is a poet and working on his next creation. Somewhere else, a guy was seating on the bank and there was no one around, except nature, birds chirping, sweet sound of dry leaves. The river is so calm that he finally feels relaxed. He can’t hold his thoughts and want to write a story. Hmm after all he is story writer. Not so far, another guy seating in a closed meeting room, leaning back on chair with eyes closed, thinking about software system. He wants to bring a change, he wants to really think through. His brain is solving puzzles and a stack of ideas are just building up.

Continue reading

Extract app icon in Android

Standard

Android has been on my radar for a long time, but I could never proceed with simple hello world program and few basic stuffs. From last couple of months, I have been working with both Hybrid and Native application development for Android. The experience has been enriching as I have explored lot of things in Android App Development. There are still few areas (testing, automation, profiling, game development etc.) that yet to be discovered. While developing one of the functionality, I came across a strange problem. The need was to extract an icon of any installed app and store it. Later the extracted icons must be displayed in GridView for user actions. I started using following code, to extract and save the icon

Drawable appIcon = packageManager.getApplicationIcon("com.xyz.mobile.app");
BitmapDrawable bitmapIcon = (BitmapDrawable)appIcon;
FileOutputStream fosIcon = context.openFileOutput(packageName + ".png", Context.MODE_PRIVATE);
bitmapIcon.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, fosIcon);
//flush stream... close stream...

Continue reading

Selfie Social – Advertisements done intelligently

Standard

Be it a party, get together or a small meetup, people like to treasure the moments and share it over social media. Got a new dress or a gadget, visiting places or done something unusual, people like to take snaps and share it with the world.

Selfie

Selfie

Technology has eased many things, taking snaps is just one click away and sharing it can be done within flash of seconds. With the rise of social networking, there are now many options available to connect with the people at distant location and share memories.

Looking at the pictures, most of the people have questions like where was the picture taken? what a person is wearing or where is it available? what is the price of the gadget or the jewelry being displayed in picture? People usually prefer to post their queries as comments or sometimes may contact a person in the picture, if possible. While all this may help to retrieve the information, it is not either available quickly or sometimes remain private. Additionally, the social networking sites have to broadcast advertisements heavily to ensure the inflow of money. Sometimes the ads are not targeted to appropriate user and more prominently it annoys the viewing experience. Most of the users also seems to be demanding that the content displayed to them should be ad-free. There is also a move to have OS level ad blocking programs which prevents Mobile Apps from displaying Ads.
Continue reading