switch to room list switch to menu My folders
Go to page: First ... 20 21 22 23 [24] 25 26 27 28 ... Last
[#] Wed Jan 18 2017 13:38:20 EST from IGnatius T Foobar

[Reply] [ReplyQuoted] [Headers] [Print]

const's virus-like behavior is quite challenging in C++.


[#] Wed Jan 18 2017 14:56:29 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]

Oh gosh. Can of worms. You sort of have to use const everywhere you safely can, because somebody else's code might force you into it.

[#] Wed Jan 18 2017 14:57:23 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]


[#] Wed Jan 18 2017 17:33:30 EST from IGnatius T Foobar

[Reply] [ReplyQuoted] [Headers] [Print]

Yeesh. I'm going to write a "deconstifier" shim that allows you to interface with other people's code, casting between const and non-const without throwing a compiler warning. And I'm going to reserve the domain "" because when you have an .io domain people automatically assume that you are an inarguably brilliant developer.


[#] Thu Jan 19 2017 15:05:56 EST from fleeb

[Reply] [ReplyQuoted] [Headers] [Print]

Er... in C++, you can use 'const_cast<>()'.

But, I find const helpful. It hasn't been a problem for me.

[#] Tue Jan 24 2017 13:59:14 EST from fleeb

[Reply] [ReplyQuoted] [Headers] [Print]

mysql, you surprise me.

In 2012, someone complained that their documentation doesn't state that concatenating a string past the max_allowed_packet will result in a 'null' for the string, and how heinous that is, etc.

So they documented this fact. But not in the part of the documentation where you'd look at the concat or concat_ws string manipulation functions. No, that would be a wholly logical, reasonable, intuitive place to look for such a thing. Instead, they documented it at the end of the table of string functions, where everyone would look for such a thing.

The *only* reason I found this was after looking at the bug report. I don't normally make a habit of looking tediously over every shred of documentation when I need to research a problem, because, I dunno, I have other things I need to accomplish in a day or something.

I dunno... I guess I could complain and be the first person since 2012 to point out the ridiculous nature of their solution and be known as 'That Guy' or something. On the other hand, I could just tuck it away as My Little Secret and whip it out someday when the right set of circumstances come about where such information is useful.

In the meantime, fucking hell.

[#] Wed Jan 25 2017 10:14:36 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]

You can't have a BLOB past max_allowed_packet either.

lame, but I guess not enough people are yelling.

[#] Wed Jan 25 2017 11:08:27 EST from fleeb

[Reply] [ReplyQuoted] [Headers] [Print]

Well, in mysql, a BLOB maxes at 65,535, while most people have max_allowed_packet set to something considerably larger. Well, in our case, it is set to the same size as a MEDIUMBLOB or MEDIUMTEXT.

However, *nothing* can be set larger than max_allowed_packet, I think, so if you wanted to really confuse someone, set that value to 10 and watch the suck happen.

[#] Wed Jan 25 2017 12:05:53 EST from wizard of aahz

[Reply] [ReplyQuoted] [Headers] [Print]

We like BATFs... Big Ass Text Fields.

[#] Wed Jan 25 2017 12:31:22 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]

I was referring to BLOBs as a class. LONGBLOB goes to 2^32, and would just be referred to as BLOB on Oracle, where BLOB storage is not in the main table record.

[#] Wed Jan 25 2017 12:32:12 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]

So having a 4gb packet seems... suboptimal.

[#] Wed Jan 25 2017 22:47:31 EST from wizard of aahz

[Reply] [ReplyQuoted] [Headers] [Print]

<GRIN> LS - I was kidding. We use BLOBs and LONGBLOBs.. But we also started describing things as BATFs cause it was funny.

[#] Thu Jan 26 2017 11:02:58 EST from fleeb

[Reply] [ReplyQuoted] [Headers] [Print]

Heh, BATFs...

If you had the 4gb LONGBLOB, you'd need to change your max_allowed_packet in mysql to something that could accomodate that size. I wonder how many people even know there's this variable limiting how much they can actually put in the table?

[#] Mon Jan 30 2017 13:42:42 EST from IGnatius T Foobar

[Reply] [ReplyQuoted] [Headers] [Print]

I was referring to BLOBs as a class. LONGBLOB goes to 2^32, and would

just be referred to as BLOB on Oracle, where BLOB storage is not in the

main table record.

What the f**k are you people storing in your databases?!?

[#] Mon Jan 30 2017 19:37:16 EST from LoanShark

[Reply] [ReplyQuoted] [Headers] [Print]

Some people do weird shit like using SQL as an index around what's basically a file store.

[#] Tue Jan 31 2017 10:23:13 EST from fleeb

[Reply] [ReplyQuoted] [Headers] [Print]

Actually, in our case, that's almost literally what we do for one situation.

We have metadata associated with the file, and we perform searches within the file's contents for information. To keep our interfaces for this kind of stuff uniform, we keep the file itself in a column of the database.

As the whole database is semi-temporary by the nature of what we're doing, it isn't a big deal. If we were doing something that lasted longer, yeah, this isn't the approach we'd want to use.

[#] Fri Feb 17 2017 15:31:25 EST from IGnatius T Foobar

[Reply] [ReplyQuoted] [Headers] [Print]

Hey web developers.

We all know by now that "synchronous xmlhttprequest is deprecated" in jQuery.

But what about doing the same thing *without* jQuery? Is support for doing a synchronous xmlhttprequest, directly from javascript, something that will continue to be supported by the browsers?

(Yes I know it's a bad idea. But ever since I switched my main desktop to Windows in January 2015 I no longer care about anything.)

[#] Sat Mar 11 2017 13:22:31 EST from kc5tja

[Reply] [ReplyQuoted] [Headers] [Print]

Anyone fluent in Rust by any chance? Having a problem describing what I want to the compiler in terms of type annotations.

Specifically, I'd like to make a globally accessible hashmap, like so:

// will not compile
static mut user_list : HashMap<String, Rc<RefCell<UserRecord>>>;

Problem is, there is no way to statically initialize a HashMap, so I cannot use an initializer, which means I cannot declare this as static. I tried wrapping this in an Option<T> type and initializing it to None, but that fails as well, since in order for this to make sense, I have to use Rc<RefCell<UserRecord<'static>>>, which is not correct either, since the user records will not out-live the user_list variable (just the opposite in fact).

The only way I can see around this is to declare and initialize this variable in main() and just pass it to everything as an argument, but holy hell, that's a nightmare. There has to be a better way.


[#] Sat Mar 11 2017 19:28:09 EST from kc5tja

[Reply] [ReplyQuoted] [Headers] [Print]

Answering my own question: you don't. You have to wrap the global variable into a single function as a static variable. Initialize it statically to None, then use a match-clause to lazily create the value on first access.
Easy enough to do manually (if a bit boiler-plate-y), but there's a crate that automates this (via macros) called "lazy-static".

[#] Wed Mar 22 2017 11:23:03 EDT from IGnatius T Foobar

[Reply] [ReplyQuoted] [Headers] [Print]

Riddle me this, Batman.

What is the point of UTF-16?

It's variable length, like UTF-8 is, but takes up no less than two bytes per character, even though the majority of text still falls in the 0x00-0x7F range (particularly in Western languages). So why would anyone want to choose an encoding that is "variable length but no less than two bytes" when there is a "variable length, as low as one byte" encoding available?

UTF-16 seems to neatly combine the worst of both worlds. So why does it exist?

Go to page: First ... 20 21 22 23 [24] 25 26 27 28 ... Last