« first day (495 days earlier)      last day (3525 days later) » 

10:00 AM
Sorry, I'm too tired to run
 
So the callee doesn't necessary know whether it is receiving a lambda or an implementation of RUnnable/Consumer<V>
That's why I'm calling it the strategy pattern - to the callee, that's exactly what it looks like
 
Erm... that's an implementation of.
 
The example I gave is an implementation of Function<I,O>, but this again is an interface that could be either a lambda or just an implementation of that interface
Further:
> State/Strategy Pattern - I group these together because they are structurally equivalent, just different in intent. Strategy usage become much more common because it is easier to implement. You don't need a parent strategy and strategy subclasses, you just need functions. So it is simple to just pass a function as a parameter, which in effect is using the strategy pattern.
27
Q: Which GoF Design pattern will be changed or influenced by the introduction of lambdas in Java8?

Mario FuscoMany claims that the biggest part of the GoF design patterns are just workarounds for the absence of first class functions. Now that Java is about to get lambda expressions, which of those patterns will be influenced by them? Which ones can be dramatically simplified or generalized? And which one...

 
So it might still need refactoring
//TODO add support for non-Dutch data
public static List<String> searchCocNumbers(final TessResult tessResult) {
    SearchStrategy searchStrategy = new SearchStrategyBuilder(CocNumberValidator.getRegex())
            .removeRegex("[^a-zA-Z0-9]")
            .validator(CocNumberValidator::validate)
            .build();
    return tessResult.findWordsForceFitRegexInTextline(searchStrategy)
            .stream()
            .flatMap(forceFitTextLineSearchResult -> forceFitTextLineSearchResult.getInformation().stream())
 
Note that I'm not saying lambdas (higher-order functions) are the strategy pattern, but that you can use lambdas to achieve the strategy pattern
 
10:06 AM
eeehh
.removeRegex("[^a-zA-Z0-9]")
newlines, unicode characters, tabs, spaces, punctation... you want all of that gone?
 
Now you might see why I like Java 8 that much, because this would be absolutely horrible to code in Java 7
@Pimgd Yes, I don't care about those in this use case :)
 
I dunno, I just see two lines of VERY LENGTHY code.
2
 
Hmm
> Travis CI provides OpenJDK 6, OpenJDK 7, Oracle JDK 7, and Oracle JDK 8. Sun JDK 6 is not provided, because it is EOL as of November 2012.
Isn't Java 6 still supported?
 
I have no idea how to alter that code of yours, it looks scary
What's not helping is that you're not consistent
 
@skiwi No, it is not.
 
10:11 AM
That :: operator is awesome.
(first time I've seen it)
 
or are you? Yeah you are consistent...
I just couldn't see it between all the parentheses.
 
You cannot code in Java 8 with streams using 80-character limit in my opinion ;)
 
thus streams suck
 
But the whole 80-charachter limit is bull in these days in my honest opinion
If you want to make concessions on readability, then the 80-character limit works
 
//TODO add support for non-Dutch data
public static List<String> searchCocNumbers(final TessResult tessResult) {
    SearchStrategy searchStrategy = new SearchStrategyBuilder(CocNumberValidator.getRegex()).removeRegex("[^a-zA-Z0-9]").validator(CocNumberValidator::validate).build();
    return tessResult.findWordsForceFitRegexInTextline(searchStrategy).stream().flatMap(forceFitTextLineSearchResult -> forceFitTextLineSearchResult.getInformation().stream()).map(possibleWord -> possibleWord.getSymbolChoices().stream().map(SymbolChoice::getSymbol).collect(Collectors.joining())).distinct().collec
yes, very readable.
 
10:14 AM
I wouldn't recommand that ^
:)
 
shame my browser can't handle your 334 character line.
 
My own rule is that a line should be no longer than 3/4th of my editor window inside an IDE on a 1600x900 resolution
 
There was some text I read a while ago, detailing various situations, going like "If you've experienced x, seen y happen, watched as z came to pass, (insert 20 more items here), well, then you'll know what it means to be a privateer, my son."
That stream code of yours is only missing the last bit.
It doesn't provide breaks, instead uttering a full sentence, subclauses and all, taking only a minor breath with each comma, ever so slightly turning a distinct tint of blue from asphyxiation, before finally ending the sentence with a soft, but resounding, semicolon.
2
wheeze
=D But anyway
I wonder whether there's a good benefit to them.
 
@Pimgd The benefit is that code not using streams is five times more ugly
 
We write SQL like code and it's perfectly readable
 
10:25 AM
And non-stream code is more error-prone
 
But you can also build it with a long chain of methods
 
@skiwi consider putting each .function() on a new line, perhaps? might make it more presentable
 
@DanPantry It's what I generally do
 
SearchStrategy strategy = new SearchStrategyBuilder(...)
    .removeRegex(..)
    .validator(..)
    .build();
 
@Pimgd Do you mean that literally?
 
10:26 AM
ah right
 
Now I'm starting to wonder whether everyone here is seeing those new lines...
@DanPantry That's just a regular builder pattern though :) But same applies
 
@skiwi: it's more presentable with new lines, that's all I'm saying, it's the exact same code that you already have
 
List<String> distinctStrings = obtainStringsFromSomewhere.stream()
    .distinct()
    .collect(Collectors.toList());
^ What is easier than that?
@DanPantry Uh... I am having the new lines
 
Ah I only saw @Pimgd's verison of the code and basically didn't see them. woops
 
public static List<String> searchCocNumbers(final TessResult tessResult) {
    SearchStrategy searchStrategy = new SearchStrategyBuilder(CocNumberValidator.getRegex())
            .removeRegex("[^a-zA-Z0-9]")
            .validator(CocNumberValidator::validate)
            .build();
    return tessResult.findWordsForceFitRegexInTextline(searchStrategy)
            .stream()
            .flatMap(forceFitTextLineSearchResult -> forceFitTextLineSearchResult
                     .getInformation()
                     .stream()
Maybe like so?
 
10:28 AM
@Pimgd I find it clutters in the code length if you do it like that, though I am using very simple constructs here (once you are familiar with Streams), for anything non-simple I use the more lengty-way
 
There's multiple ways to respond to that but I'm a bit of a jerk
He thinks it's SIMPLE what he's doing?!
dude wat
 
@Pimgd .map(possibleWord -> possibleWord.getSymbolChoices().stream().map(SymbolChoice::getSymbol).collect(Co‌​llectors.joining())) is quite simple, it's just a shame it needs to be written in such ugly way
 
It's not written simply, which is what I think @Pimgd is getting at. wtf I just back-ticked a name
 
You actually transform a List<SymbolChoice> to a String mapping every occurrence using the function SymbolChoice::getSymbol, and then joining them
 
Personally I think you're abusing the chain functionality.
 
10:32 AM
It's a shame in my opinion that you need to go through the Streams-api here, as mapping a List<X> to a List<Y> using a mapper Function<X, Y> and joining a List<X> to a string using a mapper Function<X, String> seem to be very common operations
 
0
Q: Ruby: Breaking a chess coordinate given as a string into a 2D array

O.F.Given a chess coordinate as a string (e.g. "a1") I'd like to transform it into a 2-D array (so, for "a1" I'd like to get [1,1]). Here's what I came up with: def safe_pawns(pawns) pawns.inject([]){|res, pwn| res << [pwn.split('')[0].index(/[a-h]/) + 1, pwn.split('')[1].to_i]} end Can anyo...

0
Q: expect vs should

Ryan-Neal MesPlease can someone explain to me how I should go about deciding whether to use expect or should syntax for my rspec examples. From my understanding we should no longer be using the should syntax. The replacement is to use expect().to or is_expected.to Is this correct? On some really good ref...

 
if that's common... then why not craft a function that does just that?
3
 
@Pimgd I probably need to do that :)
Only I learned to live with it now already, which is bad
Lunch break!
 
That's it, really. That's how you're abusing the chain functionality; it makes it look like one whole
But basically it's a long chain of assigning to a variable and passing it into the next thing
I would go for lunch but all my co-workers are still staring at their screens for some reason
 
Shoult "OMG, it compiles", then say, who's for lunch?
 
10:36 AM
@Pimgd that confused me until I realized timezones exist
 
I'm not working on code ATM
which is nice, anytime people look at my screen I can pull up the design tool with my diagrams and stare at it, thinking
2
... it needs more lines.
 
@Pimgd i occasionally do this with code. i look atthe same code and humm and harr and it looks like i'm being productive
 
Meanwhile I'm actually hungry =/
 
11:05 AM
Meanwhile my number of server applications is increasing, and clean building and uploading all 10 by hand is not really nice
And the worst part is that I'm human
I forget things
 
Jeeeenkins....
Continuous build integration!
 
@Pimgd Not a possibility here at work :(
Would be nice though if it were that easy
I think the closest I can get is to use some Maven script and upload a whole directory to the server by hand
 
You have ant, yes?
 
Yes, but I like Maven more ultimately
Netbeans uses Ant by defaut though
 
All I did with Jenkins is start up a ant script that builded all the projects. And I used Jenkins to hook it up to git.
you could save it as a console command of sorts.
You can even move files to the server with a console command, I think
 
11:13 AM
Is it okay to do a git pull (or rebase) on a testing (or even production?) server and then execute a build step?
 
Depends? Do you normally compile on your testing or production server?
If you build local then upload the files then do that. Have it run in the background... Ideally on some build server if it's big
 
Currently my code is not on production yet, and having the test server since a few weeks, I manually copied over compiled jars to there for now
Can you run Travis or Jenkins on your own server if you want?
 
yeah?
All it takes is financial justification, which is pretty easy.
 
As far as I know Travis CI runs on a remote server
 
A co-worker spends 5 minutes twiddling his thumbs everytime he needs to make a new build for the testing server
there's a LOT of builds like that.
 
11:17 AM
The 5 minutes is a good or bad thing?
 
Bad
You hit build and for the next 5 mins you can't even browse the internet with chrome
 
@skiwi you can have jenkins poll your git-repo for commits
 
@Pimgd Wait what?
 
then you make him automatically pull the changes into a workspace on testing env.
 
@Vogel612 Yeah, but say the company doesn't want the code to go outside their company domain, that's kind of the situation I feel I'm in
 
11:18 AM
Oh
Like that
 
2
Q: Thumbnails for bootstrap carousel jQuery plugin

SrleCodepen: http://codepen.io/srkimir/pen/mGbrf Github: https://github.com/srkimir/thumbnails-carousel While you slide left or right appropriately, thumbnails gets selected and change their opacity to be different among others thumbnails. You can also click on thumbnails to show the appropriate i...

 
Host your own internal server.
 
and jenkins can then build and deploy it
@Pimgd and that, yes....
 
and yes, git is the outside world.
 
@skiwi A linux server VM for testing stuff is not that hard.
@Pimgd *cough*
 
11:19 AM
well github is, my bad
Anyway, you'll be happy that it's in the outside world
 
I think I myself would be comfortable with github + travis "looking" at my code though if I had my own company, obviously on private repositories
 
Because the alternative is the building burning down and gone is the code
 
hehe 125 Rep on SO today :D
 
@Pimgd That's not of an issue where I work, code is first of all all located somewhere in the magical cloud, and there's backups around somewhere as well
 
My first day at work: "Ah, so you've got a whole cloud-based online service platform?"
 
11:23 AM
Once I've done some tests I think I'll spend a bunch of my time on creating a workable local testing, staging and production system
 
"No, we just call our server 'cloud', it's a marketing thing"
2
 
@Pimgd lol
I'm so done with manually adding all kinds of dependencies to my projects
 
I've taken to not calling it cloud, instead referring it to the "online platform". Maybe the cloud thing will die somewhere along the way.
 
Actually, I have a good argument now
Is there any reason why the magical cloud would be less evil than github and/or travis?
The code is outside of the company doors already either way
 
Wait, you guys work for companies that host source code on the Internet?
 
11:27 AM
@nhgrif Time for technical terms...
 
▲▲
 
Internet = Somewhere anywhere? And world wide web = Accessible via an URL, right?
If so, then Internet is correct
 
@skiwi why no? make the magical cloud only reachable from the internal company network
@skiwi add publicly for the internet...
I can, you can, he can, she can...
 
There's a difference between Internet and intranet.
 
▲▲ that
 
11:29 AM
But the "intranet" is hosted in the cloud, which is a domain accessible via VPN with the correct credentials
 
If it's hosted in "the cloud", it's not "intranet".
 
@skiwi would you mind kicking your network-admin in the balls from me?
 
It's internet.
 
@Vogel612 I might get a bad reputation if I would do that
I don't see what is directly bad with the Internet though, I do know of the risks
 
Being on a server doesn't make something in "the cloud"
 
11:30 AM
@skiwi alternatively kick the CIO / CSO, because they didn't stop them from doing theis.
 
It's when that server isn't local and requires Internet to access it that it's bad.
 
What exactly is bad about it? In your opinion
 
Risks aside, you're done working any time the Internet dies.
 
@skiwi you mean, aside from the possibility of company data being stolen and losing ownership of your data?
 
@Vogel612 Are those realistic issues if you're a low profile organization?
@nhgrif That's a risk yes
 
11:32 AM
Yes.
Those are realistic issues.
 
Doesn't Github for example also use Github?
 
I mean, honestly it's not that hard to setup a clustered server with some OSGi / Hypervisor to take care of your servers.
@skiwi you sure you can find all of the internal github data in github repositories?
 
Unless you have zero competitors, or your product is so terrible that any competitors you do have think there's literally nothing to gain from your product.
 
@Vogel612 But you need all technology and expertise yourself... You cannot have another person/company monitor them for you, because then they need to be accessible via the Internet
 
A huge chunk of github is open source.
 
11:34 AM
I really wonder if Github uses private Github repositories for their private stuff
 
@skiwi um... we're a 200 ppl. company, and we got 7-10 dedicated people for technichal stuff, networking and the like.
@skiwi I honestly doubt it.
 
@Vogel612 There's the issue, here there are I think 2-3 people doing technical stuff in a company of 40 tops
 
@skiwi then make them have one guy to set this up..
 
Are all 40 people in the same building?
 
the initial setup takes about a day at max, when you got the infrastructure up.
 
11:35 AM
If you're all in the same building, there's ZERO reason to not be on Intranet.
 
@nhgrif Nope, two or three buildings, one here and others in India (other department)
 
and as you guys seem to not have any infrastructure yet, you don't have to give a fuck about already existing servers, that need to keep running.
@nhgrif actually even if they aren't there isn't really a reason.
 
That's actually the first issue, how do you set up your intranet servers @Vogel612 if it's not possible to be on the same connection?
 
stuff like that should be tunnelled to the internal net.
@skiwi sorry but that's BS...
 
My company shares a network with our two sister companies. It's 10 buildings in total. Two buildings on the south side of town, 8 on the north side.
 
11:37 AM
-1
Q: bracket matching

user52907 Brackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. Brackets refer to different types of brackets in different parts of the world and in different contexts. Write a program which reads a String, which consists of alphabets [a-z, ...

0
Q: Average of averages

AngeloI need to get the average of multiple averages calculated basing on data on a sql database. To do that, I'm using this code: $a = mysqli_fetch_assoc(mysqli_query($connessione,"SELECT AVG(voto) AS mediaa FROM values WHERE type ='a'")); $b = mysqli_fetch_assoc(mysqli_query($connessione,"SELECT AV...

 
@Vogel612 So if you tunnel things, then it needs to go via the Internet? Or not
 
@nhgrif I bet you are actually tunneling the networks
 
Okay...
 
@skiwi well It goes via the internet, but it isn't necessarily on the internet
 
11:38 AM
Yeah.
 
How else am I going to get from internal, to some external IP?
 
With some dongle!
And a VPN connection
remote desktop
 
Well, when I say the same network... I mean, I'm not networking guru.
 
and ALLLL that other crap
 
@Vogel612 Still a risk vector (oh fancy words!), someone could get the connection and force access
 
11:38 AM
@Pimgd actually that's already about it..
@skiwi yea sure if you'd be bull retarded about it and not encrypt or secure it in any way.
 
Oh. Anyway, the Ministry of Defense does that in the Netherlands.
 
and it's definitely less of a risk-vector than putting your stuff into the cloud
 
@Vogel612 Then back to the starting point... What is the difference we are talking about internal vs cloud? Is it the fact that cloud has access to the code itself as well?
 
There's a cap on how much people can work at the same time because they don't have enough bandwidth.
 
@skiwi no the difference is the accessibility of network
internal is by definition only reachable if you're physically present at a trusted location
 
11:40 AM
Plus, there's the fact that the code itself is on a local server so you could access it if the internet went down. In a setup like this, I'd probably keep a copy at each location.
 
and your cloud could be hacked from anywhere
@nhgrif I'd say that depends on how many people sit in the different locations.
 
What happens if the Internet goes out? Do you guys take the day off?
 
additionally you could introduce a distributed server-system
 
@nhgrif I believe there are quite some measures to ensure that there are multiple providers, etc.
 
If the internet dies work is significantly impaired.
 
11:42 AM
But developers also have their local repos, so nothing big is lost
 
You can say it shouldn't be.
 
For those interested, a new editing feature is now available if you need it.... you can start numbered lists in MarkDown at numbers other than 1.
3
 
It would be just very uncomfortable
 
But there are so many things I rely on...
Email and google to start with.
2
 
@skiwi say someone trashed your router....
 
11:45 AM
@Vogel612 Then there would need to be a new one
Is it even realistic to assume the Internet would be down for a prolonged period of time? And attach unique risks to that
You probably work with other developers and companies, and they might rely on the Internet to work, and if you do not get stuff from them, you are screwed either way
 
I think that for a company, having the internet be down internally has less risks than having the internet down externally.
That is, if you can't google stuff, but your website still works, it's not a big deal.
But if it's the other way around... red alerts everywhere.
 
@Pimgd at least for our company it's irrelevant
if the internet's down, it's red alerts everywhere.
 
Oh, if the Internet would go down, I'd just check a news site to confirm it
Right? ^
 
If the internet in general is down you'd see some interesting psychological and social effects
 
but (almost) the complete network infrastructure is designed redundant
 
11:49 AM
You could write a cool book with that
 
@Pimgd how are the odds you're not the first to think of that??
 
It's a very interesting thought experiment
Uhm pretty high actually
now I want to read a cool book about it.
 
Either way
If 1) Your company's net would go down, it would be fixed in a matter of days worst case, 2) If the Internet would go down, your IT-company would be screwed either way
I do not see the risk, assuming you always have some kind of local stuff around with which you can fiddle around
 
@Malachi s/your/you're/ in and your well on your way to a Customized Digital Christmas Letter .... ;-)
let me edit that, wrong Ma.
 
Ma, the autocomplete is acting up again
 
11:56 AM
@skiwi . Yes, it's realistic. You know how fragile the Internet really is?
 
@SimonAndréForsberg Yes, but the point more is that you will most likely still be in trouble as there is no communication with your consumers either way
 
It's a really bad target to strike at if you're a geographically bound group though.
 
@SimonAndréForsberg DDOS with IP-Spoofed DNS and Time requests.
 
@skiwi s/consumers/customers/ ?
What @Vogel612 said ^^
 
11:58 AM
@SimonAndréForsberg Yeah..
 
monking @all
 
Monking @Duck, @RubberDuck
 
It's a pretty nice explanation.
 
I like that guy.
 
yea he's got the coolest accent of these guys ;)
 
12:00 PM
@Vogel612 I remember years ago when Computers were running Windows 98, if I used a Linux computer I could issue a flood-ping, and violà the Windows user couldn't do anything at all.
 
That image though... it feels all sorts of fake technical.
 
well the real fun starts at 6:30
 
I like that guy.
 
I like that duck.
4
 
12:17 PM
I feel like I could fall asleep at any moment...
^ Not good when I'm at work
 
@skiwi y'know what, let's go grab a coffee together ;)
2
 
@Vogel612 I can grab coffee sure, but I don't drink it
 
So, question.
I want to break this Utils static class into several more meaningful ones.
I have a bunch of global behavior for different form events.
Do you think FormEvents is an okay name?
 
It looks fine on first glance
 
@RubberDuck Depends on what it contains.
I don't like coming up with naming suggestions though.
FormEvents, FormUtils, FormEventUtils, EventUtils... you name it!
 
12:32 PM
Well, I pass the methods in it an instance of a form and it handles the events rather than duplicate the same code in each form.
But I'm bad at naming!!
 
Everyone is!
 
And people around her tend to scowl at me anytime I mention that I have a Utils module...
 
@RubberDuck It's not a pain... Until you start to publish things ;)
 
Hmmmmm..... okay. FormEventHandler sounds like a good name.
 
12:48 PM
Monking Mug.
 
Mugging Monk.
 
You've earned the "Nice Question" badge (Question score of 10 or more) for "Javascript Minesweeper (with Stack Snippets!)".
3
Hmm... I got an upvote on a SO answer I don't even remember having written...
2
A: Java code for to accept 7 bit ascii characters

Simon André ForsbergThere is the '\x' way of entering numbers hexadecimally: (Source http://www.regular-expressions.info/reference.html ) yourString.matches("[\\x00-\\x7F]+"); In Java this might be: yourString.matches("[\\u0000-\\u007F]+");

Not one of my best SO-answers I think...
But apparently it helped someone today.
 
This code reeks....
EnableDisableUnIntializedFormControls(ByRef Caller As Form, ByRef pbar As Form_ProgressBar)
Enable Disable blah blah blah
4
 
@RubberDuck U what?
 
12:55 PM
Hey all, quick question about site scope
 
Hello @wnnmaw
 
Hello @wnnmaw
 
I just tried to pronounce your username... wasn't easy.
 
Say I have two methods of performing a specific action, with working code for both, is asking which method is better on topic for the site?
 
Am I really the third person to post a live Code Snippet for review? meta.codereview.stackexchange.com/questions/2467/… At least my tiny piece of code has the bonus side effect of overflowing the stack (with large enough input.)
 
12:56 PM
@SimonAndréForsberg, yeah, I picked it a long time ago before I realized that phonetics are cool, I usually go with "win-maw"
 
@wnnmaw Yes, it can be on-topic. Assuming that you provide enough context, and that you post your real code. (We don't like to see stripped-down examples)
@wnnmaw win-maw, much easier. Thanks.
 
How much to strip down? Is there a Meta FAQ on that?
 
@SimonAndréForsberg, well that's what I'm struggling with, I'm trying to decide if implementing the second method is worth it in my 8.5k line code, so how stripped-down can I go before I irk someone?
 
@dcorking It seems like you are!
 
12:58 PM
where's @dcorking 's code
 
@wnnmaw is your method really 8.5k lines of code??
3
 
@Pimgd where is whose code?
 
@SimonAndréForsberg No, the method is 2 lines, but its used all over
 
well...
 
wtf method of 8.5k lines?
 
12:59 PM
I've made my project names look less aggressive
 
I wanna see the 8500 line method
 
not really OO I think ^^
 
strip down the lest possible, but as much as needed
 
16
Q: Why is hypothetical example code off-topic for Code Review?

200_successAs stated in the Help Center, one of the criteria for a question to be on topic is: Is it actual code from a project rather than pseudo-code or example code? What is the rationale for that rule?

 
Post it as a separate question, I wanna rip it apart
 
12:59 PM
OO is not the only game in town ;)
3
 

« first day (495 days earlier)      last day (3525 days later) »