« first day (1810 days earlier)      last day (3360 days later) » 

15:00
how about the console.log and see what servers has at beginning of fillServerDropDown
@jumpstracks Just breakpoint it
@jumpstracks console.log always the life-saver
for me debugger showed values there most of the time(occasionally I was seeing jquery methods)
try this link for real breakage:
oops
but stepping through code of the foreach, I saw different beahvior
*behavior
so I think debugger and console.out may show different results
15:01
All I did then was replace $('<li/>') with $('<li></li>')
looks great - if your goal is a loading message :)
@SterlingArcher I have this
function createMessages(items) {
    var result = {};
    Object.keys(items).forEach(function(key) {
        var keyParts = key.split('.');
        var currentObj = result;
        while (keyParts.length > 0) {
            var currentKey = keyParts.shift();
            if (keyParts.length === 0) {
                currentObj[currentKey] = function() { return items[key]; };
            }
            else if (!currentObj[currentKey]) { currentObj[currentKey] = {}; }
            currentObj = currentObj[currentKey];
But it's ugly as fuck
Anyone an idea why it's showing only 1 error? paste.ee/p/oKl3S
In the console.log(errors) there are 2 shown.
@Alnitak if I remove your little svg element, it works
oh...
that's interesting...
15:03
* And it loops the each twice.
I wish I knew more about recursion
I feel like you'll need to iterate the keys anyways
@AwalGarg good spot!
@Duikboot Use append
@Duikboot html() will replace the innerHTML and you'll see only the last message
$('.errors').append('<div class="alert alert-danger" role="alert"><span class="sr-only">Error:</span>'+ value + '</div>');
it works if I close the <svg> tag separately too
@MadaraUchiha think you want to start by calling currentObj=createMessages(currentObj[currentKey]) instead of currentObj = currentObj[currentKey];  that way you could recurse into {'a.b.c.d':{'a.b.c.d': 42, 'a.b.c.e': 43}} swagging anyway
15:06
Perhaps <svg/> isn't strictly legal?
Better option will be to create a string and throw it in DOM after each finishes
@Alnitak doesn't matter if it is legal or not
@Luggage :D
<svg/>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>var $el = $('<li>');console.log($el);</script>
@Alnitak this much of code is enough to repro
15:08
What is this strange looking data structure?
@Luggage add ? or & .png
generally does the trick
nice job Awal!
[ 'StoredPosition: 00',
  '00',
  index: 0,
  input: 'StoredPosition: 00\r\n' ]
15:09
@Loktar burned my nose with coffee on that one. 10/10 did not expect xD
haha, sorry
@corvid Is this valid JS syntax
@AwalGarg That's fucked up
@Alnitak so is this: <svg/><script>console.log('<li>')</script> <-- doesn't log anything
hahaha
15:10
@BenFortune ^ :P
I have no clue, it looks bizarre. It's the result of str.match(/someregex/)
@AwalGarg Jesus christ
so the presence of the auto-closed SVG tag breaks (some) subsequent tags that appear in the page...
that is so broken...
@corvid Can you add the sample code returning above
that's html.
lots of tag's can't autoclose
15:12
@corvid Match returns array
<svg/><script>console.log("<a>")</script> LMAO.
@Luggage but the inspector shows svg to be autoclosed
user1596138
@Alnitak Nah.
in anycase, I'd expect that code to either not execute, or throw
"StoredPosition:00\r\n".match(/^(?:StoredPosition:)\s*(\d+)\r\n/gm)
@Alnitak sigh, that was fun. Thanks to you
15:13
Returns `["StoredPosition:00
"]`
You can see why I brought it here rather than as a SO question...
> SVG and MathML elements whose start tags have a single "/" character before the closing ">" character are said to be marked as self-closing.
user1596138
@Alnitak Actually if you word it properly it would be a great SO question.
@BenFortune yeah that's out of question. FF parses it really properly
15:14
There was too much code for a question, I think. Awal did a great job finding the tag that broke the parser
!!>"StoredPosition:00".match(/^(?:StoredPosition:)\s*(\d+).*$/m).index;
@corvid null
@corvid ["StoredPosition:00","00"]
<svg/><script>console.log('<a>foo')</script> interestingly, this logs foo.
@corvid 0
15:16
Hrmph
@corvid You didn't provide global flag here
user1596138
You guys realize SVG isn't the same as like say an anchor tag
@corvid So, returning the matched group in the second index
@Lana that page says "The syntax <foo/> opens and immediately closes the foo element if it is a MathML or SVG element (i.e. not an HTML element)."
@corvid regex101.com/r/fL4qY8/1 good to test..
15:17
@corvid FYI you should use exec when using non-capturing groups
so according to that, it should be legal
user1596138
No.
user1596138
Your moms legal
@Alnitak @LanaKane that absolutely doesn't change anything. If the parser is treating the <li> inside it as a terminal tag, the JS parser context should immediately throw since console.log(' is not a valid expression.
user1596138
Try not leaving the tag empty..
15:18
@LanaKane Yours isn't
user1596138
I don;t even know where the offending code is that we are discussing.
Your mom offended
@LanaKane you are jhawins?
@LanaKane small self-contained example at alnitak73.homedns.org:8080/test3.htm
@AwalGarg If you step through, it steps through the svg...
15:19
it should log '<li>' but it logs nothing
I'll open a Chrome bug ticket
@KendallFrey his mom offended what?!?!
the law
user1596138
> SVG and MathML elements whose start tag is marked as self-closing, can’t have any contents.
my nose
user1596138
15:20
So we are seeing conflicting documentation around the net lol
they don't have to be marked self closing.
user1596138
Or wait. No. That makes sense
@Alnitak I'd open a jQuery ticket first
And see if it needs escalating to Chrome
@MadaraUchiha no, read up
@Madara it's not remotely a jQuery issue
This is enough to show the bug - no jQuery:

<svg/><script>console.log('<a>');</script>
15:22
@Alnitak Interesting
@AwalGarg xbenjii.co.uk/i/LoxKN Should it be stepping through the svg?
@Tushar why's that?
@BenFortune horrible behavior
7
Q: Javascript RegExp non-capturing groups

MorhausI am writing a set of RegExps to translate a CSS selector into arrays of ids and classes. For example, I would like '#foo#bar' to return ['foo', 'bar']. I have been trying to achieve this with "#foo#bar".match(/((?:#)[a-zA-Z0-9\-_]*)/g) but it returns ['#foo', '#bar'], when the non-capturing...

Thanks for the help - I've logged an issue with Chrome
15:27
woa that was weird
I only got Awals messages for the last like 15 minutes
thought he was going insane and spamming talking to himself.
refreshed and saw the rest of the convo
yes because I would make that up just for the purpose of telling you all about it
chat has absolutely no bugs at all. none of them. perfect code.
In the words of Kariz, why you treat chat like potato
15:34
0
Q: JavaScript function to generate tree object from flat object

Madara UchihaEvening everyone. The function function createMessages(items) { var result = {}; Object.keys(items).forEach(function(key) { var keyParts = key.split('.'); var currentObj = result; while (keyParts.length > 0) { var currentKey = keyParts.shift(); ...

user1596138
@AwalGarg Bruh, you have absolutely no idea why it is the way it is. Might have a damn good reason. You are horrible behavior :P
that video made me smile
fucking awesome
user1596138
@SterlingArcher Holy shit lol
15:39
> Sharkjet
CatCopter, I want.
has anyone tried prefetching in firefox?
100% real cat
@rlemon can I borrow 2 cats? I can only guarentee the safe return of 1
The other.. well it's an ill the Terms of Service you signed.
15:40
@MadaraUchiha something like:
function walkTheChain(arr, val, obj){
    if(arr.length === 1) obj[arr[0]] = Object.assign(() => val, obj[arr[0]]);
    if(!arr[0] in obj) obj[arr[0]] = {};
    walkTheChain(arr.slice(1), val, obj[arr[0]]);
}
@BenjaminGruenbaum No Object.assign.
No libraries either.
@Loktar everyone online from then on hehe this dude sucks ... "hey are you john cena?"
Note that this code needs to be able to run in Phantom 1
lol
@MadaraUchiha it's ES2015. I don't care about your environment, polyfill it.
15:42
@BenjaminGruenbaum That's for a single key, right?
@MadaraUchiha right, only one key.
Also, it's missing a return
Something like:
@BenjaminGruenbaum Will it work for the third example in my question?
@MadaraUchiha yes, that's why I need the assign.
!!afk lunch
needs to rework it, didn't test
15:44
@BenjaminGruenbaum Yeah, I'll use it as reference, thanks
godamn it, ok last one:
    function walkTheChain(arr, val, obj){
        if(arr.length === 1) return obj[arr[0]] = Object.assign(() => val, obj[arr[0]]);
        if(!(arr[0] in obj)) obj[arr[0]] = {};
        walkTheChain(arr.slice(1), val, obj[arr[0]]);
    }

    function createMessages(map){
        var obj = {};
        for(var key in map) walkTheChain(key.split("."), map[key], obj);
        return obj;
    }
This works, sort of
2 messages moved to Trash can
@BenjaminGruenbaum "sort of"?
@MadaraUchiha I only tested it against your three examples
the trick is to use recursion :D
15:48
@BenjaminGruenbaum Using recursion is a trick.
I can also make it return the object, and then use reduce, but that'd do nothing but make us feel clever.
crl
crl
!!angular-local-storage or ngStorage?
@crl ngStorage
0
A: JavaScript function to generate tree object from flat object

Benjamin GruenbaumHere is what I'd do. I'd split it into two actions - adding a single property and assigning them all. Adding a single property is just adding a function if it's something like "a", and it's adding a property to a sub-object if it's something like "a....". So let's use recursion and break it up ...

15:52
@BenjaminGruenbaum Huzzah
Wow great answer Benji
applauds
> We get it, you vape.
bahaha
crl
crl
@MadaraUchiha why message1.a.b.c.d() and not just message1.a.b.c.d?
15:58
@crl It's a given format
Our answers are pretty similar, I just extracted the overall part to a function and changed:
            var currentItems = {};
            if (currentObj[currentKey]) {
                currentItems = currentObj[currentKey];
            }
        currentObj[currentKey] = function() { return items[key]; };
        Object.keys(currentItems).forEach(function(currentItemKey) {
            currentObj[currentKey][currentItemKey] = currentItems[currentItemKey];
        });
This is code to generate a mock object for one of the ugliest parts of our code
Into an Object.assign with a default thingie
16:10
@BenjaminGruenbaum youtube.com/watch?v=JYDkzqCfJzg try it :D
@Abhishrek only reason I wouldn't is because it seems rude
I love octopus though
what do you guys typically do when there's nothing else left in the current sprint?
16:28
I have a couple of presentations which I am trying to open on my lumia Windows Phone 7, but Powerpoint complains it is corrupted. Open office's Impress opens them just fine on Ubuntu. Any idea what to do?
@RalphWiggum Learn something new.
Take on a challenge.
Contribute to open source
Make a game
Lame a game
@RalphWiggum ask for more work
usually get assigned bugs
Read books.
16:32
Introduce bugs so you'll have more work later.
6
Job security, right?
Exactly
Write terrible code that only you understand
Write perl
@rlemon if that's not work productivity I don't know what is.
16:33
@rlemon Reminds me of the speedup loop
@rlemon not sure if that's genius right there or if they would actually fire you because you can't write code well enough
@towc sadly this does happen in the real world.
also lots obscure/old tech that not enough people have knowledge of
nice job security there
esp in the gov where lots of old systems are still in use
Cobol pays
16:36
@rlemon I don't have faith in that sort of thing, I remember having a short look at the economical and practical sides of that approach, and it ended up not paying off.
Not for everyone in the long run, but I do know coders who have done this with some degrees of success.
Also newer companies today (at least in Israel) give you stock options in addition to your pay, so that you have an incentive for the company to succeed.
@rlemon Interesting.
@MadaraUchiha lol speed up loop..
That's playing dirty though. I know I'd have to switch a mindset in order to introduce "quality" bugs on purpose, and that it'd be difficult for me to switch back.
@SterlingArcher That is some genius piece of engineering right there.
@SterlingArcher "We worked very hard all week to bring you this amazing x100 improvement to performance! Amazing!"
> Press back one more time to exit app
> Press back one more time
> one more time
16:40
@MadaraUchiha the one person who comes to mind was in charge of the framework (enterprise solutions) and wrote such spaghetti code that he was literally the only person who could maintain it.
the entire thing was scrapped when he left, but he was kept on board with a nice salary because he wrote unmaintainable code that we couldn't function without.
Seen that happen many places
@rlemon Mmhm
The sad thing is, there's nothing much you can do to combat that
Beware of architects that code
@ivarni he wasnt stupid either.
I mean, how do you seriously incentivize writing good code?
16:41
some of his solutions were elegant.
> Your code sucks, you're fire
I often write to myself, so I want to make it as easy as possible for future me
Easy way to incentivize good code
@SterlingArcher That needs to happen very quickly
Otherwise it becomes very expensive to say that line
you can't force people to give a fuck.
16:43
I've excavated one such deeply rooted system on my workplace
It had taken me the better part of a year
I mean, I wouldn't want to hire someone who writes unmaintainable code, but it's not really possible to detect it beforehand
You look at their GitHub and Stack Overflow accounts and are impressed. You give them an interview and are impressed.
Then they hop into your codebase and start noodling.
Problem is that SO or Github are code you take time to do.
@MadaraUchiha Impressed by stars and upvotes or code quality?
At work you have deadlines, and this, and that, and so code comes up weird and bad
@AwalGarg Even code quality
16:46
And when you want to refactor, you have no time
Assuming I did a very good job at researching into my potential recruits.
@MadaraUchiha I incentivize based on bug reports tracked back to coder, code review rejects
@dievardump That's just a case of bad business dept.
At least here, our business dept understands that a feature without tests and without refactors is half a feature
ends up being paid out quarterly. No mistakes or bugs, you get full bonus
And while we still do get some requests to "It's a huge client, do it yesterday", there is a very clear line
@jumpstracks That creates office politics
16:48
@MadaraUchiha Which takes a quality programmer. So you say quality programmers also write un-maintainable code at work? (Genuine question, since I have no idea how industry works)
hmm always politics at play
@AwalGarg That's why @rlemon and co. claim, yes.
That they write unmaintainable code on purpose so that they cannot be thrown out
what the fuck
seems weak....
who the hell does that irl
16:49
I have never actually encountered that.
Even in the gov
@rlemon Ah yes, I remembered where it all comes crashing down
usually speggetti code is result of being unfocused, too many changes etc
its always thrown around joked about, but I have yet to actually encounter it.
or just lack of experience
If you can't be replaced, you can't be thrown out, but you also very often can't be promoted.
16:49
@Loktar that's what I always thought
Because no one else can take your role.
I've not seen people do it on purpose, but I have seen it happen because noone with any influence had the balls to stand up and say "that's a shitty idea"
The main thing i've seen similar are people who hold onto knowledge
9 mins ago, by rlemon
@MadaraUchiha the one person who comes to mind was in charge of the framework (enterprise solutions) and wrote such spaghetti code that he was literally the only person who could maintain it.
16:50
@SomeGuy your tweets from 30 minutes ago worry me
9 mins ago, by rlemon
the entire thing was scrapped when he left, but he was kept on board with a nice salary because he wrote unmaintainable code that we couldn't function without.
For some reason, a lot of people are wary about criticizing seniors or architects, even constructive
@MadaraUchiha maybe not one person, but a few can
@MadaraUchiha is it his fault, or other bad programmers?
@SterlingArcher I'll be okay.
16:50
I've seen some shitty code.. but none I can't figure out at some point
@Loktar I've seen the horrors of the world
biggest thing to me is - is there unit test coverage for the crap code :)
Internals of frameworks that are patched versions of 3rd parties
this was a single person. he was around from a very early version and most of the software was built on the framework he authored. problem was no one else could make heads or tails of his framework (and these were not dumb people) now, they may have been able to 'understand' individual aspects of it, but this was huge enterprise software and no one could follow the flow of his code
@SomeGuy XD
16:51
ah, he understand the biz
Imagine jQuery, edited with our own crap
Good luck reading that!
@SterlingArcher Might have to block that group for a few days, though :p
@MadaraUchiha I would have had a hard time believing you just a month ago. I recently worked on something horrendously dreadful. About 8000 files of markup hand-constructed by copy pasting around random stuff which works. Each of them over 600 lines, all kinds of inline JS and CSS, no server, no API.
he used to get away with so much too. he was a crazy introvert and ignored flex core hours and would work from 11pm -> 7am and then leave when everyone else was getting into work
16:53
@AwalGarg This isn't the worse part of it
maybe felt the passion from the smart folks :)
The worse part of it is that there were 4 fucking versions of patched jQuery living in the system at the same time
the glares from those that didn't understand
Each with their own patches of course.
holy fuck! I just looked him up on linkedin.
he works for EA now
:D
16:54
So, any mongo pros here or is mongo not popular in the JS room?
not I sorry
@jumpstracks ARE YOU FUCKING SORRY?
2
I'm still struggling with the framework of the week :)
@corvid You should be well aware of the popular opinion on Mongo here by now.
ya, heard good things about it :)
I should get into the newer stuff... just not enough time
16:56
@MadaraUchiha there was jquery, multiple versions too. But not patched.
@MadaraUchiha is dark theme loading fixed for you now ?
testing #123
@rlemon Let's see
ohh bloody hell now that doesn't work again.
function test() {
    return 42;
}
Doesn't work after a refresh
Although it may not have updated yet
Let me make a manual update
heh.. you need to quit using refresh :)
16:57
ahhh
I don't have the latest either.
@rlemon Still no
didn't you have the oddball svg tag behavior browser bug
Also, the bug I mentioned earlier is still in effect
(CTRL+K, add two lines, then try to add a line in between without using the mouse)
yea I don't care about that right now
Let's see #123 and #456
That's also still highlights the whole line
16:58
0.0.4.6 fixes that
you probably still have 0.0.4.5
0.0.4.5, yes
delete and re-install to force new version
sometimes it doesn't "update" with the button

« first day (1810 days earlier)      last day (3360 days later) »