« first day (1081 days earlier)      last day (1775 days later) » 

9:54 AM
Hi guys, I wrote a program in c++ on Linux which sends some information to a server. But I don't know why, the response is "HTTP/1.1 505 HTTP Version Not Supported" . But when I cURL , its working perfectly fine... I am getting the same response when I use nc to do a GET request.
can anyone please help ?
 
10:25 AM
@0xVikas well what is the HTTP version you specified in the request header?
 
10:37 AM
its 1.1
 
@0xVikas can you post the complete first header line?
 
GET / HTTP/1.1
And about the host, its hosted on Heroku. And it looks like it is changing its ipaddress constantly
When I curl -v, I see different IP address everytime
 
@0xVikas did you make sure to terminate the line with \r\n and not just \n ?
 
Well I guess that was the problem for that message. I didn't put \r\n
But still , I have another problem now
It is changing its ip address :/
 
10:58 AM
@PeterT are you there ?
 
yeah, I don't know anything about Heroku though
 
how can I get the current IP address from the domain in c++ ?
 
the public IP? There's no API for that
there's no way to do it in any language without a public server to bounce off of
 
I tried using gethostbyname and other ways I found by googling, but they are not getting the actual ip the website is using
 
I'm also not sure whether you have the HTTP client or the HTTP server on it
because if it's the client, then it shouldn't matter, the server is going to just reply to where it got the request from
and the client will just choose a random port to send it from (though not a random IP normally)
 
11:34 AM
I got it sorted (Y) thank you for trying to help !
 
 
1 hour later…
12:55 PM
i need some information , i am learning to write simple llvm pass , i want to know can we write llvm pass using any ide , i am sorry for this question , i just want to make my life simple :P , thanks
 
@sunil if you can compile llvm with it, you can compile a custom pass with it
 
Note: i have llvm in my system and i can run a simple function pass using command line , but only thing i am writing pass using text editor
@PeterT can you please explain in detail
i am talking about ide like clion or eclipse
 
if you can use a text-editor than you can use any IDE, I don't understand the question
 
@0xVikas heroku dynamically changes and allocates addresses by use
 
text editor is not giving me any information about methods and auto suggestions
i want that
 
1:18 PM
@JerryCoffin Yeah, sorry, I meant that is what is expected.
 
@sunil That means you need to point the IDE to LLVM's headers and have it correlate the #includes to the correct files.
 
2:01 PM
@ratchetfreak how to do it , any link
currently i am reading this stackoverflow.com/questions/35047489/…
but i want to do it clion
 
there is not really anything special about the llvm case, just search on how to add header search paths in general for your IDE
 
ok let me try
 
2:34 PM
i got it , i just need to add the include_directories(/media/sunil/8C62C9A162C9907E/llvm-8.0/llvm/include/) in CMakeLists.txt
@PeterT and @ratchetfreak thanks :)
 
 
5 hours later…
Zoe
7:23 PM
Does C++ have something similar to Kotlin's map/Java's stream mapping? (TL;DR: converts i.e. a List to something else). As an example: (Kotlin) var list = listOf(SomeClass(42), SomeClass(62)); var listOfInts = list.map { it.intVariable } or (Java) list.stream().map(it -> it.intVariable).collect(Collectors.asList())
 
 
2 hours later…
8:53 PM
@Zoe Yes, the algorithms library.
From std::vector<SomeClass> vec = ...;, you could write: std::vector<int> intVec; intVec.reserve(vec.size()); std::transform(vec.begin(), vec.end(), std::back_inserter(intVec), [](SomeClass const& c) { return c.intVariable; });
There's a lot of variations on that
The algorithms library isn't lazy. If you want laziness, look at Range V3, Boost Range, or perhaps boost::transform_iterator
 
Zoe
I try to avoid boost. That'll do the trick though. Thanks ^^ I'm not entirely used to searching in other headers for functions yet :]
 
@Zoe What headers are you searching to find functions? In most cases, you should have better places to search...
 
Zoe
I usually check the main header for a specific feature (so for this, I checked the vector header).
 
@Zoe en.cppreference.com/w is usually a good place to start
 
Zoe
I know, I also added that as a search engine to FF
... but that specific page is actually better
 
9:09 PM
suppose at some point ptr=NULL, where ptr points to a structure node which has a next pointer to the node type. I thought(and I remember my prof. taught me that) ptr->next will through error, as NULL doesn't have any next field. But it's not the case. Please correct me if I'm wrong.
 
@taritgoswami you're wrong, it's technically undefined behavior IIRC
it just so happens that most implementations reserve the bottom 256k of the address space with a guard page
that said you shouldn't do that, you should check for nullptr before accessing a pointer
 
could be worse.. in the old days that's where the interrupt vector table was... so if you did that you could randomly modify some code
 

« first day (1081 days earlier)      last day (1775 days later) »