« first day (743 days earlier)      last day (4211 days later) » 

4:03 PM
Ahahahaha
 
user1174868
2 semesters of programming and I still can't figure out sort
 
@Jordan well, you better sort that out :p
 
user1174868
sorting is really abstract and math intense
 
Ell
@Jordan as in sorting an array?
 
user1174868
basically yes, I know how to do it it just took me several days to write the code because I suck
 
Ell
4:15 PM
it doesn't mean you suck. What language are you writing in?
 
Hello all, please check if my program is correct, I am trying to learn binary operator overloading pastebin.com/KmtXWDvi
 
Ell
and what sorting algorithm? quicksort?
 
this is just the same as with local automatic variables. there will be no object at runtime either if you dont call the surrounding function, and there may be multiple objects if you call it recursively. what is the difference of them to nonstatic datamembers? if you want, you can call local automatic variables "function nonstatic datamembers" and then the analogy is obvious. and for the class members you dont even need an object to refer to them at compile time. taking your example, you can say sizeof(Chamber::pot * 3). try that with a local automatic without a function call. — Johannes Schaub - litb 4 mins ago
 
user1174868
C++ and scheme, scheme is for my class but c++ is for my own learning
 
user142019
I designed a logo!
 
user1174868
4:21 PM
I am not sure about a sorting algorithm but I have been trying to do a list, element and sorted list where I make the sorted list the first element of the list, then I keep making the sorted list by adding a lower number from the list to the sorted list, if the number is larger I take away that element from sorted list, make that element from list the element and then make the list the element from sorted list that was smaller and the rest of the old list
 
user1174868
insertion I think
 
is my program for binary operator overloading correct ?
class Sample
{
  int m;
  public:
  	 Sample(int a)
         {
	   m = a;
	 }

         int operator +(sample s)
         {
             return m + s.m;
	 }
};

int main(void)
{
  Sample s1(5),s2(6);
  int result = s1 + s2;
  cout << result << endl;
  return 0;
}
 
user142019
@Failed_Noob edit it, hit ctrl+k and hit return.
 
user142019
You failed, noob.
 
so its not correct ?
 
user142019
4:25 PM
Initialize m using an initialization list rather than using assignment. Prefer a free function operator+ rather than a member function. Don’t use using namespace std. endl is not necessary; '\n' is fine. Your indentation is terrible and inconsistent.
 
user142019
Also, your code doesn’t compile since the type is named Sample, not sample.
 
@Zoidberg'-- << "\n"; over << endl; is just nit picking
 
what do u mean by free function ? are u asking me to define it outside the class ?
int Sample :: operator +(Sample s)
{
m= a;
}
 
user142019
@Failed_Noob Here are a few improvements: gist.github.com/16f343db1f26db2d8f1c
 
user142019
Bracing style is a matter of taste, do what you prefer. But indentation should be consistent.
 
4:29 PM
DAKNOK FOR FUCK SAKE STOP CHANGING YOUR NAME ALL THE TIME
11
 
@thecoshman lol
 
user142019
@thecoshman lol
 
take you own advice, use what ever name you want, but be consistent with it
 
user142019
 
user142019
You may want to ask there. Make sure it compiles, though.
 
4:31 PM
thank you.
 
@Failed_Noob I also trust that you are simply getting to grips with concepts rather then actually doing something as stupid as wrapping an int into your own class
 
user1174868
are programming internships through colleges usually unpaid? Because I think I am too old to work for nothing
 
@Zoidberg'-- does that function not need to be made a friend to be able to access the private variable?
 
user142019
@thecoshman oh yeah of course.
 
@Jordan internships are usually unpaid
@Zoidberg'-- your code is bad and you should feel bad
 
user1174868
4:33 PM
@thecoshman well that sucks, how is that even legal?
 
user142019
@thecoshman hey that’s a Zoidberg meme!
 
user142019
 
Ell
can't you make it a member function?
 
@thecoshman u mean this
class Sample
{
int m;
...

? I am tyring to understand the concept rather than getting the program run correctly (at the moment ) as I have a test soon after 3 hours
 
user142019
 
user142019
4:36 PM
Logo I designed for Zoidlang. xD
 
why does the function need to be friend function , the function already belongs to the class so wont it be able to access the data members of that class ?
 
user142019
@Failed_Noob If it’s a free function it can’t access the class’ private members unless it’s a friend.
 
@Jordan usually and internship is short term thing for the company to see how good you really are
 
user142019
And operators are usually preferred to be free functions since you can overload them, IIRC.
 
@Failed_Noob if your test is in three hours your fucked
 
user142019
4:37 PM
Except operator T and operator=.
 
@thecoshman that encourages me
 
@Zoidberg'-- operator T is that casting?
 
user142019
I don’t know the exact conventions.
 
user142019
@thecoshman yeah.
 
@Zoidberg'-- what are u referring as free functions? I am not sure if I am familiar with that term
 
4:39 PM
@Zoidberg'-- AFAIK the only place you can access a private field is in a function called on the object it self. You can access a variable in another object
 
user142019
Free functions are functions that are not member functions.
 
@Failed_Noob not part of a class
 
user142019
25
A: Operator overloading

sbiThe Decision between Member and Non-member The binary operators = (assignment), [] (array subscription), -> (member access), as well as the n-ary () (function call) operator, must always be implemented as member functions, because the syntax of the language requires them to. Other operators...

 
user142019
> If a binary operator treats both operands equally (it leaves them unchanged), implement this operator as a non-member function.
 
user142019
Which is the case with operator+, so it should be a free function.
 
4:42 PM
C++ is so tough I find C and C# more easy
 
@thecoshman this thing is confusing me still
http://pastebin.com/Bw2SJyp0
I saw some similar things where std::vector in a boost::variant caused something similar, and std::array instead of vector fixed it...but that isn't really the case here
 
@melak47 it's because their is an error in a function that takes a bost::varaint
 
@thecoshman whcih one? and what can be done about it?
 
the variant takes Kyro::Platform::FullScreen or Kyro::Platform::Windowed but because variant is pre C++11 it can't use variable template arguements, so it has a load of void types
the function is very clearly said to be Kyro::Platform::Window::Create
some where the code is trying to call this function but it has not been defined
Kyro::Platform::Window::Create(boost::variant<Kyro::Platform::FullScreen, Kyro::Platform::Windowed, int) this is the function signature in the code
 
"somewhere" would be in main :)
 
4:48 PM
What should be output of the following (ba)sh command? NAME=Test echo $NAME
(And why doesn't it do what I want it to do?)
 
Xeo
Okay, my "vertical lying and the effects on the human body" self-experiment tells me, that I seriously need to get my sleep cycle back in order.
 
We need less sleep than we think.
Yet, tiredness can be so overwhelming.
 
Xeo
No, I mean, I shouldn't be getting up at 5pm.
 
@thecoshman still not sure what's not matching up...
 
I think 5 PM is a fine hour.
It's before sunset as it ought to be.
Allows the brain to enter the programmer's zone as the sun goes down.
 
4:53 PM
I don't know what you're talking about, but 5 PM is one hour late for beer.
 
I prefer to start drinking beer at 4 AM.
 
Xeo
@StackedCrooked But it's already dark outside D:
 
Ah, I forgot about the time change.
 
user142019
Stupid daylight saving time is moronic and stupid and unhealthy for people (especially babies) and only costs a lot of money.
 
I think babies are not much affected.
 
user142019
4:54 PM
And it doesn’t save any power at all, since it’s 2012 where people stay awake 24/7.
 
They can just sleep like lazy fucks.
 
user142019
@StackedCrooked My mother works at kraamzorg and she says it’s bad for babies. :P
 
That's old-people talk :P
 
user142019
As humans evolve, I think people need less and less sleep over the years.
 
user142019
In a thousand years, 3 hours of sleep per day may be enough for everybody.
 
4:57 PM
The world-record holder of not-sleeping-for-a-long-time claims his intention was to prove that not sleeping for a while won't harm the body.
 
user142019
There was a Chinese fool who hadn’t slept for two weeks and then he died. He played WoW continuously and he had a fridge full of food and milk.
 
user142019
He locked himself up in a basement.
 
What happens when several catch handlers match the type of object thrown from a try block ? For example :
int main(void)
{
   int m = 5;

   try
   { throw(m);}
   catch(int)
   { //do something }
   catch(int)
   { //do something }
   return 0;
}
 
> On the eleventh day, when he was asked to subtract seven repeatedly, starting with 100, he stopped at 65. When asked why he had stopped, he replied that he had forgotten what he was doing.
2
 
user142019
4:59 PM
@Failed_Noob the first one will get called, if it compiles at all.
 
okay ^_^
 
@Failed_Noob First one is matched in case of "similar" types (base and derived classes).
 
user1174868
man I suck at programming
 
user1174868
binary trees are hard as shit
 
user142019
Binary trees aren’t that difficult.
 
user142019
5:07 PM
Binary search trees, at least.
 
user1174868
it seems incredibly abstract to me
 
user1174868
there are infinite forms of a tree it seems
 
user1174868
so how could you possibly ever be able to find the height of a tree? There is no uniformity to the trees ever, they can be anything as long as the numbers are in order, I mean I could have 5 be the beginning and the right branch go up to 99999999999955555555444444444999 and to left branch be 1-4
 
user1174868
there is no mathematical way to determine the shape
 
user142019
5:09 PM
@Jordan Data Structures and Algorithms is a good book that teaches these things.
 
user1182183
hih
 
Xeo
@Zoidberg'-- 2 hours of sleep are already enough today! :)
 
user1174868
the starting point can be 5, the right and be 6 , 100, 1000, and the left and be 1 2 3 4. The left has more numbers but the same height
 
user142019
@melak47 lol
 
Xeo
5:10 PM
You just need to portion in 20 minute mini-sleeps
 
user142019
I want a simple logo. Not too much clutter.
 
user1174868
binary trees seem like a stupid idea
 
user1174868
the tree should be split in the middle, the beginning part should be the halfway point
 
user142019
@melak47 I have a black-and-white version in the specification. :P
 
it's full of lorem ipsum!
 
user142019
5:14 PM
I know!
 
user142019
Johannes!
 
user142019
Haven’t seen you here since months!
 
user1174868
there is no structure to binary trees is there? besides the beginning point anything can happen on either side, there are no rules
 
@Jordan well, there is a certain structure to binary trees - only two children per parent :p
 
user142019
5:16 PM
@Jordan What kind of binary tree are you looking for?
 
user1174868
but beyond that anything can happen, there is no rule for finding the height
 
user142019
A binary tree is any tree where non-leaf nodes have two children.
 
user1174868
I am trying to find the height, but it seems like an incredibly complex program where I have to create a list of values that adds 1 to the list value each time you go down the tree and every time you can go left or right you make a recursive call that also makes another list entry and adds down and then once you are at a leaf it makes the list entry and then finds the largest in the list and that is the hieght of that tree
 
user142019
The easiest approach is brute-force.
 
user1174868
I mean there is no simple rule like just going to the left branch the whole way because there could be another node of the left that is longer
 
user142019
5:19 PM
No, you need to check all nodes.
 
user1174868
every node has to be counted all the way to the bottom and then compared with every other possible broute
 
user142019
No.
 
user142019
You can do something like this:
 
fuck
today I ate the most disgusting thing ever
a butternut risotto
 
user142019
height = 0
h = 0
for node in nodes: # a bit more complex; needs recursion for every node
    h += 1
    if node.right is None: # leaf node
        if height < h:
            height = h
 
user1174868
5:21 PM
I am using scheme so I can't do that
 
user1174868
but I think what I said earlier is the same idea
 
user142019
Doesn’t Scheme have a state monad?
 
the principle is the same
 
user1174868
I dont know what monad means but I can't use assignment in scheme yet
 
user142019
Doesn’t Scheme have a way to store state in a function without making the function impure?
 
user142019
5:22 PM
Oh okay.
 
user1174868
I dont know what that means but I dont think I can use that yet
 
user142019
I’ve never used Scheme. I only know it’s a functional language.
 
user1174868
so I think what i have to do is make a list and then find the largest value in that list
 
user1174868
scheme is shit
 
user142019
Then why do you use Scheme?
 
user1174868
5:23 PM
class
 
user142019
Ah. Okay. :P
 
user142019
4
Q: Calculating the depth of a binary tree in LISP recursively

crazybyteI have the following binary tree A / \ B C / \ D E represented as a list in Lisp (A 2 B 0 C 2 D 0 E 0) where the letters are node names and the numbers are the number of child nodes (0 for none, 1 one node, 2 two nodes). I need to find highest from root node to leaf depth of the t...

 
user142019
It’s in Lisp, but it should be similar in Scheme.
 
user1174868
I dont want to look at an answer yet
 
user1174868
I am really bad at programming, want to try and get at least one thing on my own sort of
 
user142019
5:24 PM
Transform the tree into a list first.
 
user142019
           A
          / \
         B   C
        /   / \
       F   D   E
 
user1174868
I dont think that works
 
user142019
Would become (A (B (F)) (C (D) (E))).
 
user1174868
because the way trees works it could be any order
 
user142019
The order doesn’t matter.
 
user1174868
5:25 PM
I already have a function that makes a binary tree a list but there is no order to trees so it doesnt affect the hieght
 
fuck
what do you mean, I can't leave comments with 1 rep?
fail
 
Ell
ill again?
oh
 
user1174868
there is probably some in depth math to determine if a specific set of numbers will create how many trees but I dont know it'
 
user142019
I’m going to learn Clojure.
 
Xeo
@DeadMG Bitch at meta!
 
user1174868
5:28 PM
For example with the tree (3 (1 () ()) (5 () (9 (7 () ()) ())))
 
pff
 
user1174868
the right branch is 5 7 9 but how to I determine the hieght?
 
user1174868
I am incredibly bad at math otherwise I could probably think of a way to determine that but I dont see an easy way
 
give the computer a blowjob
 
user1174868
I only give your dad blowjobs
 
Ell
5:29 PM
...how?
 
obviously by typing in the correct program
by the way, the height of a tree is like, super simple
h(node) = max(h(left), h(right)) + 1
 
user1174868
oh thanks
 
user1174868
it is super simple
 
user1174868
if only I know it was super simple
 
user1174868
I would be able to get it so much easier
 
user1174868
5:32 PM
thanks, that is very helpful
 
greetings
 
Ell
why plus one? because the height of current node?
 
y
 
user1174868
I dont think I can use max like that in scheme
 
what, you mean, "Simple recursive call with two arguments"?
even PROLOG can do it like that
I think
 
user1174868
5:37 PM
(define (largest-in-list? list)
  (define (helper list n)
    (cond
      ((null? list) n)
      ((>= (car list) n) (helper (cdr list) (car list)))
      (else (helper (cdr list) n))))
  (helper list null))
 
why cars and cdrs?
 
user1174868
because it has to be
 
user142019
@Jordan You can indent code by hitting Ctrl+K and it’ll be in a decent font.
 
What does that function have to do with tree height
car is idiotically named head and cdr is tail, so that bit is fine. It'd be better with pattern matching.
 
user1174868
5:44 PM
I am making a list that will find the length of all possible branches in the tree and then that will find the largest number
 
List can't find anything try again
 
user1174868
?
 
user142019
Lists are data. They cannot do things like “finding” something.
 
user1174868
largest-in-list does
 
That's a function Jim
 
user1174868
5:48 PM
the list will be contructed of recursive calls that adds up the heights of different branch possibilites
 
What do you think of the name coliru (short for compile-link-run) for an Ideone clone?
 
It's dumb but so is Ideone.
 
user142019
@StackedCrooked are you going to make one?
 
It's fine, really.
 
user142019
Idetwo
 
5:49 PM
But running this sort of thing is not something I'd do voluntarily.
 
@Zoidberg'-- Yeah, here's a first draft that only does the coli part
 
user142019
@StackedCrooked cool.
 
user142019
What language do you write it in?
 
So, still didn't fix that fork bomb problem, eh.
 
do vector elements need to be movable?
 
5:51 PM
@CatPlusPlus Just went on a trip for two weeks. Now I'm refreshed and ready to tackle the problem :P
@Zoidberg'-- CSS :P (Not a joke actually.) The server is a very simple ruby script.
 
user142019
Ah okay. Cool.
 
user142019
What compiler are you gonna use? Or can the user choose (which would be awesome)?
 
I intend to provide the latest compiler. Probably gonna be configurable.
 
user142019
Also run the program in a virtual machine.
 
Yeah, that's what I'm currently researching.
 
user142019
5:53 PM
I’d have a pool of VMs running and put all the submitted programs in a queue, then dispatching them to a VM that’s not doing anything.
 
I need to prevent fork bombs, internet access, disk access, out-of-memory during compilation, etc...
I'm currently looking at qemu.
@Zoidberg'-- Yeah, I've thought about things like that.
 
user142019
ØMQ could do the actual dispatching. But you need to pick what fits your design best.
 
It's actually a bigger challenge that expected.
 
user142019
@StackedCrooked as with everything. :P
 
I'm currently working on a synchronous (single process, single thread etc) solution. I'll tackle the scaling later, if I ever feel like it :)
 
Ell
5:56 PM
wait, is zoidberg ØMQ?
oops I mean radek
 
user142019
@Ell huh?
 
user142019
ohlol
 
user142019
Yeah.
 
user142019
@StackedCrooked fuck security, just run every program as root.
 
user1174868
I have no idea how to make this program work
 
Ell
5:58 PM
so you're radek?
 
user142019
1 min ago, by Zoidberg'--
Yeah.
 
user1174868
the problem is that it can't distinguish between left and right adding to the height
 
and WTP
 
user142019
lol
 
@Jordan Irrelevant.
 
5:58 PM
@Zoidberg'-- sure..
 
user1174868
it goes left, adds 1, not it can go right or left but my program will add the total of those hieghts to the orignal
 
Ell
why change your name?
 
Can this be considered as a fork bomb ?
coolfunc()
{
   while(1)
   {
     coolfunc();
   }
}
 
user142019
No. That’s infinite recursion, usually resulting in a stack overflow.
 
user142019
A fork bomb is something like this:
 
user142019
6:01 PM
while (true) fork();
 
but thats what I also did , I also called a function
 
user142019
You need to call the fork function, silly.
 
but fork() is special
 
user1174868
man I suck at programming, 5 hours on this program and I have nothing
 
Xeo
@Failed_Noob fork() spawns a new process, thereby eating system resources.
 
user142019
6:02 PM
@Failed_Noob man fork(2)
 
user142019
@Xeo a new process, to be exact.
 
user142019
> fork() creates a new process by duplicating the calling process.
 
ah I understand now ^_^
for each new process , does system allocate some amount of memory ?
 
Which would you take? (For my Ideone clone utility.)
 
user142019
@StackedCrooked GPLv3
 
user1174868
6:05 PM
I just dont get this I guess
 
user1174868
I can do pair?
 
Why would you prefer GPLv3 over "New BSD"?
 
user1174868
and I know that I always want to go with the pair but what do I do when there are two pairs?
 
user142019
@StackedCrooked BSD allows derived works that are not OSS.
 
user142019
IIRC
 
6:06 PM
I want most liberal. I guess BSD is that?
 
user142019
Most liberal? CC0.
 
user1174868
another problem with this is that when I do run into a part where I can go left or right I have no way to split the value and give them both a new value in a list that will keep recursively adding the value of each node down
 
user1174868
somehow each time I hit a node it has to grab the previous value and make a new recursive call for each node
 
user1174868
trees can be constructed in any way so there is no way to "probe" the tree to see which way to go you literally have to check every single part of it
 
user1174868
this is why I don't do homework, I just sit here all day and do nothing
 
user142019
6:15 PM
@StackedCrooked you should support Zoidlang and Wide when they get implemented. :P
 
@Zoidberg'-- Remind me in another 10 years :D
 
user142019
Hehe. :P
 
(If this offends someone then he should direct his anger at proving me wrong.)
 
Ell
what about Daklang?
 
user142019
@Ell renamed.
 
user142019
6:18 PM
 
user142019
2022. :)
 
user142019
If I’m still using iCloud then I’ll be laughing my ass off in 2022. xD
 
@Zoidberg'-- Good job :p
 
What does that meeeaannnn?
 
user142019
> Remind StackedCrooked to make his pastebin support Zoidlang.
 
user142019
6:19 PM
> 28 Oktober 2022
 
@StackedCrooked wewf
 
user142019
 
@StackedCrooked Anything that is not GPL.
 
user142019
I use TeX and Git for reports/documents for school. :P
 
Public domain everything
 
user142019
6:34 PM
Apr 29 at 19:58, by class daknok_t
If I were president, you would be required to release all rights.
 
user142019
Apr 29 at 19:58, by Cat Plus Plus
Communist!
 
Xeo
> Let's do the instructor escape: Determining what this paragraph means is left as an exercise! - Dietmar Kühl
lol'd
 
user142019
I didn’t lol.
 

« first day (743 days earlier)      last day (4211 days later) »