via Trying to understand something about Dependency Injection : csharp
User badlife says this:
DI is a lot deeper than you’re thinking. It’s an entirely different way of doing architecture. Here’s a simple example:
- I’m a component. I need X to do some work. So I’ll create an instance of X and use it. I don’t want Y, or something that looks like X but behaves differently– I want an instance of X and only X.
- I’m a component. I need an instance of X to do some work
- I’m not going to create an instance of X– I’ll let you give me one when you create me
- I don’t care if X is really X, as long as it looks like X.
- I don’t want Y, but if Y pretends to be X, I’ll never know. This is because I only want something that lookslike X.
Here’s an example in concrete terms:
- The ‘component’ is something that does a calculation. As part of the calculation, it needs to call a web service to get a value (let’s say an interest rate)
- X is usually a component that calls a web service to get the interest rate
- Y is a testing component that just returns ‘1.0’ for the interest rate
Without DI, the component is very hard to test because it needs to call a ‘live’ web service to get an interest rate. What if that web service isn’t live? What if it isn’t accessible from the testing environment? The test could be running as part of a build, and the build server might not be able to see the web service.
With DI, both X and Y can implement a common interface. The component doesn’t actually create an instance of X– it just asks for a reference to the interface. So in a real world scenario, the system gives the component a ‘real’ instance of X by passing a reference to its interface. In a testing scenario, the system gives the component a ‘fake’ version of X (it’s actually Y!) also by passing a reference to its interface. The component doesn’t know or care about the internal implementation of what it thinks is X, and can do its work without the web service being available.
UPDATE 5/31/2018: I believe there are version 3.0 drivers now on Samsung’s website.
Here are the latest 64 bit drivers I could find on Samsung’s website for an 850 Pro NVMe. They (the .inf and .sys files) are from the version 2.3 installer. It may install for other SSDs as well, though I have not tested them yet. Instructions below..
The password is “nvme“. If you can’t find the download link, it is purring at you.
Hint: Past Post.
- Install 7zip, if you haven’t already.
- Make sure you have a backup of your important files.
- Download the cute cat picture to a temp folder.
- Open the image with 7zip.
- Save the 7z contents to the temp folder, all 3 files.
- Open your device manager and navigate down to “Storage controllers”.
- Override Microsoft’s default NVMe driver with these from Samsung.
Reboot and you should be good to go.
Benchmark before and after if you’re into that sort of stuff. 😛
@ Link Expander & Decrypter
Quote from their site (with the Grammar fixed!):
“This tool is an Ajax based link expander. It works by taking into account the API & shortening algorithm used by the shortener. After you submit your link, it checks the API used by the shortener. Within seconds the tool unshortens the URL according to the API detected. But that’s not all this tool does, it also tells if the uncovered site is safe to browse and displays a screenshot of the website along with the result. Now you can decrypt any URL with our link unshortener. We have tested our tool with all the services & it works perfectly!”
“Now expand URL from Bitly, Goog.l, AdFly & many more in just a click!”
VeraCrypt – Free Open Source Storage Device Encryption
(with strong security for the paranoid!) – Their words, not mine lol.
Has anyone else noticed a performance boost in reading from and writing to a VeraCrypt encrypted storage device?
Let’s run some tests and see if there really is any difference..
Continue reading “Performance Boost with VeraCrypt?!”
For free storage device benchmarking software, I highly recommend CrystalDiskMark. The interface is nice, clean, and simple to use. And the results are easy to understand!
You can even record the test results by pressing Alt-PrintScreen (after the benchmarks have completed, of course) to post to your website or blog for sharing and historical comparisons.
I’ll be using this program in my next blog post to test VeraCrypt’s (a free storage device encryption program) performance vs the same plain hard drive.
For free hard, flash, USB, SSD, and NVMe drive diagnostic software, I highly recommend CrystalDiskInfo. It sits in your Windows system tray and report all drive’s temperatures and S.M.A.R.T data.
It can also set off an audible alarm if any drive’s temperature gets too high (the temperature limit is adjustable). Very useful when testing new computer case configurations or new drives!
Yikes! Only $80 per month for a CDN…
Even with the coupon they mention, that’s a little steep. Although, if I had thousands of readers clicking on my site it might be tempting.
I should buy a boat. Er, I mean I should write more..