HNHacker News
TopNewBestAskShowJobs

msclrhd

126 karma · joined November 11, 2012

submissionscomments
msclrhd··on Thomas Cook collapses, stranding 150k UK holidaymakers
From the 05:37 summary:

-----

* There are 600,000 Thomas Cook travellers who have been left stuck overseas.

* More than 150,000 of those are Britons.

-----

msclrhd··on Linux Kernel Fastboot [pdf]
Would it be possible on multithreaded architectures to have a thread listening for the response, then setting a flag in /proc or somewhere else to indicate that the part is now active? That way, init code that does not depend on that device can continue to run.
msclrhd··on The subversive messages hidden in The Wizard of Oz
Voicing s as /z/ is widely variational. For example, I voice the s in "us", and "Muslim", while others don't. While I don't voice the s in Australia (/ɒ.ˈstreɪ̯.li.jə/ ~ /ə.ˈstreɪ̯.li.jə/), I do in Oslo (pronouncing it /ˈɒz.loʊ̯/).
msclrhd··on How can List be faster than native arrays? (2018)
It will depend on the allocation method. For example, you could use a pooled allocator that allocates a contiguous array of list items in a block, then use those in order as required. That would help with cached locality. IIRC, the Borland C++ STL implementation did something like this.
msclrhd··on Google search takes 7 seconds on certain queries
I get this a lot when searching for exception messages, or for information on how to implement something. It is getting increasingly harder to find the signal in the noise.
msclrhd··on A Brief Guide to a Few Algebraic Structures
I pronounce it /r@N/ -- i.e. like 'ring' but with the 'a' in comma, or the o in button. Although if it was a Rng formed by a pseudo-random sequence, then R-N-G would be apt ;).
msclrhd··on Intel Prepares to Graft Google’s Bfloat16 onto Processors
4x8-bit values in a 32-bit value? SIMD does this to perform an operation on 4 8-bit values in a single 32-bit register. There are other configurations, IIRC.

https://en.wikipedia.org/wiki/SIMD#Software

msclrhd··on Most Unit Testing Is Waste (2014) [pdf]
Mock things like database access, or better yet pass the database connection via an interface and create a test version of the database access so you can create a database-like thing for your tests (e.g. an in-memory database).

If you are depending on another component of the application (a lexer, a JSON class, a maths function, etc.) don't mock that because if that class breaks you want tests to fail instead of silently passing because the broken class/function was mocked.

If you are depending on thirdparty libraries, don't mock those unless you have to (i.e. if you cannot run the tests). This will help avoid unexpected bugs after upgrading libraries or if supporting different versions of a library.

If you are writing code for a complex infrastructure (e.g. an plugin for an IDE), try to use test-specific versions of enough of the infrastructure to get the rest functioning, and use the real versions of as much as you can. This will help pick up issues in your code when new versions of that infrastructure make changes -- you want your tests to fail in this case, as the real code would fail.

Understand why your tests are breaking and address that. Use @Ignore as a last resort. If APIs or behaviour has changed, update the code and tests to reflect that. If you are supporting different versions, create version-specific compatibility layers.

msclrhd··on Most Unit Testing Is Waste (2014) [pdf]
When implementing lexers and parsers for language specifications, I have taken the approach of testing each token (keyword, number, etc.) for the lexer for each EBNF symbol. This repeats tests for common keywords and other constructions, but means I can see that the lexer handles all the tokens in each EBNF symbol. In this way, these tests are more BDD (behavioural driven development) in style, but without things like gherkin/cucumber. With this approach, I do full coverage tests for a given symbol/token, and just check the basic symbol/token case elsewhere.

I do a similar thing with the parser tests -- have a test for each valid complete symbol production, and then tests for as many error cases that the parser can handle for that symbol.

With that base, I can add additional tests for bugs and additional error recovery cases I implement.

I never see unit tests as a waste as they provide a set of regression tests that are invaluable for refactoring and making other changes to the code, like implementing new features or better error handling.

msclrhd··on The Definitive Guide on Win32 to NT Path Conversion (2016)
How about SHITEMID in the shlwapi DLL? That's supposed to be SH-ITEM-ID.
msclrhd··on Why I Switched from Visual Studio Code to JetBrains WebStorm
I've personally found tests to be invaluable. Yes, they take longer to write than just writing the initial code, but they help save time on testing bugs in the future and ensuring that the code you have written does not regress, especially when refactoring the code.

I've not necesserily always used test driven development, but something close to it, especially for non-UI code where I try and aim for high test coverage.

Tests also help when writing code that implements specifications (JSON parser, XML parser, JavaScript engine, etc.) as you can have tests for each part of the specification and the various error cases.

msclrhd··on IBM is preparing for a UK exit from the EU
Because the ERG ("European Research Group", including MPs like Jacob Rees-Mogg) pushed a UK ammendment to include the March 29th leaving date into UK law, MPs will need to revoke that to make it possible to retract Article 50. It is unclear whether the current pariament breakdown would support removing that ammendment.

The key question is how blocking a no deal Brexit will be implemented, given the rejection of the withdrawal agreement (not a deal!) and the reluctance of the EU to extend the Article 50 period without something different such as a general election or people's vote. There is also the upcoming European Parliament elections in 3 months which -- if the UK stays past that point -- the UK would need to participate in if Article 50 was extended past that point.

A general election is also problematic as it will likely result in another hung parlaiment or slim majority and we will be back where we are. This is especially the case given that Scotland is overwhelmingly SNP, and may gain seats over the Conservatives/Tories.

While a people's vote may be a potential way out of the deadlock, the government (and maybe the majority of parliament) are against it. Even if there is a majority for it, there isn't a majority for what to ask in the new vote. There are MPs that don't want remain on the vote, and there are others that don't want no deal on the vote.

msclrhd··on IBM is preparing for a UK exit from the EU
The UK had trade deals with various countries (including those within the EU) as part of being a member of the EU. It has also built up a lot of infrastructure on the facilitated access to the EU this gave. This covers things like: 1. just in time transport of parts for car manufacture (and other things like florests getting flowers from the EU overnight) that are tariff free; 2. just in time transport of food and medicine (including radioactive materials for x-rays); 3. access to the EU air space for flights going to/from the UK; 4. seamless trade between Northern Ireland and the Republic of Ireland (including roads, houses, and farms that span the border).

In addition to this, a large amount of regulation comes from the EU, along with 40-60 years worth of continued integration and interdependence.

We are now ending that overnight. This needs adequate planning and prepration to ensure that things don't fall over. Things like border checks on both sides and agreements to make sure that things such as access to EU air space continue to run smoothly.

It is problematic because of the scale of the task and the lack of information/transparency from the government. So you have things like banks and aerospace companies moving offices to the EU to try and retain access to the EU on which they depend.

There are things like having to store information on EU citizens within the EU. This was fine when the UK was a part of the EU, but with Brexit that changes, so EU citizen data needs to be stored on servers in an EU country like the Republic of Ireland.

msclrhd··on VFX, Amiga and Babylon 5 [video]
He mentioned that somewhere. It might have been in the script books, and possibly the usenet archives.

You can see that in similarities with various characters -- Lyta Alexander/Talia Winters, Jeffrey Sinclair/John Sheridan, Catherine Sakai/Anna Sheridan. (Note that the former encountered First Ones in a season 1 episode, setting up the possibility of her encountering the Shadows between season 1 and 2.)

msclrhd··on The Case Against Quantum Computing
With Shor's algorithm, the quantum part of the algorithm comes down to finding the period of 'a mod N' where N is the prime number you have, and a is a number less than N that is not a factor of N. Here, the period is the smallest value of x where 'a^x mod N = 1'.

This is done applying the Quantum Fourier Tranform on each 'a^x mod N' using x+1 complex roots of unity for that value of x. You can visualise this as x+1 arrows from the centre of a unit circle with an angle 2pi/(x+1). So, for x=3 you have 4 arrows pointing up, down, left, and right.

When you stack the arrows end to end, they will loop back to their starting point (3 will form a triangle, 4 a square, etc.). The key is that when multiplting this quantum fourier transform with the value of 'a^x mod N', the 1s (at the period) will occur at the same point around the unit circle only for the cases where the number of complex roots is a multiple of the period.

This has the effect that for the correct answer, the arrows are lined up together in a single direction, amplifying the number and thus the probability of selecting that number. For the others, the arrows cycle and loop back on each other, so stay fairly small, decreasing the probability they will be selected.

msclrhd··on The Case Against Quantum Computing
It's not that they can execute a computation faster in the traditional sense. It is that you can exploit the quantum behaviour in some types of computation (e.g. factoring primes) to make the answer more probable, and thus more likely to be "observed", when you read the state of the quantum computer and thus make it easy to locate the correct answer compared to traditional algorithms.

PBS Infinite Series has several videos on quantum computing and Shor's algorithm: 1. https://www.youtube.com/watch?v=IrbJYsep45E "The Mathematics of Quantum Computers" 2. https://www.youtube.com/watch?v=12Q3Mrh03Gk "How to Break Cryptography" 3. https://www.youtube.com/watch?v=wUwZZaI5u0c "Hacking at Quantum Speed with Shor's Algorthm"

msclrhd··on Ask HN: Favorite teachers on YouTube?
blackpenredpen (math): https://www.youtube.com/user/blackpenredpen

mathologer (math, rubix cubes): https://www.youtube.com/channel/UC1_uAIS3r8Vu6JjXWvastJg

Welch Labs (math): https://www.youtube.com/channel/UConVfxXodg78Tzh5nNu85Ew

Physics Girl (physics): https://www.youtube.com/channel/UC7DdEm33SyaTDtWYGO2CwdA

minutephysics (physics): https://www.youtube.com/user/minutephysics

Khan Academy (math, science, etc.): https://www.youtube.com/user/khanacademy

Bob Ross (painting): https://www.youtube.com/channel/UCxcnsr1R5Ge_fbTu5ajt8DQ

The Virtual Linguistics Camps (linguistics & phonology): https://www.youtube.com/channel/UCaMpov1PPVXGcKYgwHjXB3g

NativLang (languages & language history): https://www.youtube.com/user/NativLang

Dr Jackson Crawford (old norse, scandinavian languages, old english): https://www.youtube.com/channel/UCXCxNFxw6iq-Mh4uIjYvufg

msclrhd··on GNOME (et al): Rotting In Threes
Qt/KDE have their issues as well. Both Qt and KDFE have their own versions of each object (e.g. QAction vs KAction). This means you have two choices when writing an application in Qt -- Qt only or KDE-based.

The Qt stack does not have support for mimetype handling for files (e.g. I want to open any text/html file). You need KDE for that.

Qt/KDE requires you to generate moc files (preprocessing the C++ code) which can make it harder to maintain if not using CMake or the Qt project format.

Qt broke the behaviour of QAudioDeviceInfo by moving it to a different package (QtMultimedia vs QtMultimediaKit). There have been times where Qt has not shipped a pc package (esp. in the package QAudioDevice moved to) which makes it difficult to add that package on build systems other than the Qt build system.

Qt does not support using gettext for translation.

Qt is in a transition from QtWidgets to QtQuick which (like Gtk3 themes) is currently a moving target.

← PreviousPage 2 of 2