MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.

As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.

x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Tuesday, January 28, 2020

Here are the important commands to keep around when logging what SQL statements you've thrown at MySQL when debugging, say, some Entity Framework issues...

-- SET GLOBAL log_output = 'TABLE';
-- SET GLOBAL general_log = 'ON';

SELECT * FROM  mysql.general_log  
WHERE command_type ='Query' 
and event_time > '2020-01-03 11:58:20'
ORDER BY event_time DESC
LIMIT 10

-- SET GLOBAL general_log = 'OFF';

Labels: ,


posted by ruffin at 1/28/2020 04:06:00 PM
Monday, April 28, 2014

PostgreSQL: Don't Use CHAR or VARCHAR:

It turns out that many variable length data types (and some that are fixed length, like CHAR) are represented internally with the same varlena data structure, which is simply a byte array prefixed with a 32-bit length field.

I assume I'm missing something, but, if true, that seems extremely lazy.

Labels:


posted by ruffin at 4/28/2014 04:16:00 PM
Sunday, May 26, 2013

double floating point precision and MySQL (Page 1) / Version 5 / Gmap3 - Forum:

There's still one problem, but I guess I can ignore it.
Setting precision explicitely means [MySQL] uses this precision always.
e.g. even for lower precision numbers.
So, 13.12847910000005 becomes 13.128479100000050 (15 precision) or even 13.1284791000000496 (16 precision).

If one needs to have accurate numbers you better store them as strings. And if you need to display accurate numbers but also calculate in MySQL with the floating point numbers you have to store two values, one float, one string.

Painfully, I'm starting to see the wisdom of storing decimal numbers as strings.  I mean, better yet is just to use 0-249 of each byte (more efficient and still mnemonic for traditionally ten-fingered cultures), but you get the point.

I'm trying to figure out what MySQL thinks a REAL is.  Well, it's a DOUBLE by default, but I'm having a hard time (> 5 min ;^D) Googling up what DOUBLE's precision is.

Labels: ,


posted by ruffin at 5/26/2013 11:43:00 AM
Sunday, December 16, 2012

MySQL Lists: mysql: Re: GUID storage:

UNHEX(REPLACE(uuid, '-', ''))

will convert uuid to 16-byte string
There's no easy way to do a reverse conversion yet. HEX() will do, but
you'll lose dashes.

Note to self.

Edit: Possibly better.

Labels: ,


posted by ruffin at 12/16/2012 10:44:00 AM
Friday, July 06, 2012

Recently, Real Software posted a blog post that said that Real Basic works with MySQL, but that you'd have to open source any Real Basic app that used it.

Real Studio is able to connect to the Community (free) edition of MySQL, but this edition usually requires you to open source software that connects to it (due to its GPL license). 

I didn't think that was right.  Obviously, you can use MySQL without open sourcing code the same way you can write an app with GNU/Linux and release it closed source.  If MySQL was that "viral", almost every two bit app on some cheap php hosting environment is now GPL'd.

Turns out it's more complicated, apparently.  It might be that the Real Software plugin that talks to MySQL is GPL'd.  I don't know how that'd happen. Can't Real just get a MySQL commercial license and start coding? 

Regardless, the post got me thinking about MySQL licensing.  And that, though I'm over two years late to the party, seems to be a lot of fun.

Groklaw - Monty Program AB's Suggestion to EU Commission to Get Rid of the GPL on MySQL - Updated:

So that is why they care. They have big plans for a business around MySQL, and they want to make some money from it. MariaDB is their fork of MySQL. Of course, there's nothing wrong with making money. Notice the role of the Open Database Alliance in all this, in case anyone tells you there is no connection. There is.

I'm not sure I understand how the sort of dual-licensing many open source but commercially funded apps work.  There's no way that MySQL-Cash isn't somehow benefitting from impressive changes and fixes to MySQL-Altruism.  (My guess is that they pretend to have a "clean room", have someone walk in, view the OSS MySQL code, then walk out, across the hall, and do the same thing from memory to the closed version.)

But companies do this, pretending that the open source version is completely and irrevocably downstream of the closed source version, and one of the MySQL co-founders apparently wanted to have his cake and eat it twice. He wanted to relicense MySQL under the Apache license so, essentially, he could do whatever the heck he wanted to do with the closed MySQL codebase at his new company without releasing that code rather than have to open source his fork of MySQL. That is, unless he bought a license to develop MySQL from the closed source, his only avenue to fork was to fork the GPL version. Oh noes! Which, of course, suggests that there's a fair bit of code in MySQL-Cash that we're not seeing in MySQL-Altruism.

Apparently that threw the world on its ear. IBM said that Oracle could buy Sun (and, with it, MySQL), but some little schmoe (above) disagreed. The sale was held up, and millions of bucks allegedly lost during the deliberation. Fine.

The worst part? Some wicked pixelers started saying stuff like this:

And in the ultimate irony, Richard Stallman himself joined the fray against... Richard Stallman?

/sigh

No, no he didn't. But that didn't stop the world from deciding that the GPL prevented you from forking code. WTF? RLY? Come on. Get a new job writing about whatever it is that you're really interested in, because it sure ain't the GPL.

Here's a quote from a horribly written piece on CNet called "Stallman: GPL doesn't guarantee software freedom".

Even Richard Stallman, co-author of the GPL and founder of the free-software movement, and not someone that spends much time worrying about monetization of open-source software, gets this.

As noted in a letter co-drafted with Open Rights Group and Knowledge Ecology International, Stallman notes that Oracle's proposed acquisition of MySQL could hurt its development because the GPL reduces incentives to commercialize the code.


Come on, that wasn't enough for you to wonder what was going on? You really thought RMS was arguing for Apache over GPL? To what ends? (Sorry -- I don't usually bash like this, but the FUD here is insane, and so easily seen through.)

A commenter on this story has a much better answer/handle on this situation. It's so good, I'm posting it all, in case the story disappears. "mbenedict" is the author.

There are many issues here getting mixed up.

First, in fairness to Stallman, when he talks about a "lack of a more flexible license" for MySQL he's really talking about GPL v3 -- or more specifically mixing v2 and v3 code together in a possible future fork. Matt's selective quoting above seem to misrepresent Stallman's position by removing its context.

Second, even under GPL v2, there is *nothing* preventing a "MySQL 2" to "arise, take the code, hire all of the developers, and development of the open-source database would not miss a beat." A new entity under GPL *can* fork MySQL code and do all that. What the new entity *cannot* do is re-license the forked code under a different license -- including GPL v3, or a separate Commercial License under a dual-licensing scheme.

So we finally get into the crux of the issue which Matt curiously omits: dual-licensing of GPL v2 code. We all knew it was "evil". Now we're all acting surprised that it could be "evil". Dual-licensing allows companies to give out crack to babies, and then charge them $$$ once they're hooked... completely against the spirit of GPL.

Now, I'm not a fan of GPL. I've been a long proponent for BSD-style licenses (which Apache derives from). Lots of companies "talk" about relicensing from GPL to Apache... but actions speak louder than words.


Okay, okay, okay. Let's stop mbenedict at one spot -- BSD? Insane. "Please steal my code! Make hats of cash! Give me nothing! Just know that you can't sue me." Or, as I've said before, those licenses "essentially enable legalized plagiarism". That's crazy. Well meaning, perhaps (more likely too business oriented and not written by a guy who actually contributes to open source code), but crazy.

There's a perfect license for releasing code into the world for commercial companies to use: The LGPL. It's fair. It encourages passive collaboration (OSS' biggest boon) from commercial enterprises (a rare but powerful thing). And, get this, it fairly requires that if they improve the functions you gave them, they must give back to you those -- and only those -- improvements. Brilliant! That's what The GNG Manifesto is all about.


I think you get the point. RMS is anti-GPLv2 insofar as it's not the GPLv3. He likes GPLv3, but thinks it should have more flexibility for users to change their project's license as changes to the GPL are made. He does not like Apache licenses more than GNU licenses. MySQL should, for RMS, be licensed under GPLv3, though v2 and v3 allow you to fork.

What a media fail.

Labels: , , , , ,


posted by ruffin at 7/06/2012 09:20:00 AM
Tuesday, June 17, 2008

Argh. No sub-selects in MySQL before version 4.1. That means you can't use the following line...

SELECT * FROM table WHERE id IN (SELECT MAX(id) FROM table)

There's an easy fix for this particular line if you can just grab the first row programmatically (and other solutions with straight SQL), say...

SELECT * FROM table ORDER BY id DESC

... but that doesn't stop you from banging your head on the wall, wondering why the earlier line doesn't work. I never want to see...

Error: java.sql.SQLException: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select max(id) from table)' at line 1, SQL State: 42000, Error Code: 1064

... again.

Of course, my inet host's MySQL version is 4.0.25-nt-max. Thanks, guys. ;^)

Labels:


posted by ruffin at 6/17/2008 08:27:00 PM

<< Older | Newer >>


Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (?_?), ยข, & ? if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.