Steps for running PHP (version 5) with Apache Tomcat 6 Server on Localhost

One of our readers Mr. Nutan Vishwakarma did some studies on how to run PHP with Apache Tomcat 6 Server. Lets see what he has to say..

Simple Steps for running PHP (version 5) with Apache Tomcat 6 Server on Localhost :

1. Download & Unzip PHP (5.2.6) to a directory, c:\php-5.2.6-Win32
(download location http://www.brothersoft.com/php-68222.html)

2. Download PECL 5.2.5 Win32 binaries
(download location http://www.filewatcher.com/m/pecl-5.2.5-Win32.zip.2948387.0.0.html)

3. Rename php.ini-dist to php.ini in c:\php-5.2.6-Win32

4. Add extension=php_java.dll in Dynamic Extensions section in php.ini

5. Extract php5servlet.dll from PECL 5.2.5 to c:\php-5.2.6-Win32

6. Extract php_java.dll from PECL 5.2.5 to c:\php-5.2.6-Win32\ext

7. Create a directory named forphp (any name you like) in tomcat\webapps directory.

8. Extract phpsrvlt.jar from PECL 5.2.5 to tomcat\webapps\forphp\WEB-INF\lib

9. Unzip phpsrvlt.jar

10. Modify both net\php\reflect.properties and net\php\servlet.properties to library=php5servlet

11. Pack phpsrvlt.jar

12. Create web.xml in tomcat\webapps\forphp\WEB-INF as following:

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
<servlet>
<servlet-name>php
<servlet-class>net.php.servlet
</servlet>
<servlet>
<servlet-name>php-formatter
<servlet-class>net.php.formatter
</servlet>
<servlet-mapping>
<servlet-name>php
<url-pattern>*.php
</servlet-mapping>
<servlet-mapping>
<servlet-name>php-formatter
<url-pattern>*.phps
</servlet-mapping>
</web-app>

13. Add php path to the system variable named path

14. Create phptest.php for testing under tomcat\webapps\forphp as following

<?php phpinfo(); ?>

15. Startup tomcat

16. Visit http:\\localhost:8080\forphp\phptest.php
(You should see php info if everything works properly)

Thanks for Reading my POST.

References :
http://www.softminer.net/2009/05/how-to-install-or-run-php-on-tomcat-6.html

MySql : How to Reset Auto Increment Starting Value?

Recently I've been doing a project using MySql database server. I created some tables using auto increment number as the Primary Key.

As the name suggests, the auto increment number will increase every time I insert a new record into the table.

After some point, i wanted to delete all the dummy data i had inserted.

I used DELETE FROM TABLE_NAME statement to delete all the rows.. It removed all the records but did not reset the auto increment number to 1 again.

After a little research i found 2 useful ways to do the needful.

1) After deleting all the rows using DELETE FROM TABLE_NAME statement, use this simple syntax to reset the number :

ALTER TABLE TABLE_NAME AUTO_INCREMENT = 1

OR

2) You can use the statement TRUNCATE TABLE TABLE_NAME. This will remove all the records from the table and will automatically reset the number to 1.

While researching i also found that TRUNCATE statement is quicker than the DELETE FROM statement. This is because the TRUNCATE statement actually drops the table and recreates it. Whereas DELETE FROM statement deletes the records one by one, and is hence slower. Thus, its advisable to use TRUNCATE statement in the scenarios where you want to remove all the records of a table.


I hope you will find this solution useful.. :)

References :
• http://cookingprogrammers.blogspot.com/2008/03/mysql-to-reset-auto-increment-number.html
• http://www.electrictoolbox.com/article/mysql/delete-all-data-mysql/

3rd Software Project for Taj Hotels Chain

It is my pleasure to inform to our readers that we have got the privilege to consult and implement on system wherein all the trainings happening in the hotel are recorded and maintained online at a centralised location.

The system would be named "GYAANPUR" which is taken from the earlier running system on excel files and papers.

It is going to be implemented firstly in Taj Lands Ends, Bandra, Mumbai.

We would keep updated about our progress over the same.

Wish us all the very best.

MySQL- A SOLUTION TO MANY PROBLEMS

This wonderful article about the basics of the well known database management software is provided by an expert in her area of working. Ms. Kanchan is in the industry wherein MySQL is extensively used. Lets understand what she has to say.


.............. In today’s scenario, computers have become a very integral part of our day to day life. You can utilize computers to store oodles of data in different types and number of files. However, to access this data from assorted files and analyze is it a tedious task.



But you can spare yourself from such a tedious task by simply using a popular relational database management, MySQL, a product of Sun Microsystems Inc.. Also known as My Structured Query Language, MySQL is a popular open source database available as a freeware as well. It is written in programming languages, C and C++ and works on various platforms.



In MySQL, the data is stored in the form of structured tables making it easier to understand, query and analyze information. You can access, store, modify and process information varying from basic household expenses to data of huge corporate houses. In addition, you can store data from a single character to documents, graphic files etc,



Being an Open Source database system, you can use and even modify the MySQL software as per your requirements. You can study the source code and personalize the software. However, the source code is available under the GNU General Public License (GPL) that defines the limitations to which you can personalize the software. Alternatively, you can embed a MySQL code into a commercial application by purchasing a licensed version. You can access more information on the limitations of the source code from http://www.mysql.com/company/legal/licensing/.



In addition, you can host information stored in a MySQL database on a web server making it accessible anywhere in the world. By hosting the database over net, you can access, modify or analyze data at any time.



MySQL provides various products such as:
  • MySQL Enterprise: is a comprehensive offering of production support, monitoring tools and database software that delivers optimal performance, reliability, security and uptime. It includes the MySQL Enterprise Server and MySQL Enterprise Monitor softwares, and MySQL Production Support.
  • MySQL Cluster: is only true real-time database that combines the flexibility of a high availability relational database
  • MySQL Embedded Server: is a full-featured, zero administration database that over 2000 ISVs, OEMs, and VARs rely on to make their products more competitive, bring them to market faster, and lower their COGs (cost of goods sold)
  • MySQL Connectors: provides standards-based drivers for JDBC, ODBC, and .Net enabling developers to build database applications in their language of choice
  • MySQL Workbench: enables a DBA, developer, or data architect to visually design, generate, and manage all types of databases including Web, OLTP, and data warehouse databases.

For more information on these products, click http://www.mysql.com/products/.

Proxy Server - an intermediary !!



In a network, a proxy server is the entity that sits between corporate client machines and the Internet. For example, it may sit between a client application, such as a Web browser and the corporate server. Proxies are used to intercept incoming and outgoing requests to see if it can fulfill the requests itself. If not, it then forwards the request to the real server.




The most common types of proxy servers are called Forward and Reverse proxies:
A forward proxy is used to forward outgoing requests from a private network or intranet to the Internet, usually through a firewall. The main goal of the forward proxy is to provide a level of security and also to reduce network traffic.
In contrast, a reverse proxy handles requests coming from the Internet to the private network or intranet. This provides a level of security that prevents the Internet clients from having direct access to data on the corporate servers.

Your browser may not support display of this image.

Most large businesses, organizations, and universities these days use a proxy server. This is a server that all computers on the local network have to go through before accessing information on the Internet. By using a proxy server, an organization can improve the network performance and filter what users connected to the network can access.


Usage:

A proxy server improves Internet access speeds from a network primarily by using a caching system. Caching saves recently viewed Web sites, images, and files on a local hard drive so that they don't have to be downloaded from the Web again. While your Web browser might save recently viewed items on your computer, a proxy server caches everything accessed from the network. That means if User1 views a blog article at www.blog.techyoddha.com at 1:00 and User2 views the same page at 1:03, he'll most likely get the page straight from the proxy server's cache. Though this means super-fast access to Web pages, it also means users might not be seeing the latest update of each Web page

The other main purpose a proxy server is to filter what is allowed into the network. While HTTP, FTP, and Secure protocols can all be filtered by a proxy server, HTTP is the most common. The proxy server can limit what Web sites users on the network can access. Many organizations choose to block access to sites with objectionable material such as hacking information and pornography, but other sites can be filtered as well. If an employer notices workers are spending too much time at sites like eBay or orkut.com, those sites can be blocked by the proxy server as well.


References:
  • http://www.webopedia.com/TERM/P/proxy_server.html
  • http://www.techterms.com/definition/proxyserver
  • http://www.webopedia.com/quick_ref/proxy_server.asp
  • http://whatis.techtarget.com/definition/0,,sid9_gci212840,00.html

Gmail is no more 'Beta' !!

Good Bye! to Beta
Google has removed the 'BETA' label from its very famous email service called Gmail. This is also applicable to Google Calendar, Google Docs, Google Talk, and Google Video for Business. The move is seen as a way to attract large businesses to Google Apps (its suite of messaging and productivity applications).

Released on April 1, 2004, Gmail was still in beta five years and tens of millions of users later.


According to Google it has beefed up the Google Apps suite by adding offline access to e-mail and calendars and streamlining access to Google Apps for BlackBerry users.
Google also says that its Web-based messaging platform is now more compatible with Microsoft Outlook and it has improved contact management for Google Apps.



What is Beta ?
The term "beta" refers to a piece of software or web application that's still being developed.
Expect problems with betas and you won't be surprised, but enjoy the thrill of being among the first to use a new bit of software.
If you don't like those kinds of thrills wait until the software is "out of" beta.


The beta version of a software release is considered to be a preview. It has all the standard features, but is not yet ready for wide release or sale. During this point, the company will collect feedback from users about the product's usability — what they like and what should be changed — before the product's wide release.



What Google representatives say ?
.......... by no means does the removal of the beta label mean Google will stop innovating and experimenting with new features offered through Google Labs for Gmail, Google Calendar, and other Google App services. They say existing Google Labs users can re-enable the beta label for Gmail from the Labs tab under Settings.



Reference:
http://www.sfgate.com/cgi-bin/blogs/sfgate/detail?blogid=19&entry_id=43121

ISAPI (Internet Server Application Programming Interface) filter

Internet Server Application Programming Interface (ISAPI) is an API developed to provide the application developers with a powerful way to extend the functionality of Internet Information Server (IIS). ISAPI filters always run on an IIS server, filtering every request until they find one they need to process. The ability to examine and modify both incoming and outgoing streams of data makes ISAPI filters powerful and flexible.

Developing a CGI(Common Gateway Interface) program involves creating an EXE with C, C++, and/or Perl programming languages. This EXE file will be executed and terminated for every request received, causing an excessive memory usage, whenever users hit the same page over and over again!

This excessive memory usage that could bring the server completely down, has been solved under ISAPI extensions. An ISAPI extension is a regular DLL file that exposes 3 special functions that is called by the calling process (i.e., IIS) and therefore, will be loaded to memory once, no matter how many clients are going to use it at the same time.

Since the ISAPI extension and the calling process (IIS) live at the same address space, they could contact each other, directly. This means a great potential to bring the whole IIS down, and in some cases, the entire web server! Take a look at the following figure:

Both ISAPI filters and ISAPI extensions can only be developed using C/C++. Visual Studio comes with wizards that make ISAPI development fast and easy.

Uses of ISAPI filters

ISAPI filters can be registered with IIS to modify the behavior of a server. Filters can perform the following tasks:

Change request data (URLs or headers) sent by the client.
Control the user name and password used with anonymous or basic authentication.
Modify or analyze a request after authentication is complete.
Perform custom authentication.
Handle encryption and compression.

NOTE: ISAPI filters DLLs cannot be requested explicitly, like ISAPI extensions can.

References :
http://msdn.microsoft.com/en-us/library/ms524610.aspx
http://www.codeproject.com/KB/ISAPI/isapi_extensions.aspx


Classes of IP Addresses

In our last article on “What is an IP address?”, we had discussed about what is an IP address, structure of an 32-bit IP address or to say an IPv4 address.. We had also mentioned about classes of IP addresses..

In this article we will be discussing on these classes of IP addresses..

But before that let’s recollect that an IP address is simply a unique number assigned to every device on a network.. and the octets of IP address are used to create classes of IP addresses. The Class of the address determines which part belongs to the network address and which part belongs to the node address.

Lets have a look at these IP classes now..

There are five IP classes plus certain special addresses :

Class A Network -- binary address start with 0, therefore the decimal number can be anywhere from 1 to 126. The first 8 bits (the first octet) identify the network and the remaining 24 bits indicate the host within the network. An example of a Class A IP address is 102.168.212.226, where "102" identifies the network and "168.212.226" identifies the host on that network. These addresses are for large networks with many devices.

Class B Network -- binary addresses start with 10, therefore the decimal number can be anywhere from 128 to 191. (The number 127 is reserved for loopback and is used for internal testing on the local machine.) The first 16 bits (the first two octets) identify the network and the remaining 16 bits indicate the host within the network. An example of a Class B IP address is 168.212.226.204 where "168.212" identifies the network and "226.204" identifies the host on that network. These addresses are for medium-sized networks.

Class C Network -- binary addresses start with 110, therefore the decimal number can be anywhere from 192 to 223. The first 24 bits (the first three octets) identify the network and the remaining 8 bits indicate the host within the network. An example of a Class C IP address is 200.168.212.226 where "200.168.212" identifies the network and "226" identifies the host on that network. These addresses are for small networks (fewer than 256 devices).

Class D Network -- binary addresses start with 1110, therefore the decimal number can be anywhere from 224 to 239. Class D networks are used to support multicasting. These addresses are multicast addresses.

Class E Network -- binary addresses start with 1111, therefore the decimal number can be anywhere from 240 to 255. Class E networks are used for experimentation. They have never been documented or utilized in a standard way.

Out of the almost 4.3 billion possible combinations, certain values are restricted from use as typical IP addresses. For example, the IP address 0.0.0.0 is reserved for the default network and the address 255.255.255.255 is used for broadcasts.

Since numbers are usually assigned to internet service providers within region-based blocks, an IP address can often be used to identify the region or country from which a computer is connecting to the Internet. An IP address can sometimes be used to show the user's general location.

The Internet Assigned Numbers Authority (IANA) manages the IP address space allocations globally. IANA works in cooperation with five Regional Internet Registries (RIRs) to allocate IP address blocks to Local Internet Registries (Internet service providers) and other entities.

Before ending this topic, lets also discuss on static and dynamic IPs.

At one time ISPs used to issue one IP address to each user. These are called static IP addresses. Because there are a limited number of IP addresses and with increased usage of the internet, ISPs now issue IP addresses in a dynamic fashion out of a pool of IP addresses. These are referred to as dynamic IP addresses. This also limits the ability of the user to host websites, mail servers, ftp servers, etc. In addition to users connecting to the internet, with virtual hosting, a single machine can act like multiple machines (with multiple domain names and IP addresses).

References:

http://www.howstuffworks.com/
http://en.Wikipedia.org/
http://www.webopedia.com/
http://www.searchwindevelopment.com/


What is an IP Address?

IP address is a very common term that we hear in our everyday life. Lets discuss in detail what exactly an IP address is..

Every device connected to the public Internet is assigned a unique number known as an Internet Protocol (IP) address. This number uniquely identifies the device and distinguishes it from other devices on the network. Networks using the TCP/IP protocol route messages based on the IP address of the destination.

Within an isolated network, you can assign IP addresses at random as long as each one is unique. However, connecting a private network to the Internet requires using registered IP addresses (called Internet addresses) to avoid duplicates.

Now lets see how an IP address looks like..

An IP address consists of four numbers separated by periods (also called a ‘dotted-quad’) and typically looks like 122.169.25.39. To make it easier for us (humans) to read and remember, IP addresses are normally expressed in decimal format as a "dotted decimal number" like the one above. But computers communicate in binary form.

Look at the same IP address in binary : 00111010.10101001.00011001.

The four numbers in an IP address are called octets, because they each have eight positions when viewed in binary form. If you add all the positions together, you get 32, which is why IP addresses are considered 32-bit numbers. Since each of the eight positions can have two different states (1 or 0) the total number of possible combinations per octet is 28 or 256. So each octet can contain any value between 0 and 255. Combine the four octets and you get 232 or a possible 4,294,967,296 unique values !

Now, this design of IP as a 32-bit number was developed by the original designers of TCP/IP and this system, now named as Internet Protocol version 4 or IPv4 is still in use. However, due to the enormous growth of the Internet and the resulting depletion of the address space, a new addressing system (IPv6), using 128 bits for the address, has also been developed. Both the systems of IP addressing are being used.

Continuing with the structure of IP address.. The octets, about which we were discussing, serve a purpose other than simply separating the numbers. They are used to create classes of IP addresses that can be assigned to a particular business, government or other entity based on size and need. The octets are split into two sections: Net and Host. The Net section always contains the first octet. It is used to identify the network that a computer belongs to. Host (sometimes referred to as Node) identifies the actual computer on the network. The Host section always contains the last octet.

The Class of the address determines which part belongs to the network address and which part belongs to the node address. All nodes on a given network share the same network prefix but must have a unique host number.

There are five IP classes plus certain special IP addresses..about which we will be discussing in our next article..

References:

http://www.howstuffworks.com/
http://en.Wikipedia.org/
http://www.webopedia.com/
http://www.searchwindevelopment.com/


Globalization and Localization

Ms. Asha Bora has done some studies on Globalization and Localization.. Lets see what she has to say..

Globalization and localization are very important features of .Net framework, which is very useful and about which every programmer should be aware of while creating an application. If I want my application to be used by everyone then I have to make my interface in a language which everyone can understand or say in a global language. But at the same time it is not possible that everyone in the world knows a particular language. So, in order to make those people use the application, I have to publish it in their regional language or say in their local language, this is known as localization .

From the introduction of the article you must have understood the basic meaning of globalization and localization. Now let’s see a proper definition of it in terms of a programmer.

This very important feature is used by .Net to make our programs universal. Now if we talk in term of programming then GLOBALIZATION can be defined as the process of designing and developing an application that function for multiple cultures and regions, irrespective of the language and regional differences and LOCALIZATION is the process of customizing your application for a given culture and locale. It consists primarily of translating the user Interface according to a culture. Culture will decide date display settings (like, mm/dd/yyyy or dd/mm/yyyy), currency display formats etc.

Now, the process by which we can make sure that our program will be localized is known as Internationalization or Globalization. In simpler terms, Globalization can be defined as the set of activities which will ensure that our program will run in regions with different languages and cultures.

Thus, globalization is related to intrinsic (basic) code changes to support such changes we use Resource files etc. Whereas, localization is the process of using a particular culture and regional info so that the program uses the local languages and culture. This means translating strings into a particular local language. This covers putting language specific strings in the resource files. Globalization starts in the main construction phase along with the code development. Localization generally comes later.

Now let’s see how we define the culture and region code.

We all know that languages depend upon the geographical location. For example, French is spoken in France as well as in Canada (besides many other countries). But linguistically speaking, Canadian French is quite different from French spoken in France. Similarly, there are linguistic differences between US English and British English. Therefore, the language needs to be associated with the particular region where it is spoken, and this is done by using locale (language + location).

For example
: fr is the code for French language. fr-FR means French language in France. So, fr specifies only the language and FR specifies the region France whereas fr-FR is the locale. Similarly, fr-CA defines another locale implying French language and culture in Canada. If we use only fr, it implies a neutral culture (i.e., location neutral).

Now, in order to change the current culture, we have to change two properties of the CultureInfo class- UICulture and Culture.

ASP.NET can set the UICulture and Culture properties for the page to the language and culture values that are passed by the browser. Alternatively, you can set the UICulture and Culture properties explicitly, either declaratively or in code. You can also set the values declaratively in
Web.config file under the property and these two properties can be set using the overloaded constructor of the class and then we can use this class to change the culture of the currently executing program.

UICulture: gets/sets the user interface culture for the currently executing thread. This property helps the runtime to load the resource strings from a specific resource. This property can take neutral cultures as well as locales.
  • Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr”); OR
  • Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr-CA”);
Culture: gets/sets the region specific culture and formats of currency, dates etc. This needs language as well as location.
  • Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr-CA”); // we have given locale
  • Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr”); // wrong, will not work
In my next article I will talk about “How to implement Globalization in our application”.

References:

  • http://msdn.microsoft.com/en-us/library/ms227427.aspx
  • http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx

<Pre> Tag in HTML

There are many times when you need to show some sample C#, or java or any other code in your web page. For proper understanding and readability, these kind of code snippets need proper formatting.

But..by default, browsers collapse all the spacings, tabs and line breaks.

So, for properly formatting such stuffs, what do you do ??

One way is to go through all the lines, and at every occurance.. manually replace the white spaces with , line breaks with <br/> tags. While writing loops, for every ‘ < ’ and ‘ > ’ signs write &lt; and &gt;, etc etc.

Don’t you think all this is a real pain ??

A simple solution to this problem is using HTML pre tag.

Pre tag simply displays the enclosed pre-formatted text. This means that it directs the web browser to render the section of text contained within pre tag, exactly as it is..including the line breaks and white spaces. The <pre> tag is supported in all major browsers.

When you place any paragraph with preformatted text such as some poetry or some lines of code.. directly inside the Body tag of HTML, browser ignores the spacing, tabs and line breaks used in its text formatting. This is because a web browser interprets your html document as being one long line. Sure, you may have tabs and line breaks in notepad aligning your content so it is easier to read for you.. but your browser ignores those tabs and line breaks. So, if you will enclose that preformatted text with HTML pre tag <pre> it will not ruin the formatting of the text and will display with its formatting preserved.

pre tag is a container tag, which means it begins with an opening <pre> element and ends with closing </pre> element. The common attributes such as id, style, class, title etc and the events such as onclick, onmouseover, ondbclick etc as common to most html elements..are applicable to pre tag as well.

This element can be contained inside other elements such as html "applet", "blockquote", "body", "button", "center", "del", "dd", "div", "fieldset", "form", "iframe", "ins", "li", "map", "noframes", "noscript", "object", "td", and "th", etc.

And it may contain any other inline elements except "img", "object", "applet", "big", "small", "sub", sup". "font", and "basefont".

The PRE element is handy for showing program code or part of file content as in the example below:

<pre>
function sayHello(){

int i =0;

for(i=0; i <=10; i++){
System.out.println("Hello World !!");
}
</pre>

You will see the output in your web page as :
function sayHello(){

int i =0;

for(i=0; i <=10; i++){
System.out.println("Hello World !!");
}
NOTE : By default, Pre tag displays the pre-formatted text in Courier font type.

A very good example for using pre tag is posting articles using blogger interface. Formatting the articles using blogger UI was a pain for me.. Pre tag really saved my life..


References :
•   http://htmlhelp.com/reference/html40/block/pre.html
• http://www.codetoad.com/html/text/pre_tag.asp

• http://www.htmlquick.com/reference/tags/pre.html

http://programming.top54u.com/post/HTML-Pre-Tag-for-Preformatted-
Text.aspx





RSS Feeds

RSS the most familiar abbreviation used by almost all bloggers, webmasters, News Providers and readers. This article presents our readers a breif introduction about Rich Site Summary or Really Simple Syndication  (RSS)

*Syndicationpublish or broadcast simultaneously in a number of media (taken from www.askoxford.com)

RSS is a format for syndicating news and the content of news-like sites, including major news sites like news.google.com, technology blogs like www.labnol.org  and personal weblogs. 
But it's not just for news. Pretty much anything that can be broken down into discrete items can be syndicated via RSS: the "recent changes" page of a wiki, the profile updates of your friends on Orkut, newly posted articles on blogs(e.g. www.blog.TechYoddha.com) and even the revision history of a book.


Why Should one have feeds?
  • It increases traffic to your site.
  • It builds brand awareness for your site.
  • It can help with search engine rankings.
  • It helps cement relationships within a community of sites.
  • It improves the site/user relationship.
  • With additional technologies, it allows others to give additional features to your serviceupdate-notification via instant messaging, for example.
  • It makes the Internet an altogether richer place, pushing semantic technology along and encouraging reuse. Good things happen when you share your data.
  • It gives you a good excuse to play with some cool stuff. {like i did by having a personal channel of feeds :-) }
  • By reducing the amount of screen-scraping of your site, it saves wasted bandwidth.


Creation of RSS:
It is just an XML file that you should have for creating an RSS feed.
Else everything is the beauty of the Feed Reader that you have viz. on Mobile, in Browsers, desktop application to read RSS feeds etc.


Steps:
  1. Create a valid XML file with .xml extension
  2. host it at some server e.g.  your public_html directory of your domain website
  3. access the file with a Feed Reader ( e.g. www.TechYoddha.com/ty.xml)
There are other 100s of RSS providers available to create your RSS feeds automatically for your blog posts (e.g FeedBurner, FeedBlitz etc.)


Contents of XML file:
  1. xml tag
  2. rss tag
  3. channel tag
  4. title tag
  5. link tag
  6. description tag
  7. item tag
  8. title tag
  9. link tag
  10. description tag


Sample Feeds:
  1. http://www.ndtv.com/convergence/ndtv/rssnat.asp
  2. http://www.hindu.com/rss/nushdline.xml
  3. http://feeds2.feedburner.com/TechYoddha


References:

Jagged Arrays

Our dear friend Ms.Asha Bora has done some studies on the wonderful Jagged Arrays..
Lets see what she has to say..

In this Article I will be discussing about Jagged Arrays. Many of us who are working as a Programmer may not be knowing about it, as I didn't knew it. One of my friends told me about Jagged Arrays. So I thought that I should explore myself on this topic so that people like me can know more about it..

.Net supports two types of Arrays:
Single dimensional arrays(Linear)
Multi-dimensional arrays - These are of two type : Rectangular Arrays and Jagged Arrays

What are Jagged Arrays?

A jagged Array is nothing but a multidimensional array, whose elements are arrays. The elements of an array can be of different dimensions and sizes. A jagged array is also known as “array of arrays”. Following is an example to show the declaration and initialization of jagged array:

i. Declaration : int[][] jaggedArray = new int[3][];
       Over here‘3’shows the number of rows in the array.

ii. Initialization: There are many ways to initialize a jagged array. In the given example each of the element is a single dimensional array.

jaggedArray[0] = new int[5];
jaggedArray[1] = new int[4];
jaggedArray[2] = new int[3];


We can also do initialization of the arrays without knowing its size.
For Example :

int[][] jaggedArray2 = new int[][]
{
   new int[] {1,3,5,7,9},
   new int[] {0,2,4,6},
   new int[] {11,22,33}
}
;

We can also do this in the below given way. Notice that we cannot omit the new operator from the elements initialization because there is no default initialization for the elements..

int[][] jaggedArray3 =
{
   new int[] {1,3,5,7,9},
   new int[] {0,2,4,6},
   new int[] {11,22,33}
};

NOTE: A jagged array is an array of arrays, and therefore its elements are reference types and are initialized to null. The length property of the array returns the number of arrays contained in the jagged array.

The following C# example will tell us how we can iterate in a jagged array.

class JaggedArray_Test
{
static void Main()
{
// Declare the array of two elements:
int[][] jaggedarr = new int[2][];

// Initialize the elements:
jaggedarr [0] = new int[5] { 3, 9, 15, 21, 27 };
jaggedarr [1] = new int[4] { 6, 12, 18, 24 };

// Display the array elements:
for (int i = 0; i < jaggedarr.Length; i++)
{
System.Console.Write("Element({0}): ", i);

for (int j = 0; j < jaggedarr [i].Length; j++)
{
System.Console.Write("{0}", jaggedarr [i][j]);
System.Console.Write(“ ”);
}
System.Console.WriteLine();
}
}
}
OUTPUT will be: Element(0) 3 9 15 21 27
Element(1) 6 12 18 24

Difference between multidimensional arrays (also known as rectangular arrays) and jagged arrays:

In a multi-dimensional array we have to declare both dimensions. Suppose we want to store the number of months and the days of each month in an array. If we create a multidimensional array then we have to give a fixed size to both the number of rows and column (To store the number of days for the month).But since each month has different number of days thus declaring the fixed size will lead to wastage of memory. Thus in this case we can use jagged arrays, as we don’t need to declare the second dimension of the array. It is enough to declare just the number of rows (to store number of months) in jagged array. The column or say the size of each linear array will vary as per the requirement.

THUS WE CAN SAY Jagged arrays have certain advantages over rectangular arrays. Jagged arrays are more space efficient, since not all rows (in a two-dimensional array) must have the same number of columns. In addition, since each row has its own one-dimensional array, we can easily pass an individual row to a method that requires a one-dimensional array parameter.
We will find working with jagged arrays much easier if you keep in mind that a jagged array is really an array of arrays.

References :
 http://msdn.microsoft.com/en-us/library/2s05feca(VS.80).aspx
 http://www.odetocode.com/Articles/253.aspx
 http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=128


LINQ : An Introduction

In this article, we will be discussing a very useful Microsoft technology called LINQ..which was introduced with .Net 3.0.

So, Lets see what LINQ is..

LINQ stands for Language Integrated Query. It is Microsoft’s new technology for powerful and easy general purpose data access in a type-safe way.

Now the question arises : What was the need to develop LINQ ??

Well.. the problem was that.. Traditionally, our data source used to determine our selection of a low-level data access API. For example, to fetch relational data from a database table, we would use ADO.NET, to parse XML data, we might use some combination of XPath and XML DOM APIs. Each data access API requires its own specialized syntax (SQL queries, as an example), and typically forces us..the developers to shuffle data between their business objects and the data access API.

All of the diverse data access strategies and APIs means there is a tremendous amount of mental energy expended to build the basic data features needed in every business application. LINQ helps us to eliminate this mental overhead.

Basically, It defines a set of standard query operators in the System.Linq namespace to select, filter, aggregate, and partition data from any type that implements the IEnumerable or IEnumerable <T> interfaces. The standard query operators are compliant with the Common Language Specification (CLS) and work inside any .NET language that supports generics. LINQ gives .Net developers the ability to query and transform data using any .Net Language of their choice.

LINQ is very similar to SQL. So, if you are used to using SQL to query databases, you are going to have something of a head start with LINQ.

This means that whether the data lives in XML, or database, or some collection of objects, we can run through the desired data in a common way..by simply writing SQL like queries.. Query expressions, like “from”, “where”, and “select”, “order by” and all the others you know and love from SQL can now be used in C# and VB .Net.

Lets now jump on to our first code and see how does LINQ code looks like..

In the following C# code, we are using LINQ to query a collection of Strings.

string[] flowers = { "Rose", "Lotus", "Jasmine", "Lily" };
IEnumerable query = from n in flowers
           where n.Length == 4
           orderby n descending
           select n;
foreach (string flower in query)
{
   Console.WriteLine(flower);
}

Inside this code is a LINQ query expression. The code will print out all the flower names in descending alphabetical order. We will discuss on the LINQ syntax in our future article.

The next query produces the same results, but queries data inside an XML fragment.

XElement flowers = XElement.Parse(
        @"<flowers>
           <flowers>Rose</flowers>
           <flowers>Lotus</flowers>
           <flowers>Jasmine</flowers>
          <flowers>Lily</flowers>
         </flowers>"
        );


IEnumerable query = from n in flowers.Elements("flowers")
          where n.Value.Length == 4
          orderby n.Value descending
          select n.Value;
foreach (string flower in query)
{
   Console.WriteLine(flower);
}

Although we made some slight changes to dig into the XML, the operators inside the query expression remains the same. LINQ query expressions are similar to SQL SELECT commands with FROM, WHERE, ORDERBY, GROUP, AND SELECT clauses.

Microsoft also designed LINQ to integrate closely with .NET languages and their environment. When typing the above queries, Visual Studio provides Intellisense for auto-completion. The compiler can perform syntax and type checking on query expressions.

Thus, we discussed the use of LINQ and what LINQ is.. We also saw an example of implementation of LINQ. We will be carrying on with the LINQ in our coming articles..

References :

http://msdn.microsoft.com/
• http://www.odetocode.com/
• http://www.programmersheaven.com/
• http://blogs.msdn.com/cyrusn/