• Home
  • About
  • Resume

Solution for “Could not load type System.Web.UI.ScriptReferenceBase from System.Web.Extensions” error

By , 12/29/2009 3:49 PM

If your ASP.NET application worked fine in your Development environment, but after deploying it to staging or production crashes with error:

Could not load type System.Web.UI.ScriptReferenceBase from System.Web.Extensions

most likely it was compiled against .NET 3.5 SP1 but the target machine has original .NET 3.5 framework without SP1. The solution is download Service Pack 1 and install it on target server. Another possibility – compile the project against original .NET 3.5 framework.

TNX.NET and autoblogging: Generate steady income

By , 12/26/2009 6:03 PM

If you’d like to generate a steadily increasing stream of income online in addition to your day time job, you can do it in 6 easy steps and once initial setup is done, everything is completely automatic, you won’t have to do a thing. (If you already have a blog and don’t need content posted to it automatically – jump directly to step 6).

  1. Get a good web hosting with PHP. If you don’t already have one, sign up with Blue Host, for less than $7/month they offer pretty much unlimited everything (disk space, traffic, databases, sub domains etc.)
  2. Install WordPress MU/3x. Once web hosting account is set up, download and install multi-blog version of WordPress. This will allow you to setup multiple blogs to have multiple sources of income.
  3. Setup your first blog.  Add 5-10 categories related to your blog topic. Then download and install Unique Article Wizard WordPress plugin (scroll down to actual download), this is a very cool service, once setup, in about a day it automatically starts to deliver high quality posts to you blog, related to your blog topic.
  4. Fill your blog with initial content. Your blog needs to have some content to be indexed by Google (this is important). One way to create several hundred initial posts it is to search Google news for related keywords, switch to RSS mode (hint: if you add “n=100” without quotes at the end of Google RSS feed URL,  you will get 100 records instead of default 20),  save RSS feed as XML file and import that XML file into your WordPress blog.
  5. Promote your blog. To speed up indexing of your site by Google you can add it to social bookmarking sites (DiggDelicious, Propeller, Yahoo Buzz are good start).  You can also add SEO-specific plugins to your blog (XML SiteMap and All-in-one SEO Pack are the best) and add your site to Google Webmaster Tools.
  6. Sign up for TNX.NET text links. Once your site has at least 30 pages indexed by Google (you can test how many pages are indexed by doing Google search for “site:your.site.name”) you can sign up for TNX.NET account. You will need an invitation code to open a new account, so you can use one of the following:

    4dfbc478
    4dfbc47d
    4dfbc47f
    4dfbc481

    After signing up you will get a small block of PHP code which you can add either to your blog’s theme templates (for example header or footer) OR install a PHP widget plugin, paste the code there and drag the widget into a sidebar.

TNX displays unobtrusive text links on your pages, for the links you are credited TNX points, which you can cash via PayPal. Links are sold on every page, so the more pages the blog has – the bigger income.  And having Unique Article Wizard will add unique pages to your blog every day.  I already implemented this approach on 7 of my autoblogs you can see here:

Automotive News
Real Estate News
Building and Construction News
Ecommerce News
Business News
Travel News
Web Developement

You can repeat steps 3 thru 6 to add new blogs adding even more to your income.

If you have any question about any particular step or if you need a new invite code to TNX, please leave a a comment here.

Microsoft Chart for ASP.NET 3.5: Correctly setting image storage location

By , 12/24/2009 2:25 PM

If you’re using Microsoft Chart control for .NET 3.5 you can specify where and how chart images are stored. And if for this purpose you’re trying to use Chart HTTP Handler setting in web config similar to this:

<add key="ChartImageHandler" value="storage=file;url=./Temp"/>

and it is failing (for example chart images are alway created in the root folder of your Web application) – there is an alternative. You can specify location of the images in properties of the chart control itself:

Just add relative path to your storage folder in front of the chart sequence string in “ImageLocation” property. and specify “UseImageLocation” for “ImageStorageMode” property

LINQ: Truly language integrated. Using VB functions inside of LINQ Query

By , 12/17/2009 5:15 PM

LINQ is truly integrated into VB.NET. This allows not only to use LINQ-specific query language in a standard VB.NET code, but use VB.NET code in a LINQ query. Consider function from the previous post. To make it universal we can pass one more parameter
“Aggregate Type” and based on that parameter return Min, Max, Avg, Sum or Count

Function GroupBy(ByVal i_sGroupByColumn As String,  ByVal i_sAggregateColumn As String, ByVal i_dSourceTable As DataTable, i_iAggregateType as Integer) As DataTable

     dim aQuery = From row In i_dSourceTable Group By Group1 = row(i_sGroupByColumn) Into Group Select Group1,  Aggr = Choose(i_iAggregateType, Group.Min(Function(row) row(i_sAggregateColumn)), Group.Max(Function(row) row(i_sAggregateColumn)), Group.Sum(Function(row) row(i_sAggregateColumn)), Group.Avg(Function(row) row(i_sAggregateColumn)), Group.Count(Function(row) row(i_sAggregateColumn)))

    return aQuery.toDataTable

End Function

In this example VB.NET function Choose is used inside of a LINQ query’s Select Statement. If i_iAggregateType parameter is equal 1 – Minimum value, will be calculated, 2 – Maximum etc.

Grouping ADO.NET DataTable using LINQ

By , 12/17/2009 10:22 AM

I’ve described before how to group and aggregate data in ADO.NET data table using standard .NET 2.0 features. But if you happen to use .NET 3.5 or above and Visual Studio 2008 or above – that entire block of code can be replaced with a single LINQ query:

Function GroupBy(ByVal i_sGroupByColumn As String,  ByVal i_sAggregateColumn As String, ByVal i_dSourceTable As DataTable) As DataTable

     dim aQuery = From row In i_dSourceTable Group By Group1 = row(i_sGroupByColumn) Into Group Select Group1,  Aggr = Group.Count(Function(row) row(i_sAggregateColumn))

    return aQuery.toDataTable

End Function

The query at line 3 is a LINQ to DataSet query, so reference to System.Data.Linq has to be added to your project. The Group.Count aggregate can be replaced with Group.Max, Group.Min, Group.Sum or Group.Avg to perform respectful function.

There is one caveat though. Continue reading 'Grouping ADO.NET DataTable using LINQ'»

WordPress MU: Delete Empty Posts

By , 12/11/2009 4:29 PM

Sometimes I bring information to a couple of my other WordPress blogs via RSS feed. It’s a nice feature, allowing you to create several posts at once without manual entry. Unfortunately if RSS feed is broken or improperly formatted it can result in blank posts imported into the blog.

I was looking for a WordPress plugin that would allow me to mass-delete empty posts, but apparently none exist. You can delete posts based on date, tags, category, but not the content. Fortunately if you have access to phpMyAdmin of your MySQL installation – there is a solution. Continue reading 'WordPress MU: Delete Empty Posts'»

Google Easter Egg. December 2009

By , 12/11/2009 10:10 AM

This is December of 2009 and Google has an interesting Easter Egg in its Search page. If you leave the search field blank and click “I am feeling lucky” button Google displays countdown in large numbers:

From the looks of it it’s a countdown to New 2010 Year. It’s coming 🙂

Don’t code and drive

By , 12/07/2009 4:46 PM

There is a new masterpiece for sale at Amazon

Using this amazing device you can place your laptop right on the steering wheel of your car. Just imagine playing “Grand Theft Auto” while driving a real car – what can compare to that? Also this not being a cell phone will never get you in trouble with the police.

As one of the avid fans put it: “What makes this product so wonderful is that now I can write letters while I drive! No more texting, no more tickets! I have been keeping up with all my friends and they appreciate how much more “personalized” my letters are than my texts. If there is any drawback, it’s on windy roads, because sometimes I make stray marks on the tighter curves, but it’s a small price to pay for staying within the law!”

Resizing IE Modal Dialog in JavaScript

By , 12/03/2009 11:44 AM

If you open an IE Modal Dialog window and later on need to resize it using JavaScript code, standard “window.resizeTo” method doesn’t work. Use dialogWidth and dialogHeight instead. For example:

window.dialogWidth='640px';
window.dialogHeight='480px';

IE Modal Dialog and ASP.NET PostBack solution

By , 12/02/2009 2:08 PM

Internet Explorer has a well known proprietary modal dialog window that can be opened using showModalDialog DOM command. While it is not a good idea to use browser-specific functionality, for many it’s a convenient way to display a modal window and return result back to the parent.

Modal Dialog is designed to display data, accept user input and close window, returning the input back to the parent. It is not meant for postbacks, if you try initiating postback in Modal Dialog, all kinds of weird stuff could happen – from opening postback in a new window to JavaScript errors.

But there is an easy fix for that. If you include following line:

<base target="_self"></base>

inside of your page header in HTML source, e.g.:

<head>
    <title>My Page</title>
    <base target="_self"></base>
</head>

modal dialog will be able to successfully postback to itself.

Panorama Theme by Themocracy