|
Others have pointed possible solutions out to you, but I would suggest that you need to step back and think about what equality actually is. It's not such a simple subject, and it's not something you should rush into. In the case of a string, equality could simply be that the text is the same (taking culture into account). In more complex cases, you need to consider whether equality is based on all values of a class being the same, or only some values.
Building a generic equality tester is a big deal. The closest you might get, for instance, could be to have a method that iterates over the items and uses Compare to compare them. This, then depends on the original items being in an IComparable class. I leave it to you to figure out whether or not it's worth the effort to build something generic, or to allow a degree of specialisation to occur in there.
|
|
|
|
|
Umm, is possible to track the mouse pointer if you move off the form, I have written an app that I needed to track the mouse pointer on the form. Now I am trying to track the mouse pointer out of the Form on the Windows back ground. I think I am having issues attaching the event handler
<
MouseHookProcedure = new HookProc(Form1.MouseHookProc);
hHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, (IntPtr)0, 0);
>
dont appear to be setting hHook.....
HELP
|
|
|
|
|
Cursor.Position will retrieve current position of the cursor on the screen
good luck
|
|
|
|
|
The simple answer, why oh why did I not think of that. Stick
label1.Text = Cursor.Position.ToString(); in a timer and off you go!
|
|
|
|
|
|
Thanks, I will have a look at that Glenn
|
|
|
|
|
read up on Mouse.Capture
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi,
I want to access port80, I am creating a software which blocks unwanted websites those who are browse from any browser in a system, so I am writing a service in that I am writing a code to access port80 and to get the url to check in my db and allow or diney url. I tried using HttpListener class in c#...but not working...can you help me to get this.
krishna
|
|
|
|
|
You need to get your software between the web browser and the network card. I do not know if you can get a hook in between and filter there. But you can write a proxy server which the browser would then use. Or write a good "proxy.pac" script (e.g. "no-ads.pac": http://www.schooner.com/~loverso/no-ads/[^]).
|
|
|
|
|
you could add unwanted IP adresses to your hosts file...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
That won't be useful when some sites serve both content and ads. The proxy.pac by Loverso (see link in my post above) circumvents that problem.
|
|
|
|
|
Hello Experts,
I have generate the problem when i am using port no 465 to send mail with the use of Gmail.Code below after some pause raise exception "waiting times operations has expired". Why?
public static void Send(string from, string pwd, string to, string subject,string body)
{
MailMessage message = new MailMessage(from, to);
message.Subject = subject;
message.Body = body;
int port = 465;
SmtpClient client = new SmtpClient("smtp.gmail.com", port);
client.Credentials = new NetworkCredential(from, pwd);
client.EnableSsl = true;
client.Send(message);
}
Thanks
If you can think then I Can.
|
|
|
|
|
You can't use port 465. If you read the documentation on the SmtpClient class, you'll know why.
The alternate port you can use is 587. This port supports the TLS/STARTTLS command method that the SmtpClient class supports over SSL.
|
|
|
|
|
Dear Sir,
Can u please help me for Sending mail with the help of Gmail from System.Net.Mail and Por is 465.
Thanks
If you can think then I Can.
|
|
|
|
|
I already told you what your solution is. You can NOT use port 465 because the SmtpClient class does not support it.
|
|
|
|
|
Yes But System.Web.Mail is Supporting it. And It works Successfully on System.web.Mail.
But My Problem is that System.Web is Obsolute Version and System.Net is new.
so how it not works?
If you can think then I Can.
|
|
|
|
|
Read this[^]. It doen't work because Microsoft said it doesn't work and, if you read the documentation on the EnableSsl property, they say why it doesn't work and what the alternative is.
|
|
|
|
|
DataGridViewTextBoxEditingControl.autocomplete conflict with wrap mode
i can`t use advantages of autocomplete when wrap mode of cellstyle set to true
what should i do to have both at the same time?
any suggestion ?
any link?
any article?
any keyword to search about?
modified on Tuesday, February 15, 2011 7:06 AM
|
|
|
|
|
private Image gifImage;
private FrameDimension dimension;
private int frameCount;
private int currentFrame = -1;
private bool reverse;
private int step = 1;
public GifImage(string path)
{
gifImage = Image.FromFile(path);
dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
frameCount = gifImage.GetFrameCount(dimension);
}
public bool ReverseAtEnd
{
get { return reverse; }
set { reverse = value; }
}
public Image GetNextFrame()
{
currentFrame += step;
if (currentFrame >= frameCount || currentFrame < 1)
{
if (reverse)
{
step *= -1;
currentFrame += step;
}
else
currentFrame = 0;
}
return GetFrame(currentFrame);
}
public Image GetFrame(int index)
{
gifImage.SelectActiveFrame(dimension, index);
return (Image)gifImage.Clone();
}
i saw this coding on the web, i am still confuse on how to use it, can anyone help me with the explaination and example on how i can use it, i am trying to get a certain gif to play and play only once without loop inside a picturebox
using expression blend 4 and VS2010 c#
|
|
|
|
|
i have a requirement that i click on button and download xsl file to client machine and after calling this function i want to redirect user to next page. but after download dialog appears an issue is thrown and control does not return so that i can redirect the page. is there any way of doing that.
|
|
|
|
|
Hi,
I am using LINQ to SQL in my Data Access Layer. I learned that I should not expose IQueryable, rather I should convert the result of IQueryable object to IEnumerable by calling ToList() method. Would you please tell me If IQueryable is better for memory / performance or what are the factors should be related to this decision ?
|
|
|
|
|
What interfaces a class implements have no effect on how the class stores and accesses its data.
Nadia Monalisa wrote: by calling ToList()
That wouldn't make sense if the data doesn't look like a list.
I tend not to make design decisions based simply on "what others say".
|
|
|
|
|
Hi,
Thanks a lot for your reply.
Actually, I am re-factoring my Web Application for better maintainability and memory performance. I host my web application in a shared hosting where I am allowed to use a very limited amount of RAM.
In my Web Application, I used LINQ to SQL where my Code Behind files are directly calling the DataContext class generated by LINQ to SQL Classes. I want to encapsulate the call of DataContext in a Business Logic Layer. I am very much tempted to return IEnumerable Objects from my Business Logic Layer to the Presentation Layer instead of IQueryable objects as I know, IQueryable object means, differed SQL query execution. Moreover, when using IQueryable object, I cannot use most of the LINQ features that are available for LINQ to Object. Because, LINQ to SQL does not have similar translation for many C# methods.
Now, My question, Is it more memory efficient to work with IQueryable object instead of IEnumerable object ? So far I can guess, using IQueryable means, my RAM will be free from loading the whole database table. But If I convert the IQueryable to IEnumerable by calling ToList() or ToArray(), then, the whole object will be loaded into the RAM and reduce performance. Is my guess right ? Would you please give me a better direction for this scenario ?
|
|
|
|
|
Nadia Monalisa wrote: Is it more memory efficient to work with IQueryable object instead of IEnumerable object ?
That depends on how the class is written, not on the interfaces, a class can even implement both interfaces. Or you can define your own interface that expresses exctly what you want.
|
|
|
|
|
It is important to understand the difference between the two: IQueryable pushes the query logic into RDBMS, while IEnumerable does things in the main memory. Although IQueryable cannot perform certain things that IEnumerable can because of the need to translate query logic to SQL, you should try really hard to push as much logic as you can onto the IQueryable side. The reason for it is the data transfer and memory costs: once you call ToList/ToArray, the data described by the query to the left of it gets copied into main memory.
Your own interfaces should rarely expose IQueryable for two major reasons - one is the deferred execution, and the other is query translation. If your class returns IQueryable, the RDBMS will be called at the time the caller decides to go through the results for the first time, which may happen significantly later than your code returns. If callers tend to not enumerate the results at all in a significant number of cases, calling AsEnumerable instead of ToLost/ToArray may save you some unnecessary roundtrips to RDBMS; if callers go through your query results immediately, you are better off calling ToList/ToArray yourself. The other reason to not expose IQueryable in your data layer is to avoid errors when your callers apply LINQ methods to your results: these LINQ queries will be translated to RDBMS, potentially resulting in run-time errors.
As a side note, if this is a new project, using Entity Framework instead of LINQ to SQL is highly advisable: at this point, LINQ to SQL technology receives only bug fixes from Microsoft; the new development is concentrated in EF. The good news is that much of what you learned about querying in LINQ to SQL applies in EF as well.
|
|
|
|