Monday, December 14, 2009

USB drive not present under ‘My Computer’.

Current post is on how to get the USB drive under My Computer.


Even when you see the USB icon in tray, the drive icon is not present under ‘My Computer’ folder.

Steps to get the USB drive:


1. Right click on ‘My Computer’ folder and select ‘Manage’.
2. Select ‘Disk Management’ under ‘Storage option’
3. On lower right hand side, you should be able to see the USB drive.
4. Right click and select ‘Change the drive letter…’ and assign some letter which is not associated with any other things (floppy drives, hard disks, network drives)

The drive will appear with the assigned letter.


Appreciate your feedback via comments. Thanks.

Sunday, December 13, 2009

How to RUN 'Hello Android' Application in Eclipse??

Current post is on how to run 'Hello Android' application in Eclipse


You reached the stage where you want to compile and check you first android application result ??

It's very simple.

1. Go to 'Run' -> 'Run Configurations..'
2. Select 'Android Application' from left panel
3. Select 'New_configurations' from left panel
4. Select 'Android Tab' from right panel and select the workspace
5. Press 'Apply' button
6. Select 'Target Tab' from right panel and select the appropriate emulator
7. Press 'Apply' button
8. Run

Here you go amigo!!!


Appreciate your feedback via comments. Thanks.

Saturday, December 12, 2009

'Hello Android' Application not coming on Emulator screen ??

Current post is on how to get the 'Hello Android' Application on Emulator Screen


You followed all the instructions properly, the code got compiled and the application got deployed on emulator, still you cann't see 'Hello Android' on emulator screen?

Just Relax.

Some times the emulator takes about 2 minutes to load the things.

So first you see 'ANDROID _ '
then you will see 'ANDROID ICON'
and finally your application with 'Hello Android'

So take a deep breath and give some time to emulator to load the application.

Congratulations on your first application on Android.

Friday, December 11, 2009

Target List Empty for Android ???

Current post is on how to get Target List for Android Application in Eclipse.


You installed and followed exactly what was required from you, yet the target list is empty while creating the 'Hello Android' Application ??

If the answer is YES, the follow this simple steps:

1. Go to 'Window' -> 'Preferences'
2. Click on 'Android' Tab
3. Browse to the path where SDK is copied

As soon you provide the correct path you will see various SDK Targets seen in the list view.

Click Apply and enjoy coding.


Appreciate your feedback via comments. Thanks.

Thursday, December 10, 2009

'Hello Android' Android Application on Vista

Current post is on how to create your first Android 'Hello Android' Application in Eclipse in Vista


As in previous post, we setup the things, now it's time to get dirty, i mean start development.

1) Create AVD Emulator


Method:

1. Run 'SDK Setup.exe' from ADK_DWLD_PATH.
2. Select 'Virtual Device' Tab.
3. Select 'New...'.
4. Enter 'Android1.1' (Any name of your choice) in 'Name Field'.
5. Select 'Android 1.1 API Level 2' (Any platform of your choice) in 'Target Field'.
6. Keep rest as default. (You can change as per your requirement)
7. Press 'Create'.


2) Create New Project


Method:

1. Start Eclipse.
2. Select 'File' -> 'New' -> 'Project'.
3. Select 'Android Project' under 'Android'.
4. Press 'Next'
5. Enter 'Project Name' as 'Hello Android'
6. The 'Target Name' will shows all the current platform installed. I selected 'Android 1.1' (Emulator is for API 1.1)*
7. 'Application name' -> 'Hello, Android'.
8. 'Package name' -> 'com.example.helloandroid'.
9. 'Create Activity' -> 'HelloAndroid'.
10. 'Min SDK Version' -> 2 (will be automatically set).
11. Press 'Finish'.

3) Edit the content


Project 'Hello Android' will be created.

Replace the content in 'HelloAndroid.java'.

Code::

package com.android.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity
{
    /** Called when the activity is first created. */
    @Override

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);
    }
}

4) Run the Application


Method:

1. Select 'Run' - 'Run'**.
2. Select 'Android Application'***.


Yes. My first application on 'Andriod'.

* - 'Target Name' Empty list Post
** - 'Run Configuration' Post
*** - 'No 'Hello Andriod' ' Post

Appreciate your feedback via comments. Thanks.

Wednesday, December 9, 2009

Android Setup on Vista

The setup is the stepping stone to develop the application.

Thought the setup is easy, it is just for reference.

1) Eclipse:

Site:- http://www.eclipse.org/downloads/
Software:- Galileo - Eclipse IDE for Java EE Developers (189 MB)

Method:
1. Download the torrent, as you get the flexibilty for pause & resume
2. Unzip it
3. Start using the Eclipse :)

2) Android SDK

Site:- http://developer.android.com/sdk/index.html
Software:- android-sdk_r3-windows.zip (22 MB)

Method:
1. Direct download only. (Supports pause & resume)
2. Unzip it

3) Setting up the path

Method:
1. Right click on 'My Computer' -> 'Properties'
2. Click on 'Change Settings' besides 'Computer Name'
3. Select 'Advanced Tab' -> 'Environment Variables'
4. Double Click on 'PATH' under 'System Variables'
5. Add 'ADK_DWLD_PATH\tools\' & press OK.
6. Press OK and OK to come to 'Properties Page'

4) ADT Plugin

Site:- http://developer.android.com/sdk/eclipse-adt.html
Software:- ADT-0.9.4.zip (3.3 MB)

Method:
1. Download it directly.
2. Start Eclipse, then select Help > Install New Softare.
3. In the Available Software dialog, click Add....
4. In the Add Site dialog, click Archive.
5. Browse and select the downloaded zip file.
6. In Eclipse 3.5 only, enter a name 'Android Plugin' in the 'Name' field.
7. Click OK.
8. Back in the Available Software view, you should now see 'Developer Tools' added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
9. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
10. Restart Eclipse.

5) Android Platform / Offline Documentation

Method:
1. Run 'SDK Setup.exe'from ''.
2. If fetching information fails, go to 'Settings' tab and check the 'Force https ...'
3. Press 'Save & Apply'.
4. It will automatically fetch the new updates or go to 'Available Packages' tab
5. Under 'Https://...', you will find many platforms, api & documentation check boxes
6. Select whichever you need to download and install.
7. Press 'Install Selected'.
8. Select whichever you need and select 'Accept' to accept the agreement.
9. Select 'Install Accepted'
10. It will download and install all the things (platform / docs) one by one.


All done. Ready to roll to application development.

Monday, December 7, 2009

Order the array of 0 & 1

Question:

Order the list with ‘0’ first and ‘1’ second, which has ‘0’ and ‘1’ stored in irregular fashion.

Constraints:
-> Time & Space complexity to be minimal

Example:

Array: 0-1-0-1-1-0-1

Answer: 0-0-0-1-1-1-1

Answer:

-> Start with one pointer from start and another pointer from back.
-> Stop if you find ‘1’ for first pointer
-> Stop if you find ‘0’ for second pointer
-> Interchange till both the pointers are not crossed over.

Complexity:

Time: O(2N) -> O(N) , where N represents longest link list length

Example:

Array: 0-1-0-1

Answer: 0-0-1-1

Tracing:

Step 1:

-> Let Pointer 1 points to head of array
-> Let Pointer 2 points to tail of array

Step 2:

-> Pointer 1 will stop at node 2 as it has '1'

Step 3:

-> Pointer 2 will stop at node 3 as it has '0'

Step 4:

-> Interchange the values of node 2 & 3 with 0 & 1 respectively

Step 5:

-> Pointer 1 crosses over Pointer 2. Stop

Answer:

0-0-1-1

Saturday, December 5, 2009

Reach i-th position from tail of link list

Question:

To reach i-th position from tail of link-list by traversing only once.

Example:

1-2-3-4-5-6-7-8-9

To reach 3rd node from tail. i.e Node 7

Answer:

-> Take two pointers.

-> Take first pointer to i-th position from head

-> Start incrementing both the pointers

-> When the first pointer reaches the tail, at that point second pointer will be pointing to i-th node from tail

Example:

1-2-3-4-5-6-7-8-9, to reach 3rd node from tail i.e. Node 7.

Tracing:

Step 1:

-> Pointer 1 & Pointer 2 points to node 1

Step 2:

-> Increment Pointer 1 '3' times, as we want 3rd node from tail

Step 3:

-> Increment both the pointers

Movement of Pointer 1: 3-4-5-6-7-8-9
Movement of Pointer 2: 1-2-3-4-5-6-7

Step 4:

Stop when Pointer 1 points to 9, at that time the Pointer 2 points to Node 7

Answer:

Node 7

Thursday, December 3, 2009

Test whether two link list have common nodes or not?

Question:

To test whether two link list have common nodes or not?

Hints:
-> There may be more then 1 common nodes
-> The length of both the link list might not be same

Constraints:
-> Time & Space complexity to be minimal


Example 1:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-6-7

Answer: Common nodes from "Node 6"

Example 2:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-d-e

Answer: No common nodes

Answer:

-> Take two pointers, each pointing to head of each list
-> Take two counter variables for each list to store the length of list

-> Traverse both the list and increment the count on each node traversal
-> Get the length difference by subtracting the counter with higher value to lower one and put to some difference variable

-> Increment the pointer "difference variable" times whose length is greater

-> Increment both the pointers and compare at each iteration, till any node reaches the tail

If they reach tail and both pointers didn't got common value -> No common nodes
Else -> Common nodes from that node

Complexity:

Time: O(2N) -> O(N) , where N represents longest link list length
Space: O(3) -> O(1)

Example 1:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-6-7

Answer: Common nodes from "Node 6"

Tracing:

See the previous post.

Example 2:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-d-e

Answer: No common nodes

Tracing:

Step 1:

-> Let Pointer 1 points to head of List 1 and counter is Length 1
-> Let Pointer 2 points to head of List 2 and counter is Length 2

Step 2:

-> The Length 1 value will be: 7
-> The Length 2 value will be: 5
-> Difference variable value will be: 2

Step 3:

-> List 1 length is bigger, hence Pointer 1 will be incremented two time to point to Node 2

Step 4:

Movement of Pointer 1: 3-4-5-6-7
Movement of Pointer 2: a-b-c-d-e

We reached the tail, hence no common node

Answer:

No common nodes

Tuesday, December 1, 2009

Find common meet point node of two link lists?

Question:

There are two link list, which meet at some node X,find the meet point?

Hints:
-> There may be more then 1 common nodes
-> The length of both the link list might not be same

Constraints:
-> Time & Space complexity to be minimal

Example:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-6-7

Here "Node 6" is the meet point.

Answer:

-> Take two pointers, each pointing to head of each list
-> Take two counter variables for each list to store the length of list

-> Traverse both the list and increment the count on each node traversal
-> Get the length difference by subtracting the counter with higher value to lower one and put to some difference variable

-> Increment the pointer "difference variable" times whose length is greater

-> Increment both the pointers and compare at each iteration, till any node reaches the tail
-> The point at which both the pointers get same value is the common node meet point

Complexity:

Time: O(2N) -> O(N) , where N represents longest link list length
Space: O(3) -> O(1)

Example:

List 1: 1-2-3-4-5-6-7

List 2: a-b-c-6-7

Here "Node 6" is the meet point.

Tracing:

Step 1:

-> Let Pointer 1 points to head of List 1 and counter is Length 1
-> Let Pointer 2 points to head of List 2 and counter is Length 2

Step 2:

-> The Length 1 value will be: 7
-> The Length 2 value will be: 5
-> Difference variable value will be: 2

Step 3:

-> List 1 length is bigger, hence Pointer 1 will be incremented two time to point to Node 2

Step 4:

Movement of Pointer 1: 3-4-5-6
Movement of Pointer 2: a-b-c-6

Node 6 is the common meet point.

Answer:

Node 6

Monday, August 3, 2009

Difference between "Struct" of "C" & "C++" ?

Difference:

C Struct :
-> Cannot have member functions.
-> Cannot exhibit polymorphic behaviour.
-> "Struct MyStruct a". "Struct" Keyword required while declaration.

C++ Struct:
-> Can have member functions.
-> Can exhibit polymorphic behaviour.
-> "MyStruct a". "Struct" Keyword not required while declaration.




.

Sunday, August 2, 2009

Difference between Class and Struct in C++ ?

Current post is on difference between Class and Structure in C++ language.


Difference:


Struct:
- By default access is public

Class :
- By default access is private

It means when:
- member variable is declared
- member function is declared
- It is derived

and one does not specific the access specifier, it will get defaulted to mentioned access specifier

Structure Key Points:

- Struct can have member functions.
- Struct can be derived.
- Struct can have polymorphic behavior.



Appreciate your feedback via comments. Thanks.

Saturday, August 1, 2009

Check whether computer is Little Endian / Big Endian ?

Current post is on how to check whether computer is Big Endian or Little Endian.


It is a common technical interview question to test your knowledge on computer architecture.

Endianness refers - the order in which computer stores the bytes.

Little Endian - Stores LSB (Least Significant Byte) in lowest address.

Big Endian - Stores MSB (Most Significant Byte) in highest address.

Answer:

/* Function returns whether the computer system is Little or Big Endian*/

bool IsLittleEndian()
{
       int TestNumber = 1;
       char * ptr;

       ptr = (char *) &TestNumber;

       return (*ptr);    //True if little Endian.
}

Appreciate your feedback via comments. Thanks.

Thursday, January 15, 2009

Compilation Windows

Compilation is the stepping stone for any application to go from lines in some text to executable or some other thing (library, DLL,etc).

Whenever compilation starts one can look into the process, and what are the errors at the compilation time itself, and not to wait till the end of compilation showing "Build Failed".

Go To Tools >> Options



Projects & Solutions >> General

Check this two simple statements which will make your life very easy to see through the compilation process and the error types and information in cluster.

On setting the output window, it will automatically show one window which will be showing you the current project and in that, which file is getting compiled.

And Error List window is helpful, when there are more project files and few error messages, then instead of search the error in the output window, Visual Studio provides the feature which accumulates all the error messages that appeared in the current compilation and shows them in listed form.

Monday, January 12, 2009

Include Directories

The include directories are of great importance, they provide the header files required for the compilation of the application. If the path specified is not valid or pointed to wrong directory, compilation can be disastrous.

As many a times if wrong header file version comes into compilation, many valid function reference may become invalid. Also some times the function reference may not be able to find the function prototype or can not find the header file itself.

Hence, whenever you face an issue where a standard header file is not found or function reference is incorrect, just make sure the include paths are correct.

Go to Tools >> Options:




Projects and Solutions >> VC++ Directories

Select "Include" from Drop-Down Box.

You will see the include paths in list box.

Tuesday, January 6, 2009

Source (Version) Control Settings in Visual Studio IDE

Current post is on how to change source (version) control  settings in Visual Studio IDE.


Source (Version) control software is an essential tool in every software company. It not only keeps the track of the history, but also its version and copy of it.

Clearcase and SVN are most common source (version) control softwares available in market. Clearcase is a proprietary software from IBM while SVN is open-source software with good developer support.

When writing a code which will go into source control or when you want to edit something in a file which is in source control, we all do check-out and check-in operations.

Some times in hurry we check-out the file which were not meant for check-out, resulting in undo-check-out operation with version-branch-deletion of that file.

In order to avoid such things, Microsoft Visual Studio IDE (VS 2005, VS 2008) provides the source (version) control settings.

Go to Tools >> Options in Menu bar of Visual Studio IDE:

Visual Studio Source Control Settings
Source Control Settings
Click Source Control >> Environment

Check-Out Settings:

  1. On Save or On Edit:
    • Check Out Automatically or Prompt for Check out are the options available. Select as per your needs
    • "Don't show Check-Out dialog box while checking out the items":  
      • Un-Check the check-box, if you want to prevent above scenarios.
      • Check the check-box of if you are precised enough and don't want a headache of another prompt.

    Appreciate your feedback via comments. Thanks.

    Saturday, January 3, 2009

    Concurrent Builds

    In Visual Studio IDE, if one has more then one project in a solution with minimal dependency, one can opt for this "Concurrent Build" feature.

    Complier starts building the projects which are not dependent, in parallel. With Core-2-Duo, this thing gets a boost.

    So, to build the solution faster, just change the thing:

    Tools >> Options



    Projects and Solutions >> Build and Run to "Four"

    It is been tested and concluded that value "Four" is optimal.
    Disclaimer:

    The above post and all the posts in the blog are derived from facts, information, logical interpretation and logical conclusion of printed and internet materials available to me, perceived and produced by 99 gm brain of mine, which by no means always be accurate, consistent and complete.

    All the posts are for personal quick reference only.

    If any suggestion, correction, misinterpretation, misconception commented, which will be moderated and deleted if required, to avoid unforeseen issues.

    If any trademark / copywrite issue is present, do send in a mail and appropriate tag (logo, name, website link) will be attached to the same.

    Additional disclaimer will be attached wherever required in the post.