« first day (1051 days earlier)      last day (3897 days later) » 

8:00 PM
@not-rightfold I see you've never built a house.
 
user1804599
I haven't; why would I?
 
user1804599
It's not my profession.
 
Because you would see it's not that fun.
So, no, it would not be "awesome".
 
user1804599
I mean the house would be awesome.
 
user1804599
Not building it.
 
8:01 PM
@not-rightfold that's why it won't be awesome
 
@FredOverflow I hope RandomizedQueue is faster to implement, Deque took me a while, with the tests and all T_T
 
@Borgleader randomized queue. sounds useful
 
user1804599
FIRO
 
@Borgleader What. It was test driven? That's the best!!! Test driven cuts the anxiety by 10x
 
@Borgleader You wrote our own tests? I'm always too lazy for that :)
 
user1804599
I only write unit tests in D and only because D makes it easy to do so.
 
@FredOverflow Deque.java -> 140 lines, DequeTests.java -> 160 lines >.>
 
@not-rightfold how?
 
user1804599
// code
// more code
unittest {
    assert(foo());
}
 
Wait what. Java?! You you .... commie scum!
 
8:05 PM
four dots?
 
user1804599
class Foo {
    private int foo;
    invariant() {
        assert(foo > 1);
    }
}
 
user1804599
Also pre and postconditions.
 
@Borgleader My Deque.java has 133 lines :)
 
@not-rightfold That's nice. And slow. Unless disabled
 
user1804599
@sehe You don't enable it in release mode, silly.
 
8:06 PM
Whyyyyyyyyyyyyyyyyyyyyy are you all torturing yourselves?
 
@FredOverflow I put my } on a new line ;)
 
Me too. Is there a line count utility that ignores blank lines?
 
No clue.
 
user1804599
I don't like the required () after invariant in D.
 
@FredOverflow nl -b
 
8:06 PM
notepad++ can remove blank lines
 
user1804599
I use cloc.
 
No shit. :g/^\s*$/d
@not-rightfold I don't sweat LoC (but yeah, I prefer cloc/loccount after astyle -ajUx)
 
user1804599
Okay.
 
user1804599
Two hours left till I go to sleep.
 
user1804599
What software shall I write in two hours?
 
user1804599
8:07 PM
Make it challenging.
 
@sehe -b needs an argument
@not-rightfold autobiography?
 
Ell
@not-rightfold .swf parser
 
@not-rightfold pick the "Roller Coaster" or "TAN Network" See if you make it pass the performance constraints on first try :/
 
user1804599
8:09 PM
@Ell Two hours, not two decades.
 
@FredOverflow So, supply one :) (seriously I forgot: nl -b t)
 
user1804599
Meh too mathematical.
 
@not-rightfold It's not. It's actually quite fun.
 
@sehe Thanks :) 122 lines
 
My Deque.java is 0 lines (on stdout).
 
8:11 PM
@sehe that's a linux thing isnt it?
 
@Borgleader number lines, yeah. Cygwin has it, FYI
 
Yeah... I'm not installing Cygwin just for that :P
 
Then ... count your damn lines yourself :/
(Maybe write a Java program to do it)
 
@Borgleader How about sort <Deque.java >tmp.java, then all blank lines should be at the beginning of tmp.java :)
@sehe The algorithms course uses Java. Deal with it.
 
@Borgleader Soooo. You install a jdk to write Deques, and you don't install a handful of DLLs (realistically, 1) for nl)
 
8:14 PM
The jdk is a necessary evil.
 
@FredOverflow :) You still haven't told me why you think I like Haskell from my twitter profile
Cygwin is a useful evil
 
user1804599
@sehe It is.
 
Which one are you ogling?
 
user1804599
It's those useless algorithms you'll never ever need in your entire career.
 
Awww, I thought it might've shipped with Mingw, but all i found was nm.exe
 
8:16 PM
@sehe lol I meant @not-rightfold, sorry.
 
@FredOverflow Ah. Clarified
@Borgleader s/nm\.exe/this lousy t-shirt/
 
@sehe Surprisingly cool.
 
@Rapptz Yup. I discovered it because I did an online assessment using it
Aug 28 at 22:47, by sehe
Gah. I just completed my online technical assessment for that job interview. I'm strangely kinda pumped now. That's an odd feeling.
 
That actually does look interesting.
 
not only am I terribly sick
but it seems like night-time has started early.
fuck me.
 
user1804599
8:25 PM
@DeadMG no
 
user1804599
I don't fuck dogs.
 
@sehe I wrote a C++ program that ignores empty lines and lines with only braces:
#include <iostream>
#include <string>

int main()
{
    std::string line;
    std::getline(std::cin, line);
    int n = 0;
    while (std::cin)
    {
        if (line.find_first_not_of(" \t{}") != std::string::npos)
        {
            ++n;
            std::cout << n;
        }
        std::cout << "\t" << line << "\n";
        std::getline(std::cin, line);
    }
}
 
user1804599
Needs to do text processing, picks C++. Well done.
2
 
Fed to itself, it produces the following output:
homer@marge:~$ ./a.out <count.cpp
1   #include <iostream>
2   #include <string>

3   int main()
    {
4       std::string line;
5       std::getline(std::cin, line);
6       int n = 0;
7       while (std::cin)
        {
8           if (line.find_first_not_of(" \t{}") != std::string::npos)
            {
9               ++n;
10              std::cout << n;
            }
11          std::cout << "\t" << line << "\n";
12          std::getline(std::cin, line);
        }
    }
 
user1804599
You can write that program in a quarter of a line in Perl.
 
8:27 PM
I don't know Perl.
 
Isn't there a simple Bash command that can do that?
 
@not-rightfold Terseness is quite often irrelevant.
 
Now my Deque.java only has 70 lines :)
 
@FredOverflow homer@marge :D
 
always good for a laugh :) robot also liked it
 
user1804599
8:29 PM
my $i = 0;
while (<>) {
    unless ($_ =~ /^[\s{}]*$/) {
        ++$i;
        print $i;
    }
    print "\t$_";
}
 
user1804599
Much beautifuler. <3
 
That's a quarter of a line?
 
user1804599
How can you write a quarter of a line of code?
 
...
 
@FredOverflow 76 =/ and I realized I forgot to code resizeDown
 
8:30 PM
I don't know, but I expected that if would end up one line.
I think my line counting tool is the most valuable piece of software ever written for programmers.
 
user1804599
my $i = 0; while (<>) { unless ($_ =~ /^[\s{}]*$/) { ++$i; print $i; } print "\t$_"; }
 
I can also write an unsafe version in C that is prone to buffer overflows, if you like.
@Borgleader Does the autograder test for that?
 
No clue. I assumed it would.
I'll leave it like that for now, implement the rest and see.
 
My longest method is deque. It has 7 lines. But I think I'll leave it at that. The rest is 1-3 lines each.
 
@FredOverflow I'd just count the damn lines:
#include <iostream>
#include <iterator>

int main() {
    size_t total {}, pending {};
    std::istreambuf_iterator<char> in(std::cin), eof;
    while(in!=eof)
        switch(*in++) {
            case '\n':
                total+=pending;
                pending=0;
                break;
            case ' ': case '\t': case '\r':
            case '{': case '}':
                break;
            default:
                pending = 1;
        }
    return total+pending;
}
Returns 17 when run on itself
 
user1804599
8:34 PM
I wonder how short it would be in GolfScript.
 
I bet it would be well suited for Brainfuck. I wager it could be <16 chars
 
size_t total {}? You really jumped on the uniform init trend, didn't you? ;)
 
@FredOverflow I don't like magic numbers (0) lol (I tried to hide the 1, but using ++/-- was too clumsy, involving ternary expressions. I hate those too)
 
@FredOverflow There wasn't much else to be modern about
 
8:37 PM
@sehe Why do you hate ternary expressions? I find them quite nice if they're short and simple
 
@robjb Me too. But not if they hide actual program logic/flow
 
user1804599
?: is nice.
 
Ah alright, I thought you just hated them in general :)
 
Something tells me RandomizedQueue could be really easily implemented as a linked list, but ... linked lists suck butts
 
Strangely, I still want my code to be readable
 
user1804599
8:38 PM
x if c else y is Python's worst syntax.
 
Imo it's elif
 
user1804599
@sehe You must love Go.
 
@not-rightfold close second: lambda
 
@not-rightfold Not yet. Never tied
 
Come on, you really had to ditch two letters to be more concise with an else-if?
 
8:39 PM
Anyways, I'm off
"Busy"
 
user1804599
@KonradRudolph lambda is rather nice.
 
user1804599
@sehe Have fun fapping!
 
@not-rightfold I've been meaning to check out Go for a while
 
@not-rightfold Not really. Tooo much syntactic noise. x => foo please
 
user1804599
@robjb It's a great language.
 
8:40 PM
Right now I'm tacking project euler with Haskell, maybe I'll start alternating problems with Go
 
Xeo
That Mighty No. game looks col and promising
 
user1804599
Go's select statement is nice.
 
Anyone got any experience with hiring on freelancer.com and alike?
 
user1804599
I want to learn another programming language. Any suggestions?
 
@not-rightfold No you don't.
 
user1804599
8:45 PM
Yes I do.
 
Fortran
 
user1804599
Heh. They added a configurable call stack size limit defaulting to 1 GB to Go.
 
user1804599
Damn now I wanna write something in Go.
 
Ell
@not-rightfold scala?
 
You should list the languages you have learned if you want suggestions. Actually, list the ones you haven't that'll be shorter.
 
user1804599
8:55 PM
Haha.
 
Ell
Scala!
Or a language you don't want to know
 
@not-rightfold I can do it in one line of Haskell if all we care about is the total number of lines:
main = getContents >>= \contents -> print (length (filter (any (not . (`elem` " \t{}"))) (lines contents)))
 
user1804599
I don't know Fortran, Scala, Scheme, Boo, Delphi, and Eiffel, and I know a very small fraction of COBOL.
 
@Borgleader A linked list won't meet the complexity requirements.
 
user1804599
@FredOverflow That's not the same thing. :V
 
user1804599
9:01 PM
Hmm.
 
user1804599
Shall I try to implement Paxos in two hours.
 
user1804599
inb4 fail
 
@FredOverflow Damnit... T_T
@not-rightfold Scala
 
Ell
Paxos o.O
I hope that isn't PaxOS
 
user1804599
Paxos is a family of protocols for solving consensus in a network of unreliable processors. Consensus is the process of agreeing on one result among a group of participants. This problem becomes difficult when the participants or their communication medium may experience failures. Consensus protocols are the basis for the state machine approach to distributed computing, as suggested by Leslie Lamport and surveyed by Fred Schneider. The state machine approach is a technique for converting an algorithm into a fault-tolerant, distributed implementation. Ad-hoc techniques may leave importan...
 
user1804599
9:04 PM
Look at the diagrams. Keep away from pistols, cyanide and trains.
 
so I went on linkedin and searched "intern" and the first result was "playboy intern"
 
hm.. deleted
 
> but really this is not very good code.
 
user1804599
9:14 PM
I'm going to write a distributed hash table in Go.
 
user1804599
But first: sleep!
 
Ell
Go for it
 
user1804599
Dat pun.
 
Q: How many lines of code does it take to sleep for a second in Java?
A: eight
try
{
    Thread.sleep(1000);
}
catch (InterruptedException ignore)
{
    // intentionally left empty
}
@Borgleader Well, what else could you use instead of linked lists?
 
user1804599
@FredOverflow Four in Erlang.
 
user1804599
9:19 PM
receive
    after 1000 ->
        ok
end
 
How many languages do you know?
 
@FredOverflow Well I could do something similar to what I did for Deque but with support for inserting at random indices.
 
user1804599
@TonyTheLion "can use for basic stuff" or "know very well"?
 
Ell
@FredOverflow I hate that
 
@FredOverflow You can save three lines by using sane formatting
 
user1804599
9:22 PM
@FredOverflow In our last school project we simple did catch (Exception e) { throw new RuntimeException(e); } everywhere. :)
 
Ell
why not just throw e?
 
user1804599
Because that would require an exception specification if the type of e is not a subtype of RuntimeException. :V
 
Ell
>.<
 
user1804599
Lombok has a compiler patch that disables checked exceptions completely, but I don't know if it works with Android. I don't see why not, though.
 
@Borgleader What did you do for Deque? Didn't you use a doubly linked list?
Why would you need to insert at random indices?
 
9:28 PM
@FredOverflow No I did resizing arrays =/
 
@Borgleader So inserting at the front is O(n) or what?
 
Oh damnit T_T
 
user1804599
Nice deque. Congrats.
 
@Ell Because of checked exceptions, one of Java's few innovations.
 
@FredOverflow Actually it was amortized O(1) because I left space on either side. But I just realized the requirements were O(1) worst case
 
user1804599
9:31 PM
Does anyone ever check the return value close(2)?
 
@Borgleader It's always a good idea to read the requirements before starting to implement ;)
 
I did, I misread the complexity one =/
 
user1804599
Write a fault-tolerant, replicating, distributed deque implementation.
 
At least I have unit tests now >.>
 
Ell
man how do I test networking stuff on one machine?
surely I don't have to resort to virtual machines? >.<
 
9:39 PM
Just send stuff to 127.0.0.1? ;)
 
Ell
That doesn't work does it? o.O
Wait.
Why doesn't it work?
Surely you can send things to your own computer :3
 
Yes you can...
I've done it before.
 
Ell
then I'm doing it wrong:P
address already in use
 
No, of course you can't, you have to setup a complicated mirror network.
 
Ell
Oh man. I'm super nub
 
9:48 PM
I have some old code somewhere that does data transmission between 2 exes on the same machine through network, but it's shamefully bad
 
Ell
I was accidentally running server twice :3
 
fail...
 
Ell
And now I used two different ports
I'm writing really bad code to try and make something super quick
it never works
 
You should answer more FGITW questions
 
Ell
10:06 PM
okay fuck it
I'll rewrite it all tomorrow
 
10:23 PM
@FredOverflow The double-link list implementation is by far simpler T_T
 
So, I decided to buy Bear Cavalry Sejuani.
Expensive, but oh so awesome.
 
How would I convert this to managed c++?
 
@EtiennedeMartel I almost bought the legendary Udyr skin, but then I realized I never played Udyr.
 
@CCInc You mean C++/CLI?
 
Right.
 
10:35 PM
Well, the same works.
If you want it to interop properly with C#, however...
 
Well.. when I just copy paste those structs inside a managed class, I get errors about having things like char wick[4], something like can't mixed managed and unmanaged types
 
Exactly.
You can always declare them as managed structs (value class)
 
2
Q: Can a compilation error be forced if a string argument is not a string literal?

Johann GerellLet's say I have these two overloads: void Log(const wchar_t* message) { // Do something } void Log(const std::wstring& message) { // Do something } Can I then in the first function add some compile-time verifiction that the passed argument is a string literal?

X/Y problem..?
 
    value class Header {
    char wick[4];
    }

still gives the error cannot define 'wick' as a member of managed 'Header': mixed types are not supported
how would I get around that?
 
10:44 PM
@Rapptz sounds like it
 
10:55 PM
huh
I just realized that in my plans for Wide unions, if you accessed two different members of different types at the same time on different threads, even if they were read-only access, you would get a conceptual data race.
maybe.
Out after the bin.
 
Sounds like lolcat: I'm in ur binz, im outta ur binz.
 
@john I do wonder where you get this information/impression about poster's experience levels — sehe 12 secs ago
 
Probably from the fact that he used GDB.
 
Oh lol. "Look mam! I'm so advanced! I know what a debugger is"
 
Ell
Where is that?
 
11:08 PM
Click da linq
 
@sehe I'm not saying that's advanced, but someone new to programming wouldn't know how to use it.
I,m also not saying I agree with his assumption
 
how many times have you guys used a char* to actually point to a character instead of for memory evulz?
 
Ell
I never point to characters
But when I do...
And sorry sehe I forgot I could click that, I'm tired
 
@sehe doesn't exist anymore
what did you do to it ?
@DeadMG how does that happen ?
 
@A.H. Well, I've been trying to piece together how I want unions to work.
I mean, we laugh at ThePhD's behaviour, but let's face it, virtually all of their use cases are for type punning.
and in Wide, I wanted to make that legal.
but on the other side of the coin, I wanted to enable strict aliasing.
 
Ell
11:15 PM
Why?
 
which presents a minor problem.
 
are you going with the same approach as C++ ?
 
Ell
Don't you have a variant type?
 
for example, union x { int a; float b; } main() { var := x(); p := &x.a; p2 := &x.b; }.
@A.H. Not really.
@Ell Almost certainly (and if not, just use boost::variant, I have C++ interop for a reason).
 
and you don't want two different unions , like one for type punning and one that doesn't allow that?
 
11:17 PM
no.
 
Xeo
@DeadMG ADTs!
 
Ell
What are the use cases of unions where a variant wouldn't work?
 
@Ell When people want to type pun the shit out of things.
 
@Borgleader I see no evidence he knows how to use it
 
Ell
Okay it turns out I don't know what type punning is
 
11:20 PM
@Ell It's when you do something like union x { int a; float b; } main() { var := x(); var.a = 5; std.cout << var.b; }.
this is illegal in C++ but I wanted to make it legal in Wide.
 
Ell
Oh right yeah
 
+1 because it works, while compiling in literally 1/10th of the time my boost example takes :/ — sehe 3 secs ago
 
Ell
I wanted to do that in c++, I used it in c# for winapi interop and is very nice I think
like being able to set upper and lower words
Or r,g,b,a components
 
@Ell turn a Student into a float , like magic
 
Ell
Indeed :P
 
11:25 PM
@sehe thanks
 
Type punning is ThePhD's natural mode of operation
 
Ell
What is supposed to happen when you corrupt a type?
By type punning
 
in C++ you get UB.
 
Ell
Eg, set random bits of memory of a complex type
 
complex type is illegal.
 
11:26 PM
You can't. Unless compiler error. You can only corrupt data. Which means you violate the invariants of the type
 
Ell
what would happen in wide? Or is this what you're planning?
 
It would bomb Syria Oh wait. That's almost implemented
 
@Ell What I'm planning is: Complex type is illegal. Primitive type, you get bit-level manipulation.
 
Ell
I think that is a good idea
nobody needs to type pun a complex thing anyway do they?
 
I already have an API function for complex types, because you have to codegen shit differently.
@Ell Should fucking hope not.
 
Ell
11:29 PM
I hope bombing Syria isn't implemented anytime soon
 
@Ell would be weird
 
Ell
we don't want a repeat of irak
 
6 hours ago, by not-rightfold
I want a Gentoo shirt.
 
Ell
well. Its a difficult issue
 
@Ell iraq, peasant
@Ell To be honest
that situation is so fucked up
 
Ell
11:30 PM
Oops. Of course :P
 
I don't really see that bombing them or not bombing them is going to make all that much difference.
 
Aug 29 at 14:21, by sehe
^ the creativity part may solve the bind that the US have gotten themselves into. They have got to do something. But nowhere does it say they have to be predictable (i.e. do something destructive)
 
I think the rebels are slightly better than Assad but not by much
 
This barley wine is hella good.
 
Ell
Yeah. But saying its not our job to help is like saying its not our job to stop jew gassing in ww2. We should stick up for our fellow humans
but it really is a difficult one I think
 
11:31 PM
eh, it's really not the same
 
I haven't answered questions in a long time but all my rep changes are downvotes on my old answers. :s
 
the Jews were unambiguously no more evil than anyone else and the Nazis were unambiguously just genoiciding them
 
@Ell Godwin point there.
Just felt like I should mention it.
Carry on.
 
the issue here is that the rebels appear to be full of Al-Qaeda and generally a bunch of terrorists.
and they can't agree on what they want to happen to Syria after Assad is removed from power; if they get to that point.
the rebels winning the war militarily would be a political disaster.
 
Ell
Yeah :/ would the rebels stop gassing their own citizens though? If they were to gain power
 
11:37 PM
for example we have a class list and we want to create lists of cars and animals... #define concatn(type) class type##list eg: #define Listof(Type) class Type##List \ { \ public: \ Type##List(){} \ private: \ int itsLength; \ }; — ProDev7 13 mins ago
i dont understand why ppl post non-oneliners in comments, its unreadable
 
I thought I understood (it's closed, no answering). However, it's the OP...
@EtiennedeMartel Someone hadda do it
 
By the looks of the comment he's trying to do a bastardized version of templates using macros
i have no clue why you would want that in c++ considering we have templates
 
@Ell That's a pretty low bar to set. And hardly the worst problem they could create
 
Ell
Yeah
I wonder if the whole world will ever get to a state where everyone lives at least a comfortable existence
 
11:53 PM
Not unless we become vulcan or something
 
Ell
Hmm
 

« first day (1051 days earlier)      last day (3897 days later) »