Pages

Saturday, October 29, 2011

Configure Eclipse for Android Dev/Tools not found Error

Just started up with my first development with Android here is the link to how to setup Android ADT Package in Eclipse...
 
http://developer.android.com/sdk/eclipse-adt.html#installing
 
Here is the link for complete guide.
 
http://developer.android.com/sdk/installing.html#Installing
 
And if you are still getting an error like tools not found in android sdk in Eclipse
  
Run Android SDK Manager from start menu 
 
On the top you will see SDK Path

copy that path(you won't be able to copy it practically.I meant just take a note of that path)

run eclipse 
 
it will show an error that tools not found in a given directory

click on window menu select preferences

select Android from the list on left hand side 
 
on the right hand side you will find "SDK Location". Copy that path next to that and Bingo issue resolved 

Tuesday, October 18, 2011

Storage Types in C Sharp

C Sharp has following types to Manage Data 1. Value 2. Reference 3. Pointer 4. Void Value types are used to store data.Two types are Struct and Enumeration Struct types include structures and built in simple types(int,float) Enumeration is a user type defined variables or we can say set of named constants Reference types are used to store references to data elsewhere in your c# program.Reference type keywords include Class,Interface,Delegate,Object,String Pointer types let you point to specific location in memory Use Void type in a method to specify that method does not returns a value...

Difference between Structure a class and its use.

The basic difference between a structure and a class is that a class is a reference type while a structure is not.All the information regarding different properties and functionality of an of an object are contained in the structure it self. Though Classes have an edge over structures as they belong to the Oops family structures are much handy in cases where there are limited range of values for a particular entity For example color of car and its model....etc...Structures are handy where we require less space comparatively Structures can include constructors but these must include parameters Structures cannot inherit another structure but they can implement interfaces.... Classes use Heap method for storage to which further space can be allocated easily while Structures use stacks as a storage medium so their storage is not expandable that is why where memory constraint is a factor structures and Unions are preferred over classes

Tuesday, September 27, 2011

Usage of Obsolete attribute

Recently I came across a fine technique to mark your old code as obsolete in C#. I did some research work and Book called the same as an Insert attribute.Leaving the theory apart the practical was was that interested me the most and here I present an example of the same.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Types
{
class Program
{
enum weekdays {mon=1,tue,wed,thurs,fri,sat,sun}

//Use of obsolete attribute to mark a function a obsolete
[Obsolete("Use newmethod", true)]
static void oldmethod()
{
Console.WriteLine("No");
}

static void newmethod()
{
Console.WriteLine("Yes");
}

public static void Main(string[] args)
{
int x = (int)weekdays.wed;
Console.WriteLine("The wednesday Enum value is {0}",x);
newmethod();
}
}
}

now when I call "oldmethod()" It gives an error with a message specified as in the code...

and on calling "newmethod()" it runs fine

I peeped more into their family and found following attributes also as a part which I will discuss later

AttributeUsage
AttributeTargets
Conditional
Obsolete as discussed in this post...

Boxing and Unboxing in OOPS

Boxing is a process of conversion of a value to generic object type for example

Consider the following code

Int alpha=1;
object boxed_alpha= alpha;

This conversion to generic type is called as boxing

Unboxing is the reverse of a boxing continuing with the above example let us unbox boxed_alpha as a string

String string_alpha=(String) boxed_alpha;

OR

String string_alpha=boxed_alpha.ToString();

I will discuss its use subsequent comments

Thursday, September 15, 2011

Getting the address of last visited page

The "document.referrer" is a string object that holds a web address of the document from which the current HTML document was reached

The Link Object of Document in javascript

In java script the link object as following properties

1) Link.hash->contains the hash portion of the web address
2) Link.host->contains host information from the links web address
3) Link.href->contains entire web address specified in the link
4) Link.hostname->contains information regarding hostname from links web address
5) Link.pathname->contains path to the file link is directed to
6) Link.port->contains the port specified in web address
7) Link.protocol->protocol specified in link's web address
8) Link.search->Querystring specified in the web address
9) Link.target->object containing name of target window
10)Link.innerHtml->Text that shows up for the link

Monday, September 12, 2011

Wednesday, August 10, 2011

Check if javascript is disabled

To check if javascript is disabled and execute a code block on the same condition use the following block

Tuesday, August 2, 2011

Difference between Silverlight and WPF

Silver light is designed to build browser-based rich applications where as WPF aims at building rich windows applications

Silverlight runs on a stripped-down version of .Net framework but WPF supports IE,Firfox and Safari on Mac.

Moonlight is an effort by Microsoft to support Silverlight on Linux/Unix
http://en.wikipedia.org/wiki/Moonlight_%28runtime%29

New in different stages of . Net

.Net 2.0
Entirely new framework for developing managed web and Windows apps

.Net 3.0
Added WCF + WPF in addition to .Net 2.0

.Net 3.5
Added Linq

Sunday, June 26, 2011

Registration Form->Requirement Analysis

You can add further points if you like R&D is a never ending process

1.Form Design:Use of any of the inline design or a company template
2.Username/Password will be system generated or manual
3.fields in a registration form
4.Validations on fields
5.Required fields
6.Procedure to recover password
7.Password Expiry System if needed

Wednesday, February 9, 2011

Sorting Digits of a Number

Q A function takes numbers as inputs and arranges them in O(n) in ascending order

Same as my last post we will use merge sort here.A merge sort has a complexity of O(n) so we can sort the number in O(n)

Tuesday, February 8, 2011

Sorting digits of a number

This is the first post
Recently I came along an interesting problem.

Q A function has input (int[] array) enter any number(array of digits of that number is entered) and the resulting number should convert to absolute number like 4578,6789,1234 etc. i.e in increasing order.Solve this in O(nlogn)?

Well I used merge sort for this as follows since merge sort has a complexity of O(n) as follows

namespace absolute_no
{
class Program
{
static int[] mergesort(int []array)
{
int x;
if (array.Length <= 1)
return array;
int[] left,right,result;
int middle = array.Length / 2;
left=new int[middle];
result = new int[array.Length];
right = new int[array.Length-middle];
for (x = 0; x {
left[x] = array[x];
}
int y=0;
for (x = middle; x {
right[y] = array[x];
y++;
}
left = mergesort(left);
right = mergesort(right);
result = merge(left, right);
return result;
}

static int[] merge(int [] left,int[] right)
{
int [] result=new int[left.Length+right.Length];
int x=0;
int y=0;
int i=0;
do
{
if (left[x] <= right[y])
{
result[i] = left[x];
i++;
x++;
}
else
{
result[i] = right[y];
i++;
y++;
}
} while (x < left.Length && y < right.Length);
while(x {
result[i]=left[x];
x++;
i++;
}
while(y {
result[i]=right[y];
y++;
i++;
}
return result;
}
static void Main(string[] args)
{
int []arr = { 1, 7, 5, 6 };
arr = mergesort(arr);
}
}
}