Wikipedia:Reference desk/Archives/Computing/2021 February 20
Computing desk | ||
---|---|---|
< February 19 | << Jan | February | Mar >> | February 21 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
February 20
edit12vdc to 110vac inverter
editThis is more of an electronics question but does anyone know how those little inverters work? The 100 watt ones that plug into your car's cigarette lighter socket. Is there an oscillator and then a transformer and then a chopper? What I'm particularly wondering is whether the output voltage varies with the input voltage. Like if they are made for use at 13.8vdc, will the voltage sag if they get less volts, like 10v? Will they work ok at higher volts like 15v? I'm wondering about the possibilities of running one on e.g. a SLA battery (voltage will gradually drop during discharge) or lithium ion pack (3 cells = 10 to 12 volts) or something of that sort. Load device would be a laptop computer which I think uses around 60 watts while operating and charging its internal battery. Thanks. 2601:648:8200:970:0:0:0:C942 (talk) 01:26, 20 February 2021 (UTC)
- See inverter. Ruslik_Zero 08:54, 20 February 2021 (UTC)
- Car lighter socket voltages tend to be pretty nastily irregular and spiky, so anything intended to be run from one will probably be perfectly happy anywhere between 11 and 15 volts. 108.21.233.20 (talk) 16:58, 20 February 2021 (UTC)
- You'll want to make sure whatever battery you end up using can sustain at leeeast 10 amps discharge safely, to emulate a car accessory socket. Most ordinary lithium cells are only safe up to 3-5 amps, so if you go that route look for the high discharge rated ones intended for model aircraft or the like. Use a fuse for safety, too. 72.89.120.120 (talk) 14:03, 22 February 2021 (UTC)
- Car lighter socket voltages tend to be pretty nastily irregular and spiky, so anything intended to be run from one will probably be perfectly happy anywhere between 11 and 15 volts. 108.21.233.20 (talk) 16:58, 20 February 2021 (UTC)
When exactly does ASP.NET MVC render the view?
editI had a problem with ASP.NET MVC at work yesterday. I had a situation where the model of a page needed a flag set on in a certain situation, but then turned immediately off after rendering the view, because the model was saved into the controller, and this flag should only render into the page once.
I thought I'd be clever by using this kind of code:
public class MyModel
{
public bool MyFlag { get; set; }
public string MyValue { get { return MyFlag ? "yes" : "no"; }
}
public class MyController
{
public IActionResult MyView()
{
MyModel model = new MyModel();
model.MyFlag = true;
IActionResult view = View("MyView", model);
model.MyFlag = false;
return view;
}
}
and then in the view file MyView.cshtml:
<div class="flag">Value of flag is: @Model.MyValue</div>
but this printed "no" instead of "yes". Running it in a debugger revealed that the call to @Model.MyValue only happens after MyFlag has been set back to false.
So I figured that the call to View() does not actually render the page and produce the HTML code. Instead it tells the framework "here's the view file to use, and here's the model to use" and the framework then does the actual rendering at some other point.
My question is, when exactly does the rendering happen then? JIP | Talk 13:43, 20 February 2021 (UTC)