« first day (2039 days earlier)      last day (2914 days later) » 

12:39 AM
@Chi-YoungJeffreyLii yes
 
@Chi-YoungJeffreyLii why would you store it in JS and not just put it in the HTML?
<style>
	#date { display: none }
</style>
<div id="date">
	the text
</div>
<script>
	function displayDate () {
		document.getElementById('date').style.display = 'block';
	};
</script>
don't put the text in the JavaScript. that's what HTML is for.
 
1:33 AM
Morning
 
1:50 AM
Would this be the place to ask about API's?
 
@JasonBourne Welcome to the JavaScript chat! Please review the room 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.
 
user2743227
@Shea It's because I want to store multiple paragraphs that can be viewed at the touch of a button.
 
put it in the HTML
don't use innerHTML
ever
 
2:12 AM
why this doesnt work for chrome ?
 
Because I don't want you to know my geolocation.
 
yes but how can i change it programmatically ?
0
Q: I can't get location on chrome - javascript

Rasim AndıranI'm coding a web app which is using by maps. I want to find visitor's location. It is working on firefox but not working on chrome. Chrome says "it is blocked that track your location by this page." How can i fix it for chrome? function onPositionUpdate(position) { v...

You must change that settings
but i need to do it programmatically
using javascript
 
You cannot.
Why do you need to do it?
You cannot do it because privacy.
 
i need to get user location.
 
The user needs to give you permission
 
2:19 AM
because i create a web platform based on client geolocation
yes how @SomeKittens ?
i cant see any prompt popup
 
> getCurrentPosition() and watchPosition() are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See goo.gl/rStTGz for more details.
@gtzinos Chrome Menu > More Tools > Developer Tools
 
hmm..that code runs on jsfiddle cause of https ?
 
hey guys.
morning
need a quick help. I dont get why I cant do this
var write1 = new Promise(function(resolve, reject) {
	resolve((function() {
		fs.writeFile(filename, message);
		return 'this sentence will be passed on to the next then value';
		})());
	if (!filename) {
		reject('there was an error');
	}
	return ('some new text');
})
output
C:\Users\mingk\coding\js\nodeTheRightWay\thirdTry\chap1\write-simple.js:29
                fs.writeFile(filename, message);
                                              ^
SyntaxError: missing ) after argument list
any idea why this happens? appreciate the help. thanks
sry. wrong code block. its this one. >>>>
var write1 = new Promise(function(resolve, reject) {
	resolve(
			fs.writeFile(filename, message);
			return 'returning a new line';
			);
	if (!filename) {
		reject('there was an error');
	}
	return ('some new text');
})
 
you can't have multiple statements inside a resolve call like that
 
2:35 AM
yeah. but want to return a value to the next then
if i dont return, then will be undefined.
any ideas on this? @phenomnomnominal
i tried this. it works. but is it correct?
var write1 = new Promise(function(resolve, reject) {
	resolve('returning a new line');
	fs.writeFile(filename, message);
	if (!filename) {
		reject('there was an error');
	}
	return ('some new text');
})
 
I don't even know what will happens when you call resolve than reject together...
 
@gtzinos because > w3schools.com
here you go, this will set you on the right track
 
i dont think so
 
@Sheepy it works. basically, if (!filename) is false. it will output the 'there was an error'
 
w3schools is a good source to learn some basics
 
2:42 AM
i think in new Promise, you need to call both resolve reject together to capture both outcomes. Is that best practice?
 
@Shea this code doesnt work without https. Try to copy paste it on w3schools
 
no
 
@MadaraUchiha But DRM doesn't "work".
 
it's some kind of trend to bash and hate w3schools, and I try to be cool.
 
@Shea can you create an example on jsfiddle ?
 
2:47 AM
The only thing it does is make it harder for people who actually buy stuff to use it.
 
@gtzinos there already is one
that's incredibly annoying that you wouldn't even glance over the link I sent you
 
DRM is basically: "You are not buying the content. You are buying the rights to watch the content. Want to watch this in your favorite video player? Haha, no."
 
@Shea i cant connect prompt method
 
what?
 
Use our shiny video player that requires a flash-enabled browser!
 
2:49 AM
function prompt(window, pref, message, callback) {
    let branch = Components.classes["@mozilla.org/preferences-service;1"]
                           .getService(Components.interfaces.nsIPrefBranch);

    if (branch.getPrefType(pref) === branch.PREF_STRING) {
        switch (branch.getCharPref(pref)) {
        case "always":
            return callback(true);
        case "never":
            return callback(false);
        }
    }

    let done = false;

    function remember(value, result) {
i cant use that code
 
It happens again. I go to read Promise on MDN and ended up editing it...
 
its not for chrome. my problem is that i cant get geolocation on chrome
i need a code to get it over cross-broswer
 
you're right though, it doesn't seem to work on HTTP
 
@gtzinos You cannot use it over http.
 
2:52 AM
that's the code it shows when you click "Open in JS Fiddle"
works fine in Chrome
just not on HTTP
 
@Shea ok i just confused that will work without https
java or nodejs for back end ?
 
3 mins ago, by Shea
you're right though, it doesn't seem to work on HTTP
 
@gtzinos Use Assembly
It's fast and web scale
 
i ask some guys who work with me, if its a good idea to continue as web developer. and they said me "web ? everyone know web "
@littlepootis assembly ? hehe
 
You should really stop asking people their opinions and start researching and making decisions yourself.
There's nothing inherently bad about any technology. It's just that it's impossible to learn every one of them. So, choose one you like.
I, for one, would kill myself rather than use Microsoft tech.
 
2:58 AM
@Ming When I try this code new Promise( (y,n) => { y(1); n(2); } ).then( v => alert( 'Yes '+v ), v => alert( 'No '+v ) ); I always get only yes. I never get no or its value. Vice versa if I call reject (n) first.
 
@littlepootis why you hate microsoft tech ?
@littlepootis i am new and my first job is as a software tester with microsoft tech. have you ever use that ?
 
@gtzinos Because they're closed. Too restrictive, stupid.
 
@gtzinos Would it ease your mind if I tell you I like Windows?
 
@Sheepy yeah. its the same for me
 
There's not much you can do without using their Operating System.
Which is terrible..
 
3:02 AM
@Sheepy my earlier code has an if statement. so only to call reject if there was an error. if not, promise will call which ever is first in line, as per your code. (resolve or reject)
 
@Ming Personally, when I write promise, the logic either call resolve or reject, not both.
 
@Sheepy yes. you are right. my point was. if (false) > reject, if (true) resolve. is that correct?
 
@littlepootis really ? what you can do with mac products ? or linux products ? or google products ? are all compatible with all softwares ?
 
@Ming You can simplify it to if ( false ) reject() else resolve(). Let me scroll up to see your original code...
 
Just to create, just just to create a ios app you need to pay 1 million to buy a mac...
 
3:04 AM
@gtzinos web
 
+100 euros / year for ios store
 
@gtzinos They're not.
I wouldn't use Mac OS X either.
It's restrictive too.
 
yes. linux too..
 
I don't want some company to dictate how I do my computing.
 
I think pootis's is trying to say that you can't compete with an open source system on openness. Which is fair.
 
3:05 AM
@gtzinos How is Linux restrictive?
 
all softwares are restrictive if they want to be better from another one
 
1 message moved to Trash can
@Ming Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
you know any shell script that runs on windows ?
or a batch file that runs on linux ?
 
@Sheepy I'm trying to convert this to a promise.
const
fs = require('fs'),
stream = fs.createReadStream(process.argv[2]);
stream.on('data', function(chunk) {
	process.stdout.write(chunk);
});
stream.on('error', function(err) {
	process.stderr.write("ERROR: " + err.message + "\n");
});
 
3:06 AM
or you have any programming language there that you can use it over other softwares ?
 
They're just programming languages.
 
@Sheepy any idea how?
 
yes..so where is the problem with microsoft ?
 
Tried this but does not work.
Promise.resolve(stream)
.on('data', function(chunk) {
	process.stdout.write(chunk);
})
.on('error', function(err) {
	process.stderr.write('Error: ' + err.message + '\n');
})
.then(function(result) {
	console.log(result);
	console.log('this is the end of the program');
})
 
ok they restrictive to use their dbms
but they need to sale their products. why to help other companies where all attack them ?
 
3:07 AM
@gtzinos As I said, too restrictive.
 
yes i am with you . but isnt only microsoft the problem. look arround
google closed a microsoft app..who cares?
anyone because is google
 
I use Google products regularly. But not that often.
 
some devs created an app for youtube
 
const fs = require('fs');
new Promise ( resolve, reject ) {
   const stream = fs.createReadStream(process.argv[2]);
   stream.on('data' , resolve );
   stream.on('error', reject  );
}.then( process.stdout.write ).catch( process.stderr.write );
 
and they did redirects to confuse users
its idiot..
 
3:11 AM
@Ming I've not used fs, but I think it'd look like this.
 
comming soon.. 1/7
 
You can say Linux gives you freedom. My mom says it is useless when she can't get iTune to work. And I say it is useless when I can't play the game I like on it. It is restrictive when it restricts common users. A problem that Mac solved... but not without taking away its freedom.
 
Good morning guys
 
Good morning everyone
 
Morning~
 
3:21 AM
@Sheepy Um, true.
But when I use Windows or OS X my mind goes haywire
 
@SankarRaj:Are you angular js lover?>
 
Learner also
 
your profile pic is angular js logo right??
 
@littlepootis The pain of being forced to click through 10 windows to reach the app / settings you want?
 
@Learning Exactly
 
3:26 AM
Or that the dos shell is stuck at 20, no, 30 years ago?
 
@Sheepy yeah
Lack of powerful command line tools.
 
I understand how that's painful after spending just a week in linux. :p
 
angular js is actually good but damn complex
 
@Learning Is there a good thing that is not complex?
 
@Sheepy:agree
nowadays i am hearing alot about node.js too
 
3:39 AM
@Sheepy It's much more painful when you've been using it since you're a kid :P
It's not really against proprietary software. I use Steam.
it's just that it's slow.
 
Oh yes. The speed different is quite obvious.
Everything is snappy on Linux. And verbose. Except that time when I tried to run Ubuntu Unity on a Win XP Netbook. Didn't went well.
 
Unity is resource hungry.
 
I was told it is Linux newbie friendly. :(
 
Well, all DEs are.
 
Yeah. Fast forward 3 years, turns out I can survive fine on CentOS.
 
3:56 AM
Am I the only one who doesnt mind OS X?
I wrote a CLI for system preferences..
TBH, I dont really know hoe to change my preferences on linux - I just pick programs with really good defaults :P
 
There isn't a way, because Linux is just the kernel.
But almost all environments allow you to do it from the command line.
And because most preferences are stored in configuration files somewhere, you can just edit them.
 
my bad I was being vague
what I meant is that I have no idea how to change volume, moniter, etc. without using the xfce GUI
I know how to configure individual programs :P
 
4:12 AM
ah
For volume, it depends on what sound arch you're using.
Alsa and pulse audio are popular.
For alsa, you can use alsamixer. For PA, pavucontrol
I just make bindings to physical buttons on my keyboard.
Because it's hard to use alsamixer when I'm playing a game
For brightness, you can use this: github.com/haikarainen/light
Or xbacklight
 
4:30 AM
wow I already use pulse audio and alsa (which is apparantly a dependency) coincidence much?
Also thanks I will look into light and xbacklight
 
@thepiercingarrow A lot of packages depend on alsa. But I don't think pulseaudio does.
Maybe they're required on your environment.
 
hmm lemme check
oh you are right
alsa is normally used with pulseaudio, but its not required and not a dependency: wiki.archlinux.org/index.php/PulseAudio
what is your avatar picture from?
 
Rebecca's Friday
 
movie?
song?
 
4:45 AM
protip: don't click on any link by pootis
also morning
 
morning
Why not?
@littlepootis ohhh... i see!
wow o.O
 
5:03 AM
pootis how are you today?
 
5:14 AM
I'm happy because:
21 hours ago, by little pootis
With today's exam, I'm done with computer-unrelated stuff :D Well, I hope so.
How're you?
 
A bit tired
I have to wake up in 6hours
i should really go to bed
wow congrats...
@littlepootis what do you call a game room with people fighting?
arena?
trying to come up with a good namespace..
 
You should go to sleep
@thepiercingarrow a typical game room? :P
 
:P
okay good night
i have 5 and a half hours pf sleep
:)
 
6:15 AM
@thepiercingarrow Insufficient sleep cause neurotoxins to accumulate in your brain. When your brain swims in them days and nights it starts to shrink. When it shrinks it won't bounce back.
 
In synatx npm install babel-loader --savedev I learnt that --save-dev option will also store the version number of module("babel-loader": "^6.2.4") in package.json. What exactly is version number here? Because npm install -S babel-loader also gives same entry "babel-loader": "^6.2.4" in package.json
 
get datetimepicker difference NAN

var from_date = $("#event_from_date").datetimepicker('getDate');
var to_date = $("#event_to_date").datetimepicker('getDate');
var days = Math.ceil((to_date - from_date) / (1000 * 60 * 60 * 24));

please help if you can
 
@BhavinShah JavaScript only knows how to deduce numbers. It doesn't know how to deduce date picker elements wrapped in jQuery object. Get the Date values from your pickers and work on them instead.
 
Seems angular 2 is now stable
 
!!tell BhavinShah google stackoverflow calculate jquery datepicker difference
 
6:23 AM
@shee
 
Hey, I have a question regarding the behavior of NaN comparison.
Is there any way that I can make
NaN == "somestring"
> true
?
 
@DanDoe Welcome to the JavaScript chat! Please review the room 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.
 
@Sheepy was alrady google it but i think the datetime picker format issue ..
 
Chrome's prompt() method trims spaces from pasted text...
 
@Sheepy problem solved!thanks for your help!
 
6:27 AM
Cheers. Glad to be able to help. :)
 
great :)
 
@DanDoe Try Object.is( NaN, something = NaN ).
 
The string is the only modifiable component, so I'd need just a string that evaluates to something equal to NaN.
 
you want a string equal to NaN ?
 
Yes.
 
6:33 AM
there's no string equal to NaN in JavaScript
 
Okay, thank you. :)
 
You'll never get true for the number NaN with ==. You much change it to other type first.
 
infact there is nothing equal to NaN in JavaScript. not even NaN.
 
!!>s/JavaScript/most languages/
 
Yeah, javascript isn't exactly my forte, but I've heard that == does a type cast under the covers, and I was wondering if I could somehow leverage that to find a string that would equal NaN.
 
6:36 AM
@DanDoe you can find strings which are converted to NaN, that doesn't make them equal to NaN, as NaN isn't equal to NaN
 
@DenysSéguret "SyntaxError: missing ; before statement"
 
so... all the strings? :P
 
@CapricaSix You're not helpful
!!> Infinity == "Infinity"
 
@DenysSéguret true
 
Thank you for pointing me in the right direction.
 
6:41 AM
@DanDoe NaN is the special case. You are right that type will be converted. But anything compared with NaN is false, regardless of type. Like Denys said it applies to most programming languages.
Most, except SQL. Any more exceptions?
I forgot to say, because NaN is a number, your string will be converted to number - usually NaN. :p
 
7:04 AM
da hell as happened to iit's arch mirrors
 
7:20 AM
MRHD cut funds.
 
@AwalGarg I overflowed the system by trying to install it so often
 
@DanDoe By definition, nothing is equal NaN.
Not even itself.
!!> NaN == NaN
 
@MadaraUchiha false
 
It's also the only thing in JavaScript that's not equal to itself.
 
!!> var a = NaN; a === a
 
7:26 AM
@towc false
 
oh, I really thought that would have returned true...
it semantically should...
 
!!> Object.defineProperty(self, 'a', { get() { return {}; } }); a === a;
 
@AwalGarg false
 
!!> Infinity === Infinity; // while this so semantically wrong...
 
@towc true
 
7:29 AM
you know what else is semantically wrong? Using "semantically" all the time
 
What bothered me when learning JS was this:
!!> [] === []
 
@littlepootis false
 
is that your real face or a reference to some thing the dinosaurs here know about and I don't?
@littlepootis
 
It's not my face lol
It's from this: youtube.com/watch?v=kfVsfOSbJY0 at 0:38
 
@littlepootis the mirror is maintained by students only so I guess their windows crashed
 
7:31 AM
@AwalGarg lmao
Wait, it's maintained by.. students?
 
atleast that's what they wrote on the ticket
 
@littlepootis clever boy
 
@towc oh yeah, you are not allowed to talk until you install arch yourself :P
 
What store would you use for storing analytics data?
Lots of inserts and want to be able to eventually run SQL against the data, but not online.
 
7:46 AM
use something like redis, then go through an ETL to put that in a classic db?
 
@BenjaminGruenbaum what size ? If I understand your requirement mysql myisam might suit you
 
@DenysSéguret Around 1000 users at a time, each doing about 100 events a minute
 
(you don't care too much about acid or reliability but you want fast inserts)
 
@BenjaminGruenbaum that sounds like a lot for mysql.
 
So 1M events per minute is tops. I want fast inserts, don't really need ACID
 
7:48 AM
@BenjaminGruenbaum then mysql myisam looks ok
 
@BenjaminGruenbaum mysql or postgresql
 
@MadaraUchiha is that what you use at Taboola?
Can MySQL do 1M inserts per minute reliably over time?
 
@MadaraUchiha pg is too slow for that in my opinion, at least if you want to directly do the inserts
 
@BenjaminGruenbaum We use MySQL for most our reports, transitioning to Vertica
 
That's reassuring.
I don't mind doing bulk inserts and don't need keys but I absolutely need to read the data later.
What about SQL Server?
 
7:50 AM
try it?
should be fairly simple to set up a prototype that simulates your traffic
 
Not really, but I guess so.
 
@MadaraUchiha kinda, details?
 
@BenjaminGruenbaum I think so (choose myisam for that table)
 
I prefer to use SQL Server since it's used more internally here.
 
Sorry, I don't know it well enough. But if you can do it in bulk, it would probably be fine. You might have to do some tuning on commit modes, etc.
 
7:54 AM
@Shmiddty Hmm?
What are you replying to?
 
your stickied post
 
@BenjaminGruenbaum It's worth noting that in our case, we can see MySQL bursting at the seams, hence the transition to vertica.
But our scale is a few orders of magnitude above yours, so I think you should do fine.
 
Also, you can be a dick about it, but you shouldn't
 
@Shmiddty I also can kick you, but I shouldn't
:)
 
Dick.
 
7:55 AM
Duck.
 
Dock.
 
Deck. I should build a deck.
 
@Shmiddty It's going to be a JavaScript based riddle, aimed at attracting JavaScript developers. For example, a possible concept would be "you're presented with an image of a safe, and your goal is to open the safe", and opening the safe would require reading the JavaScript code, understanding what to do, and then perform it. Your job would be to develop this, working alongside a designer and the project manager from the company.
 
I'm down
like Pagliacci
 
@MadaraUchiha yeah, we're doing analytics for one company
 
7:58 AM
@Shmiddty Can you commit to deadlines? Do you have past works you can showcase?
 
Yep nope
 

« first day (2039 days earlier)      last day (2914 days later) »