Cloud and Software Architecture, Soft skills, IOT and embedded
Spring.net configuration in App.config
Get link
Facebook
X
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;
I do a lot of my development and configuration via ssh into my Raspberry Pi Zero over the RNDIS connection. Some models of the Raspberry PIs can be configured with gadget drivers that let the Raspberry pi emulate different devices when plugged into computers via USB. My favorite gadget is the network profile that makes a Raspberry Pi look like an RNDIS-attached network device. All types of network services travel over an RNDIS device without knowing it is a USB hardware connection. A Raspberry Pi shows up as a Remote NDIS (RNDIS) device when you plug the Pi into a PC or Mac via a USB cable. The gadget in the Windows Device Manager picture shows this RNDIS Gadget connectivity between a Windows machine and a Raspberry Pi. The Problem Windows 11 and Windows 10 no longer auto-installs the RNDIS driver that makes magic happen. Windows recognizes that the Raspberry Pi is some type of generic USB COM device. Manually running W indows Update or Upd...
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 defaul...
This is about running VSCode AI code assist locally replacing Copilot or some other service. You may run local models to guarantee none of your code ends up on external servers. Or, you may not want to maintain an ongoing AI subscription. We are going to use LM Studio and VS Code. This was tested on Windows 11 with an RTX 3060 TI with 8GB of VRAM. 8GB really limits the number and size of the models we can use. LM Studio's simple hosting model of 1 LLM and an embedding works for us in this situation. You want a big card. 8GB is a tiny card. Related blog articles and videos Several related blogs and videos that cover VSCode and local LLMs Blog Get AI code assist VSCode with local LLMs using Ollama and the Continue.dev extension - Mac Get AI code assist VSCode with local LLMs using LM Studio and the Continue.dev extension - Windows Rocking an older Titan RTX 24GB as my local AI Code assist on Windows 11, Ollama and VS Code YouTube Video Using loc...
Comments
Post a Comment