Sunday, September 26, 2010

Bom Sabado Worm Fix for Orkut

Most of the new orkut users are affected with a worm called “BOM SABADO”. Please refrain from login into the new orkut, or you switch to the old one. This worm will send scraps to all of your orkut friends. For safe side you can change your google account password.

You can get out of this virus by using firefox addon Adblock plus  

After installing Click go to Preferences-> Add filter and enter *tptoos.org/* .

Also Revoke the access to worm in your google account settings.

gAcc

  1. Go to google account settings
  2. In Security ,”Change authorized websites”
  3. Revoke the access from “stapi.snacktools.com”
  4. Switch to old orkut, until google had a fix over it.

Happy Social Networking!!!!!!!!!!!!!!

Sunday, July 4, 2010

HTTP Error 500.19 with IIS 7.0

Last week i was deploying an application in IIS 7.0 freshly configured and got a HTTP 500.19 error as elaborated below

Description: The requested page cannot be accessed because the related configuration data for the page is invalid.

Error Code: 0x80070021

Notification: BeginRequest

Module: IIS Web Core

Requested URL: http://localhost:4341/webapplication1

Physical Path: c:\inetpub\wwwroot\webapplication1

Logon User: Not yet determined

Logon Method: Not yet determined

Handler: Not yet determined

Config Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Config File: \\?\c:\inetpub\wwwroot\webapplication1 \web.config

 

This due to the web.config section is get locked. By default whenever we install ASP.NET this section will be get unlocked. But sometime if we install IIS after ASP.NET installation it will not get unlocked. Here is the appcmd to unlock the section

%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers

You need to run this command in Administrator mode, also go to control panel-> Turn windows feature on or off and under IIS install ASP.net.

Tuesday, June 8, 2010

Windows Phone 7: No Native Code Support


As in the previous generations of Windows Mobile phones the newly arrived Windows Phone 7 does not have any Native Code(Native code is computer programming (code) that is compiled to run with a particular processor (such as an Intel x86-class processor) and its set of instructions) support.It will support application running in the RIA platform Silverlight runtime and XNA Game studio only. This will make most of the SmartPhone Application developers to refrain from the Windows Phone 7. The user interface overlay the .Windows Embedded CE 6.0 Release 3 kernel , runs only interpreted or managed code through the two runtime environments provided by Silverlight and XNA.

Eventually all the Silverlight developers will become windows mobile developers. Any way that's the new step to the mobile-RIA world, good gaming
platform for the windows mobile with minimum hardware requirements

Saturday, May 8, 2010

VS 2010 –Some amazing features

For the past some months I'm looking into what’s there will be with Visual Studio 2010.At its beta releases VS 2010 faced a series of problems(Installer crash,Add reference empty in Silverlight project, Smart device project creation problem). Now they fixed most of the issues in the latest releases.I’m describing some of the cool new features with 2010 IDE.

View Call Hierarchy

By this we can see the hierarchical list of function usage.We can see the parameter details and function location.

Untitled11

Data & Schema Comparer

Previously most of us struggle a lot in comparing data's and schemas in and between databases. Also there was some third party tools Sql tool belt from Redgate, its so expensive.In Visual Studio 2010(I'm using vs 2010 ultimate) there is a new schema and data comparison tool.You can select two different databases and run the comparison task.

DMenu  Capture

Dcompare

Architectural and UML Model Explorer

This is quite useful for functional & architect.In the tool bat Select->Architecture->Windows->Architecture Explorer.Dig into it and do more!!!

archmen Arch1

Debugging With IntelliTrace

Visual Studio 2010 had a vast changes in the debugging sections.One of the cool feature is “IntelliTrace” which will more helpful while debugging the application as it provide a detailed picture of the debug info , you can record debug information and we can later look up into the previous debug info.

intellitrace

With IntelliTrace, you can actually see events that occurred in the past and the context in which they occurred. This reduces the number of restarts that are required to debug your application and the possibility that an error will fail to reproduce when you rerun the application.

Also we can pin-in values to variables  while debugging!!!

Read more in MSDN Click here

Read more about debugging information on ScottGu Blog Click here

Also VS 2010 newly added

  • Optional & Named parameters(like old vb 6)
  • Insert Code Snippet for JS,Html
  • We drag windows outside the model-Multi monitor support(Like we drag a tab to another window in Firefox&chrome)

Drag

And many more…that i will update in this chain.

Go and Rocks with VS 2010!!!!!!!!!!!!!!!

Converting “Var” to Dataset

After a long time back i’m into my blog…Didn’t get enough time to sit with the things..

In some cases we need to convert the anonymous datatype var to a dataset or datatable.we cant do it directly as so.Here is a

Simple method that will return the var or List item to dataset


public static DataSet ToDataSet(List list)
{

Type type = typeof(T);
DataSet ds = new DataSet("Company");
DataTable dt = new DataTable("Contacts");
ds.Tables.Add(dt);
//Dynamically adding columns to data table
foreach (var propInfo in type.GetProperties())
{
dt.Columns.Add(propInfo.Name, propInfo.PropertyType);

//You can add columns manually also here
if (propInfo.Name == "ID")
{
dt.Columns.Add("Photo");
}
}
foreach (T item in list)
{
DataRow dr = dt.NewRow();
foreach (var propInfo in type.GetProperties())
{
dr[propInfo.Name] = propInfo.GetValue(item, null);
}
dt.Rows.Add(dr);
}
return ds;
}

Wednesday, February 17, 2010

Xml Manipulation Using Linq-Some basic lessons

The “functional construction” feature of Linq to Xml provides great usability in creating and modifying xml documents. XDocument object is used for the xml declarations. The XElement class constructor are used in resolving the xml entities.

string path = Server.MapPath(@"/Linq2XML/DataStore.xml");
XDocument xd = XDocument.Load(path);
var result = from c in xd.Elements("DataStore").Elements("Table") select new { oid = (string)c.Element("oid"), BuildName = (string)c.Element("BuildName"), Appserver = (string)c.Element("Appserver"), DBServerName = (string)c.Element("DBServerName"), dbname = (string)c.Element("DBName"), comments = (string)c.Element("comments") };

This will load the Xml file to your XDocument object and perform a linq operation to get the xml elements. We can use Descendants to return the filtered collection of matching XName elements.

For modifying the elements we can use the SetElementValue Method of XElement, that will set, add and remove child elements.

public void ModifyEnvironments(string oid,string buildName,string appServer,string dbServer,string dbName,string comments )
{
XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));
var items = from item in objdoc.Descendants("Table")
where item.Element("oid").Value == oid
select item;
foreach (XElement itemElement in items)
{
itemElement.SetElementValue("BuildName", buildName);
itemElement.SetElementValue("Appserver", appServer);
itemElement.SetElementValue("DBServerName", dbServer);
itemElement.SetElementValue("DBName", dbName);
itemElement.SetElementValue("comments", comments);
}
objdoc.Save(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml"));
}

We can use Remove() to delete an element.Also can use RemoveContent method that will make an empty element tag()

public void DeleteEnvironment(string oid)

{
XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml"));
var items = (from item in objdoc.Descendants(@"Table")
where item.Element("oid").Value == oid
select item).FirstOrDefault();
items.Remove();
objdoc.Save(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));
}

For adding new XElement we can use the Add() method

public void AddEnvironments(string buildName, string appServer, string dbServer, string dbName, string comments)
{
XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));
XElement xe = objdoc.Descendants("DataStore").Last();
xe.Add(new XElement("Table", new XElement("oid", GetMaxOid()), new XElement("BuildName", buildName)
,new XElement("Appserver",appServer),new XElement("DBServerName",dbServer),new XElement("DBName",dbName),
new XElement("comments",comments)));
objdoc.Save(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml"));
}

Please find the sample XML file (“DataStore.xml”)here

Tuesday, February 2, 2010

Location and Sensor Platform in Windows 7

Cool , there are some nice sets of Location and Sensor API associated with windows 7.As now computers are portable like cellular phone the necessity of GPS enabled application are very useful. If your laptop doesn’t have any sensors installed it will take the default location provided by the user. This Location and sensor API open wide variety of applications.

References
http://msdn.microsoft.com/en-us/library/dd318936(VS.85).aspx
http://msdn.microsoft.com/en-us/library/dd464636(VS.85).aspx


Learn how to read the GPS co-ordinates, See this article.
http://blogs.msdn.com/coding4fun/archive/2006/10/31/912287.aspx
Even More..

Thursday, January 14, 2010

Func<T,TResults> – Flexible delegate to create reusable functions

Today while googling i found an interesting feature of delegate Func<T,TResults> ,it allows us to represent a method that can be passed as a parameter without declaring a custom delegate explicitly and the method must have one parameter that is passed to it by value and must return a value.

In the following example we need to explicitly define a new delegate and assign a named method to it.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BlogSamples
{
delegate int ConvertMethod(int _x);
class Program
{
static void Main(string[] args)
{
ConvertMethod objConv = SquareMe;
int val = 5;
//delegate is called
Console.WriteLine(objConv(val));
Console.ReadKey();
}
private static int SquareMe(int myInt)
{
return myInt * myInt;
}
}
}

Without explicitly defining a new delegate it can be simplified as below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BlogSamples
{
class Program
{
static void Main(string[] args)
{
Func convertMethod = SquareMe;
int val = 6;
Console.WriteLine(convertMethod(val));
Console.ReadKey();
}
private static int SquareMe(int myInt)
{
return myInt * myInt;
}
}
}


Please see the msdn link for more references.