|
csammis posted:Which is why I qualified my example by saying it was the Community edition
|
# ? Apr 12, 2008 04:02 |
|
|
# ? Jun 10, 2024 09:28 |
|
What's the difference betweencode:
code:
|
# ? Apr 13, 2008 02:43 |
|
These are lambda expressions. Oreilly says:quote:Lambda expressions are designed to provide not only inline delegate definitions, but also a framework for Language-Integrated Query(LINQ).
|
# ? Apr 13, 2008 03:03 |
|
Also, there is no difference between the two. The compiler should compile it exactly the same. The first method is just easier to write and read (once you know what it does.)
|
# ? Apr 13, 2008 12:38 |
|
This is a stupid assed question but I can't seem to find out how to write a Dataset to an Excel XLS file in Winforms. Any ideas?
|
# ? Apr 14, 2008 20:34 |
|
hey, I'm displaying data using a gridview, and one of the columns is a datetime, what's the best way to format these date values (mm/dd/yyyy, for example)?
|
# ? Apr 15, 2008 00:32 |
|
TheReverend posted:This is a stupid assed question but I can't seem to find out how to write a Dataset to an Excel XLS file in Winforms. Any ideas? Get a third-party component, or write some simple code to export as a CSV file, which Excel can read.
|
# ? Apr 15, 2008 01:36 |
|
uh zip zoom posted:hey, I'm displaying data using a gridview, and one of the columns is a datetime, what's the best way to format these date values (mm/dd/yyyy, for example)? If you've got a variable called myDate then you can use myDate.ToShortDateString()
|
# ? Apr 15, 2008 01:44 |
|
I've been working on a C# program for rollout of our program installations. It consists of two parts: the configuration and files set up on a hidden share on a site's server, and the executable run on the local machine. The program uses robocopy to grab different directories from the server as required for whatever purpose the workstation is filling. Now, the servers are on our domain, as are most, but not all, of our local workstations. The problem is that there are a number of local workstations that do not run on the domain. Since the servers and the workstations do not share any non-domain logins, this means that on the non-domain workstations I cannot access the files to copy from the server. Is there any way, or any program, that will allow me to specify different source and destination logins for copying files? I would rather solve this problem using the existing logins as there's quite a lot of work in adding (and justifying) logins or open shares on almost 50 servers. EDIT: map a network drive, problem solved theodop fucked around with this message at 07:10 on Apr 15, 2008 |
# ? Apr 15, 2008 06:35 |
|
theodop posted:domain/workgroup stuff Or just supply fully qualified credentials in the form of domain\username.
|
# ? Apr 15, 2008 10:59 |
|
uh zip zoom posted:hey, I'm displaying data using a gridview, and one of the columns is a datetime, what's the best way to format these date values (mm/dd/yyyy, for example)?
|
# ? Apr 15, 2008 15:01 |
|
Here's a question, I'm trying to use XmlSerializer on a class hierarchy. I'm trying to produce some simple xml for a 3rd party api. What I'm getting is close, but the XmlSerializer insists on junking it up with xsi/namespace crap:code:
|
# ? Apr 15, 2008 16:30 |
|
biznatchio posted:Get a third-party component, or write some simple code to export as a CSV file, which Excel can read. I can do the CSV thing, it just seems like a hacky last resort. Any ideas for free or low cast third party libraries?
|
# ? Apr 15, 2008 17:35 |
|
double post, sorry
uh zip zoom fucked around with this message at 19:00 on Apr 15, 2008 |
# ? Apr 15, 2008 18:57 |
|
uh zip zoom posted:yes, but can it sort when you click the header?
|
# ? Apr 15, 2008 19:00 |
|
TheReverend posted:I can do the CSV thing, it just seems like a hacky last resort. Any ideas for free or low cast third party libraries? There's nothing reliable, because the Excel file format is a bastard. (Here's why.) Your choices are: invoke Excel through COM interop or whatever they're calling it these days, add your data to a worksheet and then tell Excel to save the worksheet; find some third-party worksheet format that's simple enough to have tools that work with it, and also supported by Excel (so, probably Quattro Pro or some other also-ran); use CSV. If you're just storing data and don't need to set up formulas or anything, CSV is a no-brainer. EDIT: the link I posted above suggests using the Lotus 1-2-3 format, .WK1. I believe Office 2008 dropped support for that. JoeNotCharles fucked around with this message at 19:16 on Apr 15, 2008 |
# ? Apr 15, 2008 19:08 |
|
TheReverend posted:This is a stupid assed question but I can't seem to find out how to write a Dataset to an Excel XLS file in Winforms. Any ideas? See this article I wrote: http://www.sitepoint.com/blogs/2006/08/22/making-excel-the-carlosag-way/ Not quite an excel file, but much better than CSV. PS: Another good option, if you have .NET 3.0 on the clients, is to create Excel 2007 workbooks. There is a pure managed API that is reputedly very good, or at least usable.
|
# ? Apr 15, 2008 21:31 |
|
cadmium posted:Here's a question, I'm trying to use XmlSerializer on a class hierarchy. I'm trying to produce some simple xml for a 3rd party api. What I'm getting is close, but the XmlSerializer insists on junking it up with xsi/namespace crap:
|
# ? Apr 15, 2008 22:09 |
|
gibbed posted:Doesn't the XmlSerializer have options you can use on creation or use of the objects that define formatting? Not that I can find. There was a hack involving XmlSerializerNamespaces for .NET1 but it actually makes things worse in .NET 2+.
|
# ? Apr 15, 2008 23:11 |
|
Yeah, I have hit this a few times and have not found an elegant solution. My inelegant solution was doing a little string.Replace() on the post-serialized stuff before sending it off for processing. Definitely a hack, but it seems to work pretty well so long as the API is locked in. Another reasonable option would be to, presuming the stuff is not too complex, write your own serialization, either using XmlTextWriter or by explicitly implementing IXmlSerializable. That should put you back in the control at the cost of having to write more code. I hate loving xml namespaces and poo poo that honors them.
|
# ? Apr 15, 2008 23:19 |
|
wwb posted:Yeah, I have hit this a few times and have not found an elegant solution. My inelegant solution was doing a little string.Replace() on the post-serialized stuff before sending it off for processing. Definitely a hack, but it seems to work pretty well so long as the API is locked in. I hate serialization. I fought binary serialization last fall and now I'm fighting xml serialization. I've currently been implementing a custom XmlTextWriter, but it's pretty hackey and I'm still trying to get rid of the <_body> crap.
|
# ? Apr 16, 2008 15:57 |
|
Man, .NET event handling is complete poo poo. I was trying to figure why merely removing a handler from an event 10,000 times took 8 seconds. Finally realized it's because of the size of the listener list; removals must be an O(N) operation! That's absurd. Anyone know of a better built-in method for registering large numbers of event callbacks, or do I just have to do it myself? I'm guessing the native implementation uses the List class, which is actually a dynamic array and not a linked list. That would speed up insertions but of course makes removals (that aren't from the end) absurdly slow.
|
# ? Apr 16, 2008 17:59 |
|
Anonymous Name posted:Man, .NET event handling is complete poo poo. I was trying to figure why merely removing a handler from an event 10,000 times took 8 seconds. Finally realized it's because of the size of the listener list; removals must be an O(N) operation! That's absurd. quote:I was trying to figure why merely removing a handler from an event 10,000 times took 8 seconds. quote:removing a handler from an event 10,000 times What in the hell are you doing that this is a requirement? Also no, events are part of the C# language. If you want to get clever, you need to maintain your own delegate lists. That's what I ended up doing when I implemented priority-based event handlers for shaim.
|
# ? Apr 16, 2008 18:27 |
|
Can anyone think of a reason why WPF would stop updating the screen? After running for an hour or two, my digital signage application stops refreshing the screen. The app is still running in the background, updating the registry, firing off timer events, etc (or our watchdog app would realize it's hung). Minimizing and maximizing brings it right back. It's as if the WPF render thread is getting stuck on something. When it comes back up, though, it runs pathetically slow and uses up 99% CPU until I restart the app. Profiling the app gives no useful data. Neither does debugging it; attaching a debugger causes the rendering to work again but again 99% CPU. I am totally at my wit's end. I can't figure out what the gently caress is causing this. I'm starting to hate WPF. edit: What if it's a VRAM issue, and minimizing/maximizing has WPF re-start rendering the window in Software mode?? I'm watching VRAM in Perforator and it just keeps going up. I'm going to assume video RAM isn't garbage collected the way system RAM is. What could be causing a video RAM leak? edit2: VRAM hits a peak and then starts coming down. I guess it's not that. edit3: The peak the VRAM usage hits keeps increasing. First 95MB, now 99MB. We've only got 128. Also the number of software intermediate render targets is slowly increasing. Goddamn goddamn goddamn this is what happens when you put a simple API on a very complex system, it's impossible to understand what the heck is actually going on. Pivo fucked around with this message at 19:59 on Apr 16, 2008 |
# ? Apr 16, 2008 18:51 |
|
csammis posted:What in the hell are you doing that this is a requirement? I second this sentiment. 10,000 listeners to a single event screams architecture issue. quote:I hate serialization. I fought binary serialization last fall and now I'm fighting xml serialization. That is interesting--can you post the serialization code. My experiences with XmlTextWriter generally indicate that it, well, writes what you tell it to write.
|
# ? Apr 16, 2008 18:56 |
|
I have 10,000 icons (for example) in a 3D world, each of which may be associated with a more abstract object that has certain properties. When those properties change, the icons need to be notified so they can handle it. Not all icons would need to handle it. So the abstract object has an event for when one of its properties changes, and for when it's removed. The icons set up listeners when they become associated with that object. (They don't actually belong to the abstract and can change whom they associate with.) When I delete all those icons, then I have 10,000 handlers I'm removing. But there could be other objects that are still using those events so I can't simply dump the entire event handler list or anything.
|
# ? Apr 16, 2008 19:17 |
|
cadmium posted:Here's a question, I'm trying to use XmlSerializer on a class hierarchy. I'm trying to produce some simple xml for a 3rd party api. What I'm getting is close, but the XmlSerializer insists on junking it up with xsi/namespace crap: Weird. When I try to serialize things, it just puts <?xml version="1.0" encoding="utf-8"?> and <RootElementNameHere xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> at the top, and that's it. Can you post the code you use to serialize, and the class you're serializing ?
|
# ? Apr 16, 2008 19:18 |
|
Anonymous Name posted:I have 10,000 icons (for example) in a 3D world, each of which may be associated with a more abstract object that has certain properties. When those properties change, the icons need to be notified so they can handle it. Not all icons would need to handle it. Can't you just leave the event handlers attached (and possibly do nothing if the icon's already deleted), and let the garbage collector clean things up? Unless I'm mistaken, the attached event handlers won't keep the icons from being garbage collected, so you don't have to manually unhook them.
|
# ? Apr 16, 2008 19:39 |
|
dwazegek posted:Unless I'm mistaken, the attached event handlers won't keep the icons from being garbage collected, so you don't have to manually unhook them. I believe you are mistaken. http://blogs.msdn.com/jgoldb/default.aspx quote:This leak is triggered because the child window (Window2) has a reference (it registered to an event) to Window1 TextBox1 which remains alive causing the Window2 object and its element tree to remain alive.
|
# ? Apr 16, 2008 19:49 |
|
dwazegek posted:Can't you just leave the event handlers attached (and possibly do nothing if the icon's already deleted), and let the garbage collector clean things up? Unless I'm mistaken, the attached event handlers won't keep the icons from being garbage collected, so you don't have to manually unhook them. I coded my own solution just now using a SortedDictionary<int,Function>. When an object adds an event handler, it has to remember an int key now (that key is what's passed back to remove the object) but I measured the time it took to add 10,000 event handlers, then fire the event, then remove those 10,000 handlers. .NET event: 2.92 seconds My approach: 0.047 seconds Less than 1/20 of a second compare to 3 seconds! SortedDictionaries use a bunch of memory, and my approach is less convenient due to the key, but the speed increase is ridiculous.
|
# ? Apr 16, 2008 19:53 |
|
Anonymous Name posted:.NET event: 2.92 seconds Sounds about right, and you pointed out the reason that I suspect this behavior exists: it's optimized for handler adds, not removals, and 10000 handlers is particularly insane. I'm not saying your situation isn't valid, but drat. edit: Why not use the handling object itself as the SortedDictionary key? It would remove the requirement of having to store some random integer as the key, at any rate. Then you get someObject.AddHandler(object, Delegate); and someObject.RemoveHandler(object); csammis fucked around with this message at 20:08 on Apr 16, 2008 |
# ? Apr 16, 2008 20:05 |
|
csammis posted:edit: Why not use the handling object itself as the SortedDictionary key? It would remove the requirement of having to store some random integer as the key, at any rate. Then you get someObject.AddHandler(object, Delegate); and someObject.RemoveHandler(object); The key of a SortedDictionary has to implement either IComparable, or IComparable<T> (or a custom comparer has to be supplied). You can also try SortedList, it should use less memory, but the add/remove operations are slower (according to MSDN). Pivo posted:I believe you are mistaken. If an object A has an event that B's registered to, then B won't be collected while A's around, but A can be collected while B's around. I thought it worked both ways. Well, looks like I'll have some work to do tomorrow.
|
# ? Apr 16, 2008 20:40 |
|
dwazegek posted:The key of a SortedDictionary has to implement either IComparable, or IComparable<T> (or a custom comparer has to be supplied). That's right. Since he's got such exquisite control over his event handlers, I'm assuming he can implement one of the IComparables. It may be done anyway, with 10000 objects they may be getting stored in a list and being searched for at some point.
|
# ? Apr 16, 2008 20:51 |
|
You can't implement IComparable in a delegate unless I'm missing something. And you can't use the hash code (of the target and the method) as a unique key either because collisions do occur. So my event is an instance of an actual object, with a counter that gets incremented each time a handler is added (but is never decremented, guaranteeing a unique value for each added handler). This value is used as the key in the dictionary.
|
# ? Apr 16, 2008 22:21 |
|
uXs posted:Weird. When I try to serialize things, it just puts <?xml version="1.0" encoding="utf-8"?> and <RootElementNameHere xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> at the top, and that's it. Can you post the code you use to serialize, and the class you're serializing ? One thing that is making things trickier is that I'm serializing inherited classes.
|
# ? Apr 16, 2008 22:35 |
|
Anonymous Name posted:So my event is an instance of an actual object, with a counter that gets incremented each time a handler is added (but is never decremented, guaranteeing a unique value for each added handler). Until it overflows. If you're using objects in bunches of 10000, I wouldn't rule that out.
|
# ? Apr 17, 2008 01:09 |
|
JoeNotCharles posted:Until it overflows. If you're using objects in bunches of 10000, I wouldn't rule that out.
|
# ? Apr 17, 2008 06:13 |
|
code:
No exceptions are being thrown, and there are no other differences. It doesn't matter how I call the asynchronous operation (callback, waiting for the AsyncResult's waithandle, or immediately calling EndWrite). edit: The amount of leaked memory doesn't seem to coincide with the bytes that are written. dwazegek fucked around with this message at 12:03 on Apr 18, 2008 |
# ? Apr 18, 2008 12:00 |
|
I'm just learning .net and have run into something I can't figure out. Using asp.net to connect to an access database. The access database has a few tables, and I have some drop down forms that allow you to filter the data on the main table. When you click on an item once filtered, it selects the data from the corresponding table using as an example "select * from other table where code = ?", the code is supplied via the browser string, etc. It's all done except for the last page, which is slightly different than the others. Two variables are sent in the address bar, and depending on which data is supplied a different select statement is used. This is an on load event: code:
This is the error I get: code:
|
# ? Apr 18, 2008 14:53 |
|
|
# ? Jun 10, 2024 09:28 |
|
Uziel posted:This is the error I get: Is "pkgcode" supposed to be in quotes ? It looks like it should be a variable and you accidently put quotes around it.
|
# ? Apr 18, 2008 18:16 |