|
The other thread (which is here) was getting really huge so thought we would sort it out by starting a new one. Basically if you have any questions about the .Net framework, we ask it here. And not to chop off people who were waiting for answers in the other thread, here were the last few questions: hopelessStoner posted:A quick question for the .NET goons: Toiletbrush posted:To the WinFX wizards: How much of a performance impact would I get for using ResourceDictionaries (to store strings in) and DynamicResource bindings to implement multilanguage interfaces? Edit: Crap, the icon is off. I am an idiot. Mods, help a brother out? EDIT: Some books for learning: C# 3.0 Unleashed: With the .NET Framework 3.5 ASP.NET 3.5 Unleashed Learning C# 3.0 Fastbreak fucked around with this message at 19:50 on Oct 23, 2009 |
# ? Jan 4, 2007 19:36 |
|
|
# ? Jun 10, 2024 10:27 |
|
hopelessStoner posted:A quick question for the .NET goons: I think that will solve the sizing issue. I would assume the tab expects the contained control to expand to fill the area within the tab, so it resizes your control when it gets added. If your control is already in a panel, only the panel should be affected. I think.
|
# ? Jan 4, 2007 20:10 |
|
I'm playing with WF a bit, trying to get my bearings. I feel like it might be a good fit for my next project, if I can just seem to get a feel for how it all works. So I created an ActivityLibrary project with a few custom activities-- they don't do anything, they're just placeholders. Then I added a sequential workflow project to the solution and referenced my ActivityLibrary. But the custom activities don't show up in the toolbox when I go to the workflow designer. All the activities and the workflow share the same namespace. Am I missing something obvious?
|
# ? Jan 4, 2007 20:22 |
|
Fastbreak, you missed the post icon Also in the case of megathreads, with sufficient pointers to the new thread, closing the old one should be okay...I did it with the last few Programming Questions threads I created anyway vv Reposting my answer to Toiletbrush: Toiletbrush posted:To the WinFX wizards: How much of a performance impact would I get for using ResourceDictionaries (to store strings in) and DynamicResource bindings to implement multilanguage interfaces? It's a higher impact than if you were using StaticResource bindings since WPF has to create what amounts to a DependencyObject wrapper for each resource being referenced dynamically to "listen" for changes. In reality, the only impact is in a minorly higher amount of memory being consumed (basically zero processor impact since it's all done with delegates), and when it comes to WPF who really gives a rats rear end, it's pretty much in the heavyweight division no matter what you do. I use DynamicResource bindings for just about everything in shaim to provide online skinability, and the performance impact isn't noticable to the user at this point. I used WpfPerf to analyze the memory usage, and I couldn't differentiate between StaticResource and DynamicResource. The question you'll want to ask yourself is "do you want to provide support for changing languages on the fly?" If yes, use DynamicResource and don't worry about the impact. If no, use DynamicResource anyway because you may want to do it someday edit: this does of course depend on the number of strings you're talking about, but I'd still use DynamicResource first. If the performance is unacceptable, profile it and see what's going on. You may end up going with LocBaml, which I have no idea what that is but I've heard it referenced on the Avalon forum.
|
# ? Jan 4, 2007 20:25 |
|
Mods: please fix the post icon. In Part I, we discussed how the ASP.NET engine munges control IDs with runat="server" when they are nested inside another control, whether it be a datagrid, a content section of a master page, or a control in a user control. This causes problems for javascript and CSS that target tags based on IDs. To some extent, this can be solved by doing code:
code:
|
# ? Jan 4, 2007 20:27 |
|
genki posted:You know what would probably work, as a quick workaround. Try adding your control to a blank panel, then add the panel to the tab. Also, the control expands to a size that's bigger than the form it's parent's parent is on.
|
# ? Jan 4, 2007 20:35 |
|
Victor posted:Mods: please fix the post icon. I tend to just use a unique class name. It's ugly, but it works.
|
# ? Jan 4, 2007 20:39 |
|
Victor posted:Mods: please fix the post icon. I don't do much javascripting, but the someInitFunction technique is solid. Remember, you are pulling the client ID from the same place .NET is, so using the ClientID property is safe. CSS stuff is a bit trickier. I usually wrap things in non-server ID'd containers and work off inheritance. Using classes is also a valid option.
|
# ? Jan 4, 2007 20:43 |
|
The unique class name thing was mentioned before; it definitely is an option. This whole thing just strikes me as not being elegant, but then again, it sort of is required to guarantee ID uniqueness. I just want my code and HTML to be elegant, damnit.
|
# ? Jan 4, 2007 20:49 |
|
Sorry this is going to be long: I'm getting a weird error in an ASP .NET 2.0 page.... This only happens in IE7. Fine in firefox and IE6. error posted:Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. I have a repeater control with a bunch of child controls in the item template: code:
code:
I was able to avoid the problem by getting rid of the useless postback that shouldn't have been there in the first place and just making it a link. code:
|
# ? Jan 4, 2007 21:02 |
|
csammis posted:FThe question you'll want to ask yourself is "do you want to provide support for changing languages on the fly?" If yes, use DynamicResource and don't worry about the impact. If no, use DynamicResource anyway because you may want to do it someday As far as on-the-fly language switching, on one hand, this seems a defacto standard with a lot of freeware applications, on the other hand, you switch it only once. I have to ask the magic eight ball... quote:edit: this does of course depend on the number of strings you're talking about, but I'd still use DynamicResource first. If the performance is unacceptable, profile it and see what's going on. You may end up going with LocBaml, which I have no idea what that is but I've heard it referenced on the Avalon forum.
|
# ? Jan 4, 2007 21:07 |
|
Toiletbrush posted:Live theme switching, man Mine says "I SAY YES," then I asked it if it was sure and it said "NO" quote:Since hashtables are used to store the RD entries, it shouldn't be affected much with the amount of entries. I wasn't talking about the amount of data in the RD, I meant the number of strings that are inserted into the application via DynamicResources. It's the DR count you'd want to be concerned with if it even turned out to be a problem, which as I said I doubt.
|
# ? Jan 4, 2007 21:11 |
|
OK, I have 2 (hopefully) simple questions. 1. I've had to write a custom control for a form. (C#) I wrote it with System.Drawing objects. Basically, it's a graph. I can't seem to make it draw when the form loads. I've made the draw function it's own function overloaded to be an event handler or take no arguments. I've had the function call from the contructor and I've gone so far as to make the function public so that the underlying form which calls this form can call the drawing function. The only way I can make it draw is to bind it to a bunch of other events like Move, then move the window and it works fine. Any ideas? 2. How do I run an application from a remote share? I keep getting security exceptions.
|
# ? Jan 4, 2007 23:06 |
|
Anybody know what those [SquareBracket] directives or whatever you can use in c# are called, and if its possible to write custom ones? Like [STAThread] or [WebMethod]?
|
# ? Jan 4, 2007 23:13 |
|
superb0wr posted:Anybody know what those [SquareBracket] directives or whatever you can use in c# are called, and if its possible to write custom ones? Like [STAThread] or [WebMethod]? They're called Attributes and they're accessible through Reflection. I've never used them before, but this looks like a good explanation:
|
# ? Jan 4, 2007 23:16 |
|
superb0wr posted:Anybody know what those [SquareBracket] directives or whatever you can use in c# are called, and if its possible to write custom ones? Like [STAThread] or [WebMethod]? I had to use them to import a non .NET Dll file. They show up in ASP.NET a lot too.
|
# ? Jan 4, 2007 23:17 |
|
poopiehead posted:They're called Attributes and they're accessible through Reflection. Badass, thanks a lot
|
# ? Jan 4, 2007 23:20 |
|
I'm trying to quickly read through many TIF files and determine if each pixel is either white or something else. After some searching, I've found information on using LockBits but I don't know how to implement it. I think I'm on the right track:code:
|
# ? Jan 5, 2007 06:46 |
|
DLCinferno posted:I'm trying to quickly read through many TIF files and determine if each pixel is either white or something else. After some searching, I've found information on using LockBits but I don't know how to implement it. I think I'm on the right track: code:
|
# ? Jan 5, 2007 07:21 |
|
When I check a NetworkStream's DataAvailable property, I get false, yet I can do a Read() and get bytes (in this case, the expected messages from a POP3 server). What's up with that?
|
# ? Jan 5, 2007 14:16 |
|
I've been writing a small DB-driven app to get learning .NET in general. The language I've been using is C# and I've been hearded into using this ADO.NET thing. The C# and the .NET in general I like, but its ADO.NET that I am skeptical about. How practical is this disconnected data source? Is it really a good idea to download at first go everything that your application may need from the database? Is this something that could differ from app to app? It seems like my program would be better off just running queries when it needs something, but that could just be me trying to resist a different way. Is there some good guidelines on when and what to throw in your DataSet's? Help!!
|
# ? Jan 5, 2007 15:51 |
|
Okay heres a question that there's pretty much a zero chance of getting answered, since it seems even microsoft itself is lovely about documenting it. I'm writing a program to access an Exchange public folder. Since the domain admins have the exchange server locked up pretty tight, I'm opting to make use of the internal webmail server running OWA. What's awesome about this is that is has full WebDAV support, meaning I can get lots of XML formatted information about the document. Whats bad about this is that it has full WebDAV support with very very minimal documentation from microsoft. How WebDAV works is essentially you do an operation other than POST or GET over HTTP, like PROPFIND and SEARCH, and as the body of the request you pass an XML formatted document. In return you get an XML formatted document with the requested data. So in .NET I need no API's other than HttpWebRequest and HttpWebResponse. The problem I'm running into now is that I'm doing a SEARCH operation on three web folders, neccesitating three different WebRequests to be made. Except Every Other WebRequest fails with a "The remote server returned an error: (400) Bad Request." exception. So basically my outpot is this: code:
code:
It's really obscure, but does anybody have any ideas?
|
# ? Jan 5, 2007 15:53 |
|
Mustach posted:When I check a NetworkStream's DataAvailable property, I get false, yet I can do a Read() and get bytes (in this case, the expected messages from a POP3 server). What's up with that? The DataAvailable property looks at the base socket's Available property, which uses native ioctl methods to determine how many bytes of data are available for reading. I don't know why it isn't working, but ioctl mixed with .NET may just be a receipe for problems. Just use BeginRead() on the socket, that way you won't be bothered until/unless there's data. If the socket disconnects, you'll get an exception in the callback method from EndRead().
|
# ? Jan 5, 2007 16:06 |
|
Heffer, one idea would be to install the trial version of WebDAV for Exchange 1.1 and then look at the messages it's sending and receiving. My shop actually bought it because I didn't want to figure out WebDAV, but perhaps you could use it for some reverse engineering?
|
# ? Jan 5, 2007 16:12 |
|
csammis posted:The DataAvailable property looks at the base socket's Available property, which uses native ioctl methods to determine how many bytes of data are available for reading. I don't know why it isn't working, but ioctl mixed with .NET may just be a receipe for problems. Just use BeginRead() on the socket, that way you won't be bothered until/unless there's data. If the socket disconnects, you'll get an exception in the callback method from EndRead().
|
# ? Jan 5, 2007 16:22 |
|
Victor posted:Heffer, one idea would be to install the trial version of WebDAV for Exchange 1.1 and then look at the messages it's sending and receiving. My shop actually bought it because I didn't want to figure out WebDAV, but perhaps you could use it for some reverse engineering? Of course moments after I give up and post for help on the Internet, I figure it out. I had: RequestStream.Close(); Request.ContentType = "text/xml"; which I guess was bad because I was sending out header information after the body of the request had been sent. Moving the Content Type setting to above the writing of the body gave me the behavior I wanted, although I still don't know why it would fault a completely different request made in a completely different function. Figuring WebDAV out only took me about a day, but probably because I have a lot of familiarity with low level HTTP operations already. What really confuses me is communication with Exchange, because they use really weird data schema's and SQL variants. For instance if you do: "SELECT * FROM "server/public/foldername" it doesn't actually give you all the information. It only gives you all properties for the DAV XML namespace. To get something like the body, you have to specifically specify it like "SELECT "urn:schemas:httpmail:textdescription" FROM "server/public/foldername". That took me about 4 hours to figure out. Also, if you want to get mails from within a specific range you would like to do " WHERE "DAV:creationdate" > '" + dtYesterday + "'" . Except a) you have to cast the date inside the sql statement to 'dateTime' (make sure to capitalize the T or else it doesnt work) and b) you have to be casting it from UTC formatted Zulu time, so be sure to shift for timezone, and c) less-thans and greater-thans mess up the HTML request, so you have to use < and > ALSO, there is no specific count function, so you use a property called DAV:visiblecount instead. However, that only works when you use GROUP BY statements, even if you really only want one single number. All this gives you a SQL statement that looks like this: code:
|
# ? Jan 5, 2007 16:31 |
|
Still hoping someone has experience with WF and can help with my previous issue, but now I've got something else! I'me using System.Runtime.Serialization to save a class to a file, then load it up later. But it appears that using this serialization does not call the class constructor! This leaves some crucial properties as null. For example: code:
|
# ? Jan 5, 2007 17:57 |
|
Dromio posted:Still hoping someone has experience with WF and can help with my previous issue, but now I've got something else! code:
|
# ? Jan 5, 2007 19:45 |
|
genki posted:There's probably a more standard way to check if the temp location has been set. I'm not sure what it would be. null? EmptyString()? String.IsNullOrEmpty()
|
# ? Jan 5, 2007 20:09 |
|
Victor posted:Mods: please fix the post icon. code:
Victor posted:Is this the accepted way to do things? Unless it's safe to depend on a mangled ID, it would appear that styling elements with runat="server" based on ID in a separate CSS file isn't possible; is this true? It would be possible if you create an aspx page that has a response.contenttype of "text/css" and the output is in CSS format, AND if that aspx page can reference the control. But it was said earlier that you're probably better off using classes.
|
# ? Jan 5, 2007 20:20 |
|
Fiend posted:It would be possible if you create an aspx page that has a response.contenttype of "text/css" and the output is in CSS format, AND if that aspx page can reference the control. But it was said earlier that you're probably better off using classes. I was under the impression that ASPX pages cannot reference each due to the 2.0 website compilation model, but perhaps web application projects allow one to revert to 1.x abilities in that respect. One thing I don't like about your approach is that the styled controls need to be made internal, but I guess that's unavoidable without C++ -style friends.
|
# ? Jan 5, 2007 20:30 |
|
Victor posted:First, thanks for noticing the lack of a '#'; I do know enough about CSS to know why it's required. ;P code:
|
# ? Jan 5, 2007 20:56 |
|
csammis posted:String.IsNullOrEmpty()
|
# ? Jan 5, 2007 21:47 |
|
genki posted:Lazy instantiation? I ended up doing this, but it makes me sad. I'm amazed that the deserialier can create the objects without using constructors. I guess it makes sense, since it's the only one I've seen that doesn't require that there be a parameterless constructor on the class.
|
# ? Jan 5, 2007 22:02 |
|
csammis posted:String.IsNullOrEmpty() Isn't there some kind of bug associated with that function? It seems so convenient but I've been nervous to use it since I heard it doesn't always work.
|
# ? Jan 5, 2007 22:27 |
|
poopiehead posted:Isn't there some kind of bug associated with that function? It seems so convenient but I've been nervous to use it since I heard it doesn't always work.
|
# ? Jan 5, 2007 22:42 |
|
Victor posted:The bug has to do with JITing code in loops; it isn't a problem with String.IsNullOrEmpty itself. If you don't use the method in loops, you're golden, otherwise you might want to look up the bug details. Thanks. good to know. I'll have to look up the details.
|
# ? Jan 5, 2007 22:46 |
|
I got unlazy and found the JIT bug involving String.IsNullOrEmpty.
|
# ? Jan 5, 2007 23:40 |
|
In college, I took a few courses that focused on ASP (about 4 years ago). I am not a programmer by trade, nor is coding really part of my job, but I have extra time at work now, so I figure I'll learn a new skill. I have MS SharePoint 07 at work, and am most familiar with VB. So, what's a good book for teaching yourself ASP.NET? Thanks!
|
# ? Jan 6, 2007 02:01 |
|
|
# ? Jun 10, 2024 10:27 |
|
Wizzle posted:OK, I have 2 (hopefully) simple questions. The Control class, which your graph control should inherit from (actually from UserControl probably). When the base class gets important events from above, they call a number of OnWhatever() functions, which belong to the base class. The OnWhatever functions are intended to be overridden by your child class. So just make a OnPaint() function, and do your drawing code in that. OnPaint will then get called whenever the base class thinks its time to redraw.
|
# ? Jan 6, 2007 05:32 |