« first day (297 days earlier)      last day (3706 days later) » 

3:01 PM
@Mat'sMug sure thing, I don't know enough to criticize code, but I'm planning on posting some questions soon
Can I ask questions about system architecture? Like how to organize modules, using design patterns and stuff?
 
3:16 PM
High-level stuff is more likely to be on-topic for Programmers.SE, but browse around the tag to see what kind of reviews we do
Here's a recent example of a high-level review that's on-topic:
3
Q: Call to external web service

SamThe architecture is showing a call to an external Web Service which is called by me. Then I will expose the data using WCF to be callable from another WCF client. But I really don't like how it's done. Interfaces, contracts, implementation in the BLO and implementations on the DAL. 7 time copy &...

 
@Jamal, sorry about the rejection .... seriously? Not a good fit on programmers?
 
Dear chatters, what do you think of this : codereview.stackexchange.com/questions/42321/…
hint : I dont like it, this is really more did I configure this right than did I code this right
 
it is Javascript... what do you expect me to think of it?
 
I protected the question this answer belongs to ▼▼▼▼
-7
A: Improving/shortening password checker

jimbobbulllllshitt!! it doesn't workkk ffss comeon!!!

 
^^ I cast the final delete vote :)
hehe
 
3:30 PM
why can't I vote to delete answers? I think I can vote to delete questions.
 
@Malachi You have to be 4K
 
if someone's raging that hard, he shouldn't be a programmer :P
3
 
@syb0rg well shoot. I better answer some questions then, none of those answers where everyone tells me i did it wrong either
@skiwi agreed
 
I wonder if I can revive this user:
 
hmm "About me" says "This account is no longer in use."
2
 
3:32 PM
@Mat'sMug beat me to it
 
@skiwi - that's not someone raging hard, that's someone being a PITA, and getting flagged offensive, and all sorts of other things.
 
well yeah it'sjust plainly bad
 
A troll, looking for entertainment.
 
@Mat'sMug Well there goes my chances of my answer being accepted...
 
ok someone take away my star privileges so I can get back to work....
3
 
3:33 PM
that could also be the case ye
projecteuler.net/problem=12 , running time of 2164s is suboptimal I guess
 
@DavidMcDavidson As long as your question contains working, actual code that you have implemented, it's on topic here. But if you haven't started/finished your code, then you'd probably should ask on Programmers.
 
0
Q: Improving and short code for select validation jquery

Digital LegendIs there any way to make that code shorter, but i want to still use jquery. I dont want to use any validation script $("#form").submit(function (e) { var tmp = $('#select-1').val(); var tmp1 = $('#select-2').val(); var tmp2 = $('#select-3').val(); var error = $('#error-1'); var e...

 
@syb0rg got my vote
 
@Malachi Good call, that's exactly when a question should be protected.
 
@Malachi Thanks.
 
3:35 PM
what's this starring system??
 
questions on Password Generators will most likely attract bad answers from people not knowing our system of awesomeness
well I only need 441 more rep to the next Milestone
anyway back to work
@skiwi it's to mark the really good comments in Chat, some of us use them more like a like button on facebook though
 
some of us?? lol
4
 
ah okay
 
@skiwi when you star something it becomes a bookmark of sorts
@Mat'sMug LOL
 
0
Q: PHP: Singleton design pattern

DanielTheRocketManI am a beginning in PHP-OOP and design patterns. I have got this basic piece of code in Singleton Pattern and I changed it in order to understand its behavior. I can see that it works as expected. However, it is not clear for me exactly how it works. Can anyone explain me? So it is working! My do...

 
3:40 PM
^^ missing anti- in front of "pattern"
 
@konijn Didn't know what to say exactly about that JavaScript question so I commented this:
Does it work as you expected? If it does, you have probably done it correctly :) — Simon André Forsberg 27 secs ago
 
Is there a way to calculate the number of divisors from a prime factorization of a number?
 
@skiwi Well, if you have the prime factorization you're kinda already done calculating the number of divisors...
 
I'm reading more up on it, but prime facotrization only has prime divisors
 
@skiwi you want a Factor Tree
 
3:47 PM
:)
 
@SimonAndréForsberg Yeah, I mean reviewing 1 line of code really seems completely silly
 
@konijn That greatly depends on the line. For example, I didn't think that the recent C++ sleep vs. horribly long for-loop question was off-topic, but some others did.
 
@Malachi, awesome answer, good for stats and worth a laugh ;)
 
yeah my code I made is completely working and awesome :P
private long divisorCount(final long number) {
    return primeFactors(number).stream()
            .collect(Collectors.groupingBy(i -> i, Collectors.counting()))  //Map<Long, Long>
            .entrySet().stream()
            .mapToLong(Map.Entry::getValue)
            .map(i -> i + 1)
            .reduce((x, y) -> x * y)
            .orElse(0);
}

private List<Long> primeFactors(final long number) { ... }
it's quite insane
 
@skiwi what language do you code?
 
3:55 PM
Java8
which is in 1 month just Java
 
@skiwi cool
 
I am soooooooooo looking forward to that
 
I am going to learn kTurtle, I think that is the name of it.
 
It's almost LINQ! <3
 
then going to teach my daughter kTurtle
then going to learn Ruby with her I think
two applications came with Edubuntu for learning programming.
 
3:56 PM
the code goes from:
List<Long> to Stream<Long> to Map<Long, Long> to Set<Map.Entry<Long, Long>> to Stream<Map.Entry<Long, Long>> to LongStream to OptionalLong to long
being able to teach programming is a great gift
 
time to go home
 
@skiwi my cousin Teaches Ruby online as well, does the pair programming and stuff, I think it will be lots of fun
@SimonAndréForsberg you are so lucky....
@SimonAndréForsberg have a good one
 
No, I am so in another time zone :)
 
alright back to work with me
 
I need to my thoughts off the idea of trying to solve all Project Euler problems in OpenCL
2
 
4:05 PM
@Mat'sMug I'm trying to work on a chat bot that will find new answers and post them to the CR answers feed.
 
@syb0rg Awesome! Make sure you post it for review!!
 
@Mat'sMug It's going to be a while, I'm looking at other chat bots and trying to understand how they work.
And none of them are written in languages I know very well.
 
the only chatbots I've ever written were IRC ones
 
Unfortunately, it's somewhat borked.
 
looks quite nice
 
4:16 PM
And I can't fully read Python either
 
ah, that's not the one you wrote? or is it
 
No. It's not mine
 
okay, maybe try some programming in python first?
 
@skiwi Lol, yeah.
I can pick up on some stuff.
But porting it over to C might take a while.
 
lol. Imagine over to C#
2-days old zombie down!
0
A: Winforms Enhanced ListView Class

Mat's MugRandom observations... Why is the ListViewColumnSorter class partial? Compare I think the code could get clearer here. First thing I'd address, I'd declare a int result; and return only once. Then the declarations and casting: ListViewItem listviewX, listviewY; // Cast the objects to be comp...

 
4:25 PM
damn, I "solved" euler problem 14, only to figure out my algorithm forgot to remember the answer
 
@skiwi Use arrays.
 
And I put a 100pts bounty on a C# question that's been nagging me for a while
 
4:39 PM
huh, the profiler cannot track where I spend the time in my code
really strange
 
1
Q: Cash Register Kata

user341493The Setup This kata is a spin on the old backpack problem. Please give feedback on both the kata itself as well as my solution. I'm not sure if the kata needs to lead the student more or if this is a good open-ended problem. My original intent with this kata was to practice using Hashes. This is...

 
then some method would need to be running infinitely?
 
4:52 PM
1
Q: WHERE NOT IN SQL Performance

TimSELECT TOP 1 l.ID FROM Leads l WHERE l.ID NOT IN (SELECT LeadID FROM LeadFollowups) AND l.ID NOT IN (SELECT LeadID FROM LeadsWorking) AND l.ID NOT IN (SELECT LeadID FROM LeadsDead) AND l.ID NOT IN (SELECT LeadID FROM LeadHolds) AND l.ID >= (RAND() * (SELECT MAX(ID) FRO...

 
5:06 PM
a very open question, but does anyone know how this method works? download.java.net/jdk8/docs/api/java/util/stream/…
 
0
Q: RESTful client with Java using Apache HttpClient

Oleg TikhonovI would like to implement an independent class to communicate with a RESTful resource, using Java. The parsing of the InputStream into JSON will occur outside of this class by a different entity. Does this code make sense? package task; import java.io.IOException; import java.io.InputStream; ...

 
^^ Jamalized ...by me! :)
does Java have an is keyword?
 
@Mat'sMug that would be far to short a keyword for Java
 
haha
 
kind of @Mat'sMug
 
5:14 PM
InputStream is = null;
 
if you want to check if something if a Car is a Ford
 
@Mat'sMug is is short for InputStream ... almost as common a name for an input stream as i is for a loop variable.
 
if (car instanceof Ford) { ... }
 
@rolfl ok then.
@skiwi yeah in C# I'd do if (car is Ford) { car.Sell(); }
3
 
okay, then it's just a different word
 
5:20 PM
in C# var is = new Something(); isn't legal.
they force you to give it a meaningful name ;)
..sort of
 
@StackExchange offtopic
 
Thanks santa
 
:)
 
And I'm home
Now it's reviewing time!
 
Got 1 vote left
 
DVLR / / thanks Monkey!
 
1
Q: Factorizing integers

LCHI'm working this method in Java, wich is giving me the factors of a number. I'll be using this method a lot, and I was wondering if there isn't a better way of doing it. Like, with just one loop. Although this code works great and it returns what I expect, I just want to know if there's a better ...

 
5:51 PM
I like the wall on the right with all our star comments :)
 
Yeah, only in The 2nd Monitor :)
(right?)
 
riiight.
 
hmmm.. my harshest review I think.
0
A: Naive implementation of attached properties for WinForms

Mat's MugWinForms is not WPF. Sad, boring truth. The correct way of extending WinForms controls is, as was mentioned, through inheritance. What you've got here is a set of extension methods in a dual-purpose static class that's asking for trouble in the sense that it's also a state-holding bag of static...

> don't try to turn a Corolla into an Audi!
 
6:10 PM
0
Q: Why is my C# program slower than my Python program?

user2180125I made a program on python, and wanted it to be faster, so I wrote it on C#, because it's compiled. To my surprise, the python program is much faster. I guess there is something wrong with my C# code, but it is pretty simple and straightforward so I don't know. They are structured about the same ...

 
6:23 PM
I think that I will hit 7k today!
2
 
6:38 PM
7K REVIVAL!
 
7k :o
that is a lot
 
Thanks, Santa!
@skiwi Not as much as 14k as @rolfl has. And we have been members here for about the same time.
 
someone's an addict...
and I"m an addict to Project Euler since 2 days or 3
 
We're all code addicts around here.
3
 
my code optimization smells... turned it form sequential into parallel to go form unacceptable 1,5s to acceptable 0,5s!
 
6:43 PM
Something's not right about this vs test. Did I hit the nail on the head?
0
Q: Why is my C# program slower than my Python program?

user2180125I made a program on python, and wanted it to be faster, so I wrote it on C#, because it's compiled. To my surprise, the python program is much faster. I guess there is something wrong with my C# code, but it is pretty simple and straightforward so I don't know. They are structured about the same ...

 
Because C# sucks
 
Given a typewriter and enough time, any monkey could come up with a Java program.
 
benchmarking with randomness
that is interesting
one day problem 1 is faster, the other day program 2 is faster
 
Or you run it 100K times, I guess you'd get 50-50%?
 
depends on the randomness of the randoms
but there is a chance yeah, and by chance we say somethign random again
 
6:46 PM
0
Q: code to write data to excel

Abhishek AsthanaI have a need to read properties from soapUI using groovy and writing them to excel. I initially had a problem with writing to excel but i was able to solve that. Now i want to know if my solution is correct from a best practice perspective and can it be optimized to work faster. I use groovy an...

 
namespace Monkey
@Mat'sMug Did you see that namespace name? :)
 
haha just did!
 
I love this one: projecteuler.net/thread=14 , "Not being very clued up on this issue, I decided to attempt a brute force solution. Starting with 500,001 and counting upwards, every odd number was tested. It took 29 hours to find the solution."
 
I'm more thinking that given enough time and a typewriter, any Monkey could write C# :)
If anyone is wondering, this is what happens when you mix Game of Life with Rule 30.
 
I refuse to search for rules on the internet.
 
6:51 PM
what's rule 30??
 
Never, ever ask google "what is Rule xx ?"
 
better ask Watson?
 
am I going to google that..
 
^^ That's rule 30
 
6:52 PM
so muc inspiration, so few time - I'd want to make Game of Line in 3D
 
Game of Line would be 1D, I believe.
 
game of life is all about dead or alive, right? and cells change state, or did it also have empty cells?
 
Game of Area would be 2D
And game of Box, 3D.
Yes, it's all about dead or alive. true or false. There is nothing else.
 
That's an Xbox
 
The only question is how you represent the dead or alive.
I'm gonna stick to 2D for now. I do have an infinite grid though, at least theoretically.
 
6:55 PM
I'm thinking about stickfigures in 3D that start to kill eachother
 
Practically, JavaScript is slow like hell already :) But it's mostly the rendering that takes time.
Haha, good luck making cellular automata for that :)
 
now back to writing a Collatz Generator with memory
 
My theoretically infinite grid is far from infinite.
OutOfMemoryError: Java heap space
 
buy more RAM
 
I can't get infinite amounds of ram unfortunately
 
7:04 PM
it will solve your programming mistakes
how many elements does that grid have then?!
 
6.2 seconds to make one step on a 1000x1000 Game of Life map. (Without any rendering)
I tried making a 5000x5000 before, that was the OutOfMemoryError
1000x1000 and 6.2 seconds, what does performance monkey @rolfl say about that?
 
"it's sub-optimal"
 
Yes, it's sub-optimal indeed
But my map is completely random, so it's quite likely that there's a lot of things that is switching
 
You tried programming it in assembly yet?
2
 
In this question, he had 5000x5000 in 766 ms.
 
7:07 PM
but in all seriousness, I would take a look at and see if I can find anything
 
lol, no. Assembly is not my thing :)
I'm quite sure that I know where my big flaws is: I'm making it flexible.
Flexible != Fast
 
hehe
would I be able to take a look at it?
 
Probably only a matter of time until I put it up for review :)
So keep sticking around at CR and you'll be able to see :)
I plan on exporting it as a GWT application today though.
 
okay
my Game Of Life is from first year of uni, so roughly 2,5 years ago
was made in "DrJava", not even a proper IDE... so bad
class Cell extends JLabel implements MouseListener { }
I do not think that was really a good design choice
 
Me neither!
I'm always trying to separate my model from my view!
 
7:17 PM
oh gosh... Toolkit.getDefaultToolkit().beep();
I really had that in my code?!
 
beep();?
 
@Mat'sMug Like DING! but... not quite.
 
nah, ..not half as exciting!
 
If I would post the code on CR, I would be near dead... yet the teacher gave me an A+ and it is understandable I think with just some baisc Java knowledge back then
 
near dead? Monkey has a theory - the shittiest code gets the highest amount of upvotes ...want to give it a try?
2
 
7:22 PM
I'd emberass myself by posting that code
 
"proof" for this theory:
18
Q: How can I make this mess of Java for-loops faster?

javaI'm trying to find all the 3, 4, 5, and 6 letter words given 6 letters. I am finding them by comparing every combination of the 6 letters to an ArrayList of words called sortedDictionary. I have worked on the code a good bit to get it to this point. I tested how many six letter words are check...

 
just say "I just dig up this code I wrote 10 years ago"
 
0
Q: the java error missing method header or declare abstract. Help!

KelliI keep getting the java error "missing header or declare abstact." I can't figure out what is wrong with my program. Any ideas? import java.util.Random; //needed for random numbers import javax.swing.JOptionPane; //needed for dialog boxes public class F...

 
the Holy Mother of Loops!!!
 
WHAT
that is a badass loop
 
7:24 PM
nah, it's way beyond badass!
I like l1++ and then l2++ and l3++
 
let me dig up some code
 
hehe
@skiwi you could always post a selfie (self-answer/self-review) along with your "shitty code"
 
i believe it's in that one class with 1060 lines, of which 68 are imports
I'm working one day a week at a project that involves automatic recognization of invoices by OCR, only problem is that the project became quite a mess (I'm only one working at it)
 
I really should consider posting a selfie on the first Delphi game I worked on...
 
and it will need to be proof of concept-ready soon, so no time to refactor either
hehe, that interesting?
 
7:27 PM
Oh, OCR... Interesting!
 
The OCR I use is the Tesseract OCR, luckily I do not have to write that myself
though it would be a challenge
making sense of the OCR output is interesting enough
Do you maybe know of any tools that automatically make class diagrams form java projects? just to see how much of a mess it is
 
Yup, I believe there's some Eclipse UML plugins that you can use.
If an UML diagram is what you are looking for, of course...
 
oh.. Eclipse
I was more thinking about a static analyzer, not integrated with any IDE
 
In that case I can't help you. I only know the Eclipse plugins :)
Which technically are static analyzers.
 
I'd like to not touch eclipse if possible
I found my amazing code finally
public class Spiral7DGenerator implements Iterator<List<Integer>> {
//Can probably be used when quantum computers become available
private BlockingQueue<List<Integer>> spirals = new SynchronousQueue<>();

public Spiral7DGenerator() {
new Thread(new Runnable() {
@Override
public void run() {
for (int t = 0; true; t++) {
loops(t);
}
}
}).start();
}

@Override
public boolean hasNext() {
return true;
}

@Override
public List<Integer> next() {
try {
return spirals.take();
} catch (InterruptedException ex) {
 
7:35 PM
Oh, you don't like Eclipse? Do you use another IDE or are you using good old notepad?
 
you guys are so mean to the Monkey
 
Netbeans I use
 
@skiwi Netbeans seems slow
Eclipse is kind of Buggy
 
Aha. I use NetBeans at work. I prefer Eclipse though.
 
mine has only been slow when I had a java file with 40000 lines of auto generated code
 
7:36 PM
Mono is fun, but I haven't used it enough to complain about it yet
 
it depends on your system too I think
 
Well... I must say that your method name makes sense... private void loops(int t) :)
 
I was using a weak Laptop running Ubuntu 12.10 or 13.04
 
needless to say that that code was not prduction ready
 
I updated my answer @rolfl I don't know that I know enough to research whether or not I should dispute your comment, your code looks like a fun time though.
3
A: WHERE NOT IN SQL Performance

MalachiThis Stack Overflow answer about NOT IN vs. NOT EXIST is way more in depth than I care to go about these two things. I do know that NOT IN will slow down your query. I suggest trying to use a LEFT OUTER JOIN rather than a NOT IN. Additional can you pick an ID and say anything less than that...

I think this is the answer that will win all the cookies
 
7:39 PM
i'm running on a i7 CPU, SSD, 16 GB RAM, might be why netbeans is not slow
 
I think this is the answer that will win all the cookies▲▲▲▲
yeah this laptop I was (am) using is old, but it still runs
 
my laptop from uni is not the fastest either
 
@skiwi SSD gives me tinglys
ABTW = Anyway Back to Work
 
tinglys?
 
I want one for my home computers so badly...I like the speed.
 
7:41 PM
I'll try to figure out what the triangles are I need to create a Rectangle in 3D
SSD's are gods
 
At work I have 2 GB RAM. Might be why I prefer Eclipse more :)
And the fact that I'm more used to the shortcuts in Eclipse
 
2GB... what
taht's torturing a developer
even though I know windows likes to use more RAM when it's available, currently I am on 5GB with just my basic stuff + firefox + netbeans
 
Yup... it's a torture alright.
Especially when I'm using Windows 7, and are often having four Java applications open, and NetBeans, and PostgreSQL, and Google Chrome with about three tabs...
 
hmmm... how in earth will I go about writing a helper method that returns the triangles for a 3D rectangle
my firefox has 329 tabs now... it used to have over 2000
 
I have 16 GB Ram here at work but only an i5
 
7:45 PM
I have 8gb ram and Windows XP 32 bits
 
64 bit finally though
@DavidMcDavidson XP? almost obsolete
 
Yeah...
 
@DavidMcDavidson still better than Vista
2
 
@Malachi heh
We'll be upgrading to win 7 soon though, so there's that
 
At work I have a dual-core (2x 2.6 GHz) Win8.1 x64 with 8GB RAM
 
7:47 PM
Here's btw a method from my first Delphi game, written about... 15 years ago...
procedure TLabForm1.Laser1_1Timer(Sender: TObject);
begin
  if L1Dir=1 then
  begin
    Ls1_1.Top:=Ls1_1.Top - 15;
    Testa_Ls1;
    if Ls1_1.Top < 1 then
    begin
      Ls1_1.Visible:=False;
      Laser1_1.Enabled:=False;
    end;
  end;
  if L1Dir=2 then
  begin
    Ls1_1.Left:=Ls1_1.Left - 15;
    Testa_Ls1;
    if Ls1_1.Left < 1 then
    begin
      Ls1_1.Visible:=False;
      Laser1_1.Enabled:=False;
    end;
  end;
  if L1Dir=3 then
  begin
    Ls1_1.Left:=Ls1_1.Left + 15;
    Testa_Ls1;
 
Vista was running fine at home in all honesty
after SP1 i think
 
@Mat'sMug crazy, we can't go to Windows 8 because we use a third party app that doesn't support it and everything that come with it yet
 
utmost interesting @SimonAndréForsberg, though I do not quite get what the code does
 
@skiwi It's job is to move a "laser" object on the screen (which is an image), and if it goes outside the map, it hides it.
 
780x560
that aws your screen resolution
 
7:50 PM
@SimonAndréForsberg does it go "pu-tchooo" as well?
 
Lol, or at least that was the size for the game area. Hard-coded values ftw.
@Mat'sMug Sounds? What's that? Couldn't even spell that back then.
 
pu-tchoo, pu-tchoo, "we're under attack!" pu-tchoo, pu-tchoo!
 
Although I still wouldn't be able to spell "pu-tchooo" probably...
Sounds like the mug has gotten ideas for a game he would like to make?
 
actually I had the Knight's .WAV from WarCraft II playing in my head
with lasers from Star Wars
 
Oh, and here's the variable declarations for the project...
var
  LabForm1: TLabForm1;
  Path    : String;
  Running : Boolean;
  Cash    : TWArr;
  X1, X2, Y1, Y2, X3, Y3, Fu1, Fu2, Fu3, Fu1Pris,
  Fu2Pris, Fu3Pris, Bo1, Bo2, Bo3, Bo1Pris, Bo2Pris,
  Bo3Pris, He1Pris, He2Pris, He3Pris, O1, O2, O3,
  Oka, Okb, Okc, Ok1, Ok2, Ok3, Load1, Load2, Load3,
  R1Dir, R2Dir, R3Dir, Ls1Pris, Ls2Pris, Ls3Pris,
  Ro1, Ro2, Ro3, Ro1Pris, Ro2Pris, Ro3Pris, Mb1,
  Mb2, Mb3, L1Dir, L2Dir, L3Dir: Byte;
  Xa, Ya, Xb, Yb, Xc, Yc, Ls1, Ls2, Ls3, E1Pris, E2Pris,
  E3Pris, Score1, Score2, Score3,
 
7:52 PM
holy mother of comma-separated-variables!!
 
Arrays? Structures? Classes? Pffft, who needs them?
 
How would I go about making a method that creates a Box/Rectangle of certain dimensions (width x height x depth), and puts the resulting elements of the vertices in a FloatBuffer?
The only problem I have is that it should use minimal data, preferably not even any Object
 
@Mat'sMug Mixing WarCraft II and Star Wars? Now that'd be something...
@skiwi float[]? Although an array is technically also an object...
 
I cannot even quite use float[]
I guess I really need to do it by hand
 
(spawns a new Rebel()) ready to serve! (right-clicks an empire soldier) at once!
 
7:56 PM
going to Learn kTurtle with my Daughter, or rather teach here how to program with it.
it came with the OS
ABTW
 
Yes my lord. At once sire
 
(gets annoyed from multiple clicks) Make up your mind!
 
Aaaand, the music.
 
0
Q: A non-blocking lock decorator in Python

bdeshamI needed to impose on a Python method the following locking semantics: the method can only be run by one thread at a time. If thread B tries to run the method while it is already being run by thread A, then thread B immediately receives a return value of None. I wrote the following decorator to ...

 

« first day (297 days earlier)      last day (3706 days later) »