|
JawnV6 posted:No. They are an hour apart. One happens, then an hour goes by, and the second happens. They share a label, that doesn't magically collapse the space/time continuum between those events. Sorry I think you're right, I wasn't noticing the "Z" on the end of those strings.
|
# ? Sep 18, 2015 01:36 |
|
|
# ? Jun 6, 2024 11:22 |
|
There is definitely some debate as to whether there is data loss there. I think it's not so much the problem with the DateTime structure as much as how it initializes the DateTime from the parsed string. Sure, the strings are two different values in UTC time but, if it parses both to local using a method similar as such:code:
whereas what some (I think) are expecting that this instead happens : code:
Interestingly, I wonder if this is the case with the second scenario if we added this as the next line?: code:
Edit2: Also had to adjust times to accommodate real DST for me I guess the moral of the story is that DateTime is really just a label The more I think about it, the more I can see the behavior as something to be expected. crashdome fucked around with this message at 02:22 on Sep 18, 2015 |
# ? Sep 18, 2015 02:02 |
|
How come VS2013 doesn't have the same refactoring options for VB as it does to C#. Extract Method, for example, is missing. if I go here: https://msdn.microsoft.com/en-us/library/ckfya594(v=vs.120).aspx There's mention of something called Refactor! which is supposedly available, but clicking the link takes me somewhere talking about free trials.
|
# ? Sep 18, 2015 10:58 |
|
Bognar posted:The example I provided shows that's not true, information is lost since 1:30AM when DST ends is ambiguous. The only way to avoid this with DateTime is with your third suggestion - specify to parse as UTC (or with RoundTripKind). Sedro posted:
I was wrong, the second option also works which means that information is not being lost. Now, the question I have is why does the equality return true if they're referring to different points in time?
|
# ? Sep 18, 2015 14:29 |
|
Bognar posted:I was wrong, the second option also works which means that information is not being lost. Now, the question I have is why does the equality return true if they're referring to different points in time? The strings are both equal length?
|
# ? Sep 18, 2015 14:33 |
|
Bognar posted:I was wrong, the second option also works which means that information is not being lost. Now, the question I have is why does the equality return true if they're referring to different points in time? I believe Jon Skeet goes over most of this in a blog post. However, it comes down to the Kind property on the DateTime object.
|
# ? Sep 18, 2015 14:54 |
|
Bognar posted:I was wrong, the second option also works which means that information is not being lost. Now, the question I have is why does the equality return true if they're referring to different points in time? Because they are the same time according to the hosed up, wrong-headed bullshit that is the Daylight Savings Time system.
|
# ? Sep 18, 2015 16:00 |
|
I have a Func(TFoo, IENumerable(Of TBar)) being passed into a method. I can use it to a get a Foo's collection of Bar's by passing the Foo into the Function. So, I'd be passing in something like Function(f) f.Bars Thing is, I also want to assign a new collection of Bar's to the property as well. Can I do this? Or do I need to be passing in an Expression or something instead?
|
# ? Sep 18, 2015 16:16 |
The settings + event function worked perfectly., thanks dudes. If anyone wants a super lightweight launcher for twitch streams using that liverstreamer thing, let me know
|
|
# ? Sep 18, 2015 16:27 |
|
chippy posted:I have a Func(TFoo, IENumerable(Of TBar)) being passed into a method. I can use it to a get a Foo's collection of Bar's by passing the Foo into the Function. So, I'd be passing in something like Function(f) f.Bars addendum: Basically, I want to check if Foo.Bars is Null or not, and assign a new List of Bars if it is. But the property name and type itself may change.
|
# ? Sep 18, 2015 16:46 |
|
Two options that I can think of: 1. Add another parameter to the function of type Action(TFoo, IEnumerable(Of TBar)) that you can use as a setter. 2. Change the type of the Func parameter to Expression(Func(TFoo, IEnumerable(Of TBar))) and get the property info from the MemberExpression, then use GetGetMethod and GetSetMethod to get and set the property. Option 1 is easier to write, option 2 is easier to use. If you need more info on 2 I can go into greater detail.
|
# ? Sep 18, 2015 17:28 |
|
Bognar posted:Two options that I can think of: Thanks. I came up with something similar to #2. Just leaving work now, put I'll post it up on Monday, as wouldn't mind some feedback, there's probably a more elegant way of doing it than what I came up with.
|
# ? Sep 18, 2015 18:02 |
|
chippy posted:How come VS2013 doesn't have the same refactoring options for VB as it does to C#. Extract Method, for example, is missing. We finally overhauled the refactorings in VS2015. Now there are more refactorings, and VB has them all too, and it's actually even possible to write your own refactorings if you want using something called "Roslyn Analyzers". Also VS2015 is faster at compiling VB code.
|
# ? Sep 18, 2015 21:56 |
|
Google Butt posted:The settings + event function worked perfectly., thanks dudes. If anyone wants a super lightweight launcher for twitch streams using that liverstreamer thing, let me know I've been meaning to code something up for this so I'm interested in whatever you have.
|
# ? Sep 19, 2015 17:09 |
Speaking of which, I'm stuck again. I'm trying to add a pop-up triggered by a button that will launch the streamer's chat. I've gotten so far as to launch a second window with a frame and webbrowser inside of it using this line in the second window's code:code:
code:
Google Butt fucked around with this message at 22:39 on Sep 19, 2015 |
|
# ? Sep 19, 2015 20:13 |
Google Butt posted:Speaking of which, I'm stuck again. I'm trying to add a pop-up triggered by a button that will launch the streamer's chat. I've gotten so far as to launch a second window with a frame and webbrowser inside of it using this line in the second window's code: Took all day but I figured it out. Feels good. Here it is for whoever wants it.. stores your previous inputs and it will open the chat of your streamer. The chat uses roughly 4 times the memory of MPC-HC with a stream at source quality, but that's still half the memory and 1/10th the cpu usage of Firefox at source quality. The chat uses the IE wrapper, still ends up being half the usage of the Firefox popout chat. Not a lot in the grand scheme of things, but if you want to play a high cpu usage game and watch a stream at the same time, saving 10-20% cpu usage can be nice! Edit: For those of you with really a low spec pc/laptop or want to reduce your cpu/mem usage even further, going from source to high halves that. Google Butt fucked around with this message at 23:31 on Sep 20, 2015 |
|
# ? Sep 20, 2015 08:10 |
|
chippy posted:Thanks. I came up with something similar to #2. Just leaving work now, put I'll post it up on Monday, as wouldn't mind some feedback, there's probably a more elegant way of doing it than what I came up with. So, this is what I came up with. By the way, the purpose of the method is something completely different, the checking of the property for null and assigning it a new collection if it is null, is just something it incidentally needs to do (quite a lot of times) but I've removed all the stuff unrelated to this. code:
edit: called like this: code:
chippy fucked around with this message at 09:09 on Sep 21, 2015 |
# ? Sep 21, 2015 08:51 |
|
To be honest, I don't completely understand the line that creates assignmentExpression (thanks SO) so I'd love if someone could explain that to me. e: And by the way, the actual aim was to create a generic implementation of the method given here: https://www.tritac.com/bp-24-dapper-net-by-example under 'A parent object with its child objects'. chippy fucked around with this message at 10:41 on Sep 21, 2015 |
# ? Sep 21, 2015 10:29 |
|
If you're only going one level deep, (e.g. foo.Bars, not foo.Bar.Bazzes) then you could simplify it a bit by using PropertyInfo. I've put an example together here: https://dotnetfiddle.net/9j3BS3 In your code, the assignment expression line is programmatically creating a function that does this: Visual Basic .NET code:
Bognar fucked around with this message at 16:00 on Sep 21, 2015 |
# ? Sep 21, 2015 15:56 |
|
From last page:epalm posted:What's grinding my gears is SQL Server and C# do different things by default. Which project manager allowed that one? ShimaTetsuo posted:Probably the same one who allowed the same discrepancy between the rounding in Excel and in Excel-VBA. Microsoft get your poo poo TOGETHER What's really crazy is that using decimal.Round(decimal, int) in C# uses MidpointRounding.ToEven by default, HOWEVER using the same function call in a C# linq query executed on SQL Server ultimately uses MidpointRounding.AwayFromZero. So it's more than just "SQL Server does this by default, C# does that by default". It's "your C# code uses a different MidpointRounding depending on the context"
|
# ? Sep 22, 2015 02:26 |
|
epalm posted:What's really crazy is that using decimal.Round(decimal, int) in C# uses MidpointRounding.ToEven by default, HOWEVER using the same function call in a C# linq query executed on SQL Server ultimately uses MidpointRounding.AwayFromZero. So it's more than just "SQL Server does this by default, C# does that by default". It's "your C# code uses a different MidpointRounding depending on the context" Yeaahhh, but things get weird when you deal with IQueryable and SQL since the Expression code isn't being run, just parsed and transformed. This also results in string.Contains or string.Equals being case insensitive and other minor differences.
|
# ? Sep 22, 2015 04:40 |
|
These kinds of things are pretty much inevitable if you want c# code to basically compile into SQL at runtime and execute in your database. It's amazing they've made it as close as it is to the "real thing."
|
# ? Sep 22, 2015 07:26 |
|
fleshweasel posted:These kinds of things are pretty much inevitable if you want c# code to basically compile into SQL at runtime and execute in your database. It's amazing they've made it as close as it is to the "real thing." That's why I love FSharp.Data.SqlClient so much. Give me the type safety and otherwise just let me write straight SQL: it's easier (and far, far more useful) to learn to write good SQL than to learn the quirks of an ORM's DSL.
|
# ? Sep 22, 2015 08:08 |
|
NihilCredo posted:That's why I love FSharp.Data.SqlClient so much. Give me the type safety and otherwise just let me write straight SQL: it's easier (and far, far more useful) to learn to write good SQL than to learn the quirks of an ORM's DSL. Fsharp's Type providers are pretty awesome compared to an ORM. Though I do like PetaPoco for data access in C#.
|
# ? Sep 22, 2015 08:13 |
|
epalm posted:From last page: Since we're complaining -- string.Compare, string concatenation? Come on. Also if you can write DbFunctions.TruncateTime(someDate) you really should be able to write someDate.Date too. At the very least it would be nice if there were an easy way to verify that an expression could be translated that didn't involve just running it.
|
# ? Sep 22, 2015 11:49 |
Is there a way in visual studio to check a project for all uses of any enums? I'm having serialization problems with them, but its not just one specific enum, and I have a few hundred of them to sort out (tool generated).
|
|
# ? Sep 23, 2015 20:29 |
|
What options are available for security when connecting a web service to a remote MySQL database, specifically on the web service side? Because I'm not aware of any. I have a client who is finally starting to get serious about security so they bought and installed an SSL cert and now only allow secure connections to their database. My knowledge on this is that security lies entirely on their end by: implementing SSL and restricting users to only the db/tables/roles that are needed. I have implemented SslMode=Required into my connection string, but I have no idea what else they expect me to do. However, their IT guy is insistent that I must implement security measures on my end and I'm really at a loss on what to do. The connection string is stored in web.config (not encrypted). He sent me there PEM cert file for their SSL, which they've already implemented to secure connections coming into their server, I'm trying to explain that I don't need the cert but he thinks I do. Am I missing something obvious/important here that I really do need to do?
|
# ? Sep 23, 2015 20:36 |
|
Manslaughter posted:Is there a way in visual studio to check a project for all uses of any enums? I'm having serialization problems with them, but its not just one specific enum, and I have a few hundred of them to sort out (tool generated). Do a find/replace over the declaration page for "public enum " -> "public enum BUTTS_", then go through the error list? (Also known as the "wow girl these hammer-shaped glasses are really makin' you look thin and sharp" method.)
|
# ? Sep 23, 2015 20:53 |
|
Manslaughter posted:Is there a way in visual studio to check a project for all uses of any enums? I'm having serialization problems with them, but its not just one specific enum, and I have a few hundred of them to sort out (tool generated). Write a unit test or something with the below code. code:
|
# ? Sep 24, 2015 00:02 |
|
Other options: - Code Lens - Architecture tools (code map, dependency graph) - Parse codebase with Roslyn, spit crap out to console/file/whatever
|
# ? Sep 24, 2015 00:12 |
|
We're really struggling to get something working and I hope someone here has some ideas. We have a product that we sell that needs to support Firebird and SQL Server. We're developing a new product for those same customers, so it also needs to support both. I'm wondering how on Earth I could possibly get this to work with Entity Framework? We came up with the bright idea of including two SSDLs and swapping them out in the connection string, depending on what database type they were using. This works well enough except the Firebird SSDL generated by Visual Studio is incorrect - it maps the database types incorrectly. I suspect this is ultimately the fault of Firebird's dodgy Entity Framework Provider. I was hoping, though I know it's unlikely, that someone here has some experience with this - we've been beating our heads against this particular wall all day and we're getting nowhere.
|
# ? Sep 24, 2015 06:55 |
|
No experience with Firebird whatsoever, but if it comes down to it you can try to fix the bugs in their EF provider: http://sourceforge.net/p/firebird/NETProvider/ci/master/tree/NETProvider/src/
|
# ? Sep 24, 2015 14:12 |
|
Essential posted:Am I missing something obvious/important here that I really do need to do? Set goals, define the attack vectors you want to defend against, plan the security approach. Just throwing security measures at the wall is better than nothing but I recommend you have a sit-down with your client and talk through what the purpose of this is and then figure out the appropriate steps to tackle it.
|
# ? Sep 24, 2015 20:57 |
|
EssOEss posted:Set goals, define the attack vectors you want to defend against, plan the security approach. Just throwing security measures at the wall is better than nothing but I recommend you have a sit-down with your client and talk through what the purpose of this is and then figure out the appropriate steps to tackle it. Good point and that's effectively what the conversation I had with them turned into. What they are ultimately after is secure connections to their server and db users having the minimum rights necessary to do what they need to.
|
# ? Sep 25, 2015 15:54 |
|
I'm trying to implement basic validation on some cells in a WPF DataGrid, and I'm having trouble. To start I'm just trying to get the straightforward default red box around a cell if the user enters a non-numeric value in a field that needs to be numeric, but the red box isn't showing up. My reading of How to: Implement Validation with the DataGrid Control seems to be that all I need to do is define the DataGrid column like <DataGridTextColumn Header="Value" Binding="{Binding Value, ValidatesOnDataErrors=True}" />, but it's not working. Googling this is really hard because apparently the problem most people have is that they want to get rid of the red box, not figure out why it's missing. I know that the setter is failing when the input is wrong - I can see the correct exception being thrown when I have a debugger attached, and when there's invalid cell contents, you can't edit any other cell.
|
# ? Sep 25, 2015 23:20 |
|
There are two possibilities for validation: ValidatesOnExceptions and ValidatesOnDataErrors. You mention an exception, so perhaps you are trying to use the latter with exceptions, instead of the former? The latter requires you to implement the IDataErrorInfo interface and is generally the way I would recommend you go, as exceptions are of very limited practical usefulness due to their inflexibility (e.g. you cannot really handle interdepentent validation of data fields).
|
# ? Sep 26, 2015 11:25 |
|
GrumpyDoctor posted:I'm trying to implement basic validation on some cells in a WPF DataGrid, and I'm having trouble. To start I'm just trying to get the straightforward default red box around a cell if the user enters a non-numeric value in a field that needs to be numeric, but the red box isn't showing up. My reading of How to: Implement Validation with the DataGrid Control seems to be that all I need to do is define the DataGrid column like <DataGridTextColumn Header="Value" Binding="{Binding Value, ValidatesOnDataErrors=True}" />, but it's not working. Googling this is really hard because apparently the problem most people have is that they want to get rid of the red box, not figure out why it's missing. I don't have a specific answer for you, but if you continue to have problems with the DataGrid control, consider using a ListView with its built-in GridView style instead. I'm pretty sure DataGrid is a holdover from the old style of data binding (binding a control directly to an ADO DataTable/DataSet so as to allow users to directly read and update database values ) and when I was working with WPF/MVVM I had no end of problems getting it to look and behave the way I wanted. I found the listview much easier to work with and customize.
|
# ? Sep 26, 2015 16:21 |
|
This is a long shot, but does anyone use SqlChangeMonitor for cache subscription/invalidation? We switched to it recently, are getting deadlocks and now our generally performant queries are slow when the server is under load.
|
# ? Sep 26, 2015 22:03 |
|
query notification is slow and interferes with MVCC https://msdn.microsoft.com/en-us/library/ms187528.aspx explains the limitations. the short version is, don't use it unless the db is not a bottleneck.
|
# ? Sep 27, 2015 01:38 |
|
|
# ? Jun 6, 2024 11:22 |
|
Gul Banana posted:query notification is slow and interferes with MVCC
|
# ? Sep 27, 2015 12:50 |