« first day (436 days earlier)      last day (3573 days later) » 

4:02 PM
-1
Q: Why were comments suggesting a move to Code Review removed?

JuhanaThe question: PHP: Optimize If Statement To me this looks like a clear cut case for migration to Code Review. It's code that works, and the question is "Is there a better way of writing the following block of code to easily be maintainable?" So I made a comment that it should be posted to CR in...

2
 
does anyone know how to set up a donate link for paypal? with the fancy button and stuff?
@GrimaWormtongue thank you for the heads up
 
What... :(
Exception in thread "JavaFX Application Thread" java.io.UncheckedIOException: java.io.IOException: Cannot run program "echo test" (in directory "C:\WINDOWS\system32"): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden
It shouldn't be too hard to run "echo test"
Nooo, someone downvoted my question, why
18
Q: The FizzBuzz challenge in Java 8 written in a short, readable and interesting way

skiwiI decided to take on the FizzBuzz challenge with as twist that I would use Java 8 concepts to make it a bit modular, yet still let it be a short, readable and understandable program. This in contrary to some gem I found on the net: FizzBuzzEnterpriseEdition The problem description: Write a ...

 
@GrimaWormtongue @Jamal are you around? what do you think of this?
 
Hard to say. People might just be sick of.
3
 
I flagged that Question as a migration, hope I didn't cause trouble in the Mod world....
 
4:10 PM
@Malachi I'll leave a little answer.
 
I was just going to start a meta answer as well... we can both leave an answer, yes?
 
Looks like we're having intermittent internet issues :(
 
@Malachi I think it would be more interesting to hear any SO mods comment about that.
 
0
A: Why were comments suggesting a move to Code Review removed?

MalachiThe entire post, question and answers, seem to match CodeReview. I have flagged the post, I don't know if it would help to have others flag the question. the reason for not wanting the Comments is because of cross posting and duplicates from this, the user is new to the Stack Exchange system an...

I think I answered it well...
 
@Malachi A lot of speculation, but it is some reasonable speculation. It will be interesting to hear the SO mods say anything
 
4:16 PM
@SimonAndréForsberg agreed, one mod already commented on the Meta post
 
0
Q: wrong value with long type in c language

bladeI'm doing an exercise in c that returns the range of integers data types, signed or unsigned. For some reason it works fine with all of them except for long type, which always return zero for unsigned and -1 for signed, I don't see the logic error. #include <stdio.h> #include <stdlib.h> #include <...

 
Yep, perfectly reasonable for Code Review. I don’t know why the comments would have been deleted. — minitech ♦ 2 mins ago
@Vogel612 good answer!
 
@Malachi thanks, right back at you ;)
 
I hate not being able to VTC on SO
should I flag the post a second time for closure? @Jamal?
 
Same here, but I do like accumulating my helpful flags.
 
4:23 PM
@Malachi wait for the mods to approve the migration....
 
@Vogel612 they won't there is a cross post already
 
then it's out on SO either way..
lool they should..
 
It has already been cross-posted, so they can just close the post.
 
@Jamal the answers would make acceptable CR answers though...
so why not keep them??
 
@Vogel612 agreed
 
4:24 PM
also Close as What? Dupe?
 
on stack overflow it is off-topic
 
@Vogel612 I'm not sure about the accepted answer, though. It's just code-only.
 
@Jamal that can be tuned by the answerer I hope
 
@Malachi even if not, it's not hard to edit some context into that answer to make it an acceptable CR answer..
 
Perhaps I'll talk to the SO mods myself.
 
4:26 PM
I wouldn't leave the Accept on it though....but that is personal opinion
 
@Malachi agreed..
 
@Malachi That went hot on SO meta real quick...
 
And that answer got downvoted fast. Speaking of which, I'm not sure why votes are not auto-updating like they used to. Maybe it's a Chrome issue?
Is this ready for reopening?
 
FYI: The 2nd Monitor (CR's main chatroom) has a feed for all codereview-se questions asked on MSO. — retailcoder 27 secs ago
@GrimaWormtongue you're one of the best ideas we've ever had :)
lunch time, later @all!
 
4:42 PM
later Mug!
@Jamal I would guess so?
 
@Phrancis Already been done now.
 
I was thinking about doing some fun calculations as new CR questions come in... But I would need some service to retrieve new questiosn and a web server online 24/7 for that :(
 
Question to all the Java guys here...
Why can't I cast:
 
Because you forgot to downcast it to Object
 
@skiwi would like to keep it a collection though...
and I need the specific toString calls on a Set<Right>
 
4:45 PM
What was your question btw?
 
and I don't have java8...
return new ArrayList<String>((Collection<String>)allRights);
with allRights being a private static Set<Right>
 
What are you actually trying to do?
I have a feeling something is off there
 
Stringifying a Limited Set of items to display it in a component that only supports String values...
or rather. why should I need the cast in the first place..
Set implements Collection and ArrayList has a constructor taking Collection...
 
I see you are going from a Set<String>, to a Collection<String> to a ArrayList<String>, something's off then
 
Set<Right> to be exact...
btw downcasting to Object doesn't work either..
Right refuses to be cast...
> Cannot cast from Set<Right> to Set<Object>
and if I try the following, eclipse tells me: "Change addAll() to add()"
 
4:51 PM
Is there any reason why Collection<Right> would be compatable to Collection<String>?
 
List<String> ret = new ArrayList<String>();
ret.addAll(allRights);
 
And you might need Set<?> instead of Set<Object>, would need some more source to get a full example
 
@skiwi why shouldn't it be compatible again?
 
Can you assign String str = right;?
 
no. for whatever reason..
String right = allRights.iterator().next();
gives me: "Cannot convert from Right to String"
 
4:54 PM
What does a Right have to do with String?
You cannot force the toString method to be called
 
darned be it.
 
In Java 8 it's easy, else you're screwed
Where the hell is the "echo" program located on my PC?
Or is it something in built in MS-DOS?
 
^^ that sounds more likely
 
probably some bat in System32
or even worse...
 
@Vogel612 That's what I was thinking, but isn't the case
 
4:58 PM
@skiwi I believe it's built-in in the command prompt. (Which is technically not MS-DOS)
 
Welp
then I'll need to use ping
 
what for???
 
To test some dashboard tool to monitor multiple applications/servers
It even kind of works! wow
2
But my design is a bit messed up currently
yay
 
 
5:03 PM
Wow. One of the ladies on my team is such an awkward person. She eats constantly and she talks to her food with a squeaky high pitch voice like it's a little baby. Oh and she eats her boogers too. Weirdo.
 
@Phrancis Wtf?
 
^^ that
 
0
Q: Searching through various PDF files

Christopher BruceI'm just looking for advice on how I can get my code to operate faster. It's pretty quick right now with searching through 30 3-page PDFs, but I imagine once there gets to be thousands of files to search that it will take longer than I'd like. I can change SearchOption.AllDirectories to TopDirect...

1
Q: Multiple dispatch decorator classes in Python

JoschuaThis is based on my first review and the suggested points in "Multiple dispatch decorator in Python": import inspect from functools import wraps, update_wrapper, partial class multi_dispatch(object): """ Returns a multiple dispatch version of the function, that has a "register" me...

 
@skiwi I think you need more icons in your taskbar. You still have room for at least 3.
 
By the way:
4
Q: Immutable Fraction class

nhgrifInspired by this question: Fraction class implemented in Objective-C, I have written what I feel is an improved version of the Fraction class in Objective-C. As per the tips in this answer, the class is immutable (and a mutable subclass might eventually happen). Besides improving on the existin...

 
5:06 PM
@Phrancis You say I need even more?
 
@nhgrif already upvoted, but not the slightest clue of sooo...
 
</sarcasm>
 
I smell a design flaw here
Every time I start/stop a server, I need to manually update the button
 
Yeah, but you can still see if there's something missing. You may not understand the details, but should be easy to understand the big picture
 
@Phrancis he just needs to disable stacking, and it's full ;)
 
5:08 PM
Time to make another spreadsheet yay.
Company motto here: "If it's on a spreadsheet, it's fixed."
 
quick question... what is the least specified Class implementing Collection?
@Phrancis ouch.
 
@Vogel612 A Set I think
 
Set is not a Class..
I went for HashSet for now..
 
Ah
 
This is why you don't set your IDENTITY columns as VARCHAR: 111414195 is lower than 40124665... great.
 
5:17 PM
public final class ModelConverter {

	public static Collection<String> stringifyCollection(
			final Collection<? extends Object> items) {
		Collection<String> stringifiedCollection = new HashSet<String>();
		for (Object item : items) {
			stringifiedCollection.add(item.toString());
		}
		return stringifiedCollection;
	}
}
 
You can also use AbstractCollectionImpl
where you implement what AbstractCollection doesn't implement
 
too much work ahem
 
@Vogel612 I disagree
What if the input collection was a List?
 
then we'd remove all the dupes..
 
In your usecase an ArrayList is probably the best
 
5:18 PM
@Mat'sMug this guy is a feed? color me embarrased...lol
 
As order also needs to be maintained
 
In fact I don't even think it would be bad if I automagically kill all duplicates in the process of converting to string..
@skiwi no it doesn't need to..
my use case is: display that Collection<T extends Object> as Collection<String>
 
this needs to be a meme
4
 
and make a reverse mapping possible
@Phrancis it is.
 
So you don't need order, then you cand o whatever you want pretty much
 
5:20 PM
exactly.
but the reverse mapping makes it hard with duplicates.
so why not remove them when converting..
 
I may wish to refactor this...
new Thread(() -> {
    String line;
    try {
        while ((line = bufferedReader.readLine()) != null) {
            String lineCopy = line;
            Platform.runLater(() -> tabControllers.get(serverTabs.get(server)).getTextArea().appendText(lineCopy + System.lineSeparator()));
        }
    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    }
}).start();
Yeah the String lineCopy = line is stupid
 
So there is a string called lineCopy which is a copy of line (which I'm guessing is also a string). Great. Just write line instead? lol
 
@skiwi especially when lineCopy is not actually a copy..
 
SELECT ThisTable.ThisColumn AS ThisColumn FROM ThisTable AS ThisTable
 
When dealing with mutable objects, it can sometimes be important to copy and not use the original.
 
5:33 PM
@Phrancis Did you find really useless aliases?
 
Plus, in SQL, if you're using the value in ThisTable.ThisColumn 10 times later in the script, you probably are making a copy of the value into a variable rather than running the select 10 times.
 
@Vogel612 But just a reference, evil huh
@Phrancis Doesn't work inside lambdas
Great huh
 
@skiwi don't laugh I had a moment of horror with that when reviewing this question
 
That's a quite long review
I'm trying to find a SSCEE for an SO question, but I need the while ((line = bufferedReader.readLine()) != null) { construct
Maybe I can build a Scanner on top of a string
that might do
But scanner has a hasNext, so I'll get shot down then :(
And for a Reader to work, there needs to be input
 
well you can scroll down to the part which is a bolded level one heading...
 
5:51 PM
reflection code makes me sad :(
 
How hard can it be to figure out how to format an Instant in Java 8
 
@Phrancis riddle: I have a VARCHAR(80) field containing units per size, with 20 slots of 4 characters. What would be a way to SELECT these values into 20 rows?
 
o_0
 
@Mat'sMug let me think. We talking MySQL or...?
Be easy to do in Excel for sure
 
I don't like doing this, but I shouldn't have downvoted this answer. Can someone toss it an upvote for me? My vote is locked.
-1
A: I'm not sure if I still love Fibonacci, but my code is getting better. How much better?

Rune FSafter this line: //If we already have the previous ordinalPosition you can simply do this: var res = Calculate(ordinalPosition-1) + Calculate(ordinalPosition-2); dictionary.Add(ordinalPosition,res); return res; If they are in the dictionary they will be returned immediately, if they are not...

 
6:06 PM
@ckuhn203 done
 
Thanks @Phrancis!
 
@ckuhn203 I can make an edit.
 
@Jamal Thanks @Jamal. I wasn't getting what he was saying when I downvoted.
 
Done
One more question until Inquisitive. Perhaps the next one will be in Java.
 
@ckuhn203 edit it!
 
6:16 PM
@Jamal Yes! Yes! Yes!
 
@Malachi Chock it up to being a Monday. I have no idea why I didn't. Omg....
 
@ckuhn203 lol
 
Too much time on SO working on this Google Cal?
 
I want to be out riding my new bike!!
 
@Malachi What'd you get?
 
6:18 PM
 
@SimonAndréForsberg I just need to find a good step up from FizzBuzz.
 
a spinner unicycle :o
 
That's one pretty paint job.
 
@Jamal Something object-oriented. Perhaps with some Lists and Arrays.
 
oh yeah!
@Jamal make a new one with square roots and fibonacci numbers and primes!
 
6:19 PM
@Jamal Fibonacci has proved to be a PITA of a learning experience. It seemed so simple...
 
@ckuhn203 try the Sieve of Eratosthenes without looking at other renditions of the code!
I need to post another question where I actually do one
@ckuhn203 it's fast too! :)
 
I'll take a look at it @Malichi. I want to work in the suggestions I got from my last review first though. It turned out to be a great way to learn the c# basics.
Does anyone know of a good (preferably free) read on test driven development. When we move to .Net I think I want to push us that way. The premise makes sense to me, but I don't understand how it's actually done.
 
@Phrancis already done in Excel ;)
 
SELECT SUBSTRING(
    (SELECT MyColumn FROM MyTable),
    1, -- position
    4 -- length
),
SELECT SUBSTRING(
    (SELECT MyColumn FROM MyTable),
    5, -- position
    4 -- length
),
SELECT SUBSTRING(
    (SELECT MyColumn FROM MyTable),
    9, -- position
    4 -- length
) -- etc
FROM MyTable;
@Mat'sMug ^^
 
@Phrancis have you seen this ▼▼▼▼
5
Q: Sorting three Decimal values

BenVlodgiI have been given three values. @lLength, @lWidth, @lHeight. I need to take these DECIMAL(4,2) values and set the values of @lMax, @lMid, @lMin with the values I've been given in order of value. So which ever value of Length, Width or Height is the greatest will be stored in Max, and the second c...

 
6:32 PM
@ckuhn203: pretty much anything from Uncle Bob will be good, though I don't know if there's any free material aside from his blog
 
@Malachi I did and already wrote my answer, but when I try to post it says there was an error posting the answer
 
@Phrancis weird! did you save a local copy?
 
Yep
 
cool. I will be patient then. :)
 
Does anyone have idea how I can describe this in a properties file?
DEFAULT_SERVERS.add(new Server("Ping Test", Arrays.asList("C:/Windows/System32/ping", "localhost")));
It first has a string for the name, then there's a number of strings which are all interpreted as first the path fo the executable, and then the arguments
 
6:40 PM
@malachi ^^
 
@Phrancis how does the math behind the @lMid work??
@Phrancis he doesn't want the average I don't think
 
0
Q: How should quicksort be modularized

CeleritasQuicksort is fast but for small arrays it is recommended to use a different algorithm, such as insertion sort. I have a quicksort implementation and now I have an insertion sort too. How should the two go together? public class Quicksort { public Quicksort(int[] arr) { this.arr = arr; } pu...

 
Add all 3 values, subtract the highest and the lowest from total which leaves the middle value. This would not work with more than 3 values
 
@Phrancis oh I see what you are saying.
 
6:44 PM
@ckuhn203 yeah, though I think most of his blogging activty is on the 8th light page: blog.8thlight.com/uncle-bob/archive.html
 
Not very portable but should be fast
 
I never thought about it like that.
@Phrancis can I steal that idea and use it...
 
Actually now that I look at it again I may write:
 
not the temp table
 
DECLARE @lMid    DECIMAL(4,2) = (SELECT SUM(value) - @lMin - @lMax);
 
6:46 PM
the addition subtraction part
 
Eliminate two aggregate functions
 
Monking
 
that is the part I want to steal from your answer @Phrancis
@MadaraUchiha Monking
 
@Malachi as long as you markdown -- thanks Phrancis! each time you use it ;)
 
0
Q: Loop over files in C++, changing their names, to store data into a single file

SarahI have a lot of data in separate files generated from a simulation program. All data is clear and formatted via a single space to read in 4 columns. I can open and store data from each file one at a time but that will get so impossible once I hit more than say 10 files of data with the same simul...

 
6:54 PM
@Phrancis and done!
I still think that your way is probably better though
 
Why am I still coding on this thing in the evening...
 
@DanLyons Thanks!
 
skiwi 1 - bugs 0
 
@Malachi I would be curious to get the execution times for his method and both of ours to compare.
 
7:09 PM
@Phrancis awesome!!
(damn phone is dying)..
 
@Mat'sMug people don't say that about my code very often, usually closer to ;)
2
 
@Phrancis it's good enough for a starting point ;)
probably will end up as a function
oh, MySQL doesn't support table functions...
 
@Phrancis I agree and I have already run out of stars, how does that happen?
there is an imposter....
Malachi, Oxford, United Kingdom
5.7k 8 40 66
or maybe I am the imposter?
2
Malachi, South Dakota
1.6k 2 11 29
 
Zombie incoming!
Unless there is someone willing to review JavaFX 8.
 
0
Q: Dashboard for running programs in JavaFX 8

skiwiI have decided to create a dashboard view of a number of running processes/programs/applications, because it became tedious to monitor a bunch of applications, which I had to boot up manually. Please keep in mind that the .fxml files have been autogenerated using JavaFX SceneBuilder 2.0 and henc...

 
7:20 PM
@SimonAndréForsberg If you wish to learn JavaFX 8, here's your chance!
 
I found a useful function in Excel and it actually works!
=CONCATENATE(L9, " ", P9)
 
@Phrancis Excel, ugh!
 
^^ story of my work life
 
@skiwi I think I know quite some JavaFX stuff already. I might take a look at your question tomorrow
 
@SimonAndréForsberg Cool, did you manage to have all your fields autoscale whenever you want to on your end already?
 
7:26 PM
0
Q: Created 2 new classes to represent my backend service and persisted data in iOS app

user3344977I just created 2 model class for my iOS app: HALUserDefaults represents the persisted data in my app. It has the ability to both retrieve persisted data and store new data. HALParseConnection represents the connection to my Backend service Parse.com These 2 models were made to work with each ...

0
Q: Interacting with database MVC

MarkWhen using MVC 4 Razor (I am new to web) - I am concerned about my understanding of interactions between the database and the client. Much like all apps these days, there is a lot of data that is presented to the user and in different fashions - I have looked around and I can't find a concrete C#...

 
@skiwi Make it look pretty, you mean? What do you think of me?
I believe one picture says more than a thousand words...
 
@SimonAndréForsberg I more meant to have everythign resize automatically
Let me see
I'm afraid... You haven't succeeded yet
 
really, I haven't? No kidding!
I tend to not put much priority into making things look good unfortunately
 
What do you think about that?
 
@skiwi I like how you designed it to look like Windows 8
Because you aren't using Windows 8 are you?
 
7:33 PM
I am using Windows 8..
The design here is JavaFX 8's Caspian theme btw
(Default)
Way better as Swing
@SimonAndréForsberg Do I even want to see the .fxml?
 
0
Q: Formatting options for a long IF statement?

NateI have a somewhat unwieldy IF statement and am wondering if anyone has any suggestions on how to make it more readable. One one line it was all but impossible to understand, so I broke it up into multiple lines: if ( empty($row) ...

0
Q: Robust organization data class (partial followup)

skiwiThis question is a partial followup from my previous question, however the requirements have changed: I now need to be able to store multiple data entries for some fields. I also have added two hooks into the OrganizationBuilder, one that validates the given input, and one that formats the given...

 
@CaptainObvious Yeah, that's my second question within half an hour!
 
@skiwi Probably not
 
Perhaps you can use a GridPane with three columns
Or BorderLayout with the areas on left and right with strategy = grow, and middle one small
At least your graphics are not as bad as this:
 
Why am I here, again?
 
7:38 PM
@Morwenn that's a deep question. Short answer is 42.
 
@Phrancis does this make sense?
 
CREATE PROCEDURE `SP_SelectWIPSizeUnits` (sizes varchar(80))
BEGIN

	create temporary table tmp_WIPSizeUnits (FieldIndex int, Units int);

	set @fieldCount = 20;
	set @fieldSize = 4;

	set @fieldIndex = 1;
	while @fieldIndex <= @fieldCount do
		insert into tmp_WIPSizeUnits(FieldIndex, Units)
			select @fieldIndex, trim((select substring(stringValue, fieldIndex, fieldSize)));
		set @fieldIndex = @fieldIndex + 1;
	end while;

	select * from tmp_WIPSizeUnits;
	drop table tmp_WIPSizeUnits;
END
not sure I need to actually DROP the temp table
 
`(IN sizes VARCHAR(80))`
 
oh
T-SQL is so much simpler :)
 
7:40 PM
@Mat'sMug You could still try DROPping the bass.
 
@Morwenn @Morwenn did you DROP your mug?
;)
 
@Mat'sMug Nope. My foot is strong enough.
And it was empty. Just in case.
 
part of me wonders how .. how the picture was taken ;)
 
I took it by myself.
 
With his other leg
 
7:42 PM
Look: my left arm is out of the picture.
 
0
Q: Optimizing Recursive Quadtree

AlexaI have a written a quadtree program in Python 2.7 to cross-correlate large catalogs with each other i.e. find the common objects in the catalogs based on their position. The problem is that it's still quite slow. Accuracy is my primary goal (No throwing out real matches, no erroneous matches, and...

 
@Mat'sMug the above code can't possibly be working
Or is it?
 
no clue, first draft.
still figuring out how to actually use it in a SELECT
damn, I can't.
 
Hey, @Morwenn! Care to review my code, or the latest C++ question?
 
@Jamal I could give it a try :p
 
7:47 PM
You know about DELIMITER this is needed in MySQL when creating a procedure, otherwise it will just pass each statement to RDBMS as it encounters ;
 
is there not a way to CROSS APPLY the function to each record in a given table?
huh?
DELIMITER $$
 
@Jamal Do you have a link? I may pick the wrong one otherwise.
 
7
Q: Encapsulated text-based RPG using a randomized combat system

JamalFor my rags-to-riches submission, I've decided to improve this code: Text-based RPG game using classes However, I've decided to start off with something different. The original code is more interactive, but mine just runs automatically. I may consider making my code the same, but I wanted to ...

 
I will have a look :)
 
7:50 PM
Use my answer as a model. MySQL interprets ; as end of statement no matter whether or not it's within BEGIN .. END
So when creating a procedure or function, you set a different delimiter. I typically use | but have seen // and $$ used frequently.
Or you can set it to whatever you like as long as it's not an operator or reserved character
 
I noticed that DELIMITER thing but left it untouched as $$
I figured $$ was working fine ;)
 
DELIMITER LOL DROP PROCEDURE IF EXISTS MyProc LOL CREATE PROCEDURE MyProc() BEGIN /* work here */ END LOL DELIMITER ;
2
 
what is it that I don't get?
select * from (call SP_SelectWIPSizeUnits(' 15 3 6 6 6 4 4 '));
FML
 
You can't SELECT from a procedure
 
and you can't have a table function either
great, I'm F'd.
 
7:56 PM
Just call it period, if the proc has a select in it you will get the result set
 
but I want to INSERT that result set in another table
and the parameter has to be a field I'm SELECTing in yet another query...
 
@skiwi strategy = grow?
 
@SimonAndréForsberg Let me check on that
 
@Mat'sMug temp tables
 
Oh, I got rid of my GridPane there, need to check other one
 

« first day (436 days earlier)      last day (3573 days later) »