The MySQL folks have a new tool, MySQL Proxy, which looks like a MySQL server to clients, but actually just passes incoming queries to a user-supplied Lua script which can pass them on to other MySQL servers, process them itself, rewrite queries before passing them on then rewrite the results, etc.
Which is fine in and of itself. I can think of a few uses for such a thing: it'd be great for query logging during debugging, especially when you're examining the interactions of queries from several sources, so just logging on the client wouldn't help. And it'd be useful for distributed database stuff, too.
However, there's a tutorial prominently linked, Getting Started with MySQL Proxy.
And what examples of the uses of the proxy does it give?
- Pass it along unchanged (default)
- Fix spelling mistakes (ever written CRATE DATAABSE?)
- Filter it out, i.e., remove it altogether
- Rewrite the query according to some policy (enforcing strong passwords, forbidding empty ones)
- Add forgotten statements (autocommit is enabled and the user sent a BEGIN WORK? You can inject a SET AUTOCOMMIT = 0 before that)
- Much more: if you can think of it, it's probably already possible; if it isn't, blog about it: chances are that someone will make it happen
Am I the only person who feels that setting up a proxy in front of an SQL server to catch spelling mistakes and semantic errors and Do What I Mean rather than reporting an error so the developer fixes their code will just lead to endless pain... like every past DWIM system? And is an SQL query proxy really the place to enforce strong passwords, as opposed to in the application code or in the database itself?
I think proxies for just about any protocol can be useful, but condoning such practices as listed above is rather irresponsible...
I read this paper shortly after it came out:
One Pass Real-Time Generational Mark-Sweep Garbage Collection
However, I've spent ages since trying to find it again. Mainly due to confusing it with The Treadmill: Real-Time Garbage Collection Without Motion Sickness, which describes a somewhat related algorithm that uses a read barrier to support mutation.
The algorithm described in the first paper is pretty amazing. It's simple, effective, fast, real-time, and requires no read barrier. The downside, however, is that it requires that pointers only ever point back in time to older objects. Which is fine if you have a purely functional language, since an object being created can only ever obtain references to objects that already exist at creation, and those references can never be updated to point to a newer object thereafter. However, you cannot then use any optimisations that use mutation "under the hood" such as in-place update of linear values.
Read more »
Back when I was a kid, I designed a low-level macro system for purely functional Lispy languages, based around a cunning use of partial evaluation. I called it meta.
Since I was a dreadfully lazy student, when I had to do a final year project, I suggested it as an idea and then pretended to think of and develop it all over again, before spending far too little time writing up a report on it, and a sample implementation. Which may have been why the sample implementation broke in the demonstration...
But at the time, I didn't think much of macro hygiene. All I'd seen of it was that Scheme at the time had a hygienic macro system called syntax-rules
that, as far as I could tell, sucked - it was limited to basic-seeming rule-based substitutions, and did not use the full power of the Scheme language as a macro language.
However, things have changed since then. The Scheme community has come up with hygienic macro systems that let you write macros in Scheme, such as syntactic closures. And so I've found that hygiene is a desirable property, rather than a terrible design tradeoff.
So, I wonder to myself, can my meta macro system be brought up to date and incorporate hygiene?
Read more »
I program computers for a living, mainly. This involves writing programs - instructions for the computer on how to do things, written in a "programming language".
There's a lot of programming languages out there; mainly because it's easy to create new ones, and an interesting exercise to do so. But if you browse a programming jobs site, you will see a lot of people who say "I am a Java programmer". Or PHP or Perl or C# or C++ or Python or Visual Basic. This means two things: that a few programming languages hold the majority of the "market share" and that people consider "their language" an important part of their identity.
Read more »
I read this today:
Structured Streams
It looks like somebody's implemented a stream protocol that lets you create substreams at will, sharing congestion control information with the parent stream but having their own redelivery queues, so missing messages will only stall the one (ordered) stream they pertain to.
Good to see that great minds think alike. When I get some time, I'll read their results in more detail, and see if there's anything useful to be learnt for MERCURY 🙂