Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Any code that uses multiple threads will potentially benefit from multiple cpus / cores. .Net itself uses multiple threads (main app thread, GC, finalisation) and as such will gain some benefits anyway. Server based apps running under IIS will benefit from multiple cpus as the service itself is already multithreaded. If you create threads yourself then you may benefit from multiple cpus depending on the operation itself. Multithreaded code does however need to be designed as such from the ground up and isn't trivial to write / test / debug...
  2. My bad - I just copied, pasted and tweaked the code without checking it...
  3. Also http://www.xtremedotnettalk.com/showthread.php?t=83092 might be worth a read.
  4. What did the original C# code look like?
  5. Did it give an error when you tried placing it within a table? You definately should be able to use tables in the master to handle positioning of place holders. If you are looking at using DIVs for placement then CSS styles are the prefered way to approach the problem now.
  6. Request.QueryString.AllKeys is probably what you are after.
  7. Try public override void Display() { Person:Display(); Console.WriteLine("Graduation: " + m_Graduation); }
  8. Using technologies like AJAX it is possible to have parts of a page refresh without requiring a post back however there is no easy way of allowing one page to communicate directly with another page.
  9. It looks like (from the link you provided) that the data is just compressed using the ZLIB compression, the library I pointed to also handles this as well. Try using one of the zip related streams (IIRC there is a DeflateStream or similar).
  10. Use a MemoryStreeam opened over the byte array. MemoryStream ms = new MemoryStream(contents);
  11. Yes. The library at the link I gave you should give you everything you need to do it. If you are having a problem then could you post the relevant code / errors as it it makes it much easier for people to help. Also are you sure it is a gzipped file?
  12. It's a restriction on how web services work, all methods need a unique name. With .Net though you can use the MessageName parameter of the WebMethod attribute to work round this restriction - simply give each overload a different messge name. [WebMethod(MessageName="HeloWorld")] public string HelloWorld() { return "Hello World"; } [WebMethod(MessageName="HelloPlace")] public string HelloWorld(string place) { return "Hello " + place; } This will give the methods different names in the WSDL, however if you then create a client to the webservice .Net will just give you an overloaded HelloWorld method.
  13. File Menu -> New Project -> Choose Visual C# on the Left -> Choose Asp.Net Web Application on Right.
  14. Use a parametrised query, then the whole issue of string handling and differing formats goes away.
  15. http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx has a free .Net compression library that can handle gzip compression (amongst other file formats).
  16. The global.asa will be used for asp pages and global.asax for aspx pages.
  17. The problem is that Server.Transfer doesn't preserve the form's data unless you specify you want it to (add an extra boolean parameter). However doing this causes an infinite loop... Bit of a dirty hack but this works for me and should get you onto the right track. Protected Sub ChangeTheme_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlThemes.SelectedIndexChanged If Session("test") Is Nothing Then Session("Test") = True Session.Add("MyTheme", ddlThemes.SelectedItem.Text) Server.Transfer(Request.FilePath, True) Else Session("test") = Nothing End If End Sub
  18. http://www.xtremedotnettalk.com/showthread.php?t=78434
  19. The data table will just store the value, formatting is down to whatever UI is displaying the data. If you are using a DataGrid then this can be hadled via a DataGridColumnStyle
  20. Typically you would use threading to get round the problem of blocking, a single listener would wait for incomming connections and spawn a new thread to handle the communication - search these forums and you should find some examples. Regardless of asynchronus or synchronus connections if you are using TCP then it is a single IP/Port to a single IP/Port - there isn't a way to have multiple connections using the same port (this isn't the same if you are using UDP based broadcasts or multicast packets though). The main reason for synchronus connections is simplicity - you do not have to worry about responding to incomming data etc. Stream.Read returns the number of bytes read into the buffer - for network connections there is no simple way to determine how much data is left as the other end could keep adding more data anyway... Stream.Write sends the data to the underlying connection, closing the stream will flush any unsent data... http://msdn2.microsoft.com/en-US/library/system.io.stream(VS.80).aspx may be worth a read regarding the Stream class. http://www.cisco.com/warp/public/535/4.html and http://www.doc.ic.ac.uk/~ih/doc/pc_conn/tcpip/intro/intro0.html are probably also worth reading as they will answer some of the networking questions.
  21. http://www.eeggs.com/items/1047.html not sure which version though
  22. Have you tried it without the ddlThemes_DataBound event handler - that shouldn't be required to maintain the correct selected item. Also is there a reason why you are doing a Server.Transfer(Request.FilePath) in the ChangeTheme_SelectedIndexChanged - again this shouldn't be required.
  23. Not had chance to test this but have you tried setting the credentials for the WebClient? Dim wc As New System.Net.WebClient wc.Credentials = new NetworkCredential("username","password") wc.DownloadFile("http://www.site.com/file.php", "C:\test.xml")
  24. Personally I wouldn't use inheritance in this case, the way I see it is that the CustomerDataAccess class uses the DataAccess class (specifically it's methods) but it isn't a more specific form of the DataAccess class. If inheritance is used every XXXXDataAccess class will also be exposing the DataAccess class' functionality and that doesn't seem right. Plus I always feel I'm doing something wrong when I'm inheriting from static classes anyway.... I would take the approach that is taking an incorrect view of the system - the DataAccess is exposing functionality to access the DB in a general way; the CustomerDataAccess is exposing specific functionality for the DB in regard to customers. If the CustomerAccessClass exposes (even as internal) generalised methods like ExecuteNonQuery then the programmatic model says it is okay to execute arbitrary code against the DB (possibly not even relating to customers) from the Customer component - this seems very wrong to me. I would imagine the exposed methods like SaveCustomer(DataSet ds) are doing parameter validation etc. which takes into account Customer specific requirements unlike the more general ExecuteNonQuery and related methods which don't (and shouldn't) have any knowledge of the higher classes - this can only increase the potential for errors. Also if your system is using unit tests then a class like CustomerDataAccess can have very specific tests written for each of the methods it exposes, non-specific methods are just a back-door where any 'short cut', 'optimised' or 'nasty hack' bits of code can bypass the documented and correct interface for the component. Just my 2p worth...
  25. Without knowing the database schema (or any other details) it is difficult to say, on the face of it the sql seems valid though. Was this a question driven by idle curiosity or are you having problems with the statement?
×
×
  • Create New...