|
crashdome posted:In fact, you should probably just avoid IDisposable unless you absolutely have unmanaged resources inside your class. Or the far more common case of a class with IDisposable fields.
|
# ? Apr 1, 2015 23:50 |
|
|
# ? May 19, 2024 22:03 |
|
So CopyDirectory doesn't do much really, like copying permissions over and things like that. I've found ways around most of these problems thanks to you guys but is there any way to copy the source folder's icon over? Or rather, whatever attribute handles the location of which icon to use for the directory?
|
# ? Apr 2, 2015 00:14 |
|
TheEffect posted:So CopyDirectory doesn't do much really, like copying permissions over and things like that. I've found ways around most of these problems thanks to you guys but is there any way to copy the source folder's icon over? Or rather, whatever attribute handles the location of which icon to use for the directory? I believe that's handled with desktop.ini inside the directory. I think it's hidden and possibly even system by default.
|
# ? Apr 2, 2015 00:22 |
|
Rooster Brooster posted:For a good laugh, Tomas Petricek posted about an "unusual" way to get F#-style pattern matching into C# 6 using Throw-Driven-Development. It's clever, hilarious, and also sad because pattern matching is so useful I momentarily considered trying this out in a real project. What makes that so much better than if statements? Just avoiding the casting? I mean it seems like you could probably well do something similar by saying var str = obj as string; if (str != null) and so on, or by treating the object as dynamic and feeding it to an overloaded method to take advantage of dynamic dispatch. RICHUNCLEPENNYBAGS fucked around with this message at 04:35 on Apr 2, 2015 |
# ? Apr 2, 2015 04:28 |
|
Scaramouche posted:Off the top of my head the &/&&/AndAlso and |/||/OrElse are probably the two biggest 'gotchas' about VB.net as compared to how other languages work. Actually bitwise operators too have a few quirks, maybe brain up on them: I know this was a couple of pages back but it's probably also worth mentioning that 'And' does not short-circuit whereas 'AndAlso' does, likewise 'Or' and 'OrElse'.
|
# ? Apr 2, 2015 10:42 |
|
Scaramouche posted:You sure are correct. Dispose() fixed it, though I didn't try .Close() Rooster Brooster. This is a nice way of not getting the error: http://stackoverflow.com/questions/887831/how-does-the-using-statement-translate-from-c-sharp-to-vb
|
# ? Apr 2, 2015 10:53 |
|
Scaramouche posted:Dispose() fixed it, though I didn't try .Close() The two are equivalent 99% of the time (the 1% being some terribly designed libraries). The general pattern seems to be that Dispose() is always provided for anything you must explicitly clean up, with Close() being provided as an alias if it feels "natural", for streams or other such concepts. Sometimes Close() might also be named Stop() (e.g. for timers).
|
# ? Apr 2, 2015 12:08 |
|
chippy posted:I know this was a couple of pages back but it's probably also worth mentioning that 'And' does not short-circuit whereas 'AndAlso' does, likewise 'Or' and 'OrElse'. This also applies to And/AndAlso and Or/OrElse in the Expressions namespace if you're ever building up Linq expressions.
|
# ? Apr 2, 2015 13:01 |
|
Is there a good rule of thumb for fixing an issue where EF, instead of saving changes, it instead concatenates the changes to the end of what is already there? What things should I be looking at? To be more specific, I have as part of my schema junction tables between a main table and a regular old key-value table, so that for each row in the main table you can have zero, one, or many values from the third table in the junction table. I've tried researching it and setting context.Entry(thingIWantToSave).State = EntityState.Modified; doesn't change anything at all. The way it's stored in my model is that I have a collection of foo, bar, and baz in my actual row that go into my main table, and it's a matter of setting "active" to true or false for the row in the junction table associated with the main table row. The problem is EF just shoves the new changes in as new rows. Is this a navigation property thing?
|
# ? Apr 2, 2015 13:28 |
|
Do you have your keys properly mapped in the model? I can't really make heads or tails of your description but if it is inserting new rows instead of using existing ones, perhaps your key definitions are broken.
|
# ? Apr 2, 2015 13:43 |
|
crashdome posted:In fact, you should probably just avoid IDisposable unless you absolutely have unmanaged resources inside your class. IDisposable can be pretty handy for anything that has a distinct start/stop operation and shouldn't be used when not started. It doesn't just have to be for unmanaged resources. RICHUNCLEPENNYBAGS posted:What makes that so much better than if statements? Just avoiding the casting? Pattern matching is a great way of reducing code without harming the ability to understand it (usually improving it). It's like a more powerful version of switch. For example, look at this FizzBuzz implementation in Rust: Rust code:
|
# ? Apr 2, 2015 14:20 |
|
EssOEss posted:Do you have your keys properly mapped in the model? I can't really make heads or tails of your description but if it is inserting new rows instead of using existing ones, perhaps your key definitions are broken. No it was something else. I think. I'll detail my fix: What I was doing is basically "I'll make a brand new entity collection and shove that in based off of my viewmodel!" This was more lines of code and also didn't work. When I was debugging I saw stuff generated from EF from the DB had munging and metadata which the data from my viewmodels did not have. code:
code:
Was there metadata coming out of EF? Is this some practice I don't know about? What's a good EF6 book?
|
# ? Apr 2, 2015 14:56 |
|
chmods please posted:I believe that's handled with desktop.ini inside the directory. I think it's hidden and possibly even system by default. Hmm. Here's what's in my Desktop.ini- code:
How come I can push files that retain the chosen icon but not directories?
|
# ? Apr 2, 2015 15:27 |
|
Bognar posted:IDisposable can be pretty handy for anything that has a distinct start/stop operation and shouldn't be used when not started. It doesn't just have to be for unmanaged resources. Pattern matching is so awesome, patternmatching over arrays is so nice compared to looping through them.
|
# ? Apr 2, 2015 15:41 |
|
In your first example, it looks like you were simply creating some Entity objects with new, which while they may be the same class you see in a DbSet on your DbContext, they are detached entities and your current DbContext doesn't know anything about them, which is why it tries to insert a row when you add these detached entities to the DbContext. Your second example works because you are directly modifying properties on attached entities, because they are in your FooCollection (which I'm guessing is your DbContext in some capacity). The way to make your code work in the first example is to explicitly attach the Entities to your DbContext, which can be done a couple of ways: http://stackoverflow.com/questions/20451461/save-detached-entity-in-entity-framework-6 I noticed in your first post you actually tried one of these suggestions and it didn't work, and I would guess it has something to do with the way your keys are set up as someone else said.
|
# ? Apr 2, 2015 16:16 |
|
I ran windows update, rebooted and now I can't build my ASP MVC project because System.Web.Mvc looks like this: happened and how do I go about fixing it? Yes I restarted VS. Do I need to repair some dev kit I forgot I installed?
|
# ? Apr 2, 2015 18:30 |
|
Munkeymon posted:I ran windows update, rebooted and now I can't build my ASP MVC project because System.Web.Mvc looks like this: Is it this guy? http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx Also, another 'I've already done but is there a better way' question: I'm parsing files that get downloaded by an FTP job that I don't control, let's say invoices instead of the sexy real thing it is. So every night a WGET script grabs *.csv from an ftp server and copies it here: d:\invoices Then I parse them, and move them to here: d:\invoices\processed The way I'm avoiding double parsing is like this currently: code:
|
# ? Apr 2, 2015 18:48 |
|
Scaramouche posted:Then I parse them, and move them to here: I wouldn't worry about the File.Exists taking too long. It's going to just ask the file system if the file exists or not. If you want to test this just make a bunch of fake "invoices" (like 100,000) and see what happens. I think you should save this in a database so there is some history the work was done.
|
# ? Apr 2, 2015 19:03 |
|
Scaramouche posted:Is it this guy? Yep. Weird that I only got that update this month considering I've been updating this thing ~monthly. quote:Is this premature optimization, or is there a better way? Probably, but if you're worried about it you can clean up /processed monthly or something.
|
# ? Apr 2, 2015 19:08 |
|
Scaramouche posted:Is it this guy? If you don't enumerate all the files in the directory it should work fine, even with 100.000 files in the directory. I think Path.GetFilename already returns a string. A Path.Combine might be nicer. You meant the invoices directory, speedy server? The whole C drive of my machine takes less than a minute to enumerate. Mr Shiny Pants fucked around with this message at 19:30 on Apr 2, 2015 |
# ? Apr 2, 2015 19:25 |
|
I have a Team Foundation Server question: If I edit a file while logged into Team Foundation Server (via Code->Browse->Edit) how does versioning work with that? Does it save the changes as a new version? What happens if I have the file checked out on a different computer? The reason I ask is because I want to make some edits but don't have my dev machine with me. Would this be a good time to look into Visual Studio online, that way I get intellisense and possibly full version control? Edit: I should clarify, I have a visual studio online account by virtue of having TFS. Maybe I'm wrong, but I thought that there was a web based VS version and that's why they migrated TFS into visual studio online a while back. I only use my VS online account for TFS. Essential fucked around with this message at 18:53 on Apr 3, 2015 |
# ? Apr 3, 2015 18:51 |
|
Essential posted:I have a Team Foundation Server question: I'm confused. I think you might be confusing VSO with the user profile support that's built in to Visual Studio 2013 (e.g. when you "log in" to Visual Studio) Visual Studio Online is "cloud hosted" TFS. There's still a separate, on-prem "boxed" product that ships roughly every year (TFS2015 will be out relatively soon and will contain everything in VSO that's not currently in TFS. They're basically the same codebase.) You have to connect Visual Studio to VSO (you can do this in the Team Explorer tab), and then it operates exactly the same as on-prem TFS. There's no magic happening. You still have to check your code in and make commits. You can use either TFVC (centralized version control, similar-to-but-better-than Subversion) or Git as your source control methodology. TFVC is easier to use than Git by several orders of magnitude, but Git is more flexible.
|
# ? Apr 3, 2015 19:03 |
|
e: ^^^ I think he's referring to the VS Online ability to view code and edit on the fly right on the website. I know that in Visual Studio online when you edit a file, the save button is effectively a 'check in' and adds a new change set with the comment "Updated <filename>." The web editor is nice but very, very far off from using even Visual Studio Express (which I don't think supports TFS??). You can always get a single license of VS through VS Online by adding one paid user subscription or by paying for a VS Azure VM (anyone have any experience with this?). e: I should clarify the VS Online "Professional" ($45/m) includes a license of the latest VS and not the "Basic". Although I just also learned if you qualify, VS Community edition is free for up to 5 people even commercially if you have less than 250 PCs or $1m in revenue and is essentially.. VS Pro. crashdome fucked around with this message at 19:16 on Apr 3, 2015 |
# ? Apr 3, 2015 19:08 |
|
crashdome posted:e: ^^^ I think he's referring to the VS Online ability to view code and edit on the fly right on the website. Yep, that's exactly what I'm referring to. So it sounds like I can edit and "check in" the file. I have an MSDN subscription, so it's not a matter of not having access to VS, but I'm using my in-laws computer and don't want to install VS just to make a couple of changes. crashdome posted:The web editor is nice but very, very far off from using even Visual Studio Express (which I don't think supports TFS??). You can always get a single license of VS through VS Online by adding one paid user subscription or by paying for a VS Azure VM (anyone have any experience with this?). For some reason I thought that a true web based version of VS was already out (not a full featured version, but something you could get intellisense & compile code in). I must be way off on that. It would be awesome if the web editor had intellisense though. Ithaqua posted:VSO stuff Yep, that's exactly how I use it now on my dev machines. In this case, my wife made me leave my laptop at home for this trip and I'm trying to get a few things done via the web based VSO editor. Essential fucked around with this message at 19:46 on Apr 3, 2015 |
# ? Apr 3, 2015 19:34 |
|
Essential posted:In this case, my wife made me leave my laptop at home for this trip and I'm trying to get a few things done via the web based VSO editor. I know you just came here for technical advice and probably don't want to hear opinions from some rear end in a top hat who knows both jack and poo poo about you, but: have you considered that your wife made you leave your laptop so you wouldn't try to work on your trip?
|
# ? Apr 3, 2015 20:18 |
|
Essential posted:For some reason I thought that a true web based version of VS was already out (not a full featured version, but something you could get intellisense & compile code in). I must be way off on that. It would be awesome if the web editor had intellisense though. You're probably thinking of "Monaco" which is AFAIK only available for Azure websites and not a full product yet. Bognar posted:have you considered that your wife made you leave your laptop so you wouldn't try to work on your trip? He's probably in the shitter with a smartphone like Robin Williams in RV.
|
# ? Apr 3, 2015 20:25 |
|
Bognar posted:I know you just came here for technical advice and probably don't want to hear opinions from some rear end in a top hat who knows both jack and poo poo about you, but: have you considered that your wife made you leave your laptop so you wouldn't try to work on your trip? I feel bad for my mean response, so I'll just say "Yes Bognar, I'm aware of that". crashdome posted:You're probably thinking of "Monaco" which is AFAIK only available for Azure websites and not a full product yet. Hm, maybe that's it. I'll check it out. Essential fucked around with this message at 23:07 on Apr 3, 2015 |
# ? Apr 3, 2015 21:22 |
|
I'm working on a small project in WPF. Basically, a type of property editor that takes a JSON schema and uses it to generate a form for editing. The point is to allow it to be extensible so you can specify a custom value editor control or other behavior based on extensions in the schema. Logically the JSON document is a tree, but visually its a list of property item rows indented based on their depth in the logical tree. Basically a two-column, n-row grid. The point: I'm not quite sure how to go about generating the property editing items. Sure I know different ways to do it, but not really a good clean way. I know about the whole hierarchal data template thing, but that isn't how the controls are actually organized. That's my real question I guess. What is a good way to go about transforming a logical tree of data into a visual list? Edit: Well I managed to get it working with view models. Had to make a multi-value converter to handle the parent references. Inverness fucked around with this message at 18:21 on Apr 4, 2015 |
# ? Apr 4, 2015 04:16 |
|
ljw1004 posted:The way we have it set up within the VB/C# team at Microsoft is that, for each binary DLL, we upload its symbols to our company's internal symbol server. Also the symbols contain a TFS command to fetch the source. That way VS can automatically pull up the correct symbols, and can automatically pull up the correct source code. (I have no idea how this magic is accomplished...) Thanks for your help. I have to spend time on other things now, but I have some ideas now. Thanks.
|
# ? Apr 7, 2015 10:37 |
|
I'm making a control in Silverlight that's made of several sub-controls and is also part of a larger application with a bunch of other user controls. I want to be able to use common resources in my new control without making them global. Is this C+Ping this into every XAML file the best way to do that?XML code:
|
# ? Apr 7, 2015 19:06 |
|
From my experience with WPF, that's how to do it. Pretty crazy, that the idea is "reference MyResources.xaml" and the code is almost 300 characters full of angle brackets
|
# ? Apr 7, 2015 20:08 |
|
Yeah, it's nuts coming from HTML-land just how verbose some of this is. I was hoping there was a way to jam it into the parent namespace, which I think would work because each control has its own, but I'm not seeing one. And there's still no way to define a data context on the control if the view model doesn't have a default constructor. Fantastic. Munkeymon fucked around with this message at 22:55 on Apr 7, 2015 |
# ? Apr 7, 2015 20:38 |
|
Munkeymon posted:Yeah, it's nuts coming from HTML-land just how verbose some of this is. I was hoping there was a way to jam it into the parent namespace, which I think would work because each control has its own, but I'm not seeing one. If you add it to App.xaml it can be used throughout that project. I think that's what you mean by you don't want to define it globally. Define your sub controls as part of a common wpf project and use it like a library. A bit hacky, but it should work.
|
# ? Apr 7, 2015 23:50 |
|
Munkeymon posted:Yeah, it's nuts coming from HTML-land just how verbose some of this is. I was hoping there was a way to jam it into the parent namespace, which I think would work because each control has its own, but I'm not seeing one. Is there any option for C# desktop apps that isn't totally painful? I'm half-tempted to go with self-hosted WebAPI + browser for my next project
|
# ? Apr 8, 2015 00:51 |
|
RICHUNCLEPENNYBAGS posted:Is there any option for C# desktop apps that isn't totally painful?
|
# ? Apr 8, 2015 01:40 |
|
Visual Studio's pathetic attempt at auto-indenting for Razor templates is loving terrible. Discuss.
|
# ? Apr 8, 2015 03:16 |
|
WPF isn't bad once you get used to it. Authoring a control (not a UserControl) and having it click on how control templates are used was a magical moment. No you can't create components at design time unless they have a default constructor. I just solve that problem by making the default constructor throw if its not design time. Unity or MEF uses the constructor with more arity. Having separate design and runtime constructors is also useful if you want to give your view model design data to see how it looks. Inverness fucked around with this message at 04:08 on Apr 8, 2015 |
# ? Apr 8, 2015 04:05 |
|
The Wizard of Poz posted:Visual Studio's pathetic attempt at auto-indenting for Razor templates is loving terrible. Discuss. The fact that they haven't offered an uncheckable checkbox for this is criminal. I'm literally afraid to Ctrl-V in *.cshtml files because it's SO loving BAD. Edit: gently caress epswing fucked around with this message at 04:24 on Apr 8, 2015 |
# ? Apr 8, 2015 04:21 |
|
Inverness posted:WPF isn't bad once you get used to it. Authoring a control (not a UserControl) and having it click on how control templates are used was a magical moment. I guess my problem is I don't really want to spend that much time on UI and I want, you know, the kind of "Bootstrap" of Windows UI development where there are sensible defaults and I don't usually have to mess with it. If I really knew WPF I guess I could probably use reflection and XML writing to sketch out forms... I've used a similar trick with Angular HTML templates.
|
# ? Apr 8, 2015 04:24 |
|
|
# ? May 19, 2024 22:03 |
|
epalm posted:The fact that they haven't offered an uncheckable checkbox for this is criminal. I'm literally afraid to Ctrl-V in *.cshtml files because it's SO loving BAD. Yep, likewise. *press enter* *razor template screams in agony as it gets twisted and mangled by VS*
|
# ? Apr 8, 2015 04:54 |