« first day (971 days earlier)      last day (3977 days later) » 

4:00 PM
err
in the original problem he should be using Set?
 
Didn't read the original problem yet.
Yeah, Bergi is right there. A Set would be the correct choice
 
I haven't yet optimized my Set, it can be made to use 2x less memory
and the Map already uses less memory than native {} used as a map
=D
 
I had a talk about it with Addy Osmani
I asked him when considerable effort was going to be put into optimizing Map vs objects, and making code that doesn't use objects as maps run faster.
He said that not for a while, but they have big plans for it
 
who is Addy Osamni
 
Some guy from Google. I think he's more of a writer.
(He has some very nice and interesting code, but not on the v8 core or that sort of thing)
Does a lot of talks about writing fast, memory efficient JS
 
4:07 PM
cool
do you know the jQuery plugin SlickGrid?
 
No, but I've read that question.
 
The main constructoris 3200 lines of code, it takes 2-3 megabytes to create one instance
and in chrome it takes like 20 seconds to create 100 instances
 
Doesn't he keep saying how 'performant' it is?
 
yes but he is relying on the fact that nobody creates more than one instance
 
4:08 PM
and that's true because it's a god object
all the code is written in closures
basically the opposite of what you would write if you wanted to write "performant" javascript
 
That's not that big of a deal. I love closures :P
Anyway, the ES6 shim implements set as a map. This is IIRC what Java and C# do as well, as well as Python.
That makes sense.
 
with some code duplication you can save 100% memory though
when set is backed by map you will store useless values for each kay
 
The problem is, "get" and "has" seem very badly implemented. It's not a hash map, but a linked list.
You should write a faster map/set shim. Or take the implementation from SpiderMonkey (or V8) and LLVM it
 
it's not a shim and it's already optimized
 
Hello, I'm having some trouble getting my onmouseover to work properly. It shows the popup correctly, but when i use popup.className = "map_symbol"; nothing changes. Any idea? codeshare.io/QohmL
 
4:12 PM
?
David, why so you have html in your JavaScript in your HTML?
 
@BenjaminGruenbaum not sure, it should be separated. But this was the structure when I started working on this, so haven't really modified it
 
@DavidPardy Ugh, you inherited that? I'm so sorry.
 
@Esailija perfs please
 
@DavidPardy according to the syntax coloring, your onclick handler (ek) opened at line 13 ends at line 14 (eeek), but then you open another string on line 15. Are there some lines missing?
 
4:16 PM
Its ugly, dont get me wrong...but I'm pretty novice so Im in no position to gripe
@JanDvorak good question, the map_body.html is actually all smashed together in real time (aka no indentation whatsoever and it looks horrendous)
 
I'm commenting about the unbalanced quotes, commenting ugly is the next to come.
 
the last double quotes, yeah..idk what the heck is up with that
seems like theres a closer and no opener?
 
Completed 1000000 operations in 76 milliseconds.  13157895 OP/s when using DS.Map filled with 500000 integers
Completed 1000000 operations in 37 milliseconds.  27027027 OP/s when using Native filled with 500000 integers
Completed 1000000 operations in 215 milliseconds.  4651163 OP/s when using DS.Map filled with 500000 strings
Completed 1000000 operations in 154 milliseconds.  6493506 OP/s when using Native filled with 500000 strings
Completed 1000000 operations in 132 milliseconds.  7575758 OP/s when using when using DS.Map filled with 500000 floats
it's in bench/map.js
 
Ah, so that's what you were talking to copy about all that time :)
 
@DavidPardy if I remove the double quote on line 15, your HTML directly follows with javascript code. Shall I assume script tags here?
 
4:19 PM
yes, sorry, script tags are used
 
Well, I'm off to Python, talk to you laters :)
 
he was able to speed up his code too
by using special purpose map instead of {}
 
And yes, a three-line event handler is a bad thing. Use, in your case, a predefined constant.
</tr, then a newline, a bunch of spaces and then > - seriously?
 
like i said im a novice but i didnt write map_body.html
 
If that newline survives into javascript, then it could well screw the javascript interpreter. Javascript does not support multiline string constants. Could this be the case of your trouble?
The onmouseover handler sends displayCityInfoHover some very different arguments than you expect.
 
4:24 PM
well thats what I was saying, it looks godawful in vim but i guess u cant have the spacing like i do in codeshare: that was just to make it easier on the eyes. check the link again, i added it to show how it actually looks in vim codeshare.io/QohmL
i see...care to elaborate?
 
umm... that onmouseover handler is invalid javascript, unless some other code jumps in on the source and replaces the [shpxy precision=0 proj=image yf=",7" xf=","] thing with an integer before passing it to the browser.
It does look like a templating tag, but I've never seen this tag style before.
 
hmmm
 
That runaway double quote is present in the original file. It must be gone.
That's about all I can find there.
I'll be back in a few minutes
 
ok no problem
 
@solisoft Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
user1596138
4:40 PM
"I had the internet minimized and it kept popping back up! Something's wrong with this computer."
 
user1596138
My office...
 
user1596138
$('.bitches').be("trippin')
 
$('#pants').on('fire', function(){ alert('liar, liar')});
 
user1596138
^
 
@PicaMio Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
4:49 PM
@BenjaminGruenbaum Are you questioning the fact that the onclick attribute is the devil?
 
@jbolanos Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Hey guys, I am having trouble validating a bootstrap switch checkbox
When i validate with isset($_POST['foo']), it always returns false even when its set to "On"
Is this an issue with the js or?
 
@rlemon it looks like you didn't actually get a bad deal
 
@HarryBeasant looking at it quickly it looks like you may have to get the innerHTML to validate it.
 
@TheSnooker There is no way of doing it with PHP straight from the POST?
Ugh
 
4:56 PM
@HarryBeasant meaning that it looks like the <input> is repalced with a <span> in the HTML. So I would just check to see if inside the <span> it says "ON" or "OFF"
 
Damnit, that makes it annoyingly harder
 
@HarryBeasant actually I may be wrong
it looks like it just hides the <input>
but for some reason it doesn't seem to be re-writing checked="" inside the <input>
 
ah right
Is it possible for me to be able to do that
 
What is value of foo?
 
yes, with Jquery you can just
var input = $('switch').find('input');
input.on('click', function() { $(this).attr('checked','checked');});
something along those lines..
 
5:02 PM
@RyanKinal Yes.
 
actually no that wont work because the input is hidden so you need to edit it to

$('.switch').on('click', function() { $(this).find('input').attr('checked','checked');});
 
@RyanKinal , onclick is not the devil :)
 
Ooh okay, and i can add that to anywhere in that script
Well, within function
 
Not saying it's awesome or anything either..
 
!!write your own mailserver system or use an existing system
 
5:05 PM
@OctavianDamiean write your own mailserver system
 
Mhmm, sounds interesting.
 
LOL good luck :)
 
@HarryBeasant normally I like to put stuff like that after a (document).ready() {} so I know everything is loaded.
 
Challenging but also quite educational.
 
Hmm, okay, but if i switch if back, on and off
That; $('.switch').on('click', function() { $(this).find('input').attr('checked','checked');});
Wont change it back and fourth, ill have to make one to remove it right
 
5:07 PM
Holy mother of god ...
 
@HarryBeasant yeah good point. There might actually be something in that plugin that does this.. I've never use it but it seems logical that a plugin for making fancy checkboxes would have a way to tell if the check box was checked or not.
 
I'm doing a $.post() to get JSON from the servlet on a 1 min setInterval - the longer it runs the more it seems to bog down my computer - am I leaving out some sort of clean up?
 
yeah i thought that
It kind of makes the plugin pointless if it doesnt
But i will see
 
fucking computers
 
5:09 PM
@OctavianDamiean Command rfc learned
 
!!rfc 5321
 
Ah, great one.
 
<input type="foo" name="bar" value="baz" class="qux"> y people use such names? we can use like, <input type="web2students" name="benjamin" value="thesnooker" class="octavian">
 
@HarryBeasant found it
$('#mySwitch').on('switch-change', function (e, data) {
    var $el = $(data.el)
      , value = data.value;
    console.log(e, $el, value);
});
there is a switch-change event
 
5:10 PM
@web2students.com if that's just an example code, there's not a problem with that
 
Ahh! Thanks!
 
@HarryBeasant that would be the best way to get the value. Then all you need to do is change the attribute for the input and when you post it it will post normally to PHP
 
Wait confused where to put this code
I have put it on the bottom of my html page
 
My second Raspberry has arrived
 
Do i need that function for every switch I have
With its own unique ID?
 
5:13 PM
sounds like a job for class names
and possibly event delegation
 
$(document).on()
 
@HarryBeasant you could create a class for all the switches to share.. and then do something like this
 
@copy Sonofa! Two!?
 
@OctavianDamiean After I plugged the first one into my TV, I needed a second one as a webserver, of course
 
$('.Switchs').on('switch-change', function (e, data) {
var value = data.value;
$(this).find('input').attr('checked',value);
});
 
5:14 PM
:( I thought the dvd rom was DOA - had the dvd in upside down :(
and I call myself a techie
:(
 
@copy heh
 
@rlemon people still use DVD's?
 
i sometimes try to read RFC but when i reach, "The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC......." i stop reading it....it looks like after some time i have to buy new RFC dictionary and see meaning of all words like, is, am, are, the, etc it may be written at some place is means are, are means the , etc...
 
Microsoft does.
People still use floppies
 
I actually miss floppies
I had red ones - they were cool
 
5:17 PM
I got thousands of them
 
another chrome syntax error quirk
 
I threw out the last box of them - along with the 3gig of 100mb zip disks :)
 
console.log(1);
return;
 
@web2students.com that rfc basically says, "must" means "must, otherwise it won't be compliant, "Should" means "should, but if it won't, we won't complain" and "may" means "we explicitly don't care".
 
the code is actually ran
and then it notices syntax error and stops... it's not normal syntax error that is statically found
 
5:18 PM
@TheSnooker LOL
 
Okay thanks snooker
I will see what i can do with this
 
@OctavianDamiean Browsing the web on the Raspberry is a pain, or am I doing something wrong?
 
I have a few boxes of 4gb-40gb hdds (~200 of them) that the boss doesn't want to bin until we clear them off.
@copy anything GUI related on the rpi I never had any fun with
was way laggy
minus the few media centers which did a good job
 
I had a boss who wanted me to copy sever boxes of tapes to DVD - I died of old age that month
 
user1125394
arrg just passed 20 minutes finding the code to right pad flats in java, but actually need in in js :-<
 
user1125394
5:22 PM
it's String.format("%.2f", x) in java for your knowlegde
 
right padding is easy
 
!!/mustache jbolanos
 
mini-stache
 
user1125394
mustaches shoudln't be #000000 it's too dark
 
5:23 PM
it's actually #010101
 
@JanDvorak ok it looks like RFC writer are talking in court, it's good that there should not be any ambiguity but it distract my mind...
 
user1125394
make it #111111 or #111137
 
LOL
 
I need a free server (cors enabled) that will host a mp4 for me :P
 
user1125394
@Shmiddty thanks, I remeber doing it some month ago, but haven't the code now
 
5:24 PM
0
Q: What's the quickest path for being productive at client side development?

gtrakI'm a server-side junkie, and by that I mean I spend time writing code that's not visible to anyone. I'm interested in rounding out my skillset and becoming more self-sufficient with writing full-stack webapps. But, I find it difficult to work with the the sort of 'organic' client-side html th...

0
Q: Coffeescript Operators: use &&, ||, etc., or keyword operators?

nickcoxdotmeI often use js2coffee.heroku.com to help me convert JS to CoffeeScript. Here was a line of JS I was converting. if ( $this.is(':checked') && radioLabel.data('showif') === 'yes' ){ In CoffeeScript, I wrote this: if $this.is(':checked') && radioLabel.data('showif') == 'yes' As a Rubyist, I've...

 
anyone know of any such mystical services>?
 
i use to do such things in school days, beard on pictures,mustache female pictures, etc
 
something like:

Number.prototype.padRight = function(char, amount){
	return (this + Array(amount+1).join(char)).slice(0,amount);
}
 
user1125394
@rlemon I could for less than 20€/months
 
obviously, use toFixed if you want a certain number of decimal places
 
user1125394
5:26 PM
!!> var x=2.145; x.toFixed(2);
 
@cx "2.00"
@cx "2.10"
 
Number.prototype.padRight = function (l, c) {
    return this + Array(l + 1).join(c || 0)
}

console.log(2.1.padRight(2, 0));
> 2.100
 
@cx "2.15"
 
user1125394
2.1.padR... look so weird
 
user1125394
anyway as it's a number, toFixed seems cool guys
 
5:29 PM
:P
 
user1125394
except if you prove me your solution is 1000x faster
 
infinity x infinity faster?
 
user1125394
!!> 2.15.toPrecision(2);
 
@cx "RangeError: precision 0 out of range"
@cx "2"
 
@cx if you want a certain number of decimal places toFixed is the correct thing to use.
 
5:32 PM
@cx well toFixed is pretty fast. just use it
 
@cx "2.1"
 
user1125394
@Shmiddty yes I know just plaing
 
Number.prototype.toFixed = function(n){
    var t = Math.pow(10,n);
    return Math.round(this*t)/t;
}
but that doesn't work
 
@copy No, it's just a pain.
 
user1125394
!!> [2.15.toPrecision(2), 2.15.toFixed(1), Math.round(2.15*10)/10]
 
5:35 PM
@cx ["2.1","2.1",2.2]
 
The display might be thin but that entire thing is far from ultra-thin ...
Well, not that far but it ain't ultra-thin.
 
@OctavianDamiean was just going to say that
 
user1125394
lol at chinese, public class 文字列
 
.5" is ultra-thin.
 
Python people, any idea what might cause:

`NameError: global name 'SomeException' is not defined`
 
5:45 PM
writing articles about code sucks :(
 
I have an from exceptions import SomeException
 
my keyboard is for code, not paragraphs
 
//Where exceptions.py is:


class SomeException(Exception):
    pass
(If it matters, I'm inside a unittest.TestCase inheriting class
@copy @ThiefMaster Any idea?
 
so toFixed does a floor? interesting.
 
@Shmiddty I don't think so...
(3.766).toFixed(2) -> 3.77
 
5:55 PM
!!> 3.776.toFixed(2)
 
@rlemon "3.78"
 
oh
hm
!!> 1.55.toFixed(1);
 
@Shmiddty "1.6"
 
!!>2.15.toFixed(1)
 
@Shmiddty "2.1"
 
5:57 PM
... what's up with that?
 
!!> [1.15.toFixed(1), 1.25.toFixed(1)]
 
@rlemon ["1.1","2.1"]
 
looks like a bug
 
$("#that").what('up');
 
hrm, I get different here.
 
5:58 PM
!!>2.25.toFixed(1)
 
@Shmiddty "2.3"
 
bad test
 
hey, i don't know where to search for a help, so... what is modulo? :(
 
@rlemon ["1.1","1.3"]
 
oh it's mod
thanks, bye
 
5:59 PM
@Shmiddty 1.15 floors, 1.25 rounds...
 
@evening in JS, modulo is %
 
reeks of bug
 
yeah
it's in both chrome and FF
(assuming bot is still on FF)
 
is there some fancy math reason for this?
 

« first day (971 days earlier)      last day (3977 days later) »