|
Gul Banana posted:has anyone been paid to use winrt yet? does anyone know anyone who's been paid to do winrt? Yes, but I work there.... so...
|
# ? Jun 12, 2013 23:56 |
|
|
# ? Jun 4, 2024 19:17 |
|
Dietrich posted:I agree that locking on this is a bad call, but what about locking on a private static dictionary object when reading or writing to it from various threads? Yeah that's fine. As a general rule, don't lock on anything you aren't certain anybody else will be able to lock on without doing stupid reflection tricks, so anything private is a prime candidate. e: does a much better job of explaining the reasons. For dictionaries you may also want to consider refactoring to use a ReaderWriterLockSlim so you can get parallel reads. Night Shade fucked around with this message at 03:26 on Jun 13, 2013 |
# ? Jun 13, 2013 03:23 |
|
PhonyMcRingRing posted:Note: If you want to post back and bind to an array/list, you have to make sure that your form inputs all have names with indexes in them(like Model.SomeList[0], Model.SomeList[1] etc) and those indexes *must* be in order without any skipping. That's the only way the model binder will correctly create a list. Without the indexes, you either get a null or empty list. And if you skip an index everything after the skipped index will be ignored(say you post back for indexes 0, 1, and 3, leaving out 2 will make 3 get ignored). EditorFor will do all of this automatically on a list, just set up the appropriate editor template.
|
# ? Jun 13, 2013 07:57 |
|
I've run into a problem with TcpListener and I can't find any documentation about this on MSDN, so I'm hoping someone here will know what I'm doing wrong. As was suggested in my last foray into this thread, I switched to using asynch (Begin/End) methods to handle the network I/O. I believe I have most of it worked out now, but I'm having some trouble with one particular issue. Specifically, if I call one of the Begin methods (e.g. TcpListener.BeginAcceptSocket), how do I tell it to stop listening so that I can shut down the server? There does not appear to be a designated method for this, and I can't call EndAcceptSocket without an IAsynchState to pass it. I tried just calling TcpListener.Stop, but that just seems to trigger my "accept socket" delegate getting called anyway, and promptly throwing an exception because the listener has been disposed! The code in question: code:
Can anyone tell me what I'm doing wrong?
|
# ? Jun 13, 2013 13:41 |
|
This is a lot more difficult than it should be our I'm missing something obvious. In wpf how do I get the celltemplates defined in a listview control in the code behind? Either I don't understand wpf at all (very likely, New to it), or were doing some idiotic validation on controls. We're using reflection and frameworkelements to dynamically add validation logic to controls. There was a bug were validation want showing on controls in a list, working on it; and turns out they didn't implement collection logic for this method of validation. So here I am.
|
# ? Jun 13, 2013 15:34 |
|
Mr. Crow posted:This is a lot more difficult than it should be our I'm missing something obvious. In wpf how do I get the celltemplates defined in a listview control in the code behind? If you're writing "code behind" in WPF, you're not doing MVVM correctly. That's bad. Use MVVM.
|
# ? Jun 13, 2013 16:25 |
|
Mr. Crow posted:This is a lot more difficult than it should be our I'm missing something obvious. In wpf how do I get the celltemplates defined in a listview control in the code behind? code:
|
# ? Jun 13, 2013 17:25 |
|
Alien Arcana posted:Specifically, if I call one of the Begin methods (e.g. TcpListener.BeginAcceptSocket), how do I tell it to stop listening so that I can shut down the server? There does not appear to be a designated method for this, and I can't call EndAcceptSocket without an IAsynchState to pass it. I tried just calling TcpListener.Stop, but that just seems to trigger my "accept socket" delegate getting called anyway, and promptly throwing an exception because the listener has been disposed! quote:Can anyone tell me what I'm doing wrong? In the case of listener socket shutdown which is what .Stop() does, it throws an ObjectDisposedException as documented on MSDN: http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.endacceptsocket.aspx All you need to do is: code:
|
# ? Jun 14, 2013 02:17 |
|
Ithaqua posted:Oh, and let me mention one of my pet peeves to head it off at the pass, because I see this come up any time IOC comes up: MEF is not an IOC framework. I know this is a few days old, but would you care to expound on that statement? I'm just reading up on IoC and Dependency Injection since it came up in this thread. The IoC wikipedia page lists Dependency Injection as a implementation of IoC. The Dependency Injection wikipedia page in turn lists MEF as a implementation. The Ninject project which you mention as a IoC framework has "dependency injection" written all over its site (although their Wiki is having trouble at the moment). So at first blush without actually having spent time trying to write code with either, it looks like MEF and Ninject are both DI implementations. What's your objection then? That MEF isn't a framework?
|
# ? Jun 14, 2013 17:10 |
|
So is there any way to format a string of the format "1900-01-01 00:00:00.000" as DateTime? Is it actually NULL and I'm just not in the loop? Ugh.
|
# ? Jun 14, 2013 17:11 |
|
Haven't actually used it, but does DateTime.TryParse() handle it?
|
# ? Jun 14, 2013 17:13 |
|
JawnV6 posted:Haven't actually used it, but does DateTime.TryParse() handle it? I was thinking I could just take a SQL datetime to a .NET Datetime and used .Parse, not .TryParse. I guess I can just have an IF statement to catch bad dates and put something else in there, but I do wonder why that particular time is wrong - is it the value or the format? ARGH. Edit: Okay it seems to be NULL. Why then can't it read a string that is something and not NULL and just pass that along or whatever? Fuck them fucked around with this message at 17:19 on Jun 14, 2013 |
# ? Jun 14, 2013 17:17 |
|
2banks1swap.avi posted:So is there any way to format a string of the format "1900-01-01 00:00:00.000" as DateTime? Is it actually NULL and I'm just not in the loop? You don't really "format a string as DateTime". You can have a DateTime object and ToString it, and format that the way you want. Or you can have a string, and parse it, producing a DateTime object. I'd guess you're trying to parse the string "1900-01-01 00:00:00.000" to get a DateTime object. In that case, you could try giving the string to DateTime's Parse static method, but if that chokes, you might have to give it to DateTime's ParseExact static method, and specify exactly where all the digits are. So, roughly, C# code:
epswing fucked around with this message at 17:24 on Jun 14, 2013 |
# ? Jun 14, 2013 17:22 |
|
VVildo posted:I know this is a few days old, but would you care to expound on that statement? I'm just reading up on IoC and Dependency Injection since it came up in this thread. MEF is optimized for plugin type development. It can scan a folder for .net assemblies and find implementations of specific interfaces and make them available for your executing assembly to utilize, without your executing assembly needing to be aware at build time that the plugin assembly even exists. That's really what it's designed to be. I recommend reading Dependency Injection in .NET by Mark Seemann, it really explains all these concepts well and gives a good overview of Castle Windsor, StructureMap, Spring.NET, Autofac, Unity (which is microsoft's IOC container) and MEF. Let me quote him on MEF. Mark Seemann, Dependency Injection in .NET, pg 493 posted:Is MEF a DI CONTAINER? Dietrich fucked around with this message at 17:29 on Jun 14, 2013 |
# ? Jun 14, 2013 17:23 |
|
2banks1swap.avi posted:I was thinking I could just take a SQL datetime to a .NET Datetime and used .Parse, not .TryParse. I guess I can just have an IF statement to catch bad dates and put something else in there, but I do wonder why that particular time is wrong - is it the value or the format? Are you reading out of a SqlDataReader? If so, why do you need to parse anything? If the column's type is nullable datetime then you can do something like this: reader.IsDBNull(0) ? new DateTime?() : reader.GetDateTime(0). If there's no SqlDataReader involved, then I don't know.
|
# ? Jun 14, 2013 17:32 |
|
The actual line of code to parse the string is basically: CultureInfo enUS = new CultureInfo("en-US", true); DateTime.ParseExact(row[2].ToString(), "dd/MM/yyyy hh:mm:ss tt", enUS), (It's a parameter being passed to a constructor, no I don't have a missing semicolon ) When I print the string that comes out of a .ToString() call for row[2], I get "1/1/1900 12:01:00 AM" Why 1/1/1900 12:01:00 AM is not dd/MM/yyyy hh:mm:ss tt is lost to me
|
# ? Jun 14, 2013 17:33 |
|
ninjeff posted:Are you reading out of a SqlDataReader? If so, why do you need to parse anything? If the column's type is nullable datetime then you can do something like this: reader.IsDBNull(0) ? new DateTime?() : reader.GetDateTime(0). Let me echo the importance of using DateTime? instead of DateTime for nullable date columns in SQL. If you don't, you'll end up with a bunch of 1/1/1900 dates in your database and stupid logic to control them. 2banks1swap.avi posted:The actual line of code to parse the string is basically: Is the column a datetime or a string? If it's a datetime, for the love of god don't turn it into a string then re-parse it to a datetime. Dietrich fucked around with this message at 17:36 on Jun 14, 2013 |
# ? Jun 14, 2013 17:33 |
|
ninjeff posted:Are you reading out of a SqlDataReader? If so, why do you need to parse anything? If the column's type is nullable datetime then you can do something like this: reader.IsDBNull(0) ? new DateTime?() : reader.GetDateTime(0). I've basically been cargo-culting and googling how to do my job as a sole jr dev with nobody around within 500 miles at my present and over at the end of today job, so I've just gone from memory and whatever tutorial I've stumbled on. I used SqlDataAdapter to fill a DataTable, and now I'm reading off each element of each row from the DataTable and casting as strings. I should be able to parse a drat string as a DateTime and I've never had this much trouble doing so before.
|
# ? Jun 14, 2013 17:35 |
|
Dietrich posted:Let me echo the importance of using DateTime? instead of DateTime for nullable date columns in SQL. If you don't, you'll end up with a bunch of 1/1/1900 dates in your database and stupid logic to control them. It is a date time. I've had trouble with the typing being correct so I thought "screw it, just make it a string!" because I just want to get done and move the hell on. I guess I need to pull everything from SQL in a way that preserves types, but then I have to cast those SQLTypes to a serializable type before I serialize it because serializing SQL data types is apparently bad.
|
# ? Jun 14, 2013 17:43 |
|
2banks1swap.avi posted:Why 1/1/1900 12:01:00 AM is not dd/MM/yyyy hh:mm:ss tt is lost to me At the risk of ignoring the XY problem others are trying to help with, 1/1 is d/M, not dd/MM. The double letters are for printing 01/01, it helps with filename sorting among other things.
|
# ? Jun 14, 2013 17:43 |
|
2banks1swap.avi posted:It is a date time. I've had trouble with the typing being correct so I thought "screw it, just make it a string!" because I just want to get done and move the hell on. You want to use a SqlDataReader to read data from tables, and that thing has extension methods that will spit out the standard datatypes. You should not have do to any of this manually or even think about it. I also want to repeat my recommendation that you use some sort of ORM. Coding this stuff yourself adds no value to your project and only creates more opportunities to make bugs or security risks. You're dealing with what is commonly known as a solved problem. Don't try to re-solve it.
|
# ? Jun 14, 2013 17:47 |
|
Dietrich posted:You want to use a SqlDataReader to read data from tables, and that thing has extension methods that will spit out the standard datatypes. You should not have do to any of this manually or even think about it. I'm working with ancient code and lazy, remote devs for all of 4 more hours, and then I'm gone, soooooooooo... I'm never going to take this kind of a job again. Fuuuuuuuuuck. Time to gently caress with SqlDataReader then. Edit: So I try reader.GetDateTime(2), and VS says I should put it to a string and parse it first The row is date time. That parameter for the constructor for my model is date time. GetDateTime is supposed to be date time. Why does it want me to make it a string? Fuck them fucked around with this message at 18:05 on Jun 14, 2013 |
# ? Jun 14, 2013 17:49 |
|
2banks1swap.avi posted:Edit: So I try reader.GetDateTime(2), and VS says I should put it to a string and parse it first Can you give us more information about the error?
|
# ? Jun 14, 2013 18:10 |
|
Oh dear god I was mistaken as poo poo the entire time. I broke down every row into it's own variable to step through, and the problem was trying to take a string to an int, and not knowing how to handle a NULL from the DB Ugh. The DateTime went through just fine! Why the error was something to do with that is beyond me, I might have hosed up the argument order for that constructor I was putting things into. poo poo. So, uh, how do you handle NULL coming from the db. That (Type?) trick? Edit: At least my poo poo works when there's data in the row and it isn't NULL. I can't believe I wasted so much time on this Fuck them fucked around with this message at 18:17 on Jun 14, 2013 |
# ? Jun 14, 2013 18:13 |
|
2banks1swap.avi posted:Oh dear god I was mistaken as poo poo the entire time. http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx
|
# ? Jun 14, 2013 18:20 |
|
I'm done here in a few minutes wooo When I get my final paycheck I need to go get some books already. I can't thank everyone here enough, seriously.
|
# ? Jun 14, 2013 18:36 |
|
I need to check a local folder for new files. From the UI perspective they should appear "instantly" to the user. That is, when they drop a file in this folder, then pop back into my app the file should show up in a listbox immediately. The listbox is already bound to an observablecollection, so my question is more on the folder/file checking. The only way I know how to do this is with a DispatcherTimer running a check every 1 second and anytime it finds new files just pop them into the collection. Is that the right way to do that or should I not be running a DispatcherTimer routine every 1 second? Realistically it will only find a file maybe once a day. It's a silveright 5 project so not all libraries are available.
|
# ? Jun 14, 2013 18:56 |
|
2banks1swap.avi posted:Oh dear god I was mistaken as poo poo the entire time. Reference the System.Data.DataSetExtensions assembly in your project, then: code:
|
# ? Jun 14, 2013 19:00 |
|
Essential posted:It's a silveright 5 project so not all libraries are available. I don't know if it's available in Silverlight, but System.IO.FileSystemWatcher lets you observe changes in a directory without polling.
|
# ? Jun 14, 2013 19:11 |
|
Essential posted:I need to check a local folder for new files. From the UI perspective they should appear "instantly" to the user. That is, when they drop a file in this folder, then pop back into my app the file should show up in a listbox immediately. The listbox is already bound to an observablecollection, so my question is more on the folder/file checking. The only way I know how to do this is with a DispatcherTimer running a check every 1 second and anytime it finds new files just pop them into the collection. FileSystemWatcher was built for this e:f,b
|
# ? Jun 14, 2013 19:13 |
|
Zhentar posted:I don't know if it's available in Silverlight, but System.IO.FileSystemWatcher lets you observe changes in a directory without polling. No Safe Word posted:FileSystemWatcher was built for this Not available in Silverlight unfortunately. Wish it was, you guys are right that would be perfect! I'm bummed it's not in SL, drat. I should also add I can't use PInvoke because this has to work on a Mac as well. Essential fucked around with this message at 19:24 on Jun 14, 2013 |
# ? Jun 14, 2013 19:16 |
|
Essential posted:I need to check a local folder for new files. From the UI perspective they should appear "instantly" to the user. That is, when they drop a file in this folder, then pop back into my app the file should show up in a listbox immediately. The listbox is already bound to an observablecollection, so my question is more on the folder/file checking. The only way I know how to do this is with a DispatcherTimer running a check every 1 second and anytime it finds new files just pop them into the collection. Silly question: Why Silverlight for a desktop application? FileSystemWatcher isn't an option because there's no guarantee of a file system.
|
# ? Jun 14, 2013 19:43 |
|
Ithaqua posted:Silly question: Why Silverlight for a desktop application? FileSystemWatcher isn't an option because there's no guarantee of a file system. Not silly, good question. The requirements for this project were: Must have local file system access and must work on PC and Mac. That narrowed it down to Silverlight only, 1 year ago when the project started. As far as I know that's still only a Silverlight domain as the HTML 5 local file access is really only supported in Chrome and even then it's iffy. If anyone knows of a different platform that can accomplish that I'd be very interested to know. We're not going to get away from Silverlight for the foreseeable future, but I would like to know of alternatives. Essential fucked around with this message at 19:50 on Jun 14, 2013 |
# ? Jun 14, 2013 19:48 |
|
http://www.mono-project.com/Main_Page
|
# ? Jun 14, 2013 20:08 |
|
Has anyone ever transferred a BUILD pass before? Due to personal reasons I won't be able to attend and I have a friend checking to see if he can pull it off and take my spot, but all the information I see implies it should only be within your company. Anyone had experience with this?
|
# ? Jun 14, 2013 20:54 |
|
poo poo, there you go. I remember looking at mono before the project kicked off and there was some reason I didn't think it would work, however after looking again I can't see what the issue would be. Well, hindsight. Thanks for the link though.
|
# ? Jun 14, 2013 21:06 |
|
Fastbreak posted:Has anyone ever transferred a BUILD pass before? Due to personal reasons I won't be able to attend and I have a friend checking to see if he can pull it off and take my spot, but all the information I see implies it should only be within your company. Anyone had experience with this? No, but as a conference organizer I know that we don't exactly check if the curtains match the carpet as long as someone pays the transfer fee. So if your friend doesn't care and it doesn't raise issues at the office I think you could just change the name. Speaking of BUILD, is anyone else here going? I missed the last one due to Sandy but I'm scheduled to fly out a week from Tuesday.
|
# ? Jun 14, 2013 22:02 |
|
Dietrich posted:Let me quote him on MEF. That was really helpful! Thanks!
|
# ? Jun 15, 2013 05:13 |
|
Does anyone know how to manually copy projects in vb.net? I have a project I was working on, and I wanted to preserve the 'existing' condition... So I copied it to a new folder with a different name, and did a bunch more coding on it. Problem is, it don't work anymore. There seem to be references to the first project, and all I get is a huge number of system error messages when I try to run it now. There doesn't seem to be anyway to import stuff that works, in VB.net express 2010. Or any way to simply "copy a project" to a different location, and get all the stuff correct.... It might work in the paid version of Visual Studio, but I don't have that. This guy says "you edit the text files with no extensions", but WTF is he talking about? ALL the files I see have extensions. http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/afd73b03-3986-4c94-ac3b-aa8b6c462a68/ I found the FileListAbsolute.txt file and tried editing that, but the first project has a whole bunch more lines in it than the second (non-functioning) project did. Just changing the file paths of the first one and copying them into the second one didn't work. I don't know if this file is an actual build-guide or if it is just a report generated after the fact however.
|
# ? Jun 15, 2013 20:25 |
|
|
# ? Jun 4, 2024 19:17 |
|
edmund745 posted:I have a project I was working on, and I wanted to preserve the 'existing' condition... This is called "source control". It is a solved problem. Use source control. [edit] VS2010 Express doesn't support source control integration from the IDE, but there's no reason to not be using VS2012 Express, which does. You could also limp along with manual source control from outside the IDE, but the fully integrated TFS (or TFS+Git)/VS experience is beautiful and easy to use. New Yorp New Yorp fucked around with this message at 20:34 on Jun 15, 2013 |
# ? Jun 15, 2013 20:27 |