|
In WPF, if I set the WindowState to Maximized, and the ResizeMode is set to either CanMinimize or NoResize, then the window covers the task bar. If ResizeMode is set to either of the “can resize” modes, the window does not cover the task bar. My googling has only turned up fixes for this when WindowStyle is set to None, but mine is set to ThreeDBorderWindow. I even tried some of the fixes I came across in google, to no effect. This happens in both Windows 8.1 and 10. Any ideas besides using CanResize which is my current fix?
|
# ? Dec 15, 2017 01:34 |
|
|
# ? Jun 1, 2024 18:49 |
|
I just updated to VS 15.5, which according to the release notes should let me create new .NET Standard libraries in F#. But I don’t have any new templates. How do I figure out what’s going on? I just re-installed the .NET Core SDK, to make sure I have it.
|
# ? Dec 15, 2017 23:35 |
|
raminasi posted:I just updated to VS 15.5, which according to the release notes should let me create new .NET Standard libraries in F#. But I don’t have any new templates. How do I figure out what’s going on? I just re-installed the .NET Core SDK, to make sure I have it. Did you install VS with F# support? I can't remember if it's selected by default but there are definitely a bajillion options now and F# is one of them.
|
# ? Dec 16, 2017 02:02 |
|
Does Visual Studio automatically show the templates from the new SDK? If it does not, the command you want is "dotnet new classlib -lang f#".
|
# ? Dec 17, 2017 01:52 |
|
Scikar posted:Did you install VS with F# support? I can't remember if it's selected by default but there are definitely a bajillion options now and F# is one of them. Well, I just did the upgrade. I assume that since F# was already installed it would be upgraded. NihilCredo posted:Does Visual Studio automatically show the templates from the new SDK? If it does not, the command you want is "dotnet new classlib -lang f#". The release notes sure imply that it should!
|
# ? Dec 17, 2017 15:32 |
|
I converted an F# project to the new .fsproj format and now C# code depending on it can't call record properties without causing a CS1546 or a CS0570 did nobody test any of this at all
|
# ? Dec 20, 2017 22:49 |
|
raminasi posted:I converted an F# project to the new .fsproj format and now C# code depending on it can't call record properties without causing a CS1546 or a CS0570 did nobody test any of this at all Heh, I gave up om the bleeding edge MS stuff for awhile now. Life got a lot simpler.
|
# ? Dec 20, 2017 22:58 |
|
raminasi posted:F#... did nobody test any of this at all mystes fucked around with this message at 23:08 on Dec 20, 2017 |
# ? Dec 20, 2017 23:05 |
|
Anyone have any idea how to do something like add a custom .NET Framework build to the VS "target framework" options? (Or where that list comes from in general?)
|
# ? Dec 21, 2017 04:47 |
|
OneEightHundred posted:Anyone have any idea how to do something like add a custom .NET Framework build to the VS "target framework" options? (Or where that list comes from in general?) Like, you forked the framework itself? I have no idea how to do that but I’m really curious about whatever project you’re doing that calls for it.
|
# ? Dec 21, 2017 05:06 |
|
raminasi posted:I’m really curious about whatever project you’re doing that calls for it. OneEightHundred fucked around with this message at 07:05 on Dec 21, 2017 |
# ? Dec 21, 2017 06:22 |
|
I'm working on an web api that makes numerous other network/service calls. All of them except one are called using libraries that we have either built internally (async all the way down), or are generic enough to use out of the box framework async clients to call. The problem is that last one, it's a proprietary service, and their proprietary .NET library does not expose async calls. What are my options (if any)? This one call is like 50% of my response time but under the hood is just another network call. I guess this is sort of embarrassing, but as part of this team I've built dozens of web apis, but I've never had to deal with I/O bound work that doesn't expose awaitable signatures.
|
# ? Dec 21, 2017 08:44 |
|
I would just fake it with a worker thread - your main code thinks it is some async operation going on but really, all that happens is that a new thread is started and the work done on that thread in parallel. This would be Task.Run(() => SyncOperation(), TaskOptions.LongRunning), which returns a Task you can await. You want to specify LongRunning (which starts a new thread every time) so you do not eat up thread pool threads with long blocking synchronous network operations (my rule of thumb: 10+ milliseconds per call is long running). Depending on your performance needs, the model might be futher optimized but the above should be a good starting point.
|
# ? Dec 21, 2017 09:41 |
|
Any idea why an explicit operator to convert a string to my object type might screw up? I also have a TypeConverter on it. I've pastebinned it since it's over 100 lines.
|
# ? Dec 21, 2017 09:47 |
|
Rocko Bonaparte posted:Any idea why an explicit operator to convert a string to my object type might screw up? I also have a TypeConverter on it. I've pastebinned it since it's over 100 lines. The closest I could find was: C# code:
To demonstrate, check this code snippet. On the left you see the C# code as you'd write it and on the right the "raw" code that the compiler actually generates. Note how only the cast on the actual string variable performs the call to the operator, but the cast on the same string being referenced via an object variable does not.
|
# ? Dec 21, 2017 10:25 |
|
SirViver posted:But in this case serializedHandle is an object, not a string. That must be it. The case where I want it to work is when that object turns out to be a string. I may add a cast for that too and throw an InvalidCastException if it does not like me. I have not been able to contort that generic code any further to support it there; TRecord could be an object or a primitive type, so the compiler gets pissed at me even though I went through all the motions to determine it was a string. I had made the particular case just make it's TRecord be a string, but that SceneObjectId type is very common. It is how I reconnect some saved entities when doing all that loading. Edit: ...and I can't create an explicit cast operator from an object due to the whole "user-defined conversions to or from a base class are not allowed." Rocko Bonaparte fucked around with this message at 20:02 on Dec 21, 2017 |
# ? Dec 21, 2017 16:42 |
|
OneEightHundred posted:Anyone have any idea how to do something like add a custom .NET Framework build to the VS "target framework" options? (Or where that list comes from in general?) I bet the easiest way, if it's possible, is to pull apart an installer for the 2.x framework SDK and replace their DLLs with yours. The process monitor logs make it look like it just crawls C:\Program Files (x86)\Reference Assemblies and C:\Program Files (x86)\Microsoft SDKs but I'm sure it's more complicated than that and I don't really have time to analyze it thoroughly.
|
# ? Dec 21, 2017 17:00 |
|
OneEightHundred posted:I'm trying to make a miniature .NET runtime because Lua is slow and Mono is huge, but the mscorlib I'm using is a fork of the .NET Micro Framework. Is https://nanoframework.net/about/ anything close to what you want?
|
# ? Dec 21, 2017 18:36 |
|
NihilCredo posted:Is https://nanoframework.net/about/ anything close to what you want? I want to support variance too, but it's a nightmare of poor planning, poor specification, and undocumented behavior that violates the spec.
|
# ? Dec 22, 2017 01:51 |
|
OneEightHundred posted:I want to support variance too, but it's a nightmare of poor planning, poor specification, and undocumented behavior that violates the spec. What variance things? I could maybe help. My first proper feature on the VB/C# compiler team was to implement co- and contra-variance in the language. I was fresh out of academia so I accompanied my implementation with a proof of correctness. Or at least, tried to, but the proof didn't work because of a "diamond bug" in the pre-existing CLR specification. I presented the flaw, and possible remedies, and that was enough to get me invited onto the language design team. Fun memories
|
# ? Dec 22, 2017 06:11 |
|
Diamond bug? You'll have to explain that one.
|
# ? Dec 22, 2017 09:38 |
|
ljw1004 posted:What variance things? I could maybe help. I bugged a bunch of cases in Mono this morning, including the worst case that I'm aware of. It's not a compilation problem, it's an execution problem. For one thing, the .NET interface dispatch specification follows a practice that I've seen in other specifications and that I hate: Describing an algorithm using a completely-impractical reordering of it for the sake of... uh, I guess clustering the operations to avoid talking about control flow? I don't know. Adding and removing stuff from a list and selecting a candidate out of it is just a slow way of implementing a tiered priority system, except now I have to puzzle out what the real algorithm is and that makes it harder to implement it correctly and validate compliance. My interpretation of it was that because all of the candidate methods would be prioritized the same way, calls through a variant interface would at least be 1:1 with one of the interfaces on the class. I'm guessing that's how 99% of people would think it works, and it'd allow for some nice under-the-hood optimizations like handling the whole cast as just aliasing one of the implementation tables. Unfortunately, it doesn't work that way, and it's possible for a variant interface to have a different set of implementations than any interface on the actual class because of a quirk where it makes a distinction between new and reused method implementations, and reused implementations are invisible to the call resolution search. Nothing in the spec even hints at this, so it's either undocumented behavior or a bug, and it forced a rewrite of the interface call code, which now has to do lookups at runtime. This is on top of quirks that ARE documented in the spec, like situations where a match by variance take priority over exact matches, and the whole existence of "type declaration order" instead of traversing the class hierarchy, that make the whole thing seem poorly thought out to me. But here's the annoying case: code:
code:
OneEightHundred fucked around with this message at 17:25 on Dec 22, 2017 |
# ? Dec 22, 2017 09:50 |
|
EssOEss posted:I would just fake it with a worker thread - your main code thinks it is some async operation going on but really, all that happens is that a new thread is started and the work done on that thread in parallel. Thanks for this. I only had like half an hour today to play with things, but I wasn't seeing the results I expected (I used the TaskFactory). I'm finished for the year now, but I'll probably spend some time during my break to learn more about Task creation.
|
# ? Dec 22, 2017 12:02 |
|
OneEightHundred posted:But here's the annoying case: Yikes. I've been down a similar rabbit hole in WPF/MVVM with many layers of inheritance, interfaces, generics, the works. It was fun to implement and understand co/contra-variance'ness, fun to write and design, but when something broke, or needed to be moved, it was a nightmare (especially due to errors that didn't quite tell you where to look). Isn't that what they say about perl (or is it regex)? Fun to write, hard to read? After a couple projects like that, I've been on a simplicity crusade for the last couple of years. I've found that a little bit of code duplication is sometimes worth it, to avoid ridiculous complexity that only one guy in your company understands on Tuesdays and Thursdays. Maybe this is an unpopular opinion in a thread full of smart people, but as I age my focus has slowly shifted away from "oh that's so cool!!". And it IS cool stuff! epswing fucked around with this message at 16:34 on Dec 22, 2017 |
# ? Dec 22, 2017 16:29 |
|
epalm posted:After a couple projects like that, I've been on a simplicity crusade for the last couple of years. I've found that a little bit of code duplication is sometimes worth it, to avoid ridiculous complexity that only one guy in your company understands on Tuesdays and Thursdays. Maybe this is an unpopular opinion in a thread full of smart people, but as I age my focus has slowly shifted away from "oh that's so cool!!". I'm waffling on just dropping support for variance and capping at .NET 2 though, which would probably be plenty for the niche that I'm trying to fill.
|
# ? Dec 22, 2017 21:17 |
|
Is it possible in F# to decorate an existing object with an Interface? I've been reading about Object Expressions but it is not clicking with me. So let's say I have a Type of Foo and an Interface of IBar can I make an instance of Foo and let this specific instance implement IBar? Or am I being too smart for my own good? I would like to have a couple of MailboxProcessors that can have different capabilities, which you would put on the specific instance. Mr Shiny Pants fucked around with this message at 12:29 on Dec 24, 2017 |
# ? Dec 24, 2017 12:27 |
|
Mr Shiny Pants posted:Is it possible in F# to decorate an existing object with an Interface? Implementing an interface is a property of a type, not an instance. You could use object expressions to create ad-hoc implementations: code:
You could write a function to convert any Foo to an IBar on the spot, which is probably best done as an augmentation (equivalent of a C#/VB.NET extension method): code:
What are, exactly, the different capabilities you want those MailboxProcessors<'t> to have? I'm betting that the correct answer will be to change the generic argument <'t>, not the processor itself.
|
# ? Dec 24, 2017 13:11 |
|
NihilCredo posted:Snip... Well I got it to work: code:
Well the idea was that I have some outputs or inputs, which I don't know about yet ( a plugin or something ) , and the system would just gather every object that would have the implementation on it. I have a default mailboxprocessor type which I want to use as a base for all the others but it might not have an output or an input etc. Now I don't need to subclass my generic processors into specific versions and all the variations of them. Let's say I have 10 capabilities in different variations ( an input might not have an output or something ) then I would need subclass the generic processor in all the variations right? I was also thinking of just adding a DU of capabilities and querying those, but then I would have no way to know if they are implemented or not. If you have a different idea, I am happy to hear it. Edit: and most importantly: Happy holidays! Mr Shiny Pants fucked around with this message at 13:51 on Dec 24, 2017 |
# ? Dec 24, 2017 13:32 |
|
It sounds like you just want a two-way MBP? If the different inputs / outputs should be processed in the same queue, then use a single MBP instance and organize the inputs / outputs in a DU, as in the example (the messages that expect an output will include an AsyncReplyChannel<'output>). If they should be separate queues, then you can just have different MBPs for each input-output type.
|
# ? Dec 24, 2017 16:13 |
|
Why did you (box foo1 :?> IBar).Send("text") instead of just (foo1 :> IBar).Send(“text”)?
|
# ? Dec 24, 2017 17:47 |
|
raminasi posted:Why did you (box foo1 :?> IBar).Send("text") instead of just (foo1 :> IBar).Send(“text”)? This does not work it seems, with the box keyword it does. It gives: code:
NihilCredo posted:It sounds like you just want a two-way MBP? Not quite, I think. I need to think about this some more. Thanks though.
|
# ? Dec 25, 2017 17:35 |
|
Another F# question, I have a Kinect running and the speechrecognition engine. The recognition engine runs on it's own thread and has to block for it to keep listening. The sensor and engine need to be disposed when stopping the application. This is what I came up with: code:
Still, can this be written better? Mr Shiny Pants fucked around with this message at 12:29 on Dec 27, 2017 |
# ? Dec 27, 2017 12:06 |
|
I've never tried this in F#, but it turns out that F# also has a 'use' and 'using' keyword: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/resource-management-the-use-keyword That should dispose them after your mutex. I'm not sure of F# 'async' actually creates a new thread, I believe it probably just adds a task to the thread pool scheduler. Anyways, since you aren't looping through the task, you can probably just use the 'use' or 'using' context to dispose of your resources. I think I'd get rid of the 'listen' function and put it into a single task. RecognizeAsync() having blocking and non-blocking calls is weird to me, but the combo of RecognizeAsync(RecognizeMode.Multiple) and CancelRecognizeAsync() seem to do most of the work already. I'd make one task for the building of the engine and the RecognizeAsync(RecognizeMode.Multiple) call. When you exit your program, just call CancelRecognizeAsync() from your main thread and the 'use' and 'using' context keywords should dispose of those resources automatically. I'm a bit tired so sorry if this isn't your question or if it doesn't make any sense.
|
# ? Dec 27, 2017 15:53 |
|
I haven't used that API, but I suspect that it's redundant to both put the whole operation inside an async {} block and use the speech engine's async methods. Assuming you want to use the synchronous methods with F#'s async system (for example, because buildGrammar is very heavyweight), I'd do something like this: code:
NihilCredo fucked around with this message at 16:27 on Dec 27, 2017 |
# ? Dec 27, 2017 16:23 |
|
I forgot to put "use" in front of the engine part. But yeah, that is good advice. I came up with the following after some more finagling just after I posted: code:
One thing that is not clear, how do I get the reference to the passed in CancellationToken within the workflow? It seems Async.CancellationToken should do it, but if I cancel this it does not seem to trigger and I can't seem to evaluate a Token.IsCancellationRequested, only if I pass one into the function itself. It does run the finally block if I cancel the passed in one, so that seems ok for now. Thanks guys Edit: One more thing, the Async.RunSynchronously, is that ok to run inside another Async block? I always thought it was to start the "main" Async loop and the it should not be used deeply within the program because it blocks? That is some nice code BTW, I especially like the check connection bit and feeding it into the Parallel bit. Man, I got some more learning to do. Mr Shiny Pants fucked around with this message at 19:30 on Dec 27, 2017 |
# ? Dec 27, 2017 18:59 |
|
Anyone have any good leads on an open source (read “free”) printing library? I am mostly interested in FixedDocuments, since I am producing reports rather than more free form stuff. The only promising hit I got on google costs more than $2,000.
|
# ? Jan 1, 2018 04:39 |
|
LongSack posted:Anyone have any good leads on an open source (read “free”) printing library? I am mostly interested in FixedDocuments, since I am producing reports rather than more free form stuff. The only promising hit I got on google costs more than $2,000. https://msdn.microsoft.com/en-us/library/system.windows.documents.fixeddocument.documentpaginator(v=vs.110).aspx + https://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog.printdocument(v=vs.110).aspx
|
# ? Jan 1, 2018 08:57 |
|
.
Xeom fucked around with this message at 20:25 on Jan 1, 2018 |
# ? Jan 1, 2018 19:55 |
|
OneEightHundred posted:I think you can just... Yeah, but you have to compose the document with controls like grids, borders, list boxes/views, textblocks, etc., and if you want good looking output you have to do things like keep track of how high each line is so you know where to put the next one. It is drearily time consuming, thus my quest for something that would make it easier.
|
# ? Jan 2, 2018 01:01 |
|
|
# ? Jun 1, 2024 18:49 |
|
Does anyone know a clever way with ASP.NET Core to set cache headers only if an optional query parameter is set? For instance if the request is GET /foo?bar=baz I want to set a cache header like cache-control: private, max-age=31536000, but if the request is GET /foo I don't want a cache header. You'd think the VaryByQueryKeys property on the ResponseCache attribute would have something to do with this, but as far as I can tell that's only used for server-side response caching, which I'm not interested in at the moment.
|
# ? Jan 2, 2018 13:31 |