<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming onlineMYSQL Get Database size Query</title>
	<atom:link href="http://www.programming-online.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.programming-online.com</link>
	<description>Free online programming tutorial</description>
	<lastBuildDate>Tue, 04 Jan 2011 14:22:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MYSQL Get Database size Query</title>
		<link>http://www.programming-online.com/200/mysql-get-database-size-query/</link>
		<comments>http://www.programming-online.com/200/mysql-get-database-size-query/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 03:48:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Data bases]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=200</guid>
		<description><![CDATA[Database size SELECT table_schema AS 'Db Name', Round( Sum( data_length + index_length ) / 1024 / 1024, 3 ) AS 'Db Size (MB)', Round( Sum( data_free ) / 1024 / 1024, 3 ) AS 'Free Space (MB)' FROM information_schema.tables GROUP BY table_schema ;]]></description>
			<content:encoded><![CDATA[<p><strong>Database size</strong></p>
<pre class="brush: sql;">
SELECT
  table_schema AS 'Db Name',
  Round( Sum( data_length + index_length ) / 1024 / 1024, 3 )
  AS 'Db Size (MB)',
  Round( Sum( data_free ) / 1024 / 1024, 3 ) AS 'Free Space (MB)'
FROM information_schema.tables
GROUP BY table_schema ;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/200/mysql-get-database-size-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MYSQL &#8211; Getting Top 10</title>
		<link>http://www.programming-online.com/196/mysql-getting-top-10/</link>
		<comments>http://www.programming-online.com/196/mysql-getting-top-10/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 03:41:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[top ten]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=196</guid>
		<description><![CDATA[You have photos (id INT, photo BLOB, tally INT) and votes(id INT, userID INT, photoID INT)tables. You wish to update photos.tally values from counts per photo in the votes table. You can use a cursor to walk the photos table, updating the tally as you go: DROP TABLE IF EXISTS photos; CREATE TABLE photos (id INT, photo BLOB, tally INT); INSERT INTO photos VALUES(1,'',0),(2,'',0); DROP TABLE IF EXISTS VOTES; CREATE TABLE VOTES( userID INT, photoID INT); INSERT INTO votes VALUES (1,1),(2,1),(2,2); DROP PROCEDURE IF EXISTS updatetallies; DELIMITER // CREATE PROCEDURE updatetallies() [...]]]></description>
			<content:encoded><![CDATA[<div>You have photos (id INT, photo BLOB, tally INT) and  votes(id INT, userID INT, photoID INT)tables. You wish to update photos.tally values from counts per photo in the votes table. You can use a cursor to walk the photos table, updating the tally as you  go:</p>
<pre class="brush: sql;">
DROP TABLE IF EXISTS photos;
CREATE TABLE photos (id INT, photo BLOB, tally INT);
INSERT INTO photos VALUES(1,'',0),(2,'',0);
DROP TABLE IF EXISTS VOTES;
CREATE TABLE VOTES( userID INT, photoID INT);
INSERT INTO votes VALUES (1,1),(2,1),(2,2);

DROP PROCEDURE IF EXISTS updatetallies;
DELIMITER //
CREATE PROCEDURE updatetallies()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE pid INT;
DECLARE cur1 CURSOR FOR SELECT id FROM photos;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
FETCH cur1 INTO pid;
WHILE done = 0 DO
UPDATE photos
SET tally = (SELECT COUNT(*) FROM votes WHERE photoid = pid )
WHERE id = pid;
FETCH cur1 INTO pid;
END WHILE;
CLOSE cur1;
SELECT id,tally FROM photos;
END //
DELIMITER ;
CALL updatetallies();
+------+-------+
| id   | tally |
+------+-------+
|    1 |     2 |
|    2 |     1 |
+------+-------+
</pre>
<p>but a simple join does exactly the  same job at much less cost:</p>
<pre class="brush: sql;">
UPDATE photos
SET tally = (
SELECT COUNT(*) FROM votes WHERE votes.photoid = photos.id
);
</pre>
<p>Before you burden your app with a cursor, see if you can  simplify the processing to a straightforward join.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/196/mysql-getting-top-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>using IDentity Columns in Sql Server</title>
		<link>http://www.programming-online.com/192/using-identity-columns-in-sql-server/</link>
		<comments>http://www.programming-online.com/192/using-identity-columns-in-sql-server/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 10:53:48 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[id]]></category>
		<category><![CDATA[Identity]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=192</guid>
		<description><![CDATA[For More Information about sql server identity please visit this post : IDentity in Columns Sql Server Creating a Table With an Identity Columns Create Table Users (userID int Identity , UserName nvarchar(255) , Password  nvarchar(255)) Inserting a row Insert Into Users (UserName,Password) Values ('Nicolas','123654789654') Or Insert Into Users Values ('Nicolas','123654789654') Note that sql server [...]]]></description>
			<content:encoded><![CDATA[<p>For More Information about sql server identity please visit this post :</p>
<h3><a title="Permanent Link to IDentity Columns Sql Server" rel="bookmark" href="http://www.programming-online.com/188/identity-columns-sql-server/">IDentity in Columns Sql Server</a></h3>
<p>Creating a Table With an Identity Columns</p>
<p>Create Table Users</p>
<pre class="brush: sql;">
(userID int Identity , UserName nvarchar(255) , Password  nvarchar(255))
</pre>
<p>Inserting a row</p>
<pre class="brush: sql;">
Insert Into Users (UserName,Password) Values ('Nicolas','123654789654')
</pre>
<p>Or</p>
<pre class="brush: sql;">
Insert Into Users Values ('Nicolas','123654789654')
</pre>
<p>Note that sql server detects identity Columns automatically event if it&#8217;s not the first ordinal column</p>
<p>to Get the last inserted  Identity Value</p>
<p>Insert Into Users (UserName,Password) Values (&#8216;Some User&#8217;,'dgvzsdx&#8217;)</p>
<pre class="brush: sql;">
Select @@Identity
</pre>
<p>@@Identity is a Global variable (on the session level) that holds the value for your last identity</p>
<p>of course if you haven&#8217;t executed any insert statements you will get a null .</p>
<p>interchangeably you could use</p>
<pre class="brush: sql;">
SELECT SCOPE_IDENTITY()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/192/using-identity-columns-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDentity Columns Sql Server</title>
		<link>http://www.programming-online.com/188/identity-columns-sql-server/</link>
		<comments>http://www.programming-online.com/188/identity-columns-sql-server/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 10:33:26 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Identity]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=188</guid>
		<description><![CDATA[By Craig S. Mullins The identity property is a very powerful and useful, yet under-utilized feature of Microsoft SQL Server.  It satisfies a common requirement of many applications: the need for a sequential, ascending identifier. Whenever there is a need for a database column to contain a serial number, the identity property can be used to [...]]]></description>
			<content:encoded><![CDATA[<p><em>By Craig S. Mullins</em></p>
<p>The identity property is a very powerful and useful, yet under-utilized feature of Microsoft SQL Server.  It satisfies a common requirement of many applications: the need for a sequential, ascending identifier. Whenever there is a need for a database column to contain a serial number, the identity property can be used to simplify the implementation. The primary benefit of the identity property is that SQL Server does the work to ensure that the number is incremented and inserted properly. But as with all beneficial features of a DBMS, the devil is in the details.  Let’s examine some of those details.</p>
<p><strong>Column Properties</strong></p>
<p>Identity is best classified a column property. Column properties are used by SQL Server to answer the questions:</p>
<ol>
<li>Can this column contain nulls?</li>
<li>If nulls are not allowed, should SQL Server increment and insert a value for the column?</li>
</ol>
<p>There are three basic column properties:</p>
<p>¨                  <strong>null</strong> &#8211; allows nulls in a column.</p>
<p>¨                  <strong>not null</strong> &#8211; does not allow nulls in a column. This forces the user to assign a specific value to a column (unless a default has been specified).</p>
<p>¨                  <strong>identity</strong> &#8211; does not allow nulls. Automatically defaults to the next highest number in ascending sequence.</p>
<p><strong> </strong>This article will discuss the identity property only.</p>
<h2>How Identity Works</h2>
<p>The identity property is used to automatically generate sequential numbers for a column.  A column defined with the identity property is assigned the next sequential number whenever a row is inserted into the table. When data is inserted into the table, a value should not be included for the identity column. Instead, you should use the DEFAULT VALUES option (available with the INSERT statement). This enables SQL Server to generate the next sequential value for the identity column.</p>
<p>Data cannot be inserted directly into an identity column. One column per table can be assigned the identity property.  Additionally, the column must be one of the following data types:</p>
<ul>
<li>tinyint</li>
<li>smallint</li>
<li>integer</li>
<li>decimal</li>
<li>numeric(p,0) – the precision is flexible, but the scale must be zero (0)</li>
</ul>
<p>At the simplest level the identity property generates numbers starting with 1 and incrementing by 1 for each insert. Of course, with database administration, it is always possible to complicate things, and the SQL Server identity function can get a little more complicated.  It is possible to start with a number other than 1 and it is also possible to increment by a number other than 1.  This is done when the table is created using the optional parameters of the identity property.  The identity property accepts two parameters, the first indicating the seed number and the second indicating the increment value.  If no parameters are specified, the default (1,1) is assumed.</p>
<p>To clarify this concept, consider the following three column definitions, for example:</p>
<p>RowId           smallint        identity</p>
<p>OtherId         integer         identity(100)</p>
<p>AnotherId       integer         identity(5,10)</p>
<p>The RowId column will start at 1 and increment by 1; the OtherId column will start at 100 and increment by 1; and the AnotherId column will start at 5 and increment by 10.</p>
<h2>Special Situations</h2>
<p>Although data cannot be inserted directly into an identity column as a general rule, it is possible to by-pass this rule. It may be necessary to specify a value to the identity column if, for example, a row was accidentally deleted, and the identity value needs to be re-created. To get the last identity value, use the @@identity global variable. This variable is accurate after an insert into a table with an identity column; however, this value is reset after an insert into a table with an identity column occurs. To allow an insert with a specific identity value, use the SET statement to set the IDENTITY_INSERT option ON.</p>
<p>Additionally, if an identity column exists for a table that has frequent deletions, gaps can occur in the sequence because the identity property will not re-generate values that have been used (even if they have been subsequently deleted). If you wish to avoid gaps in sequence at all costs, this may be a valid reason to avoid using the identity property.</p>
<p>To fill a gap in the sequence, you can analyze the existing identity values before explicitly entering one with the IDENTITY_INSERT option ON. Just query the table checking for gaps in the sequence for the identity column. Be sure to take into account the original seed value and the increment value. For example, if the increment value is 2 then there may appear to be gaps in the sequence because SQL Server is counting by 2, not because there are actual gaps.</p>
<p>If the column is referenced and a specific value is provided, then the identity property cannot automatically generate the next sequential value as desired.</p>
<h2>Some Identity Advice</h2>
<p>Instead of concocting an algorithm to create an ascending key, the identity property is a better choice. Columns assigned the identity property contain system-generated values that can uniquely identify each row within a table. It is automated and requires no additional application coding. However, be aware that it is not a panacea for planning and preparation.  For example, columns assigned the identity property can have repeating values unless a unique index has been created on that column.  This could result from an erroneous insert (instead of letting SQL Server calculate the next value by default).</p>
<p>One additional concern is how to identify which column in the table has been assigned the identity property. It is not necessary to remember—you can simply use the IDENTITYCOL keyword. When referencing data, use the keyword IDENTITYCOL in place of the identity column name. The IDENTITYCOL keyword can be used in an SQL data manipulation statement (SELECT, INSERT, UPDATE, DELETE) to reference an identity column.</p>
<p>SQL Server also enables users to find additional information about the identity property column via two system functions. The IDENT_SEED function returns the seed value specified during creation of an identity column and the IDENT_INCR function returns the increment value specified during creation of the identity column. Both of these may prove useful as you manage and manipulate data in columns assigned the identity property.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/188/identity-columns-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select Case Sql Server</title>
		<link>http://www.programming-online.com/176/select-case-sql-server/</link>
		<comments>http://www.programming-online.com/176/select-case-sql-server/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 16:42:21 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Case]]></category>
		<category><![CDATA[Searched Case]]></category>
		<category><![CDATA[Select Case]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=176</guid>
		<description><![CDATA[In alot of situations we find that we need to display data to the user that&#8217;s not actually in the database tables for eamples let&#8217;s think about a table containing employees data Create Table Employees (ID int identity primary key , Name nvarchar(255) , isMarried bit ) insert into Employees Values ('John' , 0) insert [...]]]></description>
			<content:encoded><![CDATA[<p>In alot of situations we find that we need to display data to the user that&#8217;s not actually in the database tables<br />
for eamples let&#8217;s think about a table containing employees data</p>
<pre class="brush: sql;">
Create Table Employees
(ID int identity primary key , Name nvarchar(255) , isMarried bit )

insert into Employees Values ('John' , 0)
insert into Employees Values ('Debra' , 1)
insert into Employees Values ('Paul' , null)

Select ID , Name , isMarried From Employees
</pre>
<p>of course we don&#8217;t display numbers that represent marital status to the user<br />
this we CASE comes in</p>
<pre class="brush: sql;">
Select ID , Name , Case isMarried
When 0 Then 'Single'
When 1 Then 'Married'
Else 'Unknown''
End
</pre>
<p>ok  pretty good   , CASE in SQL Server is much like Select Case in Visual Basic / Visual Basic .net or even like switch</p>
<p>in c / c++ / C# / php &#8230; etc . which means it can test the expression (Column) against single value such as 0 , 1 , 25 , &#8216;Pharo&#8217; , GetDate() , etc .</p>
<p>what about ranges or even logical operators(and ,or , not) , well , in other Database Management systems such as Mysql there&#8217;s often an inline if statement , fortunately sql server offers a &#8216;Searched Case&#8217; Statement which is equivalent</p>
<pre class="brush: sql;">
Create Table Products
(id int identity primary key , Name  nvarchar(255), Price decimal(15,5))
insert into Products Values('Optical Mouse' , 10)
insert into Products Values('Keyboard' , 20)
insert into Products Values('Speakers' , 60)
insert into Products Values('2gb Ram' , 120)
insert into Products Values('I7 CPU ' ,1500)

Select ID , Name , Price , 'Price Category' = Case
when Price &lt;= 0 then 'free'

when Price &gt; 0 and Price &lt;=25 then 'First Category'

when Price &gt; 25 and Price &lt;= 70 then 'Second Category'

when Price &gt; 70 and Price &lt;= 150 then 'Third Category'

else 'Top  Category'  End
</pre>
<p>More Information about Case Statement ::</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms181765.aspx">http://msdn.microsoft.com/en-us/library/ms181765.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/176/select-case-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql Select Previous/next Rows with single query</title>
		<link>http://www.programming-online.com/163/mysql-select-previousnext-rows-with-single-query/</link>
		<comments>http://www.programming-online.com/163/mysql-select-previousnext-rows-with-single-query/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 10:10:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=163</guid>
		<description><![CDATA[Here is mysql query , for retrieving the previous and next column values in a sequence, given a particular column value thisvalue The previous value is the maximum value less than thisvalue, and the next value is the minimum value greater than thisvalue: For Ex. We will get The Next and Previous ( ID =2 [...]]]></description>
			<content:encoded><![CDATA[<p>Here is mysql query ,  for retrieving the previous and next column values in a sequence, given a  particular column value thisvalue</p>
<p>The previous value is the  maximum value less than thisvalue, and the next value is the  minimum value greater than thisvalue:</p>
<p>For Ex. We will get The Next and Previous ( ID =2 ) from MyTbl.</p>
<pre class="brush: sql;">
SELECT
  IF(ID &gt; 2,'next','prev') AS Direction,
  IF(ID &gt; 2,MIN(ID),MAX(ID)) AS 'Prev/Next'
FROM videos
WHERE ID &lt;&gt; 2
GROUP BY SIGN(ID - 2);
</pre>
<p>+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+<br />
| Direction | Prev/Next |<br />
+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+<br />
| prev      | 1         |<br />
| next      | 3         |<br />
+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+</p>
<p>and now we can make our code more easy, we will make A PROCEDURE</p>
<pre class="brush: sql;">
DELIMITER |
CREATE PROCEDURE PrevNext(
  IN db CHAR(64), IN tbl CHAR(64), IN col CHAR(64), IN seq INT
)
BEGIN
  SET @sql =
          CONCAT( &quot;SELECT &quot;,
          &quot;IF(&quot;, col, &quot; &gt; &quot;, seq,&quot;,'next','prev') AS Direction,&quot;,
          &quot;IF(&quot;, col, &quot; &gt; &quot;, seq, &quot;,MIN(&quot;, col, &quot;),MAX(&quot;, col, &quot;)) AS 'Prev/Next'&quot;,
          &quot;FROM &quot;, db, &quot;.&quot;, tbl,
          &quot;WHERE &quot;, col, &quot; &lt;&gt; &quot;, seq,
          &quot;GROUP BY SIGN(&quot;, col, &quot; - &quot;, seq, &quot;)&quot; );
  PREPARE stmt FROM @sql;
  EXECUTE  stmt;
  DEALLOCATE PREPARE stmt;
END;
|
DELIMITER ;

call PrevNext('db', 'tbl', 'col', 'seq');
</pre>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/163/mysql-select-previousnext-rows-with-single-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rebuild All Database Indexes SQL Server</title>
		<link>http://www.programming-online.com/158/158/</link>
		<comments>http://www.programming-online.com/158/158/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 09:34:53 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Indexes]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=158</guid>
		<description><![CDATA[Background :: in SQL Server 2000 and Above we can use System Catalog View to Obtain Meta Data about our database For Example we can list all of database tables using sys.tables . select * From sys.tables and also we can list all indexes in a database using sys.indexes select * From sys.indexes we can [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background ::</strong><br />
in SQL Server 2000 and Above we can use System Catalog View to Obtain Meta Data about our database<br />
For Example we can list all of database tables using sys.tables .</p>
<pre class="brush: sql;">select * From sys.tables </pre>
<p>and also we can list all indexes in a database using sys.indexes</p>
<pre class="brush: sql;">select * From sys.indexes</pre>
<p>we can join those together using a common column (object_id)</p>
<pre class="brush: sql;">
Select   I.Name 'Index Name'  , T.Name   'Table Name'
From  sys.Indexes I join sys.Tables T
On I.object_id = T.object_id
Where I.Name is not null and T.Name is not null
</pre>
<p>and easily we can generate a code to rebuild all indexes on our database</p>
<pre class="brush: sql;">
Select 'Alter Index ' +  I.Name  + ' On ' + T.Name  + ' Rebuild '
From  sys.Indexes I join sys.Tables T
On I.object_id = T.object_id
Where I.Name is not null and T.Name is not null
</pre>
<p>Execute this code in SSMS and it&#8217;ll rebuild all indexes .</p>
<p><strong>Note</strong> //&#8212;&#8212;&gt; the code execution time may vary depending on your tables/indexes sizes so be carefull</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/158/158/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>get machine name and ip address C#</title>
		<link>http://www.programming-online.com/145/get-machine-name-and-ip-address-c/</link>
		<comments>http://www.programming-online.com/145/get-machine-name-and-ip-address-c/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 14:38:40 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[IP Address]]></category>
		<category><![CDATA[machine name]]></category>
		<category><![CDATA[system.net]]></category>
		<category><![CDATA[windows forms]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=145</guid>
		<description><![CDATA[be sure to use the following namespace using System.Net; we will create a method that sends out machine name and ip address as output parameters void getMachineInfo(out string MachineName, out string IPAddress) { MachineName= Dns.GetHostName(); IPHostEntry iphostentry = Dns.GetHostByName(MachineName); IPAddress = iphostentry.AddressList[0].ToString(); } you wanna call the method like : string myMachineName , myIpAddress; getMachineInfo(out [...]]]></description>
			<content:encoded><![CDATA[<p>be sure to use the following namespace</p>
<pre class="brush: csharp;">
using System.Net;
</pre>
<p>we will create a method that sends out machine name and ip address as output parameters</p>
<pre class="brush: csharp;">
void getMachineInfo(out string MachineName, out string IPAddress)
{
   MachineName= Dns.GetHostName();
   IPHostEntry iphostentry = Dns.GetHostByName(MachineName);
   IPAddress = iphostentry.AddressList[0].ToString();
}
</pre>
<p>you wanna call the method like :</p>
<pre class="brush: csharp;">
string myMachineName , myIpAddress;
getMachineInfo(out myMachineName , out myIpAddress);
MessageBox.Show(string.Format(&quot;My Machine name :{0},My Ip Address :{1}&quot;,
myMachineName ,myIpAddress));
</pre>
<p><strong>Note :</strong><br />
the IPHostEntry Class contains an Array of Ip Addresses which means that you can loop through it and obtain all available addresses of the machine (if any)</p>
<pre class="brush: csharp;">
MachineName= Dns.GetHostName();
IPHostEntry iphostentry = Dns.GetHostByName(HostName);
foreach(IPAddress  myAddress in  iphostentry.AddressList)
{
      MessageBox.Show(myAddress.ToString());
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/145/get-machine-name-and-ip-address-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL remove html code from data ( Strip HTML tags )</title>
		<link>http://www.programming-online.com/127/mysql-remove-html-code-from-data-strip-html-tags/</link>
		<comments>http://www.programming-online.com/127/mysql-remove-html-code-from-data-strip-html-tags/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 23:54:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Funtions]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[StripTages]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=127</guid>
		<description><![CDATA[MySQL remove html code from data .. here &#8216;s My Functions: SET GLOBAL log_bin_trust_function_creators=1; DROP FUNCTION IF EXISTS fnStripTags; DELIMITER &#124; CREATE FUNCTION fnStripTags( Dirty varchar(4000) ) RETURNS varchar(4000) DETERMINISTIC BEGIN DECLARE iStart, iEnd, iLength int; WHILE Locate( '&#60;', Dirty ) &#62; 0 And Locate( '&#62;', Dirty, Locate( '&#60;', Dirty )) &#62; 0 DO BEGIN [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL remove html code from data .. here &#8216;s My Functions:</p>
<div style="clear:both; overflow:auto;">
<pre class="brush: sql;">

SET GLOBAL log_bin_trust_function_creators=1;
DROP FUNCTION IF EXISTS fnStripTags;
DELIMITER |
CREATE FUNCTION fnStripTags( Dirty varchar(4000) )
RETURNS varchar(4000)
DETERMINISTIC
BEGIN
  DECLARE iStart, iEnd, iLength int;
  WHILE Locate( '&lt;', Dirty ) &gt; 0 And Locate( '&gt;', Dirty, Locate( '&lt;', Dirty )) &gt; 0 DO
    BEGIN
      SET iStart = Locate( '&lt;', Dirty ), iEnd = Locate( '&gt;', Dirty, Locate('&lt;', Dirty ));
      SET iLength = ( iEnd - iStart) + 1;
      IF iLength &gt; 0 THEN
        BEGIN
          SET Dirty = Insert( Dirty, iStart, iLength, '');
        END;
      END IF;
    END;
  END WHILE;
  RETURN Dirty;
END;
|
DELIMITER ; 
</pre>
</div>
<p>SELECT RemoveStripTags(&#8216;&lt;p&gt;This Function will remove Paragraph Tage&lt;/p&gt;&#8217;)   Text;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Test                                                                   |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| This Function will remove Paragraph Tage                 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/127/mysql-remove-html-code-from-data-strip-html-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bill Gates Lecture to High School Students</title>
		<link>http://www.programming-online.com/124/bill-gates-lecture-to-high-school-students/</link>
		<comments>http://www.programming-online.com/124/bill-gates-lecture-to-high-school-students/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 16:15:36 +0000</pubDate>
		<dc:creator>Pharaoh</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Bill gates]]></category>

		<guid isPermaLink="false">http://www.programming-online.com/?p=124</guid>
		<description><![CDATA[Bill Gates gave a speech at a high school about 11 things they did not and will not learn at school. He talked about how feel-good, politically correct teachings created a generation of kids with no concept of reality and how this concept set them up for failure in the real world. Rule 1. Life [...]]]></description>
			<content:encoded><![CDATA[<p>Bill Gates  gave a speech at a high school about 11 things they did not and will not learn at school. He talked about how feel-good, politically correct teachings created a generation of kids with no concept of reality and how this concept set them up for failure in the real world.<img class="alignright" src="http://www.topnews.in/files/Bill-Gates_1.jpg" alt="Bill Gates" width="245" height="245" /></p>
<p>Rule 1. Life is not fair &#8211; get used to it!</p>
<p>Rule 2. The world won&#8217;t care about your self esteem. The world will expect you to accomplish something before you feel good about yourself.</p>
<p>Rule 3. You will NOT make $60,000 a year right out of high school. You won&#8217;t be a vice-president with a car phone til you earn both.</p>
<p>Rule 4. If you think your teacher is tough &#8211; wait til you get a boss!</p>
<p>Rule 5. Flipping hamburgers is not beneath your dignity. Your grandparents had a different word for hamburger flipping: it was called opportunity.</p>
<p>Rule 6. If you mess up its not your parents fault, so don&#8217;t whine about your mistakes; learn from them.</p>
<p>Rule 7. Before you were born your parents weren&#8217;t as boring as they are now. They got that way from paying your bills, cleaning your clothes, and listening to you talk about how cool you thought you were. So before you save the rainforest from the parasites of your parents generation, try delousing the closet in your own room.</p>
<p>Rule 8. Your school may have done away with winners and losers, but LIFE HAS NOT. In some schools they have abolished failing grades and they will give you as many times as you want to get the right answer. This doesn&#8217;t bear the SLIGHTEST resemblance to ANYTHING is real life.</p>
<p>Rule 9. Life is not divided into semesters.. You dont get summers off and very few employers are interested in helping you find yourself. Do that on your own time.</p>
<p>Rule 10. Television is not real life. In real life people actually have to leave the coffee shop and go to jobs.</p>
<p>Rule 11. Be nice to nerds. Chances are you will end up working for one</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programming-online.com/124/bill-gates-lecture-to-high-school-students/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: www.programming-online.com @ 2012-05-20 18:52:12 -->
