|
Nagy Vilmos wrote: The man at the door said I could get a good argument here!
Whisky is better than gin.
/trollface
Seriously though, welcome back. 🍻
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
'ello, decided the banter is better here?
|
|
|
|
|
I just posted a question at the top that could be taken as bait if someone were so inclined, though it wasn't written as bait, it's a C vs C++ thing, so I expect there to be casualties.
Real programmers use butterflies
|
|
|
|
|
Yes, arguments can be found. The "good" part is another argument in itself.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Upon entry, you do not "get" an argument, you supply an actual one for the formal one declared by the man at the door.
|
|
|
|
|
How on earth has no-one given this as a response yet!?
OH! Oh! I'm sorry! This is abuse!
Aha! No, you want room 12A, next door.
[Argument Clinic - Monty Python](https://www.youtube.com/watch?v=DkQhK8O9Jik)
EDIT: Face-palm. Of course Griff was on it.
|
|
|
|
|
We keep our (encrypted) connection strings in (web)config files, and that requires us to create a unique deployment package for each of the eight environments and 12 web apps, seven windows services, and an assortment of in-house tools we have to support.
After a meeting about the "problem" on Friday afternoon, I came up with a way to build all of the connection strings on the fly - in code - which will relieve us of the need to create unique deployment packages. Now, we can create a single package and when it passes testing/validation in one environment, we can simply deploy it to the next environment, eventually ending up in production.
I developed the actual code for the solution, a proof-of-concept app, and a 6-page document explaining what I did. The code has almost as many lines of comments as there are lines of actual code.
The beauty of this solution is that:
- it can be used in our web apps AND our desktop apps/windows services
- multiple connection strings can be specified for each app/tool/service
- the connection strings don't actually exist as connection strings in memory until they're requested
- once requested, the connection strings are built and either Base64 encoded or 256-bit encrypted (dev's choice)
- it completely eliminates the need to maintain connection stings in config files.
Now comes the hard part - convincing management to let us implement it. Honestly? That shouldn't be the hard part.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
#realJSOP wrote: That shouldn't be the hard part.
People are afraid of things they do not understand...
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Sounds good John - do I smell an article ? I hope so.
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
I might. The code as it exists is very work-specific, so I'd have to refactor it a bit.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
So the conn string is regenerated on the fly every time the program is run ?
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Every time it's requested.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I would like to see how you do this
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
The connectionstring when "at rest" is not assembled into a string. It merely exists in its component parts.
When you call the "Get" method to retrieve the connection string, it assembles the parts into a connection string, and either base64 encodes it, or 256-bit encrypts it (programmer's choice) and returns that encoded/encrypted string.
When you're ready to access the database, you simply decode/decrypt it when you send it to the SqlConnection object.
(We don't use Entity Framework or any other ORM, so this approach is no problem).
Any using base64/encryption is optional as well, you can have it return a string as plain text as well.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 3-Mar-21 8:33am.
|
|
|
|
|
Ok I f****ng" hate EF ( and any ORM ) - look forward to reading your article - thanks for your efforts
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
The article's been posted:
A Connection string manager for multi-environment ecosystems[^]
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
That's my Friday taken care of - thanks John
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
We're going to add the code to one of our projects to see how it goes. Until i see it work in the intended environment, it's all prettty much just theoretical. The sample app works within the context of my dev box, but I wanna put it on a live server to make sure it will actually do what I want.
If you're up for it, feel free to relate your experience in the article forum.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Wow, making it general enough for public consumption is going to take some work. We have considerations not normally encountered in the civilian ecosystem, and I have to make the code easy to implement in a way that makes sense to devs that have never been exposed to it before.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I work for the government in the UK ( at local level ) so it definitely is of interest
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
While staring at the code trying to come up with a way to describe how it works, I actually came up with what I think is a better way to approach some of it, so code introspection is a "good thing" (TM).
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
We use Ansible for similar purposes.
|
|
|
|
|
Does it save money ? that's the only convincing you need to do.
I'd rather be phishing!
|
|
|
|
|
Maximilien wrote: Does it save money ?
Dev reply: No, it only saves Developer headaches.
Manager: Denied! These are unnecessary changes.
|
|
|
|
|
First of all, it makes too much sense for them to use, unless you can convince them it was their idea.
Good show. Generating connection strings that is. I've never liked them and often found myself doing similar, and yes, because of security.
#realJSOP wrote: The code has almost as many lines of comments as there are lines of actual code.
I hate to say this, but that's a red flag to me.
1. Are you using comments where you should be using documentation? You're perhaps either duplicating effort and creating maintenance issues #2, or you're using comments for where you need documentation - it sounds like in your case it's the former, since you have a 6 page doc.
2. What of maintenance? Is your code not clear enough to stand on its own absent all the comments? If not, why not spend that time refactoring instead? Every line of code is important. A comment is still a line of code. It must be maintained, too. If the source changes, and the comments get out of sync, then they become counterintuitive. Comments should be avoided if possible, for the same reason other lines of code should be. The most bug free, efficient code is the code you never wrote. I break this rule in one place - writing articles for code project with code in them - because comments allow me to describe what I'm doing as I'm doing it, but in normal circumstances, you aren't writing your comments for learners, but for maintainers.
/design-hat
*ducks*
Real programmers use butterflies
|
|
|
|
|