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

11:00 PM
Also, I didn't say to replace "Photoshop" or whatnot. I mentioned MSPaint for a reason.
@sehe Exactly.
 
@TonyTheLion Have you watched Scott Meyers talk on move semantics?
 
I'm talking about art here.
 
((c=getchar()) !=EOF) && ((c != '\n') , I also tried ((c=getchar()) !=EOF) && ((c=getchar()) != '\n') but it does not work
 
@RMartinhoFernandes Krita does come to mind
 
what prohibits me from learning it, is in what godforsaken situation or shit hole I would ever need it.
 
11:01 PM
@LearningC What does "not work" mean?
 
@FredOverflow yep
 
@LearningC The second one is wrong because it causes getchar() to be called twice, skipping every other character.
 
long time ago
 
@sehe Ok, I'll try that.
 
@LearningC what's the error message on the first one?
 
11:01 PM
@Potatoswatt yea it only recorded half the sentence
 
@TonyTheLion I think Scott's motivation for move semantics is excellent.
 
@LearningC the first one looks fine
 
@FredOverflow right, perhaps I should watch that video again someday, after I've played around with it a bit
 
So save it as a variable such as
int main(void){
int number;
ilist i;
ilist x = iempty();
while (1 == scanf("%d",&number)) {
ilist y = icons(1,x);
i = y;
}
return 0;
}
 
@Mooing it complied. I also tried ((c=getchar()) !=EOF) && ((c=getchar()) != '\n') but only half of it was printed.
 
11:03 PM
@LearningC yeah, because that gets the next character=getchar twice before doing anything with it
 
@RMartinhoFernandes oh and if it is for redeye, contrast and that stuff, Shotwell and Picasa for linux seem to be good fits
 
No, it's for art.
 
@renatofernandes You are repeatedly consing the same element 1 to the same empty list. That doesn't sound terribly useful. How about x = icons(number, x); instead?
 
@MooingDuck Thanks for the help
 
Oh, wait, I found exactly I needed: kolourpaint.
 
Xeo
11:05 PM
@RMartinhoFernandes It's for free-hand circles. Admit it.
 
@Xeo and POP in stars
 
@Xeo :)
Mwhahaha.
 
Xeo
@RMartinhoFernandes And that's a model for which arcane C++ feature this time? Move semantics? :P
 
going back to kindergarten?
 
97
A: Why is it a memory leak? What could I catch if I shall use such things in C++?

R. Martinho FernandesWhat is happening When you write T t; you're creating an object of type T with automatic storage duration. It will get cleaned up automatically when it goes out of scope. When you write new T() you're creating an object of type T with dynamic storage duration. It won't get cleaned up automatica...

 
11:06 PM
so int main(void){
int number;
ilist x = iempty();
while (1 == scanf("%d",&number)) {
x = icons(number, x);
}
return 0;
}
 
@Xeo Ah, no, that's just a screenshot from the Internets.
 
@Xeo No, that's the logo from Boost.YourCreativity ;)
 
where would i add tht second loop to remember the rest of the list?
 
@renatofernandes is that C++?
 
11:07 PM
@renatofernandes Excellent, now you got the first part down. You stored the input in a list. Now you need another loop to print it back out.
 
Xeo
@renatofernandes: Please make it easier on us by reading the newbie hints on the right and formatting your code
 
@Xeo so how do you bend your mind around all the template stuff, which you seem to play around with like I used to play with my Lego's?
 
@renatofernandes read your code. Imagine the input is A followed by a EOL. Where does the code go?
 
@renatofernandes Directly after the first loop. Before the return 0;.
 
that is c? I guess I haven't learn ilist x = iempty(); yet
 
11:08 PM
@Xeo sorry
 
@LearningC he's using a custom API, ilist is not a standard type
 
@LearningC ilist is a type provided by his school.
 
Xeo
(Yes, good ol' STL)
 
Grab your mind. Grab the templates. Apply strength on your mind so that it encircles the templates. Done.
 
Oh what school?
 
11:08 PM
@RMartinhoFernandes what kind? sketch? impressionist? For line drawings look at Inkscape, Skencil or Xara
 
Xeo
@TonyTheLion Uhm... good question? :)
@MooingDuck I feel like the robot should make a real cartoon out of those stripes.
 
Hey, I'm three boats away from a gold badge!
 
@RMartinhoFernandes oh I love it :)
 
Xeo
For?
 
For that answer. It's at 97.
 
11:11 PM
I did bend my mind around SFINAE, which is not a bad start
 
Xeo
Ah
I want a 100 score answer too. :(
I think my best bet is the 1..1000 sum question
 
That will my fourth :P
 
@TonyTheLion oh, ahead of me there. I sort of have a high level concept, but haven't successfully written one without Xeo correcting it 3+ times
 
oh wow
does anybody have this problem too, when they are writing code, that your mind suddenly kind of "locks up" and you can't think anymore?
 
Xeo
@RMartinhoFernandes :'(
 
11:13 PM
I have that a lot, when I'm trying to figure something out, and then I kind of have to restart my train of thought when it happens
 
@TonyTheLion go home
 
meh, very annoying
@MooingDuck I AM HOME
 
@TonyTheLion GO TO SLEEP
 
Did you by any chance, open a TVTropes page?
3
That happens to me sometimes.
 
int main()
{
    std::vector<int> vec;
    std::copy(std::istream_iterator<int>(std::cin), std::istream_iterator<int>{}, std::back_inserter(vec));
    std::copy(vec.rbegin(), vec.rend(), std::ostream_iterator<int>(std::cout, "\n"));
}
Can this be shortened?
 
Xeo
11:15 PM
@FredOverflow What the duck says (damn you, slow connection!)
 
@FredOverflow yes, construct the vector with iterstors
 
@RMartinhoFernandes lol, Reddit does it for me. Once on Reddit, I'm lost
 
Can I use C to program a checkers game?
 
Xeo
You can use C to programm operating systems.
 
int main(void){
    int number;
    ilist x = iempty();
    while (1 == scanf("%d",&number)) {
       x = icons(number, x);
    }
    while (EOF != scanf("%d",&x)){
    printf("%d\n",x);
    }
    return 0;
}
?
 
11:16 PM
@LearningC C can do pretty much anything
 
int main()
{
    std::vector<int> vec(std::istream_iterator<int>(std::cin), std::istream_iterator<int>());
    std::copy(vec.rbegin(), vec.rend(), std::ostream_iterator<int>(std::cout, "\n"));
}
 
wow
 
you can use C to write drivers
 
Xeo
@FredOverflow Needs parens
 
11:16 PM
So if I make my own os right now, I'll be rich like bill gates?
 
@renatofernandes the second loop is in the right place, but scanf won't work on lists
 
@renatofernandes The second loop shouldn't depend on scanf. You're already done with input at that point.
 
@LearningC euh, yea if you ever get that far
 
@LearningC no. Keep in mind that Bill Gates never programmed an OS.
 
writing an OS is no small task
and not generally accomplished by one individual
 
11:17 PM
@Xeo Because of MVP? I thought so, too, but g++ doesn't complain.
 
@LearningC I think a rocket to space might be easier than an OS
 
lol
 
Xeo
@FredOverflow Clang does, "parameter can not be qualified"
 
@Xeo There's a {} in there that should help no?
Oh, wait there isn't.
 
Xeo
@RMartinhoFernandes It was in the first code
 
11:18 PM
@RMartinhoFernandes I got rid of that in the second version to make it C++98 compliant :)
 
but dont i wannt do something with control-d ? so i can the input
 
Where do I put the extra parens?
 
@renatofernandes nope. Code should not reach the seocnd loop until after it read in the ctrl+d
 
around the empty constructor call?
 
@FredOverflow Arounds one iterator.
 
11:19 PM
it's called the most vexing parse, iirc
 
Xeo
But @FredO, know what's worse than that one extra std::copy line? The 4 #includes you need before that.
3
 
@renatofernandes All that's left at that point is to display the results
 
@Xeo +1
 
int main()
{
    std::vector<int> vec(std::istream_iterator<int>(std::cin), (std::istream_iterator<int>()));
    std::copy(vec.rbegin(), vec.rend(), std::ostream_iterator<int>(std::cout, "\n"));
}
better?
 
Alternatively use std::istream_iterator<int> {} so that it's unambiguously not a function type.
 
11:20 PM
Missing import std; at the start. Oh wait, not yet.
1 min ago, by FredOverflow
@RMartinhoFernandes I got rid of that in the second version to make it C++98 compliant :)
 
@Xeo What's wrong with 4 includes?
 
Xeo
@FredOverflow It's just so tedious. For those two lines of code..
I mean, modularity all right, but..
 
@RMartinhoFernandes I'm not editing until the original question is edited to remove those {}, too!
 
@Xeo Well, how about #include <everything>? Just kidding ;)
 
Xeo
11:21 PM
@RMartinhoFernandes That'd be so awesome. And it wouldn't incur any overhead if properly implemented (aka, only load stuff queried in the symbol table).
 
@Xeo precompile it?
 
Xeo
5
A: C++1y Modules and the C++ ABI

Nicol BolasPre-compiled headers (PCH) are special files that certain compilers can generate for a .cpp file. What they are is exactly that: pre-compiled source code. They are source code that has been fed through the compiler and built into a compiler-dependent format. PCHs are commonly used to speed up co...

(Yes, the question title is misleading)
 
Damn, was about to post that.
 
alrite imma brb hopefully you guys will still be here in 45 mins or so ? :D
 
@RMartinhoFernandes I was looking for it too :/
 
11:22 PM
Nicol is a game programmer, but he is not that kind of game programmer.
 
@renatofernandes maybe not us, but someone will be
 
Xeo
@RMartinhoFernandes The browser history is like a cache for the SO search for me. :)
 
@renatofernandes Here's some pseudo code for the second loop to print the results:
while the list is not empty
    display the first element of the list
    remove the first element from the list
 
Why would Boost.Range provide an istream_range helper for std::basic_istream but no ostream_range.
 
@Xeo Well, that is on the cache of my Windows browser.
:(
 
11:23 PM
@LucDanton same reason there's no apple
 
@LucDanton irange --- integer range?
 
Xeo
@LucDanton Because irange is for integers :P
 
fail
The joke is nice though.
 
close, but no banana
 
For future reference how do I type a code in chat?
 
11:24 PM
a code? send them to pastebin
 
@LearningC with 4 leading spaces
 
Guys, it's not a joke.
 
Xeo
@FredOverflow And here's some C++ code: while(!list.empty()){ std::cout << list.first(); list.pop_front(); }
 
@LearningC There's a "fixed font" button right of the input box.
 
what is leading spaces
 
11:24 PM
@Xeo He's not interested in C++.
 
test
 
Xeo
@FredOverflow I know, that's why I posted it. :)
 
@LearningC Spaces at the front of the actual text.
 
after this word is code: test
 
@Xeo Okay, now you do a monadic Haskell version!
 
Xeo
11:25 PM
@LearningC Read the newbie hints on the right.
 
@LearningC It only works at the beginning of a line.
 
Xeo
@FredOverflow Uhm...
 
Xeo
Hey, I don't know Haskell, alright?! :(
 
@LearningC for arbitrary code in the middle use backticks (the ~ key without shift)
 
11:26 PM
mapM_ print list
 
@RMartinhoFernandes is that reversing?
 
Xeo
Wow. After 6 month, one of my answers was accepted. oô
 
@sehe No, but neither was Xeo's code.
 
testing code: int c[BUFSIZ];
ohh I got it
 
@Xeo Probably someone who was reminded of a low accept rate and went back to look through old answers.
 
Xeo
11:27 PM
@MooingDuck That's + for me. :P
 
@RMartinhoFernandes i was confusing with Fred's snippet :)
 
printList :: Show t => [t] -> IO ()
printList [] = return ()
printList (x:xs) = print x >> printList xs
@RMartinhoFernandes How is that for a start? :)
 
Eww. Use mapM_ dude.
 
Xeo
@FredOverflow Wait, >>?
 
I'm a monadic noob, gotta finish the explicit recursion level first ;)
 
11:28 PM
@Xeo It's called "sequence".
 
testing bold Bold word
 
Xeo
@LearningC We have a sandbox room for that
 
@LearningC I'm sure there is a sandbox room. Start your own or take it to the php room :)
 
Xeo
@RMartinhoFernandes Talk about overloaded meanings...
 

Sandbox

Where you can play with regular chat features (except flagging...
 
11:29 PM
@Xeo >> always means sequence in Haskell. It never means bit shift :)
 
Xeo
That reminds me
@FredOverflow I never said pure Haskell. :P
 
@Xeo It reminds me of C++ concepts
 
Xeo
Anyways, I have a quest in the meta jungle!
 
@RMartinhoFernandes What is the significance of the trailing underscore in mapM_? From the types, it seems it's throwing away the result, only being interested in the effect?
 
11:31 PM
@FredOverflow Yes, that's it. mapM would produce a list of the results (in this case, would be a [()], which is a tad silly).
 
@RMartinhoFernandes It's a single boob in a box! @TonyTheLion, would you like on of these for Christmas?
 
Sigh.
It's nipleless.
 
dang
I was getting over-excited.
So, what could one possibly do with a list of voids?
 
Well [(.)] is also valid Haskell.
 
Xeo
@RMartinhoFernandes Is [(.)(.)] too?
 
11:34 PM
@Xeo Yes.
[(.)(.)] :: [(a -> b -> c) -> a -> (a1 -> b) -> a1 -> c]
 
If I had a .in file with this in it `0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
2 0 2 0 2 0 2 0
0 2 0 2 0 2 0 2
2 0 2 0 2 0 2 0` Will scan`fscanf()` it into a 8x8 array?
 
Read %d 64 times.
 
Depends on how you use scanf. Show us the code.
Damnit, half past midnight already? Gotta hit the hay.
 
I didn't write any code yet. I'm brain storming
 
@LearningC then yes, fscanf can theoretically do that
 
11:38 PM
@MooingDuck So it will indent to array[0][1]?
 
@LearningC say what? indent?
 
Damn, you removed it before I pointed out the mistakes.
 
@RMartinhoFernandes I remembered he was doing homework :/ Also I'm pretty sure I was relying on UB
 
yea if it went to the next row will it auto go to array[0][1]
 
@LearningC if you do it right, then yes. You'll want fscanf in two double for loops
 
11:39 PM
@MooingDuck Nah, it wouldn't compile.
 
ok don't tell me answer. I'm going to try it
 
@RMartinhoFernandes oh probably that too. Anything I post on SO won't compile unless I say otherwise
 
You forgot scanf takes things by pointer.
 
@RMartinhoFernandes that would compile wouldn't it?
 
Oh, yeah... Damn.
 
11:41 PM
C can read .in files right?
 
? .in files?
 
You can read text files in C. Does that answer your question?
 
C is a language. languages are used to create programs. Programs often read files. Files have names. Some names en in the letters .in. So, yes?
 
well my professor gave me a hw1.3.in file
 
Extensions are not magical.
 
11:43 PM
Languages don't support file formats. Libraries do. And special purpose applications (like, e.g. Matlab instead of C)
 
@RMartinhoFernandes extensions are mostly just misleading :/
 
0
Q: how to add my executable to /usr/local/bin

Ahmet TanakolI created my own process and I want to add it into this directory /usr/local/bin. Actually I don't know the commands for this. Could you help me?

 
I'm also how can you have a period before the extension?
 
fresh from the waoh dept
 
.jar is a great example.
 
11:44 PM
@MooingDuck that includes hair extensions and gnu compiler extensions
 
@awoodland waoh...
 
.jar conveys semantics.
 
@LearningC Has anyone really been far even as decided to use even go want to do look more like?
 
@MooingDuck Why is it misleading?
 
@RMartinhoFernandes because they're only loosely associated with the data and how they'll be opened.
 
11:46 PM
@MooingDuck huh? I don't understand the question
 
@LearningC I didn't understand yours either
 
@MooingDuck ROTFL
 
@sehe You’ve got to be kidding me. I’ve been further even more decided to use even go need to do look more as anyone can. Can you really be far even as decided half as much to use go wish for that? My guess is that when one really been far even as decided once to use even go want, it is then that he has really been far even as decided to use even go want to do look more like. It’s just common sense.
 
@LearningC Wait, what? A .jar contains a bunch of zipped .class files (and MANIFESTs and shit). It's only misleading if you use it for something else.
 
@RMartinhoFernandes I find the loose connections misleading. I guess jar wasn't a stellar example
 
11:49 PM
meh
 
What loose connections?
 
mooh
 
I just learned I have a friend, who has a family member whom Bjarne mentions in a forum as one of the people he considers most important in C++'s history
not bad
 
@CatPlusPlus the more confusion you all express the more I wonder if I have any idea what I'm talking about
 
I hope you're not trying to say Java should have invented a compression scheme just for their archives.
 
11:50 PM
Right.
 
@RMartinhoFernandes just to make it portable!
 
@TonyTheLion So, what's your Bjarne number then?
 
@RMartinhoFernandes no, that wasn't my intent
@RMartinhoFernandes 4i
 
@MooingDuck 4i imaginary?
 
Xeo
I do have to admit though, that jar is quite a good choice. "Java archive" and a "jar" where you put stuff into.
 
11:51 PM
@sehe yeah
 
@RMartinhoFernandes I don't have Bjarne's number. I just have a friend who has family whom helped in some of C++s development back in the day
 
lol
fail
@Xeo Usually IDEs use jars with beans inside as the icon.
 
Number or it didn't happen!
 
@TonyTheLion I was referring to this:
 
Xeo
11:52 PM
A 2-line feature request on meta feels kinda lame. Any idea what I could pad the question with?
 
The Erdős number () describes the "collaborative distance" between a person and mathematician Paul Erdős, as measured by authorship of mathematical papers. The same principle has been proposed for other eminent persons in other fields. Overview The idea of the Erdős number was created by friends as a humorous tribute to the enormous output of Erdős, one of the most prolific modern writers of mathematical papers, and has become well known in scientific circles as a tongue-in-cheek measurement of mathematical prominence. Paul Erdős was an influential and itinerant mathematician, who spen...
@Xeo Ponies.
 
oh lol
 
Worked for me.
I guess it would be Stroustrup number instead, since both Erdős numbers and Bacon numbers seem to use the last name.
 
Turns out professor did half the work and want us to finish it. And this is what he used to read all the numbers from the `.in` file and stored it to a 8 by 8 arrayinFile int i, j;
FILE *inFile;

inFile = fopen("hw1.3.in", "r");
for (i = 0; i < BOARD_SIZE; i++) {
for (j = 0; j < BOARD_SIZE; j++) {
fscanf(inFile, "%d", &the_board[i][j]);
}
}
 
@Xeo <!------- works for me ----------->
 
Xeo
11:54 PM
@sehe Visible padding. :P
 
@Xeo Ponies, obviously. Or embed an image. Better yet embed ten 1pixel transparent images
 
@LearningC Just like we told you, read %d 64 times.
 
Yes
 
Xeo
Hm... I think I'll add an ASCII pony (or unicorn). Anyone got one handy?
 
@Xeo I usually pad with gratuitous expletive (in the linguistic sense) adjectives, like "awesome".
 
11:55 PM
I was not aware that fscanf could do that.
 
@LearningC I wasn't aware that you could usefully state unawareness of things yet to be learnt.
 
8
Q: Inline editing silently overwrites other people's changes

R. Martinho FernandesWhen you are editing in the dedicate edit page adding some awesomeness to a post and hit the "Save changes" button, you are warned if your edit will be writing over other awesome edit that happened while you were editing the post yourself. That lets you see what other people changed and merge the...

Like this.
 
@sehe that a good point and funny
 
Xeo
       .,,.
     ,;;*;;;;,
    .-'``;-');;.
   /'  .-.  /*;;
 .'    \d    \;;               .;;;,
/ o      `    \;    ,__.     ,;*;;;*;,
\__, _.__,'   \_.-') __)--.;;;;;*;;;;,
 `""`;;;\       /-')_) __)  `\' ';;;;;;
    ;*;;;        -') `)_)  |\ |  ;;;;*;
    ;;;;|        `---`    O | | ;;*;;;
    *;*;\|                 O  / ;;;;;*
   ;;;;;/|    .-------\      / ;*;;;;;
  ;;;*;/ \    |        '.   (`. ;;;*;;;
  ;;;;;'. ;   |          )   \ | ;;;;;;
  ,;*;;;;\/   |.        /   /` | ';;;*;
   ;;;;;;/    |/       /   /__/   ';;;
lol'd
 
@LearningC besides, stackoverflow.com seems to be a nice site to go with questions like that
1
A: Read File Element wise

sehefscanf to the rescue: #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> int main() { FILE* file = fopen("input.txt", "r"); if (!file) perror("Can't open input"); int matrix[4][4] = { { 0, 0, 0, 0, }, { 0, 0...

 

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