Monthly Archives: June 2011

Microsoft with the sense of humor

Visited IE test-drive site in my Chrome browser today and was greeted with a cheery banner:

Microosft about Chrome

I guess that “Don’t forget to enable your partial hardware acceleration in the about:flags thingy…” is a veiled reference that IE9’s HTML5 is fully “hardware accelerated”. Still funny.

Update: Since Microsoft is abandoning their “native HTML5” party line the funny logo has been removed as well. Too bad, especially after comparing FPS on speed tests.

Stored Procedure in LINQ2SQL query

Linq2Sql has a great use of stored procedures – it converts them into methods which you can easily call using standardized .NET syntax. For example if you have SP:

ALTER PROCEDURE MyProcedure(MyParam int) ...

after dragging it into Linq2Sql designer you can call it in your .NET code like this:

Dim aResults = MyDbContext.MyProcedure(2011)

but there are 2 caveats. Continue reading →

Solution for WordPress CURL IPv6 error “Network is unreachable”

I am using FeedWordPress plugin on some of my sites to pull data from Google News RSS feeds. It was working fine, but after I moved to a new host, I started to get errors like:

Failed to connect to 2a00:1450:8006::63: Network is unreachable

Note the IPv6. Google have been supporting it for a while and news.google.com resolves to IPv6 first (similar error happens in WordPress admin dashboard in “Incoming Links” section). Unfortunately network of my new host didn’t support IPv6, so I had to find solution to force WordPress to use IPv4. Enter class-http.php. Continue reading →

String Aggregate in LINQ

In the past I described how to perform string aggregates in T-SQL. In this post I will show how strings can be concatenated in LINQ.

I am using ADO.NET data table as a source for the query, but LINQ being LINQ can pull data pretty much from anything so this example can easily be adjusted.

First things first, let’s create the source. As in T-SQL post I am using ol’ faithful Northwind database and getting data from the Employees table:

Dim oConn As New SqlConnection(sMyConnStr) : oConn.Open()
Dim oComm As New SqlCommand("SELECT Country, FirstName FROM Employees ORDER BY Country, FirstName", oConn)
Dim oAd As New SqlDataAdapter(oComm) : Dim oTable As New DataTable : oAd.Fill(oTable)

This will fill the datatable with employees’ first names and countries

Country FirstName
UK      Anne
UK      Michael
UK      Robert
UK      Steven
USA     Andrew
USA     Janet
USA     Laura
USA     Margaret
USA     Nancy

And now we want to group this by the country, combining first names into comma separated string. Continue reading →