« first day (4764 days earlier)      last day (408 days later) » 

08:20
Hello! Is someone of you familiar with point cloud data?
yeah me
08:59
I want to convert a json file into a pcd file but it seems that something goes wrong, since :

The original json file is :

"points": [
{
"x": -3.0436267852783203,
"y": -0.16995574533939362,
"z": -1.8130922317504883
},
{
"x": -3.1966617107391357,
"y": -0.16642192006111145,
"z": -1.8037652969360352
},
{
"x": -3.341731309890747,
"y": -0.1634843647480011,
"z": -1.784134030342102
},
...


And the pcd file is :

[{'x': 1.3563156426940112e-19, 'y': 1.3563156426940112e-19, 'z': 903106396160.0}, {'x': 1.7475111971083882e-19, 'y': 1.1707312099192039e-19, 'z': 1.3563156426940112e-19}, {'x': 10248.031
Could you maybe put that into a question? It's a bit too long for chat
Usually you shouldn't post links here to new questions, but when you post it I will have a look on your profile to find it
09:36
@Hakaishin the usual solution to that is a pastebin, github gist or similar
@MaryStar why do you use struct.pack when you're converting text to text? Note that I'm not familiar with pcd files.
You said "And the pcd file is : ..." which is confusing if it's a binary format
If it is a binary file you have to
1. Show its specification,
2. Show your code you want us to debug
10:01
3. How you "convert it again to json" because decoding could be buggy instead of encoding
10:32
@AndrasDeak--СлаваУкраїні @Hakaishin

For the conversion from json to pcd I initially had :
https://gist.github.com/manimari/8044e769610dec493a14a0429558a0c6
and after some adjustements I have :
https://gist.github.com/manimari/8943424e68dee7d28668886db680b3d6
Do you see anythong wrong there ?

From the print statements we get :

First 5 points in frame['points']: [{'x': -3.0436267852783203, 'y': -0.16995574533939362, 'z': -1.8130922317504883}, {'x': -3.1966617107391357, 'y': -0.16642192006111145, 'z': -1.8037652969360352}, {'x': -3.341731309890747, 'y': -0.1634843647480011, 'z': -1.784134
Can you explain what the problem is?
When I convert the pcd that we get back to json I get :

{"points": [{"x": 1.3563156426940112e-19, "y": 1.3563156426940112e-19, "z": -1.8130922317504883}, {"x": -3.0436267852783203, "y": -0.16995574533939362, "z": -1.8037652969360352}, {"x": -3.1966617107391357, "y": -0.16642192006111145, "z": -1.784134030342102}, {"x": -3.341731309890747, "y": -0.1634843647480011, "z": -1.767945408821106}, {"x": -3.5075273513793945, "y": -0.15954247117042542, "z": -1.757532000541687},...

So the first point from the initial json file corresponds to the second point of the final json file, the second point
Oct 29 at 3:07, by smci
@MisterMiyagi Why would you use Homebrew Python rather than pip (or download) directly? Homebrew Python Is Not For You (2021) advises against. What platform are you on?
I have, for the first time, seen this in action while watching it during installation of spark and openjdk. It's bumped my python version (still within 3.11) and postgres (!). I'm surprised I haven't been bitten by this before. This will take some restructuring.... :/
@MaryStar You declare FIELDS x y z but then serialize them in a different order: struct.pack("fff", point["z"], point["x"], point["y"])
@Aran-Fey Even when I write FIELDS z x y I get :

{"points": [{"x": 1.3563156426940112e-19, "y": -1.8130922317504883, "z": 1.3563156426940112e-19}, {"x": -0.16995574533939362, "y": -1.8037652969360352, "z": -3.0436267852783203}, {"x": -0.16642192006111145, "y": -1.784134030342102, "z": -3.1966617107391357}, {"x": -0.1634843647480011, "y": -1.767945408821106, "z": -3.341731309890747}, {"x": -0.15954247117042542, "y": -1.757532000541687, "z": -3.5075273513793945},

as the final json file.
10:46
How are you converting pcd back to json?
To convert pcd back to json I do : gist.github.com/manimari/486ae0defba83380101bd0ce3abf86a4 @Aran-Fey
Did you adjust the x, y, z = point accordingly?
Ah shall we have everywhere z x y instaed of x y z?
Ah ok! Will try!
10:50
Well, actually I don't know. But I assume yes
The difference is that we get the coordinates in different order, the first point in the final json file that doesn't match to the initial json file is still there :

{"points": [{"x": -1.8130922317504883, "y": 1.3563156426940112e-19, "z": 1.3563156426940112e-19}, {"x": -1.8037652969360352, "y": -3.0436267852783203, "z": -0.16995574533939362}, {"x": -1.784134030342102, "y": -3.1966617107391357, "z": -0.16642192006111145}, {"x": -1.767945408821106, "y": -3.341731309890747, "z": -0.1634843647480011}, {"x": -1.757532000541687, "y": -3.5075273513793945, "z": -0.15954247117042542}, {"x": -1.7415
Welp, I'm out of ideas then
Ok, no problem! Thanks anyway :-) @Aran-Fey
@AndrasDeak--СлаваУкраїні @Hakaishin Does someone of you maybe have an idea?
 
1 hour later…
12:09
@MaryStar Sorry looking at the code it looks correct, can you run the code in the debugger maybe?
12:20
Is anyone else getting a popup about Google AI Assistant on every single search?
@roganjosh no
It's driving me nuts. The only options are "Not now" or "Join waitlist". Technically the very next time I do a search wouldn't classify as "now" but, given the number of searches I do per day, I don't think I need to clarify my position several hundred times
are you logged in?
or using incognito mode?
Yup, on a gmail account and not incognito
ok very weird
clear cookies?
12:28
I'm erring more towards it potentially being the company VPN I'm on. I'll try dropping that in a bit to see if it causes it, but it's kinda crucial to my workflow
 
2 hours later…
14:41
is there already a library out there that could allow me to take a command, add an argument at the correct place, then return the command as a string?
@shintuku currently it is not clear what you are asking, can you be more precise?
What exactly is a "command" and how do you turn it into a string?
@Aran-Fey e.g. if p s structuration is a command, where -i is an option for s and not p, I'd like to obtain p s -i structuration when I ask it to add the -i flag
Isn't that just command.replace(' s ', ' s -i ') then?
Or I guess if escaping is a thing, then something like
args = shlex.split(command)
args.insert(args.index('s') + 1, '-i')
command = ' '.join(args)
hmm, it really is a simple as you say. don't know why i'm overcomplicating things, thank you
@Aran-Fey consider the following case: p s 1000 1200 structuration is a command, where both the second integer and the first are optional, and -i is a flag for the first integer. i think it's simple regex again, but this probably starts to showcase how creating some sort of command management handler would make sense
15:01
Hmm. Sounds like you essentially need some high-level regex-like thing then? I'm thinking something along the lines of command.replace(Arg('s') + Value(int), Arg('s') + Flag('-i') + Value(int))
yeah exactly, some sort of thing aware of the entirety of valid grammatical statements
guess i'll have to make it
Probably
@Aran-Fey not to interrupt the fun, but this sounds like a XY problem, is there no easier way to do the higher level goal? Whenever I hear regex it sounds to me like something went wrong
@Hakaishin personally would do it with pyparsing instead. create a grammar whose tokens you can designate through ParserElements
Regex at its core is just pattern matching. Nothing wrong with that
15:27
I added some print statements and I get the following results :

From json to pcd we get :

First 5 points in frame['points']: [{'x': -3.0436267852783203, 'y': -0.16995574533939362, 'z': -1.8130922317504883}, {'x': -3.1966617107391357, 'y': -0.16642192006111145, 'z': -1.8037652969360352}, {'x': -3.341731309890747, 'y': -0.1634843647480011, 'z': -1.784134030342102}, {'x': -3.5075273513793945, 'y': -0.15954247117042542, 'z': -1.767945408821106}, {'x': -3.69936466217041, 'y': -0.15570560097694397, 'z': -1.757532000541687}]
@MaryStar yes
Do we get the wrong result at the point where we create the point cloud?

Because I added a rint statement to get the elemnts after the craetion of point cloud :

# Print the first 5 points before and after conversion
print("First 5 points before conversion:")
for i, point in enumerate(point_cloud.points):
if i >= 5:
break
print(f"Point {i}: {point}")


And we get :

First 5 points before conversion:
Point 0: [ 1.35631564e-19 1.35631564e-19 -1.81309223e+00]
Point 1: [-3.04362679 -0.16995575 -1.8037653 ]
15:54
@MaryStar and?
Potentially really stupid question here, but why does it matter if the ordering is preserved?
Surely the 3D coordinate set, in any ordering, describes the same surface?
I am trying to understand how we get as teh first point [ 1.35631564e-19 1.35631564e-19 -1.81309223e+00] and all the other points seem to be correct. Where does this come from? Maybe at the step where we craete the pointcloud?
Or is the error coming earlier, at json to pcd conversion? @Hakaishin
16:19
@MaryStar please make a question with an mvce, currently the information is all too spread out
this will probably also help you troubleshoot the problem. Also include sample data in the mvce not just paths to files we don't have access to
Agreed. Our room rules ask for posts longer than ~14 lines to be posted off-site and linked back here. Instead, we have multiple posts that go against this rule, and the information is scattered. As it stands, I don't think any of us are following what you're trying to communicate. I think you would be better asking on the main site with it all consolidated as this isn't working
Ok, will do that! Thanks! :-)
What are "keywords" or "reserved words" called officially in python? I could have sworn that there was an easy-to-find official doc page for this but google is just entirely flooded by 3rd party sites. The only official result (which is quite high up) is this
I could well just be losing my mind but it feels like some part of the docs is now mysteriously... missing. Was it the aspression in the billiard room or the exception group in the hallway?
16:46
There's a list of keywords here, and there's also a keyword module
It's weird that I cannot get to that from "python keywords" in a google search or "python reserved words"
Especially since that link shows async in the list, but the top result (W3Schools, yay!) doesn't and then had me second-guessing whether I was right to call it a "keyword" in the first place. What a mess.
@roganjosh weird for me it's the 3rd link when searching python keywords
17:01
I have angered Google by dismissing their trial a bajillion times
... wow ... I dropped the VPN and the adds have gone, and indeed it is now 3rd spot in the search results. Our VPN is still, for now, run by Walmart. They must really have a thing against them or something
is there a UML parser somewhere?
17:28
@roganjosh maybe query expansion could be the cause: google.com/support/enterprise/static/gsa/docs/admin/70/… this is what they use server-side (admittedly) to use targeted ads based on your search query
they use different way to do this, likely country, etc. Probably why it works without the VPN
(but then again, you might be talking about a company's vpn, in which case, they might not use a different country's vpn, and instead their own network. If that's the case here, then I don't know)
It's just silly. I've passed my findings on to my team that were also shocked. I don't suppose I'll really understand what Google actually did there other than take another flush on the toilet to get rid of the stubborn "don't be evil" tag. At least I know now
It's interesting to me, though, that I actually wouldn't have noticed had I not been looking up something basic to comment on a noob question on SO. Anything more complex and the ridiculous results wouldn't have been so blatant to me
this is likely also why I can't always find the same thing someone here might give me when I search for SO question/answer
When I say "ah, thanks, did not find this when I searched" I really do mean it
18:00
anyone has a sure-fire way to fix index errors or to debug them? or is there no way around other than to manually investigate?
What would such a solution look like to you?
18:15
I mean, you could always print out the index and what's in it:

```
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i, e in enumerate(my_list):
print(f"{i} - {e if i < len(my_list) else None}")
```
do you know any hoster that accepts payment by month...and OFC supports Python...any suggestions?
yeah that's probably it, just logging all index-related constructs
@DimitrisPapageorgiou you'll need to be more specific. What is it you want to do? There are no end of options to get instances with fixed IPs that you could build on
@Shmack Guide to editing in chat :) It's not straightforward
I just want to upload a small site I built to play with deployment practices...that's it
@shintuku The code there can never fail so there is no point logging it
enumerate() cannot give you an index greater than the length of the list... unless you modify the list while iterating, something else moderates the list, you add or remove from the index or... And if you logged it in any real programme you'd have literally billions of lines in log files
@DimitrisPapageorgiou I use DigitalOcean for my personal site, but I overpay for no real reason; it's $28/month but I overspec'ed it on the stupid idea that I'd wanna play with it more. You can get cheaper than that for a simple "box". The only thing to look out for is a service that will allow you to overrun your quota on bandwidth/CPU
AWS (IIRC) won't stop you going over your limits on some EC2 instances and then you're on the meter. Have fun when that bill drops if something goes wild. I think DigitalOcean just kills my site in the worst case
18:27
@roganjosh you pay month by month or you pay for the whole year upfront?
By month, and I can scale up or down whenever I like
But this is also a static resource - my website is up 24/7. If you just want a box to play with, you can get pay-per-use options elsewhere and you won't be charged if you spin it down
that is not a bad idea but I think28/month for a small site that I want to use only for testing/deployment purpose is too much
Like I said, I overspec'ed it
I don't need that to run my site
so...where do we conclude? a pay per use monthly plan I would say...any provider to suggest with such criteria?
Have a look at lightsail but again, just check properly about what happens if you overrun the limits
18:32
that seems a good idea to investigate further
Already I can see things like "*Only outbound data transfer in excess of your plan's data transfer allowance is subject to overage charges. Please see the FAQ for more details. ". Don't underestimate these costs
it start froms 20gb storage - for linux...that's overkill for my case
anyway...I will do some research
I mean, you'll struggle to find less in an instance. It's 2023 and 20GB is tiny for storage in the cloud. In any case, hopefully that gives you enough to research further, and obviously lightsail isn't the only option.
oh...
a basis droplet seems a good option
basic
Yup. That's what I'm on, just the 4GB RAM, 2CPU version. The extra $4/month is VAT and some-such as I'm in the UK
18:48
I just want to be sure that is month by month....but since you say so
I do not want yearly cost
This is cloud - hire and fire. See the "destroy" option here. I could pull it down now and the cost stops. I'm not sure why you are so worried about this. Check out the FAQ
I think I am covered...thanks
19:47
I've got a design question, kind of. Imagine I'm coding the character creation for a game. The player first chooses whether they want to play a Healer or a Tank, and depending on their choice, they then get to allocate points into various stats - for example, let's say a Healer has Mana while a Tank has Defense and Stamina.
Now, if I design the code with the needs of the GUI in mind, each playable class would essentially have to be a data structure that contains stats. Basically, you want the ability to iterate over all the stats so you can write code like
for stat in character.stats:
    character.stats[stat] = input(f'How many points do you want to put into {stat}?')
My problem is that this is super specifically designed for the GUI and not at all how you'd usually expect it to be implemented. Usually you'd imagine something like character.mana = 5, right? If I hadn't known about the GUI in advance, I would've implemented it completely differently. That doesn't sit right with me. Am I doing something wrong here or do you really just have to know in advance?
I wouldn't expect that at all. I would expect that all characters would have some of each stat in the game. And if my healer really couldn't increase their defence, the stat would still be listed with the fixed value, and it would be greyed out. So the stat page for the GUI would have the same structure for both classes, just with tweaks to what I could do to change the base values
Well, how would you know which stats need to be greyed out?
Based on the class selection on the previous screen?
Right, but how do you map the class to the stats?
If everything is on one page then there is surely a callback to modify the second stat panel based on what I select in the first?
19:55
If you can't do for stat in character.stats, what do you do instead? Do you hard-code a mapping like {Healer: ['mana'], Tank: ['defense', 'stamina']}?
For character creation, I probably would. I don't know if this is an analogy or an actual thing. Because clearly the player classes will have different behaviour as the game progresses
Let's say there are so many different stats that it's not viable for all classes to have the same stats. What then? Would you still use the mapping and getattr/setattr to read/write the stats?
@Aran-Fey I'd compose the raw character object with a GUI character object. I think having the GUI character object have a mutable mapping interface would be what you want. On the backend you just do something like setattr(self.character, key, value). As for graying out, you've not really said how you do so with your current character class. However what ever you do I'd put in the GUI character object.
Back in the day I used to play way too much EverQuest which had a really complicated stat system and the old-school code is released. Something something it starts around here
@Peilonrayz With my design, greying out the (ir)relevant GUI objects would essentially be mana_slider.greyed_out = 'mana' not in character.stats. Although I simply wouldn't create those GUI elements to begin with. How would that work in your design?
20:04
@Aran-Fey are we talking literally about a game now or stretching an analogy?
Well, it is a game, but it's not really about stats in the classical sense
But it's a bunch of numerical values that vary based on what you're playing, so close enough
I don't know of a game where you couldn't have a stat, but at the very least you would just list it and set it to zero. The UI has to be consistent, if not only for your own sanity
@Aran-Fey I guess it might make more sense if you make it not focused on GUI, but just plaintext input/output
If you have a billion stats then have a "modal" (no idea if that's what they're called in games) that gives a structured list based on the particular class
maybe make it work around a dict-like structure or json and then you could think later about how to set it up with a GUI structure, such that you could just iterate over the tree-like structure to set up the GUI
20:09
There is an elephant in this room btw
Where is it? is it pink?
What happens when you want to store the state of the game? Or is it a one-shot game and you start from scratch in each session?
I'd just json.dump(character.stats)?
Although I'd also need to dump the character's class. Is that what you're getting at?
I'm slowly working toward figuring that (where I'm going) myself but it's becoming clearer for me
20:20
That # pretend we're a healer is exactly where the interesting code would be :D
I cannot get past the idea that every character needs every stat in a base class, then you have an archetype that zeroes out a set of those stats (or, conversely, the base class sets them all to zero and the archetype gives them values) and then the class itself tweaks it further
@Peilonrayz Say you have a character = Healer(Stats(0, 0, 0)). How do you create a GUIStats object from that?
How do you get the Stats object from the Healer class? What's the attribute
Let's say character.stats
gui_character_stats = GUIStats(character.stats, ('mana',))
20:23
That would be incorrect for a Tank though
You can choose a different way to represent the character if you want. What I'm interested in is how you turn the character (or rather, the character classes "Healer" and "Tank") into a GUIStats
By having them all set to zero in the base class. Then your GUI either displays all stats and greys out the ones that are irrelevant for the subclass (representing Tank/Cleric) or you choose not to display the stat at all for those which are 0
@Aran-Fey yes
I can't have all classes share the same stats, there are too many of them and they conflict with each other
That's why you have the irrelevant ones set to zero
Think about your mobs. Now you want an AoE attack that checks for stamina. Whoops, the Healer doesn't have a stamina stat, so that check can't work. Crash.
@Aran-Fey Oh, you're not following the standard for gaming. Ok yeah, I have no clue what you're doing. Ima peace out.
20:30
Alright, then let's pretend we're dealing with skills instead of stats. A Tank doesn't have a Heal skill. Period.
He does, it's just 0, so he doesn't get the option in the GUI (though the skill can still be scanned)
Ok fine, I guess it would technically be possible
I didn't think my choice of analogy would become this much of a problem...
Here's the skill list in EverQuest
Every character gets a baseline
I also did ask twice whether it was a stretched analogy :P I'm off out for a bit now too
@Peilonrayz To be honest, there isn't really a standard. There dozen of RPG that break the mold, so the only standard is creativity or non-creativity
 
2 hours later…
23:06
@Peilonrayz Yes I had seen your earlier reply. The C experience in parsing declarations involving forward references.
Yes, clearly I had too much hope in Python being sensible.
@MaryStar Curious to see your MCVE.

« first day (4764 days earlier)      last day (408 days later) »