Sunday, May 31, 2020

Friday, January 8, 2016

AngularJS Helloworld

As a Developer, we know that Web browser understands HTML. Most of the client side frameworks works on HTML to improve the performance of user experience. Similar way AngularJS also works on HTML tags and its customized directives (ng-app, ng-controller) to render page.

How it works ?

Scope is glue between view and model. Whatever entered information will be updated in syc with Model.
View template:
<!DOCTYPE html>
<html ng-app="helloApp">                       
    <title>AngularJS - Hello World</title>
<script src="angular.js"></script>
<script src="helloController.js"></script>
</head> <body ng-controller="HelloController">                   
<input type="text" ng-model="name"> <br />  
Hello <strong> {{name}} </strong>
</body> </html>
var helloApp = angular.module('helloApp', []);

helloApp.controller('HelloController', function($scope) {
   $ = 'world';


Friday, May 22, 2015

Major Web applications attacks in .Net

As a Programmer, when we write code, we will concentrate on the functionality and output, but we are least bother about security of the application. Secure code gives always freedom from hacking.

Below are few known attacks of web application (OWSAP top 10 .Net attacks)

  1. Security Misconfiguration
  2. Cross Site Scripting
  3. SQL Injection
  4. Cross Site Request Forgery
  5. Failure to Restrict URL Access
  6. Insuffitient Transport Layer protection
  7. Unvalidated redirects and Forwards
  8. Insecure Direct Object Reference
  9. Authentication Breach
  10. Insecure Cryptographic Storage

Wednesday, June 13, 2012

Android versions and version codes

All of us learned A for apple and B for ball, isn't it?. Google followed same approach for version code names. Version code names also follows same approach except A.They left A coz i think A for Android.

Th following are the versions and and code names

Version Code
1.0 and 1.1
2.0.x and 2.1.x

Thursday, May 31, 2012

Scheduling background task using Alarm Manager Android

All of us know, what Alarm does. Alarms will run in the background, whenever it counter the time, plays nice Music. Alarm wake-up us. Every phone has this feature from low end to high end mobiles.

In Android, we can use Alarms to schedule the tasks. Android has Alarm manager to manage these Alarms.

Service, perform long-running operations in the background and does not provide a user interface.

We need to use Alarm manger as well as service for scheduling background task like downloading information at particular time.

Steps to Create background task :
1. Create project, specify default activity. The following code to set schedule and cancel schedule for background task
public void btnStartSchedule(View v) {

  try {
   AlarmManager alarms = (AlarmManager) this

   Intent intent = new Intent(getApplicationContext(),

   final PendingIntent pIntent = PendingIntent.getBroadcast(this,
     1234567, intent, PendingIntent.FLAG_UPDATE_CURRENT);

     System.currentTimeMillis(), 10000, pIntent);
  } catch (Exception e) {
   // TODO Auto-generated catch block


 public void btnCancelSchedules(View v) {

  Intent intent = new Intent(getApplicationContext(),

  final PendingIntent pIntent = PendingIntent.getBroadcast(this, 1234567,
    intent, PendingIntent.FLAG_UPDATE_CURRENT);

  AlarmManager alarms = (AlarmManager) this

2. Create AlarmReceiver, for waking up the task
public static String ACTION_ALARM = "com.alarammanager.alaram";

 public void onReceive(Context context, Intent intent) {
  Log.i("Alarm Receiver", "Entered");
  Toast.makeText(context, "Entered", Toast.LENGTH_SHORT).show();
  Bundle bundle = intent.getExtras();
  String action = bundle.getString(ACTION_ALARM);
  if (action.equals(ACTION_ALARM)) {
 Log.i("Alarm Receiver", "If loop");
 Intent inService = new Intent(context,TaskService.class);
 Log.i("Alarm Receiver", "Else loop");
 Toast.makeText(context, "Else loop", Toast.LENGTH_SHORT).show();
3. Create a Service do background task
public class TaskService extends IntentService {

 public TaskService() {
  // TODO Auto-generated constructor stub

 protected void onHandleIntent(Intent arg0) {
  // Do some task
Log.i("TaskService","Service running");

4. Specify the receiver and service in the Manifest file.

        android:label="@string/app_name" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            android:process=":remote" >

        <service android:name=".TaskService" >
References : download_source_code

Saturday, May 5, 2012

My New Mobile HTC One X and its Reviews

Recently, Went to service center for repairing my old phone Samsung galaxy Captivate. They told that phone screen is damaged and have to replace the screen. i asked him that “How much will you charge for changing screen”. He told that it will cost around 10,000. I shocked and realized it is the time to change the phone. 

I have done market research on android phones as well as apple, Came to know that HTC One series mobile are good as per software and hardware. 

Checked HTC One X features and bought it.

Specifications :
Processor : 1.5 GHz Quad core processor
Display : 4.7-inch (1280 x 720 resolution) - HD 720p touch
RAM : 1 GB
Music: Beats Audio
Connectivity : NFC, Wi Fi, Wi Fi Direct, Bluetooth
Camera : 
  • 8 megapixel camera with auto focus, smart LED flash, and BSI sensor (for better low-light captures)
  • 1.3 megapixel front camera (720p for video chat)
Memory : 32GB Internal memory
Software : ICS - 4.0.3

Reviews : 
  1. Camera quality is extra ordinary
  2. Audio is awesome
  3. Display is mind blowing 
  4. Battery life is not too bad
Coming to negatives, it does not have extra SD card port. i feel 32 GB is enough for mobile devices. Also, phone heats a lot whenever playing games and using camera for more time.

At the end, i feel HTC OneX is the best phone in the market as of now. 

References :

Thursday, March 29, 2012

Bind Spinner (Dropdown) Android

As a beginner, It is difficult to bind the data to Spinner (Drop down). If we consider HTML, it is easy to add option values to the drop down. But In Android, we have to use Adapters to bind the data. So here I am targeting my approaches to bind to the Spinner. 

Binding static Array to the spinner

static final String[] COUNTRIES = new String[] { "India", "US", "UK",
   "Sri Lanka", "Austraila", "Denmark", "Saudi" };

Spinner spCountry = (Spinner) findViewById(;

ArrayAdapter<CharSequence> adCountry = new ArrayAdapter<CharSequence>(
                this, android.R.layout.simple_spinner_dropdown_item, COUNTRIES);  


Binding resource Array to the Spinner

Spinner spCities = (Spinner) findViewById(;

String[] cities = getResources().getStringArray(R.array.arr_cities);

ArrayAdapter<CharSequence> adCities = new ArrayAdapter<CharSequence>(
       this, android.R.layout.simple_spinner_item, cities);



Binding resource Array to the Spinner Using ArrayAdapter.createFromResource

Spinner spLocalities = (Spinner) findViewById(;

ArrayAdapter<CharSequence> adLocalities = ArrayAdapter
   .createFromResource(this, R.array.arr_localities,android.R.layout.simple_spinner_item);



References : download_source_code

Monday, March 26, 2012

Openframeworks Vs A Day Made of Glass

Few days ago, I watched a video - "A day made of glass".My reaction was, "When will I see this technology in action?"

Few months later, I found one framework by name "OpenFrameworks". I realize that the things that were shown in " A day made of Glass" are possible by this framework.

Here is the one of the most popular game - SNAKE, implemented using openframeworks in a different way.


Wednesday, March 7, 2012

Android Preparing Development Environment

I feel many developers wants to write mobile app and run in their mobile. Tools are plays important role while developing any application. Like wise, If you want to develop android app, first you need to prepare develop environment. In this post will see how to install and create hello world project.

What to install ?
  1. Java ( JDK5 or JDK6 or any latest version )
  2. Android
    1. SDK
    2. Platforms ( at least one )
  3. Eclipse
  4. Eclipse ADT

If Java is not installed in system, you need to download the java file from the following link and install it.

Android SDK

If Android SDK is not installed in system, you need to download the SDK file from the following link and install it.


If Eclipse is not available in machine, you need to download from the following link.

Note: No need to install eclipse, download and extract the eclipse. You will find eclipse.exe, just open this. 

Eclipse ADT

  1. Start Eclipse, then select Help > Install New Software....
  2. Click Add, in the top-right corner.
  3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
  1. Click OK
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
  1. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  2. In the next window, you'll see a list of the tools to be downloaded. Click Next.
  3. Read and accept the license agreements, then click Finish.
Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.

Android Platforms

After successful installation, you will find SDK Manager.exe or AVD Manager.exe files in android installation folder.
  • Open the SDK Manager.exe, you will find the following screen
  • Select the platforms which you want to install. (it is better to install Eclair[ 2.1 ], Froyo[ 2.2], Gingerbread[2.3.3] and Honey Comb coz will find only these platforms in mobiles and tabs as per present market)
  • Click on the Install Packages and then select Accecept all, Click install

  • After successful installation, open the AVD Manager and create virtual device by clicking New button

  Creating Helloworld project
  1. Open eclipse by clicking on eclipse.exe
  2. Click on File -> New 

 3. Select the Android project
 4. Will find Create New Project Window, type the Project Name as Helloworld
 5. Next screen, will find Select Build target window. Select target platform, Click next

6. Here you will find Application name and project name. Type some names and click on the Finish button.

7. Run the application by clicking Run button and select Run as Android project.

You done... You will be able to see hello world application in Emulator.

Good luck :-)

References :