Sid’s Blog

(life => life.make_it_better)

How to store data using SQLiteDatabase in Android application?

| Comments

I was asked by one of my friend to help him to save some data in his android application. Due to that nature of the application, his preferred storage option was SQLiteDatabase which resides under android.database.sqlite namespace. It exposes methods to manage a SQLite database. It also has methods to create, delete, execute SQL commands, and perform other common database management tasks.

Why does my mac terminal still uses an older version of Java?

| Comments

While I was working on my mac, I got a pop up to update Java running on it. I did all the process that was required. It was also needed by one of my application being developed in Android Studio on latest platform. But when I checked the version number using System Preferences > Java which opens the Java Control Panel in a separate window. If you click on the About button under General tab of this new window, it displays the Version details which said the following and with other copyright information:

Introduction to Dependency Injection

| Comments

What is Dependency Injection?

In simple words, Dependency Injection (DI), is a type of IoC where the creation and binding of a dependency is moved outside of the class that depends on it.

Say suppose when you pack your lunch, you know what you have packed inside it. But when you know that the food will be provided, you know that you need not to worry about lunch, it will just be served when you need it.

Similar to above example, when you don’t use DI, your class will have the creation and binding of dependencies inside it. But when you use DI, your class will just work taking into consideration that the required dependencies will be provided by a service.

Introduction to Inversion of Control

| Comments

What is Inversion of Control (IoC)? IoC is basically a pattern that we use to apply Depenency Inversion Principle. Most people mix DIP, IoC and DI together! Its good to have your concepts clear.

How does IoC relate to DIP? Please read my post about DIP. This priciple says that the high level module should not depend on low level module.

Introduction to Dependency Inversion Principle

| Comments

Vocabulary required for this article:

  • Dependency Inversion Principle (DIP): This is a principle used in architecting software.
  • Inversion of Control (IoC): This is a pattern used to invert interfaces, flow and dependencies.
  • Dependency Injection (DI): This is the implementation of IoC to invert dependencies.
  • Inversion of Control Container: A framework to do dependency injection.
  • Interface: The term interface will refer to externally exposed way to interact with something.

What is Dependency Inversion Principle?

Many developers gets confuse and mix up the terms like DIP, IoC and DI without even understanding the concepts. The root that one needs to know is DIP. It basically states that instead of lower level modules defining an interface that higher level modules depend on, higher level modules define an interface/abstraction that lower level modules implement.

How to compress, decompress a string in c# using GZipStream?

| Comments

I recently had a scenario where my application was sending raw json data to send to the browser in string format. This data was used as a viewstate by using hidden input element. When the app started to run in production envrionment, we realised that this raw data is very big in size and needs to be compressed.

So, the only solution available here was to compress the raw data and decompress it when app wants to access the data. Both needs to happen server-side. My app uses .NET v4.5, so I thought to use the out of the box classL GZipStream

How to customize Chrome Developer Tools?

| Comments

I spend most of my programming time within Visual Studio and I never liked the white theme that came out of the box. Same is with the Chrome Developer Tools. I use Dark theme for Visual Studio and want something similar for Chrome as well.

In version 32, custom.css was removed from Chrome. I’ll be using an theme extension to setup a custom theme. The old way was to play with a local css file that you can rely on or add your own files.

Use your own font everywhere

| Comments

Have you spent any time thinking of which font to choose while writing a word or any other document either on your laptop, online, etc.? Will it not be easier to have your own handwriting available to you even when you don’t hold a pen in hand and instead press keys on laptop?

I answered it as ah yes, but that must be hard? No, its not. Some dev friends have created a free tool that can be used by anyone to create a font based on your handwriting.