« first day (3216 days earlier)      last day (1746 days later) » 

1:25 AM
posted on August 01, 2019 by Scott Hanselman

I love me some text mode. ASCII, ANSI, VT100. Keep your 3D accelerated ray traced graphics and give me a lovely emoji-based progress bar. Miguel has a nice thing called Gui.cs and I bumped into it in an unexpected and lovely place. There are hundreds of great .NET Global Tools that you can install to make your development lifecycle smoother, and I was installing Martin Björkström's lovely "dot

 
 
3 hours later…
4:19 AM
Will mongodb give me a nice start
They start with connect to database instead of create database. While the starter are begins with zero, this make no sense
 
 
2 hours later…
6:13 AM
Goooood moorniiiiing CeeeeeShaaaaaarp!! Have you started usign any new frameworks or tech stacks lately?
@nyconing What starts with zero now? indexes? Sounds logical.
 
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' pleberinos!
@Squirrelkiller Actually yes, I've started doing stuff in Angular like yesterday
 
Noice
Working on an existing project, or building something completely new?
 
good morning guys and gals
 
@Squirrelkiller Following a Tutorial for starters, it's not work related :D
 
Ah I see. Definitely good for building web apps, maybe you can build a frontend for our teambuilder :D
 
6:27 AM
@Squirrelkiller I'm using puppeteer now. That's new~ish I guess
 
Angular's component, module, router, service, pipe and ts's this.variable are driving me crazy
 
Hey TS is awesome, it's basically C# but as a script
It's difficult to get into the architecture though, definitely
 
TS is more like Java
 
"How components and modules work together?" "I donno , Im copied from blizstack"
 
But the symbol is blue!
lol
 
Rob
6:31 AM
TS is definitely nice, but it's too easy to start trusting it completely to pick up typing errors
For example, it won't say a word if you pass an any type into a function requiring, say, a string
 
or execute an any type as a function
or really do anything with the any type XD
THat shit is dangerous
Wanna "cast" one type to another but the analyzer complains? as any.
Wanna pass a whole function instead of jsut a filter string because you're the one evaluating it anyway and you know whats in there? as any.
Worlds better than JS though
 
haha yeah
 
Rob
The typing system is pretty cool, but sometimes it falls flat for seemingly common cases. For example: chat.stackoverflow.com/transcript/message/46488134#46488134
You can do some magic to restrict it for the callers, but the function itself doesn't recognize the restriction
 
is it possible to define a valuetuple field in a class?
like public ValueTuple foo, which I can then assign any kind of tuple?
 
@Rob same goes for dynamic brah
 
6:40 AM
I...think you have to tell it what kind of ValueTuple it is
Although if it's always the same per instance, you could make it generic
 
well its going to be a tuple of ints
but with a varying amount of em
tbh I could just put an int[] there but I think the tuple looks cleaner
might be my python speaking though
 
Or a List<int>
 
Rob
@Squirrelintraining True, but dynamic is far more rare than any
 
But that's because dynamic comes from somewhere else. In C#, you start statically typed. In typescript you do too, but many people come from javascript.
 
@Rob Cuz JS devs are not afraid of the great unknown I guess
 
6:47 AM
So in TS the threshold to use a dynamic type is way lower
 
yeah, in js you never really think about types
 
ohayou
 
7:09 AM
/o squirrel
 
\o\ guyzzz
 
7:55 AM
@Squirrelkiller I love TS. I very much prefer NodeJS+TS over C# nowadays. :-)
Puppeteer is definitely awesome if you need to do some Web UI automation
 
Please, call me Mr. Trainerino :)
 
how about... Kotlin for web development?
:p
 
I never tried it for front-end WebUI, might be nice.
 
o/
AHOY LAND LUBBERS
 
I feel like kotlin is the new typescript
there are a few differences tho
kotlin has interop with JS, but its much more difficult than with typescript
but afaik, that is mostly because typescript isnt as strict as kotlin
 
7:59 AM
More importantly, does it support all the community typings for existing JS frameworks?
 
another difference is that typescript still has certain interesting features
such as union types
@RoelvanUden you can port TS typing to Kotlin
 
Meaning I have to do it myself?
 
there is a tool that does that for you
 
Can't it just pull types from npm and run for you?
 
I dont use npm tho...
I am not sure
I suppose you can add the feature to read d.ts files from a remote server
and I suppose you can also add the feature to read d.ts files from an npm package
would make it more interesting
 
8:12 AM
It sounds like too much effort for something that critical :-)
 
I havent used it that often tho
but the only library I really used was react
kotlin by itself is pretty damn rich in its base lib
 
morn
 
no need for stuff like lodash etc
 
tf @MikeTheLiar why are you up
 
he took one too many blue pills
his wife loved it tho
 
8:19 AM
wot
 
looking at typescript
can anyone explain downcasting to me in TS?
for (let current in someObjects) {
    if (current instanceof Movie) {
        console.log(`Movie: '${movie.name}', ` +
            `dir. ${movie.director}`);
    }
}
> if (current instanceof Movie) {
does this create a local variable with the camelCase name of the type?
I dont understand where "movie" comes from
 
@Harry lolol
nasty roach
 
lmao
 
@Wietlol isn't that if statement checking if the value of your current variable is a Movie?
oh shit
wait
wtf
wot
 
does that even compile?
 
8:22 AM
its from an example...
I cant be arsed to actually get TS to run on my machine to try it
but it looks weird
 
C# would use the syntax
if (current instanceof Movie movie)
 
I guess it's just a typo
 
it would be interesting tho
how many times do you write this in C#?
if (x is MyClass myClass)
 
8:24 AM
hmm I wrote this like 3 times in two years or so
 
it'd be if(x is MyClass)
 
Rob
@Wietlol Nope. Movie is a class. Inside the block, current will be typed as Movie
 
oh mkai
 
Q_Q
 
11
A: Type Checking: typeof, GetType, or is?

JoelCIf you're using C# 7, then it is time for an update to Andrew Hare's great answer. Pattern matching has introduced a nice shortcut that gives us a typed variable within the context of the if statement, without requiring a separate declaration/cast and check: if (obj1 is int integerValue) { i...

That has an example in it similar to yours @Wietlol
 
Rob
8:26 AM
So yes, it's the same as if (x is Movie), except C# doesn't automatically narrow the type in the true block
Hence why you need a new variable in C#
 
ok
another day with intelliJ
lets see
 
oh boi, a headache
This day just keeps getting better D:
 
bruh
how
 
8:28 AM
@Rob actually, this is pretty straight forward
 
I am not really familiar with TS, but considering it is all JS in the back-end, there isnt much need for a special cast
does casting even exist in JS?
 
Rob
Nope
 
does it exist in TS tho?
 
Rob
Casting in typescript is just to make the compiler happy
It compiles to nothing
 
8:29 AM
@Wietlol yes
 
Rob
instance of is actual javascript, though
 
as in, it throws an error when it is not the correct type
 
Rob
Nope
 
ew
 
using the awesome <any>x syntax
 
Rob
8:30 AM
That'd be super difficult to implement. Especially with typescript's interfaces, which are very different from C#'s interfaces
 
why so?
isinstance should be equally difficult as a throwing cast
 
Rob
That's one case of casting
 
there are more?
 
Rob
You can define an interface, where every object automatically implements it if it fulfills the contract, even anonymous objects
 
ah
 
Rob
8:31 AM
That includes functions with particular argument types. No way to check that function exists as specified via javascript
 
but does instanceof do that check too?
what I would expect from a cast is something like this
 
Rob
There aren't interfaces in javascript
instanceof checks that your object is an instance of the class
It's not a cast, it's just a function which returns true or false
 
fun cast(it, type) {
    if (it instanceof type)
        return it
    else
        throw new Error("...")
}
 
Rob
typescript special cases it, and narrows the scope inside a true block
 
I think it would be a bad idea to make casts and instanceof checks have a different condition
 
Rob
8:34 AM
They're entirely different concepts
 
(ignoring reuse of syntax such as the (explicit) cast operator in C#)
 
Rob
At least in my experience, very little coding is done with classes/prototypes. You type things via interfaces
 
as do I
 
Rob
Anyway, you shouldn't view it as a traditional cast. It's a compiler hint at best
 
I suppose I shouldnt try to understand JS
or TS for that matter
 
Rob
8:36 AM
Give it a go, but just don't approach it from a C# point of view
 
I have a fine alternative tho
perhaps soon another
depending on how fast I start doing wasm
 
9:08 AM
That's because of union types. If you have a type that can be number | string, you don't know what you can call on it. So if you make an if statement goingif (typeof myvariable === 'string') then that block knows it's a string, and the else block knows it's not a string (and thus a number). That's type narrowing.
The same applies for instanceof or checking properties etc.
 
Morning "friends"
 
Hi "Captain"
 
union types are pretty damn powerful
last week, I implemented optional types in my language using an anyof union type
@AlternateSyntax("typeReference '?'")
typealias Optional<T> = T | Unit
Unit is a global singleton that represents nothing basically
(in other words... null)
 
I mean, you could just use null or undefined
 
and using this, you can use String? or String | Unit or Optional<String> which is just the union of a string or a unit
@Squirrelkiller in my language, null doesnt exist
and undefined isnt even a valid word
I think I will remove undefined from the language as a syntax error
 
9:20 AM
Also you can declare any variable as `name: string | undefined'
 
Morning "squirrels"
 
Morning "Hans"
 
touche
we are all pretenders it seems
 
Everyone wears their own mask
 
true
 
9:21 AM
You can also write guard functions in TypeScript FWIW. For example, function isString<T>(value: T): T is string { return typeof value === 'string'; } and now you got a very simple guard function that just guards for something being a string. You can make these as complex as you so desire.
 
I dont wear a mask
I wear a face to hide my true mask
 
Next level masking
 
@RoelvanUden my language calls them execution contracts
they are quite complex and have many options
they are inferred from the code you write
 
you wear a Lion face to hide your mask ?
 
9:23 AM
how did you get hold of that Lion face
 
@Hans1984 the face I wear is made of flames
the mask I hide is the lion
 
oh, ok
 
Like a duck hiding its beak
 
@RoelvanUden ONE PUUUUUUNCH
 
@Squirrelintraining Definitely a funny series. :-)
 
9:31 AM
Yeah, my wife finished the 2nd season without me :<
 
too much dota 2 @Squirrelintraining
 
Nah
she just a junky
And student
 
@Squirrelintraining Season 2 wasn't that great, so you didn't miss all that much tbf.
 
I found it funny, but a bit repetitive after a while
 
@RoelvanUden ya, she complained that the drawing is way better in season 1 (we rewatched it since)
 
9:36 AM
Yeah. Studios changed for S2. It's definitely noticeable and of poorer quality. There isn't much going on in terms of story either, and Saitama is mostly off doing random things or not appearing at all for 2-3 episodes at a time.
Of course, if he shows up, the fight is over... so I get it. Still, it's a bit boring to be watching "One Punch Man" without seeing the guy after whom it was named for multiple eps
 
9:48 AM
So how do I find out, if, in our giant web app, there is a <select> element somewhere that doesn't have the form-group class?
 
find-all
 
.......................MUFFINS ATTACK
hey there
 
find all select elements? It says "1361 results in 326 files". I can ignore like 50 files becuase they are js/cs files. That leaves too many to check manually.
 
where are my Muffins ?
Q_Q
what do you mean we have no Muffins ???
 
there are no muffins
cri
 
9:55 AM
Or maybe I just widen the css selector to include select and see if anyone cries.
 
@Squirrelkiller is the class always the first element?
first attribute of the select node?
 
Oh my god it's been so long since I built Xamarin forms app
 
Nope, class is anywhere
 
and can you search by regex?
 
sometimes in the same line, sometimes not
Why would you even ask that
 
9:58 AM
<select(?:\s+[^=]+="[^"]*")*\s+class="([^f"]|f[^o]|fo[^r]|for[^m]|form[^-]|form-[^g]|)+"
 

« first day (3216 days earlier)      last day (1746 days later) »