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
Opulent Ceremony
Feb 22, 2012

Ithaqua posted:

Why do you want to use Git over standard TFVC?

No particularly good reason, we are leaving SVN and one of us already has Git experience. I appreciate your thoughts and I'll pass them along, thank you.

Adbot
ADBOT LOVES YOU

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Opulent Ceremony posted:

No particularly good reason, we are leaving SVN and one of us already has Git experience. I appreciate your thoughts and I'll pass them along, thank you.

Consider using TFVC. The workflow for TFVC is conceptually closer to SVN, and I think you'll end up with fewer growing pains by using it.

glompix
Jan 19, 2004

propane grill-pilled
Git is awesome. Being able to commit locally is nice, but it really shines in a team environment when you start throwing pull requests around and branching like it's nothing. This is coming from someone who is not a git enthusiast.

ManoliIsFat
Oct 4, 2002

Opulent Ceremony posted:

1) Single TFS project, single Git repo where each solution is in a different branch (really multiple branches per solution for development/production etc). Seems like switching between branches to get to a different solution would suck, because we couldn't work on more than one solution/branch without committing changes before the branch switch? Also seems to take a long time to switch between branches since it removes and adds a bunch of files each time.
I can't speak to TFS and Git together specifically, but that's definitely not how to use git.

glompix posted:

Git is awesome. Being able to commit locally is nice, but it really shines in a team environment when you start throwing pull requests around and branching like it's nothing. This is coming from someone who is not a git enthusiast.
It's taken about 6 months for it to click, for me to really feel intuitive with it, but I don't think I could ever go back to SVN. I never really got in to TFS. The way they defined their whole own unique language to describe everything kinda threw me off, felt rinky-dink.

ManoliIsFat fucked around with this message at 04:32 on Feb 1, 2014

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
Source control has been a strange evolution for me. Initially it seems a lot more sensible to just do the whole "checkout this file when I'm using it and check it back in when I'm done" thing, since it's easy for people to think in terms of files. Over time, though, I warmed up to the concepts of change sets and the whole Git model of commits pointing to other commits. Nowadays, I can't stand going anywhere near file checkout based source control systems.

Admittedly, newer versions of SVN do a much better job of handling commits in terms of changesets rather than whole files, but some things are still pretty clunky with it. Probably the worst part of Git is the variety of strange command names that each have a list of arcane flags which presents a substantial learning barrier. Once you get over that barrier, though, it's great. I have no experience with TF-anything so I can't really talk to that.


------------


On a completely unrelated note, I recently inherited a code base for a desktop application that we're fixing up. It stores some data in a hard-coded path on the C: drive, so I decided to move it somewhere else and make the path configurable. By default, I decided to place it in a folder relative to the working directory since I could at least guarantee that the folder exists. Now, I've been working on web applications for the past while, so I somehow missed out on this whole UAC Virtual Store crap that redirects your file modifications to some random folder deep in the current user's AppData.

The application I'm working with needs to have data stored available to all users, so I ended up moving it to %PROGRAMDATA% and that seems to work fine. However, the problem I run into now is that I was using the .NET configuration manager to store settings (again, for all users) which defaults to changing the configuration in the working directory. That, of course, gets redirected to the Virtual Store so the settings are no longer the same for all users.

So, after all that rambling, my question is: what is the best practice for storing non-user specific application data and configuration in Windows Vista and above?

raminasi
Jan 25, 2005

a last drink with no ice

ManoliIsFat posted:

I never really got in to TFS. The way they defined their whole unique language to describe everything kinda threw me off, felt rinky-dink.

You can't really sell git by using its nomenclature.

ManoliIsFat
Oct 4, 2002

GrumpyDoctor posted:

You can't really sell git by using its nomenclature.
Lol, very true. Although in the most basic and pure usage, it makes a bunch of sense, seems simple enough. It's only when you start using it does it become a complete mess.

crashdome
Jun 28, 2011

Bognar posted:

So, after all that rambling, my question is: what is the best practice for storing non-user specific application data and configuration in Windows Vista and above?

Off the top of my head, registry, Program Data, or maybe even a data file (e.g. Sql Express).

Program data folder is exactly there for that reason though. ProgramData for global settings and AppData for user specific is a good guideline.

crashdome fucked around with this message at 07:18 on Feb 1, 2014

ninjeff
Jan 19, 2004

Bognar posted:

So, after all that rambling, my question is: what is the best practice for storing non-user specific application data and configuration in Windows Vista and above?
This isn't really a "best practice" as such (I hate that term), but if you have a lot of code using ConfigurationManager then you might try starting a new AppDomain with your config file from ProgramData loaded. See http://msdn.microsoft.com/en-us/library/system.appdomainsetup.configurationfile%28v=vs.110%29.aspx

I think it's almost criminal that .NET has been around for this long and we don't have a good cascading configuration scheme built in.

Dromio
Oct 16, 2002
Sleeper
I'm trying to do some dynamic routing based off database entries in ASP.NET MVC. So I set up my default route to go to a controller, passing in the full URL like this:

code:
routes.MapRoute("ManagedRoutes", "{*requestedUrl}", new {controller = "Home", action = "Index"})
That controller action returns an ActionResult, with the default view if the parameter is null. Otherwise, it does a lookup to see if there is something defined for the request. I thought I'd make my own RewriteActionResult since I didn't see one:

code:
    public class RewriteActionResult : ActionResult
    {
        private readonly string Url;
        public RewriteActionResult(string url)
        {
            Url = url;
        }

        public override void ExecuteResult(ControllerContext context)
        {
	    context.HttpContext.RewritePath(Url);
        }
    }
And have my action use it appropriately:

code:
        public ActionResult Index(string requestedUrl)
        {
            //Default with no paremter, show the basic home page.
            if (string.IsNullOrEmpty(requestedUrl))
            {
                return View(new HomePageModel());
            }
            var foundRoute = findRouteByUrl.GetRoute(requestedUrl);
            if (foundRoute != null)
            {
                //NOT WHAT I WANT-- DOES A REDIRECT INSTEAD
                //return Redirect(foundRoute.OutputFromUrl);

               //Just gives a blank page!
               return new RewriteActionResult(url);
            }
	    return HttpNotFound();
        }
Any ideas what I'm doing wrong here? Is this a terrible approach? They want to have full control over "vanity" urls to anything in the site, dynamically driven from an admin UI.

Dirk Pitt
Sep 14, 2007

haha yes, this feels good

Toilet Rascal
I just finished Seerman's Dependency Injection in .Net, and am now tackling the 3rd edition of C# in Depth, but that isn't a cover to cover type book.

What should I look at reading next? I am getting more interested in architecture and design patterns. Is the a more modern book recommended than Gang of Four or is that the best still?

Shy
Mar 20, 2010

I finished C# in Depth recently, it felt easy to read cover to cover, I only struggled with expression trees and dynamic, but I have no background experience whatsoever. The other two .Net-specific books I'm reading now are CLR via C# and The Art of Unit Testing. This doesn't quite answer your question I think, but the two spend many pages discussing good practices, and I've never seen anybody complain about either.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Dirk Pitt posted:

I just finished Seerman's Dependency Injection in .Net,
If you liked what Seemann had to say, might want to take a look at what he has to say on unit testing, and specifically AutoFixture. Unfortunately there's no documentation, only various blogposts.

As for a follow-up to design pattern reading, I really liked Coplein's Lean Architecture, which takes a very people-oriented approach. Then again I'm a newbie so there's a decent chance it's a pile of crap and I just don't know enough to recognise it.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
If you have a post action on a controller and your model uses an input from the form, do you call he method doing the background stuff in the initial controller's post or the next controller's get? I realize it doesn't really matter I guess but I'm just curious if there is a best practice.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

Dirk Pitt posted:

I just finished Seerman's Dependency Injection in .Net, and am now tackling the 3rd edition of C# in Depth, but that isn't a cover to cover type book.

What should I look at reading next? I am getting more interested in architecture and design patterns. Is the a more modern book recommended than Gang of Four or is that the best still?

For design patterns I liked Head First Design Patterns. It's a bit "simple" but I thought the examples were pretty good and even though it's in Java the code translates over to C# pretty easily. I haven't had a chance to read Gang of Four so I can't compare. There's also Pragmatic Programmer and Code Complete 2. If you can borrow someones copy of Clean Code that's a good book but it's heavy on the Java frameworks.

raminasi
Jan 25, 2005

a last drink with no ice
Does anyone have any idea why "regedit /s something.reg", when run as a post-build event for a WiX project, won't work, even though the exact same command run manually works fine? It's actually opening the file correctly but if I leave off the /s the error message is a generic "no idea" one.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

GrumpyDoctor posted:

Does anyone have any idea why "regedit /s something.reg", when run as a post-build event for a WiX project, won't work, even though the exact same command run manually works fine? It's actually opening the file correctly but if I leave off the /s the error message is a generic "no idea" one.

Regedit rights depend on the user you're logged in as, so maybe the post-build event is being invoked as a different user than what your cmd.exe runs as?

Sedro
Dec 31, 2008
Are you running VS in 32bit mode? Your script might be writing to wow64node.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Uziel posted:

If you have a post action on a controller and your model uses an input from the form, do you call he method doing the background stuff in the initial controller's post or the next controller's get? I realize it doesn't really matter I guess but I'm just curious if there is a best practice.

HTTP POST is generally recognized as causing a modification to some data while GET is used for queries. You should be able to call a GET method any number of times without causing a change in the result. If you're doing something with side effects, do it in the POST.

Dromio
Oct 16, 2002
Sleeper
I've kind of given up on my original attempt at doing rewrites through an actionresult. Instead I'm working at the RouteHandler level, examining the incoming request, looking to see if that matches my database, then trying to modify the RequestContext.RouteData to cause the MvcHandler to send it all to the right place.

I'm really close-- I'm able to find the correct route from the RouteTable (by generating my own HttpContextBase from the new URL and asking the routetable about that), but it always ends up calling my action with a null parameter. I'm losing it on how the parameters end up getting to the actual controller action from the querystring if they weren't specified on the route itself. What part of the MVC stack does that, and how?

RICHUNCLEPENNYBAGS
Dec 21, 2010

Ithaqua posted:

First off, answer this question: Why do you want to use Git over standard TFVC? Git is generally a lot harder to use effectively. Full disclosure: I am massively biased against Git.

How do you figure?

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Let me propose a scenario:

There is a WCF service (though it could be WebAPI or whatever else for all it matters).
This service is only consumed internally.
There are about 20 different interfaces exposed.
There are 4 clients of this service. All are in the same solution with the service.
It is suspected, but not proven, that 20-50% of all the API calls exposed across those 20 interfaces are never called; they are simply legacy cruft.


My question: how can I find the unused calls without having to right-click and find references on each and every method in each interface?

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug
Add logging to your service and let it run for a few weeks. You could also remove the calls, deploy to your staging environment, and recompile all of the applications that use your service. As long as they are referencing the service the compiler should find calls that are now missing. If you have something calling the service using HTTPClient you won't find missing calls until run time.

wwb
Aug 17, 2004

If it is over HTTP and they left the logging on you should be able to figure out a bunch based on that -- especially with webAPI where the endpoints will have different / methods. Check out http://www.iis.net/downloads/community/2010/04/log-parser-22 for an easy way to data mine said logs.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
Any opinions on how to handle a single user system? I have a very tiny personal project made in MVC, that has a tiny single table database and I want to be able to CRUD items. There is no need for anyone else to login or authenticate as there is nothing to do other than get the database items displayed in a table and a google map.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
Here at work we use a three layer architecture on our server and the service sitting on the database; DataService->Repository->Controller injected as such, and the DataService calls the service which is constructed DataAccessLayer->ServiceLogicLayer->Service.

Are there any vs plugins or scripts that can help automate just setting up the boilerplate of one calling the other, setting up the constructor, the interfaces, and such? It seems to take an inordinate amount of time, and at least just the hot-potato part of "I call foo, foo calls bar, bar calls baz, baz discos my wsdl bla bla bla" should be trivial enough to be automated.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

2banks1swap.avi posted:

Here at work we use a three layer architecture on our server and the service sitting on the database; DataService->Repository->Controller injected as such, and the DataService calls the service which is constructed DataAccessLayer->ServiceLogicLayer->Service.

Are there any vs plugins or scripts that can help automate just setting up the boilerplate of one calling the other, setting up the constructor, the interfaces, and such? It seems to take an inordinate amount of time, and at least just the hot-potato part of "I call foo, foo calls bar, bar calls baz, baz discos my wsdl bla bla bla" should be trivial enough to be automated.

Use an IOC container?

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

Ithaqua posted:

Use an IOC container?

We did once! But now we don't. Not sure why.

That's something I need to ask.

wwb
Aug 17, 2004

Uziel posted:

Any opinions on how to handle a single user system? I have a very tiny personal project made in MVC, that has a tiny single table database and I want to be able to CRUD items. There is no need for anyone else to login or authenticate as there is nothing to do other than get the database items displayed in a table and a google map.

My default option is to just use windows auth (or basic or digest if it needs to survive proxies). Simple to implement (add configuration, add [Authorize] attributes), easy to manage (need multiuser -- just add windows users), secure enough if you've got SSL in place.

If you don't want to mess with that you can pretty easily jack into the forms auth plumbing to login using whatever magic user / pass combo you want. Then you can ride all the [Authorize] attributes, etc, all the way to the bank.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

2banks1swap.avi posted:

We did once! But now we don't. Not sure why.

That's something I need to ask.

OK, asked, and phew, big answer.

Basically, we have the standards of $CLIENT to stick to which are very rigid, the fact that our cases are often extremely complex, and trying to configure automation was much more work than just doing it ourselves since we have few default cases, so to speak.

It's not TERRIBLE, but I do wish I had a konami code to just spit out classes/interfaces/method stubs with some basic calling and returning to go fill in myself to work in. I should try to write one.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

2banks1swap.avi posted:

It's not TERRIBLE, but I do wish I had a konami code to just spit out classes/interfaces/method stubs with some basic calling and returning to go fill in myself to work in. I should try to write one.

I don't quite understand what you're asking for, but maybe code snippets (or whatever the equivalent is in your IDE) is what you're looking for?

Uziel
Jun 28, 2004

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

wwb posted:

My default option is to just use windows auth (or basic or digest if it needs to survive proxies). Simple to implement (add configuration, add [Authorize] attributes), easy to manage (need multiuser -- just add windows users), secure enough if you've got SSL in place.

If you don't want to mess with that you can pretty easily jack into the forms auth plumbing to login using whatever magic user / pass combo you want. Then you can ride all the [Authorize] attributes, etc, all the way to the bank.
Perfect, thanks. I think I'll go the forms auth route as I think it would be much quicker to implement!

Sab669
Sep 24, 2009

A weird bug (can I even call it that?) happened to me at work in VS 2010, .NET 3.5... Decided to come home and try it in 2012 using .NET 4.5:



I set a Breakpoint on my KeyDown event that checks to see if the user hit the Delete key. So I run it, press Delete... and KeyCode evaluates to MButton | RButton | Back | Space

If I go and look at the actual Key enum:

Delete = 46

RButton = 2
MButton = 4
Back = 8
Space = 32

32 + 8 + 4 +2 = 46. I don't really understand what I'm observing, but the IF statement still evaluates properly. I was hoping someone could explain :downs:

raminasi
Jan 25, 2005

a last drink with no ice
It looks like Microsoft refused to follow their own guidelines for flags, which is sure to cause much merriment and rejoicing for anyone wondering why someone hitting the delete key keeps triggering their code that's listening for a space bar. Or, you've got the wrong enum values somehow.

Sedro
Dec 31, 2008
It's normal to create special flags for commonly used combinations
C# code:
enum Flags
{
    None = 0,
    A = 1,
    B = 2,
    C = 4,
    D = 8,
    BandC = B | C,
    All = A | B | C | D
}
Notably this will let you deserialize the string "BandC".

But what's happening here actually dates back to win32 when bits were at a premium

http://msdn.microsoft.com/en-us/library/system.windows.forms.keys(v=vs.110).aspx posted:

In the Win32 application programming interface (API) a key value has two halves, with the high-order bits containing the key code (which is the same as a Windows virtual key code), and the low-order bits representing key modifiers such as the SHIFT, CONTROL, and ALT keys.

Do not use the values in this enumeration for combined bitwise operations. The values in the enumeration are not mutually exclusive.
So in this scheme Back | Space is not a valid combination

RICHUNCLEPENNYBAGS
Dec 21, 2010

2banks1swap.avi posted:

We did once! But now we don't. Not sure why.

That's something I need to ask.

I think that was meant to be a suggestion, rather than a question.

Funking Giblet
Jun 28, 2004

Jiglightful!

2banks1swap.avi posted:

OK, asked, and phew, big answer.

Basically, we have the standards of $CLIENT to stick to which are very rigid, the fact that our cases are often extremely complex, and trying to configure automation was much more work than just doing it ourselves since we have few default cases, so to speak.

It's not TERRIBLE, but I do wish I had a konami code to just spit out classes/interfaces/method stubs with some basic calling and returning to go fill in myself to work in. I should try to write one.

Most IOC containers allow configuration delegates, you really should be using IOC for this. Really!

zerofunk
Apr 24, 2004
I have an assembly that contains business logic code that I would like to make available to another application through COM. I know how to deal with all the COM visible stuff as I've done that before albeit with a much simpler case. What I'm not sure about is configuration details that the assembly relies on. It gets access to a database through a repository layer that then hits an ORM.

We have a simple console test app that has connection strings and such in app.config. We also have some WebAPI services with a similar setup in web.config. I just have no clue what needs to happen to get it working for a situation like this where I want a standalone assembly that will be used by a non-.NET application. Has anyone dealt with something like this before or have some ideas on where I might start?

wwb
Aug 17, 2004

I think if you make a MyAssembly.dll.config file in the same folder it will find it. Or at least that stunt worked for the one office plugin I wrote eons ago and seems to work for stuff like unit tests.

If you've got WCF in play I would just expose HTTP and let the com app speak to that.

Adbot
ADBOT LOVES YOU

zerofunk
Apr 24, 2004
Thanks, I'll give that a shot. Now I'm running into problems getting the client to recognize the COM object, so I need to figure that out first.

Using web services is another possibility. I had done a quick proof of concept for that awhile back which seems to have somehow stopped working. My biggest issue is that as much as PowerBuilder sucks, trying to get PowerBuilder to interface with anything else is even worse.

  • Locked thread