using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;
namespace Linqex_1
{
class Program
{
static void Main(string[] args)
{
XElement xml= new XElement("Bookstore",
new XElement("Book",
new XElement("Author","J K Rowling"),
new XElement("Title","Harry Poter")
),
new XElement("Book",
new XElement("Author","William Sakespeare"),
new XElement("Title","Hamlet")
)
);
xml.Save("c:\\Bookstore.xml");
//Loading xml -Writing Linq Expression to printout element's text
XDocument doc = XDocument.Load("c:\\Bookstore.xml");
var q = from c in doc.Descendants("Book")
select (String) c.Element("Title");
foreach (string s in q)
{
Console.WriteLine(s);
}
Console.WriteLine(xml);
}
}
}
Prabin = { Alias : "Babu" ,
Profession : ["Programmer/Analyst", ".Net developer"],
Languages :["Nepali", "English", "C", "C++", "C#", "Java", "JavaScript","Learning Python"]
}
Monday, June 30, 2008
Friday, June 20, 2008
Binding CheckBoxList with Arraylist -A Problem
Though I can bind the ArrayList as a DataSource for the checkBoxList Control, but it became a problem for me. When I tried to get the selected item
----------------------
CheckBoxList1.Items[i].Checked
---------------------------
It always returns false, no matter you check the checkboxes or not.
So, To get rid of this roadblock I had to use DataTable as the DataSource.
----------------------
CheckBoxList1.Items[i].Checked
---------------------------
It always returns false, no matter you check the checkboxes or not.
So, To get rid of this roadblock I had to use DataTable as the DataSource.
Monday, March 31, 2008
I upgraded to .Net 3.0
I just accepted the Microsoft EULA for .Net 3.0 and clicked ok Button for Installation.
Today I officially upgraded to .Net Framework 3.0 from .Net Framework 2.0.
I am excited to learn about WCF,WPF,WWF and LINQ.
Yahoooooooo!
Today I officially upgraded to .Net Framework 3.0 from .Net Framework 2.0.
I am excited to learn about WCF,WPF,WWF and LINQ.
Yahoooooooo!
Monday, March 24, 2008
.Net Framework has ThreadSafety in Static Variable Initialization
Its a great thing to know about some facts that reduce your coding time .Net Framework JIT compiler only initializes the static variable only when any method uses it. Static field is instantiated with a thread safe. .Net Framework cares all about it. You dont have to add Thread Safe code for initializing static property.
For example : http://msdn2.microsoft.com/en-us/library/ms954629.aspx
For example : http://msdn2.microsoft.com/en-us/library/ms954629.aspx
Tuesday, February 26, 2008
Login failed for user computername\ASPNET
$exception {"Cannot open database \"Pasal\" requested by the login. The login failed.\r\nLogin failed for user 'owner-CC6FEF3\\ASPNET'."} System.Exception {System.Data.SqlClient.SqlException}
Try to solve this kind of error by adding below lines in web.config file.
Try to solve this kind of error by adding below lines in web.config file.
<system.web>
<identity impersonate="true" userName="abc" password="abc" />
</system.web >
Wednesday, February 13, 2008
Unable to connect to Visual Studio's Localhost Web Server
This Problem occured when I was trying to compile ASP.net in VS 2005. I tried for 2-3 hours tyring every possibilities like changing browser settings, turning off windows firewall but nothing works. At last I found in some forums that it might be the problem with the file WebDev.WebServer.exe which comes with the .net framework. Then I copied WebDev.WebServer.exe from other machine and replace it and it worked. my gosh ! the file was corrupted.
Sunday, January 20, 2008
Teach Yourself Programming in Ten Years
I found this article interesting. It is written by Google Researcher Peter Norvig.Most of us who have taken AI courses might have read his popular book AI: A Modern Approach (book)
link for the article is :
http://norvig.com/21-days.html
link for the article is :
http://norvig.com/21-days.html
Subscribe to:
Posts (Atom)