Навигация

Итоги года

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


Реклама

Счётчики


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

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.

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

EDI error after installing BizTalk 2006

10.04.2008 Четверг 18:22

Software: BizTalk 2006

Soon after doing a fresh insallation of BizTalk 2006 I noticed the following error that kept appearing in the system event log:


Error encountered: ERROR (120) :
An error occurred in the File System connector. Check the details.Cant make a connection to \\SRV01\EDIDocsHome\Documents\PickupEDI. Errormessage: The operation cannot be performed because a network component is not started or because a specified name cannot be used.Foldername: \\SRV01\EDIDocsHome\Documents\PickupEDI, Errormessage: The operation cannot be performed because a network component is not started or because a specified name cannot be used.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.



To get rid of this error, open Properties for the specified folder (by default \\SRV01\EDIDocsHome points to C:\Documents and Settings\All Users\Application Data\Microsoft\Biztalk Server 2006\EDI\SubSystem), switch to Security tab and give EDI Subsystem Users group full access to the folder.

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

Hash tools

11.01.2008 Пятница 03:31

Hash calculator: http://johnmaguire.us/tools/hashcalc/

Search millions of hashes (MD5, SHA1): http://md5.rednoize.com/

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

Getting rid of the "An unexpected error has occurred" message

01.11.2007 Четверг 18:07

While trying to deploy a SharePoint web site to a server I've seen the following error a lot of times:


An unexpected error has occurred.

Troubleshoot issues with Windows SharePoint Services

With no error diagnostics given whatsoever, it makes hard to find what's causing the bugs and fix them. However I've been able to find out how to make SharePoint to become a little more wordy.

For your site find all available web.config files and make sure the following options are set in all of them:

<configuration>
<SharePoint>
<SafeMode MaxControls="200" CallStack="true" AllowPageLevelTrace="true">

...

<system.web>
<customErrors mode="Off" />

<compilation batch="false" debug="true">

Once you do that, you'll start getting the complete ASP.Net diagnostics page instead of the generic error.

Also, when configuring WCF client, make sure to specify includeExceptionDetailInFaults option in the client's configuration file. For example:

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="BlahBlah.Services.ServiceImplementation.Community_Behavior">
<serviceDebug includeExceptionDetailInFaults="true"/>

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

Commenting HTML code with .Net server controls

27.09.2007 Четверг 21:51

Software: .Net Framework

Here's how to comment out sections of HTML code containing .Net server controls:

<%-− blah-blah −-%>

Regular comments (<!-− blah-blah −->) don't work (or work incorrectly) for sections containing server controls.

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

Changing Remote Desktop listening port

30.08.2007 Четверг 17:10

Remote Desktop (former Terminal Services) listening port is defined in registry:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber

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

Redirect using IIS, with query string

30.08.2007 Четверг 01:31

Suppose you want to redirect "http://raxxla.com" to "http://www.raxxla.com". In IIS create a new web site for the URL you want to be redirected ("http://raxxla.com"). On the Home Directory tab of the site's properties page, select A redirection to a URL radio button and specify destination URL ("http://www.raxxla.com"). At this point redirection will occur but query string will be lost (i.e. e.g. "http://raxxla.com/Journal.aspx?blogid=2" will be redirected to "http://www.raxxla.com". In order to enable redirection that keeps query string specify the following as destination URL:

<your URL>$V$Q

In our case,

http://www.raxxla.com$V$Q

Query string will be preserved while redirection.

Courtesy this.

More info on all suported parameters that can be used in redirection URL.

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

SharePoint: How to enable/disable content based on security context

30.08.2007 Четверг 01:09

<Sharepoint:SPSecurityTrimmedControl AuthenticationRestrictions="AuthenticatedUsersOnly" runat="server">

… Everything here will be displayed to authenticated users only. Other users won't see anything.…

</Sharepoint:SPSecurityTrimmedControl>


There are other handy uses of SPSecurityTrimmedControl. Refer to Microsoft documentation.

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