Навигация

Итоги года

Другие ссылки


Реклама

Счётчики


<- Предыдущие записи Следующие записи ->

Error 0x80070005 at regsvr32

27.08.2008 Среда 16:18

Trying to register a COM dll in Vista Buisness SP1 with the following command:

regsvr32 [name of the dll]

I got the following error:

The module "[name of the dll]" was loaded but the call to DllRegisterServer failed with error code 0x80070005.

Resultion: Start command line in "Run as administrator" mode before issuing this command.

Комментариев: 2

LINQ to SQL and Unions

22.08.2008 Пятница 17:50

For some reason I was getting the following error:

Specified cast is not valid

when trying to use LINQ to SQL in the following way:

var q1 = from p in Context.Posts
... blah ...
select new SearchResult
{
...
};

var q2 = q1.Union
(
from c in Context.PostComments
... blah ...
select new SearchResult
{
...
}
);

return q2.ToArray();
The error was happening at the last line. Turned out the following fixes it:

var q1 = from p in Context.Posts
... blah ...
select new SearchResult
{
...
};

var q2 = from c in Context.PostComments
... blah ...
select new SearchResult
{
...
};

return q2.ToArray().Union(q2.ToArray());

Доктор, меня все игнорируют (нет комментариев)

Windows: 32 vs 64 bit

22.08.2008 Пятница 16:39

To find out what version of Windows (32 or 64 bit) your computer is running, type the following in the command prompt:

winver

A window appears that shows information about the operating system installed. If you don't see words "64 bit" anywhere then it's 32-bit Windows.

Доктор, меня все игнорируют (нет комментариев)

Magic expression

20.08.2008 Среда 15:31

What will be the result of the following expression in C#?

Math.Floor ((31.4 - Math.Floor(31.4)) * 60)

If your answer is 24 you are wrong. Give it a try. The result is not that obvious.

Доктор, меня все игнорируют (нет комментариев)

System.Core.dll grayed out

18.08.2008 Понедельник 14:40

I was trying to add a reference to assembly System.Core.dll in my project. However the dll's name was grayed out in the Add Reference dialog box. The reason is that System.Core.dll can only be added to projects whose target framework is .Net 3.5. Target framework can be changed in the project's properties.

Доктор, меня все игнорируют (нет комментариев)

Multiple development web servers

31.07.2008 Четверг 15:03

Software: Visual Studio 2008

You may have noticed that when you debug a web project that resides in a solution that contains other web projects, Visual Studio starts multiple development web servers — one for each web project in the solution. Sometimes it may be annoying (especially when you have somewhat 30 web projects). To turn this "feature" off do the following for each project:

- open the project's property grid
- set "Always Start When Debugging" property to false

Доктор, меня все игнорируют (нет комментариев)

Locating files in Solution Explorer

04.07.2008 Пятница 19:07

Software: Microsoft Visual Studio 2008

When studying unfamiliar code in Visual Studio and looking at contents of a file, have you ever wondered how to locate the same file in the Solution explorer window? That may not be easy at all if the solution has lots of projects and scores of files in them, and the way you got to open the file in the editor was through navigating symbol definitions (F12). Well, here's the remedy. For me it was real revelation since it's been many years that I've been suffering in such situations, trying to locate file either manually (by looking through all the projects in the solution) or by searching the physical media (folders on the hard drive) for the file name.

In Visual Studio:

Go to Tools —> Options —> Projects and Solutions —> General -> check Track Active Item in Solution Explorer.

This will make Visual Studio keep editor window and item selected in Solution explorer in sync. That is, if at ant time you switch from one file to another in editor window, solution explorer will find and highlight corresponding file.

Thank God this annoying issue is gone for good.

Courtesy this blog

Комментариев: 1

Local sequence cannot be used in LINQ to SQL

10.06.2008 Вторник 21:10

Gor the following exception with LINQ:

System.NotSupportedException: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator

The LINQ query looked like this:

public static Service[] GetByGuids(Guid[] guids)
{
var q =
from s in Context.Services
join g in guids on s.ID = g
select s;

return q.ToArray();
}
The reason for the error is that guids is an in-memory array. When using with LINQ to SQL such arrays would need to be translated to SQL somehow, which is not supported by current LINQ to SQL implementation. The work around is:

public static Service[] GetByGuids(Guid[] guids) {
Service[] services = null;
foreach (Guid g in guids) {
Service[] s1 =
(from s in Context.Services
where s.ID == g
select s).ToArray();

if (services == null) {
services = s1;
} else {
services = services.Union(s1).ToArray();
}
}

return services;
}
Go figure! :)

UPDATE 6/12/08

It turned out the above logic can be implemented in a much easier way with use of "Contains":

public static Service[] GetByGuids(Guid[] guids) {
var q =
from s in Context.Services
where guids.Contains(s.ID)
select s;

return q.ToArray();
}

Доктор, меня все игнорируют (нет комментариев)

Re-enabling ASP.Net-rendered check box

15.05.2008 Четверг 20:35

If in a ASP.Net-rendered page you have a check box control (rendered by asp:CheckBox), and the corresponding server control has its Enabled property set to false, you won't be able to re-enable the check box in JavaScript just by setting its disabled property to false. This is because when rendering a check box from asp:CheckBox control with Enabled="false", ASP.Net encloses HTML check box (which is in fact a <input type="checkbox"> element) in a SPAN element, which has its disabled property set. Therefore to enable the check box you'll have to enable the SPAN too. This can be done with something like this:

cbRequired.disabled = false;
enableEnclosingSpan(cbRequired);

function enableEnclosingSpan(ctrl)
{
if(ctrl.parentElement.tagName == 'SPAN' && ctrl.parentElement.disabled == true)
ctrl.parentElement.disabled = false;
}

Доктор, меня все игнорируют (нет комментариев)

Receive location shutting down by itself

10.04.2008 Четверг 18:26

Software: BizTalk 2006

Another security-related issue. I created a very simple BizTalk application, but noticed that a receive location in that application was shutting down right after it was enabled. The reason was that no write permission was granted to the BizTalk service account for the receive location's folder.

Доктор, меня все игнорируют (нет комментариев)
<- Предыдущие записи Следующие записи ->