« first day (1721 days earlier)      last day (3220 days later) » 

m59
12:01 AM
What would you call a variable that is a domain+port?
host? address?
actually, protocol+domain+port
 
Why is there no Number.range( starter, ender, iter ) in javascript ?
 
@Abhishrek Why is there no ice cream in my banana?
 
@KendallFrey :-/ it kinda seems logical
to do this
Number.range(8999, 9001).map( el => el > 9000 : 'ITS OVER 9000!' : 'BOo' );
instead of writing a for loop :-/ or am i missing some good utility function ?
 
12:19 AM
Hi in Javascript when I convert 165 centimeters to meters it comes out as 1.6500000000000001. How do I make it so that it comes out as 1.65 only?
I don't want those extra 0's or that 1 at the end.
 
!!> 165 * 0.01
 
@KendallFrey 1.6500000000000001
 
dang
!!> 165 / 100
 
@KendallFrey 1.65
 
try that
 
12:22 AM
lol
!!> 165 * 0.01 === 165/100
 
@Abhishrek false
 
No I can't divide
I have to multiply
 
uh why ?
 
Because its stored in an array like this:
var Centimeters = new Array(1, 0.01);
So I just multiply it by what is inputted
 
Maybe you should just round it while displaying it
 
12:37 AM
@Tahmid Not a lot you can do about that, just round before you display it
 
Is doing 165 * 0.01 and 165/100 the same thing? Why does it give different answers?
 
And hope that you don't do enough operations to affect your results
Because of floating point arithmetic
 
Or use a decimal or fraction type
 
I'd handle it the same way you handle currency
Store it as an int then just add a decimal point when you display it
But I don't think there's an easy way to do that without dividing at some point
 
Hmm..
Okay thanks guys
 
1:33 AM
@Tahmid hi
 
@JimSteven 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.
 
@JimSteven, Hi?
 
okay, thanks, then I'll post my code here
This works in google chrome and IE, but it doesn't work on lower versions of IE and Firefox, I hope someone can help me :D
<script type="text/javascript">
var cutTextareaBtn = document.querySelector('.js-textareacutbtn');

cutTextareaBtn.addEventListener('click', function(event) {
var cutTextarea = document.querySelector('.js-cuttextarea');
cutTextarea.select();

try {
var successful = document.execCommand('cut');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Cutting text command was ' + msg);
 
document.querySelector didn't exist in ie before ie8
That's the first problem
addEventListener was added with ie9
 
ohh, is it possible to set one depreciated code and another newer version of the code so it would work across different browsers(either different version)
 
1:44 AM
Sure
But I wouldn't worry about supporting anything below ie8
 
I am developing on a remote server which has a lower version of IE and firefox
that's why I want to test everything xD
other notes before I search for depreciated codes?
 
You could use jquery
The one thing it's good at is handling outdated browsers
Or you could use modernizr
Or you could just avoid "new" features or you could google for polyfills as you need them
You have lots of options
 
wait, I find jQuery difficult that js
or is it possible to convert my code to jQuery
 
Use modernizr then
 
2:18 AM
@Meredith We don't support IE < 11. So the biggest problem we have now is Safari.
 
Yeah safari is balls
 
Safari used to be good and push hard for standards. Stopped doing that since two or three years ago...
 
:(
I can't make my code work xD
 
I don't like how Safari is discontinued on Windows.
 
Keep trying
You'll get it
 
2:20 AM
hahaha, I don't quite get js, I'm more comfortable in using php :D
 
So then you have good motivation to learn js
 
PHP is quite similar with JS. Much closer than Java or .Net.
 
yep
anddd, I'll be presenting this later.. sadlife
this is the last part wew
:/
 
@Sheepy really? in the way that they both have functions and variables?
 
I'd definitely say that javascript has more in common with php than it does with java
 
2:28 AM
namely?
 
knowing more c# than Java, I'd say JS is closer to c# than PHP
in a pure syntax argument
 
I've never worked with C# so idk
 
c# is similar, but more organized imo
but I don't know much java
:P
php and js don't share scope similarities, many syntax differences exist, and there is no proper class system or inheritance in js (albeit many alternatives and similar constructs exist)
 
And there are a lot more differences with java
 
yes, I find it difficult to understand js than java/php/c#, and I don't know why
 
2:32 AM
but there is also more similarities
 
Namely that java isn't dynamically typed
 
let's look at Ruby then
 
hahahaa, I wanna learn ruby :)
and coldfusion
 
don't learn CF
well, do if you wanna
but I don't recommend it
 
Ruby reminds me of python
But I've used ruby like once
 
2:33 AM
it is dead/dying, and it makes little sense to program in markup
 
Ruby isn't dying or dead
 
I'm talking about CF
 
As a first language Java is best to learn?
 
Ruby is pretty hip
 
@Tahmid JS imo
 
2:34 AM
Usually they teach java in computer science 101
That or C++
 
@Tahmid nah. Ruby is nice, JS or python
 
Depending on the professor's preference
 
JS gives you the benefit of instant gratification.
you have interpreters everywhere.
 
I don't understand why most universities teach Java as programming fundamentals (I'm from the UK by the way)
 
you can get something cool working in mere hours.
 
2:35 AM
They both work without classes, has haphazard api, no variable type, have template string and same array syntax, are interpreted....
 
Because java is great for teaching fundamentals
 
"haphazard API"?
 
I'd argue teach c# over Java..
 
That's pretty much the only good thing about java though
 
c# is (from what I see) more flexible a language
 
2:36 AM
So once you learn Java is easier to grasp other languages?
 
I learned js/php/pearl all around the same time
 
@JanDvorak Even Java is more consistent than PHP and JS in my book. Your opinion may differ.
 
c# later, c++ much later
 
Wouldn't it be the same say if you learnt Visual Basic as your first language?
 
Java makes it easier to learn object oriented programming
 
2:37 AM
VB4 was a little later :P
basic is nice for learning as well.
 
Switching from java to haskell wouldn't be a smooth transition
 
@Tahmid perhaps, but VB is bad
 
I agree with Meredith. Java has a lot less magic than most languages.
 
VB isn't bad unless you're doing anything real with it
VB is a great learning language
teaches you constructs and shit
 
Java's verbose design makes the code's intent clear.
 
2:38 AM
Yeah java's good for teaching because it's straightforward and basically forces fundamentals on you
 
for me C# is very fun to learn
 
QBasic is also great to tickle around with
 
Aah.. I see..
 
If you want a language that forces you to write good code, look at Haskell
 
C# is also nice. I like Java more, but C# is indeed more... convenience.
 
2:39 AM
I wish I had learned haskell in school
I want to learn it now but I have so many other things to do
 
I like JS because I like JS :P I'm working on moving most of my work to JS
fuck c++ or c# when I have JS :D
 
@JanDvorak Tell that to universities. Some of them do.
 
now...I just need to embrace es6
 
One of my professors loved talking about haskell
And most of her pseudocode was haskell-y
 
Is Android application development Java?
 
2:40 AM
@rlemon Spread the good words!
 
yes
java
but you can also use C++
 
Or Angular
 
I like C++
It's a pain in the ass like 100% of the time
But I still like it
 
seriously, c++ and js + node and I can do almost anything
so long as I don't need crazy ass performance
 
Ooh..
 
2:42 AM
You can use js to create email templates
 
@rlemon Make a million dollars
 
@SomeKittens we're working on it :P
well, maybe there or more
 
Tonight I make the compilation & edit phases of my blog not terrible.
 
don't quote me, I don't know exactly how much my project has racked in
@MadaraUchiha I'm almost through the entire first season of fullmetal alchemist, the first manga show I actually appreciate. :D
 
FMA?xD
 
2:48 AM
why can't javascript have ?: as an operator?
 
we have ||
 
not always the same
 
when isn't it?
 
for example: slug.length > 11 ? slug : slug + 'a'.repeat(12 - slug.length)
 
ternary !== ||
 
2:49 AM
um...
 
Javascript does have a ternary operator
 
oh, you mean the normal ternary? We do have it.
 
no, but there should be an implied version
 
2:49 AM
slug.length > 11 ?: slug + 'a'.repeat(12 - slug.length)
actually wait………
 
lol
 
Never mind, that doesn't work
 
how would that work?
 
bad proposal
 
hmm hey guys, my code does not work on firefox xD
 
2:53 AM
Are you using modernizr?
 
my code doesn't work on IE
evil grin
 
no no no, i don't have spare time because I'll be presenting this later
 
Define later
 
so for now I wanted to test this across all browsers
 
1 message moved to Trash can
@JimSteven Please don't post unformatted code - hit Ctrl+K before sending, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com or pastie.org
 
2:54 AM
My code doesn't work in IE:
#include<stdio.h>

main()
{
    printf("Hello World");

}
 
oops okay,
 
Uncaught SyntaxError: Unexpected token ILLEGAL
please advise with this doubt
 
Well I told you what the problem areas were
 
you need to #include jQuery
3
 
And they're still there
 
2:55 AM
but i just installed firefox
code works on chrome and IE
i opened the console of firefox but it says unable to cut :/
 
Well there you go
They don't want you to cut
 
hahahahha
why is it not working :(
 
@JimSteven ff is anti emo
 
should I post it here in stackoverflow
 
No
 
2:57 AM
not in this form
 
hahaha well, kaneki is not emo in somewhat xD
 
Firefox won't let you use cut until september
 
until september?
why?
 
Idk
 
the heck, I'll kill them haha
 
2:58 AM
+ even in september most of your ff users won't be using the latest release
So have fun
 
Actually, it won't let you use cut outside a combat until after your S.S. Anne in Vermilion city.
 
hahaha, it has a bug, let ash die inside ss anne, and when you have surf, go back inside the port, then you can surf beside the ship and you will also see a truck! hahaha
then you will be blinded by the truth, you will see a block of black pixel xD, collider :D
 
3:16 AM
i posted at the forums, they told me that cut is only supported in FF41
 
Which will be released in september
 
ohh, but question
if I made it to copy, instead of cut
will it work?
 
Maybe
 
hmm, I forgot how to make it copy instead of cut
0
Q: How make js work on firefox

Jim Steven<script type="text/javascript"> var cutTextareaBtn = document.querySelector('.js-textareacutbtn'); cutTextareaBtn.addEventListener('click', function(event) { var cutTextarea = document.querySelector('.js-cuttextarea'); cutTextarea.select(); try { var successful = doc...

maybe you can dropby and put a resolution to change the cut button to copy, if you have spare time :)
 
dat title
 
3:20 AM
sorry for that, hahaha
pls don't downvote
 
I forgot the link where did I got my code
it is from google project
checked the link, is that js?
 
Yes
 
hmmm, what is i use flash?
wil it work on firefox
 
Is it really that important?
 
3:28 AM
yes, the cut/copy feature is important for my webpage
 
@AwalGarg I summon you
 
Well if it's important, then go for it
 
will it work on FF?
 
Sure
If they have flash installed
 
oh okay, I'll add it on my documentation
 
3:41 AM
hmm, why zerotoclipboard does not work, I've downloaded v2
moviePath: 'C:/xampp/htdocs/zeroclipboard-2.2.0/dist/ZeroClipboard.swf'
not allowed to load local resource
 
well, it's telling you...
 
Yeah you gotta read the error messages
 
yeah i read it
not allowed to load local resource
<script src="C:/xampp/htdocs/zeroclipboard-2.2.0/dist/ZeroClipboard.js"></script>
 
And you're still trying to load a local resource
 
anddd, Uncaught ReferenceError: ZeroClipboard is not defined(anonymous function) @ copy.php:19
how not to load local resource? this is my first time to encounter this
 
3:47 AM
Put it on your server
 
wait, I'm using zampp
and the zeroclipboard files are on my htdocs
i mean xampp
 
    let el = this._wrap(data, this._start, this._end);
    if( this._start ){
      this._start.prev = el;
    }
    this._start = el;
can i somehow reduce this to a single statement ?
 
this._start ? this._start.prev = this._wrap : this._start = this._wrap
 
meredith i wanna ask about DOM
this one:
 
@Meredith no
it would rather be like
 
3:52 AM
w3schools.com/jsref/tryit.asp?filename=tryjsref_text_select, it will highlight only, can I add something like it will copy the highlighted text :D
 
this._start && this._start.prev = el;
this._start = el;
 
Stop using w3schools
 
it's quite useful haha
 
well worth a try
 
i can edit the codes on the fly with the demo
 
3:53 AM
@JimSteven well a knife is useful to cut your throat ... will you ?
 
@JimSteven no
@JimSteven ...
 
I can't?
 
@JimSteven jsfiddle.net codepen.io // for the editor part javascript.com codecademy.com for learning with the same you just said
w3schools is not a good resource, #legacy web
 
ohh okay thanks for the tips
 
@Abhishrek if you use it, you'll need to add && this._start = this._wrap to the 2nd argument
I forgot about it
And I'll figure out how to use it with bitwise operators in a second
 
3:56 AM
its anyways a micro optimization.
but i wanted to beat javascripts.push, i will now be happy by smoking .unshift though :D
 
It's a thought exercise
 
with a link list T_T
 
(this._start && this._start.prev = el) || this._start = el
Try that
 
Actually you don't need the second this._start let me remove it
 
3:59 AM
ew. Just use the ternary
 
anyone have any good front-end calendar libraries (besides full calendar)?
 
or a conditional
 
Yeah use a conditional
I hate ternaries
 
@royhowie moment.js?
 
@JanDvorak for display
 
4:00 AM
jQueryUI?
 
I'll probably end up building my own
 
@Meredith best case would be this._start.prev = this._start = el;
but we will have to somehow check for this._start's existence to give it to prev :-/
 
Just use an if statement
 
yeah i am slower than .push :-/
but okay
 
Make your algorithm faster
 
4:08 AM
nah not critical for the thing
 
>
 
@Abhishrek Even if you beated push now, it may beat you in next browser update, and vice versa. If you have Chrome and Firefox, a major update arrives every three weeks.
 
@Sheepy that doesnt mean its not worth trying.
 
@Abhishrek it does
 
@JanDvorak eh i am not shipping this it was merely just for fun exercise
heck even if i beat .push in chrome i might be destroying my performance in ffox and most likely the code wont work in IE cause well IE
 
4:20 AM
*won't
 
4:34 AM
Wow, just discovered stackoverflow chat :-)
 
@RON2015 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.
 
Love it
 
@HimanshuMishra 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.
 
If a question that I post is answered, but then I realize there is a second part to the question, how do I go about "re-opening" a question? I noticed that my question gets no attention after it is answered. Would it be best to just open a new question? or am I missing something obvious?
 
ask a new question. Sometimes the answerers answer to comments, too
 
4:39 AM
Sorry, do you mean post a comment asking a question on the original question page that I posted? or post a new question page. Sorry for the confusion. I have tried posting comments asking my additional question but it seems that no one sees those.
 
You can link your previous question from the new one
 
Gotcha, that makes sense. Thank you. I will be posting my new question when I get home!
 
@argentum47 like what?
@Abhishrek yo
 
4:59 AM
@AwalGarg have u ever used financial times scroller lib ?
 
no
 
i have heard that its a pure logic library with no ui requirement :-x
is it possible for you to have a look looks with hope
 

« first day (1721 days earlier)      last day (3220 days later) »