« first day (2071 days earlier)      last day (2875 days later) » 

12:47 AM
 
@FilipDupanović so you get what I was trying to accomplish right ?
 
not really... you want to use url.format() or url.parse() to push data around?
 
i don't know if you have used mongodb, it is require to use a schema and a model, where you could set the key and values
for example username should be a string
and a user profile in my case should a be a url
{}
{username: String, userProfile:URL}
thats how i wanted to have my schema to be
@FilipDupanović
 
1:02 AM
oh, well, you can use url.format() to construct the URLs (in favor of doing it manually)
they're just strings at the end of the day, like @towc mentioned, you won't find any dedicated URL type or something like that
 
I did with string already but I want it to see if i could actually change it to url
 
1:18 AM
Can anyone identify this library.. if it is a library:
 
1:46 AM
Hello
 
 
2 hours later…
3:23 AM
@captainrad It's not a library. It's a drag and drop UI.
 
4:00 AM
^ amazing
 
4:41 AM
@littlepootis Morning~ Is it possible to setup iptables to ignore IP whose domain lookup is googlebot.com? My research seems to say no.
Don't think we'll need it, but want to know just in case.
 
Hi All
 
~
 
trying to create a timer of format hh:mm:ss
tried recursive function which say maximum stack exceeded
   {
    startTimer: function(element, minutes){
        if(minutes >= 0){
            element.innerHTML = this.getTimer(minutes); // converts minutes to hh: mm: ss format
            setTimeout(this.startTimer(element, +minutes--), 1000)
        }
    },
 
setTimeout( () => this.startTimer(element, +minutes--), 1000 )
 
what I am doing wrong here?
ok
trying
 
5:04 AM
yup worked. Thanks :)
 
Nice. :) This is not recursive, by the way. The working code can be said to be self-repeating, but not recursive.
 
5:32 AM
@Sheepy I didn't get you
I thought it is known as recursive
 
Your original code is recursive - startTimer calls startTimer, which calls startTimer, which calls startTimer... until stack overflow.
In the working code, the chain is broken at setTimeout. startTimer calls setTimeout, but setTimeout itself does not call startTimer.
The lambda function (and, thus, the new startTimer) is called in the global context.
 
MORNING ALL
 
@Sheepy I don't think so. You're better off using application-level blocking.
 
@littlepootis Figured. Thanks!
 
how to send image file data using ajax call
 
5:45 AM
!!tell Aniket google stackoverflow ajax send image data
 
i did but was not able to figure it out
 
unclear, too broad, POB (also, grammar error in title). stackoverflow.com/questions/37874026/…
 
function Log(m) {
  Log.idx = (Log.idx === undefined) ? 0 : Log.idx;
is that bad?
 
@cswl Why would you do that?
 
@cswl You can do Log.idx = Log.idx ? Log.idx : 0;
 
5:53 AM
That doesn't really help
 
Cause I don't wanna create a class.. .-.
 
How about create an object?
 
OK, who's willing to bash on w3schools on that cv-pls question? Two people have praised it already.
and the comment's got two upvotes
 
@JanDvorak Are people upvoting for the sarcasm?
 
vOv
 
6:07 AM
hello everybody
 
Can't we just nuke Stack Overflow and Earth?
 
time to wake up! \o/ \o/
if you nuke the Earth, Stack Overflow inherits the same behavior. :)
 
  $scope.login = function(user){
  loginService.get(user).then(function(response){
    if(Object.keys(response).length === 0){
    }else{
      dataService.setUA(response);
      $location.path('/home');
    }
  });

};
 
in true OOP style :D
 
why shoud i need to click twice to route home page ?
 
6:20 AM
@SpringLearner o/
 
the response is return a Promise ?
 
"I promise to force you to click twice!" :)
 
@thedigitalmouse means what?
 
@SpringLearner the use of o/ is an emoticon of a person waving to you... o = head, and / = arm.. therefore o/
 
$scope.login = function(user) {

    var results = loginService.get(user).then(function(response) {

        return response;

    });

    results.then(function(response) {

        if (Object.keys(response).length === 0) {

        } else {

            dataService.setUA(response);

            $location.path('/home');
        }

    })

};
@thedigitalmouse ?
this is also giving same result
why ?
 
6:25 AM
@underscore ??
 
i need to click twice to route home page ?
 
then don't do that! :P
(just kidding)
sorry, i do not have an answer for you at this time
not enough coffee injested
but i suspect you are triggering another click event when you have the .then appended function... like perhaps the Object.keys(response).length === 0... not sure
 
@thedigitalmouse I didnt know that. Thanks for info
 
@SpringLearner very welcome. here is a historical list of more text emoticons en.wikipedia.org/wiki/List_of_emoticons
 
6:55 AM
@thedigitalmouse thanks again
 
7:12 AM
@underscore all you're doing here is returning the promise, it's unnecessary
How are you binding it with a click?
 
7:35 AM
s/injested/ingested
well ok... in-jest-ed has a ring of accuracy to it for most of the words exiting my speech hole.
 
Morning! I am currently trying to make a counter, nothing too advanced I feel like (click here and a value will increase and that value is shown on the website). However, even although I am not getting any VS nor Browser errors, the button refuses to do anything. Any ideas?
 
That button needs a good whippin'
@Xariez: You haven't included jQuery in the fiddle.
 
7:50 AM
@Xariez Looks like you are depending on jQuery, but have you included jQuery?
 
In my project I have, Yes
I'll include it in the fiddle though
 
That would be helpful
 
i was gonna mention the missing jQuery in the fiddle, but when i made it remotely on a local machine and included the jquery, it still fails... i removed the val return stuff and just used a console log with some text, nothing happens.. so that points to the button call
 
Not sure if it updates with the already existing fiddle link, but if it doesnt, jsfiddle.net/56fgrs82/3
 
@Xariez Looks to be working now
 
7:52 AM
And there it works.
The hell.
 
@Xariez Yes it does.
 
Ah! Good to know @Sheepy
 
It should work
Did you fail to wait for DOM load?
 
Soo this is interesting
Well It could be
 
So, in your website, where did you place the code?
 
7:53 AM
I pretty much have whats in the fiddle at the top of the page
Then the content of the page
 
Now that's not good
 
wrong link
 
notice how jsfiddle says "wrap javascript in..." and the default is "onLoad"? It's there for a purpose.
 
Well
 
9
Q: Make jquery function run on page load

NazI have a jquery function to change the opacity of an image on mouse hover to produce a pulsating effect, but I would like to change it so that the image pulsates as soon as the page loads, removing the mouse hover elements mouse over and mouse out. Here is the code I have (function($) { ...

 
7:55 AM
HL2E3
 
Like I said. Could very well be it since that just shot way above my head apparently.
 
if you moved your script to the bottom of your body, it would probably work too.. otherwise wrap your javascript as per Cerberus' link
 
@littlepootis What about it?
 
I am newbie at JS, can someone help me? stackoverflow.com/questions/37875374/…
 
@littlepootis still waiting for it
 
7:55 AM
Is that so? Why have I always thought JS shold be running at the top, if they exist, in the <head></head> tags? @thedigitalmouse
Yeaaaap, that would have been it.
Thank you so much! :P
 
@Xariez any manipulation of the DOM requires that the page elements be loaded before you mess with them. if you run the code first then display the button in the body.. the code doesn't see the DOM elements (the button in your case). moving the code below the button ensures that the button loads first, then your code. or in the case of jQuery you wrap your code in a (function($) {} that says "wait until the page loads completely before executing this code"
it's a top-down thing :)
 
s/rendered/loaded/
also, s/page loads/DOM loads/
 
Oh yeah, that makes so much more sense. Cheers for clearing it up! @thedigitalmouse
 
same difference! :D
 
"page loads" would suggest it waits for images to load, which it doesn't
 
8:00 AM
ah..well ok.. i'll concede that
...*fixes*
arg too late!
oh well
 
!!s/(.) (.)/$2 $1/
 
@JanDvorak ow hell (source)
 
@Xariez if you don't need jQuery for much else you can also do:
document.addEventListener("DOMContentLoaded", function(event) {
  //do work
});
 
@JanDvorak That's one dirty regex.
 
Won't work in IE
 
8:04 AM
thought it was just IE8 that does not like it
 
Alright! ^^ @thedigitalmouse
 
!!mdn domcontentloaded
@Cerbrus Titus 1:15 Everything is clean for clean men; but for polluted unbelievers nothing is clean, but both their mind and their conscience are polluted.
 
O:-)
 
screw IE! >,<
 
> supported since IE9, IE8 has readystatechange, IE7 says screw you.
 
8:11 AM
@thedigitalmouse why the fuck would you do that?
just put the script right before </body>
 
I think I hate Safari more than IE now.
 
@tereško to load the javascript sooner. No swearwords, please.
 
We don't ban swearwords here...
 
Still they should limited
 
> Swearing is tolerated so long as 1) you are not using it to insult another user. 2) you are not throwing around curse words like a 10 year old at summer camp. We understand emphasis and frustration can result in a fuck or two, but just try not to get out of hand. (source)
 
8:14 AM
@tereško if you put your code at the bottom, but relied on jQuery... what if jQuery was slow to load (from CDN for example)? then your code would still fail.
 
It's just one "why the fuck"... No need to correct that.
 
no fucks were harmed in the giving of this conversation
:-D
 
@thedigitalmouse That's not an issue, unless you use <script async.... Never do that with libraries. You can require them with requirejs, though.
 
so... add another library just to load a small bit of code correctly? o.O over complex much? :D
 
8:16 AM
Right. Just load jQuery synchronously into the global scope. The rest of page can wait.
 
@Sheepy they're working very hard to make sure you get the Web of today sometimes in the next 5 years... hopefully
 
sorry, not gonna add jQuery and requirejs just to make sure 3-4 lines of code get loaded in the right time :P
 
Sure, but once you already have jQuery...
@tereško well put, I guess...
> //This shouldn't happen, but it does
DOMParser, or $.parseHtml?
DOMParser, I guess, since I don't want the scripts to execute
 
8:35 AM
how to see if all elements in an array literal are the same, [0,0,0,0].every((e,i,a)=>e===a[0]) ?
 
Hey ppl, How do you slide a div up by 20% on scroll? found this but it hides the whole div jsfiddle.net/GM46N/2
 
can anyone tell me where i could learn more about terms like functional programming, lazy evaluation, static typing etc...?
I'm trying to learn more about haskell, clojure, scala, go etc...
 
@JanDvorak thx
 
@cswl sure, why not?
 
8:46 AM
@Neil I was thinking of doing something with perhaps reduce, as I'm uselessly checking a[0] with a[0]..
 
Meh. == is fast.
 
Yeah.. I should totally use web assembly for this.
 
9:07 AM
Does anyone have any experience with bootstrap?
 
Yes
Not me though
 
oh xD
 
It is a very basic question, I think. Let's consider this stackexchange sites. When other users post comments, answers, etc, either in the chat room or the main sites, we get notified. My questions are: (1) Are the notifications retrieved by the clients' browsers from the server for every specified interval (polling)? (2) Or the notifications are sent by the server to the clients?
 
@優しいエイリアン 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.
 
Hey guys - Do you guys know why I can't change page with window.location.href once i've relocated with Ajax?

E.g.

Ajax Call
window.location.href - Worked
Ajax Call
window.location.href - Not working
 
9:09 AM
@CapricaSix Are you a robot?
 
@ChrisBeckett No idea what you mean. Are you trying to send Javascript through AJAX?
 
@優しいエイリアン The latter, websockets.
 
@優しいエイリアン Websockets, mostly. I think the chat is able to poll, but not sure.
 
    @JanDvorak

    I do the falling -

    $(document).on("click", ".remove_pupil_quad_blog_member", function(){
    		var member_id = $(this).attr("id").replace("remove_member_", "");
    		var group_id = $("input[name='pupil_quad_group_id']").val();
    		$.post("/ajax/admin/school.design.ajax.php", {cmd:'remove_pupil_quad_blog_member', group_id: group_id, member_id: member_id, dataType: 'json'}, function(data){
    			var JSON_Message = JSON.parse(data);
    			window.location.href = JSON_Message.new_location;
 
@BenFortune @JanDvorak thanks.
 
9:12 AM
$(this).attr("id").replace("remove_member_", "");
._.
 
Yeah, that won't work
 
@JanDvorak why?
 
Oh, wait, misread. But it's still not clean.
 
It's returning everything correctly - it's just not relocating on second removal
 
I'll put my question anyway. I'm using bootstrap, I have a table inside a container. However my table overflows, and doesn't stay inside the width of the container. Does anyone know what might be causing this?
 
9:17 AM
@JoãoPaiva try overflow: whatever on the container
probably overflow-x: auto
 
How can I do that inline on html?
 
@JoãoPaiva Don't
 
don't do CSS inline... it's EVIL :D
 
it's just for testing >.< i don't feel like creating a css file just for testing this
in my html <div class="container></div> where would I put that?
 
9:21 AM
@JoãoPaiva ...you don't already have one?
 
I do
 
you already define the class, just add a .class rule for the styling in your HTML <head>
 
The rule #1: of production-level programs: All have started as tests, unintended for production
<style> ...
 
the class "container" is from bootstrap
 
but if you must use inline then <div class="blah" style="blah">blahblah</div>
 
9:23 AM
BTW, why is it <style> ... for inline sheets, but not <style src=...> for external ones?
 
so <div class="container" style"overflow-x: auto">?
 
@JoãoPaiva ew
 
@JanDvorak It's just for testing I promise ^^;
 
It always is
 
It kinda worked, however In order to make the table fit the container it cut the collumn that is in the edge of the container in half.
 
9:25 AM
Well... yeah.
 
it's ugly, it's wrong in so many ways.. but yeah, like that. and since 'testing' is just a copy-n-paste or move process to 'production', you should get into the habit of making styles either above your code in the <head> or linked as external sytlesheets... because one day inline will not be allowed. it also makes your code a lot cleaner and easier to debug.
 
And the other ones that follow don't even show up anymore :/
 
unexpected. Fiddle?
 
@thedigitalmouse thanks, I'll keep that in mind :)
@JanDvorak okay, gimme a few minutes
 
!!time
 
9:26 AM
@JanDvorak !!>new Date().toLocaleTimeString()
 
Nice user command, but can someone please fix it?
 
@JanDvorak regarding your <style src= question: yeah I wondered about that too early on... it seems that it was just a preference to sticking with <link href=""> because we already had <a href=""> in the early versions of HTML.. doesn't really explain the later preference of <img src=""> though... an interesting read would be: diveintohtml5.info/past.html
 
hello developers i need a guide with google map
api
my issues is with i integrated a map api with both my sign up page as well as with the edit profile but its not working in sign up
working best in edit profile
used same copy for both the edi and signup pages
 
@VishnuSBabu have you tried lmgtfy.com/?q=google+map+api+tutorial yet?
ah so the problem lies within your sign up page and not the map api specificially?
 
9:34 AM
Guys, i made a javascript for upvote/downvote button. Now i want the vote counter not to reset every time someone refresh the broswer. How to solve it? I am newbie, where can i learn it?
 
Can you see and edit the code?
 
@tehkc you need a place to store the data. A web server, ideally.
 
Okay @JanDvorak, but i am newbie. Where can i learn it? This is my button fiddle.jshell.net/g6Lhurae/36
 
@JoãoPaiva works just fine for me
 
@JanDvorak nice, can you see, the problem with the table columns?
 
9:37 AM
Except you should probably have one container per table
Yes. You're trying to fit a table where it doesn't fit.
 
but it won't fit because the inputs are too big
they make the columns fatter
 
@JanDvorak interesting read, and talks about several sides of the issue... I'm for not banning the use of lmgtfy. but sure attitude is something to improve upon. for the record, I was actually trying to be helpful with Vishnu's original query "i need a guide with google map api" and leading him(?) to make sure he already tried to solve it himself seemed more useful. if he had done that already, then we could have moved on to more help.
 
I made this, jsfiddle.net/wt0dea74 But i'm trying to make something that instead of having a defined time period, How can i make it so that it does it as it scrolls. Like this: bbc.com/earth/world
 
but then Vishnu laid out a more specific problem, and that changed everything :)
 
@thedigitalmouse Just link to the Google search page instead of LMGTFY, and I will be fine
 
9:40 AM
One question. Will i be able to learn how to store data in a web server (of a upvote/downvote button), if i learn everything wrote here w3schools.com/js/default.asp
So i need to learn more things also?
 
Don't touch w3schools
Also, no. You'll need a server-side language + API, even if it's Node.js.
 
w3schools is ok to get your feet wet, but there are far better resources for learning javascript at a higher level. codecademy.com or html5rocks.com/en or htmldog.com for examples. Perfect your JS with those resources, then you can tackle stuff like node
 
@thedigitalmouse no, not even for that
 
Oh. And i need to learn PHP in order to complete what i want to learn?
Looks like PHP is easy + better compared to JS?
 
I'd recommend Ruby on Rails, or Node.js if you don't want to learn a new language
 
9:45 AM
not necessarily, @tehkc. you can do it all with Javascript and Node.js (server-side Javascript) and a database like MongoDB.
 
@tehkc Easy maybe, better no.
 
So Javascript is better than PHP?
 
that is more of an opinion, than a verifiable fact
 
@tehkc, @thedigitalmouse phpsadness.com
 
it comes down to how you were taught. some people write good PHP, some people write bad PHP.. some people write good JS, some people write bad JS
 
9:47 AM
@tehkc You could use php, mysql (or some sort of database) you can find tutorials online. just google "php, mysql rating system script". then edit it for you own purposes.
 
@KerrialBeckettNewham no, he doesn't need to use PHP
 
@JanDvorak I'm saying he can.
 
Thanks a lot. Best website for leaving Javascript for a beginner according to you guys//
 
"you will need to"
 
learning not leaving
 
9:48 AM
@JanDvorak happy. . .?
 
Thanks
 
@JanDvorak man i got stuck on something so simple. lol
 
Best website to learn JS for a beginner?
 
@thedigitalmouse problem is only existing with live server working perfectly with local
 
@tehkc google
 
9:50 AM
@tehkc try any of those last links I gave. should get you started. w3schools gets a bad rap because it started out really bad with lots of inaccuracies and issues. it has gotten better over time, but is still considered untrustworthy by the developer community at large.. so best to go with something else.
 
@KerrialBeckettNewham No. jQuery is one of the worst choices to learn JS as a beginner.
 
thanks a lot
 
gah! don't point someone to jQuery until they are comfy with Javascript first! :O
 
@thedigitalmouse good point.
 
!!google javascript tutorial
Oh, cap's down
 
9:52 AM
Nah, just broken
@thedigitalmouse the jQuery tutorial teaches both
 
could some just point out how the scroll effect works on this? bbc.com/earth/world
 
what tutorial @JanDvorak
?
 
@KerrialBeckettNewham do you mean the parallax effect?
 
bot! mdn javascript
@cswl Got nothing.
 
bot!> 1+1
 
9:56 AM
@JanDvorak 2
 
bot! help
 
@JanDvorak Information on interacting with me can be found at this page
bot! mdn promise
 
bot! time
 
@JanDvorak That didn't make much sense. Use the !!/help command to learn more.
I had implemented mdn with duck duck go api, their search results are not web search.. so I didn't add ddg
 
what's up with the room title lately?
 
9:59 AM
@SomeGuy your breath is quite alliaceous.
 
It's in a constant flux
 
@JanDvorak yes
 
@JanDvorak What is time supposed to do?
 
move forward?
:D
speaking of time... it's time for lunch! \o/
 
Is using jQuery .html() function a good approach to check if a div is empty or not?
in case the div has real long HTML it will load it first
 
10:09 AM
0
Q: how to create dynamically Array in jquery?

Ram SinghI want to generate the following format of array, but not getting how can i do: var items = [ { src: 'images/wild-rose.jpg', w: 810, h: 1080 }, { src: 'images/black-2.jpg', w: 810, h: 1080 }, { videosrc: 'video/IMG_4979.mp4', html: '<video controls poster="images/video-icon.png">

 
Could there be any other efficient way?
 
please help me
 
10:26 AM
@RamSingh no
first you need to go and google what is difference between "javascript" and "jquery"
@techie_28 no, it is not. You can always just do element.childNodes.length > 0
also, keep in mind that using innerHTML is a really nasty way to populate DOM
 
@tereško I just need to check if a div is empty elements.childNodes.length would be efficient then .html() right?
 
Keep in mind that linebreaks and whitespaces are considered as child nodes too..
 
@cswl I think comments too
but I have this growing suspicion that where have a "jquery programmer" here, who actually cant write javascript
 
@thedigitalmouse been there, bought something
 
10:41 AM
if (!Array.prototype.last) {
    Array.prototype.last = function () {
        return this[this.length - 1];
    }
}
how can I make it return me last item as a array not string or text
 
return [this[this.length - 1]];
 
Don't add methods to standard prototypes, especially not if they're likely to collide with future functions`
 
I'd go with .childElementCount on supported browsers.
 
return this.slice(-1);
 
@JanDvorak so what you suggest then ? :)
thanks guys let me try
 
10:43 AM
@Mathematics Here? I'd just inline it everywhere.
 
yeah, if you have an array var myArr = [1, 2, 3] you can just use arr.slice(-1) to get [3]
 
or that
 
Couldn't give up on JavaScript @Mathematics
 
This is really cute, I want to implement it.
There is no reason for a lazy map to recalculate much when a single array element changes, and filter can be optimized with that balanced binary tree approach too.
Same for concatMap and other actions
 
@BenjaminGruenbaum Isn't that just what every FRP framework would do? Sure, the "drawbacks" are that your functions need to be pure and you can't program in an imperative way.
 
10:56 AM
Oh hi @Bergi fancy seeing you here :) Been following your debate with Domenic.
@Bergi it's not FRP, it's just RP, MobX is actually very nice and I've been enjoying it a lot - it's more like KnockoutJS with React than like Redux. It's super non-functional in a way - just reactive.
I guess people call everything functional today, but I really like MobX, it does proper change detection but it doesn't have any of the cruft Knockout has and it uses React so it's a much sounder model.
 
OK I've got to admit I didn't read the entire article, only the abstract...
 
Oh, the article is not about MobX, it's about diffing.
Let's say you have an array, and a .map result of that array that's an observable result (Knockout/WPF ObservableArray, not Rx observable), if you change one items, the map shouldn't run on the whole array.
Also, if you filter and you change one item - it should use a red-black tree and only change one item at most in the result which is O(log(n)) and not O(n)
 

« first day (2071 days earlier)      last day (2875 days later) »