Tuesday, July 7, 2009

HttpWebRequest & WebRequest in WebServices

protected void btnWebRequest_Click(object sender, EventArgs e)
//string xmlfile;
//xmlfile = Request.Params["xmlfile"];
//if (xmlfile == null)
// xmlfile = "uddi.xml";
//HttpSOAPRequest(xmlfile, null);
//string xmlfile = "uddi.xml";
string xmlfile = "myRequest.xml";

HttpSOAPRequest(xmlfile, null);


void HttpSOAPRequest(String xmlfile, string proxy)
XmlDocument doc = new XmlDocument();
doc.Load(@"D:\Applications\FridViewManipulation\" + xmlfile);
// HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://uddi.microsoft.com/inquire");
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost:1709/FridViewManipulation/WebService.asmx");
if (proxy != null) req.Proxy = new WebProxy(proxy, true);
// if SOAPAction header is required, add it here...
//req.Headers.Add("SOAPAction", "\"\"");
req.Headers.Add("SOAPAction", "http://tempuri.org/Identify");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
// process SOAP return doc here. For now, we'll just send the XML out to the browser ...
// Response.Write(r.ReadToEnd());
dvResponse.InnerHtml = r.ReadToEnd();



Tuesday, June 16, 2009

Test to Find Adulteration in Milk, Ghee etc.

Important Tests
Test for detection of urea in Milk

1. Urea is generally added in the preparation of synthetic milk to raise the SNF value.

Five ml of milk is mixed well with 5 ml paradimethyl amino benzaldehyde (16%). If the solution turns yellow in colour, then the given sample of milk is added with urea.

2. Take 5 ml of milk in a test tube and add 0.2 ml of urease (20 mg / ml). Shake well at room temperature and then add 0.1 ml of bromothymol blue solution (0.5%). Appearance of blue colour after 10-15 min indicates the adulteration milk with urea.

Test for detection of starch

Addition of starch also increases the SNF content of milk. Apart from the starch, wheat flour, arrowroot, rice flour are also added.

How to detect?

Take 3 ml milk in a test tube and boil it thoroughly. Then milk is cooled to room temperature and added with 2 to 3 drops of 1% iodine solution. Change of colour to blue indicates that the milk is adulterated with starch.

Test for detection of formalin

Formalin (40%) is poisonous though it can preserve milk for a long time.
How to detect?

Take 10 ml of milk in test tube and 5 ml of conc. sulphuric acid is added on the sides of the test tube with out shaking. If a violet or blue ring appears at the intersection of the two layers, then it shows the presence of formalin.

Detection of Neutralizers in milk

1) Rosalic acid test (Soda Test)

In milk neutralizers like hydrated lime, sodium hydroxide, sodium carbonate or sodium bicarbonate are added which are generally prohibited.

How to detect?

Take 5 ml of milk in a test tube and add 5 ml alcohol followed by 4-5 drops of rosalic acid. If the colour of milk changes to pinkish red, then it is inferred that the milk is adulterated with sodium carbonate / sodium bicarbonate and hence unfit for human consumption.

This test will be effective only if the neutralizers are present in milk. If the added neutralizers are nullified by the developed acidity, then this test will be negative. In that case, the alkaline condition of the milk for the presence of soda ash has to be estimated.

How to proceed?

2) Take 20 ml of milk in a silica crucible and then the water is evaporated and the contents are burnt in a muffle furnace. The ash is dispersed in 10 ml distilled water and it is titrated against decinormal (N/10) hydrochloric acid using phenolphthalein as an indicator. If the titre value exceeds 1.2 ml, then it is construed that the milk is adulterated with neutralizers.


Tests to detect adulteration in ghee

1. Butyrorefractometer reading

Properly filtered ghee whose temperature is around 40°C is taken; 2-3 drops of it are poured in to the butyrorefractometer by the side of the glass rod. Now the reading is noted by the scale placed above the meter. Care has to be exercised to maintain the temperature of water that is flowing over the thermometer to be at 40°C. If the temperature deviates, then the results obtained may not be accurate.

2. Baudoin Test (Detection of adulteration of ghee with vanaspathi)

As per the prevention of food adulteration act, it has been made mandatory to add 5% sesame oil to vanaspathi in order to detect the presence of vanaspathi in ghee through Baudoin test. The principle behind the test is development of permanent crimson red colour with furfural in the presence of concentrated hydrochloric acid in ghee adulterated with vanaspathi.

How to detect?

Take 5 g of molten filtered ghee in a test tube and add 5 ml of concentrated hydrochloric acid and 0.1 ml furfural solution in alcohol (2%) and mix the contents thoroughly and it is allowed to remain undisturbed for 10 min. Development of crimson red colour shows that the ghee is adulterated with vanaspathi.

3. Detection of mineral oil in ghee

About 2 g of ghee is saponified with 25 ml of 50% alcoholic potassium hydroxide for one hour. Then the saponified content is transferred to a beaker containing 100 ml of water. Development of turbidity indicates the adulteration of mineral oil in ghee.

Friday, May 15, 2009

Endless Race to get Everything for Nothing !

Once I have read from some book that "Don't desire, desires are like fires"
These are not just words but they have a hidden message inside them.
As fire burns something whatever it takes, similarly Desire burns our conscience, consciousness, truthfulness, loyalty, morality, peace of mind... and the list is endless... it completely overcome our freedom of life and we became slaves, who works on the order of their master (will), and we works like machines.
And above all we forgot the goal of our life i.e. to achieve a state where we can live full consciousness.

....To be Continued....

Friday, April 3, 2009

Job Loss ? 5 ways to recession proof your job.

1. Save Money:
It is the only and the best way to survive in worst time like this, so try to save your money and make 20% investment in short term investments so that in need you can liquidate you money quickly and rest 80% in long term investment be careful while investing because invest the big chunk in government sponsered schemes only eg. fixed diposits, mutual funds etc. otherwise in times like this value of you money will be much less then you have invested.

2. Break your credit card into multiple pieces, throw away your credit card in to dust bin and call your bank account customer care executive to close account, becouse credit card could make our life worst due to compoudedness of its interest.
3.Get away from Loans.
4. Buy all goods you use at a time for 1 month or year so that you can get discount.
5. Keep contant track and look at your budget.

Sunday, January 18, 2009

Encrypting and Decrypting connection strings in web.config

In an ASP.NET website or web application, connection string for connection to a database server are stored in web.config file. It becomes easy to manage and access the connection strings from a central file accessible to all ASP.NET pages. But the security and privacy of the connection strings are higly important. It is a good idea to protect the connection strings in web.config by encrypting them. ASP.NET gives a built in way to do this. We can use RSAProtectedConfigurationProvider to encrypt the connection strings using User Level Key and Machine Level Key. User Level Key is used when you are running your application on a shared server and Machine Level Key is used when you are running your application on dedicated server. In this article we will see how to encrypt using Machine Level Key. In the web.config following is the section having all connection string:

After storing all connection strings, go to the Visual Studio 2005 Command Prompt.
(Start->Programs->Microsoft Visual Studio 2005->Visual Studio 2005 Tools->Command Prompt)

There write this command on command prompt:

aspnet_regiis -pef "connectionStrings" "c:\myProjects\website1"

Where the "c:\myProjects\website1" is the physical path of your website. Review the web.config after this. You will find it encrypted.

Later on you can access this connection string as normal way in your pages:



To revert the web.config connection strings back to plain text:

aspnet_regiis -pdf "connectionStrings" "c:\myProjects\website1"

Microsoft Silverlight 2

From Microsoft website available to public

Microsoft Silverlight 2

Fact Sheet

October 2008

A New Way to See the Web

Over the past year Microsoft Silverlight has led the way for developers and designers to create compelling media experiences and rich Internet applications (RIAs) on the Web via an easy-to-use, quickly installed browser plug-in. With the release of Silverlight 2, Microsoft Corp. is delivering a wide range of new platform features and tooling options that enable designers and developers to better collaborate while creating more accessible, more discoverable and more secure end-user experiences.

Silverlight Momentum

Silverlight is one of the fastest-growing browser plug-ins in history, both in terms of customer adoption and consumer installations. In 2008, Silverlight powered the 2008 Beijing Olympic Games (http://www.microsoft.com/presspass/presskits/ms-olympics/default.mspx) and the Democratic National Convention (http://www.demconvention.com). In addition, companies such as CBS College Sports Network, Blockbuster Inc., AOL LLC, Hard Rock Cafe International Inc., HSN Inc. and Toyota Motor Corp. are using Silverlight to provide a unique and dynamic Web experience for their customers. Silverlight has also been widely adopted throughout the developer and designer community by means of the Silverlight Partner Initiative. With more than 150 companies in the program — 120 of which have joined in the past year — it is a vibrant ecosystem of agency, solution provider, content delivery network, independent software vendor and independent hardware vendor partners, which are delivering some of the most innovative Silverlight experiences on the Web today. Finally, consumer installations of the Silverlight plug-in are growing rapidly, with penetration in some countries approaching 50 percent.

Openness and Interoperability Support

Proving its commitment to openness and its support for interoperability, Microsoft is funding a project to integrate advanced Silverlight development capabilities into the open-source Eclipse integrated development environment (IDE), will publish the Silverlight Extensible Application Markup Language (XAML) Vocabulary Specification, and will make the Silverlight Control Pack available as open source software.

“We have been very pleased to have a project proposed to create Eclipse tools for Microsoft Silverlight,” said Mike Milinkovich, executive director of the Eclipse Foundation. “This proposed project will provide Eclipse developers with the ability to leverage Silverlight and Java Web Services when developing rich Internet applications. Having a strong endorsement from Microsoft for this project is a clear sign of their support for Eclipse and open source communities.”

· The Eclipse Tools for Microsoft Silverlight Project will integrate advanced Silverlight development capabilities into the Eclipse IDE and Eclipse Rich Client Platform. Developed by France-based IT solution provider Soyatec, the project is funded by Microsoft.

­ Increased interoperability. Eclipse will contain functionality that will help Java developers build Silverlight applications that work better with Java Web Services using representational state transfer (REST), Simple Object Access Protocol (SOAP), JavaScript Object Notation (JSON) and other standards.

­ Silverlight Project System and Silverlight Compiler. Eclipse will contain both an advanced project system for creating Silverlight applications and media experiences and a compiler for packaging Silverlight applications for deployment.

­ XAML editor and preview with code hinting and code completion. Eclipse will contain an advanced, standards-compliant XAML editor with code hinting and code completion, which helps detect and correct coding errors.

­ Full compatibility with Microsoft’s development and design tools. The XAML and Silverlight projects created by Eclipse will be fully supported by both Microsoft Visual Studio and Microsoft Expression Studio tools.

­ Results. See the picture below for a glimpse of a Silverlight application being created in Eclipse.

­ Availability. A preview of the bits was posted today at http://www.eclipse4sl.org under the Eclipse Public License Version 1.0. Customers can use the SourceForge project site to submit bugs and feedback or contribute to the project. The release candidate is scheduled to be available free for download by spring 2009.

­ Road map. Although the first version of the Eclipse Tools for Microsoft Silverlight will be optimized for the Windows version of Eclipse, the project plans to offer full support for the Mac and Linux versions of Eclipse in a later release.

· By publishing the Silverlight XAML Vocabulary Specification under the Open Specification Promise, Microsoft will better enable ISVs to read and write XAML for use in Silverlight projects in other design and development software applications, thus accelerating the creation of a robust authoring and server ecosystem for Silverlight. This documentation release complements Microsoft’s existing published specifications of the XAML object mapping rules and XAML vocabulary for Windows Presentation Foundation (WPF).

· By making the Silverlight Control Pack available as open-source software, which is built on CodePlex and released under the Open Source Initiative-approved Microsoft Public License (MS-PL), Microsoft is helping developers easily customize and ship their own expanded controls, augmenting the powerful built-in control set that already ships in Silverlight.

­ Featured controls in the Control Pack. DockPanel, WrapPanel, ViewBox, Label, HeaderedContentControl, Expander, TreeView, NumericUpDown, AutoComplete and Accordion are available.

­ Advanced skinning support. The Silverlight Control Pack will provide additional control skins and templates to customize the look and feel of both the core Silverlight and Control Pack controls.

­ Learning opportunity. Developers can learn how to create their own advanced Silverlight controls by using high-quality Microsoft source code as a starting point.

· Growing tooling support from partner ecosystem. Tool support for building Silverlight-enabled applications continues to grow, with partners such as Captaris Inc., Telerik Inc., ComponentOne LLC, Infragistics, Software FX Inc., Intersoft Solutions Corp., Developer Express Inc., K2, Gizmox and RemObjects Software LLC providing products ranging from forms layout and rich interactive components to workflow, programming languages and business intelligence.

“Microsoft is thrilled to see the momentum building around tooling support from our partners,” said Scott Guthrie, corporate vice president of the .NET Developer Division at Microsoft. “The breadth of these partner offerings enables Silverlight developers to build evermore sophisticated and capable applications, further broadening the appeal of Silverlight for use in a wide range of scenarios.”

New Features in Silverlight 2

Highlights of new features of Silverlight — which are fully supported by Expression Blend 2 SP1 and Microsoft Visual Studio 2008 SP1 — include these:

· Expanded .NET Framework language support. Unlike other runtimes, Silverlight 2 supports a variety of programming languages, including Visual Basic, C#, Managed JavaScript, IronPython and IronRuby, making it easier for developers already familiar with one of these languages to repurpose their existing skills.

­ Cutting-edge RIA development. With Silverlight 2, developers do not have to pay the “productivity tax” of converting their existing code to JavaScript to run inside the client. With support for languages such as Ruby and Python, Silverlight 2 enables developers to be on the cutting edge of RIA development, creating Asynchronous Ruby and XML (ARAX) and Asynchronous Python and XML (APAX) applications.

· A rich base class library. A compatible subset of the full .NET Framework gives developers the most comprehensive RIA runtime on the Web today, with unparalleled data access capabilities, local data caching and local data storage, superior input-output (IO) performance, and better threading. By leveraging the rich base class library of the .NET Framework, developers can minimize the amount of additional code they have to write for their projects.

­ Building better AJAX applications. Silverlight 2 includes APIs that enable the creation of better asynchronous JavaScript and XML (AJAX) applications, with improved HTML DOM/JavaScript integration with .NET code and with better data access through Language-Integrated Query (LINQ) and LINQ to XML library support.

· Powerful built-in rich controls allow developers and designers to quickly build applications through a rich set of built-in controls such as DataGrid, ListBox, Slider, ScrollViewer and Calendar. With the rich controls built into Silverlight 2, developers don’t have to start from scratch when building the controls for their rich Internet applications.

· Advanced styling and templating support gives designers and developers complete control over the look and feel of an application to ensure the custom brand experience for their rich Internet application meets their exacting requirements.

· Rich UI Library. Silverlight 2’s UI Library, a compatible subset of the WPF user interface framework featured in the full .NET Framework, makes building rich Web applications easier. The powerful graphics and animation engine enables developers to reuse skills, code and content to build rich applications for the browser that can be rapidly ported to the desktop and devices.

­ Better support for higher-level UI capabilities. The UI Framework in Silverlight contains support for higher-level UI capabilities such as layout management, data-binding, styles and template skinning.

· Comprehensive networking support enables Silverlight users to leverage the power of the .NET Framework’s Windows Communication Foundation and directly access resources on the Web by supporting cross-domain network access.

­ Out-of-the-box support for calling REST, WS*/SOAP, POX, RSS and standard HTTP services enables users to create Web 2.0-style applications that easily integrate with existing heterogeneous back-end systems.

· Advanced content protection features, now including Silverlight digital rights management (DRM), Powered by PlayReady. Silverlight DRM builds on Microsoft’s extensive expertise in developing DRM technologies, delivering robust protection for key Silverlight scenarios including live streaming, on-demand streaming and progressive downloads for connected experiences.

· Improved server scalability and expanded advertiser support. The combination of Silverlight 2 and Windows Server 2008 offers streaming video professionals industry-leading scalability and cutting-edge progressive download features. In addition, Silverlight offers superior search engine optimization capabilities and advanced in-stream advertising support through companies such as DoubleClick Inc. and EyeWonder Inc.

· Unparalleled interactivity with high-resolution content through Deep Zoom technology. The new Deep Zoom technology in Silverlight allows users to see images on the Web as never before. The smooth, in-place zooming and panning that Deep Zoom allows is a true advancement and raises the bar on what image viewing should be. It is also now possible through this feature to make super-high-resolution images easily consumable on the Web. Even better, Deep Zoom is designed in a way that will reduce Web hosting and bandwidth costs by sending to the browser exactly the right size and resolution image for the current display area.

Truncate and Delete

Delete table is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow.

Truncate table also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the de-allocation of the data pages of the table, which makes it faster. Of course, truncate table cannot be rolled back.

Truncate table is functionally identical to delete statement with no where clause both remove all rows in the table. But truncate table is faster and uses fewer system and transaction log resources than delete.

Truncate table removes all rows from a table, but the table structure and its columns, constraints, indexes etc. remains as it is.

In truncate table the counter used by an identity column for new rows is reset to the seed for the column.

If you want to retain the identity counter, use delete statement instead.

If you want to remove table definition and its data, use the drop table statement.

You cannot use truncate table on a table referenced by a foreign key constraint; instead, use delete statement without a where clause. Because truncate table is not logged, it cannot activate a trigger.