Convert list index to a 3D position based on width and height

I’m working on a CPU voxel raytracer in Python. With the amount of costly calculations involved everything must be as efficient as possible especially storing and fetching point data in space. I started by storing 2D and 3D data in dictionaries indexed by string positions, eg: data["4,16"] == "solid". Since converting positions to and from… Read More Convert list index to a 3D position based on width and height

Parse over large JSON array of Objects from Facebook

This is the JSON array: { "id": "", "name": "", "posts": { "data": [ { "likes": { "data": [ ], "paging": { "cursors": { "before": "QVFIUnpFd2IwMlhuOWI3dJqelFNNEZAPWDlqeENTNkg1N2RqMm9zQXBreVV6bE9KNXJzX29LeXlMZAzhNT2x3TEhlcGk3OG1Bd3ZABRmpyTXhnNDZAWV2hR", "after": "QVFIUl9Vbm14cld0dm41OTFtKYmgtelBKall2bnBINjBQMXBiNkNCMUM0d21lQXptOXRvbklkU0pHbV9yejNBVG9Jb2hqQTFoem1mdm9zMnJn" }, "next": "" }, "summary": { "total_count": 84, "can_like": true, "has_liked": false } }, "comments": { "data": [ { "created_time": "2022-05-25T18:22:19+0000", "message": "", "id": "" }, {… Read More Parse over large JSON array of Objects from Facebook

TypeError: not all arguments converted during string formatting in vertica_python

I’m trying to insert some values into my vertica database using the vertica_python module: data = {‘SalesNo’: [‘12345’, ‘678910’], ‘ProductID’: [‘12345_2021-10-21_08:51:22’, ‘678910_2021-10-21_10:27:03’], ‘StoreID’: [‘6d522936e240cd64e1cf9176c5bfdff3bfe8146a345ff2’, ‘a7274d507d443c752be66b2851415138d75bd913d4949e’], ‘PurchaseTime’: [‘2021-10-21 08:51:22.846000’, ‘2021-10-21 10:44:06.218000’], ‘Date’: [‘2021-10-21’, ‘2021-10-21’], ‘StoreNumber’: [‘0’, ‘1’], ‘PurchaseValue’: [‘348.0’, ‘4893.23’] } dataset = pd.DataFrame(data) column = dataset.columns n = len(column) SQL_insert = f"INSERT INTO table_name ({‘,’.join(list(column))})… Read More TypeError: not all arguments converted during string formatting in vertica_python

How to search json for a string and output a parent value using jq?

Trying to pull a value out with jq, but didn’t seem as easy as i originally thought. I have a variable of CAR="baga6e~tlwdcmli__QmbHKa~G65fMXzh.car". How can i use this variable to return the parent "piece_cid" ? Example: Using a bash varible of $CAR with a value of baga6e~tlwdcmli__QmbHKa~G65fMXzh.car, id be able to get the results saved… Read More How to search json for a string and output a parent value using jq?