« first day (516 days earlier)      last day (3800 days later) » 

11:01
@SimonAndréForsberg I thought you knew this.
@Heslacher I didn't know it until now.
Each day one learn a little bit more ;-)
I've been looking at alternatives for hosting your own maven repo on Github, but that seemed like a bad idea. Then I googled for how to host your maven repo on Tomcat, but that returned more results about how to use the Tomcat plugin for Maven, turns out a simple webserver with FTP access was enough...
So you use sonatypes's nexus ?
@rolfl Okay, then I'll need to wait until I'm home so I can replug it and hope it works
@SimonAndréForsberg Huh? Why don't I know that?
11:10
0
Q: Code igniter uri routing with id

vajiko prangishvili=======controller class Event extends CI_Controller { public function index($id = null) { $this->load->view('header'); $this->load->model('get_event'); $data['results'] = $this->get_event->getall(); $this->load->view('event', $data); } public function look_up() { echo $id; } ========routes...

@skiwi Because you never investigated it?
@Heslacher I'm using this and this. The repository ends up at zomis.net/maven
@SimonAndréForsberg Ok
@SimonAndréForsberg What is the use of it then?
Hmm, a Map<K, V> is not serializable?
11:30
It is if it is a HashMap.
and all the members are Serializable,
(or a TreeMap).
@rolfl Okay, is there a good way to deal with it?
Currently my SerializationProxy has a HashMap and uses the putAll to put the properties of the class
I want to punch myself in the face now... After debugging 15 minutes, I see this
public class OffsettedObject implements Serializable {
    private static final long serialVersionUID = -3938499459539549043L;

    private final Object object;
    private final int offset;

    public OffsettedObject(final Object object, final int offset) {
        this.object = Objects.requireNonNull(offset, "offset");
        this.offset = offset;
    }
Does your IDE not come with the warning "unused argument"?
    public Object getObject() {
        return object;
    }

    public int getOffset() {
        return offset;
    }

    @Override
    public String toString() {
        return "[" + object + ", " + offset + "]";
    }
it's still unused
@Pimgd Not if I am calling those other methods perhaps?
11:38
Irrelevant
and by default it's initialized to null as it's a class parameter
unused argument
not unused class member variable
Ah
Well yes, it looks like it should complain
if it doesn't, find your IDE's issue board and upvote or create the issue
Eclipse has option for it already
12
Q: Showing warning for unused method parameter?

BradI am using Eclipse v3.5. In previous Eclipse versions i remember if i have defined a method with a parameter and didn't use it internally a warning appears, like this : public void myMethod( int x ) { // Didn't use x here so a warning appears at the x parameter. } But in v3.5 i do not see t...

0
A: Speeding up storage of about 220000 values in Core Data

nhgrifTen seconds for reading/writing nearly half a million lines from/to disk is actually relatively decent. The autorelease pool doesn't actually slow us down. Autorelease pool is handled by the preprocessor. So is ARC. Instead of us manually writing our release/retains, ARC, or autorelease pool,...

11:44
Even FindBugs does not catch it using the default options... That's kin of awkward @Pimgd
Netbeans might tell you why...
> Yes, this was disabled after 6.0 for non-private methods, as way too often there is nothing that could reasonably be done about this: e.g. the method may be called from a lot of places. It was too annoying to see unused parameters that couldn't practically be fixed.
@skiwi You can use mvn deploy to deploy the project directly to the webserver, and then other projects can use it as a normal Maven dependency. What is not the use for it?
@SimonAndréForsberg So it's a sort of development server then? Because ideally once you finished, you want to put it on mvnrepo and sorts
@skiwi ... Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:findbugs-maven-plugin:3.0.0:check (execution: analyze-compile, phase: compile) ... wat???
@Vogel612 I'll need to see the full pom for that..
11:51
it's 470 lines long...
0
Q: Multithreading synchronization between reading and writing in a channel

TimI was hoping to get some feedback on what the recommended design pattern are for this subject. public class Channel { private AtomicInteger buffer = new AtomicInteger(0); public void read() { // This function should keep blocking until there is something to read. while...

and I only changed as you described earlier today...
this error is in you plugin configuration for finbugs analysis...
@Vogel612 That's a classic Eclipse bug, simply wrap all your <plugin> tags inside a <pluginManagement> tag
I've never seen that error
@SimonAndréForsberg lemme just get the m2e findbugs plugin connector before doing that..
11:54
303
Q: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

Andrew WhiteI am trying to work with Spring Data and Neo4j. I started by trying to follow this guide linked to by the main site. In particular I based my pom.xml off of the Hello World example file. Here is a snip from my pom.xml for the plugin that is causing the issues... <plugin> <!-- required to resolve...

@skiwi It is a real repository. It can be used for production use as well. Bukkit for example uses it, as can be seen here: wiki.bukkit.org/Plugin_Tutorial#Reference_the_Bukkit_API
I see, I still think released software is best at mvnrepo though
There must be a way to refactor this to look more clean...
//calculate property offsets
Arrays.stream(TemplateProperty.values())
    .forEach(property ->
        scoreFunctions.add(invoiceDataSet -> (invoiceDataSet.hasProperty(property) ? Math.max(-10, -invoiceDataSet.getProperty(property).getOffset()) : 0)));
Right now when I see this I think: WAT
invoiceDataSet needs a getPropertyOrDefault method
Arrays.stream(TemplateProperty.values())
    .forEach(property ->
        scoreFunctions.add(invoiceDataSet -> Math.max(-10, invoiceDataSet.getPropertyOrDefault(property, 0))));
@SimonAndréForsberg I'm retrieving the offset of a property though
Well, I'm quite sure you'll be able to extract a method somehow anyway
Yeah, without method extraction this doesn't seem a good idea
Might be better to even get rid of the stream
There's nothing bad with looping over an array
12:07
What am I reading? @skiwi NOT using a Stream!?
My new approach..
I still think streams are stupid because they require that everything changes
1. Create code trying to minimize Java 8 usage to the bare necessary. 2. Figure out you still used too much Java 8. 3. Remove Excess Java 8.
total new code style, hard to follow
I think streams are useful, but they should not be over-used.
12:08
@Pimgd I don't think they are stupid at all, just do not over-use them
Java 8 requires you to be more sane to write good code
And if anyone knows about over-using them, I guess it's @skiwi
The collectors are what makes streams so powerful
Rubber duck: Is even this too much magic?
for (TemplateProperty property : TemplateProperty.values()) {
    //check if property is present
    scoreFunctions.add(invoiceDataSet -> (invoiceDataSet.hasProperty(property) ? 10 : 0));
}
10
You can get 10 score if a property is present here
also comment and method name clash
"check if property is present"

Okay.

scoreFunctions.add...

Wait, what?
12:11
@skiwi I'm a bigger fan of the filter and map methods
@skiwi that's not the same code you used before
@SimonAndréForsberg Well yes, they are nice as well, a bare Stream and forEach might be only worth it if you can fit in a reasonable short one-liner
@SimonAndréForsberg Correct, first I want to unmagicfy this one and then the more magic one
what does add(object -> int) do
... or is this some kind of strange function
it definitely looks weird
@Pimgd It's a scoring function
Also interesting error messages:
> lambda body is neither value nor void compatible
Your comment is wrong, then. You say "check if property is present..."
but it should be something along the lines of "add property checker"
... at which point it's stating what the code DOES
... meaning it can probably get removed
12:17
I don't think having explanation is bad in all cases
I'll leave it at this for now, I'm aware of the magic constant
private static List<ScoreFunction> calculateScoreFunctions() {
    List<ScoreFunction> scoreFunctions = new ArrayList<>();

    for (TemplateProperty property : TemplateProperty.values()) {
        //check if property is present
        scoreFunctions.add(invoiceDataSet -> (invoiceDataSet.hasProperty(property) ? 10 : 0));

        //calculate property offset score
        scoreFunctions.add(invoiceDataSet -> {
            if (!invoiceDataSet.hasProperty(property)) {
                return 0;
            }
well it's a comment that says how not why
I don't know if it is worth to put all of them into methods
And suddenly you've lost me
What I'm all doing here is not trivial though, does that mean that it is allowed that the code looks more difficult?
scoreFunctions.add(invoiceDataSet
scoreFunctions.add(invoiceDataSet
That overrides the old mapping... right?
no... it doesn't
but for having a property you get 10 points, and then you get the negative offset...
Just turn it into one function
scoreFunctions.add(invoiceDataSet -> {
            if (!invoiceDataSet.hasProperty(property)) {
                return 0;
            }
            int score = HAS_PROPERTY_SCORE - invoiceDataSet.getProperty(property).getOffset();
            return Math.max(-10, score);
        });
12:22
I see how you are thinking
But I have thought of these all the time as individual scoring functions, sort of like business rules
So one rule should not be mangled into another rule is what I think
Business rule... That right there is your comment
Although I did introduce another bug =/
scoreFunctions.add(invoiceDataSet -> {
            if (!invoiceDataSet.hasProperty(property)) {
                return 0;
            }
            int score = HAS_PROPERTY_SCORE - invoiceDataSet.getProperty(property).getOffset();
            return Math.max(0, score);
        });
Sneaky bug ;)
0
Q: Is there anything I could of done better here?

AddioioiI created the google homepage as part of the odin project. I had a particular hard time in lining up the top right hand menu bar, is there anything I could of done differently? I didn't know you could have a UL list overlapping different divs! any feedback would be excellent! #wrapper { ...

@CaptainObvious the title, for starters
2
0
Q: Recreating the Google Homepage

AddioioiI created the google homepage as part of the odin project. I had a particular hard time in lining up the top right hand menu bar, is there anything I could of done differently? I didn't know you could have a UL list overlapping different divs! any feedback would be excellent! #wrapper { ...

12:33
@skiwi - I am beginning to like some of the sugar in Java8.... my new favourite method:
    private static final long time(String name, Runnable torun) {
        long nanos = System.nanoTime();
        torun.run();
        long time = System.nanoTime() - nanos;
        System.out.printf("Ran %s in %.3fms%n", name, time / 1000000.0);
        return time;
    }
called like:
time("Warmup", () -> warmup());
@rolfl that is one excellent usage of lambdas
2
@rolfl That's very nice yep :)
@rolfl Improvement could be: time("Warmup", this::warmup);
I'm trying thow to make Java Regexes work with unicode
which one (CharSet)?
This might do the trick...
private final static Pattern SEARCH_PATTERN_MONTH_AS_NUMBER = Pattern.compile("(?uU)^.+(\\d+).+(\\d+).+(\\d+).+$");
private final static Pattern SEARCH_PATTERN_MONTH_AS_TEXT = Pattern.compile("(?iuU)^.+(\\d+).+(\\w+).+(\\d+).+$");
It's for matching a date specified as text to the components of it
Pattern.compile("(?uU)^.+(\\d+).+(\\d+).+(\\d+).+$") <-- Any sane person should WTF at this
12:49
When using Pattern.compile, use the flags option instead of embedding them in the regex.....
 Pattern.compile("(?uU)^.+(\\d+).+(\\d+).+(\\d+).+$")
should be.... (wait for it)......
Pattern.compile("^.+(\\d+).+(\\d+).+(\\d+).+$", Pattern.UNICODE_CASE + Pattern.UNICODE_CHARACTER_CLASS)
I think this is a point to add unit tests
0
Q: Are people overusing the <li> element in HTML?

Mark BoulderAre people overusig the <li> element in HTML? Why do people insist that "any collection or group of things" must be classified as a list? If they wish to divide items in their markup, why can't they just use <div>? The examples at http://w3.org/TR/html401/struct/lists.html#h-10.1 clearly shows <li>

0
Q: Program that prints out repetitives of 3,5 and both of them

user3142247public static void main(String args[]) { for(int i = 1; i < 101; i++) { if(i%3 == 0) { System.out.println("repetitive of 3"); } else if(i%5 == 0) { System.out.println("repetitive of 5"); } ...

0
Q: Is context.clearRect() neccesary?

Jacob Pedersen.clearRect is one of the more intensive events in my application so far, however I also draw an image on top of the screen (as background) at the top of each loop, like this: function redraw(){ ctx.save(); ctx.clearRect(0,0,canvas.clientWidth,canvas.clientHeight); ctx.drawImage(background,...

@CaptainObvious Fiiiizzzbuuuuzzz.
2
@rolfl Would that be more clear? I think you need the bitwise or though
@CaptainObvious Nice try, disguised FizzBuzz.
I am really happy that we don't have this problem on our meta.
87
Q: A Proposal for More Constructive Downvoting on Meta: Express Disagreement by Answering the Question

Robert HarveyDownvoting legitimate questions on Meta because one disagrees with the question's premise has become a bit of a problem. Question bans on users asking legitimate questions are a real possibility. Discussion can be suppressed. Heavily downvoted questions fall off the front page, and no longer...

12:55
@CaptainObvious and VTC broken.
Code fails to produce correct result
he editted the bit out
okay
So...
Greetings, Programs.
Is it okay to edit your code in your question if no answers have been posted yet?
yes.
Hey @Donald
Greetings @Donald.McLean
0
A: Program that prints out repetitives of 3 and 5

Uwe PlonusFirst of please format your code properly as it helps to read it. I've formatted the code as it is suggested for java: public static void main(String args[]) { for (int i = 1; i < 101; i++) { if (i%3 == 0) { System.out.println("repetitive of 3"); } else if (i%5 ==...

So what to do with this?
13:09
@SimonAndréForsberg it means I have a bachelors of Science in Bullshit
check this out
> You've earned the "Popular Question" badge (Asked a question with 1,000 views) for "Proof that I was wrong about Random Number Generators".
@Donald.McLean Greetings, User
@Donald.McLean You are being watched, user.
Fun fun...
0
Q: How to parse three numbers to a LocalDate using a Locale?

skiwiI am trying to parse three numbers, like [2, 10, 2014] to a LocalDate using the new Java 8 Date and Time API. All sounds relatively easy, right? Well, perhaps not. The additional constraint is that I need to take into account the locale, as for example Dutch and American use different date forma...

@skiwi Oh, it's Friday tomorrow!
@SimonAndréForsberg I think I'll ask my wife for new Firday Meme suggestions.
13:17
@Donald.McLean Firday! Is it gonna be christmas?
@Donald.McLean Too bad POI is on Tuesdays/Wednesdays and not Friday.
Plant a tree in your home on Firday!
@Pimgd Do you think I resolved it OK?
I understand the frustration it causes when people change their code after asking their question. As the timing was slightly in the favour of the question asker, I have elected to resolve the situation this way. I appreciate that this is not great, and it is a compromise 'solution'. — rolfl ♦ 1 min ago
Yeah... does it warrant a meta?
Meta question would be "Once a question has been posted, can ANY modifications be made to the code?"
No, the answers would be too complicated, etc.
13:23
2
Q: AngularJS accessing parent isolated scope in directive

michaelI was looking for a way to markup parts of my app as restricted to only certain roles, on an element basis. This works quite well, using an attribute directive, where I specify the allowed roles and disable/hide the corresponding element; e.g. <input require-role="admin" /> In order to make ...

I think the occasional instance when things have bad timing, are occasional enough that it's OK.
Making a blanket rule would have more exceptions than the current one.
It's the SO problem =D
@RubberDuck I'm forced to use that style in my java projects
And then, sometimes, migrations are worth it ;-) :
Wow that was a really well explained answer. It was really interesting to see how such minor changes can really affect the compute time! Thank you I really appreciate the time and effort you took to right me that and I am definitely taking notes! — user3029557 6 mins ago
dammit now I'm ranting internally about company-forced coding style
when you get downvoted on CR because auto-format creates bad formatting
Yet another reason on the list of why I'm not planning to stay if I don't have to
@Pimgd Explain? Ciation?
13:31
Pssst... That's C# formatting. — RubberDuck 7 mins ago
they made me change the settings on my IDE to do all the braces like that and then make me ALT+SHIFT+F the files. I don't look at them anymore, they're strangers to me
and then make me ALT+SHIFT+F the files
Everyone who uses C# formatting in Java should die a painful death... Except the few people whom we need for whatever reasons, they should just be tortured...
3
I did reverse when you pointed out that you staid consistent with OP's style @Pimgd.
If I would be forced something that is wrong and I'm in a financial situation where I can leave... Then the choice would be easy
@Pimgd stay on CR or in the company?
@RubberDuck I'm just imagining the case where I'd post a snippet of code from my editor and get downvotes...
@SimonAndréForsberg the company.
13:33
I honestly don't care, so long as it's consistent.
Oh Canada... why
> All 3 main types are used in Canada – in French and in English.[29][30]

Social Insurance applications for Canada use DMY format.[31]

Passport applications[32] and tax returns[33] use YYYY MM DD.

Immigration Canada Stamps use DD/MM/YYYY and Canada Customs Stamps use MM/DD/YYYY.

Nearly all English newspapers use MDY (MMM[M] D, YYYY).[34]

The default date format used by Microsoft Windows for English Canada for all-numeric dates (short-dates) is DD/MM/YYYY, and for long dates is MMMM D, YYYY in Windows XP and MMMM-DD-YY in later versions; for French Canada it is YYYY-MM-DD for short-date
Monking!
In general, I do not advise people to spill their grievances in a public forum ...
hmm
yeah okay
13:37
@rolfl it's probably fine, as long as people don't know where you work exactly
It probably is fine, but I have seen it not be fine.
Gtg. Cya.
@skiwi "s and D MMMM YYYY for long-dates." is worth a new line and "(see full text)"?
@Pimgd That's what the chat thought!
But don't you always have that slippery slope?
Not if you snip more =)
Allow x*1.2 chars, if you go past that, snip to x
Hmm... Networking API design issue
13:43
0
Q: Class template specialization for empty template parameter

TimI'm implementing classes for simulating and generating different kind of automata. I'd prefer to use the same State and Transition classes for all the automata: NFA, DFA, PDA, etc. For a PDA a transition from one state to another work require some sort of an extension, because the transition req...

In the input you have a header, then a payload.
You read the header, removing it from the input.
It says you need X bytes to store the payload.
You allocate the buffer and fail, there's no memory.
Do you then
A) skip through the payload
B) leave the inputbuffer in a bad state where reading will result in bogus values?
It's C so I can't just throw exceptions =/
How about setting the buffer pointer to null (assuming a "char** buffer" like function argument), and returning an error code?
That'd be option B
hmm... but the function is also responsibly for allocating the buffer... what's the char** buffer for... pointer to pointer...
you provide a memory location to store the pointer to the buffer to
ah okay
char* buffer; int error = your_api(&buffer, other_params)
but if you need to free it then you'd call free(buffer) right
I hate multiple levels of pointers, they're hard to grasp
13:54
Well, as long as you clearly lay out ownership for each reference, it gets manageable. When a function allocates a buffer, but passes ownership to the caller, then the caller is responsible for freeing. Also, you should always return the size of the buffer. This ends up using pointers as out-arguments; C++ has a much nicer mechanism with references.
C++ I'd be using smart pointers instead
"Also, you should always return the size of the buffer"
Should I just make it a struct then?
But that gets strange, because you have this struct and you have to delete one of its members before exiting scope
Well, C has arrays but they're statically sized. Pointers can be used as arrays, but they don't know their size. So to avoid buffer overflows, you either have to use something like null-terminated strings, which is broken and error-prone and wrong, or return the size, so that you can do "for(i=0; i < length; i++) frobnicate(buffer[i];". That requires something like char* buffer; int buffer_length; int result = your_api(&buffer, &buffer_length), which I'd prefer over structs.
Debug time! On (?iuU)^.+([\\d\\w]+).+([\\d\\w]+).+([\\d\\w]+).+$
Pff I'm used to Java, I see all these cases where I'm passing 4-5 arguments into a function and think "this needs to be different"
I'll use the two-argument setup, C code should look like C where it can
0
A: AngularJS accessing parent isolated scope in directive

MalachiIn your HTML <form> <div required-role="Admin"> <!-- Set: 'Admin' --> <input required-role/> <!-- Inherit: 'Admin' --> <input required-role/> <!-- Inherit: 'Admin' --> <input required-role/> <...

@konijn ▲▲▲▲
14:04
@skiwi The u and i modifier are unnecessary. The \d charclass is a subset of \w. Also, what is there to debug, it ought to work?
@SimonAndréForsberg it's a play on Acronyms
Ah I found my issue
@skiwi I found the solution to date problem
@amon I'm not expert on this, what I need is that it takes the maximal string in a character group
@Malachi yes, I understand :)
14:05
@JaDogg I also found it, didn't hsare yet though
@amon I don't think this is the case using Unicode character classes (?U), where \\w maps to \\p{L} denoting a Letter
lol I have been saying it for some time now, I thought it was rather clever, and seems to fit with the logic I use to come to conclusions about things I know something about but am still not an expert.
@skiwi wait I'll add it as an answer :D
@Malachi, reason not in code, but in main idea: using preprocessed values. — outoftime 21 mins ago
@skiwi \w is not \p{L}. Per the Java documentation, the char classes behave according to Unicode, which means that it matches all alphabetics, digits, connectors such as underscores, and marks such as diacritics
@skiwi I added the answer
14:10
If I use "(?iuU)^.+([\\d\\w]+).+([\\d\\w]+).+([\\d\\w]+).+$" on "2-10-2014", then it matches 0, 2, 1 - Doesn't seem to be correct
^^ whats that ?
is it for me ?
"Here, a gift! It's a regex I made just for you."
@skiwi concerning your Date question on SO... how about something like:
I've created this so far, but it doesn't work as the regex is still wrong:
public final class DateParser {
    private DateParser() {
        throw new UnsupportedOperationException();
    }

    private final static Pattern PARSE_DATE_PATTERN = Pattern.compile("(?iuU)^.+([\\d\\w]+).+([\\d\\w]+).+([\\d\\w]+).+$");

    public static LocalDate parseDate(final String text, final FormatStyle formatStyle, final Locale locale) {
        Objects.requireNonNull(text, "text");
        Objects.requireNonNull(formatStyle, "formatStyle");
        Objects.requireNonNull(locale, "locale");
@RubberDuck, there is nothing wrong with Java People wanting to switch from the dark side and use the correct formatting. — Malachi 30 secs ago
14:14
LocaleDate date = ReadToLocaleDate(String.format("%d-%d-%d", list[0], list[1], list[2]), Locale.NL_nl);
??
@skiwi It is correct, but suffers from catastrophic backtracking. Note that "." can also match all characters that "\w" matches. Note also that you require at least one character at the beginning ("^.+"). How to fix this: (1) make the prefix/suffix optional: "^.*" and ".*$" (2) consider using something like \W+ instead of .+ in the middle.
@Malachi Please don't try to start a religious war here...
@Malachi Flagged
lol
6
14:16
#just-saying...
at least I didn't say "JAVA people"
Serious... I was writing my reply but 3 revisions later I still didn't write a word of something that would be on-topic on the question OR the answer
@amon Good calls
0
Q: Speeding up analysis of an array (varying in size)

Michael ShamashI use this code each time a user clicks on a GMSMarker in my Google Map view and then three variables are passed to this function. The 'routeInput' one is the longest one which can very in length and requires analysis of each of it's components. The 'dep' and 'arr' strings are simply looked up in...

@amon Nice! "(?iuU)^\\W*([\\w]+)\\W+([\\w]+)\\W+([\\w]+)\\W*$" indeed works
Now onto trying to figure out which pattern a given DateTimerFormatter instance uses
14:22
@skiwi "(?U)(\\w+)\\W+(\\w+)\\W+(\\w+)" should be equivalent, unless Java anchores matches at the beginning of the string.
You self-deleted??
???? nope
I think it should have gotten flag-handled
someone bashed me on this answer though codereview.stackexchange.com/a/64532/18427
no it didn't..
it isn't down...
14:25
0
Q: Need help on code

Biffy261I'm trying to push out a questionnaire at work with several questions on. Users can reply with radio buttons ranging from yes, some, maybe and no. This questionnaire is contained in the sheet called manager. If they select yes or no I would like to copy the question to a seperate sheet in a tabl...

0
Q: Optimization in a piece of C# code

Eduardo Calazans JúniorI have a little piece of code that is a little bit unoptimized. Need some help with optimization in this case, any help will be appreciated. { string concat = ""; for (i = 0; i < 2; i++) { if (concat != "") { concat += "," + oDrc[y].ItemArray[1].ToString()...

I just can't read anymore.
I am looking for a link right now from meta, anyone feel free to post it they can find it
0
A: How to parse three numbers to a LocalDate using a Locale?

JaDoggFirst create a strings from numbers and then you can use something like import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.FormatStyle; import java.util.Locale; public class IntegerDateTest { pub...

@skiwi ^^
@Malachi what link?
1
A: AngularJS accessing parent isolated scope in directive

MalachiIn your HTML <form> <div required-role="Admin"> <!-- Set: 'Admin' --> <input required-role/> <!-- Inherit: 'Admin' --> <input required-role/> <!-- Inherit: 'Admin' --> <input required-role/> <...

sorry
meant to put it at the end of that last post
14:26
OH MY GOD!!!
` DateTimeFormatter df = new DateTimeFormatterBuilder().append(
DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT))
.toFormatter(locale);`
The !par statement is even wrong to me, as exiting early and not using potentially nested ifs is good coding practice imho (see programmers.stackexchange.com/questions/118703/…). Also, the ternary statement is largely only a personal opinion, I don't think it is any easier to read. — dirkk 5 mins ago
Ah, I misread that I think
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDate(formatStyle).withLocale(locale);
System.out.println("dateTimeFormatter = " + dateTimeFormatter);
This prints dateTimeFormatter = Localized(SHORT,), doesn't look correct?
When your youtube metal playlist has a mostly silent ad, apart from some running water and a spray of something in between
2
O_o
@Pimgd when your spotify "rock"-genre-radio suddenly has a full-fledged electro/house advertisement
]]:-x
14:29
@skiwi huh
?
@skiwi why are you printing a DateTimeFormatter ?
coding standards on the other hand say that you should write a clear path and not dance around the fire 3 times before doing what needs to be done. if you would like to discuss further we can take this to chat. 2nd MonitorMalachi 5 secs ago
@skiwi does my code do what you want ?
2
Q: Coding style of critical server's code

user3275699I was writing a server that should serve more or less a thousand clients. After writing the net part of the server code I had to stop writing because I saw that the code was chaotic and not very readable. The code work, but it seems all wrong. Net.h: #ifndef H_GUARD_NET #define H_GUARD_NET #d...

0
Q: Fastest way to find and replace inside a large amount of files

MX DCurrently I am looping through dependencies of objects, and I am trying to replace GUID (unity object ID's) inside the files. Right now I am using the following code, any suggestions for improvement ? public class SendToThread { public int localID = 0; public string oldID; public st...

@amon where would you define the error codes? I'm thinking of placing them next to the function definition in the header as #define functionName_errorName errorCode
@Pimgd not a good idea to have error codes as define directives...
public constants seem to be a better option.
14:40
Does an enum make sense?
@Malachi well, I have to say I still disagree. One reason is that stylistic advice is not really what we are looking for (of course it is appreciated if something really stupid is done). But my main point is still that I believe (and many programmers agree with this coding practice), that returning early is good and avoiding nested ifs is a very good thing.
typedef enum {
	receiveStreamMessageInNewBuffer_Success = 0,
	receiveStreamMessageInNewBuffer_HeaderReadFail = -1,
	receiveStreamMessageInNewBuffer_AllocateBufferFail = -2,
	receiveStreamMessageInNewBuffer_PayloadReadFail = -3,
	receiveStreamMessageInNewBuffer_DecryptMessageFail = -4,
} receiveStreamMessageInNewBuffer_errorCode;
@dirkk hey there, you saw my comment?
@Pimgd I think that might be slightly overkill...
That's good, I like overkill
There's a lot of stuff I'm not doing enough in C
(such as splitting contents between files...)
@Vogel612 Now I did ;). Sorry, if it comes across as rude, it is not meant that way and not intended. It's true that I am not actually aware of the specifics of CR, so my apologies.
14:45
or documentation in general
@dirkk my role is played ;)
/me taking on a new role:
0
Q: Understanding the MVVM Concepts and validation of my code

SamI have been learning MVVM concepts and trying to implement it in my new project. I want to validate my work that I have been doing these past days. I want to know if I follow correctly the mvvm pattern, I need your criticism / advise / suggestion on my Work. I understand that everyone has their w...

@dirkk as an aside, whenever I personally write early returns I try to make them as distinct as possible:
	@Override
	public boolean isValid(final Location instance,
			final ConstraintValidatorContext context) {
		if (instance == null) {
			// Recommended, instead use explicit @NotNull Annotation for
			// validating non-nullable instances
			return true;
		}

		final String checkedValue = instance.getLocationName();
		final long id = instance.getId();
@Vogel612 "as distinct as possible" means "separated by a blank line" in this case?
@Vogel612 But as you can see, I already took it to chat, so I am not completly hopeless ;) So quoting from the help "Feel free to call attention to specific areas you are concerned about (performance, formatting, etc)." --> That's what I am actually trying to do
14:48
@Christoph well in comparison to if (instance == null) return ""; ....
@dirkk make your colleage mention it in the question then ;)
I am amazed yet again how many people in the world seem to be utterly unable to read...
@Vogel612 well considering the locale too yes, but I though the strings are different [2, 10, 2014] vs [10, 2, 2014]A4L 8 mins ago
@Vogel612 I don't quite see what you mean with "make them distinct" in this example. This is just If (instance == null) return true;,, I don't see any difference in cody style to If(!par) return;
Needs some HTML comment language tags if anyone has a minute.
0
Q: Understanding the MVVM Concepts and validation of my code

SamI have been learning MVVM concepts and trying to implement it in my new project. I want to validate my work that I have been doing these past days. I want to know if I follow correctly the mvvm pattern, I need your criticism / advise / suggestion on my Work. I understand that everyone has their w...

@dirkk the important part is placed braces, additional space. IMO this greatly helps readability of code..
@dirkk having the return in an extra pair of braces makes it much easier to spot
oneline if-statements are one of my many nemeses
14:52
@Vogel612 Well, one is Java, the other one JavaScript, so code styles tend to differ naturally
@Vogel612 nemesii? nemesises?
@Pimgd no clue...
nemesae?
To the Googles!
"nemeses", it says
14:52
nemeses yeah
@dirkk While that may be true, there's no need to make code harder to read (and parse) just because the language is different
neemeesees. It sounds weird.
oh and please don't argument with the "minification" now.. ;)
Frankly, to me this is very much opinion-based. I think the one liner is as easy to spot as before, especially because it is not surprising in this place. Checking for empty elements at the beginning of a function is quite expected, it would be different if it is in the middle of a long spaghetti-like function
"PITA aspects of reality" seems much more descriptive
14:54
@dirkk Style advice is inherently opinion based to some extent.
Code-Review answers are not "the only truth"...
@Vogel612 Well, parsing is not effected in any way by this. "harder to read" is of course a valid argument, I simply have a different opinion here.
IMHO; if you use guard clauses on 1 line, leave a blank line between your body and your guards. Those that are being protected need their breathing space too.
Well, seems like CR is very different than SO and other SE than. That's surprising :) I normally expect an answer to be the single source of truth ;)
@dirkk well there is some answers, that are, but they're rather seldom, especially when reviewing style..
mostly answers are having this "single truth" air...
but they're almost always backed up by measurements here.
Yeah, that might be why I reacted so strongly against the fact the style was even commented on, because it seems rather useless to me. Except for a beginner code-styling comments are rather pointless to me, because there are a lot of different styles out there, and for a good reason.
14:57
@dirkk as long as it's consistent and agreed upon in your team, there's no need to worry about it..
Of course I respect if the CR community has a different view on this issue
but as soon as you have multiple people working together, you should define a minimal consensus..
just for the sake of not having edit-wars / merge-conflicts about it..
and then there's some languages with official conventions ...
sorry I missed out on the conversation, my boss called me into his office and I need to clean up some documentation and add clarification to it
I am well aware of that :)
that said, I think we're beginning to beat a dead horse here ;)
14:59
"sorry I missed out on the conversation, my boss called me into his office and I need to clean up some documentation and add clarification to it

I am well aware of that :)"

dirkk is malachi's boss =D

« first day (516 days earlier)      last day (3800 days later) »