|
Am I missing something obvious here? When I create a ListBox and populate it like so:code:
edit It looks like that only happens if all the listbox's entries are the same edit2 Oh my god now it's calling that function when I double click on the loving scroll bar on the side cowboy beepboop fucked around with this message at 09:19 on May 6, 2007 |
# ? May 6, 2007 08:59 |
|
|
# ? Jun 10, 2024 09:24 |
|
Elky posted:Am I missing something obvious here? When I create a ListBox and populate it like so: The mouseclick events (onclick, doubleclick, etc..) have nothing to do with the selection of an item in a listbox. You want the "SelectedIndexChanged" or "SelectedValueChanged" events.
|
# ? May 6, 2007 17:31 |
|
Colbo posted:The mouseclick events (onclick, doubleclick, etc..) have nothing to do with the selection of an item in a listbox. You want the "SelectedIndexChanged" or "SelectedValueChanged" events. That won't fire on double-click, just single click. This might be closer to what you're looking for: code:
As for your selection problems, I'm not sure what's going on from your description. Can you post code?
|
# ? May 6, 2007 18:51 |
|
Oh I see. Thanks Colbo and csammis. The issue with the selections is simple. I populated the listbox with a simple for loop with lots of entries that were exactly the same. For some odd reason this causes the listbox to get a bit nutty. egcode:
|
# ? May 7, 2007 00:02 |
|
Edit: Nevermind. I figured this one out. I forgot that the authentication was set for a very short timeout. _____________________________________________________________________________________ I'm still figuring out ASP.NET and forms authentication. I've got an ASP.NET site with forms authentication enabled. I have another application which spits .htm files into the ASP.NET site. I set up the ASP.NET application to run .htm files through the aspnet_isapi.dll and added the following to the web.config file: code:
So I write a simple httpHandler that does not set the expiration. This was also pretty easy and works well. BUT, now every time the static page changes, ASP.NET wants the user to authenticate again. This won't fly at all. It looks like when I re-authenticate, the cookie ASP.NET is using has changed. Does anyone know how I can change this behavior? Dromio fucked around with this message at 17:04 on May 7, 2007 |
# ? May 7, 2007 16:50 |
|
I'm trying to output a big XML document that I'm generating in a readable, formatted way for easier editing, but It's not working right and I can't see why.code:
code:
Edit: it's the meaningfull white space nodes loving it up :\ quote:Edited by whom and in what editor? By me in Visual Studio Munkeymon fucked around with this message at 18:50 on May 10, 2007 |
# ? May 7, 2007 23:57 |
|
Munkeymon posted:I'm trying to output a big XML document that I'm generating in a readable, formatted way for easier editing, but It's not working right and I can't see why. Hol'up. Edited by whom and in what editor?
|
# ? May 10, 2007 18:05 |
|
Munkeymon posted:I'm trying to output a big XML document that I'm generating in a readable, formatted way for easier editing, but It's not working right and I can't see why. I have this compiled as a console app that I call from a context menu: code:
code:
|
# ? May 10, 2007 19:35 |
|
Fiend posted:...code...
|
# ? May 10, 2007 19:42 |
|
genki posted:Uh, you know you aren't handling the case where the user passes in 2 arguments, right?
|
# ? May 10, 2007 19:42 |
|
Could anyone recommend me a good reference book to learn ASP? (.net) I've been coding for years, I've built tons of PHP apps, I don't need an introduction to web programming. Just a reference book. Thanks !
|
# ? May 10, 2007 21:59 |
|
Is there any way to configure the "Application Settings" portion of an IIS virtual directory? For example, I want to programatically create a virtual directory in IIS, create "Application Settings" (like when you click "Create" on the Directory tab of the virtual directory properties), then add ISAPI mappings for .htm and .html files to that virtual directory's application configuration. I can access a bunch of properties using System.DirectoryServices, but I don't see the mappings anywhere in there. Does anyone have any ideas? Edit: Got it: code:
Dromio fucked around with this message at 14:26 on May 11, 2007 |
# ? May 10, 2007 22:37 |
|
Nibelheim posted:Could anyone recommend me a good reference book to learn ASP? (.net) You could pick up a book specifically on the .NET Framework but I found that the two C# books covered a lot of what I needed to know anyway.
|
# ? May 10, 2007 22:56 |
|
Nibelheim posted:Could anyone recommend me a good reference book to learn ASP? (.net) They're not very much alike, and shouldn't be.
|
# ? May 11, 2007 19:16 |
|
Nibelheim posted:Could anyone recommend me a good reference book to learn ASP? (.net) Like the other two said, ASP .NET isn't really going to be anything like PHP. Classic ASP is bascially just PHP but with VBScript and new names for some of the server stuff. ASP .NET is a framework. It does a lot for you and really isn't designed to be used with a bunch of echo statements. You can definitely write ASP .NET pages like PHP pages, but you'd be missing the major advantages of ASP .NET. Also, if your only coding experience is with PHP, there probably will be some amount of transition involved in using a more strongly typed and object oriented language. If you have a bunch of experience programing and once you're somewhat familiar with C# or VB .NET(probably C# in your case), Wrox Professional ASP .NET is probably a really good resource. It's not a reference but it covers a lot of ground.
|
# ? May 12, 2007 15:40 |
|
poopiehead posted:Like the other two said, ASP .NET isn't really going to be anything like PHP. Classic ASP is bascially just PHP but with VBScript and new names for some of the server stuff. I've got experience in many different languages. I've mainly coded in C++, Java and Python. I've been writing scripts in VB for a good 7 months now, and am slowly getting used to the syntax. I've fetched my first job in the field as a junior networks technician for this summer, but I'll have a few side projects to work on. I have to write small web applications (DB fetches, search functions, form/data processing) that I could very easily do in PHP, but the corporation is strictly under MS frameworks. I'm just looking for a good book to make me understand the logic behind .NET and be able to write my small applications under them in ASP. My college's web courses concentrated on PHP/JS with Oracle DB access.
|
# ? May 12, 2007 21:20 |
|
Nibelheim posted:I've got experience in many different languages. I've mainly coded in C++, Java and Python. I've been writing scripts in VB for a good 7 months now, and am slowly getting used to the syntax. I highly recommend this title: http://www.amazon.com/Pro-2005-NET-Platform-Third/dp/1590594193 I bought it new at Barnes and Noble for $60. I started with .NET/C# at my job a few months ago working on coding a new Call Tracker for our help desk. I had no previous experince with the framework, but I had taken a few C++/Java courses in college, and this book was just the perfect level for me.
|
# ? May 12, 2007 22:00 |
|
Ok so I'm writing a program to plot the Mandelbrot Set (wiki). I'm using a seperate thread to generate the image, and then sending that back to the main GUI thread to be displayed. Problem is, the images often take a long time to generate and in order to keep things interesting I wanted to display the image as it's being generated. How would I do this while keeping it threadsafe? I thought to make a delagate that sets a pixel and using BeginInvoke, but that seems like a lot of overhead to me and I don't want to slow the program down. However I don't really know how .NET handles delegates internally so I could be wrong about that. Any ideas or info would be appreciated.
|
# ? May 13, 2007 03:39 |
|
HappyHippo posted:Ok so I'm writing a program to plot the Mandelbrot Set (wiki). I'm using a seperate thread to generate the image, and then sending that back to the main GUI thread to be displayed. Problem is, the images often take a long time to generate and in order to keep things interesting I wanted to display the image as it's being generated. How would I do this while keeping it threadsafe? I thought to make a delagate that sets a pixel and using BeginInvoke, but that seems like a lot of overhead to me and I don't want to slow the program down. However I don't really know how .NET handles delegates internally so I could be wrong about that. Any ideas or info would be appreciated. Probably the most sensible option is to call CreateGraphics (it's safe to call CreateGraphics from other threads) on the control that you are painting the set in from the thread that is calculating it, and update the drawing as you go. Obviously in the paint method for the control you'll still need to handle drawing it, since the thread doing the calculation will only temporarily pain tthe pixels but it won't handle repainting later on. Make sure you don't forget to dispose the returned Graphics object when you finish with it.
|
# ? May 13, 2007 10:31 |
|
Hypnotadpole posted:Probably the most sensible option is to call CreateGraphics (it's safe to call CreateGraphics from other threads) on the control that you are painting the set in from the thread that is calculating it, and update the drawing as you go. Obviously in the paint method for the control you'll still need to handle drawing it, since the thread doing the calculation will only temporarily pain tthe pixels but it won't handle repainting later on. This combined with Graphics.DrawImage did the trick. Thanks.
|
# ? May 13, 2007 19:00 |
|
I'm pulling a file from a SQL database, storing it in a byte array, creating a memory stream from that byte array, and then trying to create a DIME attachment with that stream. Unfortunately I'm getting a "Object reference not set to an instance of an object" exception. fileData = r("data") binaryFile = New MemoryStream(fileData) Dim attachment As New DimeAttachment(mimeType, TypeFormat.MediaType, binaryFile) ResponseSoapContext.Current.Attachments.Add(attachment) Any idea what I'm missing? This is in a Web Service by the way.
|
# ? May 13, 2007 20:32 |
|
Hey guys, I'm a Java guy but have recently been playing around with C# at uni for a group project. It's a pretty nice system and I wouldn't mind staying if it weren't for a few little things. But that's beside the point; I've come to ask a question. I have written a webservice and it works pretty handily on the server side, responding to all the requests I send at it. The problem I having is at the client side, the responses I receive are dumb 'bean' objects mapping to the WSDL file. That's all well and good but I was wondering if there was quick and non hacky way to convert these objects back into their native type. My idea was to write a look up / mapping service for the client that could do this; but then I realised that this would probably be a common issue. I don't want to re-roll a feature which could well be built into C# Thanks for the help.
|
# ? May 14, 2007 12:34 |
|
Stramit posted:I have written a webservice and it works pretty handily on the server side, responding to all the requests I send at it. The problem I having is at the client side, the responses I receive are dumb 'bean' objects mapping to the WSDL file. That's all well and good but I was wondering if there was quick and non hacky way to convert these objects back into their native type. My idea was to write a look up / mapping service for the client that could do this; but then I realised that this would probably be a common issue. I don't want to re-roll a feature which could well be built into C# I was going to type out an example, but I think you could find a better rundown on this page. Basically, .NET makes it incredibly easy to do what you need. http://www.dotnetjohn.com/articles.aspx?articleid=173
|
# ? May 14, 2007 16:03 |
|
I have a problem with namespaces: I'm working on a project (asp.net, c#), with several layers: -The WebUI (= a website) -A businessrules layer (= a class library) -A datalayer (= a class library) All layers are in seperate projects. There's also a third class library that contains the business objects. The datalayer gets stuff from the database, puts it in a business object, and passes them on to the business layer, which passes it to the WebUI. (All projects are different namespaces as well.) Now the problem I'm having is that for a specific business object, the WebUI layer (sometimes) only recognizes them when I fully qualify it with the namespace. Example: code:
code:
Same problem: when I declare an object of that class (without fully qualifying with the namespace), I can't even use its properties. Intellisense recognizes the object and shows the properties, but compiling tells me that "'WeirdClass' does not contain a definition for 'Id_weirdClass'". When I qualify it, it does work. When I right-click the class, and do "go to definition", it shows me a definition generated "from metadata", that includes all the right properties, and is in the correct namespace. Fully qualifying the class, and then asking for the definition again, shows me exactly the same thing. But still the compiler thinks they're different. I'm stumped. (I could just always name fully name them, but that annoys me.) Any ideas ?
|
# ? May 16, 2007 14:40 |
|
uXs, do you happen to have a namespace with the exact same name as the class you're having problems with? If I recall correctly, that caused a problem for me, too. If you had a namespace named 'WeirdClass', the compiler won't be able to tell the difference between the class and the namespace, and fully qualifying the class name would be necessary.
|
# ? May 16, 2007 15:00 |
|
Oh god yes thank you. I should've known it was something stupid like that. There was a webpage with that same name. (And webpages are classes as well in .NET.) It didn't give the same error for the other object that did work correctly, because while there was also a page for that object, the capitalization was slightly different so there was no conflict there. Thanks ! (And now, weekend ! )
|
# ? May 16, 2007 15:26 |
|
I am just getting started with ASP.NET AJAX and I have been going through examples and things, just getting a feel for it. I noticed something which seems wrong to me: If you fire an asynchronous postback, the page updates *all* controls on the page that have changed, not just the ones in the UpdatePanel. This seems to me like it could get my applications into an invalid state. For example: test.aspx: code:
code:
Now, granted, this is a situation I have created to show off the issue but is this something to worry about in real life applications? Is there a best practice for mixing AJAX and non-AJAX postbacks that I should keep in mind?
|
# ? May 17, 2007 14:01 |
|
What is going on here? Why is this string not defined? In the debugger, I step past the following code:code:
code:
Edit: Even worse, if I initialize DocGUID as an empty string before this, then just set it's value here instead of initialize AND set, it STILL claims that DocGUID does not exist in the current context. Final Edit: AHA! I was running under the "Release" configuration, which I guess drops any variables which aren't read later in the code. Since I hadn't written any code to actually read the DocGUID string and use it later, it was pretending it didn't exist at all. Dromio fucked around with this message at 20:44 on May 17, 2007 |
# ? May 17, 2007 20:16 |
|
I have to make an ASP .NET application that allows user registration and login, etc. I've only really done authentication using Windows Authentication so far. So I have a question. Do you people generally use the built in ASP .NET login and account creation controls(and membership service) or do you tend to roll your own? If you do use the .NET membership service, how do you deal with extra user information? Do you add to the users table itself or do you make your own separate table with a foreign key?
|
# ? May 17, 2007 21:00 |
|
poopiehead posted:I have to make an ASP .NET application that allows user registration and login, etc. I've only really done authentication using Windows Authentication so far. So I have a question. I've just started with ASP.NET Membership, but it seems to work great for me. The site itself uses the standard "Create User Wizard" control to add new users, and I wrote a winforms app to do the initial setup and populate the initial admin accounts before the site goes online. You can use Profiles to add more information to the users.
|
# ? May 17, 2007 21:32 |
|
Dromio posted:I've just started with ASP.NET Membership, but it seems to work great for me. The site itself uses the standard "Create User Wizard" control to add new users, and I wrote a winforms app to do the initial setup and populate the initial admin accounts before the site goes online. Thanks! I guess I'll have to jump in and start playing.
|
# ? May 18, 2007 03:58 |
|
I'm still trying to figure out all this ASP.NET stuff. This ought to be a simple one, but it's not working like I expected. I'm using a master page that is housed in the main folder of my application, and that master page has a hyperlink to a page in the same folder. Something like this: code:
Here's the hyperlink in the masterpage: code:
Edit: And again I struggle for hours, post, then immediately figure it out on my own. There was an errant base tag in the header that was screwing with my relative links. Dromio fucked around with this message at 20:59 on May 18, 2007 |
# ? May 18, 2007 20:49 |
|
Can anyone suggest a good book on .NET remoting? Ingo Rammer's Advanced .NET Remoting gets a lot of high praise, but the description says its targeted at .NET 1.1 and work with 2.0. Is it safe to say that not much has changed between 1.1 and 2.0 with regards to remoting or is there another book out there I should look into?
|
# ? May 18, 2007 21:57 |
|
This will indeed be a stupid question, but... I'm learning C# from a book and though the book in question (Essential C# 2.0 by Mark Michaelis) is generally very good, the chapter on interfaces has me confused. Given the way it's explained in this book, I really don't understand the concept of interfaces and why I would want to use one. Could someone give me an example of an area in which an interface would be helpful, so I could get a better idea of how and why I would use one of these in practice? Thank you!
|
# ? May 19, 2007 03:21 |
|
MariusMcG posted:I really don't understand the concept of interfaces and why I would want to use one. Could someone give me an example of an area in which an interface would be helpful, so I could get a better idea of how and why I would use one of these in practice? An interface is a way of implementing strongly-typed contracts on an object independent of the inheritance heirarchy. A good example from the framework itself is IDisposable. An object that implements the IDisposable interface guarantees that there's a Dispose() method you can call to cleanup unmanaged resources held by the object. Without an interface, the only other way of doing that would be to make all disposable objects subclassed from some DisposableObject base class, which given C#'s design of single-inheritance is quite an unworkable solution, or to use reflection to try to find a Dispose() method dynamically at runtime (slow, not strongly-typed so you'd have runtime errors instead of compiler errors). Another good example from the framework itself is IComparable. By implementing it, you can add more rich comparison logic to any class you create, and that object will "just work" with things like Dictionaries, anything that does sorting, etc. Interfaces are also useful in remoting server scenarios, where you want to publish a limited API, and have that API be completely detached from the actual code providing the implementation. Your remoting server offers up the interface instead of a specific class. You can even swap in a completely different implementation class behind the scenes on the server and the clients would have no idea. biznatchio fucked around with this message at 03:39 on May 19, 2007 |
# ? May 19, 2007 03:36 |
|
Hmm... I still must not be getting it because that just sounds like a security nightmare waiting to happen. Thanks very much for the explanation, though. As part of my efforts to learn C# I'm writing some small programs, and once I try using interfaces in them I should have a better understanding of what benefits they can offer.
|
# ? May 19, 2007 16:01 |
|
MariusMcG posted:Hmm... I still must not be getting it because that just sounds like a security nightmare waiting to happen. How does any of that sound like a security nightmare? Dropping a new implementation class behind the interface without the client's knowledge isn't as scary as it sounds; it's not something that can be done as a man-in-the-middle attack if that's what you're thinking.
|
# ? May 19, 2007 16:32 |
|
It probably just sounds that way to me because C# embodies a different sort of programming paradigm than what I usually work with. From here on out I'll just refrain from commenting until I've actually used something in a program.
|
# ? May 19, 2007 17:06 |
|
MariusMcG posted:It probably just sounds that way to me because C# embodies a different sort of programming paradigm than what I usually work with. From here on out I'll just refrain from commenting until I've actually used something in a program. Oh no, comment away, just explain yourself so we can corroborate or deny it
|
# ? May 19, 2007 17:38 |
|
|
# ? Jun 10, 2024 09:24 |
|
MariusMcG posted:Hmm... I still must not be getting it because that just sounds like a security nightmare waiting to happen. If you're referring to the remoting scenario, in situations where security is a concern you'd have the appropriate amount of security at a lower level in the networking infrastructure to prevent any sort of attacks (encryption, certificate exchange, etc.). But on the level that an attack like that would take place, there's no difference between remoting with an object or with an interface; both would be equally vulnerable to man-in-the-middle types of attacks because an attacker wouldn't be constrained by your object's existing base class implementation, they play outside those rules. In an in-process situation, there are numerous security options you have to verify that even untrusted third-party plugins running behind an interface are safe. (Interfaces are quite useful in plugin models, since they describe the API and don't restrict the implementation in any way.) You have code signing, appdomain isolation, and CAS all at your beck and call to control untrusted code. biznatchio fucked around with this message at 18:24 on May 19, 2007 |
# ? May 19, 2007 18:20 |