« first day (1067 days earlier)      last day (2935 days later) » 

2:02 PM
0
Q: Generic matrix in Java supporting arbitrary rotations in constant time

coderoddeI have this generic "matrix" holding elements of arbitrary type. It supports any horizontal or vertical rotations (of any step size) in \$\mathcal{O}(1)\$. See what I have: package net.coderodde.util; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Grap...

 
Kaz
Converting to plaintext:
Hopefuly that produces something usable.
Because I tried using the built-in PDF converter and it crashed.
 
Sometimes, it works. Sometimes, it's horrendous.
 
and they overlap
 
Aye.
 
Can I have another answer here? I feel like the existing one doesn't cover everything.
 
2:07 PM
we don't really go writing languages like you guys do
 
:(
that's fine.
 
you might be able to find someone on PPCG to give you a better review
 
Go write some.
 
@CaptainObvious aww yeah I got a clever one for this
 
@Quill that might work...
 
2:08 PM
@EasterlyIrk it looks like fun, but I don't know how ;-;
 
@ConorO'Brien was thinking about writing a guide to writing languages.
 
@EasterlyIrk Turns out, most of the languages which already exist do a mighty fine job of allowing us to write code, so...
 
@Phrancis So you don't ever want a builtin to print ascii art goats????
3
Or have a command to turn '' to 'avocad'?
 
Kaz
Nope. Time for the direct solution: Ask my Boss to phone the publishing company and get them to email over an actually usable version of the data.
 
@EasterlyIrk PHP does that
 
2:10 PM
@Quill Really? How?
 
it was a joke
because PHP
 
^^
not ^^
ಠ_ಠ
 
4 hours ago, by Quill
$foo = 'bar';
$bar = 'foobar';
echo $$foo;    //This outputs foobar
there's some fun PHP for ya
 
Kaz
2:11 PM
Mathematica has a builtin for determining goats. I don't know how to feel about that. — Robert Fraser Feb 10 at 15:21
 
IKR?
 
@Quill What does it do, print the variable name and it's content?
 
yeah
the same thing works with functions
 
        ___
        \_/_         ___..._____....__\|/_
       / /_/__..---""___   ___ .    .  .  """---...___
__..--/ ( (       .  \_/   \_/            \|/    .   .
     /  | |   \|/     \ \  \ \     \|/
\|/ |  <  <  .     .   \ \  \ \   .        .        .
    \   \_ \            \ \ |  \
 .   \    `-.___    _.../__/   |   .   .      \|/  .
     /          `~~~      /   /
    |                   (    /
    |                  /     \   .     .   \|/
   /                          \
 .'                            \  .-"""-.
 
If only all languages had such a function, would make debugging easier.
 
2:13 PM
that seems unnecessary and evil
 
@EasterlyIrk That's not a goat.
 
$foo = 'bar';
$bar = 'foobar';
function bar() {
    echo 'Hello world!';
}
function foobar() {
    echo 'What a wonderful world!';
}
$foo();    //This outputs Hello world!
$$foo();
 
That's a sheep.
 
> that's no goat
 
@Mast ^
Is this a goat?
I WILL SWARM YOU WITH GOATS!!!
 
2:15 PM
oh my
 
0
Q: 3D bin packing algorithm using Java?

Rii933I wrote a 3D bin packing algorithm but I am still not sure if it is correct or not. I did not follow any code or pseudo-code that's why I would like to know if it is an efficient algorithm for the 3D bin packing problem or not. each container has a length, height and breadth each item has a l...

0
Q: Displaying a String array in tabular format

Jaken HermanI have an array of strings called theArray. All strings in theArray are of length 20. I wish to display this array in tabular format to view the clustering of a hashing function. This code works, however, it looks horrible. Is there a better way to create tables? for (int i = 0; i < array...

 
0
A: Generic matrix in Java supporting arbitrary rotations in constant time

PimgdI took a look at the way you handle negative rotations... and you seem to just negate the value, and then pass it to its opposite function. Which is a pretty clever idea. Except that there is one case in which it doesn't work. System.out.println(Integer.MAX_VALUE); System.out.println(-I...

 
@EasterlyIrk No, that's a ram.
 
@EasterlyIrk pls don't do that
 
@EasterlyIrk cough
 
2:16 PM
sowee
 
Did you know that in Java, Integer.MIN_VALUE and -Integer.MIN_VALUE are the same?
 
(probably in various other languages too)
 
well that's why you're not allowed to just -argument to flip it from negative to positive
 
2:17 PM
@Pimgd I don't know many languages which even have such a function, so I wouldn't know.
 
> Created 22 seconds ago
 
@EthanBierlein No, it stays negative.
 
nvm
I read that wrong
 
That is an odd behavior though.
I wonder if it's a bug.
 
2:18 PM
^^
Don't use Java, JAVA, or PHP.
 
it's not a bug, it's because bits
 
Apparently I left this open overnight.
 
but I don't know the full explanation off the top of my head
 
@EBrown this chat?
 
@EasterlyIrk Yeah...lol
 
2:20 PM
Or xkcd?
I had both open overnight.
 
19
A: Java Integers Min_Value negative then compare

assyliasBecause of silent integer overflow: Integer.MIN_VALUE is -2^31 and Integer.MAX_VALUE is 2^31-1, so -Integer.MIN_VALUE is 2^31, which is Integer.MAX_VALUE + 1, which by definition is too large for an integer. So it overflows and becomes Integer.MIN_VALUE... You can also check that: System.out.pr...

 
I had 2 PPCG posts, xkcd garden, this chat and TNB, and 2 posts on CR.
 
@ Kevin Esche oh I did not know that site exists! sorry, I will post my question there. And do you have another website for code reviewing (except the one you posted) ? thank you! — AIR 11 secs ago
 
oh and r/nethack.
 
the answer is actually relevant, the question only kinda-so
 
2:21 PM
@Pimgd Aha, that's why.
 
Back in a bit, gotta go to Taco Bell and get food.
 
IN N OUT FOR LIFE!!
but okay bai
 
We don't have those here.
@EasterlyIrk
 
There's an In-N-Out going up about a mile from my home actually.
 
I pinged you.
 
2:22 PM
It's strange too, because I live in Minnesota.
 
For absolutely no reason.
Do I win?
 
That's about the last place I'd expect one to be going up.
 
@EthanBierlein No kidding.
 
@EBrown yes sorry
 
I live in a tiny town in Ohio, not likely that we'll see one any time soon.
 
2:22 PM
@EBrown no
 
:(
 
In fact, it's going up right on top of an old Shell Gas station, which is even stranger.
 
I don't have either of those in Australia. or Burger King
 
What do you have in Australia?
 
@EBrown 3 more and you get a goat cookie.
 
2:23 PM
@Quill But, you do have kangaroos.
 
@EasterlyIrk No time for that.
 
KANGABURGER!
 
It's Taco Bell time.
 
What I do have is the KangaFlu at the moment
 
2:23 PM
@EBrown YOu can have both anyway, bai.
@Quill Is that like a normal flu?
 
it's an australian flu
 
@Quill Doesn't Australia have a bunch of creatures that constantly try to kill you?
2
 
But is it identical in most respects?
^^
 
that concept applies globally, but hey, sure why not
 
(Which isn't always a bad thing, mind you.)
 
2:24 PM
how isn't that a bad thing
 
giant spiders are always a bad thing
 
@Quill Easy hunting.
I always wanted to visit Australia.
 
@EthanBierlein unless you need lots of spider silk
 
The problem is it's like a 9,000,000 hour flight.
And that's just too far for me.
 
DUDE GO TO TACO BELL!
2
 
2:25 PM
@EBrown China is only 10 hours from here, so Australia will at most be 15 if you take a direct flight.
 
inb4 biologist complaining about how small spiders make strongest spiderwebs
 
Alright, now seriously, out of here. Be back in like an hour+.
 
bai
get gut burger
 
@EBrown 1027 years?
 
2:26 PM
I'll still be in the room, so feel free to ping the snot out of me.
 
Interesting story about fast food chains though:
 
(The noise annoys the other people in my house.)
 
@EBrown
@EBrown does you has cats?
@EBrown will you answer my questions when you comes back?
 
Trademarks aren't global, so ninja-smart people can register brand names in other countries, like Burger King or whatever
 
2:27 PM
then the companies have to pay big bucks to buy the trademark off you when they want to expand
 
Topic is all over the place right now - FYI
 
@Quill so, like patent trolling
 
yeah
 
You guys have such a more on-topic room then us.
 
Kill more zombies.
 
2:36 PM
it's a good thing I'm a programmer and not an electrical engineer - I just wired my functions together in the wrong way (showfooter hides the footer, hidefooter shows the footer)
2
 
Kaz
@EasterlyIrk TS, for irony if nothing else.
 
What's everyone doing?
Cus I'm doing this.
 
eating an avocado and reading chat
avocad = good
avocado = not quite as good as avocad
 
@DanPantry stop screwing around with your food
 
;-)
 
2:43 PM
I just submitted my examination project. :S
And now it's back to Swift I suppose.
 
0
Q: The Boyer-Moore Majority Vote Algorithm

Dhrubojyoti BhattacharjeeI have started learning Java recently and was looking into some easy algorithms. I found the Boyer Moore voting algorithm here Boyer Moore Voting Algorithms I am trying to get better at writing good code for my solutions. Please give me your suggestions. import java.util.Scanner; public class ...

 
wow the websockets connection into chat is weird
 
You are reading this from the se-chat-terminal thing?
ohai @LiquidPenguin
 
@Pimgd I accidentally wired a transistor the wrong way this morning. Luckily those survive it if you don't do anything too stupid.
I felt really stupid.
 
2:47 PM
Like eat them?
 
@EasterlyIrk
Hello. mortal
 
@EasterlyIrk kinda, I was just reading the pure socket events
 
@DanPantry deleting rows :)
 
@Quill Does the oneboxed question look weird, or just in general
 
2:49 PM
it comes through as HTML
which makes it really annoying in a non-browser environment
 
yeah, that does look stupid.
and the delete message prints it all over again.
 
yeah, that was kinda by choice tho
I think I added a config option to turn that off
 
If you want to see what I mean when I say "the websockets data is weird", paste this into your console:
var socket, url;
function connect() {
    $.post('/ws-auth', fkey({roomid: Number(/\d+/.exec(location)[0])})).done(function (data) {
        url = data.url;
        poll();
    });
}
function poll() {
    socket = new WebSocket(url + '?l=' + Date.now());
    socket.onmessage = function (response) { console.log(JSON.parse(response.data)) };
}
connect();
 
that won't do anything on its own surely
@Quill forgot to post connect()...
and yeah that's sorta weird
looks like each key corresponds to r${roomId}
 
2:53 PM
it sends empty events through
 
1
A: Struct implementation of immutable Maybe<T> monad

Nikita BYour code formatting is mind-blowing. It is so unconventional, that it looks chaotic (even though there is probably a system to it). I had a really hard time reviewing it, even though the business logic itself is fairly simple. I think you should use common .Net coding style, if you want to share...

needs ♥
 
it sends an event when a new message is received, so I guess it then goes off and grabs the new message. weird
> Your code formatting is mind-blowing. It is so unconventional, that it looks chaotic
lol
 
my answer actually expands on that one point
but Nikita's answer is awesome (as always)
 
That just reminds me of that comment that someone posted that went along the lines of
 
2:55 PM
I like how it ends with a one-liner implementation that mootinates the whole OP's code
 
"Wow, for every good choice you made you threw in two bad ones!"
 
0
Q: Making a multiplayer game using socketserver. Need help optimizing UDP server

Dysprosium DysprosiumI am making a multiplayer platforming game, and currently there are server performance issues once I have about 7+ clients connected. I was told earlier last week that I should investigate socketserver since previously I had been writing my own server using merely socket. Well, after 6 hours of ...

 
haha that was 200
 
> What a fascinating solution! It seems that for every smart decision you made, you also threw in a poor decision or two.
15
A: Wow that's a big integer! What's its largest prime factor?

200_successWhat a fascinating solution! It seems that for every smart decision you made, you also threw in a poor decision or two. Smart decision: In PrimeFactors(), you start testing divisors from small to large, rather than large to small. Poor decision: You used if (IsFactor(number,divisor) … rather t...

 
2:56 PM
^
 
I wish there were more "fun" reviews like that sometimes
 
> the whitespace you had was like a gigantic flashing neon arrow sign saying "LOOK!! THIS IS A NEGATION!!" ...I mean, come on.
I try :)
 
@DanPantry most of the "fun" ones sound a lot like insults
 
@Quill Yeah, it's a balance that has to be struck
 
I'm not passive aggressive, unlike some people
/s
 
@EasterlyIrk I like how you felt you had written ^ too many times in a row so this time you wrote two in the same message
 
^^
 
Kaz
@DanPantry I think @Mat'sMug used that in the first review I got on CR. Might've been @RubberDuck instead.
 

« first day (1067 days earlier)      last day (2935 days later) »