« first day (2732 days earlier)      last day (2208 days later) » 

12:52 AM
fuck, i just messed up 5 hours of printing
 
1:33 AM
hey guys...
is there any way to remove unnecessary white space from textarea with js?
var lib_name = prompt("Type the lib name:");
	$("#command_list").append(`
		<li>
			<div class="bloco-visual">
				#include &lt;${lib_name}&gt;
			</div>
			<div class="bloco-codigo">
				#include &lt;${lib_name}&gt;
			</div>
		</li>\n`
	);
this code is appending this html to a textarea
but the text looks like this...
#include

#include <stdio.h>

#include <stdlib.h>
very separated lines
and with lots of tabs
 
2:29 AM
Has anyone read tutorials in javascript.info?
How are they?
Are they accurate, I am finding their tutorial very good, but want to confirm that they teaches best practices and provide authentic details
 
 
3 hours later…
5:39 AM
Mailgun ultimately took a proper look at my issue and was able to resolve it ad give me the details on why the issue happened in the first place
So all is good again
 
6:22 AM
did they saw your complaints here? :o
 
@HenriqueHBR Uh, that's not javascript
you mean you're trying to show C++ code on a webpage?
you need put contents of textarea under CDATA escaper
or the < and > will cause only confusion to the browser
 
6:46 AM
hello
 
\o
 
yo/
 
ha. they are checking the request headers
 
how does angular know what services to pass through the constructor of a module?
you often see this kind of code:
import { SomeService } from './some.service.ts';

...

export class SomeComponent {
  constructor(public someService: SomeService) { }
}
 
are you saying that angular does some magic?
 
6:57 AM
I get that someService will now be a property of the class because of the public, but I don't understand how angular knows to pass an instance of the service to the constructor
@KarelG it does a lot of it, but in the end it's just js/ts... right?
or is it doing some kind of file-parsing to determine this?
if so, I'm so pissed
 
@towc Granted, I don't know how it works
But I presume the class getting exported is going to have its constructor called
the link is that. if you didn't export the class, it wouldn't be called
 
I would have thought that actually by doing something like public someService: SomeService, if it's not passed, it will generate a new instance of the service
but that kind of fucks services up, as the classes are meant to be shared
and this errors out:
class X {
  public y: number = 10;
  constructor() {
    console.log(1);
    this.y += 10;
  }
}

class Z {
  constructor(public x: X) {
    console.log(x);
  }
}

console.log(new Z())
on the last line
 
then maybe internally, it'll instantiate a new instance only if it hasn't already been done
I assume
 
@towc did I just witness
 
@Neil managed by the @Injectable? Maybe
 
7:00 AM
you writing TS?
 
@towc In that case I suppose it would be somewhat magic ;)
 
holy fucking motorcycles it has happened
 
@KamilSolecki I'm not enjoying it
 
TS is bad :-<
 
anyway, can you help out?
 
7:01 AM
@Ikari why?
 
The more I try to understand how the type system works in it, I get more confused
 
does TS provide some sort of way to find out which classes/interfaces are being used as parameters of, for example, a constructor, programmatically? Within the ts itself?
 
I think that angular precompiles typescript modules into javascript ones and handles the rest of project as javascript codebase
 
@Ikari How come? It's quite a straightforward system.
 
I mean, this thing works and it's actually quite handy, but it bugs me that I can't think of how it would behind the curtains
 
7:03 AM
typescript has a major disadvantage: boilerplate. But that does not outweigh the advantages it offers
 
well, admittedly I haven't really spent much time trying to understand it; guess I should give it another shot.
 
still, I am a peasant in TS. Madara is more skilled with that language
 
Is it possible to get a js variable like "var code" into my html/php href link to another page , something like this "href='view.php?view=$row[Com_ID]" , only $row[Com_ID] replaced with the js variable?
 
@towc Why would it do that? TypeScript doesn't come with a built in DI container
Just like Babel doesn't.
 
I use TS quite extensively. It's a beautiful little enhancement over JS. The recent 2.7 and 2.8 really added some amazing strictness features.
 
7:05 AM
@RoelvanUden 2.8 and ReturnType<T> is huge
 
oooo nen 'ollander (poor monday joke)
 
@MadaraUchiha it was a guess as to what was happening
 
oh it's monday again. cries in corner
 
@MadaraUchiha Hm? Not sure what you're referring to.
 
I can see how the @Injectable decorator could help with DI, but still not how angular knows to pass that into the component
 
7:06 AM
function foo() {
  return 42;
}

type T0 = ReturnType<typeof foo>; // number
@RoelvanUden ^
 
is there a trigger that happens when you import the service? It shouldn't happen
 
Before 2.8, you'd have to do something like this to actually get the return type
 
Ohhhhhhhh that's a thing? That's quite cool!
 
@MadaraUchiha does it work with API codes?
 
is there a TS trigger that happens when you use the class as an interface? That seems weird and unelegant
 
7:06 AM
function foo() {
  return 42;
}

const _temp = foo();

type T0 = typeof _temp;
@KarelG What do you mean?
@towc What are you trying to do?
 
I haven't had much need to get return types of functions as type, but I can see it can be useful at times.
 
@MadaraUchiha figure out some angular magic
 
@towc If you're looking for DI, that has to be a runtime thing
 
@MadaraUchiha like google maps, that returns with a lat/long object for position. You use that ReturnType (with a helper?) and gives you a GeoLocation type.
 
Not a compile time thing.
 
7:07 AM
13 mins ago, by towc
how does angular know what services to pass through the constructor of a module?
 
GeoLocation is defined by myself in my TS project
 
but types are lost at runtime :/
 
@KarelG If the function returns a GeoLocation named type (or interface), that's what ReturnType would give you.
@towc look for reflect-metadata
 
how do you mean with that? The google maps API does not return with a type, only {lat: ... , lon: ... }
if it eventually manages to convert that to the GeoLocation type, then it has to keep a list type definitions I think
 
@KarelG TypeScript has a system in place for adding types retroactively for libraries that were written in JS
 
7:09 AM
to see if that object fits a given type
 
The @types/ namespace in npm and the DefinitelyTyped repo
 
* checks DefinitelyTyped *
 
I'm almost sure that the google maps SDK has something like @types/google-maps or something like that, that gives it types and allows you to use it with type-safety in TypeScript
 
Yeah. Google maps? npm i @types/googlemaps
 
@RoelvanUden Right
 
7:11 AM
@MadaraUchiha huh, intriguing
 
I use those too :-P
 
And that definition file will have defined types for the various functions and methods you can use
@RoelvanUden For like 80% of the cases it's amazing
But for the more niche libraries, it's either not there (which is no biggy, just add any) or lying (which is a bigger bummer)
 
Indeed. But if you use the more popular ones, e.g. React ReactDOM Mobx Moment Googlemaps, that kind of stuff, it's all there.
Hell, some of those ship with their own typings
 
@RoelvanUden Yup
Stuff written with TypeScript have the option to outputting .d.ts files along with the output files
That makes it relatively easy.
 
7:48 AM
If anyone is using Travis-CI, rotate your secrets
3
 
@MadaraUchiha you can also deal with the jsdoc, which would be a nice PR for TypeWiz btw
 
@BenFortune huh, that's pretty old
hadn't seen it before though
 
> It took us a day to uncover the root cause of the original database truncation. ... The shell the tests ran in unknowingly had a DATABASE_URL environment variable set as our production database. It was an old terminal window in a tmux session that had been used for inspecting production data many days before. The developer returned to this window and executed the test suite with the DATABASE_URL still set.
 
@towc Just a friendly reminder, hadn't seen it either
 
oh from 3 april?
did not have noticed something :P
 
7:56 AM
We do that shit in our own scripts
 
o/
 
Problem waiting to happen, no doubt
 
I am dynamically adding a div to a page and it is not visible
although I can see it in inspect element and and when I try to inspect it I see the outlines, but the div itself is not visible
 
@SurajJain Well, is it inside a hidden container?
 
@Neil It is visible under all other pages
 
7:58 AM
@SurajJain That doesn't answer the question :P
 
I am adding that div through tampermonkey script that is running on all pages, and the div is visible on all other pages
No it is not inside hidden container
 
ok, well does it have content? Would you see it if it were visible?
 
in Python, 2 days ago, by Kevin M Granger
I'm sure this has been asked before, but why is it cooking.SE and not Snack Exchange?
 
@FlorianMargaine And eating disorders SE should be Snack Overflow Exchange
 
@Neil heh
 
8:01 AM
@SurajJain Ok, last question: Is the div you're adding itself hidden?
 
See I am able to inspect it, but it is not visble
 
I asked three questions.. one of them is not what you expect.. find out which.. there are only three possibilities :P
 
@Neil
It has content
@Neil Also div is not hidden itself
 
top: 2259.2 px;
Yeah, it's probably not where you think it is
 
@SurajJain Then the answer "Would you see it if it were visible?" is "no"
 
8:05 AM
Have you tried adding a z-index?
 
Actually it is there only, top is from the page top, and When I inspect it see the blue region it is present there
 
@SurajJain then maybe it's underneath another div? (aka set z-index to something really high)
 
It worked When I add z index
But on all other pages it was working fine without adding one
 
maybe this is the special page
 
@SurajJain Don't make assumptions. That'll kill your ability to debug
 
8:09 AM
but this can be a good learning experience
 
I don't care if it worked on every other page. It doesn't work for this one.
 
try to figure out why it does not work on this page, and does on the others
 
@Neil Thanks :)
 
@BenFortune lmao
 
@GNi33 Yeah, I am trying to figure out.
 
8:09 AM
@SurajJain no problem :)
 
@Neil Earlier why did you said 'Then the answer "Would you see it if it were visible?" is "no"'
 
@SurajJain Well I thought it could be an issue with top: 2259.2 px
 
what's some decent-sized open source angular project I can download, so I can test editors on it?
oh, nvm
 
the z-index property on the item which overlay my div was 1
and I did not specified any z index for my div
so it was auto
now in case of auto it inherit from parents, is it right??
 
@SurajJain No, auto means that its index is determined by its parent depth
an inner div is higher than an outer div
"inherit" will inherit the z-index from parents
though in all likelihood, you should leave it on auto if you don't have a particular reason for changing it
 
8:31 AM
morning
 
that it is
 
o/
 
8:57 AM
> a database query was accidentally run against our production database which truncated all tables
lol
People are the worst
 
someone got hell for that
 
9:10 AM
what if it was not accidentally?
 
@OliverSalzburg as long as the backups are working :P
 
> someone truncated our backups database
 
that does not sound very accidental anymore
 
> so we truncated the developer who did it
#devgore
 
i dont think you can truncate a backup
i suppose you have to remove them from wherever they are stored
 
9:17 AM
devnuke it ?
 
could still be accidental
Imagine the scenario when database is wiped and then filled in with test data
just apply to production environment instead of test environment
 
who screwed up their backups? was it gitlab?
 
one of our policies is to have a yearly backup of the system and store its info in a closet, in case if someone jeopardized our weekly and monthly backups
@GNi33 pinned msg (travis CI)
 
yeah, I know
 
@KarelG You are truly wise
 
9:19 AM
but there has been a case fairly recently where a company was not able to use their backups
 
just cautious
 
yeah, I just want to have some backups that is not connected
I even have a copy of those at my home.
 
at my old job, our systems administrator did a full backup to a tape and then put the tape into a fire-proof safe
a little old school, but it worked anyway
 
oddly enough, I never did backups of my personal projects
or other stuff non-work related.
 
Well there's nothing I've made for myself that I'd ever do more than commit to github
I doubt if github would lose it, but if so, no big loss
 
9:28 AM
@Zirak the ting is done
how would you like the database
also, 3 things I need to tell you
1. Oneboxes arent handled, and there is a superb informative message body instead in its place
 
@KamilSolecki does it go skrrrraaa?
 
@GNi33 sadly not
 
:(
 
Is there a font-awesome icon searcher/browser?
 
not interested
 
9:30 AM
2. Some messages have deleted users, and in that scenario (since I didn't have time to restructure the db) the userID is 69 (duh)
 
@paul23 fontello.com maybe?
 
like detexify.kirelabs.org/classify.html for latex math symbols
 
so you shouldn't care much about those, as the username that corresponds to that ID (69) will be overriden by the latest deleted user's username
but all the other info about them is all good
3. There is no no. 3
 
okay, what exactly is the ting?
 
9:32 AM
@KamilSolecki ( Í¡° ͜ʖ Í¡°)
 
I'm looking for the "opposite" of origin.fontawesome.com/icons/check -- to identify something "failed", have trouble finding the right search term failed doesn't find anything
 
thanks!
 
@KamilSolecki for good practice, you could have used 0 or -1 which is handled more easily at the application name. Then you can use "deleted user" or something like that when displaying user names.
it is a simple function:
 
@KarelG this was totally half assed
I would do it differently
simply have a userID nullable
but zirak asked me about it yesterday
 
9:43 AM
getmahusername() {
   return (id > 0 ? username : "deleted");
}
 
and I wanted to give it to him asap
 
@KarelG You should submit that to codecrap.com
 
hence I did not fiddle with it
 
@Neil if that is code crap for you then you did not have seen some veeerrrry nasty code I have seen so far.
 
@KarelG its not about usernames btw, you can still get them from transcript
 
9:45 AM
@KarelG Well just kidding (mostly). If you're using that for descriptive info for the user to see, it's still acceptable
 
even if users are deleted they are given that weird numerical username
but they has no id
 
did not know the context until that comment with Ziraks name
 
@Ikari And runs a hair under 5 seconds per call too
 
@Ikari I have seen way too many of these on the internets
 
9:46 AM
@Ikari missing support for ñ :P
 
encodedString = (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
 
o wait
 
much parens, such wow
 
Needs hindi character support too
I thought this one was pretty brilliant too
 
9:50 AM
@Ikari Has the added feature that it doubles as a function that'll strip "-" from anything passed in
abs("I-don't-like-dashes")
 
@Neil efficiency at its peak
 
Exactly. Two for the price of one.
 
also, if that is js, it won't work, since there is no g flag :B
 
var removeFirstDashFromString = abs;  // Done, baby!
multitasking genius!
 
why do my google skills suck?
 
9:56 AM
try googling
 
@Neil removeFirstDashFromString(-my-goodness)
gets mygoodness. Me sad
 
//lmgtfy why do my google skills suck?
 
@Wietlol no, no! Not like that!
 
"Why do my google search skills suck? Let me google to find out why.." *googles "waffles spice toaster"*
 
10:02 AM
why does AWS documentation suck?
why do i feel like a cswl?
 
2 days ago, by Ikari
because you touch yourself at night
 
@Neil halp me
 
they offer courses for aws
That tells me their investment in writing complete clear documentation is somewhat a conflict of interest
So good luck. That's how IBM does all their documentation. "Just throw it on some article page and someone will find it.. eventually"
 
im trying to set up an AWS CodePipeline... pipeline... and I want my action to be "create a new version of my lambda function"
and later stages to be "set the version of alias x to that version"
on the other hand, now that I think of it, it will pretty much overwrite any manual changes then
im not sure if this is a good approach
 
@OliverSalzburg ^--
 
10:14 AM
We don't use CodePipeline
AWS code offerings seemed poor compared to our established GitLab solutions
 
Do RXJS subscribe causes change detection in angular ?from my testing , I do see the value changed.... but it doesn't mentioned anywhere ( besides XHR , events and clicks) stackblitz.com/edit/angular-rvoxxd?file=app%2Fapp.component.ts
 
Morning ;)
 
morn
 
\o
 
Gentlemen, how do I "push" 2 objects (as they are) into 1 object (aka container)? I have been googling and most answers are about merging key:value , while I am after simple push type of thing for object.
 
10:19 AM
@OliverSalzburg what are code offerings?
 
@Wietlol Code-related AWS services
Like git hosting and code pipeline and whatnot
 
im not sure what those do, but I suppose that those are the API Gateway and CodePipeline (but then the gitlab versions)
 
No, API gateway is unrelated
 
^ slow as hell
 
10:24 AM
it's getting the HN hug right now I guess
 
Anyone knows how to fix this easy thing?
why is p undefined
 
a.filter. not foreach ^ @Mike
 
I know but actually I want to know how to capture return value from fromEach
The code I provided just a sample
 
it's not the role of foreach
 
okay Thanks @RoyiNamir but how do we capture the return value of forEach or does forEach not support that
 
why has js no compiler?
 
Thank You @BenFortune
 
10:45 AM
@Wietlol What's a compiler?
And why do you think JS doesn't have any?
 
if Mike had one, his code would never reach his website
a function with some code paths returning a value and some dont
how horrible is that?
@Neil wront chatroom?
 
@Wietlol That's just not true
 
wrong room :(
 
1. Compilers can allow for some code paths not returning and some others
 
but why?
 
10:47 AM
2. In most "compiled" languages, you can still return null, which is the exact same amount of "fuck you" as not returning at all.
 
not really
only if said language makes no difference between nullable and non-null types
like Java and C#
 
Which are the mainstream compiled languages
For better or worse
 
i rarely use plain Java any more
mostly kotlin and groovy
 
Accidentally rewrote the partition table of /dev/sda instead of /dev/sdb.
 
(only Java for school)
C# is trying to adapt and adding ? and ! all over the place
im not sure if that is an improvement though
 
10:51 AM
@Wietlol Java is slowly going down in the advent of Oracle's ridiculous lawsuit against Google and Google switching to Kotlin
Android was the only thing really keeping Java afloat
 
im not really following it
 
Used testdisk and tried to recover it. Accidentally recovered GPT table while I had an MBR table before.
 
And I do mean Java as the language, not the runtime or the environment
@Wietlol C# has NonNullable<T> though, doesn't it?
 
Tried to recover MBR again and it recovered a GPT partition (wtf?) spanning the whole disk.
 
Ah, next version
 
10:52 AM
@MadaraUchiha wot?
 
Now I deleted all the partitions, recovered MBR, and it doesn't boot. I can chroot into it.
What do I do
 
> NonNullable<T>
pls dont make me sick
 
The ideal is that NonNullable is the default, and you have Nullable<T> instead
 
or wait... is that "T!" ?
 
@Wietlol Yeah
Ideally, T would be just T, and T? or something would have been T | null
 
10:53 AM
it has Nullable<T> though
but T is bound to structs
and its api is pretty limited compared to null type stuff
like ?. and ??
 
@Wietlol Right, I mean things like Nullable<int>
No
I mean something like this
(ignore the syntax errors I'm bound to have, didn't use C# in forever)
public int orZero(Nullable<int> n) {
  if (n == null) { return 0; }
  return n;
}
And if I say I want int n, you can't pass null.
 
> public int
checks chat room name
 
Ah, ints can't be null anyway, damn you Java
But yeah, you get my point.
 
reads Java
 
Anything can be nullable, but by default isn't.
TypeScript has that feature
With the strict flag on, if I say I want number you can't give me null or undefined
I can say I want Nullable<number> though, and then you can
 
10:56 AM
@MadaraUchiha why java?
 
(Or number?)
@Wietlol Because this particular feature is from the time where C# copied Java
So, like Java, only reference types (objects, structs, etc) can be null
 
Dear God, I am retarded
 
kotlin has one very particular special case considering nullability
you know the Void type in Java?
 
C# should have one too (but i never needed it)
Kotlin has the same type, it is called Nothing
(same how Any is Object)
but Nothing has a very special property
Nothing cannot have instances
 
10:58 AM
Like never in TypeScript
(Only never isn't an actual class)
 
and since Nothing is nonnull (Nothing? is nullable), Nothing cannot have a value... like at all
Nothing x = ...;
this can never compile
 
Yeah, so the exact same semantics as TS's never.
 
independent of what you write in those dots
 
const x: never = ...; // always a compilation error
 
ow im an idiot
 

« first day (2732 days earlier)      last day (2208 days later) »