|
It looks like I had this question post twice. I put a response on the other one. That would be great if we could switch the primary discussion to the other posting. Thanks!
|
|
|
|
|
Maybe the problem is with how I create the backgroundWorker. From my form class, I am doing the following (I create two of these..one for each form tab):
if (!backgroundWorker1.IsBusy)
{
try
{
backgroundWorker1.RunWorkerAsync();
}
}
Is there a way I can still have the user able to hit a button on the form, yet have the backgroundWorkers hog more of the processor so they can have priority over the form and other things on the computer?
|
|
|
|
|
Not with a background worker - the whole point is that it's meant to work in the background. If it has a higher priority, then this would slow down your application and will lead to a poor user experience.
|
|
|
|
|
I created a class so I can add extensions to the GroupPrincipal object but I am getting this error:
System.InvalidOperationException: Principal objects of type CloudPanel.AD.Custom.GroupPrincipalExt can not be used in a query against this store. at System.DirectoryServices.AccountManagement.ADStoreCtx.GetObjectClassPortion(Type principalType) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRefHelper(Type principalType, String urnScheme, String urnValue, DateTime referenceDate, Boolean useSidHistory) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRef(Type principalType, String urnScheme, String urnValue, DateTime referenceDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue) at CloudPanel.AD.Custom.GroupPrincipalExt.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue) at CloudPanel.Exchange.ExchPs.Get_DistributionGroup(String distinguishedname)
I don't really know why this isn't working since I have used this class before.
Here is a piece of the class I created (I didn't include all the DirectoryProperties since there are a bunch that I've added):
public class GroupPrincipalExt : GroupPrincipal
{
public GroupPrincipalExt(PrincipalContext context) : base(context) { }
public GroupPrincipalExt(PrincipalContext context, string groupName) : base(context, groupName) { }
public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, string identityValue)
{
return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityValue);
}
public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue)
{
return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityType, identityValue);
}
[DirectoryProperty("wWWHomePage")]
public string WWWHomePage
{
get
{
if (ExtensionGet("wWWHomePage").Length != 1)
return null;
return (string)ExtensionGet("wWWHomePage")[0];
}
set
{
this.ExtensionSet("wWWHomePage", value);
}
}
}
Here is how I am calling it:
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "dc.******.local", "DC=*****,DC=local", ContextOptions.SimpleBind, "******\\Administrator", "*********"))
{
GroupPrincipalExt group = GroupPrincipalExt.FindByIdentity(pc, IdentityType.DistinguishedName, distinguishedname);
if (group != null)
{
}
}
Any idea why this would be happening?
|
|
|
|
|
Have you tried adding the DirectoryObjectClassAttribute[^] to your GroupPrincipalExt class?
[DirectoryObjectClass("group")]
public class GroupPrincipalExt : GroupPrincipal
{
...
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ahhh!! You are awesome. I copied and pasted the class and didn't copy it!
That fixed it. Thank you so much
|
|
|
|
|
Does anyone know a mathematical formula (which can be translated to C #) to check if a polygon is inside another polygon?
|
|
|
|
|
Regular polygons (where all the angles or equal) or irregular?
Needless to say, irregular ones are the PITA...especially where they are the containing polygon.
Just to confirm how much of a PITA irregular polygons are, here's a discussion that may may like to read (though you'll probably wish you hadn't)
The Polygon Containment Problem[^]
modified 28-Jan-13 14:17pm.
|
|
|
|
|
There are irregular polygons.
|
|
|
|
|
If polygon A is inside polygon B, then:
1. Every vertex of A will be inside B, and
2. No edge of A will intersect an edge of B.
So you need two subroutines: One to detect if a point is in a polygon, and one to detect if two line segments intersect each other.
Test all points of A to see if they're in B. If one isn't, then B doesn't contain A. Then test all edges of A to see if any intersect an edge of B. If none do, then polygon A is inside polygon B.
|
|
|
|
|
Yes you are right, but this is a very costly routine, and it might be performed more than 1000 times during the opening of a shapefile.
|
|
|
|
|
So you need efficiency too. Ok, calculate the bounding rectangles of both polygons. If the bounding rectangles don't overlap, neither polygon contains the other, so you can skip the more expensive test.
If they do overlap, check if each polygon contains points of the other in the overlap region. If polygon B contains some points of polygon A, but not others, then B doesn't contain A.
|
|
|
|
|
Hello ,
I am posting on the server side application using a "Response.Write(str)" statement, where "str" contains some XML code .
On the client side I am getting the response using a HttpWebResponse .
When I get the HttpWebResponse content , I find , apart from the correct XML code that I posted on server side, soem kind of strange trailer which resembles an Html page, but is absolutely random (I mean , this "html page" changes from session to session...) .
What is the reason of this strange result ? I am posting some relevant code below to help explain :
Server side :
Resp = ....some XML code ....
Response.Write(Resp);
Client side :
HttpWebRequest WR = (HttpWebRequest)(WebRequest.Create(url));
HttpWebResponse Resp = (HttpWebResponse)WR.GetResponse();
Stream RS = Resp.GetResponseStream();
StreamReader SR = new StreamReader(RS);
string mess = SR.ReadToEnd();
Resp.Close();
textBoxResponse.Text = mess;
Thank you in advance
Leo
|
|
|
|
|
I'm guessing that you're calling Response.Write from the code-behind of an ASP.NET page? In which case, the content of the page will still be output to the response after the text you've passed to the Response.Write method. You'll need to call Response.End after your last call to Response.Write to prevent this.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I followed your instructions and now it works correctly.... I think I need to study better the way a web application works ....
Thank you very much.
Leo
|
|
|
|
|
Hi,
I have a question: I am want to add text (many strings) into file by using the method TextWriter.Write(), will this method append text into a file or overwrite the content of file ?
Are there any other ways to append text into file ?
Thanks and regards,
|
|
|
|
|
A writer will write its content at the current file location, and move the current location to the end of the written content. In typical usage this means that it will append each time you call it.
|
|
|
|
|
Using a StreamWriter [^] is generally a better choice. When you open the underlying FileStream you can specify whether to append or not by the mode option[^].
|
|
|
|
|
The TextWriter don't care. The state of the underlying Stream is what matters -- it can be opened to append or overwrite.
|
|
|
|
|
Thanks all of you.
I used StreamWriter for this.
Kind regards,
|
|
|
|
|
Hi All,
I have created an asp.net c# website that is being used like a helpdesk, tickets are being logged and resolved etc.
I now want to add a pop up that should appear on the user that logged the tickets' pc when the IT personnel updates the ticket.
I am not sure how or if you can use notifyicon to do this?
|
|
|
|
|
You would need to install an application on their machine which talked to the ticket server. There's no way to do that simply through a web interface.
|
|
|
|
|
Thank you for the response!
How would the application know which tickets belong to which user? - I have a username linked to the ticket and a ticket number.
Sorry if I sound stupid!
I don't know much about c# applications, I have only worked with websites.
|
|
|
|
|
If the user name was linked to their Windows Identity, then you can use that. If, however, your site uses a custom login mechanism or something like OAuth, then the user is going to have to associate their identity with the notification application - this would typically require you to provide a settings page where they entered their user name and password details so that you could verify that they were a valid user.
To be honest, this opens a whole can of worms, including things such as verifying that web service requests haven't been intercepted and so on. A simpler method would just be to email them.
|
|
|
|
|
Thank you so much!
I would just use email, but my company wants the pop up. They want to move away from emails.
I think I found my solution!
|
|
|
|