Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 01:12
    HertzDevil labeled #13014
  • 01:12
    HertzDevil labeled #13014
  • 01:12
    HertzDevil labeled #13014
  • 01:12
    HertzDevil opened #13014
  • 01:05
    straight-shoota edited #13012
  • Jan 26 22:06
    straight-shoota ready_for_review #12978
  • Jan 26 22:06
    straight-shoota edited #13013
  • Jan 26 22:05
    straight-shoota edited #13013
  • Jan 26 22:04
    straight-shoota labeled #13013
  • Jan 26 22:04
    straight-shoota labeled #13013
  • Jan 26 22:04
    straight-shoota labeled #13013
  • Jan 26 22:04
    straight-shoota opened #13013
  • Jan 26 21:28
    straight-shoota labeled #13012
  • Jan 26 21:28
    straight-shoota labeled #13012
  • Jan 26 21:28
    straight-shoota labeled #13012
  • Jan 26 21:28
    straight-shoota opened #13012
  • Jan 26 21:21
    HertzDevil edited #12985
  • Jan 26 21:21
    HertzDevil edited #12985
  • Jan 26 21:19
    HertzDevil edited #12985
  • Jan 26 21:00
    straight-shoota closed #12874
George Dietrich
@Blacksmoke16
or curl, or insomnia, or whatever HTTP client you like
get it working there then can port it to crystal
looks like they also support JSON which might be easier
nvm, you're using a file
Jonathan Silverman
@mixflame
i think their api is being unfriendly, the code im using works and is a port from Imgur uploader, im doing api specific stuff wrong
no rush on the feature tho
gonna take a break and then i'll post man it, the feature is cool, i won't reveal it yet but i think you'll like it :D
if i don't have to apologize for a rude banner ad a fan bought (automagically) and i didn't remove but i had to change the rules of the uploader lol
similar uploader for this feature tho
me
@me:ky.rs
[m]
just a wild guess from glancing at their api + all the api madness ive seen out there: maybe put formdata.field("type", "dtg") as the first field?
Jonathan Silverman
@mixflame
ok! i will try that
From IRC (bridge bot)
@FromIRC
<Guest59> Hi
Ali Naqvi
@naqvis
Hi
From IRC (bridge bot)
@FromIRC
<oz> v
<oz> oops, sorry. Wrong window.
G. Gibson
@mistergibson:matrix.org
[m]
is there a source build path for the arm64 arch?
I've got a Raspberry Pi 400 running Ubuntu and would like to add crystal
From IRC (bridge bot)
@FromIRC
<straight-shoota> You can cross compile from a x86 system
<straight-shoota> @mistergibson ^
Daniel Worrall
@Daniel-Worrall
I've got a docker image of arm64 alpine https://hub.docker.com/r/danielworrall/crystal
Daniel Worrall
@Daniel-Worrall
Can either use it in rpi docker, or use it to build for ubuntu without cross compile
Daniel Worrall
@Daniel-Worrall
Okay, I don't have a Comp Sci background, so hopefully this isn't a dumb question. Would a binary cross compiled result in the same binary compiled locally assuming they're both static/release/etc/source version/target version
G. Gibson
@mistergibson:matrix.org
[m]
the arm procedure didn't work for me -- I'll keep trying. Any idea when an official arm64 build will be forthcoming?
Daniel Worrall
@Daniel-Worrall
If you check out the dockerfile, you can see the usual hardships with cross-compiling, specifically the compiler. libcrystal.a for example, which is being removed in future crystal builds
Also uses alpine to avoid problems with dynamic linking
From IRC (bridge bot)
@FromIRC
<straight-shoota> > Would a binary cross compiled result in the same binary compiled locally assuming they're both static/release/etc/source version/target version
<straight-shoota> Yes, should have the same result AFAIK
<straight-shoota> Code is generated by LLVM and that should operate the same way, whether it's building for the native architecture or a different one
Daniel Worrall
@Daniel-Worrall
So, I had an answer in the crystal discord. Reproducability (byte-for-byte) is a complicated issue, but the programs will be "the same"
Isaac Sloan
@elorest
Is there a better way to do line 2 of this? A way to take advantage of the fact that the compiler already knows what type the value is supposed to be.
https://carc.in/#/r/bb91
Kirk Haines
@wyhaines

@elorest: I don't know if this qualifies as "better"....

class Array
  def t
    T
  end
end

arr = Array(Hash(String, String | UInt64 | Int64 | Float64)).new
arr << arr.t.new

It's shorter, but calling the method that was added to Array #t is not particularly clear, and it is dependent on implementation details, but it does take advantage of the type of the array already being known. It could maybe be made less objectionable with:

class Array
  def add_new_value(*args)
    self << T.new(*args)
  end
end

arr = Array(Hash(String, String | UInt64 | Int64 | Float64)).new
arr.add_new_value

Or something kind of similar to that.

Generally, reopening standard lib types to add things is risky business, especially when they depend on other implementation details.
Isaac Sloan
@elorest
@wyhaines Yeah I generally try to avoid that. I was hoping there was something more general with types and aliases. Thanks though.
Sung-Chul Lee
@sclee15
Will CrystalConf unvail videos on YouTube? I am a Crystal user from South Korea. Since the event time starts up at 12AM in my timezone. I cannot attend the live event.
Kirk Haines
@wyhaines

I don't know of any standard method that gives you the type that an array stores, unless you go and create one yourself as above.

You could finagle something with a macro and typeof, which might also be reasonable if you are repeating the above pattern A LOT, but it also won't be particularly pretty in implementation).

Ali Naqvi
@naqvis
1 reply
From IRC (bridge bot)
@FromIRC
<yxhuvud> @wyhaines: typeof(array.first), but yes, it is not super pretty.
3 replies
From IRC (bridge bot)
@FromIRC
<yxhuvud> hrrm. Monkeypatching certain things would be easier if kernel.cr didn't execute as much directly in the top scope. :⁠(
ddd
@Dan-Do
Can we spawn fibers on GPU instead of CPU?
George Dietrich
@Blacksmoke16
no
i remember seeing a shard that allowed using GPU for stuff, but not sure if it's applicable here
ddd
@Dan-Do
:thought_balloon:
thinking :)
ddd
@Dan-Do
okay, can we do this?
done = Channel(Nil).new
spawn do
  call_next(context)
ensure
  done.send nil
end
select
when done.receive
  # print content
when timeout(34.seconds)
  # how to print stack trace to investigate which code causes long processing
  raise "Server could not process_request in 34 seconds"
end
George Dietrich
@Blacksmoke16
for what reason?
ddd
@Dan-Do
I don't know it is because of db, or pooling or business logic processing...
the call_next(context) is more or less like your Athena's Controller