Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
vOv
Feb 8, 2014

Shadowing: Not Even Once.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Does -Wshadow catch that?

canis minor
May 4, 2011

So I wanted to concatenate some strings in Open Office



nielsm
Jun 1, 2009



canis minor posted:

So I wanted to concatenate some strings in Open Office





Yes that's how date/time values are represented, courtesy of Excel. (I don't know if earlier spreadsheet software had date/time values/handling.) Integer part is days since some epoch date, fractional part is time of day as a fraction of 24 hours. If you want to format the date/time value for string concatenation you need to use a formatting function.

Sereri
Sep 30, 2008

awwwrigami

What, are you still using imperial time? Americans and their fear of the metric system I tell you...

canis minor
May 4, 2011

nielsm posted:

Yes that's how date/time values are represented, courtesy of Excel. (I don't know if earlier spreadsheet software had date/time values/handling.) Integer part is days since some epoch date, fractional part is time of day as a fraction of 24 hours. If you want to format the date/time value for string concatenation you need to use a formatting function.

But it's a string, it's not timestamp, since my confusion.

And indeed, resetting formatting changes it to 0.4166666, even though the person that created the spreadsheet didn't format it as time.

What I've done is copied the entire column to notepad and back in - since copy to clipboard copies the displayed value, and not the "actual" value, thus dropping the formatting and preserving what I want, but still - how is that sane?

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
phpredis: A PHP redis library that can't handle high load. Thankfully someone reported an issue in 2011. Fast-forward to 2017 and...people are still trying to add reproduction scenarios and having failures.

Edit: Some more Redis talk here. Apparently Redis is single-threaded and you shouldn't do blocking and long-running things with it. Who knew?

Sagacity fucked around with this message at 17:11 on Mar 29, 2017

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

canis minor posted:

What I've done is copied the entire column to notepad and back in - since copy to clipboard copies the displayed value, and not the "actual" value, thus dropping the formatting and preserving what I want, but still - how is that sane?
The vast majority of the time users will enter data into a spreadsheet as a string representation, but then they want it to be treated as data, not a string. So it makes perfect sense to take strings that look like numbers, dates, or times and automatically convert them to numbers, dates, or times respectively. If you want something that looks like a number, date, or time to stay a string, put a ' in front of it.

Maybe it might make sense to have the CONCATENATE function automatically use the formatting of the source column when it outputs the string, but if you're already doing string manipulation with functions, just use more functions to make sure the output is exactly what you want.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

canis minor posted:

But it's a string, it's not timestamp, since my confusion.

It's a timestamp or it would be shown as '10:00:00.

One way to concatenate is as noted to format the time:

=CONCATENATE("Time is ", TEXT(L2, "hh:mm:ss"), " WOW")

See also http://stackoverflow.com/questions/220672/convert-time-fields-to-strings-in-excel

nielsm
Jun 1, 2009



ulmont posted:

It's a timestamp or it would be shown as '10:00:00.

One way to concatenate is as noted to format the time:

=CONCATENATE("Time is ", TEXT(L2, "hh:mm:ss"), " WOW")

See also http://stackoverflow.com/questions/220672/convert-time-fields-to-strings-in-excel

This. Note the apostrophe in '10:00:00 -- that would force it to be parsed as a string (the apostrophe is not part of the cell value), but when it's absent it's parsed as a time, stored as a fractional time, and displayed as a formatted time when used with Standard format. Even in the formula editor.

canis minor
May 4, 2011

nielsm posted:

This. Note the apostrophe in '10:00:00

That's pretty nifty - thanks!

Jethro posted:

Maybe it might make sense to have the CONCATENATE function automatically use the formatting of the source column when it outputs the string

Yup, that's what I'd expect - although that probably opens up another can of worms.

Still, as an inexperienced user with Excel this behaviour strikes me as absurd - if I saw "0.416667" in the top bar, but "10:00:00" in the cell, I'd know the matter is with formatting of a specific value. If I see 10:00:00 in both I'm thinking - this is definitely a string. And I know for sure the person that created the sheet didn't apply time formatting to this column, so why should the app in this case try to fix the data for the user?

edit: to clarify - if I open a blank spreadsheet, put in first cell: "10:00:00", second cell "=CONCATENATE("Time is ";A1)" I don't expect it to output: "Time is 0.416667" and I consider it weird that that's the standard behavior.

vvv That's a hilarious read

canis minor fucked around with this message at 18:56 on Mar 29, 2017

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

Jethro posted:

The vast majority of the time users will enter data into a spreadsheet as a string representation, but then they want it to be treated as data, not a string. So it makes perfect sense to take strings that look like numbers, dates, or times and automatically convert them to numbers, dates, or times respectively.

An alarming number of scientific papers contain Excel errors.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

canis minor posted:

Still, as an inexperienced user with Excel this behaviour strikes me as absurd - if I saw "0.416667" in the top bar, but "10:00:00" in the cell, I'd know the matter is with formatting of a specific value. If I see 10:00:00 in both I'm thinking - this is definitely a string. And I know for sure the person that created the sheet didn't apply time formatting to this column, so why should the app in this case try to fix the data for the user?
If the word "string" means anything to you other than twisted plant or synthetic fibers you are probably more advanced than most Excel users. There are definitely some times when Excel's magic data type conversion causes problems (see the examples above). I see it all the time at my company (lots of items with identifiers like 111E-00 that Excel changes to 1.11E+02). But ultimately spreadsheets are about manipulating data, so Excel has to take what users type and automatically turn it into data without much effort on the part of non-technical users to be of any value. If a user couldn't type 1,000 in one cell and 1500 in another and then add them together without having to do anything else, or have 10:00 and 9:00 sort properly, Excel wouldn't be used everywhere. So maybe it is a bad thing :v:

quote:

edit: to clarify - if I open a blank spreadsheet, put in first cell: "10:00:00", second cell "=CONCATENATE("Time is ";A1)" I don't expect it to output: "Time is 0.416667" and I consider it weird that that's the standard behavior.
The magic has to stop somewhere, and a function that depends on you knowing what string means is as good a place as any and probably better than most.

canis minor
May 4, 2011

That are great points you're making - especially about sorting "9:00" and "10:00"; still, I'd say I prefer Google's approach - it is, what it is, until user makes a conscious decision about changing it

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

canis minor posted:

That are great points you're making - especially about sorting "9:00" and "10:00"; still, I'd say I prefer Google's approach - it is, what it is, until user makes a conscious decision about changing it

Where does google do that?

Only registered members can see post attachments!

nielsm
Jun 1, 2009



Date/time values in Excel are slightly special in that they degenerate to regular numeric values as soon as you feed them into any function at all. There also (as far as I know) is no function specifically to isolate the date or time from a value, you have to use the FLOOR function to do that. In particular, the functions named DATE and TIME are borderline useless for that, their purpose is assembling the numeric date/time values from year/month/day/hour/minute/second components. (Extracting the time component of x is in fact x-FLOOR(x), which is madness.)

Doom Mathematic
Sep 2, 2008
I believe MOD(x, 1) would also do the job?

nielsm
Jun 1, 2009



Doom Mathematic posted:

I believe MOD(x, 1) would also do the job?

Huh yeah it does. I pretty much only think of modulo in the context of integer-integer division but yes of course it should work just as well.

QuarkJets
Sep 8, 2008

Sereri posted:

What, are you still using imperial time? Americans and their fear of the metric system I tell you...

Is this just a really bad joke or do you live in some weird country that actually uses a base-10 system of time?

canis minor
May 4, 2011

Jethro posted:

Where does google do that?



Oh, indeed, by default it assumes it's time as well, even though nothing is selected. I must have been looking at field where I've already selected text format and thus it worked, apologies :(

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

QuarkJets posted:

Is this just a really bad joke or do you live in some weird country that actually uses a base-10 system of time?

Revolutionary France isn't weird, just dead.
http://mentalfloss.com/article/32127/decimal-time-how-french-made-10-hour-day

The calendar lives on, though.
https://www.frenchrepublicanwallcalendar.com/

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

Jethro posted:

The magic has to stop somewhere, and a function that depends on you knowing what string means is as good a place as any and probably better than most.

This is almost exactly (date versus time) the scenario Excel uses in its example of the TEXT function.
https://support.office.com/en-us/article/TEXT-function-20d5ac4d-7b94-49fd-bb38-93d29371225c

QuarkJets
Sep 8, 2008


Madmen

TheresaJayne
Jul 1, 2011

QuarkJets posted:

Is this just a really bad joke or do you live in some weird country that actually uses a base-10 system of time?

https://www.timeanddate.com/time/internettime.html

QuarkJets
Sep 8, 2008



QuarkJets posted:

Is this just a really bad joke or do you live in some weird country that actually uses a base-10 system of time?

Alan G
Dec 27, 2003
Civic UK are a company who supply a 3rd party service for hosting UK cookie law compliance pop ups.

Today their site went completely dead which resulted in an error pop up appearing on your site if you use them. On every page.

We do and so one of our sites was hosed.

Coding horrors:
No failsafe at our end for their service being unavailable
No contact details for the company - their twitter had last been updated in November

The best part though is the service was also being used by the Information Commissioner's Office. So the people who are meant to regulate companies displaying these cookie notifications also had problems with their cookie notification.

Seat Safety Switch
May 27, 2008

MY RELIGION IS THE SMALL BLOCK V8 AND COMMANDMENTS ONE THROUGH TEN ARE NEVER LIFT.

Pillbug

Alan G posted:

Civic UK are a company who supply a 3rd party service for hosting UK cookie law compliance pop ups.

Today their site went completely dead which resulted in an error pop up appearing on your site if you use them. On every page.

We do and so one of our sites was hosed.

Coding horrors:
No failsafe at our end for their service being unavailable
No contact details for the company - their twitter had last been updated in November

The best part though is the service was also being used by the Information Commissioner's Office. So the people who are meant to regulate companies displaying these cookie notifications also had problems with their cookie notification.

This is an actual company? gently caress, I wish I had thought of doing this.

smackfu
Jun 7, 2004

That company would be 99% sales and 1% tech which seems borne out by their tech quality.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Those loving cookie notifications/warnings are a legislative horror. They do nothing but annoy people & teach them that every website uses cookies and to just click OK to make the dumb thing go away.

vOv
Feb 8, 2014

Powaqoatse posted:

Those loving cookie notifications/warnings are a legislative horror. They do nothing but annoy people & teach them that every website uses cookies and to just click OK to make the dumb thing go away.

It's the online version of California's Proposition 65 (the "this thing may give you cancer" one).

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
The hilarious bit is that the same EU board that insisted on the cookie warnings in the first place later suggested that they didn't mean every website would have to have a form agreement, and that a setting in the browser would be enough. You know, like every browser always had..

Rubellavator
Aug 16, 2007

They should also warn you if a site uses javascript.

Alan G
Dec 27, 2003

Seat Safety Switch posted:

This is an actual company? gently caress, I wish I had thought of doing this.

Yeah :(. Seems like a licence to print money.

We were like:
In 2 years this law comes in
In 1 year this law comes in
Hey that law was meant to come in but it has an extension

Eventually legal went:
This law comes in in X days, why are you guys not doing this.

So using this 3rd party was the quickest way to finally get it done when the task got suddenly got put into a sprint...

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Rubellavator posted:

They should also warn you if a site uses javascript.

code:
javascript:alert('this site uses javascript');
done, gimme that sweet contractor cash

qntm
Jun 17, 2009
"This site does not use cookies. This message will reappear every time you reload the page. LEARN MORE / GOT IT"

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
The tendency for the EU to ignore locked-in or established technologies with things like the Right To Be Forgotten seems like a good double-edged sword to me. On the one hand it makes things ridiculously impractical to internet, on the other hand the way lock-in works probably inspires 90% of the horrors on this thread that people find in production code and there's merit in the idea that laws shouldn't be written by the firm with the biggest marketing department.

redleader
Aug 18, 2005

Engage according to operational parameters

Rubellavator posted:

They should also warn you if a site uses javascript.

This, but unironically.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



hyphz posted:

The tendency for the EU to ignore locked-in or established technologies with things like the Right To Be Forgotten seems like a good double-edged sword to me. On the one hand it makes things ridiculously impractical to internet, on the other hand the way lock-in works probably inspires 90% of the horrors on this thread that people find in production code and there's merit in the idea that laws shouldn't be written by the firm with the biggest marketing department.

Yeah, most of the time it seems like the intent of it comes from a good place. For instance, warn people that their personal info is being gathered, but the implementation is just so often completely destroyed by a combination of industry lobbyists and technically illiterate legislators.

Obviously every person has a slightly different idea of "too much", but imo "Right to be Forgotten" is totally fine. The intent of the law was pretty clear that it's like if you search for an otherwise private person, not a politician or anything, and there's a news article from the early 2000s about him putting his dick in an exhaust pipe or something, he has a right to get that specific result, for that specific query annulled. It doesn't count if it was a criminal or civil offense, you can't block those.

Google intentionally interprets the law in the broadest and annoyingest way possible; it often feels like pretty much any combination of given name + surname will result in a bunch of worthless results (no newspapers) + the disclaimer "some results may have been removen due to blah blah blah", which was specificially not what the whole thing was about.

P sure they're doing this on purpose to undermine the law. Obv I cant speak to the wording, but they're very much subverting the intent to bridge the idea of "right to be forgotten" = "annoying law" in people's minds.

e: whoa sorry for ranting :stare:

Vanadium
Jan 8, 2005

Maybe people could just stop using cookies on sites that don't need them instead of annoying people with popups!!

Adbot
ADBOT LOVES YOU

Hydronium
Oct 23, 2008
Found at work today: no code needed, the function name says it all. TrimAndAddSpaceAtEnd

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply