IRC log of #novawebdev for Friday, 2023-10-13

*** shmohamud has quit (Remote host closed the connection)01:06
*** shmohamud has quit (Remote host closed the connection)01:21
*** shmohamud has quit (Remote host closed the connection)05:13
*** mulbah has quit (Remote host closed the connection)11:40
*** mulbah has quit (Remote host closed the connection)12:18
*** mulbah has quit (Remote host closed the connection)12:19
mulbahGood morning Mr. Cole13:00
ubuntouristHi.13:00
mulbahHow are you doing today13:01
ubuntouristDid your preferred candidate win the election? Last time I checked the vote counting had not finished yet.13:01
ubuntourist(I read that there were "skirmishes" but not too much violence.)13:02
mulbahYeah everything things is going cool13:04
ubuntouristI had a sore night. All of the bones I've broken seem to be hurting more. I break easily: My first bone break was at age 6, my  most recent at age 55.13:04
mulbahthere is no violence13:04
ubuntouristIt's starting to make me sleepy and grumpy all the time.13:04
mulbahso you will not be up long today13:05
ubuntouristI think I read that the "favorite horse in the race" is the current president winning another term.13:05
ubuntouristI don't know how long I'll be up. I have things to do that require daylight. But I'll probably try to get some daytime sleeping in.13:06
ubuntouristAnyway... On to the hard stuff.  Were you able to look at old notes about fields and field delimiters? Can you explain them now?13:07
mulbahMr. Cole I didn't email you this week13:10
ubuntouristI do too much "telling" and not enough "asking". So, I will be trying to ask for more demonstrations of understanding.13:11
mulbahthe reason is I have been busy with family stuff and also my Graduation13:12
ubuntouristCongratulations on graduation. And good luck with family stuff.13:13
mulbahAlright! thanks13:14
ubuntouristI shoul prepare better. Give me a second. I had an idea last night while staring at the walls.13:14
ubuntouristI want to quickly find a good file for you to download and experiment with...13:14
ubuntouristI think I found one. Click on13:18
ubuntouristhttps://www.openintro.org/data/csv/cars.csv13:18
ubuntouristAnd save the file.13:19
mulbahdone13:19
ubuntouristOK.13:20
ubuntouristNow, using nano,13:20
ubuntouristNo.... wait.  13:20
ubuntouristUsing "most", look at the file.13:20
mulbahshould i tmate you13:21
ubuntouristsure.13:21
mulbahssh KkYEudpNmT5YD2R8BrkyUfCur@lon1.tmate.io13:21
mulbahdone13:23
mulbahshould i use nano now13:24
ubuntouristNo. I don't want to change the file. And I found one that is a bit more like what I want.13:24
ubuntouristq and "rm" that file.13:24
ubuntouristget this one instead 13:25
ubuntouristhttps://www.openintro.org/data/csv/cars93.csv13:25
ubuntouristmost cars93.csv13:26
ubuntouristOK.13:26
ubuntouristSo, just looking at it, can you get an idea of what the data means? Look at the very beginning ("T" for "top").13:28
mulbahno13:29
mulbahidea13:29
ubuntouristOK... I will not be able to see this next thing when you type it: I want you to open the file a different way. type q to quit, then13:30
ubuntouristtype:13:30
ubuntouristlocalc cars93.csv13:30
mulbahlocate cars93.csv right13:31
ubuntouristNope. Good guess, but this time I didn't make a typing mistake. ;-)  I really wanted "localc"13:31
mulbahalright13:32
ubuntouristLook at what it is showing, and think about it a minute. Try to remember it for a few minutes.13:33
ubuntouristNot everything, just the basic information. 13:34
ubuntouristHold a sec while I call it up on my computer also.13:34
ubuntouristSo. We were talking about "fileds" and "filed delimiters".  Notice where the screen shows "fields".13:35
ubuntouristNotice what is below it.13:35
ubuntouristI also said that "field delimiters" are sometimes called "field separators". (Maybe I didn't say it that exact way, but13:37
ubuntouristfield delimiters, field separators, and field dividers all mean the same thing.13:38
ubuntouristSo. There is a section called "separator options" on your screen...13:39
ubuntouristWhat can you tell me about what you see there? Wha options are selected?13:39
mulbahthere options that are selected are:13:41
mulbahTab, comma Semicolon 13:41
ubuntouristAnd just above that, there is one other thing marked. (Below separator options but above tab, comma, semicolon.)13:42
ubuntourist(When you see a square, it is a "checkbox" and it means you can select zero, one or many of the options.13:44
ubuntouristWhen you  see circles, they are called "radio buttons" and you can only select one option. They are called "radio buttons"13:45
ubuntouristbecause old car radios used to allow you to set up your favorite radio stations and assign each station to a button. If you pressed a button,13:46
ubuntouristit would select that station and cause all the other buttonss to release and "pop out". You could only choose one button at a time.)13:47
ubuntouristSo, what are the radio button choices and what is selected?13:47
mulbahyou asking me Mr. Cole13:52
ubuntouristYep13:52
mulbahto separate by tab, comma, semicolon, and other13:55
ubuntouristOK.13:56
mulbahif you click fixed width it will lose ship13:57
ubuntouristGood.13:57
ubuntouristFor a moment, let's keep "fixed width" selected.13:57
ubuntouristWhen you do that, the bottom of the screen loses the column lines and instead displays at the top:13:58
ubuntourist0.........10.........20.........30..........13:59
ubuntouristMove your mouse over that line but don't click.13:59
ubuntouristMove the mouse left and right and notice what happens.14:00
ubuntourist(And  tell me what you see.)14:00
mulbaha straight line appeared and follow the mouse every where it go14:01
mulbahalmost like a radio stuff14:02
ubuntouristOK. now pick a spot where the line appears and click. Then do iit a second and third time in other locations.14:03
mulbahdone14:03
ubuntouristYou shold see very faintly, lines staying wherever you clicked. 14:04
mulbahsure14:05
mulbahwith a red dot14:05
ubuntouristNice. You've got a slightly better version of the Libre Office Calc (localc) than I do: My dots are not in color.14:06
ubuntouristI like the color better.. I will need to upgrade (or see if there is a way to turn that on for my system).14:07
mulbahI download the whole file using wget -r14:07
mulbahthat why14:07
ubuntouristNope. It is not the data file. It is the localc program putting in the red dots. The way you downloaded the file makes no difference.14:08
mulbahAlright14:08
ubuntouristThe data file is just a plain text file. You could create one with nano. Maybe we'll do that next in a minute.14:08
ubuntouristA "fixed width" field means that data is divided into columns (fields) based on  widths not separators. So,14:09
ubuntouristwherever you clicked will determine where the each line is broken into separate parts. 14:10
ubuntouristThe places where you clicked won't look good:  Sometimes words will be split in the middle with a line dividing the14:12
ubuntouristword into two parts randomly. That means this  data is NOT fixed width. Some lines are longer or shorter than others.14:12
ubuntouristSwitch back to "Separated by" and notice how the bottom section in white changes.14:13
ubuntouristFor now, just concentrate on lines 1 and 2. Don't worry  about "Standard" that appears above the lines.14:14
ubuntouristSwitch slowly back and forth between "Fixed width" and "Separated by" and look at the data in white for lines 1 and 2.14:15
ubuntouristFirst, we're going to do things wrong: When you feel like you see the differences, leave it set to "fixed width" and click the "OK" at the bottom.14:17
mulbahdone14:17
ubuntouristOK. It should look like garbage. I mean, the spreadsheet that shows up does not make sense. 14:18
ubuntouristClose that (and if it asks you if you want to save, tell it "No".)14:18
mulbahit open in liberoffice14:19
ubuntouristRight, Libre Office Calc - the spreadsheet program.14:19
ubuntouristThis time, leave it as "separated by" and click "OK"14:19
ubuntouristNotice how the data in the spreadsheet looks when "separated by" is chosen.14:20
ubuntouristWhat can you tell me about the difference in appearance between the "fixed width" version and the "separated by" version?14:21
mulbahthe difference is everything was colse together when I click the "fixed width" and when I click the separated by and press okay it was separated 14:25
ubuntouristOK. Close Libre Office Calc and go back to "most cars93.csv"14:26
mulbahdone14:27
ubuntouristA file name that ends with ".csv" is a Comma-Separated-Values (CSV) file. And it is exactly what it says it is:14:27
ubuntouristvalues are separated by commas.14:27
ubuntouristWhen you opened it with localc, and you chose "separated by" it meant that localc would separate each line14:28
ubuntouristanywhere that a comma, a semicolon or a tab appeared. And it would remove the comma, semicolon or tab, leaving only14:29
ubuntouristthe values that appeared between them.14:29
ubuntouristEach column was also referred to as a "field". 14:30
ubuntouristFields are groups of consecutive letters or numbers that together make sense.14:31
ubuntouristFor example, this sentence is can be broken up into fields.14:31
ubuntouristTell me, in my previous line, what is the field separator? (What is the field separator in "For example, this sentence can be broken up into fields.")14:32
ubuntouristAnd how many fields are there? (Hint: More than two.) 14:33
ubuntourist(Hint #2: We have another way to describe the fields in a sentence.)14:34
mulbah 14:37
ubuntouristI think you answered correctly. It is a bit difficult to be sure. Either add quotes or use a different way to describe.14:39
ubuntouristACTION waits for a response...14:43
ubuntouristACTION worries that the network is failing...14:45
mulbahresponse on what14:46
ubuntouristWhat is the field separator and how many fields in "For example, this sentence can be broken up into fields."14:47
mulbahthere are two fields14:48
ubuntouristI already said "Hint: There are more than two." and "Hint #2: We have another way to describe fields in a sentence.")14:49
mulbahthey are four14:50
ubuntouristYou're just guessing. 14:50
mulbahtwo quotation marks14:50
mulbahone ,14:51
mulbahand one dot14:51
ubuntouristLook at the cars93.csv in your terminal. You do not need to scroll. How many fields in each line of the cars93.csv and what is the field separator?14:51
ubuntourist(Each line contains the same number of fields.)14:52
ubuntouristHow many fields in each line of the cars93.csv and what is the field separator?14:55
mulbahthere are five I'm seeing14:56
ubuntouristThen you are still not understanding. When we looked at the file with "localc" it asked us which field separators we would accept.14:58
ubuntouristIt divided the file into fields based on which separators we allowed, that were in the file. The file is a CSV file...14:59
ubuntouristIt's 11:00. I'm calling it "quits" for today. Go back and read today's IRC log. Also, look back to several weeks ago15:00
ubuntouristwhen we were talking about file ownership and file permissions, and we looked at /etc/passwd. We talked about fields15:00
ubuntouristand field separators then.15:01
mulbahAlright I will email you tomorrow on this and the cut command 15:01
ubuntouristAnd TAKE NOTES !!! You won't learn this stuff and remember it unless you have your own notes, in your own way describing15:01
ubuntouristwhat I've said. Rewriting it and summarizing will either help you understand, or help you ask good questions when you don't 15:02
ubuntouristunderstand. If you're writing it down, and yout own words do not make sense to you, then it's time to ask for a better15:03
ubuntouristexplanation.15:03
ubuntouristGood luck! I hope you'll find some time to experiment with this stuff.15:03
mulbahAlright15:03
mulbahThanks for today15:03
ubuntourist(We're working our way back to the cut command, but trying to understand what a field is and  waht a field delimiter (field separator, field divider) is.15:04
ubuntouristBye!15:04
*** ubuntourist has quit (Quit: Leaving)15:05
*** mulbah has quit (Remote host closed the connection)15:12
*** mulbah has quit (Ping timeout: 480 seconds)15:50
*** mulbah has quit (Remote host closed the connection)17:52
*** mulbah has quit (Remote host closed the connection)18:11
*** mulbah has quit (Remote host closed the connection)18:13
*** mulbah has quit (Ping timeout: 480 seconds)18:26
*** sysadmin_ has quit (None)20:00
*** scooper has quit (Ping timeout: 480 seconds)20:05
shmohamudHi Scooper20:12
shmohamudHi Scooper20:17
*** scooper has quit (Ping timeout: 480 seconds)20:19
sysadminHello Sahnun20:21
shmohamudHow's it going?20:22
scooperInteresting every single day with js20:22
shmohamud:D good to hear20:23
shmohamudSo, ready for today's lesson?20:23
scooperyes20:24
shmohamudWrite me a function declaration that takes in two numbers, a and b, and logs out the multiplication of a*b20:24
shmohamudCan you do that for me?20:24
scooperyes20:24
shmohamudthink about the name of the function carefully20:25
scooperok20:25
scooperconst doingMath = function(a,b){20:28
scooper    console.log(a*b)20:28
scooper}20:28
scooperdoingMath(4,5);20:28
scooperVM235:2 2020:28
shmohamudis that a function declaration or function expression>20:28
shmohamud?20:28
shmohamudand can you think of a more specific function name? That's better than yesterday but it could be better20:29
scooperwait20:29
scooperlet me get something clear here Sahnun20:29
scooperif you declare a function with const or let with putting an equal sign is call a declaration right??20:30
scooper*without20:30
shmohamudyes, without the equal sign, it's a function declaration. 20:30
scooperif you declare a function with const or let without putting an equal sign is call a function declaration right20:30
shmohamudyes20:31
scooperok20:31
scoopernow I understand the it now20:31
shmohamudok, so rewrite the function as a function declaration and name it more specifically to what the function is diong20:31
scooperfunction timingNumbers(a,b){20:35
scooper    console.log(a*b)20:35
scooper}20:35
scoopertimingNumbers(4,5);20:35
scooperVM259:2 20:35
shmohamudgood, it's a function declaration20:36
shmohamudwhy did you name it timingNumbers?20:36
scooperaccording to your convention function should alway be name base on verb or what they are doing....20:37
shmohamudyes20:37
shmohamudwhat does the function have to do with timing? Is there there something more specific that the function is doing? Think about the math20:38
scooperfirst that was the name that came to my mind, secondly according to your instruction " I write a function that take two number and output the multiplication of a*b20:39
shmohamudyou should take your time naming functions, the name is important to make the code readable and maintainable20:40
scoopera*b is a multiplication going on here, that is why I name the function timingNumbers20:40
shmohamudcorrect, it's about multiplication! So why not name it multiply?20:41
scooperok recommendation accepted I will take my time naming function next time, but is there a problem with the function?20:41
shmohamudthere's no problem with the function, well done :)20:42
shmohamudjust the name20:42
shmohamudOk so write the same function as an arrow function20:42
scooperok20:42
*** shmohamud has quit (Remote host closed the connection)20:48
scooperconst doMath =(a,b) => {20:49
scooper    console.log(a*b)20:49
scooper    20:49
scooper}20:49
scooperdoMath(4,5);20:49
scooperVM884:2 2020:49
shmohamudexcellent20:49
scooperthe function name is ok???20:50
shmohamudwhat if you named it multiply, would that make it more readable?20:50
scooperok20:50
scoopernaming function with a suitable name for now will take time Sahnun20:50
shmohamuddoMath could mean addition, subtraction, multiplication, division, exponentiation, etc. so it's better to be a bit more specific20:50
scooperok20:51
shmohamudI understand, I'm just pointing you in the right direction. It will take time to get used to naming functions properly20:51
shmohamuddo you want to move on to logical operators?20:52
scooperconst Multiply = (a,b) => {20:52
scooper    console.log(a*b)20:52
scooper}20:52
scooperMultiply(4,5);20:52
scooperVM1027:2 2020:52
scooperyes20:52
scooperlet more to logical operator in JS20:52
shmohamudstart by declaring x = 520:52
scooperyes let move to logical operator in JS20:53
scooperas global variable or local variable???20:53
shmohamudjust use let x = 520:53
scooperok20:54
scooperI m done20:54
shmohamudok now write console.log(x == 5)20:54
shmohamudwhat do you expect it to log?20:54
scooperit will print out true20:55
shmohamudyes, test it and let me know what you see20:55
scoopertrue20:55
shmohamudperfect20:55
scooperlet x = 5;20:55
scooperconsole.log(x == 5);20:55
scooperVM1130:2 true20:55
shmohamudhow about x == "5"20:55
shmohamudwhat do you expect?20:56
scoopertrue20:56
shmohamudok, try it and let me know20:56
scooperconsole.log(x == '5');20:57
scooperVM1226:1 true20:57
shmohamudperfect. the == means "loose equality" it doesn't check if the type is equal. So integer and string of 5 , '5' will return true20:57
shmohamudnow try x === "5" 20:57
shmohamudwhat do you expect?20:57
scooperfalse20:57
shmohamudyes20:58
shmohamudtry it and let me know20:58
scooperok20:58
sysadminsorry my internet strip21:02
shmohamudno problem21:02
sysadminAre you still there Shmohamud????21:04
shmohamudyes21:04
*** scooper has quit (Ping timeout: 480 seconds)21:07
shmohamudScooper I've got to get going. Can we continue Monday?21:07
scooperOk21:07
scooperI appreciate today....21:07
shmohamudDo you have any questions before I sign off?21:08
scooperThanks for every step along the way21:08
scooperyes21:08
shmohamudYou're welcome, it's my pleasure. Yes, let's hear your question21:08
scooperI really need to understand in JS when to do function declaration and when to do both declaration and assignment of function21:09
shmohamudThere's not a big difference, so don't worry about it. I'm just making sure you understand the difference because you will see it done both ways in code you read21:10
shmohamudThey're both functions. One of them is a function expression, one is a function declaration.21:11
scooperok, please give me your feedback on the book when we resume monday21:11
shmohamudOk, I'll take a look this weekend21:13
shmohamudHave a good weekend and see you tomorrow for the meeting21:13
*** shmohamud has quit (Remote host closed the connection)21:13
*** scooper has quit (Quit: Leaving)21:37
*** shmohamud has quit (Ping timeout: 480 seconds)23:22

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!