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

09:00
package delivery got broken up now. There is not only that company, but also DHL, freelance delivers, TNT and ect
I might have forgotten one but cannot recall its name
in Italy, when tv started becoming popular, the government made government-sponsored channels and they promised to never show commercials
Later, they started asking for a mandatory tax from all those who own a tv in order to cover costs..
The funny thing is, they started showing commercials anyway
So now you pay a tax to support government-sponsored tv without commercials, but they don't deliver on the promise
In fact it's almost a joke. They can't oblige you to pay if you don't own a tv, and since they can't just come in and check, pretty much nobody pays the tv tax
we have the same history with our national television service. They are focusing on their tasks though: bringing news and sport
@MadaraUchiha o/ on a scale of 1 to 10... how likely you'd make use of TS if you were presented a yuuuuge SPA spaghetti and kinda made responsible of it?
yet they have a historical advantage of watchers so that they can get/produce TV series cheapily to broadcast it
@Ekin 10
TypeScript can be gradually introduced.
But in terms of strictness and activating it on a per-file basis.
I'll retract that 10 for now. Tell me a bit more about the project.
Do you have a build step?
09:08
I think I need to strategize here...
On government sponsored tv here, you get shows where often there'll be pretty girls dressed up nicely which don't speak a word and just dance at the beginning or the end of the show
I'm looking at a result of ~10 developers who went in there not giving a single fluck apparently. For the sake of having soome structure someone started an angular 1.5.3 version of it on one side... and apparently he is leaving now :-P that already had a big Nope vote from me at the meeting.
Honestly I'm surprised there hasn't been some sort of formal protest
@Ekin You have my sympathies
It's really one of those yuuuge, click to load all the scripts over and over again kinda SPAs.
that sounds as a poor management.
the person responsible for the project has to handle it
09:11
in my experience, the company which produces a product like this is likely not going to let you dedicate the time necessary to refactor it
@Ekin Do you have a build step or a module system?
@MadaraUchiha Nope.
@Ekin What's the exposed public API?
The fact that it's yuge is making me kinda think 5 times before starting on anything.
Or is it all in one file?
09:12
The latter :-(
Interesting.
Tell you what, give this one a try
First, what's the output of npm -v?
6.2.0
that will be a tough transformation
npx tsc path-to-file.js --noEmit | wc -l
What's the output for that? (Might take a short while)
it's formatting your computer, don't run it!
09:16
This will try to just compile (without emitting code) and count the number of lines in the output (i.e., roughly how many errors)
j/k ^_^
Wait no
Now it wouldn't emit
brb
@Ekin Any luck?
so far it's been just 0
Interesting
That doesn't really make sense.
What's the output without | wc -l?
nothing but the time it took
09:24
Alright.... different tactic.
npm i -D typescript
npx tsc --init
Then enter the newly create tsconfig.json, and change "strict": true to "strict": false
How does your directory structure look like?
Or is it just the one file on the same level as the root directory?
hi
I have a very basic question to ask
I don't have friends
1 message moved to Trash can
@Breathing Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
I have a function
functionf1(){
f2();
f3();
f4();
}
they will be called asynchronously by default right?
@MadaraUchiha there are plenty of them in plenty of directories under root. I feel like this needs some cleaning though to be able to asses this way. I saw a good bunch of html files having over 700 loc script tags where you see almost all click events. Same thing only worse number of loc for backend files...
I noticed one part of the system has bundled files and a package.json whereas the actual user facing side has nothing but above
@MadaraUchiha with this I get 50 for one of the mid size files
@Ekin You said there was just the one file
09:36
@Breathing why would you assume that?
Because I see it happening
How are those files linked?
sometimes
JS doesn't have an autoloader. What references all those files, if you don't have a module bundler?
like inside f2() something big is happening
f3() shows first f2() shows up later
09:37
each synchronous call made to a function can perform an asynchronous action
but the way you wrote it, those 3 functions are called in order
say, them as
bindUser();
bindMembersip();
I see bindMembership() view loading first and after that bindUser() view()
they both involve getting data from the database
javascript works as an event driven mechanism
If you want bindMembership to follow bindUser, then the issue is not here
@MadaraUchiha sorry, maybe I failed to convey but the entire application loads the pages with ajax calls. There's a big app.js, a good bunch of js code seems to be within html, hence I thought it first of all needs some cleaning
it happens synchronously unless you are doing a task that happens asynchronously (=event)
09:40
Because you're calling them in proper order
You need to study first how an event driven mechanism works to comprehend it (something I think you don't )
If you want an action to follow an asynchronous event, you need to return a promise there
and follow up with a .then
@KarelG Where can I see the list of all tasks that happen asynchronously? I know a few intuitively
ok
@Ekin What I would do as a first stage is create an entry file and imports all the other files in order, and add a build step without TypeScript
09:42
@Neil I can use call back as well?
like f2(f3)
@Breathing good rule of thumb is anything involving promises or callbacks should be considered async
it means the operation isn't going to be "done" after the call finishes
I can do f2(f3){
//call f3() <- that is one solution, right?
}
it may not be, but if you treat it like an async operation, you can't go wrong
no, that's a function which calls another function synchronously
take this example.. suppose you have a function A which is asynchronous. You want to write function F which calls B after A
if you write it as:
function F() {
    A();
    B();
}
you get into trouble
Because the call of A returns immediately, but the operation isn't done, right?
you need some sort of hook here.. it isn't enough to be on the line to call function B. You need a callback or promise of some sort
So one possibility is to call A, and in A, return a promise
09:46
I can do fA(fB){
//call fB() <- that is not a solution!?
}
I thought this is how callback works
Yes, that's a callback
and yes, this may be a solution..
I say may because it depends
the callback needs to be called only when you know the operation is complete
If you simply call the callback at the end of function A, it's no better than calling that same callback on the line following the call to function A
yeah
so I add it at the end
@MadaraUchiha I feel like there's possibly plenty that can be removed also. It's just too spreaded everywhere right now. I guess TS needs to wait then. The fact that they have given plenty of time made me want to get started at it, but oh well..
@Breathing no. I'm not explaining myself very well
^lol tell me about it
09:49
the async operation will have a callback or will return a promise
@Breathing History lesson time
That callback and/or promise is your link to performing operations afterwards
and you shouldn't bury them
console.log(1);
maybeAsyncMaybeNot(function() { console.log(2); });
console.log(3);
return promises, or pass callbacks along to the async call
@Breathing What's the order of the logs here?
09:51
that I wrote before
functionf1(){f2();f3();f4();}
lol
sorry
What do you think is the order, in my case?
that's a bit advance syntax
for me
see that as
I am sorry
console.log(1);
maybeAsyncMaybeNot(function() {console.log(2)});
console.log(3);
09:52
How about now?
NO ANIME NINJAA MAADAARRAAAA :P
gotcha hide for a moment you come up with something from anime
each synchronous call made to a function can perform an asynchronous action
1
3
2
if asynch
if sync
then
1
2
3
09:54
@Breathing That is correct. You can't know, without looking at how maybeAsyncMaybeNot is implemented.
that's what I know
yeah
Which is the reason that Promises .then() is always called asynchronously
console.log(1);
// Promise.resolve actually resolves synchronously. It returns an already fulfilled Promise.
Promise.resolve().then(function() { console.log(2); });
console.log(3);
This always logs 1, 3, 2.
Callbacks are also problematic in other ways. If you want to ensure that one function is called after the other, you need to nest callbacks, which is not fun.
async1(function(res1) {
  async2(function(res2) {
    async3(function(res3) {
      console.log(res1, res2, res3);
    });
  });
});
This is when async 1 through 3 is implemented with callbacks as the means to know when the operation is completed.
A callback-based async function can be implemented like so:
Without closure that is a practical nighmare
09:59
the so-called "callback hell" which motivated the reason behind the creation of the promises to begin with
function readLines(callback) {
  fs.readFile('whatever', 'utf8', function(contents) {
    callback(contents.split('\n'));
  });
}
You accept a callback as a parameter, and just call it whenever the operation is completed, with whatever result you have.
There are a few problems with callbacks when used like this.
10:00
async function readLines() {
  return (await fs.readFile('whatever', 'utf8')).split("\n");
}
Notice how I don't return anything
Handling errors is awkward too
function() {
    async1();
    async2();
    async3();
}
what you're doing now is this
no callbacks, no way of knowing when the operations finish
I simplified the example, but most callbacks in node actually give two parameters, an error which will be null, and you must check if it isn't before continuing, and the result.
you're just launching tasks left and right without a care in the world :P
For all of those reasons, Promises were introduced into the language
Here's how you'd implement the same function with Promises
function readLines() {
  return new Promise(function(resolve, reject) {
    fs.readFile('whatever', 'utf8', function(err, contents) {
      if (err) { return reject(err); }
      return resolve(contents.split('\n'));
    });
  });
}
The main things to note is how readLines no longer accepts a callback, and now returns an instance of Promise.
You normally do not need to use the Promise constructor yourself. I am only doing it for the sake of the example.
Now, I can use readLines() like so:
readLines()
  .then(function(contents) {
    console.log(contents[0]); // log the first line
  })
  .catch(function(error) {
    console.error(error);
  });
This still has problems.
10:06
callback -> the hook gets sent to the async function vs promise -> the hook is returnerd from the async function
9 mins ago, by Madara Uchiha
async1(function(res1) {
  async2(function(res2) {
    async3(function(res3) {
      console.log(res1, res2, res3);
    });
  });
});
With Promises alone, it's a bit awkward to use res1 after async3 has completed, like it's fairly easy to do here ^
there's always a hook though with async operations
it's never as simple as just calling it synchronously, unless you have async and await keywords at least
But the advantages are that the function now returns something, I can attach my callback with .then() on that "something", I can pass that "something" around, I can handle errors predictably and safely.
For example, a feature of .then() is that if I return a Promise from it, the next .then() in the chain will also wait for it.
var promise = readLines(someFile)
  .then(function() { return readLines(someOtherFile); });

// snip

promise.then(function(otherFileLines) { console.log(otherFileLines[0]); })
I think @Breathing is sleeping
possible :D
10:10
his assimilation of knowledge has been launched asynchronously :P
TL;DR - Read about Promises. Use async/await.
10:25
-3
Q: Please tell me the solution of program

SabihudinWrite a program that asks the user to enter the numbers from 1 to 16 (in any order) and then display numbers in a 4 by 4 arrangement, followed by the sums of rows, columns, and dialogues: Example Run: Enter the numbers from 1 to 16 in any order: 16 3 2 13 5 10 11 8 9 6 7 12 4 15 ...

10:41
this just made my day: return new Function('$http', 'return $http(config)');
and ofc it's from a angular question: stackoverflow.com/questions/53169810/…
@MadaraUchiha terribly sorry I went away for food. Things started getting over my head.
@MadaraUchiha Thank you for your time!!
snapshoting what you said
@Neil thanks as well!
will study promises in depth.
11:03
@GottZ wtf @ using array reduce to chain promises
@KarelG Thank you
@Breathing it was a good explanation :) Take the time and try to understand it
It may save you a lot of time later
yes it is
11:19
ergh
HTML 5 is so annoying
I'm really considering using XML now
stop me before I do it
@KarelG ye. totally hilarious
@KarelG why not? foldl (>>=) is one of my funniest tricks
@BartekBanachewicz i won't stop you. actually xml is faster than json. (at least in the browser)
@GottZ I'm not going to present it directly, I need to render it to something anyway
I'm typesetting a book thing
xml is a markup like html
11:25
a book thing? as in.. a book library or as in booking flights?
I was using HTML which I preprocess with JS so far
@GottZ a handbook
html is just more flexible while xml is more strict in its specs
@KarelG are you sure it's not the other way around
*thinks* no?
@KarelG dooood you made my day again
i mean.. if you were talking about xhtml and html then yes
11:27
I have to say that defining tables in html compared to MD is pretty annoying
just use csv lolol
but then again I don't really need source readability
medical doctor ?
I need good end result
managing director?
11:28
@KarelG markdown
how big is the dataset?
:|
tables are something horrible to handle. true
so I let other people do it for me :P
@GottZ not that big
hm. then why does it matter how you transport it?
especially the requirement about having fixed headers when scrolling down is a lot asked but technologically seen not feasible to implement
11:29
it's really all about convenience of typing this in
@KarelG use position: sticky;
does not work well if you think about that :P
an approach with some javascript is required
I also have to say that the fact that CSS is dynamically typed is becoming annoying
and the fact that "classes" are really tags
why the hell are they called "classes" I have no idea
if they were classes you could instance them with parameters and subclass and inherit and mix and whatever
I have seen some nice solutions with flex though
this is position: sticky; without any js: share.home.gottz.de/2018/11/2018-11-03_15-54-46.mp4
just throw in a polyfill if you really need support for older browsers
11:34
go open a fiddle and create a table with position fixed. It only works if the header size and table cells have fixed sizes
which is not the situation in a lot tables
position fixed.. why would you use that on a table
*sticky. pardon me.
ye. that's not a table
<dl>
  <div>
    <dt>
*twitches eye*
i didn't do that. look at the comment in js
i'd just argue, if you have a table, use <table>. if you want to modify it (make parts sticky etc. avoid <table>
tables have css incompatibilities
11:55
@KarelG Before async/await, that was how you'd chain async operations and keeping it sequential.
Today, you can just do for (const res of arr) { await someAction(res); }
But consider that you have no await, how would you run a bunch of actions in a sequence, when you had an array to run on?
12:55
@MadaraUchiha the solution is usually just named event loop or queue processing
13:10
waz up
any idea why this -> if (window.matchMedia("(orientation: landscape)").matches) {
   window.scrollBy(0, 200);
} dont work?
ye. probably because you run this before the window has a scrollbar
ok thx any idea how i can execute it when the scrollbar appears?
or should i use simple timeout ?
well. how do you fill the screen?
ööö i use some divs with content or what do you mean with "fill"
do you fill it through raw html or do you use some xhr / fetch magic to request data with javascript and fill your page with that dynamically? also do you have images in your context? do these image tages have fixed width and height attributes? do you render your html within your javascript world with something like angular, react, glimmer, vue or similar?
13:16
here i have this dumb project for trying -> glitch.com/edit/#!/glossy-string?path=index.html:136:27
that aframe thing sure takes quite a while to load
what did you expect?
simple fix: create a placeholder for that aframe thing before you even load it
and make it have the same size as the final aframe thing
and then just swap it when the aframe thing is loaded
this way you can scroll down before the thing is loaded
hmmm should I use
> country/registration/configuration.json
or
> country-registration-configuration.json
?
use /
na jk how should we know how much stuff would match country or registration?
13:23
I have heard about that before. They just cannot be without Linus
hmm without the aframe scene it still dont work is something wrong at this code? ->
if (window.matchMedia("(orientation: landscape)").matches) {
  setTimeout(function(){window.scrollBy(0, 400); }, 1000);

}
@Delidragon i said: throw in a placeholder. i didn't say RiP it out
with all my CSS hate, repeating-linear-gradient is great
good ui does not change page height when loading
@BartekBanachewicz did you find valid usages in modern UI?
I keep using it for eccentric designs
but nothing else
13:26
Hi everybody, I am trying to run concurrently. It worked initially and now I get "missing script"
ohshit.. repeating-linear-gradiend my old enemy
maybe some progressbars, but they can't be animated afaik
@BartekBanachewicz you can use linear-gradient for that too. codepen.io/GottZ/pen/ZbEaZg
(this code is so dated, i would not recommend even looking at it)
so ye. i'd say repeating-linear-gradient is gold for progress bars
@towc lol. <progress> is so freakin bad
that's actually why i made this: https://codepen.io/GottZ/pen/YXdxQr
but still.. this is dated.
@towc yes
I used it before to render calendar background
and now I'm using it to render another time grid
it's much nicer than using say image backgrounds
image backgrounds.. dear god why
i mean for noise textures.. ok
btw do you know if firefox will have dithered gradients some day?
i'm a chrome user so i could not care less but this looks horrible in firefox: login.home.gottz.de
13:36
@GottZ easy to use
@KarelG well. the last time i used it, the visual progress differed when tabbing away and back after it was supposed to change.
and easy to use.. cmon
@GottZ now it works ty for help : here the code for people which are interested
window.addEventListener("orientationchange", function() {

      if (window.matchMedia("(orientation: portrait)").matches) {
    window.scrollBy(0, 200);
        }

      }, false);
14:10
@GottZ it is. You only have to update the value field after each progress update
sounds like you have not yet tasted the beauty of getters and setters in javascript then
scroll down to line 38 in js
3 tags + small fraction of your code.
idc about its design
ye. and you get all the bugs that come with <progress> out of the box
Been a while since I was here. I like the new carpets... anyway, in theory -- let's say you have a string - a sentense. Like "How I met your mother was dope until your mom screwed it for us" and you want to get only the words beginning with 'm'. How would you go about it?
/\bm\w*/
14:25
@KendallFrey is that for me?
@KendallFrey I hate the new X7, so I can't accept BMW as the answer
@KendallFrey I knew I should've used regex. Thanks man!
15:01
@GottZ bugs?
@KarelG when i made my own progress bar in 2015, the original <progress> had displaying bugs in chrome for windows 7 when you switched tabs. like.. literally showing a wrong progress.
I am just saying that it is easy to use now.
it is as easy now as it was back then.
nothing changed since it's introduction
you are free to use that or those other fancy progress bars. I don't think I have been using progress bars in my websites.
because it is ... pointless
I use a lib for file uploads, which has its own progress bar
15:09
hm. i once made a website with a jail countdown for a friend. that page was showing a progressbar until he was set free
keh, gotcha continue with my mails. 146 mails to go
wtf did you ever hear about filters?
those are filtered :P
i love quiet environments. especially quiet inboxes.
I have 20 ish filters I think. 2 of those are very specific (filtered by email) because I know those two persons just mails me for nothing. I just ignore.
they know my office. Be here dammit.
15:20
posted on November 06, 2018 by CommitStrip

15:46
the strip would be better if they didn't spoon-feed you the moral of the story
the rules are there thanks to our own experience
like, duh, of course that's the point
@nicoan Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
anyone here familiar with those new optane memories from intell?
I'm thinking about buying a new laptop, but i'm not sure what config would be good
Good Morning!
I have the option for solid 8gb ddr or 4gb ddr + 16gb optane
16:01
I've never even seen that, seems really interesting
what the hell is optane
but i'm afraid that those 4gb won't be enough for running webstorm and the other apps, nowadays in my notebook when developing i use around 6gb
Optane is a memory used for caching, so if you use the same apps everyday, it will cache them and then access it in a high speed
ahh its cache
it's described as a mix of a ssd/ram type of thing
but i'm scheptical bout it tbh lol
i'm not so sure my computer will access this optane memory when i'm using webstorm for instance, or many chrome tabs
check out some third party benchmarks
16:06
I will, if it was 8gb plus 16gb optane it would be a no brainer
looks like it could be practical for memory but intel seems to be selling it as storage
o/
i mean... if this pc can run it, any modern laptop can
yeah thats true
I almost bought this laptop with optane but I just couldnt help but feel unsure about it lol I'm just tired of my current laptop overheating like crazy no matter what kinds of "fixings" i do
16:23
i'm capped at 4gb of ram, and am running a 2core 2.6
@Neil A farmer has a circle of grass with a fence around it. He wants to tie a goat up on the inside of the fence. How long should the rope be so that the goat is only allowed to graze on 1/2 of the area of the circle?
16:37
@KevinB which Windows do you use?
@Allenph so the goat effectively gets a segment of a circle centred at some point on the circumference?
or is the goat tied in the middle of the circle?
Some point on the circumference.
If it was the middle that problem would be trivial.
7, 64bit
hi guyst
guys a question
I have know passed on bootstrap 4 and this code doesn't work
 <div class="row ">
            <div class="col-md-12 col-xs-12 col-lg-12">

                <div class="col-md-2 col-md-offset-8 col-lg-2 col-lg-offset-8 col-xs-8">
                   .....
                </div>
                <div class="col-md-2 col-lg-2 col-xs-4">
                    ......
                </div>
                </div>
            </div>
isn't that just html
16:51
in bootstrap 3 it works and It print the one component and the second compone like I want
in bootstrap 4 the component are displayed in wrong way
why?
There may be a breaking change between versions. Did you check the docs to swee if those are still valid classes?
user1596138
@Doflamingo19 Explain

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