Cloud and Software Architecture, Soft skills, IOT and embedded
Spring.net configuration in App.config
Get link
Facebook
Twitter
Pinterest
Email
Other Apps
I recently (10/2012) converted my TFS build monitor program to be Dependency Injected using the Spring.Net container. I did this because I wanted a no-code way of setting certain parameters and of specifying a build device management class without having to convert a configuration parameter into a class name. I instead injected the spring object with the same name as the configuration parameter using Spring.Net's built in facilities.
Spring.Net is moving towards more annotation based configuration but the XML configuration is still widely used and powerful. You can easily configure Spring.Net in XML with markup inserted into App.config. The first thing to do is to tell the system that there are going to be some spring.Net sections added to app.config. This defines two sections, contexts and objects. context is the section that describes where to find other pieces. objects is the section that contains the actual object wiring. Additional sections might be present if you are using the AOP runtime injection facilities in Spring.Net
The spring/context section describes the object configuration location, in this case in the config file (App.config) in the spring/objects section. The first object defined in objects is the VariablePlaceholderConfigurer. This class implements variable replacement from properties for spring.Net object parameters.
The following configuration creates a TfsBuildConnection instance under the name myBuildServerConnection. the "${Tfs.Url}" notation is the spring expression language replacement where the value will be the application property TFS.Url.
Consumers of a spring wired object can either have it directly injected through auto-wiring or they can retrieve the object from the spring context in a Service Locator pattern. This following cod retrieves the build server connection created above. The IApplicationContext should only be created once and can support multiple hierarchical context files. This context creation syntax uses the spring configuration from App.config (or web.config) when find the location for spring defined objects.
IApplicationContext ctx = ContextRegistry.GetContext();
TfsBuildConnection myBuildConnect =
ctx.GetObject("myBuildServerConnection") as TfsBuildConnection;
The Windows Subsystem for Linux operates as a virtual machine that can dynamically grow the amount of RAM to a maximum set at startup time. Microsoft sets a default maximum RAM available to 50% of the physical memory and a swap-space that is 1/4 of the maximum WSL RAM. You can scale those numbers up or down to allocate more or less RAM to the Linux instance. The first drawing shows the default WSL memory and swap space sizing. The images below show a developer machine that is running a dev environment in WSL2 and Docker Desktop. Docker Desktop has two of its own WSL modules that need to be accounted for. You can see that the memory would actually be oversubscribed, 3 x 50% if every VM used its maximum memory. The actual amount of memory used is significantly smaller allowing every piece to fit. Click to Enlarge The second drawing shows the memory allocation on my 64GB laptop. WSL Linux defaults to a maximum RAM size of 5
I wanted to access all my Azure resources without making any of them visible to the Internet. The easiest give my local machine access to everything on my Azure Virtual Network (VNET) was to connect to it over VPN. It turns out creating Azure VPN gateways and connecting to Azure VPN endpoints is easy. There are some subtleties in getting DNS name resolution to work that can confuse when first starting out. Setting the Stage There are a few ways to get to Azure endpoints and resources that are blocked from the internet. We can Create a Point-to-Site connection from our local machines to Azure Network Gateways Create a Site-to-Site network connection from our local networks to Azure Network Gateways. Use Bastion Hosts Use Cloud Shell Leave everything open to the internet. I chose a Point-to-Site (P2S) VPN connection that connects from my laptop to a VNet Gateway. That joins my laptop
Create Storage Spaces in Windows 10 Windows Server O/S contains Storage Spaces support for Server Spaces tiered storage. You can front slower spinning disks with smaller faster SSDs. Windows 10 has a Storage Spaces GUI Control Panel that does not include the tiered storage GUI. This means Powershell must be used for all configuration. https://github.com/freemansoft/win10-storage-spaces contains scripts that create tiered storage pools that integrate SSDs as caching drives and HDDs as storage drives. They assume you have at least one SSD and one HDD. The scripts automatically find all raw drives and add them to the pool. Some HDDs have their types incorrectly identified. The script can coerce them to be MediaType:HDD The entire virtual drive is added to the system as a single large volume You need at least 1 SSD and 1 HDD to run cached storage / Simple resiliency 2 SSD and 2 HDD to run cached storage / Mirror resiliency / 1 SSD and 2 HDD to run cached storage / Simple re
Comments
Post a Comment