Wednesday, July 7, 2010

Working with Interfaces in C#

Working with Interfaces in C#



Interfaces

To rectify the drawback of multiple inheritance, the creators of C# have introduced a new concept called interfaces. Java programmers may be well aware of this concept. All interfaces should be declared with the keyword interface. You can implement any number of interfaces in a single derived class, but you should provide signatures to all method definitions of the corresponding interfaces. To illustrate, Listing 1 shows how to declare interfaces and implement them in a class:

Listing 1

using System;

interface Interdemo
{
void Show();
}

class Interimp:Interdemo
{
public void Show()
{
Console.WriteLine("Show() method Implemented");
}

public static void Main(string[] args)
{
Interimp inter = new Interimp();
inter.Show();
}
}

Combining Interfaces

Two or more interfaces can be combined into a single interface and implemented in a class, as shown in Listing 2:



Listing 2

using System;
interface Interdemo
{
void Show();
}

interface Interdemo1
{
void Display();
}

interface Combineinter:Interdemo,Interdemo1
{
//Above interfaces combined
}

class Multipleinterimp:Combineinter
{
public void Show()
{
Console.WriteLine("Show() method Implemented");
}

public void Display()
{
Console.WriteLine("Display() method Implemented");
}

public static void Main(string[] args)
{
Multipleinterimp inter = new Multipleinterimp();
inter.Show();
inter.Display();
}
}

You easily can determine whether a particular interface is implemented in a class by using is and as operators. The is operator enables you to check whether one type or class is compatible with another type or class; it returns a Boolean value. Listing 3 illustrates the usage of the is operator by revisiting Listing 2.

Listing 3

using System;

interface Interdemo
{
bool Show();
}

interface Interdemo1
{
bool Display();
}

class Interimp:Interdemo
{
public bool Show()
{
Console.WriteLine("Show() method Implemented");
return true;
}

public static void Main(string[] args)
{
Interimp inter = new Interimp();
inter.Show();

if(inter is Interdemo1)
{
Interdemo1 id = (Interdemo1)inter;
bool ok = id.Display();
Console.WriteLine("Method Implemented");
}

else
{
Console.WriteLine("Method not implemented");
}
}
}

Whereas the is operator returns a boolean value as shown in the preceding listing, the as operator returns null if there is any incompatibility between types. Listing 4 examines the usage of this operator. Here we have revisited Listing 3. Notice the change in code inside the Main () method.

Listing 4

using System;

interface Interdemo
{
bool Show();
}

interface Interdemo1
{
bool Display();
}

class Interimpas:Interdemo
{
public bool Show()
{
Console.WriteLine("Show() method Implemented");
return true;
}

public static void Main(string[] args)
{
Interimpas inter = new Interimpas();
inter.Show();

Interdemo1 id = inter as Interdemo1;

if(null!=id)
{

bool ok = id.Display();
Console.WriteLine("Method Implemented");
}

else
{
Console.WriteLine("Method not implemented");
}
}
}

Avoiding Name Ambiguity

Suppose you are declaring same method definitions in two different interfaces. The compiler will naturally show an error due to the ambiguity of the implemented method. Even if you use the "is" keyword, the compiler still will show warnings. To avoid this, you have to follow the syntax as shown in Listing 5:

Listing 5

Void .
{
//Body goes here
}

Listing 6 illustrates the application of the preceding concept in detail:

Listing 6

using System;

interface Interdemo
{
void Show();
}

interface Interdemo1
{
void Show();
}


class Interclash:Interdemo,Interdemo1
{
void Interdemo.Show()
{
Console.WriteLine("Show() method Implemented");
}

void Interdemo1.Show()
{
Console.WriteLine("Display() method Implemented");
}

public static void Main(string[] args)
{
Interclash inter = new Interclash();
inter.Interdemo.Show();
inter.Interdemo1.Show();
}
}

Computing table content differences with Oracle SQL

Computing table content differences with Oracle SQL


The question "what is the difference between two tables? is simple to ask, but difficult to code. It's like an "anti-union" where we seek only the unique rows within each table.

Tropashko has a great analysis of this common SQL problem from both a mathematical perspective and a practical Oracle perspective. It also shows an undocumented technique for improving execution speed for querying the non-intersection of two tables.

Vadim notes that the _convert_set_to_join parameter can be used when comparing the contents of two tables. This type of SQL query is called a "semantic difference", or an "anti-union" operation. Tropashko depicts the table comparison problem below:

In the above figure we read the "/" as "not in" and the "∪" as "union". In sum, we want the table comparison SQL to find:

Rows in table A that are not in table B
plus
Rows in table B that are not in table A

Vadim notes that the obvious solution van have poor performance:

The figure 1 with the expressions (A \ B) ∪ (B \ A) and (A ∪ B) \ (A ∩ B) pretty much exhaust all the theory involved. It is straightforward to translate them into SQL queries. Here is the first one:

(select * from A
minus
select * from B) -- Rows in A that are not in B
union all
(
select * from B
minus
select * from A
) -- rows in B that are not in A

In practice, however, this query is a sluggish performer. With a naïve evaluation strategy, the execution flow and the operators are derived verbatim from the SQL which we have written. First, each table has to be scanned twice. Then, four sort operators are applied in order to exclude duplicates. Next, the two set differences are computed, and, finally, the two results are combined together with the union operator. . .

SQL Server - Temporary Table

SQL Server - Temporary Table

Creating a temporary table is virtually the same as creating a normal table. The main exception is the naming of the table. A hash ('#') character as the first character in the table name denotes that it is a temporary table.

There are two types of temporary tables, local and global.

A local temporary table has a single hash ('#') at the start of its name. A local temporary table is visible only to the user who created it and is destroyed automatically when that user disconnects.

A global temporary table is denoted by a name starting with two hashes (i.e. '##'). A global temporary table is visible to all users and is deleted automatically when the last user who has referenced the table disconnects.

An example of creating a local temporary table:

create table #foo
(
CarIndex smallint,
CarType varchar(20)
)

An example of creating a global temporary table:

create table ##baz
(
CarIndex smallint,
CarType varchar(20)
)

Exclusive Archos 7 Home Tablet

Exclusive Archos 7 Home Tablet



By Mey Lia

The revolutionary design of mobile phone, MP3 Player and PC has created many amazing styles, models and designs that will make the customers stunned and astonished. Each and every month all the elements in the manufacturers including the IT software and hardware experts are competing to create amazing products.

Like the tablet based Android OS, actually it is not only available for the use as same as a PC. But taken from the bright idea, Archos 7 Home Tablet is now already offer for the comfort of the customer to enjoy movie as the media to watch the movie with new huge screen. This device completely looks adorable. It is the impressive style of tablet based Android OS that ever created. The customers are allow to watch the HD movies with the good performance, able to download movie from the internet, or customers are able to directly connect to the internet and do several social networking activity, or email, or browsing and much more enjoyments.

The customers are offered with many selections in this device. Just prepare your $199, to get this Archos 7 Home Tablet. It is available in the market to pre-order. Complete your house with Archos 7 Home Tablet.

Sorce :- http://thebestmp3player.com/page/3/

Smartphones for High-End by Dell Thunder

Smartphones for High-End by Dell Thunder


By Mey Lia
Mobile Phone manufacturers are very creative in developing product that they differentiated it in several market levels. Commonly the market will be divided into three segments first is the high end, medium-end and low end. Each of the market segments has its own price and specs level. Differentiation products according market segment is important to do in order to adjust with the demand.
The mobile phone that recently was developed by many manufacturer possess multi task, and ability to conduct the applications is now called as the Smartphone. That glossy shimmering mobile phone is actually the latest gadget from the Dell manufacturer. It is the Dell Thunder High-end Smartphones. This product is intended to target for market segment of people that prepare a bigger budget to purchase a device.
This Dell Thunder High-end Smartphone has screen with 4.1 inch 800 x 480 pixel screen. It is more than sufficient for the level of Smartphone. The customers are allowed to enjoy the technology and also entertainment with this gadget. Connectivity to internet is able to access for Facebook, Twitter, Myspace and many other social networking. The camera is 8MP, with HSPDA, and virtual keyboard. The processor is using Snapdragon processor. Many other interesting features are available in this Smartphone, including an embedded video Hulu app.

Source :- http://thebestmp3player.com/page/2/

T-Mobile Garminfone Soon in the US Market

T-Mobile Garminfone Soon in the US Market





Get ready to see the T-Mobile Garminfone in the US market soon. This device is actually cell phone completed with GPS navigation means. The T-Mobile USA has officially announced that they will release this to market. This device is powered by Android processor with Garmin premium for its navigation system. This device is designed to help the driver to show the direction from one point of spot to another without getting lost.
This T- Mobile Garminfone will be in market this spring. It is operated with key touch of 3G, the screen is 3.5 inch. This company claimed that this device has the ability to navigate above any other same level device in the market. The users just have to click the address that he want to go to get from the text of emails, messages or calendar appointment, then this smart phone will automatically navigate the way to that target place.
This T-Mobile Garminfone guarantees not to give overlapped direction of navigation, not like any other navigators. In this device voice is also available in order to make the users easier to apply this device. In here include Microsoft, Wi-Fi, 3G, instant message and connectivity such as email, FB, Twitter and many more advantages.

Source :- http://thebestmp3player.com/page/2/

Understand Cat’s Language With ‘Meowlingual’

Understand Cat’s Language With ‘Meowlingual’

By Mey Lia
Many people in world love to keep cat as their pet at home. They love cat very much because of the cute looking, smooth furry, funny acts and sweet purr voice. The relationship between the cat and the owner are built from language that spoken with each part. This means that the owner will speak in human language and cat will of course only able to express its communication with its own language, like meow.
For certain time cat and the owner able to understand each other. But in other occasions the owners cannot understand what does the cat trying to tell. This is going to be a problem for the owner, moreover if the cat is annoying with its language.
Technology always finds the way on how to solve such problem. It is the ‘Meowlingual’ actually a tool with high-tech computer system, that able to translate cat language into human language. This tools able to translate 200 of cat’s phrases, it is displayed on the LCD of this Meowlingual.
This Meowlingual is made in Japan and only available in the Japan’s market. This product is actually more expensive than the former similar product but tools for translating dog’s language into human language, called the “Bowlingal” ($120), which sold in the US market.

Source :- http://thebestmp3player.com/Understand-Cat%E2%80%99s-Language-With-Meowlingual

Bag to Charge Laptop Energy

Bag to Charge Laptop Energy


By Mey Lia

Earth day is every day. Moreover after the recently development of the global warming, people from over the world become more concern to take act in order to reduce global warming. The emphasis acts are mostly in limiting the use of energy. This is shown by many manufacturers that create tools and devices in order to more limiting the energy consumption.

One of their inventions is a Bag for Laptop of Voltaic Generator Solar Energy. This bag’s size is similar with any other laptop bags, but on every sides of the bag there are all applied with voltaic Generator Solar Energy. This is very smart, because instead of plugging in the charger’s battery of laptop on the house’s electricity device, this one able to charge the laptop’s battery, this will save much energy. Just by put the laptop inside the bag, and there you go, the charging time is automatically going on. The laptop will be juiced for about five hours.

This bag’s price is $499. This is not just for saving energy but the bag itself is also made from recycled from many soda bottles. This summer, the bag’s manufacturer, Samsonite is looking forward to release its own line of solar bags.

Source : http://thebestmp3player.com/

Save the Energy with Energy Orb

Save the Energy with Energy Orb



The Southern California Edison power company has come up with the idea of when should people use more or less energy at home and for how long? That is why this power company made a device that able to show to the users about the consumption of energy at home. If people know when the suitable time to use energy, therefore the cheaper cost of electricity will be. This is the aim of this company to create the Energy Orb.

This is actually a small clever devise that only operated with fingertips; it is very easy to use at home. The concern for people to use less energy is the idea from the company. Since the world has spend too much energy annually, and this give bad effect to the earth. This company also created an Ambient Orb. This is a small round glowing ball that will change its color according to the changes of streaming data for example data of interest rates, weather, curse exchange etc.
The customers have proven that the use of Energy Orb it has reduced their energy consumption at home for 40%. This sphere will glow constantly as a media to communicate to the user of how the energy will be efficient or oppose.

Smart Watch Citizen i:Virt

Smart Watch Citizen i:Virt

Watches are functioned to show the time. But by the time goes, watches were modified not only to show the time, but also, date, weather, temperature, and sometime complete with the extra light. Watches are able to modify by the manufacturers according to the need for the users. The modification of watch is starting for the simplest function to more complex purposes.

The watch manufacturer, Citizen, has invented a watch that able to be connected to the mobile phone or Smartphone, it is specially designed to have the link to it with the media of Bluetooth. This product is called with Citizen i:Virt. With the help of Bluetooth this Citizen i:Virt watch able to give sign of all the incoming phone calls, incoming message, and the user is able to read that message.

This is in order to simpler the mobile phone users while their hands are full holding other thing. Just by put in on the wrist, the user will easy to look whether any phone calls are coming in. This watch is very useful for example, during the meeting, or during test and examination is going on, where the mobile phone and the Smartphone will be kept silent.

Source : http://thebestmp3player.com/

Add Sitemap in Google-Yahoo-Bing for Bloggers

Add Sitemap in Google-Yahoo-Bing for Bloggers


Many bloggers are getting trapped when they read somewhere about adding sitemap for the blog for better indexing, so no need to confuse any more, i will going to tell you step by step procedure for how you can add Sitemap for Blogger in Google, yahoo and Bing.
Add Sitemap in Google-Yahoo-Bing for Bloggers

Prerequisites: First lets introduce you from the different Webmaster Tools which you need to be understand. You will need accounts for the sites, and you should be able to add some code in your blog or site (Verify Meta tag). you should have your blogger feeds ready (Example of the feeds is http://feeds.feedburner.com/geekbloggerorg)
  • Google webmaster tools
  • Yahoo site explorer
  • Bing webmaster tools


Steps to Add Sitemap in Google Webmaster Tools Add sitemap for blogger in Google webmaster tools 1. Open Google webmaster tools.
2. Find Add a Site Button then Enter your URL and Click Continue (Complete Meta Tag Verification process by adding meta tag to your blog's <head> section) Verify meta tag
3. After adding site to your Google webmaster navigate to the Dashboard > Site Configuration > Sitemaps.
4. Click on Submit sitemap button.
5. Enter this same string (Don't Modify this): atom.xml?redirect=false&start-index=1&max-results=500
6. Click on submit button and Done! Steps to Add Sitemap in Yahoo Site Explorer Add sitemap for blogger in yahoo site explorer 1. OpenYahoo site explorer.
2. Navigate to the Site Explorer > My sites.
3. Enter your site Name and Click on Add My Site Button.
4. Verify your site as seen above step 2 for Google.
5. You will get the message like "Your site has been authenticated".
6. Add feed URL in Site Explorer > Feeds Section. Note: Rest of the things will look after by yahoo. Steps to Add Sitemap in Bing Webmasters Add sitemap for blogger in Bing 1. Open Bing webmaster tools.
2. Click on the Site List (Left pane).
3. Click on Add a site button and fill the Web address, Sitemap address(Feed URL), Contact information and Webmaster e-mail:
4. finish HTML META Tag authentication.
5. Done and now you can find the summary, profiles, backlinks and many more. Please put your comments on this Article.


Source :- http://www.geekblogger.org/2009/12/add-sitemap-in-google-yahoo-bing-for.html#more

Custom Meta Tags for Each Blogger Posts - Blogger SEO Tips

Make your post title,your blogs title

Now you can use custom Meta Tags for each blogger posts which will help you to increase the visibility of your pages in search engines, this can be done by adding little piece of code in you <head> section of your blog, with the help of this code you will have different description for individual blogger posts.



Navigate to the Dashboard > Layout > Edit HTML and Add below code into your <:head> section. must be before </head> section.



<b:if cond='data:blog.url == data:blog.homepageUrl'>
<meta content='Geek Blogger - Best Blogging Hacks and Templates, Free Widgets and Plugins.' name='description'/>
<meta content='Geek, Blogger, Wordpress, BlogSpot, Tips, Hacks' name='keywords'/>
<title><data:blog.pageTitle/></title>
<b:else/>
<title><data:blog.pageName/> | <data:blog.title/></title>
<meta expr:content='data:blog.pageName' name='description'/>
</b:if>



Benefit of the above code are:


1. If the Page is your Home page then the Blog Title will be Home Page Title

2. If the page is inner page means Post Page then Blog Title would be Post Title

3. If the Page is your Home page then Meta Keywords and Meta Description would be for your Home Page Only.

4. If the Page is your inner page means Post Page then Meta Description would be your Post Title.



Limitations:



The Above code can't give facility of Different Meta Tags for Different Keywords because as you know that Labels are the part of widgets so difficult to maintain that, i will suggest you not use different meta tags for different pages (Posts) because google is no more using your meta keywords for indexing.



Source :- http://www.geekblogger.org/2009/12/custom-meta-tags-for-each-blogger-posts.html#more

Popular Posts