« first day (2005 days earlier)      last day (2943 days later) » 

12:00 AM
15
Q: "Use Strict" needed in a TypeScript file?

DeborahKI've seen posts regarding where to put the "use strict" line in a TypeScript code file. My question is, why have it at all? Since TypeScript is already a strongly typed language, what does "use strict" add?

It gets more complicated
it got added when I A) Compiled to ES5 (not ES6) and B) had an export statement in my file
 
seems like "just add it, the good is more than the bad" is the conclusion
 
tslint was a good call :)
@ton.yeung we have a proprietary system
I don't think so. I could add it if I found it useful though
tbh I don't know a ton about the build process yet
even if I did, I couldn't talk about it :P
silly
I'm sure we do, I'm wondering if it causes any difference in behavior while writing the typescript
now I just need to figure out how to make a REST call return a promise...
fetch should return a promise, right?
 
12:17 AM
why would MS not use tsc? They made some 'better' version that they don't release?
kinda like how they don't use .sln files. :)
 
@Luggage I'm not sure if we use tsc or not
also we do use .sln files, we just generate them on the fly :)
 
some blog by someone on the visual studio team was saying they weren't good enough so they used something else. still used .proj (msbuild) files, though
 
@SomeKittens LOL I thought that was just a troll video but it's a real thing. That is awesome!
the one redeeming factor is it looks like its easy to replace the batteries and storage :p
 
now to figure out if fetch is usable on IE10... probably not right?
 
according to caniuse.com/#feat=fetch not even IE11
 
12:22 AM
polyfill it
 
too bad
@ton.yeung dude I had to fight not to have to support ie9 with my new feature
polyfills are great but I have to go through Legal to use any open source software
 
ouch
 
it's not that I can't use open source software, it's that it's a process I don't want to deal with
jQuery.ajax is perfectly workable, I can just rejigger it to return a promise and when the world starts using fetch, it's easy enough to refactor it if we want to.
 
@Codeman do you work for the government?
 
@Loktar MSFT, not too different.
 
12:35 AM
return new Promise((resolve, reject) => {
    $.ajax(apiRoot + url, jQueryAjaxOptions)
    .done((data, textStatus, jqXHR) => resolve(data))
    .fail((jqXHR, textStatus, errorThrown) => {
        try {
            let error = Object.assign(new Error(), { xhr: jqXHR, ...jqXHR.responseJSON });
            reject(error);
        }
        catch (ex) {
            reject(ex);
        }
    });
});
 
@Luggage very similar to what I'm doing :)
 
ah, well understandable I guess
 
except I'm using Q.Deferred
 
1 message moved to Trash can
@AdityaVikasDevarapalli Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
12:37 AM
also I'm using Q, though I don't think that changes much
 
shouldn't.
you can't tell what I'm using, but it's bluebird.
 
@Luggage oh I've heard people suggest that to me :) it's a mature codebase, it's not really feasible to change from Q to something else right now
 
1 message moved to Trash can
@AdityaVikasDevarapalli 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 or pastie.org
 
not much reason to if you are happy with Q
 
@Luggage yeah, it works fine. Great, even
this is my first big project with typescript, knockout, and promises. learning a ton, you guys are helping :)
I'm kinda old school javascript, so promises are a breath of fresh air to GIANT CALLBACK TREES OF DEATH
 
12:40 AM
indeed
 
I'm mainly a C# programmer, and we've had delegates at least for a decade, lol
 
@AdityaVikasDevarapalli works for me: jsbin.com/zejadovugo/1/edit?js,console
Codeman, and now Func<> ?
shit, i forget.
 
12:56 AM
@Luggage usually Task
393
Q: Func vs. Action vs. Predicate

InfoLearnerWith real examples and their use, can someone please help me understand: When do we need Func delegate? When do we need Action delegate? When do we need Predicates delegate?

remember delegate is a primitive in C#, also
(or close enough to a primitive to be considered one)
and now we have nifty stuff like lambdas too
 
@Codeman And lambda expressions
fancy-pants C#
 
yeah
old school delegates were easy enough to understand when you got them, but kind of a pain in the ass. anonymous functions are a lot better, I think
 
C# needs more monads now
 
do lambda expressions support multi-statements blocks, yet?
 
@KendallFrey tell me a story
 
1:09 AM
ohh, they do, Statement Lambdas.
 
1:20 AM
should I always end promise chains with .done? .then with no callback is functionally equivalent, right?
@KendallFrey I agree, if only for the fact that it'll help me understand monads
@Luggage yeah, they do:
 
only .then() is for real promises. .done() is an alias/shortcut for a .then().catch().
or jQuery deferred done, which has multiple arguments in the callback unlike normal promises
 
Enumerable.Range(1, 10).ForEach((num) => {
    num = num + 1;
    Console.WriteLine(num);
});
dumb example, I know, but it works
 
that's jsut a Action<T>. I' talking about Expression<Func<X, Y>> or Expression<Action<T>>
 
@Luggage not sure, I assume you could
 
you can, now. in previous versions of .net only single expression lambdas could be expressions
Expressions allow SQL generation and other fancy techniques.
 
anu
1:35 AM
hi all. let me jump right to why i joined chat.... I am working through Definitive Guide 6th Edition and in 3rd Chapter he talks about toFixed(), toPrecision() and toExponential() .
var N_a=6.023*100000000000000000000000; ///avogadro's number
console.log("avogadro's number printed fixed to 20 (max) decimal digits: "+N_a.toFixed(20));
/// toExponential() will convert a number to it's exponential notation
console.log("avogadro's number printed in exp(5) exponential notation: "+N_a.toExponential(5));
/// toPrecision() will convert a number to the passed precision
console.log("avogadro's number printed in max precision: "+N_a.toPrecision(21));
OUTPUT:
avogadro's number printed fixed to 20 (max) decimal digits: 6.022999999999999e+23
avogadro's number printed in exp(5) exponential notation: 6.02300e+23
avogadro's number printed in max precision: 6.02299999999999908774e+23
I thought toFixed would never show in exponential notation ...
but apparently it does if the requested decimal is greater than it's max ?
or is it just the Node.js implementation that works like this ?
 
I can never tell if my coworkers hate me or if they're just socially awkward engineers who stare at the ground when they walk past me in the hall
 
nope, still no multi-line lambda expressions: dotnetfiddle.net/aPiRrH
sorry, don't know anu.
 
anu
that's alright. thanks luggage.
 
@SterlingArcher Once upon a time, there was a little girl.
She loved to sing very much.
Her name was Rebecca
Once she sang a song about her favourite day of the week.
She was very proud of her song.
She gave it to the internet.
 
@Luggage a heap ?
 
1:47 AM
The internet was not happy.
 
5 character long heap o_O
 
j/k :)
 
It said it didn't like her song.
 
@Luggage you made me waste 10 minutes in depression
 
Rebecca was very sad.
 
1:47 AM
:-|
 
@SterlingArcher You are like that little girl.
 
Did anybody convert a java swing UI to javascript web UI? Java allows multi-threading
 
Party and party and party
 
*partyin'
 
1:50 AM
Whatever brah!
 
@overexchange LEL
 
@SterlingArcher Any girl will tell you that "whatever bra" isn't good enough.
 
@overexchange webworkers
 
1:51 AM
lol
 
whew, I finally got the 'i' key in vim-adventures.com
 
anu
be me
search for "come at me bra"
was more disappointed than my parents with my life decisions :\
 
What does it mean when a site lists their products online, but don't have an order form? I mean, say I want to buy one...
 
anu
pre-preorder ?
 
duke nuken forever?
 
1:58 AM
@anu nah
 
anu
@Luggage sounds about right
i mean apple does it almost every time ... i don't get why they do it. they list their "next generation product" for a couple of days and only allow you to order starting end of week.
 
@KendallFrey either "You can't afford it" or "it's not for sale [yet]"
 
mrnging
 
The thing is, I could afford a product that contains the part I want to buy
So it can't be too expensive
Probably too expensive for me to want to buy it though :(
 
2:13 AM
mmm gyro
 
1 message moved to Trash can
@Shniper 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 or pastie.org
 
why didnt it format
 
1 message moved to Trash can
@Shniper 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 or pastie.org
 
I hit ctrl+k
Hi I'm learning blast.js could anyone tell me whats wrong with this code?
http://hastebin.com/puruduzaka.vhdl
 
@Shniper LOW ENERGY COMMENT, THE WALL JUST GOT 10 FEET HIGHER
 
2:20 AM
what?
 
i thought node.js was like a compiler or something
 
this is the weird part of the night, I'm leaving
 
i don't know
i compiled a chat bot in the command line with node.js for an alicebot
that's all
she started talking about her boyfriend or something, then i like gave her my credentials and she started acting weird
 
Shniper is a spy
 
I thought these chats were for helping people and talking about the category of the room. Clearly I was mistaken
 
2:34 AM
@GettingNifty wat
@Shniper I don't know what blast.js is, so I cannot help you.
 
anu
wat's blast.js ?
i'd recommend also trying to post on their github page if you can't find an answer here
 
idk Jake weary either
 
Well it's for an assignment due tomorrow and I doubt they'd get back to me that quickly. That's why I posted here, because I'm not going to post a "fix my code" post on SO
 
You sure there are no syntax errors?
 
ran it through jshint nothing came up
 
2:39 AM
What is the expected output? And how is the result you're getting different from it.
It'll be easier to help if you make an MCVE
 
generateValueClass is supposed to divide something into classes based on the delimiter, since the delimiter is 'word' it should create two classes based on the two words in my html files h1, "Surviving" and "Earth". It creates these classes in this format "blast-word-yourword"
in my example my words are Hello World though
 
Ah, so it's like Lettering.js
 
similar yes, but it's more animation oriented
 
The code you gave me doesn't have your markup
 
what do you mean
 
2:50 AM
The HTML code
 
plz stop using hastebin. It doesn't let you view the output
 
thats one of the things Caprica Six said to use..... I'd use jsfiddle but I don't know how to link blast.js to it
 
Really wtf Cap? jsfiddle.net is better
 
2:54 AM
@Shniper You can add external resources
Or better, use jsbin
It shows the console output
 
Yes jsbin codepen.io/pen & jsfiddle.net are all better
 
anu
look at codepen.io/julianshapiro/pen/kIJHe ... the guy who created blast.js used it to create all his demos.
simply fork that guy's pen and work on that
 
That's what I did @anu but he has nothing where he makes two words in the same element animate differently, which is what I am trying to do
 
anu
what about this ?codepen.io/anon/pen/BKYPjL
two words. two animations.
 
3:00 AM
it.. works
OH GOD I HAVE JAVASCRIPT DISABLED
 
@William seems like an easy thing to PR
 
anu
@littlepootis what is this 1998 ?
 
I wasn't even born in 1998
 
I was 4
 
anu
man am i old
 
3:08 AM
how old are you?
 
3
 
hmm...I say B.S.
 
morning
 
there are no uppercases in the blast.js class. So literally the only reason my code wasn't working is because I had .blast-word-Surviving instead of .blast-word-surviving....
 
@William asking somebody personal information is considered a little offensive.
 
@Abhishrek how old are you
 
@Meredith Over 9000!
well actually less than 9000 days though, darn :(
 
yeah 10000 days is 27 years
thanks tool
 
sweet I'll be 10000 days old on Nov 17th
 
anu
3:41 AM
william he ndugger meant decades
i m 2.5
 
> You are 9028 days old.
Which is 1289 weeks and 5 days.

That's 24 years and 262 days, including 7 leap days,
or 24 years, 37 weeks and 3 days.

In other words, that's 296.58 months.
Therefore, you are 24.72 years old.

You were born on a Wednesday, your last birthday was a Friday
and your next one will be on a Sunday.
 
you old
 
@anu or he could have meant 4^3
 
dugger is 64?
 
3:56 AM
He's 42
 
4:14 AM
@littlepootis twitter.com/hashtag/… dafuk
 
@Abhishrek lol, it's trending because everyone's confused why it's trending and keep mentioning it
 
@littlepootis making us look like a country where the masses aren't happy with the government.
perfect
 
All python libs be like, "u wan some docs? fu lol"
 
4:34 AM
@AwalGarg um, I have read extensive documentation on pretty much all python libs I have used
in some cases insanely well made tutorials too
 
morning
sup @SterlingArcher
sup meredith and lil pootie tang
 
user2620028
 
hey @HatterisMad
 
user2620028
hey @taco
 
.
 
4:46 AM
@taco you forgot me :(
 
user2620028
.
 
no i didn't :<
 
user2620028
whats up holmes
 
@HatterisMad not me just google abhishek hingnikar thats me
 
nada, just working
 
user2620028
4:47 AM
 
@HatterisMad lol
!!abhishekpornfreak
 
Jan 21 '14 at 16:46, by Abhishek Hingnikar
they love there work like i love p***. maybe i should do a p*** site !
 
^ There, happy ?
 
user2620028
i believe i was there for that
 
Your point still eludes me
 
user2620028
4:51 AM
must have been lurking that day
 
user2620028
i have a point?
 
Anyone know whats the best way to get a range of cells (horizontal or vertical) in a 2d matrix?
 
if this was c. hehehe
but since its not meh you will have to clone the full ones and slice the half ones
and then use [].concat
to merge them all
more along the lines of
`[].concat([arr[y1].slice(x1), arr[y1 + 1 -> y2 - 1 ], arr[y].slice(0, x2)])`
 
okay, whats the easiest way to create a square matrix so I can test this...
nev mind that...will figure it out...
 
5:05 AM
//untested
function* range(min, max){for(let x=min; x<=max; x++) yield x}
 
@JanDvorak while (min <= max) yield min++;
 
If you want to minify it, use n and x :-D
 
That trick is way too old now.
@JanDvorak good thing you rejected @AaronGillion's edit :)
 
Aw thanks guys
 
@AwalGarg be sure to do so as well ;-)
 
5:16 AM
just did
 
@AaronGillion I suggest you post your own answer
 
@Mr_Green no! that question needs to die
 
that answer itself is laughable. "use websockets to serve javascript files [...] it's very very very difficult for anyone to see your code, since it simply does not have a 'source' available / visible"
 
@Mr_Green Except I would be copying everything he said
 
@AwalGarg he has a point. Eval'ed code doesn't show in the sources tab
 
5:20 AM
@JanDvorak I can inspect the source on network level anyways. And in one single line I can hijack global eval to break before evaluation. And every debugger has an eval hook since over an year.
 
@AaronGillion just say. "Adding more to this answer" and post it. but here users are suggesting that post need to die. IDK
 
eval hook? Educate me.
@Mr_Green It's a recommendation question!!!
 
I don't see how it is mis-guiding or something
 
@ton.yeung Got a response, he doesn't have a framework for BADD
 
@JanDvorak for instance, in chrome devtools, you can add a breakpoint Script First Statement which breaks the debugger before any script is evaluated.
 
5:22 AM
I agree it is off-topic but at that time it wasn't. and deleting old posts just because of new rules I don't think that is good.
 
@Mr_Green ... and people like Aaron shoving us yet another free obfuscator is exactly what we don't want.
@Mr_Green I didn't say delete. I said close. I meant ASAP.
 
And FWIW, @Abhishrek said evaled code does show in sources in Edge. I guess it will eventually come to other browsers as well.
 
ok I got it.
Someone should post answer on that post I think. the correct answer
 
@Mr_Green Don't. Touch. That. Thing. Unless you are willing to close it, don't touch it.
 
but..
it is misguiding right?
 
5:25 AM
What kind of answer would you post?
Also, "misguiding" is a fine reason to delete a closed question.
 
I will not. I don't have idea about that topic. AFAIK, the answers there are mis-guiding. Someone should say that it should not be handle like that
 
... ???
 
Honestly, don't know why Mozilla/Chrome haven't implemented a way to run JS securely. I agree on closing the question, but not removing it.
 
nvm leave it
I agree on closing too but not deleting.
 
We should just close Stackoverflow itself and return to the 80s.
 
5:29 AM
@AwalGarg but you weren't around then
 
@SomeKittens right, so I can experience what you old people experienced then :-P
 
@AaronGillion uh, what
@AwalGarg p.s. I wasn't around in the 80s
 
yeah but you are still oooooollldd :D
 
@AaronGillion "Hand over complete control of code to someone" and "run securely" as a venn diagram gives you two separate circles.
 
Depends on what you are handing them complete control over.
 
5:32 AM
@JanDvorak if you've got a solution, then the DRM problem is solved.
 
@SomeKittens That's the entire problem.
 
Jan probably means shifting all logic to the server.
 
... no.
I'm saying they can't infect your computer just because you let them do anything in a sandbox
 
ahh, the "control" part
 
I'll bet dollars to doughnuts the OP on the question is trying to defend some stupid jQuery app
@JanDvorak oh, you're thinking about a separate but similar problem.
I, as the programmer, hand code over to a user. There's no way to ensure the code A) Runs as expected and B) is 'secure'
 
5:35 AM
@SomeKittens people "hand over" .exe and .app files to "clients" all the time, why can't we decode those?
 
it's just a lot easier with the modern web.
@AaronGillion Go google 'decompilers'
 
@AaronGillion we can. It's just pain to read 30000 lines of assembly written by a computer
 
LOL have fun!
 
@JanDvorak Interviewed with a company that decompiled apps to sell the SDKs they used as competitive data to SDK providers
 
@SomeKittens That's illegal
 
5:37 AM
Sounded awesome, great opportunity but the other offer was Netflix.
@JanDvorak in what country?
 
In every program's EULA
They can even smack you for decompiling it.
 
huh, never thought to ask them about that
they were profitable & worked with Google/Apple, so obviously they've found some solution.
 
5:51 AM
@sireeshaj hi
 

« first day (2005 days earlier)      last day (2943 days later) »