« first day (1781 days earlier)      last day (3170 days later) » 

7:00 AM
@ZhengquanBai English is fun, isn't it?
 
Actually +25 but some people thought downvotes in that thread are meaningful lol
 
Chinese is also fun too. We have no spaces. Go figure! :D
 
user3119231
'<form action="system/php/register.php?action=register" method="post" onsubmit="return confirm('Is the form filled out correctly?');">'
 
user3119231
any way to get it working with " and ' in the script part?
 
是的,确实挺好玩的
 
7:02 AM
@Maurize '\'\"' "\'\""
 
Ugh simplified characters
 
user3119231
@Sheepy what. the. hell :D
 
Yes. A big thanks to Communist Party of China. They say they did it to keep Chinese complexity down. Now we have two ways to write the same characters. So much simpler!
 
They don't even make sense
 
user3119231
You don't.
 
7:04 AM
!!tell Maurize google javascript character escape in string
 
@MaiLongdong I think a tiny portion of them do. The country 国, for example, a king 王 in a wall 口 holding a rod 丶. Or follow 从, one man 人 followed by another 人. But no, I can't agree with a love character without heart 心 in it, so I agree with you. Only the traditional love 愛 make sense
 
ITT a Honkie teaching Chinese to another Honkie
good job
 
user3119231
@Sheepy are this chinese characters or just random symbols?
 
@Maurize Chinese characters. All of them, except the dot :)
 
7:11 AM
@MaiLongdong Wouldn't it be efficient costly to use traditional Chinese than to use simplified Chinese? (筆畫 vs 笔画)Traditional Chinese is so difficult to spell right.
 
Implying simplified is any easier to spell
 
@ZhengquanBai No, we don't think so. But please agree to disagree and don't bring this topic to an English chatroom.
 
Yeah it's heated enough :D
 
Okay. Let's cut it out.
 
Hiii . if any one have use twitter typeahead Js, then please help.
http://stackoverflow.com/questions/32317432/autocomplete-with-twitter-typeahead-js
 
7:22 AM
We have enough of our own versions of this. It is sad when a Java programmer cannot read my Java 8 code... I fully expect the same for ES6 in one or two years :\
 
Hm, Chrome just disabled the Youtube chat plugin.
Screw you, Chrome. I want that. I installed that -.-
 
@Sheepy an 'es6 developer' not being able to read es5?
 
when will java break backward compatibility?
java 9 black edition ?
 
They don't. Neither will C#. Both are in dire need to clean up their legacy crap.
 
i think you'd be better off just using a different language entirely
 
7:27 AM
write your own language with C bindings
 
so java's new upcoming modularizing things are a step to cleanup?
 
A new, modern language like Go or Angular that has no legacy craps? Hmm. Wait a moment...
@argentum47 That will be a tool for you to say "My apps don't need this and that legacy module". But those legacy code will still be in the full Java, never going away.
 
And language design can't break backward compatibility (e.g. no 'non-nullables')
 
Backwards compatibility is the root of all evil.
 
angular 2 breaks backward compatibility .. most libraries have broken some compatibility at some point of time I guess.. thy termed them as "breaking changes" in readme
 
7:30 AM
Well, I'm glad I can play my DOS games on Windows 10. And that I don't need to update the code for the Java programs I wrote, let me see, around 15 years ago.
 
user3119231
 
user3119231
someone can have a look at my "search in users" problem?
 
user3119231
No errors, no action...
 
Below is the representation on WorkerBee.prototype = new Employee with below code. Is my understanding correct?
 
@Maurize this.getElementsByClassName will gives you empty result because this would be the input element. Which has no children.
 
user3119231
7:36 AM
@Sheepy this.parentElement.getElementsByClassName("conversation"); could work?
 
sorry it is WorkerBee not Worker
 
@Maurize How about window.getElementsByClassName? Always work.
 
Hello
 
user3119231
type error - is not a function
 
user3119231
 
7:41 AM
Morning guys
 
@Maurize You are right. Should be document. Now it ways check is undefined.
 
user3119231
my question is why it is undefined?
 
parsedData.filter(function(element){
	return filtered_data.push(element.id == "purchase_comment");
});
 
@Maurize jsfiddle.net/prLhvu7m Because it should be textContent instead of value. And computedStyle is under `window. Working now.
 
Guys how can I return an element while pushing it an array ?
 
user3119231
7:44 AM
@Sheepy this is it! Thanks for your help!
 
I'm trying to populate a <textarea> with a Select query so that I can Update the content. I have several buttons that create all a different query. when I alert() the response I can see the content inside the <textarea> in the alert() popup .But not in the current html
 
@ZahidSaeed ([1,2,3].push( e = 4 ),e)
 
I hope this makes sense :P
 
@Sheepy I didn't understand that code
I'm using the Array.Prototype.filter() method
 
@ZahidSaeed It pushes 4 into [1,2,3] and return the 4. filter always return you a new array.
@Poteito Sounds like an error in your code.
 
7:47 AM
@Sheepy But I didn't see the return command
:/
 
@ZahidSaeed Well, you may put a return before it. :)
 
@Sheepy I got that but I'm just a bit confused for that you did with that 'e' variable
Why did you put (data, e)
What's that e is doing there ?
 
@ZahidSaeed The push function does not return anything by itself, so I use a variable to store the pushed value to fulfill the requirement of "return (evaluate) an element while pushing it an array (in one line)".
 
@Sheepy But that's not checking an element for a unique ID !
If i put e == 4
That returns false
Of course that element isn't in the array yet
But I want to push an element in the array whose ID is equal to some ID that I want
 
@ZahidSaeed Ah I see. I missed your filter code above and misread the question as a simple one.
 
7:55 AM
@Sheepy Is it because the php already load ?
 
@Sheepy So how can I do it now ?
 
@Poteito Not necessary. Hard to say. Need to do a little dance with the code called debugging.
 
@Sheepy Is it possible ?
 
@ZahidSaeed Can you rephase your question? I am a bit lost. filter would applies to multiple elements. What do you want it to return?
 
@Sheepy I want to push an element with some ID that I want in the 'filtered_array'
 
7:58 AM
Ok, is this what you want? var filtered_data = parsedData.filter(function(element){ return element.id == "purchase_comment"; });
 
@Sheepy But that returns only true
Rather than I want to return an element
 
The filter function only care about true / false and returns filtered elements.
 
@Sheepy Well I am. How would you proceed when trying to fill a form with a query ?
 
@Sheepy tbf, i advise to use === for comparisons in javascript
even for strings
 
!!> [{id:"yes"},{id:"no"},{id:"yes"}].filter(function(element){ return element.id === "yes"; });
 
8:01 AM
@Sheepy [{"id":"yes"},{"id":"yes"}]
 
!!> [{id:"yes"},{id:"no"},{id:"yes"}].filter(el => el.id === 'yes');
 
@MadaraUchiha []
@MadaraUchiha [{"id":"yes"},{"id":"yes"}]
 
Yey arrow functions!
 
:p
 
I think I or Zahid is confused enough without fat arrows (roll eyes)
 
8:04 AM
do you want to see the -> instead of => ?
 
I still didn't got my answer :/
 
@ZahidSaeed Here's [].filter:
 
From my PHP and Java point of view, hell yes! Let's make it more confusing! :D
Oh, C++ can join the party too!
 
i also don't know why they have decided to use => for lambda's
most other languages uses ->
 
Array.prototype.filter = function(predicate) {
    var theArray = this, result;
    for (var i = 0; i < theArray.length; i++) {
        if (predicate(theArray[i], i, theArray) {
            result.push(theArray[i]);
        }
    }
    return result;
}
 
8:06 AM
@KarelG Good question. And there is a reason. For ES6 it is to make it compatible with CoffeeScript.
 
@MadaraUchiha why refcopy this to theArray?
 
bah coffeescript
 
@AwalGarg readability. Newbies might not be aware that this is the actual array
Decided I'd make it perfectly clear.
 
Yeah :| Well, it helps adoption.
 
fair enough
 
8:08 AM
@AwalGarg I actually forgot to initialize result to [], but meh
 
@Sheepy I did this :P
parsedData.filter(function(element){
	if(element.id == "purchase_comment"){
		filtered_data.push(element);
		return false;
	}
});
Is it ok ?
 
@MadaraUchiha and to lint your code :-P
 
@ZahidSaeed No.
 
@ZahidSaeed What do you want to do? You want to push and filter? Can we, say, filter and concat instead?
 
@MadaraUchiha Then tell me the correct way to do it.
 
8:10 AM
@ZahidSaeed Did you look at the filter implementation I've posted above?
That's how filter is functionally implemented
 
return element.id === 'purchase_comment'
 
@Sheepy I want to push an element in an array that has some ID that I WANT
@AwalGarg That returns true !
I want to return the element
Not a boolean
 
!!tell Zahid mdn array, filter, foreach
 
Zahid, Did you see our code 10 minutes ago?
 
8:12 AM
@Sheepy I did and I even tried it
 
Why would you insist on pushing in filter callback and returning the element? I think we don't understand that. You can get your filtered list without pushing.
 
But it returned:
[false, false, false, false, true, false, false]
 
please read the three links before continuing
 
@ZahidSaeed Let's try it this way
What do you have and what do you want to reach?
(I have an array/object/collection of _________ and I want an array/object/collection of ________)
 
@MadaraUchiha just sayin: Not 100% sure if this will help. OP's problem is most likely very simple and will be solved if they just RTFM once.
 
8:15 AM
@MadaraUchiha I have an array of objects and I want to filter that an array by pushing each element to a new array that matches an ID that I want
 
@ZahidSaeed No implementation details
 
really, I wonder sometimes
 
You want an array with all the elements that match an ID
 
@MadaraUchiha Yes
 
Must you call the push or filter function? Or is it ok as long as you have the new array, no matter how?
 
8:17 AM
Yeah I don't care about using push or filter function
 
@ZahidSaeed Filter is an array method that takes a function, it iterates over the array, calling the function on each of the array elements in order, and returns a new array with only the elements that the function returned a truthy value for
Array.prototype.filter = function(predicate) {
    var theArray = this, result = [];
    for (var i = 0; i < theArray.length; i++) {
        if (predicate(theArray[i], i, theArray) {
            result.push(theArray[i]);
        }
    }
    return result;
}
This is how filter is implemented ^
@Sheepy ...
 
Shaun
 
Ok. But I posted that, like 20 minutes ago?
 
With that information in mind, what do you think you need to do?
@Sheepy XD
 
@MadaraUchiha Y U STILL NO LINT!!!
there should be this magical place on the internet where you go and get pocketmoney for lil coding jobs
 
8:24 AM
@ZahidSaeed When using `filter` function, it expects a boolean function as argument. The code will run through the given array and uses the boolean function to determine if an element should be returned or not.

a boolean function is a function which either returns **true** or **false**.

an example of using filter on an array is here below
myArray.filter(part1 => part2);

// the filter argument has two parts: part1 => part2
part1 = a variable which represents each element in the array. part1 means an element of the array
part2 = boolean function. You are testing the given variable `element` (from the array) to check if it what you want.

// example myArray is an array of fruits, which contains apples, pears, (r)lemons, ...
var result = myArray.filter(fruit => (fruit === 'apple')); // result has only apples
var result = myArray.filter(fruit => (fruit === 'apple' || fruit === 'pear')); // result now has apples and pears
 
Array.prototype.filter = function(predicate) {
    var theArray = this, result = [];
    for (var i = 0; i < theArray.length; i++) {
        if (predicate(theArray[i], i, theArray)) {
            result.push(theArray[i]);
        }
    }
    return result;
};
@AwalGarg happy?
 
s/ {4}/\t/g
 
are you a sloth ? :o
 
Is production code written(preferred) using class based approach(if required) in JS for new projects? I understand that class based code internally works on prototypical inheritance. Is the knowledge of prototypical inheritance crucial for only existing applications getting enhanced?
 
removed content :D
 
8:27 AM
@AwalGarg no
 
FAIL
 
if you get a result, then it's from the cache
PS: can you undo the direct link ? 2 gifs is too much
 
2 gifs is exactly 2 more than the maximum limit
 
i don't mind a sporadic gif placement
@JanDvorak : * gives a broom * can you clean up ?
 
8:29 AM
Party poopers
 
how does an gif image format provide video like feel? It is a static file.
 
@overexchange It contains all the frames
 
@overexchange It's an optical illusion
 
Or rather, the first frame, and then for each frame, the difference from the last
 
8:30 AM
Then your computer plays it fast enough to give the illusion of movement
That's how all videos work
 
the browser just loops through the given frames, provided in the gif data
 
mp4 kind of files are read by the players(VLC) continuosly to provide the video like feel
 
@MadaraUchiha should soon change
 
@MadaraUchiha it's not only the computer, but also the timers set between each frames. If it's slow, you get a choppy video
 
@AwalGarg How so?
@KarelG The computer eventually plays it according to whatever rules it sees fit
 
8:39 AM
@MadaraUchiha read something on YC about it recently. Some people found a way to estimate what parts of the change in frame is not noticeable to human eye, so they discard that change. also s/soon/sometime/
 
8:51 AM
any ideas guys? this should be an easy fix.. do I need a sh script instead?

https://stackoverflow.com/questions/32316990/running-ln-s-doesnt-work-in-npm-postinstall
 
@MadaraUchiha I think one has to understand the gif format and its reading logic by the player like mspaint
 
or maybe I should use a terminal emulator to cater for windows?
 
@SuperUberDuper What is that command?
You want to create symlinks in a npm package? why?
 
"postinstall":"ln -s ../../dist foo/dist"
create symlink
on mac
 
But symlinks in a package? :|
 
8:59 AM
not in a package, they should be created after install
I have a folder and lots of demos that need to use this folder, and I dont want to have build script for each of them
and i dont want to seperate dist into a seperate npm module either
 
I would hate an npm package to make symlinks on my machine. If my machine is even capable of it. Examples should be on the repo, not in the npm package, it's just bloat I don't need or want when installing a package.
 
so I should have build scripts on all my demos?
The means the user has more work to do to get the demos working
 
A windows user is basically fucked if you try to rely on symlinks though, unless it was added in Win10 or something
 
so I have a cross platform symlink..
 
Windows can do symlinks on NTFS since Vista IIRC. But if you don't have NTFS...
Still, I wouldn't want them. Distribute a demo ZIP that you pre-build?
On your repo.
 
9:10 AM
ok I'll have a prepublish script that bundles the dist into the demo folders
is there a cross platform way to do this without using grunt and gulp?
maybe a terminal emultator
 
No. No emulators. Write robust commands that work cross-platform.
I don't know what prepublish script you have so I can't give a clearer advice.
 
I just want to copy files from one dir to another.
mv /a /b
but that will be a sh script
but for windooze?
 
unobtrusive JavaScript
 
there are npm modules for some common shell commands, like rimraf for rm. Might be something similar for cp
 
in react es6 why do they do super(props)
 
9:15 AM
everything npm installed is available on PATH for your npm scripts
 
I know I have access for the PATH, will look at rimraf thx
 
@argentum47 useless non standard extension from JSX
 
@SuperUberDuper rimraf won't copy files, it will delete them, but you might find something similar
 
@SuperUberDuper You can use my package, github.com/Deathspike/npm-build-tools
 
Or you could just whip up a node script that does it, node has the fs module
 
9:19 AM
In this case you can use n-copy
 
its a shame node doesn't have this modules built in
thx Roel
 
rimraf is also in npm-build-tools as n-clean
(less dependencies that way)
 
@RoelvanUden That looks handy, starred
 
@RoelvanUden n-clean ?
 
9:32 AM
Who uses Jack'd
 
@AwalGarg :( does props corresponds to propTypes and context to contextTypes .. ?
 
god knows
 
@AwalGarg Non standard?
 
@BenFortune super doesn't take anything in es6
 
You mean initializing props or super?
Ah
 
9:36 AM
what does that mean?
 
@AwalGarg Wait, surely it does?
 
read again
 
What about when extending a class, and you need to initialize props on the class you're extending?
 
the JSX component class doesn't receive arguments, so had it been pure es6, super(anythingHere) would be useless
 
ReactComponent takes two args props and context
 
9:53 AM
FWIW, no JS interpreter currently (as of 2015) supports class. The only way to use class is to use an es6-to-es5 compiler. And only a few such compilers support class. And even in those cases some are known to have buggy implementation of class. So in my not-so-humble opinion, production code should not use class. Which means they must use prototypes and constructors. If history is any indication it will stay that way until around the end of 2016 or early 2017. If your boss can wait that long for you to START a project then go ahead, use class in production code. — slebetman 39 mins ago
 
generally ppl tend to transpile es6 code
 
@overexchange spidermonkey supports es6 classes
 
@overexchange As does chakra
 
@overexchange MDN says V8 supports it since v42, too.
But my Chrome doesn't. May be hidden for extension code like Firefox do? MDN may be wrong, yeah.
 
Am not sure, what spidermonkey/v8 are? Am yet to learn versioning of ES with corresponding interpreters. I never used JS in a browser. Currently am learning JS as a language.
Js beginner
Layman answer from slebeten helps me
 
10:02 AM
Maybe you should experiment more first. You can read whole world's cook book and memorise a thousand recipes. But if you haven't cooked, you won't make much use of them.
 
@Sheepy Only accessible from a flag afaik
 
And you would have a hard time convincing chefs they should teach you fancy cooking techniques.
 
Ok. Running out of time. Parallely doing some java stuff
 
@BenFortune Already enabled. Found the problem - console does not default to strict mode.
 
@Sheepy I remember asking about that ages ago. Can you set the console to strict mode yet? Or do you still have to wrap everything in an IIFE?
 
10:06 AM
I rarely use Chrome so I may not be qualified. I know I am still wrapping.
 
How to compare two array of objects and find they are same?
 
@overexchange Well, you can code, compile, run, and debug JavaScript in Java. That is what I am doing :)
@Ant's Turns them to JSON and compare as string. Inefficient but simple.
 
user3119231
how are you executing php without refreshing page or similiar? Is there a js trick?
 
@Maurize Ajax.
 
user3119231
@Sheepy But is it only me or is ajax everywhere slow?
 
10:11 AM
@Maurize Ajax by itself is not slow. It avoids the round trip of tearing down the whole page and recycle all JS objects and rebuilding everything. It is supposed to be faster.
 
@Sheepy: Yeah guess that will work! Thanks nice idea!
 
user3119231
@Sheepy any reference link for fast ajax requests? :D
 
Create a small, static html or json file, rename it to php, and you get the fastest PHP server-side respond you can get.
Anything slower, it would be because of php code
 
10:24 AM
Oh and, on JS side, use Element.remove and insertAdjacentHTML to remove from/insert to the end of changing area. These two functions can be highly efficient.
 
10:39 AM
can we use memsql with javascript?
 
depends. Can you use node.js?
 
11:19 AM
hi everybodyyyy
 
@Hamed_gibago 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.
 
I want to ditinguish users in my nodejs game
everytime socket.on('connection')
happens
I want to create new player
it means it gets to new game
but if a player press F5 again socket.on('connection') happen
and 1 players can play az 2 players. its strategy game and players trade with each other
shall I check Ip address of player and mix it with socket.Id connection and create players based On this and check in server side for cheating player?
 
Just log them in via an account.
 
Yes, that sounds like something you want to do server side
 
is it write method ? or there are more simple ways to do?
will you explaine account?
you mean before playing every player should signed up before and signed in here?
@RoelvanUden
 
11:24 AM
Whoa... dat grammar
 
@RoelvanUden any nodejs modules could help me?
@JanDvorak my grammer is bad?
 
@Hamed_gibago yes
 
your grammAr is bad
 
With your last question I'm wondering if it's deliberate
 
me too xD
 
11:27 AM
@JanDvorak why? will tou tell me my mistake?'
 
*Will, *you
 
you said if your "grammer" is bad
after he said clearly "grammar"
 
@Hamed_gibago Well.. yes. If you have some sort of user identification, which y'know, makes sense for a game, then the logical conclusion would be to have accounts. So yes, you should authenticate a client prior to accepting it into the game. Then you won't have any of the issues you're currently facing.
 
@Hamed_gibago npmjs.com/package/passport is pretty popular
 
@Hamed_gibago Got a login for an already logged in user? Kick the old one out, accept the new one. Simple, efficient, and logical. You can roll your own solution, or use something as @ivarni said (passportjs is popular).
 
thanks for help. I will go and read that. will come back for new questions. thanks cheers
 
*with new questions
unless you want us to ask, that is
 
no no, he's coming back to get some new questions from us :)
:o
 
Telling someone to "go play with traffic" for fixing your terrible grammatical errors. :/
 
11:39 AM
I might go play with my room owner abilities instead
 
@Neoares That last one totally fell on purpose
 
I am working on node and angular js application with mysql as database. What is the best practise for project strcture.
 
@KishoreIndraganti 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.
 
how can you prevent a socket being written to from truncating the results?
 
Idle complaint: The style for cobol used here requires initial 7 space indent, followed by a 4 space indent, followed by 3 space indents for everything after. It's infuriating
 
11:50 AM
@corvid improve the physical layer?
 
I am not entirely sure if that's an option. I am interacting with a Galil DMC-4143 and if you try to upload an array over a certain length, it could truncate the result and split it awkwardly between two socket writes
 
That's how TCP works
 
So how do people usually handle that case? I feel like I am doing it wrong
 
TCP gives you a stream of bytes
websockets, maybe?
 
Don't websockets just make it available to the client?
 
11:54 AM
The old school way is to handle framing yourself, but websockets provide that feature themselves
 
@BenFortune not the chrome console, you don't. blame 6yr old apple's shitty code.
some developer somewhere thought wrapping user code with a with block will go just fine
 
user3119231
 
user3119231
what. the. hell?
 

« first day (1781 days earlier)      last day (3170 days later) »