Archive

Archive for September, 2012

Checking a variable can be cast to a specified type in C#

September 20, 2012 Leave a comment

 var myObject =variable as SomeType;

if(myObject !=null )
{
//successful cast

}

else

{

//casting failed

}

🙂

Advertisements
Categories: ASP.NET Tags:

Error : Maximum request length exceeded when you upload large files aspx page

September 14, 2012 Leave a comment

When you upload large files you may get error

“Maximum request length exceeded”

to resolve this add this section in web.config

<system.web>
        <httpRuntimemaxRequestLength="52768"/>
    </system.web>

 

it sets the maximum request length in KB.

🙂

 

XML Parsing Error: reference to invalid character number. Hexadecimal value 0x[whatever] is an invalid character

September 13, 2012 Leave a comment

If you get an error parsing xml

“XML Parsing Error: reference to invalid character number

<Text> Some Text &#xB;</Text> ”

try to remove the unsupported invalid characters from the xml string as

writer.WriteStartElement(“Text”);

string text = sometext to be in xml;
StringBuilder buf = new StringBuilder(text.Length);
foreach (char ch in text)
{
if (IsLegalXmlCharacter(ch))
{
buf.Append(ch);
}
}
writer.WriteString(Convert.ToString(buf));
writer.WriteEndElement();

public bool IsLegalXmlCharacter(int ch)
{
return
(
ch == 0x9 || ch == 0xA || ch == 0xD ||  (ch >= 0x20    && ch <= 0xD7FF  ) ||
(ch >= 0x10000 && ch <= 0x10FFFF) || (ch >= 0xE000  && ch <= 0xFFFD  )

);
}

🙂

The procedure entry point _Atomic_fetch_add_4 could not be located in the dynamic link library c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\vswinExpress.exe

September 4, 2012 Leave a comment

If you installed Office 2013 preview , you will get an error

“The procedure entry point _Atomic_fetch_add_4 could not be located in the dynamic link library c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\vswinExpress.exe”

when you open VS Express for Win 8.

To resolve this, install this fix

http://www.microsoft.com/en-us/download/details.aspx?id=30178

Happy metro style coding

🙂

Categories: Windows 8

Enable start button in Windows 8

September 4, 2012 Leave a comment

Currently Windows 8 release preview has no start menu as in Windows 7

Download and Install ViStart, from the link

http://lee-soft.com/vistart/

you will get a start button as in older version.

Categories: Windows 8 Tags: , ,