Jump to content
Xtreme .Net Talk

Derek Stone

*Gurus*
  • Posts

    1910
  • Joined

  • Last visited

Everything posted by Derek Stone

  1. There really isn't any apparent reason to use GetTickCount in the code example you've provided. Instead, render the pictures in a loop. If you want a noticeable delay use Thread.Sleep() after each iteration.
  2. Declare the object as follows: Rectangle rect = Rectangle.Empty; This is a requirement of the C# compiler, since it doesn't allow access to unassigned local variables, even though those variables may be value types that don't need to be explicitly initialized. The proper handling of this compiler requirement is to initialize all variables, which in some cases I find to be rather annoying. Take the following VB.NET code for example: Dim r As Rectangle This will compile just fine, since the VB.NET compiler doesn't fuss about unassigned variables (which isn't always a good thing mind you). Note that both lines of code generate the exact same line of MSIL and the C# error message is produced during compilation (as mentioned above), not at runtime.
  3. Loop through the array of ServiceControl objects returned and poll their ServiceName property.
  4. You need to pass an absolute URI to the WebRequest.Create() method, not just the host's domain or IP. Dim request As HttpWebRequest = WebRequest.Create("http://127.0.0.1:8080/boundxml") Also, you should leave the ContentType property blank and set the UserAgent property.
  5. [msdn]System.ServiceProcess.ServiceController[/msdn].GetServices()
  6. http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp
  7. You'll want to use HttpWebRequest, not HttpWebResponse. Use WebRequest.Create() to initialize an instance of HttpWebRequest.
  8. Do things the correct way and use Sub Main(). Private Sub Main() If bShowSettings Then 'Show the settings dialog modally End If mainForm.Show() End Sub 'Main
  9. If you have a firewall active make sure to temporarily disable it prior to connecting, or take the time to figure out which blocked/ghosted port the IRC server is fussing about.
  10. The ONLY code that should be located in a finalizer is code that frees unmanaged resources. Code located in Dispose() should first free managed resources, then free the same unmanaged resources as the finalizer. After all resources have been freed by Dispose(), GC.SupressFinalizer() should be called. This is the only correct way of implementing IDisposable. If your class does not utilize unmanaged resources, a finalizer should not be used, as it only slows down the garbage collector, since instances of dependent objects need to held that much longer.
  11. Spy++ does not ship with the Standard Edition of Visual Basic .NET. Either buy a higher edition of Visual Studio .NET or purchase Visual Studio 6.
  12. You can't for sure, that's the whole point. Each of the encoding types has its own byte-level signature, and some offer bit order marks, however there's nothing mandating that signature to only be used in text files. This is part of the reason why file extensions exist-- to indicate what type of file is being dealt with. For example: ASCII uses 7 bits to represent one character. UTF-8 uses one to six octets per character, with the initial octet serving as both an indicator of the number of subsequently used octets and a portion of the character value. UTF-8 is also marked with an opening byte sequence of EF BB BF. And while UTF-8 is relatively easy to spot, there's absolutely nothing to distinguish ASCII with other than by checking whether or not there are bytes in the file that don't map to characters. A null value, 00, would be one indication that the file is not ASCII-encoded for example.
  13. <%@ Import Namespace="MyNamespace" %>
  14. Considering Environment.GetTickCount() directly calls the Win32 API GetTickCount I would hope their output is identical.
  15. [msdn]System.Net.Sockets[/msdn]
  16. You should be storing as little as possible in cookies. Roles should be retrieved from the database (if any) with each request, and used to populate IIdentity and IPrincipal objects. Roles should never be placed in cookies, as its an open door for account elevation attacks. Nonetheless... Dim roles(0) As String [b]roles(0)[/b] = ticket.UserData HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(id, [b]roles[/b]) I've highlighted your problem.
  17. Check to see if CPU utilization is jumping up to 100%. If this is the case let me know, as I've experienced the same problem, which I believe is caused by a corrupted solution user options file (*.suo). Recreating the solution has fixed the problem in my situation.
  18. A file is always binary. If the file was ANSI/Unicode/UTF encoded, it's still binary, however it is interpreted as text.
  19. Try to use the HttpContext.Current.User.IsInRole() method opposed to storing the role in the UserData property.
  20. Ideally this would be accomplished outside of ASP.NET using a Windows service or scheduled task. If those are not options however you may want to take a look Michael Teper's article.
  21. Put the script in the head element of your page and call the function from the body element's onload event.
  22. <%@ Page SmartNavigation="True" %> That will only work in Internet Explorer however. For a cross-browser solution, you should use JavaScript.
  23. Forget about it. Framework controls are not an end-all solution.
  24. ASP.NET does not provide any outward support for frames, nor should it. Any solution would be a hack, at best, and it would most definately be limited to loading the DataGrid from the frame's page and not from another document. I strongly suggest you remove any frames from your site if that is an option. Most frame-specific functionality can be achieved using CSS and layers.
  25. I hope so too. If this isn't a one time operation such as updating the database or such, then I'd strongly suggest you look into the topic of normalisation. If you're well aware of that term then I digress.
×
×
  • Create New...