« first day (2325 days earlier)      last day (2615 days later) » 

12:00 AM
I'm guessing it has to do with transparency, but no idea how
I've seen a couple of javert stuff like that :P
 
@towc imgur displays zoomed images on a white background, black otherwise
 
oh that's evil and genius
 
Is it possible to wrap some text inside of <p> with some tag like <span> ?
like if I've
<p>Hello World</p>
 
only if you've really
 
How can I wrap the word "World" inside of <span>?
 
12:07 AM
@ZahidSaeed one way would be to modify the innerHTML, but that's super-not recommended
but you can always fall back to that
 
@towc I'm trying to use QuillJS. It's a rich text editor
 
other way is to get the text content, substring in 3 different variables what should be before the span, then inside the span, then after the span
 
When i select some formatting option, it adds/removes tags inside of it
 
then you add a text node as a child of p with the first variable, add a span element with the second variable as content, then another text node with the last variable
that's the safe-ish way to do it
 
I want to attach some data to the word that the user has selected
 
12:10 AM
if you already have something set up to know the index of what the user has selected, then this is the answer :P
 
Well I've the index what the user has selected
 
that's all you need
 
But the problem is, That stupid editor isn't letting me to add my tags :/
 
just read what I wrote earlier
 
due to XSS
 
12:16 AM
you're not listening
 
I'm
I'm trying
 
I gave you a solution, you don't have to explain yourself
 
I try to implement
 
enjoy :)
 
Can you help me out a bit?
 
12:21 AM
if you have a specific problem just ask
otherwise I do have things to do and it's really late
 
I make a fiddle
Give me a sec
 
I'm actually off to bed
 
Just 1 min
 
I have a flight in a few hours
and need sleep
or something entertaining
I do also have school on monday
shit my scheduling sucks
 
@towc Here's the updated one
https://jsfiddle.net/95yh4z5a/1/
Are you checking?
 
12:27 AM
pinging me won't make me check faster
 
Yes I know
 
the internet here is also soooo slow
fiddle hasn't loaded yet
 
What I want to do is, you add and select some text
 
and I'm too bloody tired. good luck
 
Then you click on the "Add Annotator" button
 
12:28 AM
unless you want to incentivize me monetarily, that is
 
hmm
At least just have a look
 
because the only thing I can sell my sanity for is money
I swear it's not loading yet
and I can't be bothered
I'll check tomorrow if I have time, ok?
 
hmm okay
 
1:20 AM
What's up with this fiddle Zahid?
 
@JavaSpyder 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.
 
 
1:47 AM
If some one around could review my answer and perhaps point anything that could fail or could be improved I would greatly appreciate, I'm not a jquery or javascript person, so I might have committed some mistakes :P
0
A: Custom format not applying

PrixUnhappily using the onchange event suggested by the livestamp examples didn't work for me at all, perhaps some one more experienced will be able to make it work on my circumstances above described, so I will leave the question open for a better answer to come up for a few days. To solve my pro...

its just a small hack to achieve what the event was not working for
 
Wes
2:09 AM
@Mosho a scarf magically appeared? :B
 
 
1 hour later…
3:10 AM
hello, anyone can help me using html5 canvas? I made a thread over here - stackoverflow.com/questions/42464280/…
 
@DownCrow 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.
 
 
2 hours later…
5:29 AM
@MadaraUchiha can u give me a tutorial about that or at lease a clue to search about it
 
6:11 AM
Hey folks
 
6:55 AM
Hey Wes
 
Hey little pootis
 
 
2 hours later…
9:21 AM
@AndroidDev Google "git deploy bare repo" and see what you get.
 
Downvote 4 answers and you'll get to 666 rep.
 
it's actually tempting
but on the other side I'm no devil
 
looking for 2 posts to downvote
 
what's special about 91194?
PIIPA?
 
 
1 hour later…
10:44 AM
@towc You free to check the code?
I'm still struck
 
well, flight is in a few minutes
 
I spent the whole night but I don't know what to do :/
Is there anyway to bind an event on text node?
 
quill probably has a certain thing that allows you to do it
read through the source code to find out how to do what
or use the solution I've already given you
 
Listen
Its just a text editor
When we press enter it simply inserts <p> tag
If I select some portion of text and click on a button (Custom Module that I made) it wraps the selected text with <span> tag
Then I bind click event on that
But the problem is, the Quill is having problems with that <span>
 
no you listen
I'm not your maid
I'm not your employee
I'm not your parent
 
10:50 AM
I didn't said that
I'm just asking for suggestion that's all
 
I owe you nothing
I already gave you a lot of help
if you don't want to listen to it, that's your problem
 
I've used it
but its still not working
 
 
2 hours later…
12:56 PM
The real wtf is that you read a subreddit like that
 
1:28 PM
It was on front page ._.
 
1:57 PM
yeah, your reddit subscriptions are definitely stranger than mine
the "front" page gets assembled from your own subscriptions
 
2:23 PM
hi
 
I wasn't logged in.
 
hmm so npm says 'eslint' installed global although I check global node modules folder it's not there and I did a -g uninstall and didn't find it. Maybe I need to clear cache?
 
2:40 PM
@BrianJ How does it "say" that?
 
you still having issues with eslint in atom? have you tried a simple test project?
 
@MadaraUchiha it says that during "npm install"
@Luggage I wish uninstalled some global packages an can't do an install.
I'll figure it out :)
 
did you uninstall npm ?
 
yeah nuked it and reinstalled
might be my project, could re-create
 
ok worth a shot
 
3:22 PM
seems to be just that project, I created a clone and install went fine
 
after nuking and reinstalling npm, did you restart your terminal as well?
 
3:39 PM
hi
 
@LovaChittumuri 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.
 
agenda please
 
what?
 
I am gently asking that what is the subject to discuss in this room.
 
The subject is JavaScript, but we're never strict on what's allowed to talk about here. We're all friendly here and will sometimes talk about other life related things as well
 
3:45 PM
Ok. This is non related . Thanks I am leaving from this room
 
3:59 PM
hmm @Luggage so it ran first time but after I npm installed I get errors which I can't quite make sense of:
 
Need to JSON.parse an object(the task is asking to present the object as a JSON object and not just a variable), and although the output is what I wanted, there's an error:
SyntaxError: Unexpected token : in JSON at position 5

I have to send it in spotless, lint is going haywire over this. No idea how to fix it, been browsing through tons of sites all day today and yesterday, tries JSON.parse(JSON.stringify(obj)); but that gave me another issue.
 
@JackOfBlades 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.
 
And I should probably mention that it looks like: string+variable+string
 
Just to be clear, JSON is not an object, it's a string. It's important to note the difference, because I have no idea what exactly your issue could be... are you trying to parse a JS object? That will throw.
 
Is the object your stringifying actually a valid object?
 
4:11 PM
Yes, it's an integer.
 
numbers are not objects in JS
 
^
 
Trying to JSON stringify a number will just give you a string with that number in it... What exactly are you trying to do? Can you make a jsfiddle?
 
I'll try, this is the first time I'm doing one with Node JS(people over in that chat aren't responding)
Until I manage that, this is the part which is to do the job :
console.log(JSON.parse('"sum": "'+summary+'"'));
 
That's clearly erroneous
JSON.parse expects valid JSON
what you're constructing is not valid
valid JSON has opening and closing curly braces...
plus, what you're doing here makes absolutely no sense
 
4:15 PM
oh God..
 
that fixed it
 
Why are you doing here is taking a variable, putting it into a string, then parsing it into an object...
that's absolutely ridiculous
 
Not to mention unsafe
 
just take the variable and put it into an object
 
4:16 PM
let summary = "foo', magic: 'lol";
 
yeah, good point ^
 
Is this better?:
summary = '{"sum": "'+summary+'"}';
console.log(JSON.parse(summary));
 
no
just do console.log({ sum: summary })
you don't need to turn it into JSON, then parse it. That step is absolutely redundant and silly
 
does anybody have any time to help me with a project of mine?
 
@ElliotLabs 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.
 
4:20 PM
I've owned this keyboard for almost a year and a half. I only just realized it has a Fn key.
 
@CapricaSix oik will do real quick
sorry about that
 
@KendallFrey hey try fn + f9
 
Thanks for the help, fixed it and I learned something new
 
ok, I need help finding the variable in a webpage that holds the data I need
Specifically on shutterfly
I need to find the variable that holds the currently selected photos
 
screenscraping? yuck
 
4:23 PM
I have trolled through the crazy amounts of variables in the system and am unable to find the one I need.
no
Here is a link to my project:
https://github.com/elliot-labs/Shutterfly-Bulk-Downloader
 
@BrianJ Google seems to indicate you're trying to get me to turn my touchpad off, but actually it would trigger Synapse to create a macro if I had it installed.
 
Shutterfly updated their back end and I need to hook into their new variable that soters the needed info.
*contains the needed info
 
4:48 PM
@KendallFrey ah my attempt to hack you failed
jk
 
@ndugger were you refering to me as a screen scraper?
 
5:36 PM
Still need help
 
6:04 PM
hello, is there any good page loader plugin?
jquery partial page ajax loader plugin, tried to search couldnt find anything descent
 
what about it?
 
seems interesting and useful
 
6:52 PM
guys i have pixel data array containing RGB values, how can I create image from this? as like a .PNG format?
 
look into ctx.putImageData
 
paint it to a canvas
 
i've seen that but thought it was only painting onto a canvas, rather than I can create an actual image from it
 
you can paint it to canvas, then get the image URL as a base64 datastring
 
as png format, even.
511
Q: Capture HTML Canvas as gif/jpg/png/pdf?

ParandIs it possible to capture or print what's displayed in an html canvas as an image or pdf? I'd like to generate an image via canvas, and be able to generate a png from that image.

 
7:08 PM
thanks, my image is being outputted as 300 pixels by 150, but I'm suppling size 512 x 512: var imgData = ctx.createImageData(512, 100);
512 * 512 it is, not 100
sorry im silly, its becuase my canvas size is 300x150 !
 
 
1 hour later…
8:32 PM
anyone know good ajax html loader plugin?
spend too much time looking for it, looks like im gonna make it myself
 
ill look into it, thanks, just short on time now
its gonna be pathetic for tommorow
 
focus on the important bits and don't get disappointed
 
Sie
Can someone help me understand why my loop isn't working properly? I'm try to replace a variable with a random (semi-random) number.
var j=0;
while(j < patrons.length){
  var books = patrons[j].booksOut;
  var fine = patrons[j].fine;
  var randomnumber = Math.floor(Math.random() * (20 - 5 + 1)) + 1;
  for(var i=randomnumber;i<books.length;i++){
    if(books[i].isOverdue()){
      fine = fine + 5.00;
    }
  }
  patrons[j].fine = fine;
  j++;
 
it looks like you are looping the array starting from a random position..?
 
Sie
8:44 PM
i is supposed to represent the amount of days and determines the fine. I'm trying to make it random to make sure it works.
 
In what way does it fail?
 
Sie
It doesn't seem to be assigning the random num. to the i.
 
it's randomly skipping books, but not randomizing the result of .isOverdue()
So it's only ever REDUCE the amount of fines charged.
it'll skip between 1 and 16 books per person.
!!> Math.floor(Math.random() * (20 - 5 + 1)) + 1
 
@Luggage 12
 
Sie
ok
 
8:49 PM
drop the random number. It doesn't help you test the logic. To do that, give it data with an overdue book.
 
Anyone with Node.js and node-mysql knowledge?
 
@Faegy 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.
 
Could anyone explain how to assign a result to an object parameter if the result is located in another object ("this.example = result;" wouldn't work). This is my bit of code:
 
attempting to get all grayscale values for .png - tried using canvas and reading pixel values, but seems 16bit images are rendered at 8 bit. Any suitable alternatives.
what up Faegy
 
1 message moved to Trash can
@Faegy 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
 
8:59 PM
class User {
    constructor(id) {
        this.id = id;
        pool.getConnection(function (err, connection) {
            if(err){
                throw err;
                return;
            }
            connection.query("SELECT * FROM `User` WHERE `id` = '1';", function(error, results, fields){
                this.firstName = results[0].firstName;
            });
            connection.release();
        });
    }
}
 
"this" is probably not the object you expect, due you you using it inside: function(error, results, fields) { ... }
use an arrow function.
connection.query("SELECT * FROM `User` WHERE `id` = '1';", (error, results, fields) => {
    this.firstName = results[0].firstName;
});
same with pool.getConnection(function (err, connection) {
 
Thank you! I'm new to javascript, any good reference site for basics? Currently using mozilla documentation...
 
mozilla's is good for a reference. 2ality.com has decent articles.
some of them are a bit low level
 
Thank you again!
 
!!resources
 
9:07 PM
@Luggage That didn't make much sense. Use the !!/help command to learn more.
 
Hey, guys, what is the equivalent of this $("div .some-class"); in vanilla JavaScript?
 
document.querySelector("div .some-class");
 
^ or querySelectorAll() if you expect multiple results
 
querySelector!!! Thanks, couldn't remember the name
 
See: github.com/ndugger/youdontneedjquery for a reference of jQuery -> 'vanilla'
 
9:10 PM
@Faegy You probably shouldn't do this work in the constructor.
 
@MadaraUchiha Why wouldn't you recommend so? I've been told that an object should be entirely operational once it has been constructed :/
 
@Faegy You're doing too much in one place.
The User object shouldn't be responsible for fetching itself
 
@Faegy Your version isn't either, since it's async.
 
Instead, you should have an object whose job is to go to the database, and create a User object
 
Those database calls are async, so it's not functional until some time AFTER the constructor finished anyway.
 
9:16 PM
Or, since it's async, a Promise<User>
 
In short, make another class (e.g. UserStore or UserRepository) with methods like getUser(id)
 
So you would recommend me to create a user with something that would be called from another class like:

user = new User(id, firstName, lastName, email, phone);
 
Yes, but I suggest using a single argument with all properties:
 
@Faegy Yes.
 
user = new User(userData); // userData = { id: 1, ... }
constructor(initialData) {
    Object.assign(this, initialData);
}
 
9:19 PM
Thanks for all your advise!
And when a user would update his information, would the update to the database be called from the user class or the other class?
 
@Faegy I have something like this:
 
Hello, can somebody help me with installing npm/nodejs on ubuntu 16.04?

it keep saying

```
module.js:328
throw err;
^

Error: Cannot find module '../lib/npm.js'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at /usr/local/bin/npm:24:11
at Object.<anonymous> (/usr/local/bin/npm:86:3)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
 
There are different schools of thought on that. In my app, I have a user.save() right on my user class, but a userRepository.save(user) on the "repository" class is a popular pattern
 
// Get `userMapper` from DI

const user = await userMapper.get(42);
user.name = "Madara Uchiha";

userMapper.update(user);
 
9:22 PM
@Luggage it is always better to split object and logic of it persistence.
 
@phenomnomnominal I can't navigate?
@pomaxa There's no such thing as "always better"
It depends on the level of abstraction you want.
 
I won't agree to "Always" but I agree that the update() on a 'store/repository/whatever' has some advantages.
 
Personally, in a large project, I won't even have direct await userMapper.get(42) calls, but go through a service that would, as part of its own work, fetch the user and manipulate it
In a small project, I'd go with a 100 line main function that does everything
 
Besides, the code that does saving isn't actually duplicated in each model.
 
Real stuff is usually somewhere between the two.
 
9:24 PM
@MadaraUchiha weird, do arrow keys work? or clicking the arrows?
 
@phenomnomnominal I don't have arrow keys or controls
The URL says #live so maybe it's that?
 
@MadaraUchiha If you create something you would develop for year or more... it is always better to keep object simple. And to keep single responsibility pattern. in case we are talking about one time job... maybe. in this case it can be done in one function... but it is imho. sorry for interuption
 
oh duh, maybe it's cause I'm logged in
 
Yea, I agree on separating your code and not mixing concerns.
 
@pomaxa It's not an interruption, it's a valid concern to the conversation.
 
9:25 PM
But an api choice of having a .save() on an instance or another class doesn't change your internal code organization at all.
 
Don't feel uncomfortable sharing your professional opinions here, they're always welcome
 
Doesn't have to, at lesat.
 
@Luggage It's not an API choice in this case
 
Yea, but be prepared for counter opinions, sometimes :)
 
9:26 PM
It's a question of where the logic sits.
Think in terms of C++
 
My argument is that how the user accesses the function can be separate from your code organization.
 
What would have to recompile if I need to make a change to my fetching/storing logic?
If you do it in the user class, then everything that uses that user class, even when it doesn't have anything to do with storage, would have to recompile.
Whereas if you do it in a UserRepository class, anytihng that uses that will have to recompile, and we know that all of them are relevant.
Users of the User class would be unaffected.
 
I don't organize code by what would need recompiled. The compiler serves me, not I it.
 
@Luggage Yes, but it's a good visualization for "what might break when I do this change" and "Are the possible break points relevant to my change?"
If the answer to question #2 is "no", then you're likely to have code smell.
Again, it's all a question of how much abstraction you want.
You can do anything between 0 layers to 5 layers in this particular case.
Maybe more..
 
I don't disagree with any of that, but I can still stick implementation in any file I want and still call it from user.update() or repository.update(user). The API that I use does not prevent any type of organization you want behind the scenes.
 
9:30 PM
And what would be the easiest (as I'm a newbie)?
 
@Faegy Easiest for what? To write? To read? To maintain?
Easiest to write would be to not even use classes, probably.
What's your goal?
An actual product you're planning to deploy in production? Something you're writing as a proof of concept to learn?
 
I want to answer "it doesn't matter". Expect to change your code as you learn to organize it and form opinions about which patterns work for you. Just pick one and learn from it.
 
@MadaraUchiha A bit of the two firsts. I'm trying to make a Express.js website and I'm looking for the user management part now. Its first aim is to help me learn.
If it can help, I'm coming from PhP but I had enough of the mess it makes
 
@Faegy Right, so I'd go with a UserMapper or UserRepository or whatever, that deals with clean User objects
 
I can agree to that.
 
9:35 PM
This will also give you the chance to learn Promises and async functions
 
I'll go with it! Thank you all for your guidance.
 
They're pretty central to async programming in NodeJS
@phenomnomnominal ^
Scrollbars make me sad
 
slack.com doesn't use 3rd party sign ins?
 
@phenomnomnominal In general, go over all your code samples and make sure they fit in and that they're for the correct language
 
9:40 PM
Yeah they fit on my mac :P
I'll plug into a projector later and check them out
 
@MadaraUchiha maybe you can help me with this error:
Error: Cannot find module 'npmlog'
google suggest to reinstall npm... already try it.. doesn't help
 
aight, I think I sorted them all
 
did you do npm install npmlog?
 
@pomaxa When are you getting this error?
 
9:47 PM
user@server:/var/www/chef# npm
module.js:472
throw err;
^

Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /usr/local/bin/npm:18:11
at Object.<anonymous> (/usr/local/bin/npm:86:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
@MadaraUchiha like each time I'm calling npm
 
Windows?
What version of node/npm?
 
ubuntu 16.04
node -v
v7.6.0
npm -v
module.js:472
throw err;
^

Error: Cannot find module 'npmlog'
 
I'm stuck with it... more of it...

locate npmlog
/usr/lib/node_modules/npm/node_modules/npmlog
 
which -a npm
 
9:49 PM
So it looks like npmlog is installed...
@Luggage
which -a npm
/usr/local/bin/npm
/usr/bin/npm
 
@pomaxa How did you install node?
.deb?
 
ls -l /usr/local/bin/npm /usr/bin/npm
should be a link..
 
@MadaraUchiha on first try, - I used standards repository, after it, I download tar.gz from npm, and build from sources.
 
it worked after that for a while?
 
@pomaxa Hmm
(In general, it's a great thing)
 
9:52 PM
uninstall the .deb and then run make install again on the source version.
maybe clear /usr/local/lib/node_modules/npm before running make install again
(i think that's the location.. is on my mac)
 
@MadaraUchiha thanks, will try right now.
Luggage, - already try... even purge everything. Maybe I miss something, but I'll try to use nvm right now.
 
I wouldn't ADD nvm on top of broken node.
2 mins ago, by Luggage
ls -l /usr/local/bin/npm /usr/bin/npm
 
Oh yeah, completely destroy the current broken installation before you try nvm @pomaxa
 
a common reason for that error is that that is not a symbolic link. so do the ls -l, please.
 
lrwxr-xr-x 1 david admin 46 21 Feb 12:51 /usr/local/bin/npm -> /usr/bin/vim
 
9:56 PM
@david ???
@Luggage it is a symbolic link :( But thanks for idea
 
well, npm can't find it's own node_modules, i think. Maybe check permissions.
 
@MadaraUchiha - thanks. NVM do it work. :)
@Luggage I even try as root...
 
why would you bind npm to vim?
 
@towc -rwxr-xr-x 1 root wheel 1745984 21 Oct 22:07 /usr/bin/vim -> /usr/local/bin/yarn
 
you sweet fuck
die
 
10:07 PM
umm
 
an astute observer would notice that I forgot to set the l flag on that second doctored line
 
I did
 
0
Q: How to connect my domain bought on name.com with my herokuapp?

PomeGranateI bought my domain on Name.com I got my App on heroku. On heroku added a new "custom domain": Domain Name DNS Target mydomain.com mydomain.com.herokudns.com and on the info bubble on heroku it says: Supply this to your DNS provider for the destination of CNAME or ALIAS records....

 
10:40 PM
If I have a shape/stencil in an ImageBitmap and I want to render it to a canvas with a certain colour what's the best way to do that? What I've come up with is setting globalCompositeOperation to destination-out for drawImage and destination-over to fill a rectangle with the desired colour.
 
@PomeGranate Have you contacted support of either provider?
 
11:02 PM
git needs an option to show a 4 way merge
1) the commit at your HEAD, 2) the commit at the branch you're merging in 3) the shared parent commit and 4) the commit your commit could smell like
 
@david whistles "with the ship that sails the ocean"
 
11:22 PM
@OliverSalzburg good idea - No didn't. maybe I should. tommorrow
who has worked with amazon s3 and lambda functions?
 

« first day (2325 days earlier)      last day (2615 days later) »