« first day (633 days earlier)      last day (3388 days later) » 

11:02 AM
Comments FTW
#include <stdio.h>
#include <stdlib.h>
#define SIZE 25    /* SIZE of 10 elements */
4
 
Seems about right
 
@rolfl You think 'Code-Q2A' is a good name for my userscript?
 
@SimonAndréForsberg It may not be very good, but it's better than: "Userscript for Stack Exchange to make it easier to answer" ...
 
@rolfl but I'm not talking about the question title, I'm talking about the actual userscript name
// ==UserScript==
// @name          Auto-Review
 
11:13 AM
As I said in my answer, that conflicts with the existing userscript AutoReviewComments .... so it shouod change to something.
I'm not going to say the name I suggested is the best though
CodeQ2A is a logical name though, but perhaps not that imaginitive
 
yeah, I'm also not entirely happy with the Auto-Review name. It makes it sound a bit like the script is actually doing the reviewing.
Additionally, this script could also be useful on Stack Overflow questions.
 
0
Q: Beginner python module

magu_Disclaimer: I use project euler to teach me programming and not to submit any results. As such I lookup the expected return values to double check my solutions. To organise my files I use the following folder structure: main.py \euler # The problem files __init__.py # empty e001.py ...

 
What is it exactly doing, I can try to think of a name
 
@SimonAndréForsberg Someone should make a bot that runs a lint tool over code in questions
 
@skiwi have you read the question and looked at the screenshots?
11
Q: Code-Q2A - Copy code blocks from Questions to Answers

Simon André ForsbergI came up with an idea for a userscript to simplify writing answers on Stack Exchange while writing a previous answer This userscript adds "Review"-links on the top of each code segment. When clicked, it adds checkboxes in front of every code line. You select the checkboxes for the lines you wan...

 
11:19 AM
I wonder how successful the bot would be
 
@Pimgd I'm on it!
 
@Duga No you're not.
 
When it starts to eat all the rep we have a problem though
 
@SimonAndréForsberg I guess I'll start there
First thought: CodeReviewHelper
 
@Pimgd I think it will be hard to make some of the code compile... because for many languages, it needs to compile before it can be lint-checked, right? (Java for example?)
@skiwi but it can also apply on Stack Overflow
 
11:21 AM
@SimonAndréForsberg You're still reviewing code though, one way or the other
 
well, one of the things it can also do is static analysis?
 
@skiwi reviewing and reviewing.... well... I guess you can call it that even when the code is not working...
 
re-looking-at-it
 
Who wrote these silly JS error messages? I never expected undefined to be a function! Just tell my what line the message occurs on please!!
2
 
@SimonAndréForsberg error on line 1 of your-minimized-js.js
 
11:32 AM
0
Q: Should I use a dictionary of functions or if statements in this function in Python?

evil_insideI have the following function: def save_to_file(data, columns_order, save_filename): """ Saves data to file :param data: data to be saved :param columns_order: the order of columns if needed to rearrange else put "" :param save_...

 
@Pimgd yeah, kinda like that
 
...
it was a stab at that line numbers don't solve everything
 
no more lines to process... or something like that
 
My own validation tool uses the following error message format:
 
turns out that $ was undefined.
 
11:36 AM
no jquery?
 
"Grammar - Minor: Double space on line 15, col 40, near "(...) blah blah ​ blah blah (...)".\r\nLine 15: <dump of line 15>"
(Zero-width-space inserted to make chat comply)
 
Nice to have the real @Phrancis picture back.
 
Is $ = undefined; actually enough to crash jQuery?
 
haha
 
Basically $ is jQuery
 
11:39 AM
Have back and forth comments about "can't you do x" "no I can't do x" "but x is just y.z"
wait for a response
all opposing comments are gone and your answer is upvoted
 
@rolfl yeah, @janos' suggestion of using $('head').append(script); didn't work
 
@rolfl $(element) is the same as jQuery(element), right?
 
@skiwi then write document = undefined; and you might crash JavaScript entirely.
 
Ummm... that's testing the limits of my jQuery ;-)
 
11:40 AM
@SimonAndréForsberg That part is obvious though, to me
 
@skiwi yes, it is. $ === jQuery in most cases.
 
On SO my rep just slowly goes down as users are deleted
 
@Pimgd my rep just slowly goes down as I downvote people
3
 
liaaar
 
I see it mostly going up there!
 
11:43 AM
 
I'd say @Pimgd's reputation also mostly going up
 
You mean, it's not normal to keep getting rep every other day?
I don't know when my last real SO activity was
 
@skiwi congrats on 10k on SO...
now you can see all the crap over there !
 
I don't really post in java tag anymore
I just post in actionscript tag
 
@Vogel612 thanks, so much fun to see crap!
 
11:45 AM
and that's mostly users that will get deleted eventually
so what goes up comes down
 
^^ why that... too young?
 
@skiwi with 327 questions and 211 answers, what would you expect?
 
I don't know, @Pimgd - yoou should see the crap I put up with on Code Review, I mean look at how little the rep has changed in the past month.... codereview.stackexchange.com/users/31503/rolfl?tab=reputation ;-)
 
Helping people who had legtimate questions on Java 8 was fun for a while...
Helping people who cannot google is not fun anymore.
 
^^ that.
even though I answered a question today..
 
11:46 AM
@rolfl You have a bounty addiction.
 
@skiwi I think the only people I've helped on SO recently is Code Review users, such as @Vogel612 and @janos.
 
I can't do anything else but cringe for a moment after reading this...
> I'm a Computer Science student at the Technology University of Eindhoven.
No effort to make it sound a bit decent in English... it just sounds plain Dutch.
 
That sounds fine ... right?
 
That sounds absolutely fine
 
Breakfast!!!!
 
11:48 AM
LUNCH
 
> I'm a Computer Science student studying at the Eindhoven University of Technology.
That sounds like... way better?
 
I guess that's what the edit button is for
 
It's fixed, yaay
Probably I don't read my own profile message a lot..
 
Isn't "studying" redundant though?
Study and student surely have the same root.
 
student + studying = no shit Sherlock!
 
11:51 AM
A student is one who studies...
 
> I'm a Computer Science student at the Eindhoven University of Technology.
 
Or
 
> I'm studying Computer Science at the Eindhoven University of Technology.
 
yes that
Phone typing isslow
 
@SimonAndréForsberg That's what I was looking for I'm sure
 
11:54 AM
But the last part of the sentence I guess is the part that sounded Dutch?
What is the institution's official name?
 
In Dutch: Technische Universiteit Eindhoven
In English: Eindhoven University of Technology
Previously I just translated the sentence word by word pretty much
 
Did you translate the institution name or is that their own translation?
 
The English one is their own official translation
 
Okay
 
12:11 PM
@rolfl about that triggering update thing. I'm trying some variants of it but have not been able to accomplish that...
 
I never said it was easy ... ;-)
 
I thought perhaps a StackExchange answer somewhere would describe how to do it on StackExchange, googling for "stackexchange force answer preview update" did not help much.
not one of my best search queries...
 
@SimonAndréForsberg it looks like you'll have to dig into their minified js..
or you might want to ask Ilmari
 
@Vogel612 who's that?
 
developer of SOUP
 
12:18 PM
@Vogel612 with balls?
Soup with balls is best soup.
 
dafuq?
SOUP as in StackOverflow Unofficial Patch
 
aww
I just had lunch but I'm still hungry
 
@SimonAndréForsberg - tried: element.fireEvent("onchange"); ...
(though it may be a different event needing firing).
@Simon: change:
       answer.val(answer_text);
to be:
   answer.val(answer_text).change();
 
@rolfl undefined is not a function!
 
253
A: Why does the jquery change event not trigger when I set the value of a select using val()?

user113716Because the change event requires an actual browser event initiated by the user instead of via javascript code. Do this instead: $("#single").val("Single2").change();

 
12:23 PM
@rolfl no effect
 
drat.
Limits of my google-fu
 
answer.trigger("change");
answer.trigger("onchange");
answer.trigger("keypress");
answer.trigger("keydown");
answer.trigger("keyup");
^^ doesn't work either
Is it time to go to Stack Overflow with this question?
 
@SimonAndréForsberg can't you dig into the actual js of so?
 
@Vogel612 I tried to dig into it a bit, but I did not succeed. Digging into minified JS is not my expertise.
I found something which I thought I could use, but when trying to code it it didn't solve anything
I haven't entirely tested all this out yet though:
176
A: How to trigger event in JavaScript?

AlsciendeYou can use fireEvent on IE, and w3c's dispatchEvent on most other browsers. To create the event you want to fire, you can use either createEvent or createEventObject depending on the browser. Here is a self-explanatory piece of code (from prototype) that fires an event dataavailable on an eleme...

not 100% sure about how to use it
@janos I did actually burrow that embedFunction from somewhere else and changed it a bit, so you are correct that there are two different people involved.
 
12:40 PM
Greetings, Programs.
 
@Donald.McLean Greetings, User
@Donald.McLean Greetings, user
 
@SimonAndréForsberg Sorry, are you not aware that I have a mind of my ownc
 
Question mark gone wrong... It seems
 
@Duga nice try @skiwi.
 
12:59 PM
@rolfl I've updated the userscript on github to incorporate most of your suggestions. I think it's only the event firing that is not fixed.
Here's a github issue for it: github.com/Zomis/Auto-Review/issues/2
 
what about the multiple lines in one go feature
 
@Pimgd haven't fixed that yet
 
-1
Q: WCF Project Structure & Maintainability

RaathigeshWe are working on a medium scale WCF project configured to use per call instancing and wondering weather it's a good practice to create classes per service method to hold the business logic since each service method deals with a single operation and business logic is quite complex ? Do we need t...

 
huzzah
 
1:19 PM
New question for you guys
I've got an AbstractLogReader class which is abstract and is supposed to be extended
However after several refactorings it has no abstract methods in it anymore, though it should still be extended (but may also be used without extending), what do I do with it?
 
you provide more context
 
The issue is that I've got an abstract class that no longer should be abstract, but how do I name it then if other classes are supposed to extend it?
 
DefaultLogReader
 
but what does it do
 
It's a common system/convention for fully implemented classes that are intended to be extended.
 
1:22 PM
^^ that
 
It reads log messages, the premise is that you supply the Iterator<String> from which it can read
 
Other classes in the hierachy include ListLogReader and FileLogReader, they provide their own iterator to the class currently known as AbstractLogReader
@rolfl Thanks, that'll work :) My own thoughts didn't go further than SimpleLogReader, but that name didn't show that it should be extended
What's the easiest way to get an outline of public methods in your API? Inspecting the javadoc? Or is there an easier way?
 
> a source of standard input. By default, the subprocess reads input from a pipe. Java code can access this pipe via the output stream returned by Process.getOutputStream().
 
Internal weird APIs are not nice but can be refactored, external ones are an issue and I'd like to mark this as stable
 
1:32 PM
I'm getting confused a bit
the output stream is the process's input and the inputstream is the process's output?
 
@Pimgd Ah yes... that one is a bit difficult
 
@skiwi go to the class in your IDE and press Ctrl + O (in Eclipse) to get the view of all methods, see the symbol for each method to see which ones are public
 
Apr 23 '14 at 9:45, by skiwi
So the output stream of a process is called an input stream when operating on it in java?
 
@skiwi haha
 
@Pimgd To the ProcessBuilder both the output stream and the error stream are of type InputStream, because you will read from them, now the input stream is of type OutputStream because you will write to it
 
1:35 PM
I see
hmmh.
> By default, the created subprocess does not have its own terminal or console. All its standard I/O (i.e. stdin, stdout, stderr) operations will be redirected to the parent process, where they can be accessed via the streams obtained using the methods getOutputStream(), getInputStream(), and getErrorStream().
> The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, or even deadlock.
what...?!
so basically; 9 little subprocesses, humming happily along, 1 joins the pack, also singing the song
10 little subprocesses, humming happily along, nobody listens to them in time AND EVERYONE DIES BUT NOT REALLY THEY ARE STUCK IN LIMBO FOREVER
2
 
BOOM! deadlock
 
This is scary
because I can imagine a server hiccuping and having less resources available for a small period of time
and then everything crashes
 
Don't worry, that won't happen to us!
Right?
 
Erm
It's as simple as having a traffic spike
 
0
Q: PHP. In_array or array_unique

ChilionWhat would be the best solution here? If there are less then a 100 items in $list? And what if there are more then a million? Example 1: <?php foreach($list as $item) { if(!in_array($item, $array)){ $array[] = $item; } } $this->doSomethingWithThisArray($array); ?> Example 2: <...

 
1:47 PM
but this is seriously bothering me because I would have anywhere from 800 to 3200 processes that'd need attention
...
actually now I'm starting to get worried about CPU power
 
@Pimgd Your concerns are unfounded if/when done properly
 
@rolfl I am responsible for doing, so I'm very concerned because I feel I will most likely not do properly
 
Modt people do not need to feed data in to the stdin of a child process, so that's one thing you seldom worry about.
Next up, most people don't need to separate the STDOUT/STDERR (though I recommend you do...).
Thus, you need just one thread to manage the process, which can be the calling thread.... if you merge the stderr/stdout on the child process.
 
@rolfl I have to send a q\n when I'm done
 
Now, what you do is have one java thread per stream handled.
with the controlling stream on stdout thread.
If the system becomes busy, it will be just as busy for your thread as it will be for the child process.
It is the very exceptional system which will drop data, and no systems you encounter will be affected.
 
1:55 PM
I'm recording video data
any lag will lead to dropped data
 
UNIX (including Mac) and Windows systems will block the child process.... Ohhhh.
 
unless it's caught up in time
 
So, you then need to have a larger buffer, an better controls and management,
Buffer the data coming from the stream in a lightweight thead, probably using the filesystem.
 
I'd like to say "I need a drink and a really big whiteboard" but I don't drink
 
have tracking to indicate dropped data.
 
1:58 PM
well
I guess as long as I keep the threads separated properly
I can make changes later
turning a single threaded application multithreaded is a huge pain
 
Dows the stderr of the source system track dropped data?
 
I dunno
 
You should find out. Also, your application almost always needs a thread to manage each child process spawned with the ProcessBuilder. There's no other way to do it.
 
I need a thread to manage each child process
 
If you are running just one child at a time, you can likely still keep your system single-threaded.
 
2:00 PM
I need another thread to sleep at waitFor() for each child process
 
in TCG Creation, 1 min ago, by Duga
> added shift+click support on checkboxes, fixes #3
3
@Pimgd ^^
 
Delegation, nice
 
@Pimgd You can do the waitfor and the stdout in one thread.
 
@rolfl eh?
 
It is always true that stdout will be closed when waitfor returns.
thus, you can loop on stdout and check for waitfor when stdout is closed.
 
2:03 PM
I even added support for shift-clicking to unselect, although that might unselect a bit too many at the moment...
 
Wait, how is duga a bot
 
@Pimgd How is not @Duga a bot?
 
3 hours ago, by Duga
@Pimgd I'm on it!
...
Did you make a "Someone should" scanner?
Someone should test if @Duga is a bot.
hmm.
 
yesterday, by Simon André Forsberg
user image
I can remote control @Duga
 
@Pimgd I am being remote controlled now
 
2:06 PM
remote-abused you mean
robots have rights too
 
@Simon only remote controls, I remote abuse
@Pimgd I am happy with my bot-life
 
@Duga 'I' == @skiwi
 
I can't continue this conversation, I have a huge grin on my face in the workplace
3
 
Probably someone is confused as heck now
 
@Pimgd smiling at work is forbidden?
 
2:08 PM
funny non-work-related things are
 
I'm helping you with work-related things
 
@nhgrif I hear you are the resident mac expert
 
I just told that the feature request is fixed, now I should shut up :)
 
@rolfl =D That's true
Okay, so that saves me half the threads
 
Not really... I'm an iOS developer. I dont consider myself a Mac power user by any means.
 
2:12 PM
Let's see, I've got one thread that listens for new requests, N threads for managing N subprocesses...
eh, that'll do for now
 
+ 1-more thread for each additional stream other than the stdout
if you need to feed stdin, or separate stderr
 
well I do need to parse the output
 
In general, I recommend a separate stderr
It makes things more complicated, but allows better error messages and logging.
I gotta run for a bit.
 
I'm gonna design my subprocess handling section
 
Use the processbuilder class.
 
2:15 PM
@nhgrif I just get tons of conflicting information :-)
 
=) I mean the parsing related bits, starting new ones, finding a nice way to give each of them their own working directory
 
What do you actually need?
 
1
Q: Sort Contacts Marked As Company

Chrismas007I found an Applescript at apple's support site to sort any contact with the "Company" checkmark checked into a "Business" group: property groupName : "Business" tell application "Contacts" if (name of groups as list) does not contain groupName then make new group at end of groups wit...

 
Hmm in my last 10 CR questions I've only accepted one answer, I believe by now people have had enough time to answer the question
 
Given that you question is about AppleScript, you could as on SO?
 
2:19 PM
It's a bit more difficult here if I don't exactly know where the questions were about anymore... oops
 
@nhgrif True. Was initially directed to Ask different as I only use SO for
 
I could probably do an ObjC or Swift app but that seems overkill...
 
@nhgrif yea
@nhgrif We will see if SO has any more luck.
 
0
A: Parsing dates from an OCR application

Andrei SocaciuI have to post this as an answer, as I cannot comment yet: Do you really want to throw an IllegalStateException if you cannot extract the date? It implies that if your method ever got called with something you cannot parse or an empty string, that would be a programming error. Which, depending o...

Is it actually valid as an answer? I would say it actually is
And is this really enough explanation?
0
A: Parsing dates from an OCR application

EpinujThis could be solved with org.joda.time.format.DateTimeFormat. As for the tests. Do not assert in the for loop. If the assertion fails then the whole test fails. So if it fails on the first date, then you don't know anything about other dates. Use parameterized tests instead.

 
2:34 PM
File	directory()
Returns this process builder's working directory.
ProcessBuilder	directory(File directory)
Sets this process builder's working directory.
Why does this class not use the regular get and set
instead opting for property = get & property(argument) = set?
 
> Since: JDK1.0
 
... and?
I'm an ignorant kid that didn't play with Java until it was 1.4, and didn't start seriously doing things with it until it was 1.6
 
Actually, it seems ProcessBuilder is more recent
Hmmm.... good enough question
 
> Since 1.5
 
0
Q: Which option is better for readability when dealing with blank strings?

LoganI'm working off a specification that says a bunch of fields within a record (one record being one line) must be blank. For example, it says that chars 6-14 must be blank. I am building a class hierarchy structure that represents the layout of the file, and within this class hierarchy I'm includin...

 
2:43 PM
Working with processes in Java with the standard libraries is ugly
 
Not really.... or rather, it's low-level, exposing all the functionality you may need.
 
hmmh
it takes a List<String> but it doesn't explain how your arguments should be formatted
is it "ping", "google.com", "-n", "4" or "ping", "google.com", "-n 4"?
 
The former.
And, I actually recommend the array version.
 
@Mat'sMug I have reworded my default phrase

> this makes it clear for Mr./Mrs.Maintainer what it stands for
 
@Heslacher Have you considered Ms.Maintainer?
 
2:49 PM
s/Mr.\/Mrs.Maintainer/Maintainer Sam/g
 
@Pimgd next time I will add Ms. also ;-)
 
I know enough male and female 'Sam'-named people, that it works for me.
 
Pat...
Or... "The maintainer"
 
@rolfl In don't know any Sam. Maybe because it isn't a common name in germany.
 
hmm it changes the list to an array with command.toArray(new String[command.size()])
 
2:56 PM
Each argument needs to be a separate item in the array. The alternative is for the first/only value to be the whole string-concatenated value, but then you rely on the shell parsing it and getting the arguments out of the spaces... and that makes things like spaces-in-file-names very hard.
 
// Convert arguments to a contiguous block; it's easier to do
63        // memory management in Java than in C.
64        byte[][] args = new byte[cmdarray.length-1][];
65        int size = args.length; // For added NUL bytes
66        for (int i = 0; i < args.length; i++) {
67            args[i] = cmdarray[i+1].getBytes();
68            size += args[i].length;
69        }
70        byte[] argBlock = new byte[size];
71        int i = 0;
72        for (byte[] arg : args) {
73            System.arraycopy(arg, 0, argBlock, i, arg.length);
from
String[] cmdarray = command.toArray(new String[command.size()]);
454        for (String arg : cmdarray)
455            if (arg == null)
456                throw new NullPointerException();
457        // Throws IndexOutOfBoundsException if command is empty
458        String prog = cmdarray[0];
459
460        SecurityManager security = System.getSecurityManager();
461        if (security != null)
462            security.checkExec(prog);
463
464        String dir = directory == null ? null : directory.toString();
I don't see it adding spaces anywhere
ehh
 
It does not, but, if it has spaces, it passes the spaces through to the shell, and the result is that the shell parses the spaces out differently... using shell rules, and the additional arguments get treated funny.
 
it splits on ... null bytes...?
 
probably.... you can't put them in as a command argument?
 
I don't need null bytes input
but at least I know how it works now
(Gee I wish we had something like Code Understanding.SE for this)
 
3:03 PM
shells on common systems (Windows/UNIX), etc. are very hard to interact with.... and it is very easy to introduce bugs.
 
and security vulnerabilities
 
and dinosaurs
 
Believe it or not, Java makes it relatively easy.
 
hey that's interesting
I can redirect the output to a log file
 
Yes, and pull it back later.
 
3:07 PM
but then I don't know that the process has died
bah.
 
That's when waitFor is useful.
also the exit code.
 
the exit code makes me do a try catch
I do not want to have a loop that relies on a try catch
 
0
Q: Random retrievable number based on day and month

AraI wrote a function to get a a 2-digit random number for each day, but it should be retrievable, for example today's random number is 72, but later i can provide "day and month" and get this 72 again. Here is the function: function ranDay($day,$month){ $pow1 = round(pow($day,$day))*$month; ...

 
3 mins ago, by rolfl
Believe it or not, Java makes it relatively easy.
 
I don't wanna know the C++ variant of managing all these subprocesses
 
3:12 PM
@Hosch250 you're welcome
 
> Body is limited to 30000 characters; you entered 30970.
Well, crap.
Can I really not post 31.5K characters? :(
 
0
Q: new StringBuilder is really needed?

Vishwanath DalviGiven a string and a non-negative int n, we'll say that the front of the string is the first 3 chars, or whatever is there if the string is less than length 3. Return n copies of the front; frontTimes("Chocolate", 2) → "ChoCho" frontTimes("Chocolate", 3) → "ChoChoCho" frontTimes("Abc", 3) → "Abc...

0
Q: XSLT 2.0 that analyzes an HTML5 document

PaulbThis xslt analyzes a HTML5 source document. (my instinct tells me a program already exists that performs similar function, and better than this, but I can't find it) <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w...

 
Halp, what do I leave out of my post?
 
1/30th of it.
 
but I can't :(
 
3:25 PM
the comments ? ;-)
 
Isn't the javadoc also relevant?
I was trying to make my post more attractive by also adding in example usage... I guess I'll need to leave that out
 
why do you have such a big question =)
 
The preface is already bigger than the average question
0
Q: Parsing log files of HearthStone: The log reading API

skiwiI'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show interesting and useful data in real time. For the question the focus is on the API I have create...

 
0
Q: Parsing log files of HearthStone: The log reading API

skiwiI'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show interesting and useful data in real time. For the question the focus is on the API I have create...

 
3:35 PM
@rolfl 20K, right?
 
Not sure what the threshold is, actually
 
I was aware that it would probably trigger a flag of two, or three, or four...
 
3:51 PM
@rolfl it's not just me!! :D
 
In fairness, we routinely simply dismiss that... we have no concerns about large posts.
If we could get rid of the auto-flag, we would.... Oh, wait, when we fully graduate....
 
I'd keep it
 
So what alternative do you suggest? There needs to be some documentation in the form of javadoc, or else it will look very ugly once javadoc has been generated. — skiwi 12 secs ago
The point about the lack of defensive copying is valid though
 
Also valid points with collections - what if they're empty?
 
Then it's not much of a collection, is it?
I have a collection of crowns worn by English monarchs... It's empty though.
6
 

« first day (633 days earlier)      last day (3388 days later) »