Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

wwb posted:

^^^^ this. It is basically the only plugin I use and I'm honestly not sure if I could use visual studio without it.

Insofar as your MSBuild woes go, TeamCity won't help you that directly -- you need to be able to effectively build it from the command line to get much mileage. But once you get there it pays off in spades.

Every time I use VS without ReSharper, I have this moment of shock. "I'm supposed to remember what namespace things are in and add using directives? Lame!"

Adbot
ADBOT LOVES YOU

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
To be fair, Visual Studio has the built-in Shift+Alt+F10 that will do the same thing. But it's much slower and requires explicit action, unlike ReSharper which will pop up that nice thing where you just have to hit alt+enter.

Sab669
Sep 24, 2009

I've never used it / we don't use it in the office, looking over their webpage I don't think I understand their Navigation features tab. How is it different from simply right click -> Go to definition with "vanilla" VS, or as you pointed out Ithaqua, often it seems like VS will know what the proper namespace is if I start to type something and right click -> Resolve.

wwb
Aug 17, 2004

The shirts jetbrains is handing out here say "Keep calm and hit alt-enter".

JetBrains rocks.

Edit: ^^^^ no idea except that is a relatively new feature in Visual Studio, I think 2010 got it first.

epswing
Nov 4, 2003

Soiled Meat

Orzo posted:

To be fair, Visual Studio has the built-in Shift+Alt+F10 that will do the same thing. But it's much slower and requires explicit action, unlike ReSharper which will pop up that nice thing where you just have to hit alt+enter.

Not that I dislike ReSharper, but isn't "hitting Alt+Enter" an explicit action? "Ctrl+Period, Enter" will add my using directives just fine and seems like the same amount of work, no?

Essential
Aug 14, 2003
Hey guys, I apologize as I know this has been answered a number of times already, but what is a good library for logging errors, both client side and server side? I'd prefer something that can store the logs in a sql azure database or even azure storage. This is a Silverlight app so my options may be limited.

Am I right in thinking there is a better tool/library for this kind of thing than just pushing it into a database myself? Google is bringing up quite a few such as elmah, log4net, etc.

I know logging has come up before, but I don't know if it was specfic for error logging or if it was application wide logging. Is it worth looking into logging actual application use and is that something that any of you do? How you would decide if it was worth it or not? Number of users, distance of users? That's very open ended but I would like to know some of your thoughts when deciding things like that.

wwb
Aug 17, 2004

Visual Studio also didn't add usings until vs2008 or so. Current versions are so vastly superior to what came before it isn't even funny. Go try and use VS2003 or 2005 without resharper and let me know how it feels.

With the caveat that I know very little about silverlight outside of visceral hate, you might want to go look at NLog or log4net on the server side. I suspect nlog might have a silverlight client. Either of those tools are capable of logging to a DB via configuration.

Essential
Aug 14, 2003

wwb posted:

With the caveat that I know very little about silverlight outside of visceral hate, you might want to go look at NLog or log4net on the server side. I suspect nlog might have a silverlight client. Either of those tools are capable of logging to a DB via configuration.

NLog looks pretty good, thank you! And yep it works with Silverlight.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
I have to do a 90 minute web presentation on TDD in July. I figure I'll talk for 10-15 minutes and burn through a few slides, then dive into a live demo where people get to watch me write some code. I'm trying to decide what to do... I'm thinking of running through Roy Osherove's string calculator, but I'm open to other suggestions.

I hate giving web presentations. I did an async/await talk at a user group a few months ago and that was great, because I could look at the audience and gauge their reactions and adjust accordingly, and also have them interrupt me to ask questions.

If anyone's interested in attending to watch me make an rear end out of myself, PM me and I'll send you the URL. I'd just post a link but I'm kinda reticent to post anything here that ties me back to my employer.

Dietrich
Sep 11, 2001

Ithaqua posted:

I have to do a 90 minute web presentation on TDD in July. I figure I'll talk for 10-15 minutes and burn through a few slides, then dive into a live demo where people get to watch me write some code. I'm trying to decide what to do... I'm thinking of running through Roy Osherove's string calculator, but I'm open to other suggestions.

I hate giving web presentations. I did an async/await talk at a user group a few months ago and that was great, because I could look at the audience and gauge their reactions and adjust accordingly, and also have them interrupt me to ask questions.

If anyone's interested in attending to watch me make an rear end out of myself, PM me and I'll send you the URL. I'd just post a link but I'm kinda reticent to post anything here that ties me back to my employer.

I used the string calculator test as the technical test for my last batch of interviews. It is pretty solid, but make sure you introduce requirements one at a time and explain how the test process can help you deal with mutating business requirements without a regression bug.

By the by, you wouldn't believe how many applicants knew nothing about the string manipulation stuff built in to .net and went for the begins with and ends with methods. Plan out your code ahead of time and if you use stuff off the beaten path, maybe give a quick word on the static string methods.


I need to figure out where the good developers in this city are hiding.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Dietrich posted:

I used the string calculator test as the technical test for my last batch of interviews. It is pretty solid, but make sure you introduce requirements one at a time and explain how the test process can help you deal with mutating business requirements without a regression bug.

Yeah, that's my plan. I'm going to "spoiler" the specs and reveal them one by one, and for every test go through arrange/act/assert, then "red, green, refactor". With emphasis on refactor, because I hear people complain all the time that TDDed code is ugly because it was developed without a plan.

I'm also going to run through the kata tomorrow and make notes to refer to during the live coding part.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

epalm posted:

Not that I dislike ReSharper, but isn't "hitting Alt+Enter" an explicit action? "Ctrl+Period, Enter" will add my using directives just fine and seems like the same amount of work, no?
ReSharper pops the suggestion up automatically if the unresolved symbol is anywhere on your screen--it also highlights it red immediately. VS requires you to click on it, and even then it's a tiny little accelerator underline under the first character or something. I know this sounds pretty trivial but the difference is fairly dramatic in terms of usability. Anyway, that's just one thing out of about 100 that ReSharper does awesomely.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Orzo posted:

ReSharper pops the suggestion up automatically if the unresolved symbol is anywhere on your screen--it also highlights it red immediately. VS requires you to click on it, and even then it's a tiny little accelerator underline under the first character or something. I know this sounds pretty trivial but the difference is fairly dramatic in terms of usability. Anyway, that's just one thing out of about 100 that ReSharper does awesomely.

One thing ReSharper calls out that I love is code simplification. I frequently end up doing something silly like foo.Where(bar=>bar>10).First(). ReSharper will call that out and fix it so it's just foo.First(bar=>bar>10).

It's also great for removing unnecessary using directives, calling out naming convention violations (which we all know that I'm anal about), converting foreach->LINQ and vice versa, reminding you when something can (and probably should) be readonly, finding unused methods/fields, and warning about accessing modified closures (which has absolutely saved me from shooting myself in the foot).

It's one of those tools that does a ton of stuff and everyone has a different thing they love best about it. I installed it and was in love after about 5 minutes. And it's really pretty cheap, especially if you can get an employer to foot the bill.

Funking Giblet
Jun 28, 2004

Jiglightful!
Or the best four shortcuts.

CTRL+n
CTRL+shift+n
CTRL+alt+shift+n
CTRL+alt+space when typing any class name from any dll.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.

Ithaqua posted:

Yeah, that's my plan. I'm going to "spoiler" the specs and reveal them one by one, and for every test go through arrange/act/assert, then "red, green, refactor". With emphasis on refactor, because I hear people complain all the time that TDDed code is ugly because it was developed without a plan.

I'm also going to run through the kata tomorrow and make notes to refer to during the live coding part.
Any chance of making this available after the presentation? I'd definitely be interested in watching it.

I also love Resharper. I feel like its made me a better programmer, with easier to read code and I find myself automatically sticking to conventions. I'm pretty sure that the next time I interview, I'm going to ask about Resharper during the process.

glompix
Jan 19, 2004

propane grill-pilled
ASP.NET MVC goons! I'm catching up on the framework features and am not really sure how to avoid ending up with a /Views/Shared/EditorTemplates folder that's a mile long. The project I worked in before started nearly as soon as the framework was released, so we wrote our own binding, validation, and HTML helpers. I want to start using the built in stuff, though. Before, I just used partial views to achieve the same thing, (which was easy to keep organized across a big application) but can't here. Any tips?

zokie
Feb 13, 2006

Out of many, Sweden

glompix posted:

ASP.NET MVC goons! I'm catching up on the framework features and am not really sure how to avoid ending up with a /Views/Shared/EditorTemplates folder that's a mile long. The project I worked in before started nearly as soon as the framework was released, so we wrote our own binding, validation, and HTML helpers. I want to start using the built in stuff, though. Before, I just used partial views to achieve the same thing, (which was easy to keep organized across a big application) but can't here. Any tips?

It would help if you specified the actual problem you are trying to solve/solving. Personally I've only used EditorTemplates for formating DateTimes to different stuff... But I guess I have similiar "problems", I tend to get a lot of shared partial views that are needed everywhere.

glompix
Jan 19, 2004

propane grill-pilled

zokie posted:

It would help if you specified the actual problem you are trying to solve/solving. Personally I've only used EditorTemplates for formating DateTimes to different stuff... But I guess I have similiar "problems", I tend to get a lot of shared partial views that are needed everywhere.

Good call. This seems like it should be really basic. Here's a model:

code:
public class Parent
{
    public IList<Child> Children { get; set; }
}

public class Child
{
    /* Lots and lots of editable properties. */
}
And here's the way a view would look:

code:
@model Parent

@foreach (var child in Model.Children)
{
	<div class="child-container">
		@Html.EditorFor(m => child)
	</div>
}
I tried a partial view first, but it looks like the parent context is lost. (the name attribute doesn't have the needed Parent_ prefix) Same goes for a child action.

One caveat is that I'm working with a really lovely database schema where the children are defined on the parent table like "Child1Prop1, Child1Prop2, Child2Prop1 ..." for 6 children. I'm using NHibernate and have Children as an unmapped collection and just build it when the parent is constructed.

JawnV6
Jul 4, 2004

So hot ...
I have a button that needs to toggle once clicked. It kicks off a process that will complete and return the button to normal, a click between that time it'll kill the process. It's functionality changes and the user needs to know in a big, obvious way. Right now I'm just setting the .BackColor and it looks terrible. There's a white border between the BackColor and the edge of the button, just looks janky. I thought it would look more like Qt's "background-color: green".

What's the best way to change the visual style of a button?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

JawnV6 posted:

I have a button that needs to toggle once clicked. It kicks off a process that will complete and return the button to normal, a click between that time it'll kill the process. It's functionality changes and the user needs to know in a big, obvious way. Right now I'm just setting the .BackColor and it looks terrible. There's a white border between the BackColor and the edge of the button, just looks janky. I thought it would look more like Qt's "background-color: green".

What's the best way to change the visual style of a button?

The best way? Use WPF, then you have an insane amount of control over how your UI appears. Why not just change the text to "Cancel" and display a never-ending progress bar to show that it's "working"?

JawnV6
Jul 4, 2004

So hot ...
The user will hear the process happening, it's out in the real world making widgets move. When they hear it going off the rails I want an obvious go-to for them to cancel it. The button right underneath their cursor when they kicked it off is a good spot. I just need a non-crappy way to show that if they happen to look at the screen.

Are you saying plain old windows forms can't color a stupid button all one shade?

crashdome
Jun 28, 2011

JawnV6 posted:

The user will hear the process happening, it's out in the real world making widgets move. When they hear it going off the rails I want an obvious go-to for them to cancel it. The button right underneath their cursor when they kicked it off is a good spot. I just need a non-crappy way to show that if they happen to look at the screen.

Are you saying plain old windows forms can't color a stupid button all one shade?

Checkboxes have a property that makes them appear as toggle buttons. I change the backcolor as an indicator on them all the time. Looks fine to me. Especially if you use the operating systems original theme style and not that classic windows 95 crap :barf:

RICHUNCLEPENNYBAGS
Dec 21, 2010
Is there a decent reference I could refer to understand like, enough of C++ that I can read documentation on Win32 stuff and understand it well enough to work with it in C#? I mean in particular I have trouble understanding what all the data types for arguments to functions are supposed to be.

raminasi
Jan 25, 2005

a last drink with no ice
If you're trying to wrap your head around P/Invoke stuff, the piece you're missing isn't C++ knowledge. P/Invoke is just a pain. Maybe give something like this a shot?

Otherwise I don't understand your question.

Potassium Problems
Sep 28, 2001

RICHUNCLEPENNYBAGS posted:

Is there a decent reference I could refer to understand like, enough of C++ that I can read documentation on Win32 stuff and understand it well enough to work with it in C#? I mean in particular I have trouble understanding what all the data types for arguments to functions are supposed to be.
There's pinvoke.net, which is a .NET reference for Win32 dll imports, if that's what you're asking.

RICHUNCLEPENNYBAGS
Dec 21, 2010

GrumpyDoctor posted:

If you're trying to wrap your head around P/Invoke stuff, the piece you're missing isn't C++ knowledge. P/Invoke is just a pain. Maybe give something like this a shot?

Otherwise I don't understand your question.

Like look at this: http://msdn.microsoft.com/en-us/library/windows/desktop/bb530498(v=vs.85).aspx

I don't really know what HWND, LPCWSTR, or DWORD are supposed to be and I feel like I'd probably understand it better if I had some basic knowledge of Windows C++ programming? I mean you can look these things up one-by-one I guess, but that's a pain and leads to a really shallow understanding.

Sedro
Dec 31, 2008
This page has a table which maps Win32 types to CLR types. It can come in handy since even pinvoke.net is full of small errors like mapping DWORD to int.

raminasi
Jan 25, 2005

a last drink with no ice

RICHUNCLEPENNYBAGS posted:

Like look at this: http://msdn.microsoft.com/en-us/library/windows/desktop/bb530498(v=vs.85).aspx

I don't really know what HWND, LPCWSTR, or DWORD are supposed to be and I feel like I'd probably understand it better if I had some basic knowledge of Windows C++ programming? I mean you can look these things up one-by-one I guess, but that's a pain and leads to a really shallow understanding.

A "really shallow understanding" is pretty much what you want with P/Invoke - time spent getting a deep understanding of it is not well spent. If you're having to do so much detailed P/Invoke work that it feels like learning it really well is worth it, there's likely a better way to do what you're doing. (Common ones include digging around for a poorly-documented .NET interface, creating your own with C++/CLI, or grabbing someone else's code that's already solved the problem.)

Plus - and I can see why this might not be obvious - Microsoft's stable of typedefs aren't indicative of a whole new programming paradigm that you need to learn to be able to talk to their APIs. They just like typedefs. Here's the extremely technical documentation for a DWORD. It's even worse for a LPCWSTR.

If you have some specific P/Invoke thing you're trying to do, post it here and we'll try to help you out.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



JawnV6 posted:

The user will hear the process happening, it's out in the real world making widgets move. When they hear it going off the rails I want an obvious go-to for them to cancel it. The button right underneath their cursor when they kicked it off is a good spot. I just need a non-crappy way to show that if they happen to look at the screen.

Are you saying plain old windows forms can't color a stupid button all one shade?

You can put an image in a button and swap a big green go button for an equally big red stop image.

Munkeymon fucked around with this message at 17:36 on Jun 28, 2013

epswing
Nov 4, 2003

Soiled Meat
Quick resharper question. My WPF project has a folder named src, where App.xaml.cs is located. Its namepsace is namespace MyProj.src, but resharper tells me Namespace does not correspond to file location, should be: 'MyProj'

The file location is MyProj/src/App.xaml.cs, so why is resharper complaining?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

epalm posted:

Quick resharper question. My WPF project has a folder named src, where App.xaml.cs is located. Its namepsace is namespace MyProj.src, but resharper tells me Namespace does not correspond to file location, should be: 'MyProj'

The file location is MyProj/src/App.xaml.cs, so why is resharper complaining?

Why on earth would you put a "src" folder within your project? That doesn't make any sense. And having it included in the namespace is even worse. The namespace should be organizing your classes, just like folders are for organizing your classes. Thus it follows that your folder structure is equivalent to your namespace. But if you were to compile your code and distribute it, is the "src" namespace going to make sense? Nope! It offers no organizational value, and shouldn't be part of the namespace.

I think what you're seeing is actually a bug in ReSharper. I was having the same thing happening until I moved the file out of the folder, then used ReSharper's quick fix to create the folder and move the file into it. After that, it was correctly identifying folders as part of the namespace.

New Yorp New Yorp fucked around with this message at 16:44 on Jun 28, 2013

zokie
Feb 13, 2006

Out of many, Sweden
Can't you just uncheck the namespace provider property of the folder? Sometimes I do that when I need folders to organize it for myself but still want stuff to have the same namespace. It will still gently caress it up when making a new class with Alt+C though...

Edit: I read good after just eating way too spicy food.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

zokie posted:

namespace provider property

:monocle:

I never noticed that before. That's the problem epalm is having, then.

Dirk Pitt
Sep 14, 2007

haha yes, this feels good

Toilet Rascal
When will .net developers learn that tinkering with defaults causes problems?

crashdome
Jun 28, 2011
Tinkering with defaults is the only way to ensure no one will ever mess with your stuff.

wwb
Aug 17, 2004

I think step 1 in most of my projects is "delete all default settings"

I'm also masochist.

Sab669
Sep 24, 2009

Is there any reason to use the ToString method on, say, and integer instead of just appending an empty string (ie. myInt + "") when something wants a string? I feel like they accomplish the same thing, but I wasn't sure if there was some added security to the ToString route instead.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Sab669 posted:

Is there any reason to use the ToString method on, say, and integer instead of just appending an empty string (ie. myInt + "") when something wants a string? I feel like they accomplish the same thing, but I wasn't sure if there was some added security to the ToString route instead.

Because ToString is one of the few methods that's exposed on System.Object and is available to every single object in the entire language. Using it shows your intent. "I want to get the string representation of this object." Adding an empty string to an object is just silly and doesn't tell me anything about your intent.

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much
What's the best way to indicate when writing a virtual method that overriding is fine but that you need to call the base version of the method as well? Or is there a better pattern for this? I know Dispose's pattern uses two methods but even there unless the extending class defines a third to mimick the second for anything that might extend from there, you'll still run into the problem somewhere down the line if your inheritance goes that far.

I kind of feel like a protected event might be the safest route but that just seems like overkill.

Sab669 posted:

Is there any reason to use the ToString method on, say, and integer instead of just appending an empty string (ie. myInt + "") when something wants a string? I feel like they accomplish the same thing, but I wasn't sure if there was some added security to the ToString route instead.

A few other things is that what you wrote might make concatenation happen, which would be more resource intensive, but not by a significant amount and the compiler's probably smart enough to remove the + "" anyways. Also, that would call myInt's implicit cast to string, which probably calls ToString from there and I can't imagine what code wouldn't but with what was said above, there's no reason not to risk it.

Mr.Hotkeys fucked around with this message at 22:43 on Jun 28, 2013

Adbot
ADBOT LOVES YOU

glompix
Jan 19, 2004

propane grill-pilled
Just out of habit, I almost always use Convert.ToString(object) unless it's a value type. This is probably coming from years and years of working with untyped ADO.NET DataTables in a terrible architecture, though. If I don't have to handle a check for null, it's a win.

  • Locked thread