|
Vintersorg posted:Oh, so I just learned that in asp.net you cannot have two forms on one page. So my idea above will not work. The entire site is created by a form itself. Not sure why, but it is. Could someone explain the significance of why a designer would choose it? ASP.NET WebForms was designed to make the whole page a form (as the name implies). There's a lot of debate over the reasons this is a bad idea, but it is what it is. You can use ASP.NET MVC or many other frameworks if this isn't your cup of tea. You can also hack in a second form in WebForms if you need... just put a closing </form> tag before yours, then open a new one after: CODE:<!-- Close the existing form tag that came from webforms --> </form> <!-- Your own form --> <form id="myform" action="WhateverMyImageUploadEndpointIs"> ...fields... </form> <!-- Open another form so the end result is well-formed --> <form>
|
| # ? May 24, 2012 15:10 |
|
|
| # ? May 25, 2013 18:34 |
|
Vintersorg posted:Oh, so I just learned that in asp.net you cannot have two forms on one page. So my idea above will not work. The entire site is created by a form itself. Not sure why, but it is. Could someone explain the significance of why a designer would choose it? Make a user control.
|
| # ? May 24, 2012 15:12 |
|
Checking out those User Controls, thanks! ![]() Boss came up to me and said we could either try a iFrame or even better just create an entire separate page since this is really for internal use only. They won't really need the default look of the site (cadets.ca). Also this page ( http://www.geekpedia.com/KB62_A-pag...e-Form-tag.html ) was awesome with people bitching up a storm.
|
| # ? May 24, 2012 16:00 |
|
This is a bit general, but I'll post it here since the thread is for the languages I'm most familiar with. My education didn't have much low-level programming, I started with VB in college and did stuff like Actionscript and HTML at University, first doing "serious" programming in the last few years where I was recruited for a role with a lot of scripting (C#) in the games industry after doing a lot of testing. I feel fine with the actual programming, but I sometimes feel that I've learnt the wrong way, and that I sometimes am unable to express what I'm doing or struggle to understand what is being asked of me. Can anyone recommend a book or website, not necessarily focusing on C# or any particular language, that might help me perhaps be more confident that both I and my audience know what I'm talking about?
|
| # ? May 24, 2012 16:27 |
|
How can I get at the type parameter of a parameterized type? (It's my parameterized type so I can give it whatever it needs to facilitate this.) In C++, I'd doC++ code:
|
| # ? May 24, 2012 19:17 |
|
Is something like typeof(Foo<T>).GetGenericArguments() what you're looking for?
|
| # ? May 24, 2012 19:36 |
|
^^ That would be among the reflection shenanigans to which he refers. The type isn't known at the compile time. .NET generics are not templates, they only generate code for a single class, that is valid for all possible types that could be supplied.
|
| # ? May 24, 2012 19:38 |
|
GrumpyDoctor posted:How can I get at the type parameter of a parameterized type? (It's my parameterized type so I can give it whatever it needs to facilitate this.) I'm specifically trying to do this in F# Here's an idiomatic way to write generic type parameters in functional languages. Use 'a (pronounced "alpha") or other apostrophe'd letters instead of capital T,U,V, to declare and refer to the type parameters. code:code:
|
| # ? May 24, 2012 19:47 |
|
Zhentar posted:^^ That would be among the reflection shenanigans to which he refers. Hm. F# does have something called statically resolved type parameters but I don't think it would help me here. That's good to know about .NET generics though! My question is if there's a way for a' Foos to somehow provide the type of 'a to other code so that the other code can operate on 'as directly (and appropriately generically, obviously). The more I'm describing the problem, the more I'm thinking I'm SOL.
|
| # ? May 24, 2012 20:14 |
|
GrumpyDoctor posted:My question is if there's a way for a' Foos to somehow provide the type of 'a to other code so that the other code can operate on 'as directly (and appropriately generically, obviously). The more I'm describing the problem, the more I'm thinking I'm SOL. Please clarify more about what you want to do. I'm still not getting it! There are two ways you can provide the type to other code. You can provide it as a type at compile-time, in syntactic language constructs which expect a type: code:Also, in my original code, I called the + operator directly and generically, and it resolved to whichever + was appropriate. I could have constructed a tree with integers instead code:You can also get a value of type System.Type, a kind of RTTI that represents what 'a was instantiated by. For instance, code:
|
| # ? May 24, 2012 20:35 |
|
Well, I think I've pretty much confused myself into uselessness. That being said, whatever I'm doing now is working, but I'm not sure whether that's because of what you've told me or because design compromises I made before I asked my question actually did their job. (Fun fact: the parameterized type syntax you gave me doesn't actually seem to be anywhere in the F# language reference, which all uses angle brackets. Once I used your syntax and let the compiler automatically generalize what it could, everything went a lot smoother). At this point I don't even really remember what I was originally trying to do, now that I have something that works. This was probably just another X/Y problem. I was looking for something equivalent to: C++ code:
|
| # ? May 24, 2012 21:03 |
|
GrumpyDoctor posted:This was probably just another X/Y problem. I was looking for something equivalent to: I see. You're asking for a type alias (i.e. a name which refers to some other type), and you want this type alias to be qualified on an instance of some type. In C++ it used to be important for abominations like "for(std::iterator<T1,Foo<T2>> i=...)", but in C++ that seems less pressing now that you can use type inference through the "auto" keyword. I don't think you can do it in F#. I think the F# people tend to use type inference, which makes the need less pressing. You can't do that in C#/VB. These languages have a deliberate design decision that people should by and large know types by their one true name rather than aliases. You can put "using" (C#) or "Imports" (VB) declarations at the top of the file to specify type aliases, and C# also allows type-aliases to be defined inside namespace declarations, but they can't go anywhere else (and can't go in the sort of place you're asking). Moreover, when you're using intellisense or tooltips, it always shows types by their canonical names rather than their aliases... code: The fancy new kids on the block would write "type Foo<'a> = | Node of Foo<'a> * Foo<'a> | Leaf of 'a"
|
| # ? May 24, 2012 21:44 |
|
This is kind of a random question, but is there a way to move where a form is displayed in Visual Studios in the designer? Like this;
|
| # ? May 25, 2012 12:57 |
|
Sab669 posted:is there a way to move where a form is displayed in Visual Studios in the designer? Why?
|
| # ? May 25, 2012 18:15 |
|
Ok, I want to make absolutely sure of something relating to the unsubscribing of events. The scenario is... C# code:epalm fucked around with this message at May 25, 2012 around 19:12 |
| # ? May 25, 2012 18:43 |
|
epswing posted:Why? Well, I got a new job recently and my monitor space is... significantly larger than what I'm used to. I can't seem to get a comfortable setting to work in when I'm looking at the designer. I know it sounds kind of retarded and babyish, I wasn't sure if it was some easy thing to do that I just never learned / couldn't find on Google.
|
| # ? May 25, 2012 18:48 |
|
The old Hat will maintain a strong reference to your Program class. So without the unsubscribe, the Program instance would not prevent the Hat instance from being GCed, but the Hat instance would prevent the Program instance from being GCed. Obviously, that's not a problem in this scenario, so no, it's not strictly necessary. That said, I still think it would be a pretty good idea to stick to that pattern; you're opening yourself up to a lot of potential issues if you don't stick to it (like getting conflicting updates for two different Hats...). If you just don't want to type that much, you could easily create a snippet that would do all of the work for you.
|
| # ? May 25, 2012 18:53 |
|
Zhentar posted:The old Hat will maintain a strong reference to your Program class. So without the unsubscribe, the Program instance would not prevent the Hat instance from being GCed, but the Hat instance would prevent the Program instance from being GCed. Obviously, that's not a problem in this scenario, so no, it's not strictly necessary. Yeah, I just stick to the rule "always unsubscribe to that which you subscribe", and it doesn't steer me wrong. Of course, that means you can't use lambdas for events, but that's not a big deal.
|
| # ? May 25, 2012 18:57 |
|
Ithaqua posted:Yeah, I just stick to the rule "always unsubscribe to that which you subscribe", and it doesn't steer me wrong. Of course, that means you can't use lambdas for events, but that's not a big deal. Sure you can! Like this... code:
|
| # ? May 25, 2012 19:00 |
|
ljw1004 posted:Sure you can! Like this... in C#?
|
| # ? May 25, 2012 19:13 |
|
epswing posted:in C#? Yeah, I forgot about that. C# code:
|
| # ? May 25, 2012 19:27 |
|
Ithaqua posted:Of course, that means you can't use lambdas for events, but that's not a big deal. Sure as hell doesn't stop the WPF Toolkit's charting library from using them everywhere. That library leaks event handlers all over the drat place.
|
| # ? May 25, 2012 21:53 |
|
Sab669 posted:This is kind of a random question, but is there a way to move where a form is displayed in Visual Studios in the designer? I wonder if you could undock the designer window... I doubt there's a way to move the form itself because absolute positioning starts a 0,0 in the top left of the designer
|
| # ? May 26, 2012 21:01 |
|
Does anyone know of a way to compare two images with some amount of error tolerance? Right now what I'm doing is hashing both images and comparing the hashes which leaves absolutely no room for error and on certain images I might have very subtle shading differences or something but the images are 99% the same.
|
| # ? May 27, 2012 07:58 |
|
You're looking for a perceptual hash.
|
| # ? May 27, 2012 08:20 |
|
Sir DonkeyPunch posted:I wonder if you could undock the designer window... Drastic solution: use WPF. The WPF designer puts forms in the middle, I think.
|
| # ? May 27, 2012 08:58 |
|
I'm looking to code a simulation in C# that would enable a remote client to send a message to a server (Either message queue or WCF) and immediately get an acknowledgement that the message was delivered. But then the message itself wouldn't actually be processed for X minutes of time (Determined by the message.) I'd love for it all to be within a MSMQ type solution to guarantee the processing of the message. I've done something similar years ago in Java using JMS and a database as a priority queue, but I'm hoping that in the last 10 years there's something native in the .NET ecosystem that I could leverage. Basically, I want something that acts as a message queue where there's entries in it, but each entry has a timestamp that's the earliest they should be processed. If the timestamp hasn't been reached, the queue looks empty when work is requested. If there are 5 messages in the queue that has reached the timestamp, they're processed in the order of the stamp, not the order of delivery/insertion. Anything like that out there?
|
| # ? May 27, 2012 20:54 |
|
This will probably lead into a bigger question, but I'm working on improving single user performance for an intranet application that has become business critical. We are unfortunately storing large custom objects in session state (using session state server) and are paying a performance price due to the serialization/deserialization. I bought our team Ultra-Fast ASP.NET (http://www.amazon.com/Ultra-Fast-AS...r/dp/1430223839) and we are going through it, but given that we are using a single web server web garden, using cache for everything isn't ideal either (distributed cache also serializes/deserializes from what I understand). I was starting to look into MVC, as its moving toward a stateless nature, but from what I've read there are still usages for session as our application is closer to "shopping cart" than basic "use a form to edit something in a database". Any thoughts or opinions as to what direction we should be going? If more information would help, I can elaborate.
|
| # ? May 28, 2012 13:38 |
|
Hughlander posted:Basically, I want something that acts as a message queue where there's entries in it, but each entry has a timestamp that's the earliest they should be processed. If the timestamp hasn't been reached, the queue looks empty when work is requested. If there are 5 messages in the queue that has reached the timestamp, they're processed in the order of the stamp, not the order of delivery/insertion. Azure message queues work mostly like this (look at the "optional validity timeout" on PutMessage, which is specified as a time delay rather than a timestamp).
|
| # ? May 28, 2012 15:00 |
|
edit: nvm, figured something out -- just need to set a virtual path ps Ektron sucks Vintersorg fucked around with this message at May 29, 2012 around 14:57 |
| # ? May 29, 2012 14:29 |
|
(WPF!) Ok, standard task of clicking a button which initiates a long-running process, I want to disable the button, run an indeterminate progress bar, and when the process is finished, enable the button and stop the progress bar. Obviously this isn't going to work: C# code:C# code:PS: My code isn't really sitting in a button_click handler, and I'm not really assigning stuff to textboxes directly. Trust me when I say I love MVVM and DataBinding. PPS: Forgot to mention, I can't waiiiit to use await! But we're not on .NET 4.5 yet, and won't be for a while, it seems. epalm fucked around with this message at May 29, 2012 around 17:02 |
| # ? May 29, 2012 14:48 |
|
Vintersorg posted:This might be a shot in the dark but does anyone know how to set a 1-dimensional array for metadata? We are using Ektron (think I mentioned this in other posts) and I am going by this guide on their site. Can't you just do C# code:
|
| # ? May 29, 2012 14:57 |
|
I'll try that out. But if not I found something else that is kind of a work around. Thanks Ithaqua!
|
| # ? May 29, 2012 14:57 |
|
epswing posted:How can I stuff the above into a pretty function? I've been playing with Tasks and Actions and I just need to stop thrashing and see a solid example. C# code:
|
| # ? May 29, 2012 16:00 |
|
fankey posted:Use async He's probably not using .NET 4.5, but yes doing it async would be the way to go. Of course, seeing codebehind in a WPF application is a sin.
|
| # ? May 29, 2012 16:13 |
|
Ithaqua posted:He's probably not using .NET 4.5, but yes doing it async would be the way to go. If you are crazy like me you can use the Async CTP with VS2010. Working so far ( fingers crossed! ). The amount of code and complexity it removed from my code is worth the risk of a problem popping up.
|
| # ? May 29, 2012 16:33 |
|
fankey posted:Use async I can't waiiiit to use await! But we're not on .NET 4.5 yet, and won't be for a while, it seems.
|
| # ? May 29, 2012 17:03 |
|
epswing posted:I can't waiiiit to use await! But we're not on .NET 4.5 yet, and won't be for a while, it seems. code:fankey fucked around with this message at May 29, 2012 around 17:15 |
| # ? May 29, 2012 17:13 |
|
epswing posted:How can I stuff the above into a pretty function? I've been playing with Tasks and Actions and I just need to stop thrashing and see a solid example. In VB because I can never remember C#'s byzantine switch syntax: VB Script code:ninjeff fucked around with this message at May 29, 2012 around 17:52 |
| # ? May 29, 2012 17:48 |
|
|
| # ? May 25, 2013 18:34 |
|
I published my first thing to NuGet, and holy poo poo is that easy and awesome. Anyone else using it?
|
| # ? May 29, 2012 19:32 |

























