HNHacker News
TopNewBestAskShowJobs

SigmundA

3,253 karma · joined February 21, 2011

submissionscomments
SigmundA··on Testing UPS Output Waveforms
>The CMRR of the Micsig I linked is pretty average, but it's a lot better than the TiePie at low frequencies. Micsig also specifies it at multiple points across the spectrum, while TiePie doesn't even say where they measured it.

It worse at high frequencies and the same in the middle. Again this is a whole scope compared to a probe.

Not sure why you think Tiepies are toys, they are use professionally in Europe, popular for automotive. They have a lot more expensive scopes, and the price difference for the differential versions are not that much.

SigmundA··on Testing UPS Output Waveforms
>Now, let's say you want to probe two things at the same time (triggered by a common signal source). You can't. And the reason you can't is because the producer took the expedient of floating the entire scope, and there's no trigger input.

Yes this is very inexpensive single input scope, they make more expensive multi input scopes you can stack as many as you want and have them synced:

https://www.tiepie.com/en/usb-oscilloscope/handyscope-hs6-di...

The difference in price between their single ended and differential scope is not the much so it seems the actual differential part is not the expensive part, back to my original point.

>Related to that, this thing doesn't appear to have a step attenuator, which is why the effective resolution depends on the volts/div setting of the input.

They sell differential step attenuators: https://www.tiepie.com/en/usb-oscilloscope/accessories/diffe...

>Also, they don't specify the CMRR, which is one the main figures of merit people look for on differential probes.

CMMR 60db from thier spec sheet: https://download.tiepie.com/Documents/Datasheets/Datasheet-H...

>This is not to say the product you linked shouldn't or can't be used for anything, but it is a niche product. That's probably why it is advertised as a "power quality monitor" and not an "oscilloscope".

From their spec page: "The tables below show detailed specifications of the Handyscope TP450 high voltage oscilloscope."

and

"The Handyscope TP450 is delivered with the versatile Multi Channel oscilloscope software, which transforms the Handyscope TP450 into an oscilloscope, spectrum analyzer, data logger, multimeter and protocol analyzer."

They make quite a few differential scopes, that just happens to be a inexpensive one physically deigned for power quality analysis.

SigmundA··on Testing UPS Output Waveforms
I understand what a differential probe does, what I don't understand is why they are so expensive. Again one can get a whole USB differential scope for the same price or less. Seems like just a differential probe should be relatively inexpensive well under a $100.

The Tiepie software actually works very well even though it's Windows only, they do have Linux library, just no GUI on Linux. Its not single purpose its a full oscilloscope that happens to use differential inputs.

They actually do sell one more purpose built for power quality analysis which is new. I would love to have a couple on my home power split phases to view and log power quality in detail: https://www.tiepie.com/en/usb-oscilloscope/handyscope-tp450

SigmundA··on Testing UPS Output Waveforms
Why are differential probes so expensive and why don't more scopes just have differential port built in?

For about $300 you can buy a Tiepie differential usb scope: https://www.tiepie.com/en/usb-oscilloscope/handyprobe-hp3

SigmundA··on GameStop makes $55.5B takeover offer for eBay
I mean its on the website...
SigmundA··on Removable batteries in smartphones will be mandatory in the EU starting in 2027
Wood boats have been around for hundreds of years as well doesn't mean they are just as good in leak resistance to welded boats...

Ship vs boat is also not a contradiction.

SigmundA··on Removable batteries in smartphones will be mandatory in the EU starting in 2027
Now go look up why they stopped riveting ships in the 40's and went to welding, there are no modern riveted ships. Even with the rivets they were forged not pressed, nothing like a screw.

Cheap aluminum boats are still riveted, welding preferred for obvious reasons. I have an old riveted aluminum John boat and is leaks through the rivets and seams...

SigmundA··on A web-based RDP client built with Go WebAssembly and grdp
Logically air gapped :)

https://docs.aws.amazon.com/aws-backup/latest/devguide/logic...

SigmundA··on What game engines know about data that databases forgot
Because there is a whole section that describes column based storage without mentioning that some databases have column based storage as an option.
SigmundA··on What game engines know about data that databases forgot
>Cache locality by default. In a traditional row store, reading all player positions means loading entire rows — names, inventories, health, everything. Most of those bytes are wasted.

Not one mention of column stores? This didn't come from ECS...

https://en.wikipedia.org/wiki/Data_orientation

SigmundA··on Data centers are transitioning from AC to DC
The batteries and phone lines were one system at -48v with power supplies converting AC power to DC while grid / generator is up.

The batteries are floated at the line voltage nothing was really charging or discharging and there was no switchover.

This is similar to your cars 12v dc power system such the when the car is running the alternator is providing DC power and the batteries float doing nothing except buffering large fluctuations stabilizing voltage.

SigmundA··on Urea prices
Not sure what your point is, I was talking primarily about Class 8 heavy duty commercial trucks (semi) and other medium duty commercial use.

All the stuff that makes up emissions gear is highly recyclable and in fact some of it very desirable which is why people are getting catalytic converters stolen. So I do not worry about it filling up a land fill.

I also don't worry about EV batteries filling landfills because again they are very high grade ore for new batteries, once we have enough in circulation we no longer need to mine much lithium or rare earth.

I agree it should be reliable and repairable and forcing the manufacturers to have very long warranties on it seems like a good way to do that, having followed the various generations of DEF systems for the last decade the manufacturers have been making big strides because it costs them otherwise and has.

I also think airplanes using lead is stupid, but that is a fraction of even private diesel pickup usage let alone commercial trucking. Diesel pickups are at least 10% of all pickup sales now days.

SigmundA··on Urea prices
No the DEF systems tend to break down and its mandated the engine go into limp mode when they do, this is hated by those that do not care for emissions and one of the biggest reason to delete by truckers. Also costly to fix the systems out of warranty.

You can find instructions on how to make DEF simulators using raspi's to fool the ECU into think the DEF system is working, people who do care about emissions will still carry these for emergency so they continue on their trip and get to a shop later. The derate was over zealous for sure and was a bad policy.

Also DPF is a performance issue since it blocks the exhaust to some degree, same with catalytic converter with def nozzle so no its not just EGR at all. DPF also consumes more fuel for regens.

2027 diesel regulations was to mandate even more NOx control but also specified manufacturers were required to have 100,000 mile 10 year warranty on emissions systems, its 5 year, 50k now. I believe thats dead in the water now.

A diesel engine with a deleted SCR system puts out 40 times the NOx of a working one. Thats 40 trucks going down the road to 1 equivalent. NOx causes asthma and acid rain, its not for the environment as much as for you directly.

SigmundA··on Urea prices
There are three main emissions control systems in diesels, the Exhaust Gas Recirculation (EGR), Diesel Particulate Filter (DPF) and Selective Catalytic Reduction (SCR) which uses Diesel Exhaust Fluid (DEF).

Any or all can be "deleted" and is a crime to do so. All 3 systems add complexity and potentially reduce performance which is why those who don't care about emissions like to get rid of them.

Before DEF NOx regulations steadily went up engine manufacturers relied on increasing amounts of EGR to control NOx until it was not tenable, once DEF systems where implemented they could back off EGR increasing performance but not as much as ripping it all out and tuning for no care of emissions.

There are EGR free engines that rely entirely on DEF to control NOx but they are not for on-road use in the US thus far.

SigmundA··on Urea prices
Saw posters on /r/Truckers complaining that truck stops were taking advantage of situation to gouge for DEF too on top of diesel before someone pointed out that Iran is the second largest producer of urea, the primary component of DEF. They are not happy right now with $5.00 / gal fuel and higher DEF as well.

Worried the administration will use it as an excuse to rollback NOx emissions regulations that mandated DEF usage in diesel engines. They are already not enforcing "deletes" of the emissions systems which is a federal crime.

SigmundA··on Nobody ever got fired for using a struct
There is a lot of space between no acknowledgment at all like this article and tracing down the exact origin of who and when invented to null bit map in what system.

Your version comes off as self promotion, going into detail how to implement a the technique with out once calling it a common technique or even mentioning its widely used in the industry to solve the problem you are solving.

It would be like saying finding rows in storage is slow so we implemented a b-tree in a separate structure for certain columns and go into detail how to create a b-tree, calling it a "trick" while never once acknowledging the is the most common form of indexing in RDBMS's, would you understand how this would seem strange?

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
>You're the one saying a 2 character string is somehow a space savings. If we're going to split hairs that finely then you have to know that any row with a variable length string makes the entire row/index variable length and that is a net storage and performance loss.

The row is always variable lengths as a structure it has flags noting how many columns there are with values and if there is a variable length section or not, only rows with no variable length fields at all has no variable length section and that is a bit flag check in the header.

You are making a non argument, variable length fields can be a space savings over an int with single char codes which is very common, and do not impact performance in any meaningful way. Besides that one could use fixed length chars and still get the other benefits I mentioned while having the same exact space usage and processing as a fixed length ints.

>That's not what happens but what happens is that somebody renames New York to New Eburacum

Changing the descriptive meaning of an entry causes all sorts of problems and even more so if it is a int because it's completely opaque its much harder to see an issue in the system because everything is a bunch of ints that do not correlate in any way to their meaning.

Changing the description to something that has the same meaning worded differently is usually not an issue and still gives good debug visibility to the value. If you and your users consider New Eburacum synonymous with New York, then having the code stay 'NY' should not be an issue and still be obvious when querying the data.

Unless someone is using the short code in a user visible way and it has to be updated. State is a common one that does this and nobody is changing state names or codes because it is a common settled natural key.

In the rare situation this actually needed to be done then one can update existing data, this is a not an issue in practice. You have the be extremely cautious updating the description of a code because much data was entered under the previous description and the meaning that it carries, having the code have some human meaning makes it more obvious to maintainers this should be done with care, many times it would involve deprecating the old one and making a new one with a different code because they have different meanings, having a table instead of a enum allows other columns to have this metadata.

This is not the same issue as say using a SSN for a person ID.

SigmundA··on Nobody ever got fired for using a struct
Interesting so you don't find it odd that an article about the storage engine of a SQL database system explains the solution to problem without once mentioning that it is the way most other sql database engines solve it? It is mentioned several times sql table are typically sparse, but not that this is how its typically solved, only this is how you solved it...

>The fix is simple: we stop storing Option<T> and instead we store a bitmap that records which fields are None.

Right here would have been the opportunity to let those not familiar with database internals know. Something like "This technique has been widely used in many RDBMS systems over the years, you can see the PG version of this in their documentation for page layout".

Instead you go into detail on what a null bitmap is and how to implement it, calling it a "trick". Which is strange if you think your target audience is assumed to already know this common technique.

I mean not one mention of the origin of the trick or even calling it a common solution to this problem...

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
>Sure they do, because now your row / index is variable length rather than fixed length. Way more complicated.

Come on its literally a 2 byte per column header in the row so it just sums the column lengths to get the offset, it does the same thing for fixed length except it gets the col length from the schema.

It's not much more complicated than a fixed length column only the column length is stored in row vs schema. I am not sure where you are getting this idea it way more complicated, nor the 3 vs 4 byte thing, the whole row is a variable length structure and designed as such, null values change the row length fixed or variable data type and have to be accounted for since a null takes up no space in the column data its only in the null bitmap.

> what's the point of user-configuration of someone hard-codes 'NY' in a query or in the code

Because it doesn't matter, 'NY' isn't changing just like 11 the int wouldn't change, but 'NY' is way easier to understand and catch mistakes with and search for code without hitting a bunch of nonsense and distinguish when 10 columns are all coded next to each other in a result set.

I prefer my rows to be a little more readable than 1234, 1, 11, 2, 15, 1 ,3 and the users do too.

I have had my fill of transposition bugs where someone accidentally uses the wrong int on a pk id from a different table and still gets a valid but random result that passes a foreign key check almost enough for me to want to use guid's for pk's almost. At least with the coded values it is easier to spot because even with single character code people tend to pick things that make sense for the column values you know 'P' for pending, 'C' for complete etc, vs 1 2 3 4 used over and over across every different column with an auto increment.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
https://en.wikipedia.org/wiki/Natural_key you should have learned learn this in your courses.

Clam down, I am not suggesting using this for actual domain entity keys, these are used in place of enums and have their advantages. I have doing this a long time and it has not bit me, I have also seen many other system designed this way as well working just fine.

Using an incrementing surrogate key for say postal state code serves no purpose other than making things harder to use and debug. Most systems have many code values such as this and using surrogate key would lead to a bunch of overlapping hard to distinguish int data that leads to all sorts of issues.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
The check is added if it sees a varchar column and nvarchar parameter predicate on it.

It currently just does a scan in that situation which orders of magnitude more expensive with a cast for every row vs a single extra cast check on the single parameter value that may avoid all those other casts in a common situation.

There is no planning overhead, it's already detecting the situation. The execution overhead is a single extra cast on top of the cast per row, so n+1 vs n with the potential to eliminate n with a very common charset.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
>Enums are for non user-configurable values

In the systems I work with most coded values are user configurable.

>But those should have an auto-integer primary key and if you need the description, join for it.

Not ergonomic now when querying data or debugging things like postal state are 11 instead of 'NY'

select * from addresses where state = 11, no thanks.

Your whole results set becomes a bunch of ints that can be easily transposed causing silly errors. Of course I have seen systems that use guids to avoid collision, boy is that fun, just use varchar or char if your penny pinching and ok with fixed sizes.

>the length of the string is stored as an int

No it's stored as a smallint 2 bytes. So a single character code is 3 bytes rather than a 4 byte int. 2 chars is the same as an int. They do not complicate storage access in any meaningful way.

You could use smallint or tinyint for your primary key and I could use char(2) and char(1) and get readable codes if I wanted to really save space.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
It should not return incorrect results, if the nvarchar only contains ascii it will cast perfectly, if it doesn't then do the slow scan path, it's a simple check and the same work its doing for every row in the current behavior except one time and more restricted. Can you give me an example of an incorrect result here?

I am not talking about the default cast behavior from nvarchar to varchar, but a specific narrow check the optimizer can use to make decision in the plan of ascii or not with no information loss because it will do the same thing as before if it does not pass the one time parameter check.

By far the most common cause of this situation is using ascii only in a nvarchar because like say in this example the client language is using an nvarchar equivalent for all strings, which is pretty much universal now days and that is the default conversion when using a sql client library, one must remember to explicitly cast rather than the db doing it for you which is the expected behavior and the source of much confusion.

This would be purely an optimization fast path check otherwise fall back to the current slow path, correct results always with much faster results if only ascii is present in the string.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
The non sargeablilty is an optimizer deficiency IMO. It could attempt to cast just like this article is doing manually in code, if that success use index, if it fails scan and cast a million times the other way in a scan.
SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
We are talking nvarchar here, yes UTF-8 solves this issue completely and MSSQL supports it now days with varchar.
SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
Mostly agree separate tables can have multiple attributes besides a text description and can be exposed for modification to the application easily so users or administrators can add and modify codes.

A common extra attribute for a coded value is something for deprecation / soft delete, so that it can be marked as no longer valid for future data but existing data can remain with that code, also date ranges its valid for etc, also parent child code relationships.

Enums would be a good feature but they have a much more limited use case for static values you know ahead of time that will have no other attributes and values cannot be removed even if never used or old data migrated to new values.

Common real world codes like US postal state can take advantage of there being agreed upon codes such as 'NY' and 'New York'.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
It can run it for a range of values: https://learn.microsoft.com/en-us/sql/relational-databases/p...

Also the simpler and maybe better approach is just make the decision every time as an operation in the plan, attempt the cast if it fails then scan and cast a many times the other way, if it succeeds then use the index, this isn't hard and adds one extra cast attempt on the slow path otherwise it does what everyone has to do manually in their code like this article but transparently.

The adaptive join operator does something much more complex: https://learn.microsoft.com/en-us/sql/relational-databases/p...

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
How do you store them? Also enums are not user configurable normally. It would be a good feature to have them, but they don't work well in many cases.

Typical code tables with code, description and anything else needed for that value which the user can configure in the app.

Sure you can use integers instead of codes, now all your results look like 1, 2, 3, 4 for all your coded columns when trying to debug or write ad-hoc stuff. Also ints are not variable length so your wasting space for short codes and you have to know ahead time if its only going to be 1,2,4 or 8 bytes.

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
UTF-8 was introduced in SQL Server 2019:

https://learn.microsoft.com/en-us/sql/sql-server/what-s-new-...

SigmundA··on C# strings silently kill your SQL Server indexes in Dapper
Specifically not talking about a name field
← PreviousPage 2 of 34Next →