Still as relevant as when introduced at [WayBack] Play Post-CES Buzzword Bingo:
Via: [WayBack] Still vaid … play-post-ces-buzzword-bing/ – Jürgen Christoffel – Google+
–jeroen
Posted by jpluimers on 2021/02/12
Still as relevant as when introduced at [WayBack] Play Post-CES Buzzword Bingo:
Via: [WayBack] Still vaid … play-post-ces-buzzword-bing/ – Jürgen Christoffel – Google+
–jeroen
Posted in LifeHacker, Power User | Leave a Comment »
Posted by jpluimers on 2021/02/11
I totally agree with Nick Craver “I absolutely hate environmental variables for configuration. They’re brittle, they’re ambient, they can be changed and FUBAR any known state underneath you, they’re an attack vector, just…”.
A little event in the early 1990s made me cautious whenever I see environment variables in use.
One of my clients had a network that had to be separated into three logical areas: one for workstations communicating with a certain server and some equipment, and another for a different server and other equipment, and finally a bunch of semi-local workstations that did some peer-to-peer and specialised equipment communication.
For that era, this was a LOT of stuff to manage.
Since users always were working from the same computers, and there was very little overlap between the areas, I created a bunch of login scripts. Since this was Novell NetWare 3.x era, you only had default, system and user login scripts (see [WayBack] NetWare 3 Login Script Fundamentals), of which only system+default or system+user could be combined. No groups scripts yet (:
So I introduced an environment variable NETWORK that would hold the kind of logical network.
Boy was I surprised that a few days later, the head of administration came to me with a problem: one of his administration programs – despite no documentation mentioning anything about such a feature – suddenly asked for a license!
A few hours of phone calls and trying later, we found the culprit: that software had an undocumented feature: when the NETWORK environment variable was set, it assumed a large corporate, with a very special license feature.
That was the day, I started to be wary of environment variables.
The workaround was simple: have the program being started with a batch file, temporarily clean the NETWORK environment variable, then run the application, and finally restore the environment variable.
Inspired by two tweets I got within a few days time:
Maybe I’m a minority opinion the way things are going, but I absolutely hate environmental variables for configuration. They’re brittle, they’re ambient, they can be changed and FUBAR any known state underneath you, they’re an attack vector, just…ugh. I do not care for them.The most common answer I get on “why?” is “that’s the cross-platform way, everyone supports it”.Okay, yeah sure…I agree that we’re at the least common denominator. My issue is settling for that. I don’t think most things should. We can do far better. Options already exist.
I love the way .NET Core does this – IOptions is very pluggable and one of my favorite API designs because it fits so many scenarios, including complex deployment and multi-tenant things we have here.It’s defaulting straight to “make it an environmental variable” that gets me.
I’ve seen so bugs where a thing works forever but stops because some sysadmin somewhere deployed a GPO that sets an environmental variable deployed to many machines that silently changed behavior of apps that haven’t been deployed in years, just happens on restart and…ugh.That’s just one example, there are many.“It works on my machine” is a problem. Environmental variables magnify that problem immensely. They’re a maybe permanent, maybe ephemeral, maybe local, maybe global external state that adds more to control, break, reason about, and debug.
“Why does this app work, but this one doesn’t?”“After 2 days of debugging we found out this one runs as account X with variables Y and it has the SDK path correctly set, the other one didn’t have that variable”
“…I quit.”
–jeroen
Posted in History, Power User, Security | Leave a Comment »
Posted by jpluimers on 2021/02/11
Remember the screenshot on the right from yesterdays post Kristian Köhntopp explaining theories?
In the end, I:
I much more would have used the screenshot functionality of Google as described here by Terence Eden:
[WayBack] twitter – How to convert a tweet to image – Stack Overflow
Google has a secret screenshot API
For example, you can use it to get a screenshot of a tweet like this
At the bottom of that JSON response, you’ll see
"screenshot": { "data": "_9j_4AAQSkZJRgAB.....=", "height": 569, "mime_type": "image/jpeg", "width": 320 }You will need to Base64 decode it using the URL and Filename safe alphabet.
That will give you a JPG screenshot of the Tweet.
I was hoping for an on-line way, so I followed [WayBack] Google’s Secret Screenshot API – Terence Eden’s Blog.
The blog post pointed me to a Python based script ([WayBack] Python-Twitter-Hacks/websiteScreenshot.py at master · edent/Python-Twitter-Hacks · GitHub) but had no online way.
So I tried out a few on-line things myself that failed:
Can't convert Unable to decode Base64.“Invalid mime type: application/octet-stream“Then I found out the script was just a proof of concept with hard coded URL and filename.
So I forked the repository, and fixed the script basing it on Python 3.
More on that next week.
Related:
The Base 64 encoding with an URL and filename safe alphabet has been used in [12]. ...An alternative alphabet has been suggested that would use "~" as the 63rd character. Since the "~" character has special meaning in some file system environments, the encoding described in this section is recommended instead. ...This encoding may be referred to as "base64url". This encoding should not be regarded as the same as the "base64" encoding and should not be referred to as only "base64". ...This encoding is technically identical to the previous one, except for the 62:nd and 63:rd alphabet character, as indicated in Table 2. ...Table 2: The "URL and Filename safe" Base 64 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 A 17 R 34 i 51 z 1 B 18 S 35 j 52 0 2 C 19 T 36 k 53 1 3 D 20 U 37 l 54 2 4 E 21 V 38 m 55 3 5 F 22 W 39 n 56 4 6 G 23 X 40 o 57 5 7 H 24 Y 41 p 58 6 8 I 25 Z 42 q 59 7 9 J 26 a 43 r 60 8 10 K 27 b 44 s 61 9 11 L 28 c 45 t 62 - (minus) 12 M 29 d 46 u 63 _ 13 N 30 e 47 v (underline) 14 O 31 f 48 w 15 P 32 g 49 x 16 Q 33 h 50 y (pad) =
–jeroen
Posted in Apple, Development, Encoding, Home brew / homebrew, Mac OS X / OS X / MacOS, Power User, Software Development, Web Browsers | Leave a Comment »
Posted by jpluimers on 2021/02/11
[WayBack] One second code: Do YOU know how much your computer can do in a second? is a quiz version of the [WayBack] Numbers Every Programmer Should Know By Year.
[WayBack] About this game revealed it was made by 3 people curious in the speed of their hardware which – not surprisingly – has been relatively stable over the last decade or so.
Source code is at [WayBack] GitHub – kamalmarhubi/one-second: Fun performance game!
I bumped into it via these tweets:
I like games like this (ever played the The Deadlock Empire multi-threading game?), so I played the computers-are-fast.github.io tests, and learned a lot:
Posted in Conference Topics, Conferences, Development, Event, Hardware, Power User, Software Development | Leave a Comment »
Posted by jpluimers on 2021/02/11
I tried searching for F2084 Internal Error: MA1263 – Google Search which happened on a complete up to date Delphi 10.1 Berlin installation.
It came from a large unit testing application using truckloads of generic language constructs, and large unit uses cycles.
Could not find anything useful. The error disappeared after recompiling the same application:
–jeroen
Posted in Delphi, Delphi 10.1 Berlin (BigBen), Development, Software Development | Leave a Comment »
Posted by jpluimers on 2021/02/10
A few years back, coincidentally and funnily shortly after Matt Haig compared confidence in Brexit with science confidence, Kristian Köhntopp explained about theories, in response to this (translated from German) question:
Why is the theory of relativity and evolution theory actually still called ‘theory‘?
The essence of this question is that in everyday speak, people have different idea on theory (thinking it is not yet proven, or can be disputed with very little evidence, both more like hypothesis), than in formal or scientific usage of the word theory:
Scientific theories are the most reliable, rigorous, and comprehensive form of scientific knowledge, in contrast to more common uses of the word “theory” that imply that something is unproven or speculative (which in formal terms is better characterized by the word hypothesis).
The English word theory derives from a technical term in philosophy in Ancient Greek. As an everyday word, theoria, θεωρία, meant “a looking at, viewing, beholding”, but in more technical contexts it came to refer to contemplative or speculative understandings of natural things, such as those of natural philosophers, as opposed to more practical ways of knowing things, like that of skilled orators or artisans.
Theory: Definitions from scientific organizations
The formal scientific definition of “theory” is quite different from the everyday meaning of the word. It refers to a comprehensive explanation of some aspect of nature that is supported by a vast body of evidence.
So Isotopp explained:
[WayBack] Kristian Köhntopp auf Twitter: “Weil sie das sind. Ein System von Theoremen, die ein Modell der Realität darstellen, das es erlaubt Vorhersagen über die Welt zu machen.”
[WayBack ]Thread 1 by @isotopp:
Weil sie das sind. Ein System von Theoremen, die ein Modell der Realität darstellen, das es erlaubt Vorhersagen über die Welt zu machen.The Quark And The Jaguar: Adventures in the Simple and the Complex amazon.de/dp/0349106495/…
Das Buch geht auf diesen Aspekt und noch viel mehr in einiger Länge ein und ist generell hilfreich um zu verstehen was Wissenschaft ist und was nicht
[WayBack] Aljoscha Rittner auf Twitter: “Ich glaube es wird noch sehr lange dauern, bis wir über den Punkt hinaus sind, nur mit Modellen unser Universum beschreiben zu können.”
[WayBack] Thread 2 by @isotopp
Äh, das tun wir seit de.wikipedia.org/wiki/Aufklärun… Es ist das Wesen des Modells, einen Scope und einen Fehler zu haben. Scope – die Newtownschen Gesetze beschreiben die Bewegung von Dingen mit Masse in Vakuum. Nicht in Atmosphäre, …… nicht von Dingen ohne Masse und nicht bei sehr hohen Geschwindigkeiten. Fehler – wir wissen, das Newtons Theorien eine Vereinfachung sind, und Einsteins Formeln den Sachverhalt gebaut beschreiben, aber Einsteins Formeln degenerieren für v<<c zu denen von Newton.Es ist der Sinn von Modellen, uns zu befähigen, Vorhersagen zu machen, wie sich die Welt verhält. Das Modell ist dabei oft beschränkt und ungenau, es seine Anwendbarkeit nicht einschränken muss, weil wir oft Fehler hinnehmen oder Beschränkungen im Anwendungsgebiet akzeptieren[WayBack] Frank Hartmann auf Twitter: “Ist eine Theorie, die bewiesen wurde, nicht mehr von alleine keine Theorie mehr? Sondern vielmehr ein Fakt?… “
[WayBack] Nathaniel Bernstein auf Twitter: “Du meinst „Hypothese“, wo du „Theorie“ schreibst.… “
[WayBack] Frank Hartmann auf Twitter: “Nopp. Man hat eine Hypothese. Dann stellt man eine Theorie auf, forscht und beweist diese. Oder auch nicht. Dann beantragt man mehr Forschungsgelder gg”
[WayBack] Thread 3 by @isotopp
Eine Theorie, ein System von Theoremen, ist nicht bewiesen und oft auch nicht korrekt (dh bekannt falsch, beschränkt und ungenau)
Darum mein abzielen auf Vorhersagen. Daltons Atommodell de.wikipedia.org/wiki/John_Dalt… ist beschränkt, war aber in der Lage, Dinge zu modellieren…
… die vorher nicht modellierbar waren. Wieso reagieren Wasserstoff und Sauerstoff 2:1 in der Knalleraktion?
Thompson, Rutherford, Bohr haben bessere (genauere) Modelle, die an Ende als Verfeinerungen oder Verkomplizierungen von Dalton aufgefasst werden können.
Diese Modelle leisten, was ihre Vorgänger jeweils konnten und mehr (größeres Anwendungsgebiet, bessere Genauigkeit)Du kannst eine Theorie “beweisen” in den Du sie für Vorhersagen verwendest und dann schaust, ob die taugen.
Du kannst sie widerlegen: Die Vorhersagen sind unzutreffend oder für den Zweck zu ungenau.
Du kannst nichts tun, wenn sie Theorie keine Vorhersagen liefern kann
Das Wesen von Wissenschaft ist, das Theorien Weltmodelle liefern, die Vorhersagen machen, die sich in Experimenten prüfen lassenDeswegen bleiben Theorien dennoch immer Theorien, Systeme von Theoremen, und sie bleiben unvollkommen (Modelle, effektiv Vereinfachungen, mit Anwendungsgebiet und Genauigkeitsgrenzen)
Via [WayBack] Frank Hartmann auf Twitter: “Wieso nennt man die Relativitätstheorie und Evolutionstheorie eigentlich immer noch ‘Theorie’? #Science”
Related:
Posted in LifeHacker, Power User, science | Leave a Comment »
Posted by jpluimers on 2021/02/10
Document locations changed, so here are some links to newer and older documentation on LCID related things:
Creates a locale identifier from a language identifier and a sort order identifier.
LOCALE_INVARIANT – Windows applications | Microsoft Docs The locale used for operating system-level functions that require consistent and locale-independent results. LOCALE_USER_DEFAULT – Windows applications | Microsoft Docs: The default locale for the user or process.
VAR_LOCALE_USER_DEFAULT: [WayBack] VarUtils.VAR_LOCALE_USER_DEFAULT ConstantLOCALE_SYSTEM_DEFAULT – Windows applications | Microsoft Docs: The default locale for the operating system.LOCALE_CUSTOM* Constants – Windows applications | Microsoft Docs
LOCALE_CUSTOM_DEFAULT The default custom locale.
LOCALE_USER_DEFAULT.LOCALE_CUSTOM_UNSPECIFIED An unspecified custom locale, used to identify all supplemental locales except the locale for the current user.
LOCALE_CUSTOM_UI_DEFAULT The default custom locale for MUI.
The following are predefined language identifiers:
LANG_SYSTEM_DEFAULT. The operating system default language.LANG_USER_DEFAULT. The language of the current user.
// A locale ID is a 32 bit value which is the combination of a // language ID, a sort ID, and a reserved area. The bits are // allocated as follows: // // +-------------+---------+-------------------------+ // | Reserved | Sort ID | Language ID | // +-------------+---------+-------------------------+ // 31 20 19 16 15 0 bit // // WARNING: This pattern isn't always followed (es-ES_tradnl vs es-ES for example) // // It is recommended that applications test for locale names or actual LCIDs. // // Locale ID creation/extraction macros: // // MAKELCID - construct the locale id from a language id and a sort id. // MAKESORTLCID - construct the locale id from a language id, sort id, and sort version. // LANGIDFROMLCID - extract the language id from a locale id. // SORTIDFROMLCID - extract the sort id from a locale id. // SORTVERSIONFROMLCID - extract the sort version from a locale id. // // Note that the LANG, SUBLANG construction is not always consistent. // The named locale APIs (eg GetLocaleInfoEx) are recommended. // // LCIDs do not exist for all locales.
Using Persistent Locale Data
A globalized application often persists or transmits data, for example, time and date. When deciding how your application should handle data persistence, remember that data is not guaranteed to be the same from computer to computer or between runs of the application. This is true for both locales that ship with Windows and custom locales.
Design of the application must take into account a variety of locale-related data changes that can occur. For example:
- Currency symbols can change as countries adopt the Euro.
- Regional preferences can change. For example, the format d/m/y might change to the format m/d/y for a particular locale.
- The spelling of day names can change due to spelling reforms. Additionally, casing can change for month or day names.
Use Locale-Independent Formats for Storage and Data Interchange
An application that persists data should use locale-independent formats for storage and data interchange. Examples are hard-coded or standard formats; the invariant locale LOCALE_NAME_INVARIANT; and binary storage formats.
If persistent sorting data is required, the application must use the CompareStringOrdinal function. Remember that an invariant format does not remain invariant for sorting, only for locale and calendar data.
Use the User Default Locale for Data Presentation
To present persistent data, it is best for the application to reformat the data using the user default locale. Use of this locale allows user overrides. For more information, see LOCALE_USER_DEFAULT.
More Delphi related links:
Assume this code and default decimal separator is , :
var v: Variant; d: Double; begin v:= '0.12'; d:= v; ShowMessage(FloatToStr(d)); end;It will show 12 (not correct).
Now add this in the first line:
DecimalSeparator:= '.';It still gives the same result. If you enable debug dcu’s you will see that
the problem occurs in functionVarToDoubleAsString, which callsVarR8FromStrwithVAR_LOCALE_USER_DEFAULTas locale, so there is no chance to change it as I tried. What is the rationale behind this setup?Only workaround seems to either force users to have the correct default
locale or use d:= StrToFloat(v) instead of d:= v; This makes the code less readable.
OLECHAR string to a double value.–jeroen
Posted in Development, Internet, link rot, Power User, Software Development, Windows Development, WWW - the World Wide Web of information | Leave a Comment »
Posted by jpluimers on 2021/02/10
A long time ago, I write a question [WayBack] delphi – Should the compiler hint/warn when passing object instances directly as const interface parameters? – Stack Overflow in 2010.
It was marked by (now former) compiler engineer Barry Kelly [WayBack1/WayBack2] as bug:
It’s a bug. The conversion from instance to interface reference in
RunLeakCrashshould be to a temporary variable, keeping it alive for the duration ofRunLeakCrash.
Added to that was a comment that this has happened since at least Delphi 6, so I filed a bug WayBack QualityCentral Report #: 90482 The compiler should keep a hidden reference when passing freshly created object instances directly as const interface parameters.
Just for years later, it was marked with “As Designed” which means it is never going to be fixed, especially since in the mean time Embarcadero got rid of most the senior Delphi R&D team members and went down the path of hiring contractors.
The problem is that I run into the two manifestations every now and then, and it usually takes a long time debugging to zoom into the actual location of the spots.
This is the bug in the first manifestation (by now the root interface is IInterface instead of IUnknown, and you usually have an interface derived from it):
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development, Undocumented Delphi | Leave a Comment »
Posted by jpluimers on 2021/02/09
The below configuration file haves [WayBack] ApexSQL Refactor – Free SQL formatter | ApexSQL produce quite OK formatted SQL, even for complex queries, not just for SQL Server.
So this is the second free tool I use from ApexSQL. The first one was ApexSQL, a free tool (SSMS add-in) for analyzing the execution plan of a SQL server query…
–jeroen
Posted in Database Development, Development, Software Development, SQL, SQL Server | Leave a Comment »
Posted by jpluimers on 2021/02/09
I linked to [WayBack] the Old New Thing a lot from my blog, but never put in a few links to the author of all those posts: Raymond Chen.
So here you go:
Recurring topics on his blog:
He is on some videos to, for instance [Archive.is] One Dev Question with Raymond Chen – Why Are There 4 Functions for Converting Strings to GUIDs | One Dev Minute | Channel 9 (the actual mp4 video file through Archive.is).
You can find many more via raymond chen site:channel9.msdn.com – Google Search
—jeroen
Posted in Development, Windows Development | Leave a Comment »