Difference between revisions of "Talk:WebAPI/Feedback"

From Team Fortress Wiki
Jump to: navigation, search
(custom texture lo - Invalid JSON)
(custom texture lo - Invalid JSON: I'm truly surprised WindPower didn't point this out to me yesterday.)
Line 27: Line 27:
 
</pre> -- [[User:Lagg|Lagg]] [[File:Backpack_Stickybomb_Launcher.png|24px|link=User_talk:Lagg]] 16:10, 23 April 2012 (PDT)
 
</pre> -- [[User:Lagg|Lagg]] [[File:Backpack_Stickybomb_Launcher.png|24px|link=User_talk:Lagg]] 16:10, 23 April 2012 (PDT)
  
: Here is a temporary workaround for the problem, as promised. This call is for python's re module but should be similarly easy to modify as needed for basically any regex implementation out there. What the expression is doing is searching for a line with 0 or more characters of whitespace at the beginning, followed by the normal float_value key and then an arbitrary length negative integer followed by a decimal point and non-decimal character. The part of the string preceding the decimal point is captured and reinserted into a string suffixed with '.0'. I hope you find it useful. <code>re.sub('(\s*"float_value": -\d+)\.[^\d]', '\\1.0', obj)</code> -- [[User:Lagg|Lagg]] [[File:Backpack_Stickybomb_Launcher.png|24px|link=User_talk:Lagg]] 21:08, 23 April 2012 (PDT)
+
: Here is a temporary workaround for the problem, as promised. This call is for python's re module but should be similarly easy to modify as needed for basically any regex implementation out there. What the expression is doing is searching for a line with 0 or more characters of whitespace at the beginning, followed by the normal float_value key and then an arbitrary length integer followed by a decimal point and non-decimal character. The part of the string preceding the decimal point is captured and reinserted into a string suffixed with '.0'. I hope you find it useful. <code>re.sub('(\s*"float_value": -?\d+)\.[^\d]', '\\1.0', obj)</code> -- [[User:Lagg|Lagg]] [[File:Backpack_Stickybomb_Launcher.png|24px|link=User_talk:Lagg]] 21:08, 23 April 2012 (PDT)
 +
 
 +
:: Fixed a small bit of the regexp. I'll let my commit message describe what the change was since it does it best: Because apparently I thought that the bug was choosy about what side of a 0 it appears on. -- [[User:Lagg|Lagg]] [[File:Backpack_Stickybomb_Launcher.png|24px|link=User_talk:Lagg]] 08:48, 24 April 2012 (PDT)

Revision as of 15:48, 24 April 2012

Improperly formed JSON float_values for decal attributes - still not resolved

http://wiki.teamfortress.com/wiki/Talk:WebAPI/Feedback/Archive_3 has the previous thread. I'm still receiving the improperly formed JSON :( Just FYI - thanks! VMDX 14:37, 21 November 2011 (PST)

Alright I've been on the lookout for this regression on my own logs for optf2 and asking around. I cannot find any reproductions. Care to give an id64 that exhibits this problem? -- Lagg Backpack Stickybomb Launcher.png 22:05, 30 November 2011 (PST)
ex: in 76561198005981351 : "attributes": [ { "defindex": 152, "value": 1879034420, "float_value": 158326252166124510000000000000. }, { "defindex": 227, "value": 117757579, "foat_value": 0.000000 } ]
Some json decoders break because the number doesn't have the 0 after the dot. I don't see this happen in PHP but I've heard others having this problem Ruiner 21:02, 22 April 2012 (PDT)
Yep I've spoken to an employee about it and they said they'll look into it tomorrow. Apologies for not noting this on the talk page sooner. -- Lagg Backpack Stickybomb Launcher.png 21:15, 22 April 2012 (PDT)

Painted items

I noticed that the steam community inventory viewer has images with paints embedded in them. Would it be possible for the backpack items to include the encoded URL for the image with paint. ex: with paint -- Ruiner 07:13, 25 February 2012 (PST)

custom texture lo - Invalid JSON

I had another talk with Drunken. This is the relevant part of his response on the matter. I'll be giving a language-independent workaround in a while if time permits.

1:34 PM - Drunken F00l: I know why it's printing bad values, yes
1:34 PM - Drunken F00l: it's just truncating
1:35 PM - Drunken F00l: I'll get it fixed but the fix probably won't ship until next week

-- Lagg Backpack Stickybomb Launcher.png 16:10, 23 April 2012 (PDT)

Here is a temporary workaround for the problem, as promised. This call is for python's re module but should be similarly easy to modify as needed for basically any regex implementation out there. What the expression is doing is searching for a line with 0 or more characters of whitespace at the beginning, followed by the normal float_value key and then an arbitrary length integer followed by a decimal point and non-decimal character. The part of the string preceding the decimal point is captured and reinserted into a string suffixed with '.0'. I hope you find it useful. re.sub('(\s*"float_value": -?\d+)\.[^\d]', '\\1.0', obj) -- Lagg Backpack Stickybomb Launcher.png 21:08, 23 April 2012 (PDT)
Fixed a small bit of the regexp. I'll let my commit message describe what the change was since it does it best: Because apparently I thought that the bug was choosy about what side of a 0 it appears on. -- Lagg Backpack Stickybomb Launcher.png 08:48, 24 April 2012 (PDT)