The Official Status Thread
-
Status: Wondering how I'm going to implement stringly arithmetic in T-SQL.
Specifically, how to detect the lowest accurate precision needed for an operation.
Example: I have a value
50
, and I want the string50
to be stored.
Currently my proc converts to50.0000000000
and (obviously) stores it that way too.I can make assumptions, but no idea how well that will pan out when my code already looks like this so far:
MERGE CHAR_Attributes a USING ( Select @PlayerID PlayerID, @ObjectID Action , case ISJSON(@CustomProperties) WHEN 1 THEN JSON_VALUE(@CustomProperties,'$.AttributeName') ELSE '' END AttributeName , case ISJSON(@CustomProperties) WHEN 1 THEN JSON_VALUE(@CustomProperties,'$.AttributeValue') ELSE '' END AttributeValue ) n ON a.PlayerID = n.PlayerID and a.AttributeName = n.AttributeName WHEN MATCHED and @IsUnique = 0 and @ObjectID in (1,3) THEN UPDATE SET a.AttributeValue = CASE n.Action WHEN 1 THEN n.AttributeValue WHEN 3 THEN CAST( CASE --Standard number on number action WHEN LEFT(n.AttributeValue,1) = '+' and ISNUMERIC(a.AttributeValue) = 1 and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN cast(substring(a.AttributeValue,2,32) as numeric(32,8)) + cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '-' and ISNUMERIC(a.AttributeValue) = 1 and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN cast(substring(a.AttributeValue,2,32) as numeric(32,8)) - cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '*' and ISNUMERIC(a.AttributeValue) = 1 and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN cast(substring(a.AttributeValue,2,32) as numeric(32,8)) * cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '/' and ISNUMERIC(a.AttributeValue) = 1 and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 and cast(substring(n.AttributeValue,2,32) as numeric(32,8)) != 0 THEN cast(substring(a.AttributeValue,2,32) as numeric(32,8)) / cast(substring(n.AttributeValue,2,32) as numeric(32,8)) END as NVARCHAR(4000)) END WHEN MATCHED and @ObjectID = 2 THEN DELETE WHEN NOT MATCHED and @ObjectID in (1,3) THEN INSERT (PlayerID, AttributeName, AttributeValue) VALUES (@PlayerID, n.AttributeName, CASE n.Action WHEN 1 THEN n.AttributeValue WHEN 3 THEN CAST( CASE --Standard number on number action WHEN LEFT(n.AttributeValue,1) = '+' and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN 0 + cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '-' and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN 0 - cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '*' and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 THEN 0 * cast(substring(n.AttributeValue,2,32) as numeric(32,8)) WHEN LEFT(n.AttributeValue,1) = '/' and ISNUMERIC(substring(n.AttributeValue,2,32)) = 1 and cast(substring(n.AttributeValue,2,32) as numeric(32,8)) != 0 THEN 0 / cast(substring(n.AttributeValue,2,32) as numeric(32,8)) END as NVARCHAR(4000)) END) ;
-
@tsaukpaetra at this point, I'd reconsider whether you really want T-SQL code for that.
-
@tsaukpaetra Ugh. That makes my brain hurt.
Status: Wrote a bunch of unit tests. Found some issues through them. Still have many more to write.
-
@tsaukpaetra said in The Official Status Thread:
@gąska said in The Official Status Thread:
@tsaukpaetra said in The Official Status Thread:
@gąska said in The Official Status Thread:
@tsaukpaetra said in The Official Status Thread:
So, personal, not "Oh, let's compare against the world where we can find instances of hundreds dying."
I wasn't comparing to the "world". I was comparing to what I've seen almost every day in evening news throughout the first 20 years of my life.
You're a world away. Your point?
Americans are big fat pussies
I'll nod at fat, but pussies? I'll have you know that nobody's complained about my lack of cats!
You need more cats.
-
@tsaukpaetra said in The Official Status Thread:
@gąska said in The Official Status Thread:
That's what you call major accident?
Major in comparison to "I haven't been late to work like this in years" major.
Today's not a good day for traffic apparently. Similar thing happened for us today:
(No deaths, fortunately)
-
@gąska said in The Official Status Thread:
@tsaukpaetra at this point, I'd reconsider whether you really want T-SQL code for that.
At the moment, it's part of the inventory rewarding system which is DB authoritative. I'm hoping this will be the most complex it will ever get, but I'm not holding my breath.
@benjamin-hall said in The Official Status Thread:
Ugh. That makes my brain hurt.
Notice the indentation level? This proc is only ~500 lines. :D
The portion above it (Mentioned WRT the @@ROWCOUNT), does more fun things too.
-
@dreikin said in The Official Status Thread:
Today's not a good day for traffic apparently.
Yeah, I don't know if I should even be driving tonight...
-
Minecraft supposedly supports Windows Mixed Reality as of the latest beta, so I got in the beta, and it just acts like an app.
There are videos of it working correctly, but it doesn't for me. I'm wondering if it needs motion controllers...?
-
@magus said in The Official Status Thread:
Minecraft supposedly supports Windows Mixed Reality as of the latest beta, so I got in the beta, and it just acts like an app.
There are videos of it working correctly, but it doesn't for me. I'm wondering if it needs motion controllers...?
Yeah for me, it starts up some kind of launcher thing, says it's Loading, and then fails. The Minecraft App on my other computers seem to work fine as a 2d App, but...
-
@tsaukpaetra I don't even get that. It's just the 2d one.
-
@Gąska You can identify as a military veteran? That's a gender now? You can IDENTIFY AS BEING POOR? That's not an identity, that's a statistic. Also, identifying as a mother? Is mother a gender now? Or are they just trying to be inclusive for SLOTUS?
-
@ben_lubar said in The Official Status Thread:
@Gąska You can identify as a military veteran?
That's the question I'm asking every time I apply for the job. "Why they ask if I identify and not if I am veteran?" "Why there's separate field for Hispanic ethnicity and for ethnicity?" "How many times do I have to select today's date on those shitty calendar controls?"
-
@ben_lubar It didn't say that section was gender, just things you identify with, some of which being gender.
Not that that means it makes more sense to identify as a veteran.
-
@gąska You could just identify as all of them, in a spiritual/metaphysical sense if nothing else.
Though I think identifying as “Other” is probably best for many of us, i.e., sense #9 at:
-
Status: Damn near had a heart attack when I went to the forums and it looked like a spiderweb crack in my screen. Nope, it's just the Halloween graphic.
-
@ben_lubar said in The Official Status Thread:
@Gąska You can identify as a military veteran? That's a gender now? You can IDENTIFY AS BEING POOR? That's not an identity, that's a statistic. Also, identifying as a mother? Is mother a gender now? Or are they just trying to be inclusive for SLOTUS?
Why would it be a gender thing? "Do you consider yourself to be poor" is a perfectly cromulent question.
-
Status: Replaced the linear ball bearings with sliding contact bearings as the included ones were
a) cheap ones and
b) on their way out as evidenced by an accumulation of oily residues on the y-axis.Then had a ball recalibrating the hotplate. Currently printing a model which is supposed to show the tolerances my printer is capable of.
-
@pie_flavor said in The Official Status Thread:
Status: Damn near had a heart attack when I went to the forums and it looked like a spiderweb crack in my screen. Nope, it's just the Halloween graphic.
Oh good, it wasn't just me. Christ.
-
@pie_flavor
My forum experience :NotLikeThis:Happy arachnophobia day!
-
@pie_flavor said in The Official Status Thread:
Status: Damn near had a heart attack when I went to the forums and it looked like a spiderweb crack in my screen. Nope, it's just the Halloween graphic.
Say, have I got the desktop wallpaper for you...
@anotherusername said in I smashed my monitor:
-
@ben_lubar I identify as being poor compared to Warren Buffett.
-
@pie_flavor said in The Official Status Thread:
Status: Damn near had a heart attack when I went to the forums and it looked like a spiderweb crack in my screen. Nope, it's just the Halloween graphic.
2spoopy4me
-
@anotherusername said in The Official Status Thread:
Say, have I got the desktop wallpaper for you...
I never posted mine in that thread. It was similar to a couple others that were posted, except with a different Windows 7 background:
-
@magus said in The Official Status Thread:
Not that that means it makes more sense to identify as a veteran.
Just noting because I love playing Devil's Advocate that some people are veterans but may choose not to identify as veterans, e.g. because they meet the legal definition but have never been deployed to a combat zone or are a reservist and don't want to take attention/resources away from active duty military.
That being said, yes of course, that survey does show a serious case of brain worms.
-
@heterodox I did a version of that one, too.
-
@heterodox said in The Official Status Thread:
@anotherusername said in The Official Status Thread:
Say, have I got the desktop wallpaper for you...
I never posted mine in that thread. It was similar to a couple others that were posted, except with a different Windows 7 background:
Just for meta-ness, I decided to set that as my background.
-
I must be hungry.
I see the variable "profileroles" and read it as "profiteroles"
-
@timebandit said in The Official Status Thread:
I must be hungry.
I see the variable "profileroles" and read it as "profiteroles"
It took me like 4 reads to even figure out what the difference was.
Never heard the term before. Apparently it's French for "cream puff"?
-
@anotherusername said in The Official Status Thread:
@pie_flavor said in The Official Status Thread:
Status: Damn near had a heart attack when I went to the forums and it looked like a spiderweb crack in my screen. Nope, it's just the Halloween graphic.
Say, have I got the desktop wallpaper for you...
@anotherusername said in I smashed my monitor:
Looks like my son's old laptop, except his was more black and green than blue and yellow. (And it wasn't wallpaper.)
-
@anotherusername said in The Official Status Thread:
Apparently it's French for "cream puff"?
Yes. Also called "choux à la crème"
-
@timebandit boy, those French must really like cream puffs. They have 2 different names for it.
-
@anotherusername I think the one he just posted is the equivalent of 'puff with cream on', which is as generic as it gets.
-
@timebandit said in The Official Status Thread:
@anotherusername said in The Official Status Thread:
Apparently it's French for "cream puff"?
Yes. Also called "choux à la crème"
*chouxing noises*
-
@magus yes, I recognized it because it's just like "à la mode", which is French for "with ice cream on".
-
Every time we run this database conversion, I've been taking 20-30 minutes to create nice pre-reconciliation and post-reconciliation sheets, importing each CSV output file laboriously through the Text Import Wizard with every column set as text so Excel doesn't do its wonderful "General" formatting, omitting leading zeroes and otherwise screwing up the data, autofitting all the columns so you can see everything at a glance, formatting everything as a table so you get the automatic sort/filter headers and alternate rows are shaded, etc...
God damn it, me. Do it once and record a God damned macro. Just recorded one/tweaked it up a little so it'll work if the size of the dataset changes and now I can do it in one click. Did all that in fifteen minutes. And you call yourself an expert, you shithead. Forgot Excel could fucking do that. Wasn't sure the Text Import Wizard could be automated also but should have trusted that anything done through the GUI could be recorded.
Christ.
-
@anotherusername said in The Official Status Thread:
it's just like "à la mode", which is French for "with ice cream on"
Sometimes it just means “with extra cream” or “with extra butter”. Which works well for savouries…
-
@heterodox said in The Official Status Thread:
should have trusted that anything done through the GUI could be recorded.
No. Never trust that.
-
@tsaukpaetra said in The Official Status Thread:
No. Never trust that.
Don't see why not; they're pretty good with that. Ran through the Text Import Wizard, it correctly generated a long OpenTextFile function call with all the parameters I gave to the wizard (code page, whether the data has headers, what the delimiters are, index of each column with the data type of that column).
-
@heterodox said in The Official Status Thread:
@tsaukpaetra said in The Official Status Thread:
No. Never trust that.
Don't see why not; they're pretty good with that. Ran through the Text Import Wizard, it correctly generated a long OpenTextFile function call with all the parameters I gave to the wizard (code page, whether the data has headers, what the delimiters are, index of each column with the data type of that column).
Trust, but verify.
-
@dkf said in The Official Status Thread:
@anotherusername said in The Official Status Thread:
it's just like "à la mode", which is French for "with ice cream on"
Sometimes it just means “with extra cream” or “with extra butter”. Which works well for savouries…
On this side of the Atlantic, we just call that "Americanized".
-
@hardwaregeek said in The Official Status Thread:
Trust, but verify.
Well, yes, of course. After you record the macro you've got to test it. Thought that went without saying but should have "trusted" in the ry. ;)
-
@tsaukpaetra said in The Official Status Thread:
Status: Wondering how I'm going to implement stringly arithmetic in T-SQL.
SQL Server can run functions in C#, a far more appropriate language for that type of work.
-
@dreikin I like your minimalist rearview mirror.
-
@blakeyrat said in The Official Status Thread:
@dreikin I like your minimalist rearview mirror.
what I can't see can't catch me...
-
@blakeyrat said in The Official Status Thread:
@dreikin I like your minimalist rearview mirror.
Where we are going we don't need
roadsrearview mirrors
-
@blakeyrat said in The Official Status Thread:
@tsaukpaetra said in The Official Status Thread:
Status: Wondering how I'm going to implement stringly arithmetic in T-SQL.
SQL Server can run functions in C#, a far more appropriate language for that type of work.
I'm not sure what language is best for "take a possible number from a string, take a second possible number from another, apply arithmetic to them depending on possible prefix, and return the result as a string with the fewest zeroes possible while still ensuring accuracy" would be.
-
status: awe shit! I forgot to even install the thing and the evaluation period is over already?
Well, whatever...
-
@tsaukpaetra I'm sure it's not T-SQL.
It's probably Mathematica, which I assume does that just by default for all math operations.
-
@blakeyrat said in The Official Status Thread:
@tsaukpaetra I'm sure it's not T-SQL.
It's probably Mathematica, which I assume does that just by default for all math operations.
I doubt I can install that on an Azure database instance...
-
@tsaukpaetra Then you might have to suck it up and use the C# option.