« first day (484 days earlier)      last day (4465 days later) » 

12:00 AM
@sehe but the cleanup order of elements isn't specified.
 
i want to make it as secure as possible so no stupid loser can do some injection or things like that to hack in
 
4 mins ago, by Hoxieboy
@user1079641 I really couldn't tell. Like I said you should take a gander at the question/answer forum of SO (StackOverflow) and post a question there. It will probably get solved faster than asking questions to a bunch of C++ programmers ;)
 
@user1079641 @sehe or... Google scary music
 
'ello
 
How does facebook do it? facebook is in php i know
 
12:01 AM
@user1079641 Basically what you say is: "I want to defend my site, but I haven't got the foggiest what the risks are". Get experienced advice. Goole SO, Bing google.
@user1079641 hahahaha. Let's check with Andrei if he does much php programming :) And, this is not the 'Facebook Devs' room
 
@user1079641 HEY! Thats what robots.txt is for... You can't really "Hack" into a website, unless you deployed trojans onto the computer that ran the server. The only way to "Hack" a website is to get information by finding security back ends that the developers failed to seal. I'm pretty sure anything you make with php that only includes a few files wont be enough for things to conflict with each other and create such flaws. Intelligence by Hoxieboy
(that means its probably false)
 
@user1079641 you need to get a book about online security. this isn't a php question. and a couple of chatroom lines won't be enough here.
also, it's a c++ room. so talk about sex or c++, not php.
 
@Hoxieboy Unfortunately, that's not right. Php has dynamic execution and it is frequently misused in horrifically insecure ways, which lead to vulnerabilities as injection attacks or even modification of the server files, yes
 
user868935
I have a file reading problem
 
@sehe Thats where my reference "Intelligence by Hoxieboy (that means its probably false" comes in
:D
 
12:04 AM
@Paul I have a drinking problem
4
 
@Paul (elaboration please)
 
user868935
@sehe lol
 
ok, i think i have a solution for myself.
 
@user1079641 To be fair, if you stay away of the 'eval' drugs and some other fairly well documented guidelines, PHP5 is relatively safe
 
i think what i need to do is wrap a std::stack in a raii object, add a commit() member, and have the destructor do the cleanup in the order i want.
 
12:07 AM
ok
 
Any ideas on whats best for beginning C++?
 
user868935
@sehe so my program opens and reads a text file in a directory. I also have it to count the words in the text file. That works. But for each word, I want to count it's length. Ultimately, I want to put a word into a temporary string, read its length, excute code, then move to the next word and do it over again until it reaches the end of the file. If I can get each word to read into a temporary string, I can figure out the rest.
 
@user1079641 No need to learn about SQL injection, XSS, Session Cookie, whatnot. Just lock down the server files if they're supposed to be immutable (they should probably be) and have lots of backups. If you have many users, have good lawyers
@wilhelmtell Yup. Make it some classes' responsibility
@Paul what is the question? just write that :)
 
@user1079641 I think you'll get better answers by searching the SO archives than asking here... broad questions like this have generally been asked before and answered well (not that there's anything wrong with @sehe's advice!)
 
user868935
@sehe How do I put each word into a temporary string? I only need one string for each word to enter when count increments.
 
12:13 AM
@Paul becaus I'm not a bad guy :
#include <string>
#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>

void somefunction(const std::string& s)
{
    // call some code here :)
    int length = s.length();
    std::cout << length << "\t" << s << "\n";
}

int main() {
    std::ifstream test("test.cpp");

    std::for_each(std::istream_iterator<std::string>(test),
                  std::istream_iterator<std::string>(),
                  somefunction);
    test.close();
}
 
user868935
@sehe You are the man!
 
i have a quick question and I don't think I would need to post this on SO for an answer. You guys can probably answer it. Is there a problem with a file name like this: 418788724-335238043ui959525611-835877454-file.php ??
 
@Paul no way you've tested it yet
 
user868935
@sehe working on it right now
 
@user1079641 To whom?
 
12:15 AM
what do you mean to whom?
 
Question: How easy would it be to implement grabbing a file from the internet using C++
 
@user1079641 Is there a problem? NO:
The filename is metadata about a file; a string used to uniquely identify a file stored on the file system. Different file systems impose different restrictions on length and allowed characters on filenames. A filename includes one or more of these components: * volume (or drive) – the physical or logical disk volume (e.g., DKA0:) * directory (or path) – directory tree (e.g., /usr/bin, \TEMP, [USR.LIB.SRC], etc.) * file – base name of the file * type (format or extension) – indicates the content type of the file (e.g., .txt, .exe, .COM, etc.) * version – rev...
@Hoxieboy Darn easy. Get libcurlpp and compile the sample
 
what about without using an external library?
 
then why doesn't it work?
 
@Paul here it is live on codepad, running on the source code itself: codepad.org/WZh2LvxG
 
12:18 AM
In fact, another question: How easy would it be to implement a GUI in a C++ application? Another external library?
 
@user1079641 why the hell should we know? We don't even know where you're using it, how. Just ask the dam question on SO, so we at least know that you'll be thinking about your question before clicking 'submit'?
 
user868935
@sehe Thats exactly what I was looking for. Thx!
 
@Hoxieboy Dozens. No GUI libraries are simple in my view,not even in python
@Paul Next time, ask it on SO? I like upvotes
 
@sehe I guess you are right on that one, I was just wondering how much time I would be spending on a certain function, though it takes time no matter what language or library ;) I think I'm going to go look up some tutorials now on C++, I'll be watching the chat
 
@Hoxieboy Oh, masochists have their work cut-out in C++. However, try doing it in Perl without library support. Getting a socket going is pretty simple, but wait till the server does chunked encoding or gzip compression, or a HTTP 302 redirect or worse
@Hoxieboy To get up to speed, don't think about GUIs in C++. GUIs aren't the strong area of application. Anyway, wxWidgets and Qt Library are the first that come to mind.
 
12:22 AM
@Hoxieboy A Gui without an external library? If you mean an X11 gui, that's nigh on impossible. The X11 spec isn't pretty.
 
@sehe lol I dislike being spoon-fed perl (I've already tried it once ;) ) I think I'll go the masochist way and see how it turns out, but thats much later on, right now, the basics of C++, and please, don't tell me GUIs arent the strong point, I already know that far too well :D
 
@Hoxieboy I've seen GUIs done in assembly with surprisingly little code. Granted that was in i386 real mode, with lowlevel int 10h/graphics buffer access
 
@sehe Gods assembly
@sehe Hey, couldn't be worse than BrainF*ck
The main thing that worries me is structure and clean code, take for instance file writing and reading in python:
 
...
 
with open('file.txt', 'r') as F:
 F.read()
 
12:27 AM
@Hoxieboy I'd love to see a GUI written in brainf.ck...
 
its as simple as that, rather than 5 lines the other way
@je4d Me too! In fact, time to get working...
 
@Hoxieboy Let me know when you're done ;-)
 
@je4d grows beard and ages 50 years Almost done with the Frame...
 
how do you retrieve an object of a move-only type from a stack?
 
@Hoxieboy equivalent? :
{
        std::ifstream F("file.txt");
        std::string line;
        while (std::getline(F, line))
        {
        }
    }
 
12:29 AM
@sehe Do you HAVE to write std:: after every line? or is that some raw format?
and yes I think it is O.o
 
@Hoxieboy it is common practice, especially when sharing code. Makes it explicit we're using standard library
There are issues with using namespace std; that are oft forgotten by newbies (don't do them, at least not in your headers)
 
What is the world without epilog and prolog?
 
@wilhelmtell I'd try MyType var(std::move(stack.top())); stack.pop()
 
@sehe yeah, you do the import statements, and right after that you type using namespace std; i remember a bit of C++
@sehe I really need to learn more XD
 
@Hoxieboy s/imports/includes/g and I suggest you do using namespace XXX; when needed.
 
12:31 AM
@je4d sounds dangerous. i don't think you're supposed to use std::move() outside move ctors and very specialized circumstances...
 
@sehe How would you do that same code without std::?
 
@wilhelmtell It's not dangerous - move c'tors should leave the source object in a valid but empty state
 
am i wrong?
 
@wilhelmtell you can use std::move anywhere so long as you don't try to use the object you've moved from after you've moved
 
I'm getting some false positives on a call to accept, meaning, to my knowledge there was not a request and it did not return -1. Any ideas on what to look for?
 
12:35 AM
@Hoxieboy I wouldn't. But see these examples:
 
Just by looking at the certain structure of a simple helloworld program in C++, if there is a definition (int?): int main(), could you call that as main() in a different def?
 
1
A: c++ Reading a text file into ints and strings

seheOh, I'd actually recommend Boost Spirit (Qi), see below later for an example #include <fstream> #include <iostream> #include <sstream> #include <string> using namespace std; int main () { ifstream myfile ("example.txt"); std::...

(uses using namespace std in the first sample, using namespace boost::spirit::qi in the second)
@Hoxieboy But just to show you things don't have to be verbose even without ever using using namespace, see this - which is actually quite high-level, pythonesque-if-you-will code:
1
A: Parsing Text to Make a Tree Data Structure

seheSpoiling the fun with an answer you can't use anyway if it's homework: A minimal implementation with Boost Spirit Qi: #include <boost/spirit/include/qi.hpp> namespace qi = boost::spirit::qi; typedef boost::make_recursive_variant< std::vector<boost::recursive_variant_>, ...

 
ah so simply stating using namespace std; you HAVE to use std::somecode for proper "etiquette"
I want to learn C++ without cheater libraries like boost, so that's the path I'll take :D
 
@Hoxieboy Using namespaces is shooting a canon. I prefer to just keep std around, except if it make a function unreadable, at which point I might add using std::cout; using std::sort; or ... sometimes even using namespace std; inside that function locally
 
@Hoxieboy Boost is not a cheater library: it's the library C++ should have by standard.
It exists because the STL is so . . . nevermind. I don't want to start a war.
 
12:40 AM
@LeviMorrison And to be fair, it mostly does these days. The essential parts have been accepted into the C++11 standard
 
@LeviMorrison I will leave it at that, but is it not proper to do it the "old" way?
 
@LeviMorrison Not a chance. The STL is 14 years old, no one uses it.
@Hoxieboy It's all right, it will get you the basics just fine. Be sure to read a recent book though, C++03 at least, or you'll deal with archaics that have long since been 'solved'
 
@sehe @LeviMorrison From what I'm seeing right now, its possible (and default) to do it without special Boost calls
 
@LeviMorrison you probably meant 'standard library'
 
Xeo
@sehe wtf am I reading...
 
12:41 AM
@Hoxieboy I lost the context. To do 'it'?
 
@sehe as in not using boost
 
@sehe If you actually read the sentence, you will see that I am talking about a library:
> it's the library C++ should have by standard
 
@Xeo I'm charging a little. It was opportunistic for me to take 'Tomalak's' hobby horse out for a ride
 
@LeviMorrison standard library, exactly
 
@LeviMorrison Well duh. I take you have read my replies too. So you know that I knew.
K I'm off to bed
 
12:45 AM
@sehe @LeviMorrison I dont understand what the difference between these two are "it's the library C++ should have by standard" vs "its a standard library"
@sehe night
Meanwhile, its time to learn C++ :s
 
@sehe My point was simply that your statement "you probably meant 'standard library'" was unneeded as I had clearly specified it I was talking about a library. That's all ;)
 
Ah I see, so if there are two definitions, one named int main, and another named something else, the code in main, no matter where, is always executed before any other def. So if you called a def in main, would it execute that def as well?
 
i may be getting something wrong here, but i have a moveable type and stack.push(t) doesn't compile because t is not copiable
what gives?
 
@wilhelmtell you have to use stack.push(std::move(t))
 
I believe you require stack.push(t); where t is an expression of rvalue value category and type T
 
12:56 AM
but as DeadMG mentioned before editing it.. use emplace if you can: stack.emplace(... args for T's c'tor...)
 
@je4d that won't work either.
and i don't think i should anyway, because push() takes by value, so the move ctor should Just Work.
oh i'm stupid
it's a named variable
 
so as i was asked to write on SO, I did, here is the link: stackoverflow.com/questions/9245499/… in case anyone can help me
 
but std::move() doesn't work here.
 
@wilhelmtell what's the error? I'm surprised std::move doesn't fix it
 
use of deleted function <copy ctor> ...
 
1:00 AM
@wilhelmtell could be a bug in stack.. what compiler/version?
I think the spec requires all contianers to work with move-only types
WFM:
int main()
{
std::stack<std::unique_ptr<int>> s;
std::unique_ptr<int> move_me;
s.push(std::move(move_me));
return 0;
}
 
@sehe ok. i meant "denote type int". not "name type int". im sorry
so decltype(Class::member) is not possible too xD
im so sory for these corrections to the quiz :(
 
@JohannesSchaublitb where's the quiz?
 
user868935
@sehe This is the error I got implementing codepad.org/WZh2LvxG : Error 2 error C2197: 'void (__cdecl *)(void)' : too many arguments for call c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm 22
 
@Paul name your class t.cpp
lol
 
@JohannesSchaublitb template <typename T> struct X_ { static T member; } template <typename T> T X_::member = 42; typedef X_<int> X;
 
user868935
1:08 AM
....
 
@Paul Vexing Parse :)
 
@sehe weren't you sleeping?
lol
 
"Declare and define a class X and its static data member called 'Y' of type 'int'. The type 'int' shall be n-a-m-e-d denoted only once."
 
I intended to
 
@sehe the lure of chat SO is too powerful
 
1:09 AM
 
@sehe i see it defines the member of a class template. but when instantiating T actually becomes int in the specialization so i guess this is an invalid answer :(
 
@Hoxieboy No, the plink is too loud
 
XD
 
wow it did actually strike through it!
 
@JohannesSchaublitb Hahaha. I guess I'll know what you mean by the time that you specify the solution .
 
1:10 AM
i didn'T expect it to do xD
wait I had an error!
im so sorry :(
ok new formulation
 
@JohannesSchaublitb I do hope you are not implying that we rely on old ANSI C relics saying that you can leave stuff undeclared and the compiler assumes 'int' (I hope that isn't legal anymore in C++)
 
tss just forget about it. i messed up
i get older
 
@sehe so here was a question I asked earlier, so you have int main, what if you had another definition, how would you use that def?
 
@JohannesSchaublitb So what was the solution to the problem-you-never-stated?
 
struct A { static A value; } A::value;
:/
 
1:12 AM
@JohannesSchaublitb mind blown
 
but it too denotes the type "A" twice. i should have said only denote type "A" by the class definition and by the declaration of the member i guess
 
What does an error like this generally mean
ilist_destructive.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘icons
 
Dear God!
 
@renatofernandes you have only ten days to live sir
 
@Hoxieboy :(
 
1:14 AM
lol
 
@Hoxieboy you can't:
> An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main:
int main() { /* ... */ }
// and
int main(int argc, char* argv[]) { /* ... */ }
That's from § 3.6.1 (Main function) of the standard
@renatofernandes to be honest, I'd expect a missing ; (after struct X{}; class Y{};)
 
actually the spec says that in the following, main is overloaded
 
Well, of course I'm making a mistake comparing python to C++, but in python you could do this: `def main():
some code
main2()

def main2():
do some more code`
 
@JohannesSchaublitb there are four types of denoting types in c++: constant ones ( also called global, live all until process dies )( also you could declare local types to be global just by adding static as you noted in the previous example ) 2. temoporary ones 3. passing ones and 4.dynamic ones
 
struct main {}; int main() {}
but it does not intend to do so
"When two or more different declarations are specified for a single name in the same scope, that name is said
to be overloaded."
 
user868935
1:17 AM
@sehe same error. keeps too many arguments. Could this be an older format?
 
@Hoxieboy forward declaring a function prototype was in C forever:
 int myfunction();
 int main() { myfunction(); }

 int myfunction() { /* hello world or something */ }
 
"Only function and function template declarations can be
overloaded; variable and type declarations cannot be overloaded.". but we actually showed that we *did* overload main!
 
no, it's not if that single name points to different types
 
@sehe i had something like this ideone.com/UgAEn and i got the error, is it something to do with the struct?
 
@sehe buts thats in C, is it the same in C++?
 
1:18 AM
yes
 
i.e. struct alfa { int a,b,c;} union alfa g,h; alfa = 55 ...
 
@Hoxieboy ilist_destructive.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘icons’
 
in both languages you can alos do int main() { int myfunction(); myfunction(); }
 
@renatofernandes 9 days sir
 
LOL
-___-
 
1:19 AM
does any one know where could i get good basic c++ tutorials
 
we miscalculated
lol
@Hira I would like to know the same. For now however, I'm going by cplusplus.com/doc/tutorial/program_structure
 
@sehe got it nvmm
 
@Hoxieboy thanx for help
 
find anything you need by simply searching for it in the search scope
 
@renatofernandes yeah... the trailing ; already
@renatofernandes ah good
 
1:22 AM
@DzekTrek thanks
 
@JohannesSchaublitb yes, if the function type is declared as int previously.
@Hira np, :)
 
you can't cast it to another type out of her declaration scope, int main() { int myfunction(); myfunction(); }
 
huh
i dont understand
where is a cast?
 
nevermind.
 
1:24 AM
@sehe Do you know anything about making functions destructive?
 
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
 
8 mins ago, by Dzek Trek
@JohannesSchaublitb there are four types of denoting types in c++: constant ones ( also called global, live all until process dies )( also you could declare local types to be global just by adding static as you noted in the previous example ) 2. temoporary ones 3. passing ones and 4.dynamic ones
 
why do types "live"
 
@DzekTrek you're getting way out of your league :) You're talking to a compiler writer there. Also, I'm pretty sure you think you are talking about scope/lifetime of variables
 
please show me an example of a temporary type
i'm not a compiler writer of c++
 
1:25 AM
@JohannesSchaublitb yeah I thought you'd missed that message.
 
@sehe thanks for reporting it to me
in fact I did miss it
 
@JohannesSchaublitb Oh, I got that idea a long time back. Nevermind, you know your stuff, that's the point :)
 
thanks, I appreciate that
 
@JohannesSchaublitb my English sucks, that may be a reason for a little foggy understending. Temp, like for loop .
 
ive long had the desire to write my own c++ compiler but i just cant get around it. so many basic things to do first until you get a half decent framework with a good ast
 
1:27 AM
@sehe Ye, I know this man rocks, no need for explaining it. :)
 
then the totally nerdy question how to represent certain tokens. I am not able to decide on those xD
 
-11
Q: Huge math operation

lolcat Possible Duplicate: What's the maximum size for an int in PHP? echo 100000000000000000000000000000000000000000000000000000000000000000000 * 10000000000000000000000000000000000000000000000000000000000000 * 100000000000000000000000000000000000 * 1000000000000000000000000000000000000 ...

it's approximately the amount of downvotes I suspect this question will get. – Mitch Wheat 28 mins ago
 
Well 'know your stuff' is a bit of an understatement, really. How come you know the ins and out of compilers and the current standard (proposals)? It especially caught my attention that you seem to make a habit of filing a gcc bug at least once a week
 
lolz
 
i think "if i now take this way I will never be able to change the decision!" xD
lol @sehe
 
1:28 AM
So did you go ice skating in Hamburg today?
 
@sehe i don't have too many open bug reports! 22 for gcc and 33 for clang
 
hahaha
 
I just read that today over 100000 people showed up to go skating on a lake. That's quite a number.
 
@JohannesSchaublitb So you're a professional compiler yourself then ?
 
user457812
@StackedCrooked Did they all fall in?
 
1:30 AM
That would be funny.
 
user457812
Funny and then sad and then really gross
 
And then funny again.
 
user457812
Only after they froze
 
Anyone mine looking at the question for me stackoverflow.com/questions/9243475/… ? :)
mind*
 
1:32 AM
@JohannesSchaublitb lol. Premature existentialism?
 
@sehe many of them are not too important. like this one llvm.org/bugs/show_bug.cgi?id=5916
 
Did anyone notice that you can start editing a prior chat message, delete it, and still submit the edit to the now-deleted message?
 
it would be good if clang supported it but noone will die if it doesn't xD
@sehe quick, write an exploit! what if you edit it two times, then send the one where you started the edit later first, and the one you previously started later? perhaps it will crash with IntegerOverflow or something xD
 
@JohannesSchaublitb but I take it you're somehow involved in the standards process/committee? In what capacity are you doing all that work? (If you don't mind my asking, or if I should already know)
 
user457812
Oh god more ilists
 
1:35 AM
@sehe jeeze you're still not asleep?
 
yes I'm helping in the committee's discussions where I can (since about one year now). but i'm not actively involved in proposals or something. i'm doing the nerdy thing in free time xD
 
Here's a nice list of pictures. (Old news if you're a reddit addict..)
 
@sehe the thing that's im totally a noob at is multithreading :(
 
Yeah, like what happens if you don't release a memory barrier?
 
then I go to sleep!
 
user457812
1:38 AM
I am not a reedit addict, but the people I know are, so I've seen that link a few times now.. weird.
 
@JohannesSchaublitb Oh, I'm a multithreading noob. I'm a noob at many things at once, fully unsynchronized. But I do false sharing.
 
HAHA
bye all
 
@StackedCrooked wut?
@JohannesSchaublitb sleep well
 
thanks, you too ^^
 
chuck norris & bruce lee = gods
 
1:40 AM
@sehe I'm talking about GCC atomic built-ins. I believe most of these are now available in C++11 atomics.
 
@StackedCrooked ah. but 'releasing a barrier' doesn't make sense, AFAICT. You can release a lock (mutex, rwlock, spinlock, semaphore, whatnot) but you can only 'pass' or 'put in' a barrier.
I think what that page talks about is 'a release barrier' as opposed to 'release a barrier'. And it is supposed to be some subtle subclassification of a barrier
 
Ah, hence my misunderstanding.
 
can anyone help on using report viewer
:(
 
@Carisle What? Is that a game? Does it relate to sex?
 
user457812
I kind of want to try that..
 
1:44 AM
nope
@sehe crazy
 
@Carisle But honestly, this is the C++ room. C++ doesn't have a report viewer. So if you don't specify any context, 'report viewer' is utterly meaningless
 
okie dokkie :)
 
so....
what is it?
@JohannesSchaublitb somehow never saw that one. Lol :)
 
user868935
@sehe red errors arent showing anywhere in my code, but from the updated code you posted, when I run it, it still says there are too many arguments.
 
@sehe tries to resist the temptation to spend time understanding that stuff
I've already spent days reading about c++11 relaxed atomics... and I'm not going to be comfortable that I actually do without trying them
unfortunately you need an SMP non-x86 box to actually test any code that uses them properly :/
 
user868935
1:58 AM
is anyone in college here?
 

« first day (484 days earlier)      last day (4465 days later) »