carlcaulkett
carlcaulkett
MModular
Created by Cdjones on 8/18/2024 in #questions
Reading Tensor From File
No description
6 replies
MModular
Created by Cdjones on 8/18/2024 in #questions
Reading Tensor From File
No description
6 replies
MModular
Created by Cdjones on 8/18/2024 in #questions
Reading Tensor From File
Do you need to use a Tensor at all? I had some code that used Tensors, until I found that I could just use the FileHandle.read_bytes function. Here's my code...
6 replies
MModular
Created by Andrey on 8/14/2024 in #questions
Interacting with Desktop Files such as .pdf documents
I see that @maxim has a new string handling package out https://discord.com/channels/1087530497313357884/1151418092052815884/1273544370578133046 I am certain that his code will be much more efficient than mine. I haven't looked at it yet, though. In my case it's a case of "if it ain't broke, don't fix it" πŸ˜‰
7 replies
MModular
Created by Andrey on 8/14/2024 in #questions
Interacting with Desktop Files such as .pdf documents
Hi Andrey! In my parser code, where I needed to convert from the bytes to a string, I used this method...
@staticmethod
fn vec_to_string(data: List[UInt8]) raises -> String:
var result = String()
for i in range(0, len(data)):
if data[i] == 0x00:
break
result += chr(data[i].__int__())
return result
@staticmethod
fn vec_to_string(data: List[UInt8]) raises -> String:
var result = String()
for i in range(0, len(data)):
if data[i] == 0x00:
break
result += chr(data[i].__int__())
return result
Something similar should do the trick πŸ˜‰
7 replies
MModular
Created by Andrey on 8/14/2024 in #questions
Interacting with Desktop Files such as .pdf documents
Hello Andrey. I would think it is possible. I've had a Bitwig preset parser up and running for a few months.. Have a look at https://github.com/carlca/ca_mojo.git and in particular the ./bitwig/preset_parser for some ideas. Essentially you just open a file using var f = open(file_name, "r") and then use methods like var data: List[UInt8] = f.read_bytes(size) to read the data. Or did you mean more specialised code geared towards PDF file in particular? I fear that for the moment, it's a case of using first-principles and a handy reference to the file-format in question.
7 replies
MModular
Created by Vijay Yadav on 12/19/2023 in #questions
How to convert string to float value?
I'm in the fortunate position of not having any looming deadlines for my code noodling, so I can afford to maintain a pure-mojo approach πŸ˜‰
12 replies
MModular
Created by Vijay Yadav on 12/19/2023 in #questions
How to convert string to float value?
Or if you do it, you can let me know πŸ˜‰
12 replies
MModular
Created by Vijay Yadav on 12/19/2023 in #questions
How to convert string to float value?
Ooh! I’d forgotten about that format. Good call! I’ll let you know when I do that…
12 replies
MModular
Created by Vijay Yadav on 12/19/2023 in #questions
How to convert string to float value?
Check out the test_float_utils.mojo unit in the repo root to get started with it!
12 replies
MModular
Created by Vijay Yadav on 12/19/2023 in #questions
How to convert string to float value?
No description
12 replies
MModular
Created by RogSat on 11/10/2023 in #questions
argv()
Testing with mojo argv_test.mojo param1 gives the output...
argv_test.mojo
param1
argv_test.mojo
param1
Executable at [0] and params at [1] onwards...
4 replies
MModular
Created by RogSat on 11/10/2023 in #questions
argv()
This just worked for me...
from sys import argv

fn main():
let a = argv()
for i in range(len(a)):
print(a[i])
from sys import argv

fn main():
let a = argv()
for i in range(len(a)):
print(a[i])
4 replies