Category: Uncategorized

  • Code4ReferenceDebugging SQL query

    Recently I started writing SQL query for analyzing and debugging the production code. But I was surprised to see that some queries takes longer time to execute to achieve the same output. I did research and found some interesting stuff about how to debug the SQL query. I have a very simple table who’s definition…

  • Code4ReferenceTutorial on new Android Jelly Bean notification

    You may have heard about Android Jelly Bean (API level 16). Google has improved a lot of features and introduced new features. One of them is the notification. Now they have made the notification more versatile by introducing media rich notification. Google has come up with three special style of notification which are mentioned below. Even…

  • Code4ReferenceA simple Python script to find and replace text string in a file

    A little while ago I was trying to port my blogs from Blogger.com to code4reference.com. But when I tried to port the blog, I noticed that the code section of my blog contained HTML tags for new line. When I used the the Syntaxhighlighter, the view was awful since the Syntax highter expects the code…

  • Code4ReferenceAndroid dynamic and xml layout

    Android activity contains various user interface components e.g Button, Radio button, List, Text field etc. The user interface component can be  arranged/attached with the activity in two different ways. Declaring UI element in layoutfile Basically, Layout file is xml formatted file present in res/layout. In this file, tags are used to define any UI component…

  • Code4ReferenceTutorial on Android application for sending sms

    I have been playing around with Android application in past. I thought of writing a simple application which can send a SMS. Android has provided android.telephony.SmsManager class which has exposed different methods for sending SMS. If the message size is less than 160 character then we can use the the following method. sendTextMessage(String destinationAddress, String…

  • Code4ReferenceAndroid AVD Emulator libGL.so error

    After announcement of Jelly bean I upgraded to Android SDK 4.1. After upgrade, AVD didn’t boot up properly and it always froze on Android boot Image. I noticed the following error on the console. Failed to load libGL.so error  libGL.so: cannot open shared object file: No such file or directory After a bit of research…

  • Code4ReferenceRegistering/Unregistering Android broadcast receiver.

    In the previous post, we learned to enable and disable the Broadcast receiver added in the Android manifest file. In this post, we will learn to register and unregister broadcast receiver programmatically. It’s always suggested to register and unregister broadcast receiver programmatically as it saves system resources. In this tutorial, we will make an application…

  • Code4ReferencePython package/library source code browsing

    Recently I moved to new project where the programming language was Python. I often get confused about what module do I need to import ? what is the signature of the method/function? etc. I also tried to consult the documentation provided by the third party library but many a times I didn’t get the clear idea. …

  • Code4ReferenceHow to find Android default screen orientation

    How to find Android default screen orientation. Recently while developing my personal project, I had a requirement to find the default screen orientation of device. Tablet default screen orientation is landscape whereas Mobile phone default screen orientation is portrait.  Well after a little bit of research I found that getRotation method can fetch me the default…

  • Code4ReferencePermalink: New feature introduced in blogger. » Code4Reference

    If you are an active blogger then you must be aware of the SEO and ways to customize your blog to get the greater traffic. Earlier Blogger had introduced the “Search Description” feature to provide more control  on indexing of blog, posts, and images so they appear correctly in search results. Now they have introduced one more…