Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:47
    straight-shoota closed #12051
  • 13:47
    straight-shoota closed #12050
  • 12:17
    beta-ziliani edited #7318
  • May 15 08:43
    r00ster91 closed #7318
  • May 15 08:17
    r00ster91 closed #7690
  • May 14 17:01
    Blacksmoke16 labeled #11995
  • May 14 13:03
    webhive closed #12055
  • May 14 10:19
    straight-shoota milestoned #12051
  • May 14 10:00
    I3oris edited #12051
  • May 14 08:45
    oprypin review_requested #11977
  • May 13 23:29
    Blacksmoke16 unlabeled #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 opened #12061
  • May 13 20:14
    straight-shoota labeled #12060
  • May 13 20:14
    straight-shoota labeled #12060
  • May 13 20:14
    straight-shoota opened #12060
Hanyuan Li
@hanyuone
name: LibGTK
ldflags: "-lgtk-3"
packages: "gtk-3"
destdir: src/libgtk
definitions:
  application:
    description: Application
    includes: [ gtk/application.h ]
    prefixes: [ gtk_ ]
Currently I have this, but it doesn't work
bmcginty?
I'm confused as to why this syntax:
a, b : Int32
is available in structs, but not classes
Hanyuan Li
@hanyuone
Hello?
Serdar Dogruyol - Sedo セド
@sdogruyol
hi @Qwerp-Derp
Hanyuan Li
@hanyuone
Hello @sdogruyol!
I'm having problems with libgen, can you help?
Serdar Dogruyol - Sedo セド
@sdogruyol
sorry, I don't have much experience with libgen @Qwerp-Derp
Gabriel Torrecillas Sartori
@G4BB3R
There is no (easy) way to load from DB and it receive a json with correct column names instead of list with values?
From IRC (bridge bot)
@FromIRC
<RX14> "a json" do you mean a named tuple?
unreadable
@unreadable
you can get the result as a tuple
I made a function that converts that tupple to json
Gabriel Torrecillas Sartori
@G4BB3R
image.png
From IRC (bridge bot)
@FromIRC
<RX14> you want something like this: crystal-lang/crystal-db#56
unreadable
@unreadable
  #converts tuples to json
def to_json(keys : Tuple, values : Tuple) : String
    if keys.size != values.size
      puts "Different tuple sizes!"
      return ""
    end
    json = "{"
    keys.size.times do |i|
      key = "\"" + keys[i] + "\":"
      val = "\"" + values[i] + "\","
      json += (key + val)
    end
    json.rchop + "}"
end
I
ex: to_json({"name", "email",}tuple)
From IRC (bridge bot)
@FromIRC
<RX14> please please don't do that
<RX14> that's no escaping at all
<RX14> use JSON.build
unreadable
@unreadable
Not sure if needed
Yeah I've used that before
require "json"

string = JSON.build do |json|
  json.object do
    json.field "name", "foo"
    json.field "values" do
      json.array do
        json.number 1
        json.number 2
        json.number 3
      end
    end
  end
end
string # => %<{"name":"foo","values":[1,2,3]}>
From IRC (bridge bot)
@FromIRC
<RX14> it's always needed
unreadable
@unreadable
In my case the data is queried from the database
not directly from the user
From IRC (bridge bot)
@FromIRC
<RX14> and where does the data in the db come from?
<RX14> and what if you make a mistake
Johannes Müller
@straight-shoota
data from the database might include special characters which need to be escaped in JSON
From IRC (bridge bot)
@FromIRC
<RX14> it's very little more effort to use JSON.build there
Johannes Müller
@straight-shoota
And it's probably even faster than concatenating strings...
unreadable
@unreadable
I guess I'ma wrap the json builin
From IRC (bridge bot)
@FromIRC
<RX14> JSON.build { |json| json.object { key.zip(values).each { |key, value| json.field key, value } } }
unreadable
@unreadable
looks nice
Gabriel Torrecillas Sartori
@G4BB3R

@FromIRC

<RX14> you want something like this: crystal-lang/crystal-db#56
It does not works yet, right? I tried it and it gives an error "DB::Database#query_all' is expected to be invoked with a block, but no block was given"

From IRC (bridge bot)
@FromIRC
@G4BB3R, I'm a bot, bleep, bloop. I relay messages between IRC (#crystal-lang on chat.freenode.net) and here
<RX14> yes that PR is not merged yet
Rubi
@codenoid
it's a Valid JSON
but why, :worried:
From IRC (bridge bot)
@FromIRC
<RX14> because crystal play is broken
Rubi
@codenoid
oderlo@oderlo:/var/app/toped$ crystal build src/toped.cr && ./toped
Unexpected char '/' at 1:36441 (JSON::ParseException)
0x47c607: *CallStack::unwind:Array(Pointer(Void)) at ??
actually
From IRC (bridge bot)
@FromIRC
<RX14> why did you gsub ' out?
<RX14> that's so weird
Rubi
@codenoid
idk :O
eh
From IRC (bridge bot)
@FromIRC
<RX14> it's entirely unneeded
Rubi
@codenoid
is i did it ?