HNHacker News
TopNewBestAskShowJobs

A_Person

128 karma · joined July 18, 2017

Retired software guy. I was coding before you were born! Get off my lawn!
submissionscomments
A_Person··on How SQL Database Engines Work, by the Creator of SQLite (2008) [video]
Yes indeed. I haven't checked his research dates, but I was writing database software in the late (uh) 60s and early 70s. I think that was even before "goto harmful". I still remember our standards officer saying, let's try some of this structured programming stuff!
A_Person··on How SQL Database Engines Work, by the Creator of SQLite (2008) [video]
Nope! I've never used postgres at all. Most of my RDBMS work was done on HN NSFW ALERT - oracle :-) But your comment supports my general point, which is, that data modelling and relational schema design skills are product agnostic; normalization is normalization, as it were.
A_Person··on Ask HN: What are the things that you have automated in your personal life?
All of the websites concerned have strict authorization requirements and none have public APIs afaics. At the start, it just seemed easiest to automatically scrape them. I guess I could have reverse engineer their private APIs and used those - but as the doctors say, the retrospectoscope is a rare and expensive piece of equipment!
A_Person··on How SQL Database Engines Work, by the Creator of SQLite (2008) [video]
Gosh, I must say there seems to be some misunderstanding of RDBMS concepts in some posts in this thread!

I was writing database systems professionally, back in the days before the RDBMS concept was even a thing. So here's my (enormously long and convoluted) 2 cents worth. Please be sure to pack a sandwich and get hydrated before you continue.

Say you were dealing with doctors and patients, and needed to store that information in a database. Back in the day, you'd typically use a so-called hierarchical database. To design one of those, you need to decide, what is the most common access method expected to be: getting the patients for a given doctor, or the doctors for a given patient? You'd design the schema accordingly. Then, the preferred access method was easy to code, and efficient to run. The "other" access method was still possible, but harder to code, and slower to run. The database schema depended on how you thought the users would access the data.

But that is absolutely what NOT what to do with an RDBMS. Certainly you look at the users' screens, reports, and so on - but that's just to determine what unique entities the system must handle - in this case, doctors and patients. Then you ignore how the users will access the data, and work out what are the inherent logical relationships between all the entities.

Your initial answer might be this. A doctor can have many patients, and a patient can have many doctors. As any competent relational designer will instantly know, this means you need a resolving table whose primary key is a composite key comprising the primary keys of the other two tables. So if Mary was a patient of Tom, you'd add Mary to the patients table (if not already there), Tom to the doctors table (ditto), then add a Mary/Tom record to the resolving table. By that means, a doctor could have any number of patients, a patient could have any number of doctors, and it's trivially easy to write simple, performant SQL to access that data however you want.

But then you'd have a ghastly thought: patients can also be doctors, and doctors can also be patients! Say Tom was also a patient of Mary! Now you need a Tom record in the patient's table, but that would inappropriately duplicate all his data from the doctors table! Something's clearly wrong. You'd soon see that from a data modelling viewpoint, you don't want doctors and patients as separate entities - you want a single entity Person, and a resolving table to relate arbitrary people in specified ways.

So what?!!

So this. IMHO, many developers using relational databases have absolutely no idea about any of that. They design hopelessly unnormalised schemas, which then need reams of ghastly SQL to get anything out. The query planner can barely parse all that crap, let along optimise it. The database has to stop every five minutes to wet its brow and take a drink.

So here's my advice to any inexperienced relational database designers who have actually managed to get this far!! If you can answer the following questions off the top of your head, you're probably on the right track. If you can't, you're lacking basic knowledge that you need in order to use an RDBMS properly:

- what is a primary key? - what is a foreign key? - what is an important difference between primary keys and foreign keys? - what is a composite key? When would you use one? - what are the three main relations? - what is normalisation? - what is denormalization? - what is a normal form? and so on.

Just my 2c! :-)

A_Person··on Ask HN: What are the things that you have automated in your personal life?
Nope, never heard of it. My software certainly has to click lots of thing! But it also has to do lots of data processing behind the scenes. So the clickety click is only part of the story :-)
A_Person··on Ask HN: What are the things that you have automated in your personal life?
I'll certainky take a look at it
A_Person··on Ask HN: What are the things that you have automated in your personal life?
The rubber hose would fail!
A_Person··on Ask HN: What are the things that you have automated in your personal life?
Thanks for the reference to sekenium etc. I know nothing about other browsers' automation capabilities, so i'll takee a look at some stage.
A_Person··on Ask HN: What are the things that you have automated in your personal life?
Onya!!
A_Person··on Ask HN: What are the things that you have automated in your personal life?
To wafflesindeed (there's no reply button):

> I'm not OP, but I suspect they meant that Python and some libraries would have solved your problem in a few days of work.

I wrote software professionally for 30 years. I have a good understanding of the work required to implement a business requirement! I cant really see myself spending 10 years on a one-week task :-)

PS. I didn't downvote you.

A_Person··on Ask HN: What are the things that you have automated in your personal life?
A lot of it is in fully-franked shares in a self-managed superannuation fund. The fund is now in pension mode, which means it pays no tax on earnings. Where I live, fully-franked shares, in a zero tax environment, get a refund, from the tax office, of all the tax that the issuing companies payed on those earnings!! It's a sweet deal, but actually makes me feel a bit guilty. It's all 100% above board (and managed by one of the big 5 accounting firms), but it means I pay less tax than all my friends and acquaintances, all of whom earn much less than me. Reference: Warren Buffet's secretary :-)
A_Person··on Ask HN: What are the things that you have automated in your personal life?
I don't think that would make it much simpler (if that's what you're getting at). There's tons of grunt work that just has to be done - eg. calculating expected dividend payments (by automatically matching portfolio details to dividend schedules from corporate websites), and automatically matching those to bank account credits - all through code. Despite the laughs that the VB languages get on HN, VBScript is in fact, a fully featured traditional imperative programming language, and has all the features you'd expect in such a language (but no IDE :-(). So I doubt that rewriting in python would make much difference. And I'd still be bound to the IE automation model.
A_Person··on Ask HN: What are the things that you have automated in your personal life?
I've no idea what they are! They're all random strings within the integrated password manager that I wrote as part of the package!
A_Person··on Ask HN: What are the things that you have automated in your personal life?
Well put :-) I was actually taking a subtle dig at folk who say, "just ditch IE, how hard can it be?" If you have an enormous corporate or personal application, the answer could be: "impossibly hard", unless a good fairy appears from the sky and rewrites it for free!
A_Person··on Ask HN: What are the things that you have automated in your personal life?
Ok, I'll bite!

About 20 years ago I inherited enough money to retire on for the rest of my life. But the only evidence of those assets was, a dot matrix printout that anyone could have done in five minutes. So over the next few weeks, I created accounts in the various share registries and online banking websites, and manually cross-checked the printed list against those accounts. All was good, but I wanted to do that on a regular basis, and it was clear that doing it manually, on a regular basis, was not gonna happen.

I am personally -- NSFW SPOILER ALERT!! -- a long time Windows/IE user, and I knew that IE has a comprehensive automation interface. In literally a few lines of VBScript (say), you can programatically start IE, navigate to URLs, parse the DOM, create new local documents, and so on. But although those interfaces are very simple, they're not robust against failures, and have various weird and wonderful corner cases that will sometimes trip you up.

So over the next 10 years or so, I created a robust, general-purpose IE automation wrapper, and wrote some applications on top thereof. The result is that at any time, I can click a few buttons on a handsome user interface, and enter a single master password, at which point my application will automatically log into each share registry and online banking website in turn; download all new and amended data therefrom; transform all data into common formats; store it in a local cache, so it doesn't matter if it later disappears from the website; then creates a single share holdings document, showing all share holdings from all share registries, and a single online banking document, showing all transactions from all accounts at all banks since the start of time. Both documents have dynamic, user-defined sorting and filtering. They also hilite significant changes; check all share holdings against banking credits to confirm that all expected dividends were received; and so on.

In other words, I've completely automated various important financial checks that I simply couldn't do by hand on a regular basis. The downside is, I'm tied to IE - and - several hundred thousand lines of VBScript! If anyone would like to re-write all that code for Chrome or whatever - for free - you're more than welcome to contact me!!!

A_Person··on Malta: an island of secrets and lies
Most people do not have car accidents. But seeing one might reasonably cause you to wonder how that happened, whether it might happen to you, and if so, how you might reduce your risk.

Seeing what happend to Stephen Martin, I ask myself, could that happen to me (if I was diving there), and if so, how could I reduce my risk? The answers (for me) are Yes It Could, and Don't Dive There!

A_Person··on Malta: an island of secrets and lies
I'd say they only dropped it because of high-level pressure and adverse publicity. I wouldn't assume the same outcome with, for example, a random ozzie instructor on a diving holiday. The concerning issue, IMHO, is that such serious charges were bought at all, particularly given the absurd allegations contained therein (improper diving profile etc.). Also the fact that they didn't even inform him of their investigation or give him a chance to appear!

My view is, who's to say they won't do it again?

> Most people have no issues diving in Malta

Until they do! :-)

PS. Not trying to start an argument, just stating my view from this side of the pond :-)

A_Person··on Decode Like It's 1999: MPEG-1 Decoder in JavaScript
Good writeup.

This is probably a silly question, but: The article says he has to use performance.now. But isn't one of the mitigations for Spectre and/or Meltdown, to reduce the accurance and/or resolution of performance.now? If so, would that affect his code?

A_Person··on Malta: an island of secrets and lies
> Malta is awesome ... the scuba diving is some of the best in the Mediterranean.

Not after this: https://www.theguardian.com/law/2016/jan/17/briton-fights-ex...

I won't summarize that article, since it's all quite clear as long as you read to the end. The upshot is, that anyone diving in Malta is subject to bizarre legal risk if something goes wrong. It's a bit like stopping to help at an accident, and then being charged with causing it!

The whole thing raised a massive stink amongst BSAC divers, since it seemed (at one point) that BSAC insurance wouldn't support him. I think he's still 6 figures out of pocket.

TL/DR: do not dive in Malta.

A_Person··on Ask HN: Polarized LCD screens?
Hmm, I see that Mr Google has lots of info on, uh, "lcd screen polarization", but I'll leave my question up regardless!
A_Person··on Tiny, weird online communities made a comeback in 2017
I can't stand comment systems with anonymous downvotes. It's like being in a group discussion, then someone else, hidden behind the curtain, calls out "You're an idiot!" Most people wouldn't stand for that. They'd say, "Come out and express your opinions, or stfu!"
A_Person··on Radical diet can reverse type 2 diabetes, new study shows
I've always been slim and not eaten much. But a few years ago I started to develop a paunch! For the first time in my life, I started to check the sugar content of what I was eating. The results surprised me greatly. For example, I like chocolate protein drinks, and often have 4 or 5 per day. But the one that I liked had 10g sugar per serve. The different brand right next to it had <1g sugar/serve! So that was an instant save of ~45g sugar/day. I also had no idea of how much sugar is in orange juice. And the misleading labelling! One juice on our local shelves says: "NO ADDED SUGAR!" - but has absolute truckloads of sugar already. Results (a few months later): me 1, paunch 0!
A_Person··on ‘Outsiders’ Crack 50-Year-Old Math Problem (2015)
Yes, great catch! Perhaps Tom said "3 weeks" to Dick, Dick said "4 months" to Harry, and Harry said "5 years" to Jane! :-)
A_Person··on ‘Outsiders’ Crack 50-Year-Old Math Problem (2015)
> "He guessed that the problem might take him a few weeks. Instead, it took him five years"

>> Perhaps the key to their success was typically programming work estimations ;)

No, you should always normalize programmer estimates by increasing both the unit and the measure by one. So "a few weeks", say 4 weeks, will actually take: 5 months! So he still took 12 times longer than the properly normalized estimate! :-)

A_Person··on Programming in the 1960s
A 'C' in column 1 - FORTRAN's comment indicator! So the statement was there, but commented-out. The 'C' was exactly under the thumbprint at the start of that line on the dirty old listing. No-one had thought what might be under that thumbprint :-)
A_Person··on Programming in the 1960s
One of my early jobs in the late 60s/early 70s was with a small government group providing online data processing services to various local hospitals. The system ran on two CDC computers, a 1700[1] and a System 17. These were originally intended for things like process control, but this group had added a home-grown multiuser timeshare system on top, then an online pathology application system on top of that!

My first experience in this group was watching them debug a problem. They had an old FORTRAN listing spread out over a table-sized (10Mb!) disk drive unit. The bug was in 5 lines of code, but it just didn't make any sense - it was as if one line was simply not being executed.

Eventually one of the guys went over to the command console and looked at the object code on disk. "Hey, that 'IF' statement isn't in the object code!". More head scratching ensued, until someone looked more carefully at the grubby thumbprint at the start of that line on the dirty old listing.

Under that grubby thumbprint was ...

[can anyone quess?]

[1]https://en.wikipedia.org/wiki/CDC_1700

A_Person··on Robot cracks open safe live on Def Con's stage
> The hope is that once assembled and weighted it can't be moved easily.

It's amazing how heavy a burglar safe is - even a small one. I have one just big enough to store some documents, spare phone, keys, and some cash. But it took two guys and a trolley to get it up the stairs to my apartment. Even if a burglar could rip it out of the floor, and push it down the stairs, I doubt that they could lift it up into their car or whatever.

A_Person··on Robot cracks open safe live on Def Con's stage
> wouldn't it be better you told [your relative] so that he can either get a burglar proof safe if that's what he wants or get a new fireproof safe that he then doesn't destroy by drilling through it?

Fair comment. But I guessed that all he wanted was something that would stop a burglar from bashing it open in 5 minutes. It's probably fine for that purpose. But I might say something to him next time.

A_Person··on Robot cracks open safe live on Def Con's stage
> Does it matter if I don't bolt it to the floor?

It depends on the type of safe. I'm not a locksmith, but I have researched this, and this is how I understand it.

There are "security" safes (aka "burglar" safes), and "fireproof" safes. A security safe should be bolted to the floor, to stop the bad guys ripping it out. It comes with pre-drilled holes for that purpose. However, a fireproof safe should not have any thru-wall holes, since a fireproof safe must protect against the deluge of water that will occur when the fire is put out. Thus, fireproof safes are often glued instead of bolted.

Some time ago, a relative showed me his new safe. It didn't have any pre-drilled holes, so he drilled some in, so he could bolt it to the floor. I chose not to tell him the following: (1) The fact that he could drill any holes in the safe, using his trusty Black & Decker drill, showed that it was a fireproof safe - not a security safe; and (2), drilling those holes destroyed its value as a fireproof safe!

In summary, you need to decide what's most important - theft protection, or fire protection. Those are different types of safes. The problem is they look identical to the untrained eye.

[edit: sp]

A_Person··on Dear Floyd Mayweather, you’re why the SEC exists
Not necessarily!

Australia has a system called "imputation credits" or "franking credits".

Say a company BigCo makes an operating profit of $100. They decide to pay that out as a divident to shareholder Mary. Australia's company tax rate is 30%, so BigCo sends $30 to the tax department, and the remaining $70 to Mary.

Say Mary's personal tax rate is 50%. On the face of it, Mary would pay 50% of the $70 (ie. $35) to the tax department, leaving $35 in her own pocket. However, this would mean that the original $100 profit had been taxed at 65% ($30 + $35)! This is seen to be inequitable, and a disincentive to owning shares.

So instead what happens is this, Mary gets a "franking credit" of $30 along with the $70 dividend. The franking credit is just a book-keeping entry to record the amount of tax that BigCo paid on its original $100 profit.

At tax time, Mary's accountant proceeds as follows. (1) Add the franking credid ($30) to the divident amount ($70), thus reverse-engineering BigCo's original profit ($100). (2) Apply Mary's personal tax rate (50%) to that whole profit, getting $50. (3) Ensure the tax department gets that $50, regardless of who and where it comes from!

In this case, BigCo has already paid $30 of the $50 total tax obligation on the original $100 profit, so Mary is only up for the remaining $20. By that means, BigCo's original profit of $100 is eventually taxed, in total, at Mary's personal tax rate of 50% - not at the double-taxed rate of 65%.

This might just seem like a whole lotta shakin' goin' on - but wait, there's more!

Say the dividend was paid to another company (SmallCo) instead of to Mary. SmallCo's tax rate is also 30%, so when you apply the franking credit, you'll find that SmallCo pays no tax on the $70 dividend.

Now say it was paid to a self-managed superannuation fund (SMSF) in so-called "transition to retirement" phase. These are only taxed at 17%. 17% of $100 is $17, so the total tax expected by the tax department, on the original $100 profit, has been overpaid by $13 ($30 - $17), and the tax department will refund that $13 to the SMSF! The SMSF gets the $70 dividend, and not only pays no tax on that, but also, gets a $13 refund cheque.

Then we get to the apogee of this process, the quintessence of financial wizardry, a situation so warming to the heart as to impose some risk of dangerous palpitations. Say the SMSF has gone into "pension mode". In that mode, it pays no tax. Thus, when the fund receives the $70 dividend, it also receives a full refund of the $30 tax originally paid by BigCo!

As I understand it, BigCo can actually choose to pay the full tax, part of the tax, or no tax, on its origial $100 profit. The dividend is correspondingly said to be "fully franked", "partly franked", or "unfranked". A dividend recipient ("X") might get a mixture of franked and unfranked dividends from various sources. "X" would add all franking credits to a notional "franking account", then use that account at tax time to offset their normal tax obligations.

[edit: typos]

← PreviousPage 2 of 3Next →