Language Integrated Query (LINQ) is a cool feature of .NET languages like C# that allows you to perform SQL-like query right within the language against language’s data structures (lists, arrays etc.) But one drawback of LINQ – you have to know in advance, at compile time which fields to select, what filter conditions would be. Sometimes there’s a need to supply these at runtime – e.g. user selects which fields they want to see
Thankfully there exists Dynamic LINQ Library that allows you to supply LINQ parameters as a string akin Dynamic SQL. Here’s an example of such query from the library’s homepage:
var query = db.Customers
.Where("City == @0 and Orders.Count >= @1", "London", 10)
.Select("new(CompanyName as Name, Phone)");
Now, one thing that LINQ can do is query XML. So in theory if we load, say, this XML:
into an XElement and run something like this
var query0 = myXElement.Elements()
.Select("new (Attribute(\"IP\").Value as IP, Element(\"OS\").Value as OS)")
it would produce list of IPs and OSes. Unfortunately this doesn’t work. Continue reading →
" (quote) --> "
' (apostrophe) --> '
< (less sign) --> <
> (greater sign) --> >
& (ampersand) --> &
And the error will disappear.
FusionCharts states in their documentation that in Bubble and Scatter Charts both X-Axis and Y-Axis must be numeric. But what if you want X-Axis to display some names or dates or other non-numeric values? That is still possible via
label attribute of chart’s
The method below utilizes ADO.NET/VB.NET to build XML for chart data, but similar approach can be easily used in other languages/technologies.
Consider the following ADO.NET DataTable, called
Login Failure Login Success
-------------- -------------- -------------
2013-03-27 1 69
2013-03-26 0 32
2013-03-25 1 86
2013-03-22 0 11
It holds data for number of successful/unsucessful logins for a given date. We want to display this data as a Bubble chart with dates displayed on X-Axis. Continue reading →
If you’re using Infragistics UltraWebGrid with it’s property
Browser="Xml", you may find yourself
living in a shotgun shack in a strange situation: When grid is rebinding – it takes (comparatively) short time to do server-side processing and then a very long time to render grid in the browser.
In my case it was most felt when grid (which had
disposeNode” which was called numerous times and had worst both inclusive and exclusive execution time. Continue reading →
If you ever need to remove namespaces from an XPath string, regex is a way to go. [\w]+:(?!:) expression to be precise. So if, for example your xpath is
Dim sXpath as String = "/ns1:ElementOne/ElementTwo/ns2:ElementThree"
Regex.Replace(sXpath, "[\w]+:(?!:)", "")
will convert it into
Thanks Bogdan Emil Mariesan @ Stack Overflow for the solution
If you’re trying to open an Excel 2003 XML file (SpreadsheetML) in Excel 2010 and getting “The file is corrupt and cannot be opened” error, try opening that file in WordPad (it will open as text XML) and save it back. Now try opening it in Excel 2010 again. You will still get “The file you’re trying to open is in a different format than specified by the file extension” warning, but after that the file should open.
If you get the following error while browsing a page in Internet Explorer:
The value of the ‘method’ attribute may not be ‘html’
chances are MSXML registration is corrupted on your machine. To fix this, open DOS prompt and type following commands:
This will re-register MSXML and the error will go away.