Home Blog Page 47

Updating to .NET 8, updating to IHostBuilder, and working Playwright Exams inside NUnit headless or headed on any OS



All the Unit Tests passI have been doing not simply Unit Testing for my websites however full on Integration Testing and Browser Automation Testing as early as 2007 with Selenium. These days, nevertheless, I have been utilizing the quicker and customarily extra suitable Playwright. It has one API and may check on Home windows, Linux, Mac, regionally, in a container (headless), in my CI/CD pipeline, on Azure DevOps, or in GitHub Actions.

For me, it is that final second of fact to ensure that the positioning runs utterly from finish to finish.

I can write these Playwright assessments in one thing like TypeScript, and I might launch them with node, however I like working finish unit assessments and utilizing that check runner and check harness as my leaping off level for my .NET purposes. I am used to proper clicking and “run unit assessments” and even higher, proper click on and “debug unit assessments” in Visible Studio or VS Code. This will get me the good thing about all the assertions of a full unit testing framework, and all the advantages of utilizing one thing like Playwright to automate my browser.

In 2018 I used to be utilizing WebApplicationFactory and a few difficult hacks to mainly spin up ASP.NET inside .NET (on the time) Core 2.1 throughout the unit assessments after which launching Selenium. This was sort of janky and would require to manually begin a separate course of and handle its life cycle. Nevertheless, I saved on with this hack for quite a lot of years mainly attempting to get the Kestrel Net Server to spin up inside my unit assessments.

I’ve not too long ago upgraded my predominant web site and podcast web site to .NET 8. Needless to say I have been transferring my web sites ahead from early early variations of .NET to the newest variations. The weblog is fortunately working on Linux in a container on .NET 8, however its authentic code began in 2002 on .NET 1.1.

Now that I am on .NET 8, I scandalously found (as my unit assessments stopped working) that the remainder of the world had moved from IWebHostBuilder to IHostBuilder 5 model of .NET in the past. Gulp. Say what you’ll, however the backward compatibility is spectacular.

As such my code for Program.cs modified from this

public static void Fundamental(string[] args)
{
CreateWebHostBuilder(args).Construct().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup();

to this:

public static void Fundamental(string[] args)
{
CreateHostBuilder(args).Construct().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args).
ConfigureWebHostDefaults(WebHostBuilder => WebHostBuilder.UseStartup());

Not a serious change on the surface however tidies issues up on the within and units me up with a extra versatile generic host for my internet app.

My unit assessments stopped working as a result of my Kestral Net Server hack was now not firing up my server.

Right here is an instance of my objective from a Playwright perspective inside a .NET NUnit check.

[Test]
public async Activity DoesSearchWork()
{
await Web page.GotoAsync(Url);

await Web page.Locator("#topbar").GetByRole(AriaRole.Hyperlink, new() { Title = "episodes" }).ClickAsync();

await Web page.GetByPlaceholder("search and filter").ClickAsync();

await Web page.GetByPlaceholder("search and filter").TypeAsync("spouse");

const string visibleCards = ".showCard:seen";

var ready = await Web page.WaitForSelectorAsync(visibleCards, new PageWaitForSelectorOptions() { Timeout = 500 });

await Count on(Web page.Locator(visibleCards).First).ToBeVisibleAsync();

await Count on(Web page.Locator(visibleCards)).ToHaveCountAsync(5);
}

I like this. Good and clear. Actually right here we’re assuming that we have now a URL in that first line, which shall be localhost one thing, after which we assume that our internet utility has began up by itself.

Right here is the setup code that begins my new “internet utility check builder manufacturing facility,” yeah, the identify is silly nevertheless it’s descriptive. Be aware the OneTimeSetUp and the OneTimeTearDown. This begins my internet app throughout the context of my TestHost. Be aware the :0 makes the app discover a port which I then, sadly, need to dig out and put into the Url personal to be used inside my Unit Exams. Be aware that the is the truth is my Startup class inside Startup.cs which hosts my app’s pipeline and Configure and ConfigureServices get setup right here so routing all works.

personal string Url;
personal WebApplication? _app = null;

[OneTimeSetUp]
public void Setup()
{
var builder = WebApplicationTestBuilderFactory.CreateBuilder();

var startup = new Startup(builder.Atmosphere);
builder.WebHost.ConfigureKestrel(o => o.Pay attention(IPAddress.Loopback, 0));
startup.ConfigureServices(builder.Companies);
_app = builder.Construct();

// pay attention on any native port (therefore the 0)
startup.Configure(_app, _app.Configuration);
_app.Begin();

//you're kidding me
Url = _app.Companies.GetRequiredService().Options.GetRequiredFeature().Addresses.Final();
}

[OneTimeTearDown]
public async Activity TearDown()
{
await _app.DisposeAsync();
}

So what horrors are buried in WebApplicationTestBuilderFactory? The primary bit is unhealthy and we must always repair it for .NET 9. The remaining is definitely each good, with a hat tip to David Fowler for his assist and steerage! That is the magic and the ick in a single small helper class.

public class WebApplicationTestBuilderFactory 
{
public static WebApplicationBuilder CreateBuilder() the place T : class
{
//This ungodly code requires an unused reference to the MvcTesting package deal that hooks up
// MSBuild to create the manifest file that's learn right here.
var testLocation = Path.Mix(AppContext.BaseDirectory, "MvcTestingAppManifest.json");
var json = JsonObject.Parse(File.ReadAllText(testLocation));
var asmFullName = typeof(T).Meeting.FullName ?? throw new InvalidOperationException("Meeting Full Title is null");
var contentRootPath = json?[asmFullName]?.GetValue();

//spin up an actual dwell internet utility inside TestHost.exe
var builder = WebApplication.CreateBuilder(
new WebApplicationOptions()
{
ContentRootPath = contentRootPath,
ApplicationName = asmFullName
});
return builder;
}
}

The primary 4 strains are nasty. As a result of the check runs within the context of a special listing and my web site must run throughout the context of its personal content material root path, I’ve to drive the content material root path to be appropriate and the one manner to try this is by getting the apps base listing from a file generated inside MSBuild from the (getting old) MvcTesting package deal. The package deal will not be used, however by referencing it it will get into the construct and makes that file that I then use to drag out the listing.

If we are able to eliminate that “hack” and pull the listing from context elsewhere, then this helper perform turns right into a single line and .NET 9 will get WAY WAY extra testable!

Now I can run my Unit Exams AND Playwright Browser Integration Exams throughout all OS’s, headed or headless, in docker or on the steel. The location is up to date to .NET 8 and all is true with my code. Properly, it runs not less than. 😉




About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, advisor, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a ebook writer.

facebook
bluesky
subscribe
About   Publication

Internet hosting By
Hosted on Linux using .NET in an Azure App Service








New drug restores imaginative and prescient by regenerating retinal nerves – NanoApps Medical – Official web site


Imaginative and prescient is among the most important human senses, but over 300 million folks worldwide are liable to imaginative and prescient loss on account of varied retinal ailments. Whereas latest developments in retinal illness therapies have efficiently slowed illness development, no efficient remedy has been developed to revive already misplaced vision-until now. KAIST researchers have efficiently developed a novel drug to revive imaginative and prescient.

KAIST (represented by President Kwang Hyung Lee) introduced on the thirtieth of March {that a} analysis group led by Professor Jin Woo Kim from the Division of Organic Sciences has developed a therapy technique that restores imaginative and prescient via retinal nerve regeneration.

The analysis group efficiently induced retinal regeneration and imaginative and prescient restoration in a disease-model mouse by administering a compound that blocks the PROX1 (prospero homeobox 1) protein, which suppresses retinal regeneration. Moreover, the impact lasted for greater than six months.

This research marks the primary profitable induction of long-term neural regeneration in mammalian retinas, providing new hope to sufferers with degenerative retinal ailments who beforehand had no therapy choices.

As the worldwide inhabitants continues to age, the variety of retinal illness sufferers is steadily rising. Nonetheless, no therapies exist to revive broken retinas and imaginative and prescient. The first motive for that is the mammalian retina’s incapacity to regenerate as soon as broken.

Research on cold-blooded animals, equivalent to fish-known for his or her sturdy retinal regeneration-have proven that retinal accidents set off Müller glia cells to dedifferentiate into retinal progenitor cells, which then generate new neurons. Nonetheless, in mammals, this course of is impaired, resulting in everlasting retinal injury.

By means of this research, the analysis group recognized the PROX1 protein as a key inhibitor of Müller glia dedifferentiation in mammals. PROX1 is a protein present in neurons of the retina, hippocampus, and spinal twine, the place it suppresses neural stem cell proliferation and promotes differentiation into neurons.

The researchers found that PROX1 accumulates in broken mouse retinal Müller glia, however is absent within the extremely regenerative Müller glia of fish. Moreover, they demonstrated that the PROX1 present in Müller glia isn’t synthesized internally however reasonably taken up from surrounding neurons, which fail to degrade and as a substitute secrete the protein.

Primarily based on this discovering, the group developed a way to revive Müller glia’s regenerative potential by eliminating extracellular PROX1 earlier than it reaches these cells.

This strategy entails utilizing an antibody that binds to PROX1, developed by Celliaz Inc., a biotech startup based by Professor Jin Woo Kim’s analysis lab. When administered to disease-model mouse retinas, this antibody considerably promoted neural regeneration. Moreover, when delivered, the antibody gene to the retinas of retinitis pigmentosa illness mannequin mice, it enabled sustained retinal regeneration and imaginative and prescient restoration for over six months.

The retinal regeneration-inducing remedy is at the moment being developed by Celliaz Inc. for utility in varied degenerative retinal ailments that at the moment lack efficient therapies. The corporate goals to start scientific trials by 2028.

This research was co-authored by Dr. Eun Jung Lee of Celliaz Inc. and Museong Kim, a Ph.D. candidate at KAIST, as joint first authors. The findings have been printed on-line on March 26 within the worldwide journal Nature Communications. (Paper Title: Restoration of retinal regenerative potential of Müller glia by disrupting intercellular Prox1 switch | DOI: 10.1038/s41467-025-58290-8)

Dr. Eun Jung Lee said, “We are about finishing the optimization of the PROX1-neutralizing antibody (CLZ001) and transfer to preclinical research earlier than administering it to retinal illness sufferers. Our purpose is to offer an answer for sufferers liable to blindness who at the moment lack correct therapy choices.”

This analysis was supported by analysis funds from Korean Nationwide Analysis Basis (NRF) and the Korea Drug Growth Basis (KDDF).

How Cisco’s Focus On Expertise Reworked My Tech Profession


This put up was authored by Khushi Saxena, a technical consulting engineer intern on the Buyer Expertise Crew.

I by no means imagined {that a} international big like Cisco would discover somebody like me — but right here I’m, dwelling proof that abilities matter greater than background.

Coming from a wholly non-technical background, my first yr of faculty felt like entering into a totally totally different world. Whereas others appeared to have a head begin, speaking about knowledge buildings, initiatives, and hackathons like second nature, I used to be nonetheless making an attempt to wrap my head across the fundamentals. It was overwhelming, to say the least. I keep in mind sitting in my first programming class, struggling to know easy syntax whereas others breezed by means of problem-solving. There have been moments once I puzzled if I had made the suitable selection and if I used to be actually reduce out for this. However as a substitute of letting it intimidate me, I made a decision I might put within the work, bridge the hole, and get on par with everybody else. And so, I spent infinite nights studying, working towards, and pushing myself past what I assumed I used to be able to.

It was in my second yr that I first got here throughout Cisco. Till then, I had solely heard of it as a worldwide tech big, however the extra I realized about its work in networking, safety, and innovation, the extra fascinated I grew to become. It shortly grew to become one in every of my dream firms, not simply due to its popularity however due to the form of influence it was making on this planet of expertise. I knew that if I ever received the chance, I needed to be a part of one thing like that.

For me, moving into an excellent firm wasn’t nearly fulfilling a dream — it was a necessity. My household had confronted monetary struggles, and I knew that securing a steady, well-paying job would change every little thing. I carried that duty with me by means of each late-night research session, each rejection, and each problem I confronted. I wasn’t simply doing this for myself — I used to be doing it to make sure a greater future for my household.

Quick ahead to my closing yr, and that chance got here knocking within the type of Cisco Ideathon 2024, a contest that challenges college students to resolve real-world issues, testing their technical abilities, creativity, and drawback solving-abilities. I began having doubts about myself — would I even stand an opportunity towards candidates from extra famend establishments? However Cisco’s hiring course of proved that expertise speaks louder than labels. Cisco assessed me based mostly on my abilities, with out contemplating different elements, which was an enormous testomony to all my efforts up to now. I used to be evaluated purely on my talents, and for the primary time, I felt really acknowledged for my potential.

After I obtained my internship + full-time provide, I used to be overwhelmed with feelings and couldn’t assist however cry. It wasn’t nearly getting a job — it was validation that arduous work, persistence, and keenness matter greater than the place you come from. All through the method, all that Cisco cared about was what I might deliver to the desk. And that made all of the distinction.

Now that I’ve been a part of Cisco, I can confidently say — it’s every little thing I hoped for and extra. From day one, I felt welcomed and valued. In contrast to the standard company tradition I had imagined, Cisco fosters an surroundings that encourages studying, collaboration, and innovation. One of many issues that shocked me essentially the most was the work-life stability. I had heard horror tales of burnout within the tech business, however Cisco genuinely prioritizes worker well-being. In reality, we even get a ‘Day for Me’ — a devoted day without work for all workers globally to recharge, give attention to ourselves, and step away from work with out utilizing our private go away. It’s a easy but highly effective initiative that exhibits how a lot the corporate values its workers’ psychological well being and private time. There’s flexibility, a supportive work tradition, and an emphasis on private development.

The perfect half? I’m already getting the chance to work on significant initiatives. Other than my common work, I’ve additionally participated in company social duty (CSR) initiatives — Cisco’s manner of giving again to the group. I had the possibility to design posters for most cancers consciousness, create greeting playing cards for most cancers sufferers, and even paint water bowls for stray animals. With the ability to contribute to such impactful initiatives has been extremely fulfilling. Daily is a brand new studying expertise, and I’m always surrounded by good minds prepared to assist and information me. I’m not simply one other intern right here — I’m handled as an integral a part of the group.

If there’s one factor my journey has taught me, it’s this: by no means let the place you come from outline the place you may go. Irrespective of your background, you probably have the abilities, the drive, and the willingness to study, nothing can cease you. The street might not all the time be simple, however belief me, it’s price it.

To each scholar on the market doubting themselves — know this: your expertise speaks louder than labels. Continue to learn, preserve pushing, and when the suitable alternative comes, seize it with each palms. As a result of if I can do it, so are you able to. And, for that I’ll all the time be grateful to Cisco.

At Cisco, we rejoice our workers’ abilities and help significant profession development. Need to see how we make a distinction collectively? Try our Objective Report.

Subscribe to the WeAreCisco Weblog.

Share:

Reviewing progress with coupling electrolyzers and offshore wind



Muritala-Ibrahim
Ibrahim Muritala is International Hydrogen Lead on the American Bureau of Delivery (ABS).

Inexperienced hydrogen is being positioned to play a important function in decarbonizing hard-to-abate sectors of the financial system. Builders at the moment are exploring the combination of electrolyzers with offshore wind farms to provide inexperienced hydrogen at sea. The strategy combines considerable offshore renewable power with hydrogen versatility, accelerating the power transition, says Ibrahim Muritala, who examines the alternatives and challenges.

The idea of a inexperienced hydrogen financial system to decarbonize industries isn’t new. Nevertheless, early enthusiasm waned as a consequence of excessive prices and technical challenges. Regardless of this, inexperienced hydrogen stays a compelling resolution for lowering emissions in energy-intensive sectors. Whereas demand for hydrogen is anticipated to develop slowly over the following decade, analysts predict vital acceleration after 2035[1].

Offshore hydrogen: an enormous problem, an unlimited alternative
Renewable power is essential to producing inexperienced hydrogen, transferring from gray or blue hydrogen to totally sustainable options. Offshore wind power provides a novel alternative to provide inexperienced hydrogen at scale, contributing meaningfully to world decarbonization objectives.

The idea is simple: putting electrolyzers at offshore wind farms, the place generated electrical energy is used to separate water into hydrogen and oxygen. There are totally different electrolyzer applied sciences – alkaline, proton change membrane (PEM), or stable oxide electrolyzers – every with various efficiencies, capital prices, and operational traits, and they are often straight coupled with floating or fixed-bottom wind generators. The produced hydrogen may then be both transported through pipelines or saved on-site utilizing compressed gasoline or liquid hydrogen applied sciences and doubtlessly transformed into chemical carriers like ammonia for environment friendly delivery to shore. The selection of know-how and system structure will rely upon varied elements, together with site-specific circumstances, power useful resource availability, and the dimensions of manufacturing desired.

Producing hydrogen offshore gives entry to considerable renewable power whereas avoiding land-use conflicts. It additionally creates jobs in distant coastal areas and enhances power safety by diversifying power sources and lowering reliance on fossil fuels.

Offshore hydrogen: making it work
Producing hydrogen offshore provides thrilling prospects, nevertheless it additionally presents some vital obstacles that should be overcome to make sure the feasibility and success of those tasks:

  • Security Consideration: The extremely flammable nature of hydrogen requires sturdy security procedures for storage, transport, and dealing with all through the offshore manufacturing course of, including complexity and value.
  • Specialised Infrastructure Wants: Offshore hydrogen manufacturing requires specialised ships, storage services, and port infrastructure. The distinctive properties of hydrogen, notably its low density, necessitate costly high-pressure or cryogenic (extraordinarily chilly) storage options.
  • Challenges within the Marine Atmosphere: Developing and sustaining services at sea is significantly costlier than on land. Components resembling corrosion, highly effective storms, and the buildup of marine organisms like biofouling pose fixed technical and monetary challenges.

Whereas hydrogen’s potential as a clear power vector is immense, it comes with formidable challenges. Hydrogen is very flammable, with a low ignition level and broad explosive vary, which requires stringent protocols for storage, dealing with and transportation. Manufacturing strategies range of their effectivity and environmental influence, and it requires specialised tankers, vessels and port infrastructure to handle security and dealing with points.  Its low density requires both excessive strain storage or cryogenic liquefaction, which will increase the prices and the chance of strain vessel failures and cryogenic embrittlement. The shortage of present infrastructure or provide chains additional contributes to the excessive capital prices of any hydrogen undertaking, whether or not onshore or offshore.

Offshore hydrogen manufacturing provides additional complexities. Infrastructure within the marine atmosphere is inherently costlier, with extra dangers resembling speedy corrosion, excessive climate circumstances, and biofouling.

At ABS, with a long time of expertise in guiding innovators, reviewing new applied sciences and offering classification/certification providers to the offshore industries and world delivery, we perceive that these limitations are normal with new applied sciences.

Regardless of these challenges, pioneering firms are main the best way pushing forward with their very own tasks. In Scotland, for instance, Hywind Scotland, the world’s first business floating wind farm, is exploring potential hydrogen manufacturing add-ons. In the meantime, the AquaVentus undertaking in Germany seeks to determine a large-scale offshore hydrogen manufacturing facility powered by devoted North Sea wind farms, with a focused manufacturing capability of 10 gigawatts (GW) of inexperienced hydrogen by 2035[2]. This can be a enormous enterprise bringing collectively a various vary of stakeholders, together with power firms, know-how suppliers, analysis establishments, and authorities companies. This collaborative strategy is deemed important to navigate the complexities of making a strong inexperienced hydrogen infrastructure in Europe.

The prize
Regardless of the challenges, hydrogen represents a major alternative within the transition to cleaner power programs. As a clear power provider, hydrogen holds immense potential. It’s considerable, and its distinctive means to provide solely water vapor when utilized in gas cells and combustion programs makes it a compelling resolution to scale back emissions in transport and industrial purposes. Hydrogen acts as a flexible power storage medium, able to storing extra renewable power electrons in molecular type and thereby serving to to stabilize energy grids reliant on intermittent sources like wind and photo voltaic.

There are financial advantages as properly. In line with the Hydrogen Council, a hydrogen financial system may generate as many as 30 million jobs throughout the globe by 20305. Environmentally, offshore hydrogen manufacturing gives a viable pathway in the direction of lowering greenhouse gasoline emissions and displacing fossil fuels in hard-to-decarbonize industrial processes and transportation sectors.

Maximizing these alternatives would require continued developments in electrolysis know-how, notably those who improve effectivity, sturdiness, and scalability main in a discount to manufacturing prices and enchancment in efficiency. Equally, developments in hydrogen storage applied sciences, which might allow the protected and cost-effective storage of hydrogen each offshore and onshore, will likely be very important for integrating offshore manufacturing into the broader power system.

Regulatory help 
Past technological developments, sturdy regulatory help is crucial. Governments are more and more recognizing the significance of hydrogen of their power methods and are anticipated to develop extra complete regulatory frameworks that foster the event of offshore hydrogen services.

These frameworks ought to embrace:

  • Establishing clear allowing processes,
  • Implementing monetary incentives and funding mechanisms,
  • Creating standardized security protocols.
  • Facilitating integration not simply into electrical energy grids and hydrogen distribution networks but in addition doubtlessly mixing hydrogen into present pure gasoline infrastructure.

At a world stage, the joint improvement of standardized applied sciences, and the institution of collaborative analysis packages throughout borders will assist to scale back prices, streamline the event course of, and keep away from the duplication of effort. This collaboration can be very important for guaranteeing that offshore hydrogen manufacturing is environmentally accountable, prioritizing the safety of marine ecosystems and native communities.

Offshore inexperienced hydrogen represents a transformative alternative for the worldwide power transition. Whereas challenges stay—starting from security issues to excessive capital prices—collaborative efforts between personal trade, governments, and analysis establishments can overcome these limitations. ABS brings a long time of experience in guiding innovators and trade stakeholders by new applied sciences and guaranteeing security requirements. By supporting infrastructure improvement and certification processes, ABS goals to assist offshore inexperienced hydrogen obtain its potential as a cornerstone of a low-carbon future.

Notes
[1] https://www.pwc.com/gx/en/industries/energy-utilities-resources/future-energy/green-hydrogen-cost.html

[2] https://aquaventus.org/en/