« first day (2553 days earlier)      last day (2399 days later) » 

10:00 PM
you get [object Object] or a json string?
 
I have in resp an object with lot of things, but I can't find the json
 
holy fuck: git bombs
 
IncomingMessage {_readableState: ReadableState, readable: true, domain: null, …}
I get that
 
you need to listen for data
 
10:01 PM
I completely misread the question
resp is your response object
it is an event emitter
resp.on('data', chunk => console.log(chunk.toString()));
117
A: How to make external HTTP requests with Node.js

chovyNodeJS supports http.request as a standard module: http://nodejs.org/docs/v0.4.11/api/http.html#http.request var http = require('http'); var options = { host: 'example.com', port: 80, path: '/foo.html' }; http.get(options, function(resp){ resp.on('data', function(chunk){ //do somet...

read this
 
is this the right way of doing relations?
im not sure if they have to be swapped though
 
First off, you should have a good PK
 
Like an ID
 
10:05 PM
@KamilSolecki its not for a database :D
 
@towc that makes perfect sense.
kinda surprised nobody found it sooner
 
just the relation is what I am after
1 - 0..n or 0..n - 1
 
@Wietlol it almost never works out
 
@towc shhhh
 
@Wietlol one to many / many to one?
 
10:07 PM
they dont have to know how many girlfriends dumped me
@towc yes, but in which way
 
why not both
 
should the 0..n be on the Town side or on the Person side (like in the image)
 
does the town have many person, or does the person have many town?
 
depends on who's chasing whom
 
towns have many people
people only live in one town
(for the time being)
 
10:09 PM
I have so many town, for example
@Wietlol so town to many people, right?
hence you answered your question
 
yes
 
I'd have the town keep a list of the person id's and the people keep a list of town id's
 
@towc so the image is correct?
 
redundant, but it means you can associate from either perspective without expensive loops
 
or use a third table with the relationship
 
10:09 PM
I'd guess so
never seen that format
 
(in the db model, at least)
 
@rlemon if properly normalized, you would have a table with townId and personId
where they form the primary key together
 
well yea, but I'm working with what you've got
which is a person class and a town class :P
 
in my case, in a db model, the personId would be the primary key on its own
in any case, now I can finish my little diagram
yay
 
rust gets better and better
 
10:15 PM
Hey, now I have this:
const options = {
        hostname: 'api.ebay.com',
        port: 443,
        path: '/buy/browse/v1/item_summary/search?&q=Beatles&limit=10',
        method: 'GET',
        headers: {
          'Authorization' : 'Bearer <myKey>'
        }
      };

      const request = https.request(options, (resp) => {
        res.status(200)
        resp.on('data', chunk => res.send(chunk));
      });

      request.end()
}
And when I execute it, the browser downloads a file
lol
 
lol
 
The file has what is returned from the API
 
damn
 
@QuicoLlinaresLlorens Probably because you send a buffer
Try chunk.toString('utf8')
 
no content type?
 
10:19 PM
Also that ^
 
@ShrekOverflow ok
 
Ace
how do i set dark theme for SO?
 
Now it seems to return json, but if I try with postman to see as json, it says: "Bad string"
I have this now:
const options = {
        hostname: 'api.ebay.com',
        port: 443,
        path: '/buy/browse/v1/item_summary/search?&q=Beatles&limit=10',
        method: 'GET',
        headers: {
          'Authorization' : 'Bearer <myKey>'
        }
      };

      const request = https.request(options, (resp) => {
        res.status(200)
        res.contentType('application/json')
        resp.on('data', chunk => res.send(chunk.toString('utf8')));
      });

      request.end()
}
 
What does it actually return? can you paste it here? (or if too big, on a pasting service)
 
Ace
10:26 PM
@MadaraUchiha how do i change my theme to dark?
for SO
 
@Ace Please don't ping random people with questions
If someone wants to answer you, they will
Also, google
 
Ace
yea i know that
just say 'piss off'
 
love the function name:
fn change_truth(x: bool) -> bool {
    !x
}
 
does rust have implicit return, @towc?
 
10:28 PM
@QuicoLlinaresLlorens Is that all of it?
 
yup
if you did !x; it would error, though
 
It's cut in the middle
 
-> for types is a bit odd, but otherwise it looks like a nice lang
 
it's pretty scary
@ssube are you pissing on haskell?
 
10:29 PM
Check the end of the string
 
-> is the best for types
 
It doesn't terminate gracefully
 
Yes, you are right
 
That's probably because it's only the one chunk
 
Yes that i was thinking
but, how can I get all chunks
and append them?
 
10:30 PM
There are a few ways
But I think you can stream one response to another
Alternatively, you can listen to the request's 'data' event, and append all the chunks in a variable
Then listen to the 'end' event to make your own response with the resulting json
 
Ok, I am going to try
thanks
 
user2620028
@SterlingArcher go look up the big block motorcycles
 
Ace
anyone wana know how to change SO style to dark theme?
60
Q: Why is there no dark theme on SO?

WiceloI think SO should implement dark theme. All major interfaces have a dark theme because it's better for the eyes.

 
Ace
yea
its so good to be in the dark
i have youtube/google/SO/VS in dark mode :3
 
10:39 PM
wow
this is a cool extension
i made facebook into pokemon
oh god it's terrible
 
Ace
lol
 
const options = {
        hostname: 'api.ebay.com',
        port: 443,
        path: '/buy/browse/v1/item_summary/search?&q=Beatles&limit=10',
        method: 'GET',
        headers: {
          'Authorization' : 'Bearer <myKey>'
        }
      };

      const request = https.request(options, (resp) => {
        var data = ''
        res.status(200)
        res.contentType('application/json')

        resp.on('data', chunk => data += chunk);
        res.send(data.toString())
      });

      request.end()
This could be right? It is not working
 
don't you just need resp.on('data', chunk => data += chunk.toString())?
 
Also, when are you actually doing something with the data?
 
@Zirak res.send(data)?
 
10:51 PM
@FlorianMargaine yep, you are right
 
@QuicoLlinaresLlorens you're sending data before you get any
 
ah, duh
thanks lemon
 
resp has an end event
listen for that, then send the data
or send it in the data event handler.
 
oh wow, I completely filtered out that line, I was sure res was resp
 
10:54 PM
I have a code smell
and one I dont like
 
you shame me Zirak
 
anyone interested in spending hours of his precious time and a lot of frustration (mostly to understand the situation) and helping me out?
 
sure.
go ahead.
I'm going to bed
 
up arrow
 
@FlorianMargaine then you wont sleep tonight :D
in any case, I wrote a little thing that serializes and deserializes models
 
10:56 PM
const options = {
        hostname: 'api.ebay.com',
        port: 443,
        path: '/buy/browse/v1/item_summary/search?&q=Beatles&limit=10',
        method: 'GET',
        headers: {
          'Authorization' : 'Bearer <myKey>'
        }
      };

      const request = https.request(options, (requestResponse) => {
        var data = ''
        res.status(200)
        res.contentType('application/json')

        requestResponse.on('data', chunk => data += chunk.toString);
        requestResponse.on('end', res.send(data))
 
we can't just wait for data. We're in a hurry
 
I am getting now nothin
 
Just like you pass an arrow function to 'data', you need to to pass one to 'end'
Otherwise you're just running that line right there and then
 
basic features of this project is polymorphism in serialized data and being able to deserialize without knowing what type it will be
 
requestResponse might be the funniest variable name ever
expressionResult is a close second
 
10:57 PM
@Zirak what is the parameter it gets the function on end?
 
I dunno, but you don't care what it is
 
So, in short, I wrote 4 things
 
congrats
 
1, a set of models
 
4 is a lot of things
 
10:58 PM
2, a schema which stores which models can be serialized/deserialized
 
to write
 
3, schema entries which handle the serialization/deserialization per class/type
4, a streamwriter/reader which writes/reads basic types such as int, float, string, boolean, etc
 
4 is a lot to count to
 
oh gosh I have this taste in my mouth of rice with milk
and cinnamon
those were the days
 
Here is a quick overview of the functionality:
https://i.imgur.com/tZ3QdVE.png
 
11:01 PM
whoreshatta
 
sitting by the fire with my parents and sister, watching tv, when we still lived in the countryside
 
      const request = https.request(options, (requestResponse) => {
        var data = ''
        res.status(200)
        res.contentType('application/json')

        requestResponse.on('data', chunk => data += chunk.toString);
        requestResponse.on('end', param => res.send(data))
      });

      request.end()
}
 
all cozed up under a blanket
sipping tea and being unaware of all the bad stuff in the world
 
the issue now is, I wanted to add varint serialization
 
rice milk, cinnamon, sugar, blankie
 
11:01 PM
Like this is not working
 
and rum
 
so that numeric values will be stored in less bytes
 
on the other hand, I had no knowledge of lambdas, linux, or vue back then
 
rumchata >>> horchata
 
> numberic
 
11:02 PM
so, in order to add this functionality, I had to change the writer/reader
 
although they both taste weird imo
 
@towc (whoops)
 
did I tell you to correct it?
it's just a genuinely funny word
 
now, changing them to add this feature wasnt a big issue
but those writer/reader classes were supposed to be a separate thingy that this project uses
so they can be used in other projects as well
 
one of two things will happen
 
11:04 PM
but, when I need a new feature in this project, I have to change its dependency to allow these features
that smells
and not like perfume
 
I am getting now a function as response :S
 
more like... socks... sweaty... put on a radiator... and spraying deodorant on it... or w/e
 
I get this as response in my browser
 
call toString, don't append it to your data
 
https://i.imgur.com/g6b1URu.png
I replaced the image with a bordered one so it is less annoying to look at
@towc any ideas?
 
11:20 PM
@rlemon but if I don't append, I won't get all the response no?
I have it
it was toString"()"
 
there you go
 
lol
what an error..
Thanks for helping
 
Can someone tell me what's wrong with this code fragment?
app.get('/api/update_level', function(request, response) {
      factor = request.query.factor;
      if (!factor) {
        response.sendStatus(BAD_REQUEST);
      }
      else {
        model.getLevel().
          then(function(level) {
            model.setLevel(level * factor);
          });
       }
 
it's incomplete?
 
What do you mean?
 
11:28 PM
missing });
otherwise, you'll have to say if you're getting an error I guess
 
I forgot add the }); sorry
I am sorry I cannot say that, I have no idea...
 
so something's wrong but you cannot tell me if anything is wrong?
 
its because it does not throw an error
it just does not do what I expect
when I send the url
that's exactly what I am saying lol
 
you'll have to say what you expect it to do and what it is doing
because if I'm not looking for a syntax error, how would I possibly know
 

« first day (2553 days earlier)      last day (2399 days later) »