« first day (870 days earlier)      last day (3133 days later) » 

12:00 PM
spooky chat
 
No kidding. :)
 
I said something there so now I'm also hunted
 
Alright so I've done al ot of complaining about our new firewall recently but this takes the cake
Our firewall is blocking access to our VSO TFS repo
 
@ARedHerring Working for a government?
 
@chillworld no, but I do work for one of the bigger companies in the world
 
12:04 PM
Might be better suited for [Code Review](codereview.stackexchange.com) — Mathias Ettinger 19 secs ago
 
@ARedHerring I spent eight hours dev-tool-fighting last Friday due to our firewall.
 
@ARedHerring wat...
 
@ARedHerring that explains it, if you where working for government, you should find it normal already ;)
 
oh my god
I'm trying to undo all pending changes so I can start afresh
Visual studio is attempting (and failing, of course) to check the TFS server for each individual file in turn (instead of doing it all at once)
the error dialog spam is real
 
@ARedHerring I need to code with app locker on pc and no admin rights
and not talking about the network ;)
 
12:06 PM
you want something to piss you off even more?
 
Go for it @Vogel612
 
in git that wouldn't even require connection to the remote, you'd just run
git checkout -- .
 
@Vogel612 git reset --hard
or that
Yep. I know. I don't know why we insist on using TFS
 
migrating VCS is a pain
2
 
svn to git isnt so bad given that theres a bridge for it built in
 
12:08 PM
at my old job we lost retraceability through 4 major versions
and that with svn to git
 
Guys, I could do with some more answers on my post:
7
Q: Roman Numerals in Java

ambigram_makerI wrote a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially: Shortening my code. Choosing a better approach. Using better/new features of Java 8. And so on... I didn't add JavaDoc because I am expecting suggestion...

 
I just want to be able to write code without having to use VS and without having to contact the server every single time i want to make a change to a ruddyf ile
@ambigram_maker have an upboat
 
@ARedHerring upboat? lol
 
@ambigram_maker le dank maymay
etc
(I spend too much time on Reddit)
3
(and on 2nd monitor, come to think of it)
2
 
@Vogel612 I never really saw your profile pic properly. I was... [falls silent]
 
12:13 PM
@ambigram_maker I had the exact same issue and it is only when I saw it on his Github that I actually worked out what it was.
 
what did you think it was before?
 
A guy in red holding up an arm.
 
^^^^^^^
 
I still confuse Zak for some Arachnoid regularly :D
 
lol
What does mine seem like?
 
12:16 PM
I actually knew what yours was because I've seen that cartoon thing before, @ambigram_maker
Though the name escapes me Gravity Falls, right? ;-)
 
(Gravity Falls)
 
@SuperBiasedMan :^)
 
Dipper.
reverse image search to the rescue
 
Zak
@Vogel612 Wait, how do I look like an arachnoid?
 
IKR?
 
12:23 PM
@Vogel612 I used to work for a tech start-up that was founded by a guy who had invented what he thought was a better technique for image analysis/matching
 
still I regularly think you're some arachnoid with red eyes :D
@itsbruce let me guess.. he hadn't.
 
I remember at one meeting we discussed how to measure improvements in the algorithms
And he said "I don't think it can be measured objectively, only subjectively by real people".
 
how do such people get money from banks?
 
And I said "Well, we might as well give up and go home, then." After a loooong pause and blink to try and work out if he was serious
Just because he had a doctorate, didn't mean he wasn't a moron
7
 
Zak
@itsbruce I would give that all my stars if I could
 
12:27 PM
Not long after that, the other founding director hired a consultant who he thought could index the entire web for him, super fast.
 
@itsbruce Then?
 
Only the guy couldn't cope with the xml feeds I was sending him. I asked him what the problem was, because they were all valid xml and valid rss schema
 
that sounds like a good plan to go bankrupt real fast.
4
 
And he said "my xml parser expects only one xml entity per line".
 
Zak
@itsbruce What does that even mean?
 
12:30 PM
wow
 
It means that his home-written xml parser used - wait for it - regular expressions.
 
lol. My condolences.
 
I resigned without a new job to go to. Would have been crazy to stay.
 
See, that's the real power of regular expressions.... I mean, their ability to reduce complicated text to manageable fields is one thing, validation is another, but the real power is that it creates a whole industry of developers, with vast job security.... in that sense, Regex is about as powerful as Microsoft Word.
6
 
Zak
does XPath count as a form of Regex?
 
12:34 PM
@rolfl Perl has a lot to answer for
 
@Zak Hmm... interesting. I would claim not.
I love regex... I really do, it is a powerful tool to have in your toolbox.
 
@Zak No. It's much more meaningful and expressive
 
But, like most tools, it needs to be applied to the right task.
 
@rolfl Has anyone made a list for that?
 
Right tool for the jobs?
 
12:36 PM
No the right jobs for regex. :)
 
There are a lot of different jobs, and, as a consequence there are a lot of different tools.
 
@rolfl But some jobs are more likely to be filled by tools than others
 
@ambigram_maker I doubt that there's a list, but google will likely prove me wrong.
 
That's a very gracious way to say jfgi
 
That's a somewhat relevant link.
And, in case you were wondering why people use regex to handle HTML, you can thank Microsoft:
> For example, you may need to search an entire Web site, remove outdated material, and replace some HTML formatting tags. In this case, you can use a regular expression to determine if the material or the HTML formatting tags appears in each file.
Way to go, MSoft.
 
12:40 PM
Oh. God.
 
And a different ghost has replaced me in the bedroom.
11
 
0
Q: Check if value is empty upon assignment

Goldentoa11I don't really know where to ask this, but in PHP, is this okay to do? if( empty( $value = file_get_contents("some-file") ) { ... } I find that it works in my projects (5.5+), but I haven't tried it on older ones, and I'm curious if I'm going to hit any pitfalls that I don't currently see. I...

 
@rolfl At this point I am convinced that the only thing that Microsoft does right is producing bloated/bad solutions.
And over-pricing on licencing fees
> What seperates regex use from regex abuse? Take a gander at this 6.2kb monster for validating RFC822 email addresses:
Which is exactly the regex we use for validating emails. Oh boy.
> [this] somewhat pushes the limits of what it is sensible to do with regular expressions
lol
 
An interesting one, is the Java double-from-string parser.
 
@ARedHerring To prove your point:
 
12:45 PM
A failed parse produces an exception in Java.... an exception is an expensive thing to process, in Java. That's the nature of the beast.... so, in any situation where you expect parsing to routinely fail, it is better to pre-validate the string, than to parse, and catch the exception.
 
@ambigram_maker I, uh, don't know what currency that is, but 15,000 of anything seems a lot. Unless it's 15,000 Yen
@rolfl That seems.... counterintuitive is the polite way of putting it, I think
 
Rupees. Look it up INR to USD.
 
@ambigram_maker $228... ouch..
 
@ARedHerring In Java, it's intuitive, for Python, it's counterintuitive.
In Java, it is better to ask permission, than forgiveness.... (like most languages), in other languages, like Python, it is better to ask forgiveness.,
Anyway, The documentatioin for Java's string-to-double is here:
 
@ARedHerring To put things in perspective, My Moto E2 costed me 6,999 INR.
 
12:48 PM
Where they conveniently have a regex for validating a potential string is a double:
final String Digits     = "(\\p{Digit}+)";
  final String HexDigits  = "(\\p{XDigit}+)";
  // an exponent is 'e' or 'E' followed by an optionally
  // signed decimal integer.
  final String Exp        = "[eE][+-]?"+Digits;
  final String fpRegex    =
      ("[\\x00-\\x20]*"+  // Optional leading "whitespace"
       "[+-]?(" + // Optional sign character
       "NaN|" +           // "NaN" string
       "Infinity|" +      // "Infinity" string

       // A decimal floating-point string representing a finite positive
But, for those who doubt the power of regex, the regex NFA is extremely fast, even for a complicated expression like the above.
 
Holy moly.
 
@rolfl No double.TryParse in Java?
 
I get that it makes more sense to ask permission than not, but I don't get why there is no-
@JohanLarsson got there before me
 
Also are you creating the string on each call?
Turning off pattern whitespace can make beast regexes readable
 
@JohanLarsson - the regex is being built in that code there, and it can then be compiled in a static/final (constant) context.
 
12:53 PM
ah, ok I don't know any Java.
 
You only build the regex once.... in to a Pattern ... and you can then use myDoubleRegex.matches(input) as many times as you want.
 
Perfect match for a static field
 
Just feels like a hack to have to use regex to parse a number from a string because the method throws if you don't
Surely it would be better to not have the method throw and instead use TryParse
but, then, in a sense it makes sense, I don't think java has out/ref parameters
(or equivalent)
 
Ok guys... gotta go. Bye.
 
@ARedHerring No, it does not, and like most instances where the language is not perfect, this is clearly documented, and a workround given ;-)
 
12:55 PM
@rolfl it just feels lacking, but I understand why it is tehre
 
Part of the issue is that the return value is a primitive, which can't be null..... or anything other than an actual double value.
 
no ref/out, and I suppose return null would seem weird from a method meaning to parse double.. and also leave it open to interpretation
Yeah, does Java not have nullable types? I assume it did not at the time
In C# you can wrap a primitive in Nullable and, tada, now you have nullable primitives (albeit boxed)
 
Java has both nullable Object Double, and a primitive double.
 
@rolfl In .Net you can do this
There are overloads that lets you specify numberstyles etc
 
I'm voting to close this question as off-topic because it belongs on CodeReviewYuval Itzchakov 19 secs ago
 
12:58 PM
@Duga broken code
 
@JohanLarsson That makes it convenient. It would be interesting to compare performance of C# vs. Java parsing of valid, and invalid values, on the same machine.
 
I would expect them to be similar
But I would expect TryParse to perform much better than regex
 
@JohanLarsson I would not count on that.
 
It entirely depends on the implementation of Tryparse
 
It is pretty optimized
 
1:01 PM
What I am saying, is that well-crafted regex is blazingly fast.
 
Yeah, probably not a bottleneck often.
Could be for HFT
 
I'm willing to bet that is faster than regex
although all said and done, i think regex vs tryparse is a dangerously low micro optimization anyway
 
unsafe & stackalloc should make it as fast as it can be
The huge win with TryParse is that you get a thoroughly tested implementation
 
1:05 PM
and you don't get an exception thrown
kek
 
good morning
 
yeah, regex can throw
 
good monking @EthanBierlein
 
I think you should put this all in context....
 
You should probably give an example and this is very opinionated and is probably not suited to stackoverflow, but another site like codereview.stackexchange.com. Also check the tag coding-style. — artless noise 23 secs ago
 
1:06 PM
> just as the title.I wonder how to improve code style.my style is bad as it said by my manager.I try many way to improve it , but it doesn't meet the result/ [sic]
 
If you have data, which you expect to be a parseable double value... then, in Java, you can parse it, and if it is not valid, you get an exception. That's the way things should work when you expect the input to be valid.
If you have data which you expect to (regularly) contain invalid doubles, and you want to check before parsing, then you can, at the "small" cost of a regex first.
 
@artlessnoise I'd say that this is off-topic for Code Review. Chances are, the OP would post no code, or hypothetical code, both of which are off-topic on Code Review. — Ethan Bierlein 47 secs ago
 
So, Java can validate the input, when necessary, and do it at minimal cost for invalid values, and at slightly more cost for valid ones.
 
@rolfl then you do double d = double.Parse("1.2"); <- throws on bad format
 
The thrown exception is a runtime exception - no need to write a try/catch block for it.
 
dont understand x2
 
|:
its painful to watch myself struggle
 
@JohanLarsson - I am not claiming that the Java system is better than the TryParse.... what I am saying is that it's not as bad as you think it is, and that occasionally the ability to choose is useful.
 
I'm fine with single char variable names for:
- Small methods
- Mathy stuff like `var s = v*t;`
@rolfl Yeah, I wasn't hammering Java btw, was just an honest question as it comes up pretty often.
 
@JohanLarsson double d is a character from edd ed and eddy, hence the image I linked :P
 
1:12 PM
:)
 
@ARedHerring Can you spare some time to help me with a jQuery/JavaScript issue?
 
if java had a method Double.isValid(String input) and it was a fast validator, then I think the problem would be a non-issue.
 
@EBrown That really depends on the issue
 
The fact that they instead put it out as a regex code block in the documentation, is a problem.
 
ping me in javascript libaries and i'll see if i can help
 
1:13 PM
I'm having a serious performance issue.
 
In your code?
 
In my JavaScript, yeah.
 
Questions like this are a better fit for codereview.stackexchange.comcharlietfl 40 secs ago
 
0
Q: Producer-Consumer in C++ Follow-up

T145To expand from the changes supplied by the answer of my previous question: #include <condition_variable> #include <iostream> #include <random> #include <mutex> #include <thread> #include <vector> // global variables std::condition_variable cv; std::mutex mtx; std::vector<char> data; int count ...

0
Q: Car Savings Calculator

TomConibearI've created a second 'calculator-like' program, this time using the JOptionPane rather than typing in the console. At the moment the code looks to have a lot of repetition so I'm looking to simplify it; any advice and suggestions would be great! import javax.swing.JOptionPane; public class Sa...

 
1:30 PM
@rolfl mixing DOM access/ XML parsing with jQuery in a while loop, nothing to see here
 
mazes are amazing, I think that I will post a question about a maze-solver I wrote
 
keep left.
all right?
 
@rolfl what?
 
keep left, or all right, those are ways to solve mazes.
 
1:34 PM
@rolfl They can also be used for flood fill.
 
Monking
 
Monking
 
Hey @Phrancis I'm kinda wreaking havoc in the "Welcome to The 2nd Monitor" post on meta..
you are stopping me in the case I am overzealous, right?
 
I am? Guess I better have a look ;)
 
3 one-liner edits?
Such havoc.
Wow.
 
1:39 PM
I was more on about the answer.
 
O.
 
Wow, you weren't joking @Vogel612 ;D
 
In general, only questions about non-working code are on-topic on StackOverflow. See codereview stackexchange for a site devoted to reviewing working code. — Paul Hiemstra 31 secs ago
 
0
Q: Unsafe Node.js code, though in a trusted environment

duci9yI am going to run a private Node.js app in a local network which will take user code submissions and evaluate them. Since it is a trusted environment (just friends), I have not bothered at all about any kind of security. I am new to Node.js and this is only my third app. I am seeking review of t...

0
Q: Determining the area of a circle with class areaCircle

ADKCourageThis seems to be throwing several errors. I am sure it is most likely a simple error since this is only the seventh or eighth program I have compiled, but I am unable to see where the error is. I was hoping someone here might be able to assist. // Assignment 4: 5.20 CircleArea.java // Program de...

 
1:42 PM
Meta is "serious ****ing business", this is the internet after all!
2
 
You know, you could always just have written a separate answer, I don't know that Quill's answer was designed to be canonical
 
I kinda requested it be made canonical
 
@CaptainObvious seems okay if not a bit ugly
 
I asked yesterday whether I could get a CW conversion on that Q&A and tagged it
 
> Since it is a trusted environment (just friends), I have not bothered at all about any kind of security.
 
1:44 PM
and is only under exceptional circumstances multiple answers
 
he has opened remote code execution over his network and hasn't bothered with security?
oh dear
 
malloc(std::null)
actually.. that might work.
 
@ARedHerring I see no way in which that could go wrong
 
So, questions/people like this confuse me:
-1
Q: Determining the area of a circle with class areaCircle

ADKCourageThis seems to be throwing several errors. I am sure it is most likely a simple error since this is only the seventh or eighth program I have compiled, but I am unable to see where the error is. I was hoping someone here might be able to assist. // Assignment 4: 5.20 CircleArea.java // Program de...

 
@skiwi quick, think of a C++ oneliner that results in a panic-screen!
 
1:49 PM
Here you have code that is so close to working..... literally 1 character wrong.
Then, the error message is quite clear.....
How can you get to the point where you can write that much code, but not yet read the error message?
 
I got a formatting puzzle, given a maze where corridors are 2 wide, how can I shrink it to be a maze where corridors are one wide? Seems no easy task
 
0
Q: Temperature Converter With Modern C++

JohnbotInspired by an earlier question I've made a temperature converter that can convert from one temperature to another and optionally output a series of conversions. This was made in Visual Studio 2015 but it also compiles with g++ and clang++ on Debian with no warnings. Usage tc.exe -40 c f Celc...

 
you'd basically have to "zoom out"..
 
@rolfl Maybe they are just writing code in Notepad but not running it?
 
> This seems to be throwing several errors. I am sure it is most likely a simple error since this is only the seventh or eighth program I have compiled, but I am unable to see where the error is.
When I run it, the exception is:
Exception in thread "main" java.util.IllegalFormatConversionException: d != java.lang.Double
with a trace pointing to the offending line.
 
1:53 PM
Crap, now it's really broke.
 
What's the difference between %d and %f?
 
%d is for printing integers, %f is for printing floating-points.
 
Ahh
integer == double?
 
This cmes from the C / unix conventions where this printf all comes from
d -> digits
f -> floats.
 
digits is a terrible name for integers
 
1:54 PM
Has anyone tried the little IDE Visual Studio Code?
 
Saudi Arabia, who is the head of the UN Human rights council, is going to crucify a 17 year old boy for illegal protesting. Well. I'm done with the internet today.
 
oh cool
 
@Caridorc Expecting an amazing question
 
when was the last time we had a crucifixion of minors?
 
Printf format string (of which "printf" stands for "print formatted") refers to a control parameter used by a class of functions in the string-processing libraries of various programming languages. The format string is written in a simple template language, and specifies a method for rendering an arbitrary number of varied data type parameters into a string. This string is then by default printed on the standard output stream, but variants exist that perform other tasks with the result, such as returning it as the value of the function. Characters in the format string are usually copied literally...
 
1:56 PM
@itsbruce I will test and document it some more for now
 
Apparently d -> decimal, and is synonymous with i. (for output)
 
@Vogel612 crucifixion
I've always thought it was d for decimal
and i for integer
 
I have been using d for years, but I should probably use i.
Regardless, the OP should be using f....
... Hmmm.... Java does not have i as a synonym to d.
 
2:11 PM
@ARedHerring I think Rivets might be slower than my loop...
Nevermind, my XML was borked.
 
if what you are looking for is a code review please post on the code review stack instead. — e4c5 17 secs ago
 
@EBrown I guarantee you that whatever bottleneck you have, it is not Rivets.
 
0
Q: Creating a search filter in c# (Access database)

friend in needHELP :( I am making a search filter. I have 1 combobox and 3 textboxes... (Item,Brand,Color) and what i want to happen is when i type in one of those textboxes and clicked search if any of it matches what's in my database it will display the description, price and item in the other textbox

 
The new problem is that I cannot get rivets to display each item number.
(Though, it creates the correct number of rows.)
 
2:32 PM
@EBrown rv-text?
 
I've tried a bunch of combinations, none of them have worked yet.
 
Can I see your template?
 
Yeah, I'll post it in the JS room.
 
Update on our TFS proxy issue. Still blocked, and now my colleague is having to manually copy files from hsi PC to mine so Ic an undo some changes.
This is not how source control should work, kids
 
I call you to initiate a local git repo
 
2:43 PM
I would, but unfortunately the code won't compile outside of TFS( i.e, using command line tools either)
And no one else in the organisation uses git
screw it, I'm going to do it anyway
 
Is anyone bothering to fix that proxy issue?
 
that's what allowed me to stay sane when I had to switch between 3-7 tickets simultaneously under SVN..
 
@skiwi Apparently, but because I'm an internal user its not like I have an SLA.
 
local git repo and just commit when I got it finished...
 
@Vogel612 I'm basically going to do the same
TFS makes me want to do macro-commits anyway for some reason
 
2:46 PM
@ARedHerring It's bothering th ecompanies effiency though
 
@skiwi if efficiency were a problem, we wouldn't have to be writing JavaScript in Visual Studio.
2
or doing all of our development in a Citrix virtual environment because we have to support Ie9 despite all of our franchises using IE11.
 
Finally!
It works. :)
 
I'm glad @EBrown :-)
 
So am I.
Though it doesn't seem any faster.
 
How slow are we talking here?
 
2:49 PM
Takes about ~5 seconds for 280 elements.
 
While that is very slow, have you considered not rendering 280 tr at the same time...?
 
Business requirements mandate this.
The owner doesn't want any pagination.
 
The owner is an idiot (with respect)
And you're sure that section of code is the bottleneck?
And not the whole sending-280-elements-via-XML-over-the-wire deal?
 
Yeah, the elements get here in <1 second.
But the rivets bit takes about 5 for them to render.
 
No.
It takes the rendering plus the parsing of the XML 5 seconds.
@Vogel612 excluding a very large portion of the repo... 1747 objects.. welp...
 
2:53 PM
Yeah, this is too slow.
 
You need to actually identify whether the bottleneck is rendering or parsing that XML
DOM rendering is slow, but creating 280 elements should take less than 1 second
 
Oh wow, found the bottleneck.
 
I mean, the average for creating 1 element is a few milliseconds on my PC.. 10000 elements takes an average of 56ms per element. It's not blazingly fast, but it's still not 5 seconds slow.
 
It's the jQuery .parseXML method.
 
@EBrown jQuery? Slow? you don't say.
 
2:55 PM
IIRC there's vanilla JS for working on XML based responses isn't there?
 
@Vogel612 Looks like it.
 
@Vogel612 yes, jquery's parseXML is just a wrapper around the vanilla JS one with some extra sugar
 
lol. I remeber parsing 200 elements into dom in ~.2 secs
 
1
Q: Dead-end filling maze solver in Python

CaridorcI was reading Wikipedia about maze-algorithms, and I decided to write my own maze-solver. It uses dead-end-filling as it seemed simple to implement (it seemed, I said). The code I wrote is pretty massive, 179 lines including documentation and tests, but I like that it solves my easy examples. I...

 
but that was only after waiting for roundabout 25 seconds for the damn server-side to retrieve the data and build the response.
 
2:57 PM
Right.
I'm willing to bet $10 that your bottleneck will be parsing that XML rather than Rivets
Rivets is very fast
Never mind that rendering 280 rows of 10 elements each is pretty silly anyway
 
I have a regexp problem:
find: (A)to(B)
replaced sample: A2B
what is the replace regexp? $12$2 do not yield what I want
 
@jvchn I am very tempted to kick you. This room is not the right place to ask unsolicited questions about code.
 
@Vogel612 To be fair, the first time he asked his question was deleted without anyone telling him.
 
but since we're nice people, here's a tip.. You can only replace what you captured
 

« first day (870 days earlier)      last day (3133 days later) »