« first day (1870 days earlier)      last day (3064 days later) » 

crl
12:00 AM
you could have a sort lock on the api request, and when you request the lock, it lasts 1s (didn't follow well, forgive me if I'm OT)
 
Again, that's a single request, regular throttling
@BenjaminGruenbaum Thanks, dunno what I was expecting. The logic is pretty straightforward. Was probably hoping for a primitive I missed, though the solution isn't that bad (both yours and mine (yours is obviously better (2.9)))
Also, this isn't really a monitor, right?
Also, I reached a situation where I had to abort a fetch. Laughed for several seconds.
 
@BenjaminGruenbaum
What I find to be alot of trouble understanding about the html5 API, is how I can either, get the current state,as I only have this specified inside my popstate handler function, and therefore it is not global.
Or, that I save the pathname from my url/pushstate into localstorage.. Am I somehow on track, or any pointers?
Looking up history Api just leads me to the same inconclusive(at least for me) results, how to manipulate the browser etc. I ahve already done that, but now I want it to still be the same, If you come directly into my ajaxState, ecept then, the state doesn
 
crl
use storage only to save things on refresh, else it would be stupid
 
thats exactly what I want it for
I understand it wont work for linkng to a new user obviously xD
but what would I need to save to the user/storage?
ah hm current state I can't seem to get as it is only in popstate, and that doesn't fire on refresh, so current pathname or something then.
I will googleSchool myself more, but any pointers is very much appreciated ;)
 
12:18 AM
you just have to read the window.history.state and url on load and popstate. use pushState() when you are changing the url yourself.
 
ahh
I am laughiong at myself right now :p
thanks!
Hm, any scriptlanguage I should look into to fix the deeplinking and bookmarking issues?
Thought of ASP when I stumbled upon that, I would need to do some server scripting for that to work I assume?
 
well, that's why you read the url on page load and popstate event, so that when someone uses a link it goes to the right place in your single-page app
i assume it's a single-age app?
 
Oh okay, that makes sense yes!
Yeah correct :)
I have to look more closesly as to how things work behind the scenes I guess, probably would make stuff like this easy to understand..
 
so make a function that reads the url and, optionally, window.history.state and then puts your app in the right state. You'll then have that function called both on page load and anytime popstate happens.
handleUrlChange(), maybe.
 
I see, yeah that should do it I guess, will try it out rigth away
window.history.state comes back undefined
that is what was so damn confusing!
 
12:25 AM
it only have a vaue when you put something it in.
 
but I will try out what u said ;)
 
the url is the only thing you can depend on
 
wow I love when I realze things, but I hate when I have been so stupid about it for so long :P haha :)
 
crl
output.jsbin.com/fuzeyo#lolcat google in jsbin, dunno why I made that
 
function handleUrlChange() {
    var location = window.history.location || window.location;
    console.log('changing to: ' + location.pathname);
}

// handle url changing during our single page session
window.addEventListener('popstate', function (evt) {
    handleUrlChange();
});

// and on load
handleUrlChange();
function goto(newUrl) {
    window.history.pushState(null, '', newUrl);
    handleUrlChange();
}
@sunto bare minimum single page app.
 
12:58 AM
CAn't say I have seen the goto before, but I'm trying to work it into my code
 
crl
hint: it's just a function name
 
hehe I was writing it as a func, then it want all blue on my ,like function hehe
so reserved word, but guess that was not what u had in mind there :)
 
rename it, then
 
yeah sure, but I am trying, and I realize I have a bit strange setup for my popstate already..
I slkice away the '/ ' from pathname, so I am left with the filename, as my pathname and filename are the same. This I have in a variable FileFinder, wich I run the xmlhttp.open with, like so:

xmlhttp.open(GET, FileFinder, true)

A bit strange when I look over it, but sure works without more subdomains, that is..

But ok, As I am trying to add this into my code, should I call the goto on load?
Or shoulkd I scrap mmy setup and start from scratch? :p
 
 
5 hours later…
6:38 AM
morning
 
6:54 AM
hey
 
hi feniixx
 
7:22 AM
what do you guys think of me changing my user id to ajaxGuru?
 
@3.14159265358... u mean username
 
7:40 AM
@3.14159265358... anything with hype + buzz words is awesome man
 
7:51 AM
so it would be a better user id, so people can find me, and may be "the speaker" on the topic
thanks @CSᵠ
 
@3.14159265358... most welcome. that's all? no more keywords in username?
 
no, i changed it
 
@AbdennourTOUMI what?
 
This is a JS lib named : `
 
8:02 AM
what is?
 
8:12 AM
tilde?
 
9:07 AM
> I have programmed a simple command line password-manager in Node.js during my learning process, and since I am done with it, I would highly appreciate a review. Comments could be based on any topic. I am looking for a review which covers the security aspects, performance, efficiency and I would also love to learn new ways to achieve this. Also, feel free to point out any violations of anything conceptual, best practices or conventions.
> Also, the assumption in this program was that any name field entry in this program entered by a user is unique.
@HassanAlthaf ^ you'd make a good "legal person"
 
@AwalGarg Lmao, why is that?
 
You asked for everything one could want without making it look vampy.
 
Alright, fine. I'll neaten it up.
There we go. Made it much more neat. :)
 
    for(var iterator = 0; iterator < accounts.length; iterator++) {
        if(accounts[iterator].name === accountName) {
            foundAccount = accounts[iterator];
        }
    }
@HassanAlthaf ^ what is accounts here?
 
Need some help with prototypes pls
I don't get how a Bear is linked to an Animal if I
Bear.prototype = Object.create(Animal.prototype);
How is
var b = new Bear();
b instanceof Animal
?
When both Bear.prototype and Animal.prototype are just ({})
How does instance of know b is an Animal?
I can see how if I
Bear.prototype = new Animal();
but not with Object.create.
 
9:25 AM
@lacksInitiative instanceof sees them as the same object, not {}. Objects in JS are compared referentially, even in all internal checks.
 
@AwalGarg
I thought that but I found
Animal.prototype == Object.create(Animal.prototype);
is false?
 
Object.create returns a new object everytime
 
Yes so Bear.prototype != Animal.prototype, so i don't get how they are linked?
 
because Bear.prototype.constructor is now set to Animal
And Bear.prototype.constructor.prototype is thus Animal.prototype
instanceof traverses the prototype chain until it reaches Object.prototype
 
Ah, then i don't understand prototype linking like i thought.
:(
 
9:33 AM
Morning
 
@lacksInitiative just understand what Object.create does, and you'll get it. Try writing a function which behaves as Object.create without using Object.create itself. That'll put it in your mind.
 
I will try. I have read MDN but this is the first time constructor has been suggested as a type inference mechanism.
How come if I
Bear.prototype = Object.create(Animal.prototype);
Bear.prototype.constructor = Bear;
var b = new Bear();
b instanceof Animal;
it's still true?
if constructor is the link and I wipe it, it still works.
 
Because Bear.prototype instanceof Animal
constructor is not the key to linkage here, it is just a way you can "see" it
Object.create sets the [[Prototype]] internal property of the new object, which you can't (ok you can) change.
If you want to change it, you can do Bear.prototype.__proto__ = Bear and then instanceof will fail
or setPrototypeOf
 
thanks for your help. I really want to get this. just a give me a sec while i play in console
@AwalGarg Go it. You're awesome. Thanks for your patience.
 
np
 
9:47 AM
I was one level too high. This sentence:
Object.create sets the [[Prototype]] internal property of the new object, which you can't (ok you can) change.
Got me to do this:
Object.getPrototypeOf(Bear.prototype);
Now i understand. Whew. Thanks a million.
 
anyone addicted to coding?
 
everyone here?
 
yeah probs
i guess looking at github on sunday morning means your addicted
I'm glad I have coding otherwise I might be addicted to computer games
 
@AwalGarg var accounts = getAccounts(masterPassword); An array.
 
I'm outta here, i will try to pay it forward somewhere else. Thanks again @AwalGarg thats a big piece of the puzzle for me.
 
9:53 AM
Just to make sure it's said. That is a horrible, horrible way of keeping a session. There's absolutely nothing stopping the user from changing their dom so that <input type="hidden" id="sessionData" value="admin">. — Madara Uchiha ♦ 9 mins ago
 
Is there any way to prove that a request came from a mobile device? I know its unlikely.
 
@SuperUberDuper How much of a guarantee do you want?
You can look at the user agent, which is easily faked
 
that 98% of traffic is from mobile
I know
 
@SuperUberDuper You can definitely use the user agent then
98% of your users won't fake their user agent.
 
yeah but a hacker could botnet me
 
9:55 AM
@MadaraUchiha I miss the Object-Oriented-ish style of PHP.
 
and skew my data
 
@HassanAlthaf Node.js has classes and objects and inheritence
 
@MadaraUchiha I am still learning. So, I don't know yet.
 
Abe
@HassanAlthaf have fun understanding how .prototype works
 
I did learn .prototype in JS.
 
9:56 AM
this is my question:
https://stackoverflow.com/questions/33974881/how-to-insure-non-logged-inuser-data-submitted-to-parse-com-only-comes-from-mobi
 
Is it the same in Node?
 
Yes, the prototype chain is how JS does OO, it's an extremely powerful feature, but has a steep learning curve.
@HassanAlthaf You've done JS in the browser, right?
 
Yeah, I did JS in the browser. :)
 
You can (almost) divide JS into two parts when in the browser. There's the ES part, and there's the DOM part.
 
9:57 AM
ES = language definition, syntax, features. DOM is all the features of the browser (AJAX, localStorage, actual DOM)
 
@MadaraUchiha : encountered a js question where the user used eval ... that was D:
i felt like kevin mcallister in home alone
 
NodeJS is ES (ECMAScript) + modules for filesystem, HTTP server/client, processes, signals, etc.
 
It's like JS + a PHP microframework lol
 
14 messages moved from PHP
 
lol
#moderatorPowers
 
9:58 AM
@HassanAlthaf PHP is a bit special in that regard.
 
How so? ;o
 
The default PHP SAPI is (for the lack of a better term) a tumor on a real HTTP server like Apache or NginX
 
Abe
ahahah i could feel your rage on the red line
 
Apache receives a request it was configured to pass to PHP, it calls the matching PHP script and fills in the $_REQUEST, $_POST and $_GET superglobals
PHP does whatever it does, and produces output.
 
* beats PHP if it's a real object *
 
10:00 AM
That output is return to the the HTTP server, and from there to the user.
 
So, is there anything wrong with that? ;o
 
NodeJS (and Java, and C#, and ....) is different in that it itself is the HTTP server.
@KarelG Please don't ping me directly with cv requests.
Post a normal request and have other people look at it too
 
that is harder to write than @ + ma + tab :p
 
coffee machines are cheap!
 
10:02 AM
@KarelG Read the second pinned message.
 
dolce gusto £29
 
Abe
@HassanAlthaf it's not made in node.js
 
Wait what, then how do you get la user input?
Something like a front end framework?
 
@HassanAlthaf Almost
 
Or just JS?
 
10:03 AM
Think about it like this, at the most simplistic term
You tell Node which port you want to listen to
And when an HTTP request comes in, a function you supply is called
The function is passed two objects, the request and response objects.
You read input from request, and provide output to response.
 
Abe
you know that php can do that too, right?
 
Yeah I do.
 
@Abe Yes,
 
Well, then, what is different in these two?
 
But people (and often the author) will need to sweat blood for that to happen sanely.
 
Abe
@MadaraUchiha so far...
 
Aren't libraries like that and Node.js almost the same?
 
@HassanAlthaf Yes, and no.
PHP can be made to behave like Node
As can Node be made to behave like PHP
 
I understand that libraries like that just abstract the super globals and emulate stuff like Node.
 
But the key here is the default behavior
What do you teach a new user of PHP? What do you teach a new user of Node
 
10:05 AM
Yeah, I get you.
 
New users of PHP do not understand HTTP
New users of Node do. At least a little.
 
You teach a new user in Node how to setup a webserver.
 
Exactly.
 
lol
And once they have the understanding, move to Express.
PHP be like.
 
@HassanAlthaf Yes, which gives you nice things on top of your standard HTTP server
sessions, errors, mappers
 
10:06 AM
(y)
 
Alright, lunch time
 
Abe
enjoy
 
Just remember, PHP vs Node is a religious debate that will never end
4
 
lol religious
 
Abe
10:07 AM
lol
 
It's important to know both tools to understand when to use each
 
Yeah.
 
That said, Node is better. Goodbye :D
 
:D o/
 
node rules, its better than java and c#
 
10:09 AM
In terms of web development. Node == Good.
(Everything - Web Dev) == (Java && C#) > Node.js
Java and .NET developers get paid a lot.
 
Abe
java sucks
 
Since Node.js is just new, I don't think it has much demand in the real world market, especially ours. We're still on ASP.NET and JSP. -______________-
 
@SuperUberDuper hmmm... i still favor ASP.NET over Node.js
 
ASP.NET is old ass.
 
Abe
@HassanAlthaf you don't know what you are talking about :D
 
10:12 AM
yes, but it has many opportunities
 
Abe
c# is a fantastic language
 
Java >:)
 
try to work with Linq
 
Abe
i would use it if it could realistically run on linux
 
I have never liked the Windows platform much.
 
10:12 AM
a great library
 
@KarelG What is Linq?
I have learnt C#, made Windows Form Apps.
 
in London js jobs about 80-90% of what java jobs get paid
 
Linq stands for Language integrated queries
 
I'm assuming C# devs get paid the most in London?
@KarelG is there any way to code in C# on a mac?
 
10:14 AM
Performance speaks otherwise? C/Java servers provide better performance than node?
 
@HassanAlthaf monodevelop ?
 
@KarelG How? ;o
 
please google for that
 
java devs can earn $150-200 per hour here
 
10:15 AM
!! tell HassanAlthaf google MonoDevelop IDE
 
@KarelG By downloading that IDE,
Can you develop apps that can be tested on OS X?
 
i know someone that uses this on Linux
not sure about mac, please check that site for info
 
If it works, it will save about 20 to 30 gb
 
it supports mac it seems
 
10:17 AM
in my laptop
I only have a 128 GB SSD in my macbook
-___-
 
512GB SSD + 1TB HDD on my laptop :p
 
f***
I'm not that rich m8 l0l
 
my laptop cost 1200 EUR
find a good mac with that hardware for the same price ;)
 
Impossible.
 
Apple aims for luxury segment.
even their silly iPen takes 100 $
 
10:21 AM
I thought I'lll be able to do C#, Obj-C, Swift, everything on a mac, so I chose Mac.
@KarelG It is quite a nice technology.
 
i have something free: my finger
 
It will really help architects
Well, it's either take it if you like, or pass. No one's forcing. :P
Civil Engineers, etc will find it quite handy.
 
heh, i was looking for a tablet pen on amazon
4000 $
OMG
 
These are professional tools for Engineers. :)
 
yes but for 100 i can probably get a better one than what mac gives
 
10:26 AM
Nah, I believe it also has 3D touch features.
I am really loving my Mac, apart from the storage space.
But, an external hard disk can solve it.
It's been a year now, no complaints. It still looks and works as if I just unboxed it.
 
true.
you may buy an apple product. i don't mind
 
yup. :P
Unlike my HP.
By the end of 2 years, it was fully dead.
I wasn't even using it as much as I use my Mac.
There we go. Got Xamarin installed.
If it will work, I better say good bye to windows. :)
 
hi
 
hi abishrek
 
its abhishrek
 
10:35 AM
.*shrek
 
ab his rekt
 
10:51 AM
@KarelG Macs better for dev
 
you can say that, but it's really dependent on the person's flavor
i use sublime text for js ... others an IDE fe
 
@HassanAlthaf in that case, that code is horribly verbose
 
@AwalGarg what do you mean?
 
how to store the result of ajax request (json type) in a JS array? (for accessing it later;)
 
@Shafizadeh Easy.
 
10:55 AM
:-)
how?
 
If you want, you can store it as a JS Object, or do you want to just save it as JSON?
 
@HassanAlthaf you know what I want exactly?
 
(JSON is just a string in JS).
 
@HassanAlthaf your code is equivalent to this: return accounts.find(el => (el.name === accountName));
 
@HassanAlthaf lemme explain it more ..
 
10:56 AM
@AwalGarg What do you mean, does it involve the use of a lib?
@Shafizadeh yes?
 
@HassanAlthaf wait
 
!!tell hassan mdn array.find
 
Well i gave up the name shake (shek)
and chose shrek over shake or worse shiekh
@AwalGarg what do you think of this ? github.com/benjamn/ast-types/blob/master/def/core.js
 

« first day (1870 days earlier)      last day (3064 days later) »