« first day (1489 days earlier)      last day (3442 days later) » 

12:00 AM
Keep in mind that JS only have one number type, and it's floating point, with all of floating point's problems when dealing with currency.
 
12:25 AM
I need exactly 4 points.
 
ililuminati confrimed
 
12:42 AM
Is anybody in a debugging mood? I'm not too hopefully about that... I have a JSFiddle that is fairly trivial, as it generates Lorem Ipsum paragraphs, but I want to work out a few kinks that it has.
 
link? no promises
 
http://jsfiddle.net/kaloncpu57/7xbqb5ya/
I tried to stick some comments in there, but I'm not sure that I was detailed enough for most people.
 
It generates text.
 
Sometimes it will get stuck on a certain character or word length (specifically one), using it multiple times as with this text it generated. (Got stuck on the character "a" and a word length of 1):
"Obiqf a vdoaoee ob aghff the ibot epv. Exxmeoi a iqdqim llhlae vebava cliat. Xtpoy ex epae ji a yg emh ifyqewe ok. Ep qefbmd siwieax on pajq ol ov.

Igpste ocaaado a qioegko fct a a. Ogriw yfpoy iff vdivt sr xxk oq eh a. Dgooejs ortaoin aclrdm ki gaw ay. A a a a a a a a . Roo afd wqxoeml joloeyv wv aser."
 
hm
line 45: Is that supposed to be randge?
Because your rand() only takes one arg but you are triyng ot pass 2.
 
12:53 AM
Yes, randge() is a function up in the first few lines.
 
I know. Look at line 45. You call rand(2, 8)
i think you mean randge(2, 8)
 
Ah, yes. Thank you.
 
That line is supposed ot prevent single letter words in a row, but i think it causes it.
since rand(2) has a good change of returning 1, and word(1) IS being called when it does the "a a a a" thing.
 
After I made the switch for the Random Range function "randge()" I tried finding all of the old rand(x, y) uses, but I guess I did miss some.
Yeah that definitely fixed the "a a a a a" problem, but there are still a few instances of 2-3 of the same vowel or 3+ consonants in a row in some words.
 
I see single letter works that aren't 'a'. Is that supposed to happen?
 
1:02 AM
Nope, the first if statement in the word(len) function is supposed to prevent that, but I keep seeing it as well.
Oh... I went into the console and used word(2) which generated a word with 1 character...
That's weird though. Isn't "for (var i = 0; i < 2; i++)" supposed to loop twice?
 
i see another bug, too. The 'if' on line 44 doesn't have an else.
you can combien those two, line 43 and 44 into one if
if (text[i - 1] !== undefined && text[i - 1].length == 1) {
 
That doesn't need one. I could actually probably stick that if into the one around it.
Using &&
 
Give an updated link when you have one, please.
 
Alright.
I just ran "word(2)" line by line in the console, and it produced a 2 letter word just fine. I'm not sure why running it as a function produces a 1 letter word.
 
yea.. but it happens enough that it's a 'real bug'..
and it's in word().
It's not just word(2). Any word() call can return a result with one less letter.
oops. ALL calls to word() return a result with one less character. That should make it an easier problem.
 
1:23 AM
Yeah, I was just using 2 as an example. Although, I don't see why the for loop would run 1 less time than they are supposed to.
 
word() has an if, else if without an else.
 
Okay, I fixed that problem when I fixed the if(){if(){}} bug.
 
turn that elseif into an else and it words
yea, that.
 
It still isn't checking the previous letters for too many of a letter type in a row.
 
what did you change in word()? it needs an else. Did you do that?
ohh,i see your change
 
1:29 AM
I pulled the if, else if out a layer, so there is an else at the end now. You can just refresh the fiddle to see the update.
 
That block never fires, btw.
 
Which block are you referring to?
 
the "if the last two characters are consonants" if block.
it's never true.
 
Do you know why that is?
 
Noy yet, but it's a different problem than 'sometimes'.
 
1:38 AM
Yeah.
 
ahh, got it. it's the previous test always being true.
it's missing the != -1 when checking for vowels
 
Funny, I just noticed that as the chat notification went off. d:
 
Suggestion: this is very redundant:
text[i - 1] !== undefined && text[i - 2] !== undefined
Just use:
text[i - 2] !== undefined
 
Cool, from what I can tell it isn't using more than 2 consonants in a row. It still seems to get stuck on a certain character however. Words like "xxexsaf" seem unlikely to occur to me.
Ah, yes. Thank you for that one.
 
Or better yet:
text.length >= 2
 
1:46 AM
Hmm... Yeah, I guess I wasn't thinking about that too well.
 
309
Q: Best resources to learn JavaScript

TarksThe question says it all really, I'm looking for book recommendations, video tutorials etc. I've been programming since I was about six so I don't need a book that spends 4 pages on for loops (thought that might be a Bad example in terms of javascript). Also I'm learning ASP.net at the moment so...

how does everyone feel about questions like this.
extremely informative.... but arguably off topic for main.
should be in the tag wiki tho
 
Meloncholy
 
judging by your face, that is a common feeling
hug?
 
Can't. I'm allergic.
 
:gives a reassuring thumbs up:
 
1:56 AM
I think it's off topic in that "how to learn" isn't a question with a straightforward answer. It'll change over time.
But sometimes there are questions that don't quite fit stack overflow.. or the code review site
maybe more "programmers.stackexchange"?
 
there is a lot of good info in it. I don't think it should be axed but I do think it is off topic at the same time.
torn.
 
Must you either destroy or endorse?
(suggestion) Just some light refactoring for readability.
 
What all did you change?
 
only the contents of word().
it should be obvious
 
Ah, I see the new functions.
 
2:06 AM
As soon as I saw that same test copied and pasted (consonants.indexof(...) != -1) I immediately wanted to do that.
 
Awesome. That does look more aesthetically pleasing for sure.
 
Everything you write think "how will i change this when the need arises"
and if the answer is "find every time i copied and pasted this" it might be time t refactor.
 
A few extra functions I will probably add later are to make sure that any consonant pairs are actual consonant pairs. Nothing like "kx" should really show up, right?
 
Yup.
You may have to built a list of word 'parts' that work and glue them together.
 
That's good advice for any coding really.
 
2:09 AM
or have a few different 'styles' of word, and choose one.
 
Yeah, I think so as well. Like I said though, I will work on improving the end result later.
 
Yup.
 
For now I just wanted those basics figured out. Anyway, thanks for all the help.
 
or jsut use: hipsum.co :)
Artisanal filler lext.
 
Yeah, I know of plenty of good text generators. I just felt like working through one for myself. d:
 
2:13 AM
That wasn't a serious suggestion. It's just funny.
Hipster Ipsum.
 
Yeah, I've seen a few stereotype/accent Ipsum generators.
 
2:54 AM
image fillers are where it is at
ugh, I really hate how slow it is sometimes
I have nginx configured wrong I think
 
That looks both so good, and so nasty.
 
what are you seeing?
it's random
 
I know
 
lol
forgot what ones I put in there
 
It looks like the kind of pizza you'd eat two of after failing to get a date on a Saturday night and before cryfapping yourself to sleep.
 
3:00 AM
that is a little specific ... do you wanna talk ?
hug?
 
nah, I'm great
 
i'm starting to get looks at the gym. that is always a good sign.
 
Leafs are up 5-1 on the Bruins. I'm happy.
 
nice
 
 
2 hours later…
5:07 AM
!!urban doodle
 
@monners [doodle](http://doodle.urbanup.com/783009) (n.) penis

(n.) random, thoughtless drawings on whatever topics happen to be flowing through the artisits' head. Often done to relieve boredom.
 
/me snickers
 
/me mars
let the word doodles begin!
 
5:43 AM
Is this behavior defined?
```
Foo.a = 5;
function Foo() {};
console.log(Foo.a) // => 5
```
It works in my browser, but seems slightly odd to me.
Oh, nevermind, hoisting.
 
It is defined
Who the hell sets properties on functions, however?
 
5:59 AM
Hi friend I want to create input validation using javascipt when user click on input box and don't input any value and here is my code
<script type="text/javascript">
$(document).ready(function(){
$('.quantity, .unitprice').on('keyup', function(e){
var errors = array[];
var quantity = document.getElementsByClassName('.quantity').val();
var unitprice = document.getElementsByClassName('.unitprice').val();

if(quantity== ""){
errors = "quantity is empty";
}
if(unitprice== ""){
errors = "unitprice is empty";
}eles{
if(errors){
forearch(errors as errors){
alert(errors);
}
}else{
calculate();
}
}
});
function calculate(){


var qty = parseFloat( $('.quantity').val() ),
But it is not work
 
!!tell heng format
 
@JanDvorak Command forat does not exist. Did you mean: format, forget (note that /tell works on commands, it's not an echo.)
@heng Format your code - hit Ctrl+K before sending and see the faq
 
@hengsopheak >eles
 
6:17 AM
oh sorry i will do it again
<script type="text/javascript">

						$(document).ready(function(){
							$('.quantity, .unitprice').on('blue', function(e){
							var errors = array[];
							var quantity = document.getElementsByClassName('.quantity').val();
							var unitprice = document.getElementsByClassName('.unitprice').val();
							if(quantity== ""){
									errors = "quantity is empty";
								}
							if(unitprice== ""){
									errors = "unitprice is empty";
								}eles{
									if(errors){
										forearch(errors as errors){
 
document.getElementsByClassName('.quantity').val(); is this legal with jquery?
 
@hengsopheak less indentation please
@Meredith no; jQuery doesn't modify native DOM nodes.
 
I should used this
var quantity = parseFloat('.quantity').val();
var unitprice = parseFloat('.unitprice').val();

Right
 
No
 
@hengsopheak no
 
6:30 AM
Now it is work http://stackoverflow.com/questions/26902480/how-to-use-javascript-for-html-form-validation-to-valid-number-only/26902566#26902566
as well
 
6:49 AM
I am so glad that the syntaxes that we use here are the same on markdown
that makes me already familiar with a few :P
 
@BenjaminGruenbaum can i use bluebird promisifyall on child_process?
 
7:18 AM
@phenomnomnominal sure
@SecondRikudo yes
@SterlingArcher we can resolve that with voting
 
7:43 AM
Is there any decent GUI library for Node.js (and I don't mean a browser)?
 
8:04 AM
s/GUI//
hi :)
 
anybody tried firefox devloper edition?
 
@JanDvorak web GUI is amazing compared to most of the alternatives, I'd use that - there are tools that bundle nodejs with webkit and let you code your app like a website.
@BartekBanachewicz you know, if you prepend !! to that, the bot would actually execute it :P
 
@BenjaminGruenbaum I'd like both a decent GUI and network + filesystem access, and I have quite a bit of javascript code already that I might be able to reuse.
link?
Oh and easy deployment would be nice - I will be the sole user of my app
 
@JanDvorak node-webkit?
 
8:20 AM
@FlorianMargaine thanks
 
It's a webpage bundled in an app... But since it's node you have fs access etc
And it's backed by Intel
 
Yeah node-webkit is one such project
 
@BenjaminGruenbaum yeah, I know. I don't think it's particularly useful though :P - like explaining a joke
 
Morning
 
hi all
anybody has an idea on how to manage mousewheel zoom in an svg canvas? :)
 
8:32 AM
 
@SecondRikudo mornin
 
so this month's challenge is clojure?
 
it's w/e you want
 
Probably, it's either css minifier in clojure, autocomplete with ko, or irc bot in ada as it seems. If you have other ideas please post them.
 
or you can mix...
 
8:34 AM
It's whatever will have the majority of the votes in 4 days on that meta post
 
if you want irc bot in clojure
 
That would kind of mean we can't reuse ideas that weren't selected though, and it'd be less of a shared learning experience, wouldn't it?
 
@BenjaminGruenbaum I thought next one will be next one in voting order
 
@BartekBanachewicz next one will be based on another meta post, like the community advertising, at least that's what I thought.
 
@BenjaminGruenbaum I am thinking about one
wondering whether a web app is a good idea
 
8:36 AM
@BartekBanachewicz you can resubmit ideas if they weren't elected.
It has to be no more than a night's work
 
@BenjaminGruenbaum I bet I wouldn't be able to get this nokoutsj thing to work in a month's time
If you're unfamiliar with some technology, setting up the environment and fiddling with absolutely basic examples takes at least 2-3 hours
if you decide to go on and implement your idea at that point you're ultimately going on "produce crappy code" route
 
@BartekBanachewicz knockoutjs is a library, learn.knockoutjs.com
@BartekBanachewicz we'll probably all produce crappy code on these challenges - the idea is to learn new technologies, while I've played a lot with Knockout 2 I've never used Knockout 3 in production and I think it could be a nice experience.
 
I don't feel good when writing crappy code.
I mean, it's cool to learn new technology
maybe I don't get this "one night's work" requirement
 
It should be small enough that people will actually do it.
 
I think stepping the requirements could be a good idea.
 
8:43 AM
@BenjaminGruenbaum How about: "These are the basic requirements, bonus points if you add stuff"?
 
Example: Write a random source webapp in haskell
- Bronze - return a random integer each time someone visits a site
- Silver - give the user the ability to pass their own seed, return a number of values
- Gold - return a randomized BMP(PNG) image with a pattern.
 
@SecondRikudo bonuses might be a good idea.
 
I thought something like that ^
 
@BartekBanachewicz it's "monthly challenge"
one night's work if you know the technology, imo
 
8:44 AM
but indeed, you have to go through the step of learning the tech
 
I'd say that various levels are nice because they naturally guide you in the next things you should learn
 
meh
we're all experienced devs
we go through the tutorials and get shit done
 
@FlorianMargaine yes, you JS people typically get shit done
I got so disgusted by our local JS community attitude precisely because of that
 
@BartekBanachewicz while you haskell people don't get past the intellectual masturbation step, eh?
3
 
@FlorianMargaine I suppose both are a bit over the top.
 
8:52 AM
you know, "getting shit done" is an expression to mean "get this done". It doesn't mean we do it badly.
 
that being said, I'd much rather talk about something nice and appreciate beauty of software constructions than work with crappy tools to get the job done
@FlorianMargaine incidentally, that's what I think about JS and its ecosystem
 
by "we're all experienced devs", I mean that we know how shit is done in multiple languages/frameworks, we know SOLID, we know SoC, etc etc.
 
yeah I mean I agree with that part
but still... I had previous experience with software before I started writing haskell
and it took me a year to start writing anything reasonable in it
 
Uh. Just dropping in... Are you seriously arguing that the JS ecosystem and tooling is crap in a JS room?
 
and imho, the js (at least the nodejs) ecosystem makes it very easy to write modular code
 
8:53 AM
Hi Javascript!
 
@RoelvanUden yes, ignore it and move on.
 
@RoelvanUden he's got a point
grunt sucks balls, callbacks suck, promises are a decent patch for previous sucker, gulp is "meh", etc etc
don't mention jquery
angularjs is so lol with "hey bc break lolilol"
so yeah... the ecosystem has its bad parts, that's for sure
 
Sure, but any language has its bad parts. It's about getting to the good parts imho.
 
@BartekBanachewicz that said, a point I really like about nodejs: many modules are very simple, very composable. There is the culture of doing simple libraries that do one thing and do it well
@RoelvanUden we're talking about the ecosystem, not the language
the language itself is meh... but good enough imho. it scatters to multiple levels of programmers, which is good for a language to be used professionally.
 
@FlorianMargaine I'll give you an example on why I disagree
 
8:57 AM
Nevermind me then. Any ecosystem that has some popularity will have good and bad parts. Unless there is absolutely nobody using it, bad parts will always be published. :P
 
consider Collections
it has some data structures. Now imagine a library with some algorithms.
 
The JS ecosystem is amazing.
 
sans one of the many versions of for loop (the one with generators, I think), there's no way this library could interoperate with Collections
 
@BartekBanachewicz exactly my point. You want a Set? npm install set. You want a b-tree? npm install b-tree... you get my point
 
It's just hard to have a perfect system. If it ain't broke, don't fix it.
 
8:59 AM
I've not seen such a vibrant ecosystem ever before in my years of software development, nothing comes close.
 
@FlorianMargaine yeah, but each of those has its own idioms
there's no common interface for data structures
 
And the community decides which idioms work best.
 
there's no common interface for anything.
@BenjaminGruenbaum that's missing the point by a parsec
 
Yes there is, have you actually coded node?
 
if this becomes an issue, the "community" decides on an interface. See Promises/A+.
 
9:00 AM
@BartekBanachewicz how so?
 
@BenjaminGruenbaum yes. My BSc project is on node, and I regret this choice deeply.
 
What does your BSc project do?
 
My part is a vDSL compiler
 
I wrote compilers in JS, it's ok-ish.
 
@BenjaminGruenbaum Honestly whenever I see BS I read that as... not the way you intended it :P
 
9:01 AM
NodeJS is really more for driving stateful backends.
 
@BenjaminGruenbaum If you have some time, would you mind glossing over what I learned about Promises/Generators/Iterators? I added a simplistic library for control flow to github.com/Deathspike/co6/blob/master/index.js. Nevermind the fact that I'm still allowing Generators to be treated as promises. I'd appreciated your feedback :-)
 
that way or another, it was a bad choice
@FlorianMargaine this takes time, and still isn't guaranteed to come out alright. why? I don't have a better answer than Haskell, I think.
 
@RoelvanUden it's great that you're building stuff. I wouldn't use that in production for a few reasons though.
 
Haskell's fundamental typeclasses aren't "decided by the community"
 
@BartekBanachewicz I'm not arguing it was a good one.
Haskell is a horrible language for what Node is used for. I tried several times.
It's a lot harder to reason about Haskell code.
 
9:03 AM
@BenjaminGruenbaum but then again we all know your Haskell is way worse than your javascript
 
There is a reason why there is a "Haskell hype" for 10 years now yet so few people use it in production.
 
and you've never shown us your attempts with any real problems pointed out
 
I've done so several times in the past.
 
@BenjaminGruenbaum I see it used more and more, now people have realized it's actually viable
Static guarantees it provides outweigh any drawbacks it might have by a ton
 
@BenjaminGruenbaum It's not battle tested for sure, and native promises might simply suck at this point. But concept wise and implementation wise, feedback appreciated :-)
 
9:04 AM
it produces correct and fast software.
well of course social matters are important here too
most of people who write haskell have picked it up as their 3rd, 4th, 5th language...
They are people actually interested in writing software, not java drones.
 
I am trying to populate data from openweather api and then pupolate in bootstrap popover. CHeck this code in pastebin. Can anyone please explain where exactly I have mistaken? pastebin.com/FSDzfFxZ
 
@anupam_on 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.
 
HI @all
 
@shantha.kumar 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.
 
@CapricaSix sure thanks
 
9:19 AM
@BartekBanachewicz have you tried Ada?
 
@FlorianMargaine yep
 
it's a very strongly typed language too, why isn't it used more?
 
not very long, but overall left a pleasant impression; I never stepped out of the stdlib though
@FlorianMargaine "more"? How much more do you want it to be used?
It's quite popular.
@FlorianMargaine I mean you could argue that because software for aeroplanes and cars is about 0.1% of whole software written on earth, even if Ada was the only language used there (effectively monopolizing that branch), it still isn't 'used'
but that's silly.
 
@RoelvanUden isPromise should only check .then, it's also relatively slow. Promisify (and .all) are very erm... naive and likely slow.
@BartekBanachewicz are you using Haskell at work?
 
@BenjaminGruenbaum no.
 
9:25 AM
@BartekBanachewicz why?
 
@BenjaminGruenbaum Because nobody at my company saw it fit to utilize in production? Because we don't have many developers that know haskell?
I can only guess
 
@BartekBanachewicz you should tell them how awesome it is.
 
@BenjaminGruenbaum I prolly will. Some people there do know it.
 
@BartekBanachewicz you should suggest they migrate all their code to Haskell.
 
sigh.
you know.
 
9:32 AM
@BenjaminGruenbaum .catch is not part of the A+ promise spec? I'm using it and relying on it, so shouldn't I check it? I can easily swap out Promise for Q, Bluebird, when, etc. I expect the build-in promise to improve before finalization though, so for me this intent was to learn and build non-critical non-production tools, where the built-in one is fine.. for now, I think. Or are there additional considerations I have to take? :-)
 
I am glad you like writing in JS
at least I don't have to.
 
@RoelvanUden it is not a part of the A+ promises spec, in practice everyone has it though.
@RoelvanUden promisification with native promise is inherently slow.
 
anyway lol this promises thing gives one observation
if js wants to steal stuff from haskell, it should at least do it properly
 
document.write("Hello!");
 
9:39 AM
@BartekBanachewicz you should really work on your rhetoric.
(Not to mention that you're completely wrong on both regards here, it did not 'steal them from Haskell' and they're proper)
 
@BenjaminGruenbaum right
of course you're right. Now go and use your shiny promises in production code.
or in any code
 
@BartekBanachewicz promises were used in programming when Haskell was still not even a thing.
 
@BenjaminGruenbaum yeah, whatever
I've realized I actually don't care about javascript in the slightest.
 
Bartok
 
9:43 AM
You should really work on that attitude problem of yours.
 
@BenjaminGruenbaum actually doing so now
 
document.write("chill yo");
 
Because the rule in CS is you only get to act rudely to others if you build stuff. Your counterargument to JS should be something better, your counterargument to JS promises if you really dislike them should be something better.
 
@BenjaminGruenbaum Ah cool. Thanks :-)
 
9:45 AM
@BenjaminGruenbaum I made myself a handy note
 
@RoelvanUden it's mainly the fact you have to allocate a clousre.
@BartekBanachewicz sharing that note here is in itself rather rude. Then again you already know that.
 
@BenjaminGruenbaum why? I believe in openness
 
No you don't, you're just trying to impress us and to show us how much of a badass you are. Making lists of stuff you don't like is insanely counter productive imo.
 
@BenjaminGruenbaum I already told you numerous alternatives and how they are better, but since you don't agree I can just shrug and let you go your way. I am sure you are a competent developer and you believe in your choices.
@BenjaminGruenbaum I'll add talking about making lists to the list.
 
I am trying to populate data from openweather api and then pupolate in bootstrap popover. Check this code in pastebin. Can anyone please explain where exactly I have mistaken? pastebin.com/FSDzfFxZ
Please check this
 
9:58 AM
@BartekBanachewicz Sorry, what according to you are the better options? I am curious about them.
 
@RahulDesai depends on what your goal is.
For most of the things I prefer Haskell.
 
I quite like Django for typical CRUD apps with heavy models.
 

« first day (1489 days earlier)      last day (3442 days later) »