IRC log of #novawebdev for Monday, 2023-08-14

*** Gap has quit (None)10:21
*** dcammue has quit (Quit: Leaving)10:48
mulbahHello tboimah12:43
tboimahHow are you doing mulbah12:48
mulbahgood and you12:49
tboimahI'm fine12:50
tboimahGood morning ubuntourist13:03
mulbahGood morning Mr. Cole13:03
mulbahHow are you doing13:03
ubuntouristtboimah, mulbah, Hi! I'm well. How are you gents?13:03
tboimahI am good13:03
mulbahI am good as well13:04
ubuntouristAnd are you both caught up with each other? Both comfortable with script, scriptreplay, dpkg, dpkg-query, apt-cache and chmod?13:05
ubuntourist(And were you able to see my recent e-mail talking a bit more about "executables" and chmod?)13:05
tboimahyeah13:05
mulbahyeah13:05
ubuntouristExcellent!  One thing that I notice while you are typing: You do not make enough use of the shortcuts that will speed up your typing.13:06
ubuntouristStart using TAB more to see if it will finish your typing for you. If it does nothing, try pressing it twice in rapid succession.13:07
ubuntouristThat will often offer up a few suggestions.13:07
mulbahokay Mr. Cole can I ask a question on the Chmod command13:08
tboimahoKay13:08
ubuntouristAlso, when you are trying to repeat a command that you've typed recently, instead of using up-arrow and down-arrow a lot, try "Ctrl-R" 13:08
ubuntouristand type a small part of the command you are trying to recall.  For example "Ctrl-Rfin" will probably show you your last "find" command.13:09
ubuntouristOK, mulbah, ask about chmod.13:09
mulbahyeah I want to understand the numerical way of using the chmod command you only talk about the alphabetical way of using it13:11
ubuntouristmulbah, I sent e-mail about the numeric way.13:12
mulbahokay 13:12
mulbahI haven't check my email yet13:12
mulbahbut I check it after the class13:12
mulbahthanks13:12
ubuntouristThat's why I asked if you had seen my e-mall message about executables and chmod.13:12
ubuntouristYou may have more questions after you read that, because it involves a little bit of understanding binary and octal counting.13:13
ubuntouristI don't know if either of you have been exposed to that yet. I am guessing that you have not encountered either. 13:14
ubuntouristAm I correct?13:14
ubuntouristOr do you already know about binary, octal, and hexadecimal?13:14
mulbahnot that much13:15
tboimah_113:15
tboimah-113:15
mulbahJeff talk about it ever since the time he was in liberia 13:15
mulbahhere13:15
ubuntouristOK. Let's take a detour and talk about that. Binary is REALLY important to programmers, and helpful to sys admins.13:16
tboimahokay13:16
ubuntouristIt comes up a lot. The basics of logic, modern electronics, and computers is binary.13:16
ubuntouristIn fact, hold on a second... Decades ago, I wrote something about it for another student. I think I may  still have the document...13:17
ubuntouristLet me check quickly.13:17
ubuntouristWell. I found it... But something got damaged in it. So it is not as clear as I want it to be.13:19
ubuntouristhttps://ubuntourist.codeberg.page/pdp-11/13:20
ubuntourist(I will try to fix it. It was written for a student who became my  girlfriend. And it talks about a very old computer, not Linux.13:20
ubuntouristbut in the beginning of the document, it tries to explain binary.)13:21
tboimahWow13:22
ubuntouristSo. Logic. In formal logic, there are only two conditions: An assertion can be TRUE, or it can be FALSE.13:22
ubuntouristIn magnetism, a magnet has a NORTH and a SOUTH13:22
ubuntouristA light switch can be ON or OFF13:22
ubuntouristIn computers, we represent these ideas with numbers: 0 = OFF, or FALSE, or DISABLED. 1 = ON, or TRUE, or ENABLED.13:23
ubuntouristzero and one. The basis of binary.13:24
ubuntouristOften, you have several conditions you want to know about simultaneously: For example, you may only want to go outside13:25
ubuntouristif the temperature is good AND it is not raining. Two conditions: Is temperature good TRUE, and is raining FALSE?13:26
ubuntouristThe condition would be represented numerically as 10.13:27
ubuntourist(I should say, it COULD be represented numerically as 10. This is one way of representing the first condition is TRUE and the second is FALSE.)13:28
ubuntouristSo, that's very basic logic. We'll get into it more later, but you  can also see it covered in my other online book for Jeff's class:13:30
ubuntouristhttps://ubuntourist.codeberg.page/Altair-8800/13:30
ubuntouristMath: As children we learn to count on our fingers. Ten fingers. So we use a counting system based on ten. That system is decimal.13:31
ubuntouristHave you both had basic algebra? If I say "ten squared", "ten cubed", "ten to the power of five" do you know what those mean?13:32
mulbahyeah13:34
ubuntourist(There may be regional differences in the words you've learned. I tutored a woman from South America and she used different words for the same concepts.)13:34
ubuntouristGREAT. That will speed this up.13:34
tboimah+113:34
ubuntouristSo, Any number to the power of zero is one.  15 to the zeroth power is one. 3647 to the zeroth power is one, etc.13:35
mulbahsure13:35
tboimahsure13:35
mulbahand any number to the one power is equal to that number13:36
ubuntouristIn decimal, the "unit" position or "ones" position is zero through nine, raised to the power of zero. The "tens" position is zero through nine to the power of one.13:36
ubuntouristThe "hundreds" position is zero through nine to the power of two, and so on, and so on.13:37
ubuntouristIn BINARY, we use two instead of ten.13:37
ubuntouristSo:  1010 equals 1**3   + 0**2   + 1**1 + 0**0 equals, in decimal 8 + 0 + 2 + 0 = ten13:39
ubuntourist(I'm using ** to mean "raised to the power of")13:39
mulbahokay13:40
mulbah** is also use in python like that too 13:40
ubuntouristI didn't know how far jeff had gotten. If you already know some Python, this will go even faster.13:41
tboimahit is an operator sign with stand for exponent13:42
ubuntouristWhen you get really long binary numbers -- for example 111011101 -- it becomes hard to keep track of all the ones and zeros 13:42
ubuntouristSo starting from the RIGHT, we often group the numbers into groups of three or four digits. The example above, broken into three digits is:13:43
ubuntourist111     011    10113:43
ubuntourist(If we were to try converting it to a decimal number, using powers of two, the value would be 477. But we're going to use it a different way.)13:44
ubuntouristYou can experiment in Python. Let's crank up a tmate session. 13:45
ubuntouristACTION waits for tmate.13:45
mulbahso if you group it int two it will not work too13:45
mulbahssh dsmSLBpzzTjdy5eehPAxNWvGh@lon1.tmate.io13:45
tboimahssh Eu9XqwbHakaMbh7gmpr4uh4wC@nyc1.tmate.io13:45
ubuntouristmulbah, tboimah which one? 13:46
tboimahyou can join both and see what we two are doing13:46
ubuntouristOK...13:46
ubuntouristSo, start python and type:13:48
ubuntouristx = 0b11101110113:48
ubuntouristpython313:48
tboimahdone13:48
ubuntouristprint(x)13:49
tboimahwow it give 47713:49
ubuntouristSo, In Python, you can enter binarary numbers usiing 0b followed by ones and zeros.13:50
ubuntouristAnd when you print, it will print the decimal equivalent of the number.13:50
mulbahso what entering 0b really matter13:50
mulbahor What 0b really do13:51
ubuntouristTry another. It doesn't need to be a big number. "0b" means, the numbers that come after this can only be zeros and ones, and it should be interpreted as a BINARY value, not a DECIMAL value.13:52
mulbahokay13:52
ubuntouristTry 0b10, and 0b100, and 0b1000.  I mean "x =" and "print(x) with those values.13:53
ubuntouristDo you understand what is happening?13:54
mulbahyeah13:54
tboimahstill a little bet confuse13:54
mulbah101 means 5 in binary and 111 means 713:55
ubuntouristtboimah, in the examples you typed, can you think of how 2, 4, and 8 are related?13:55
ubuntouristmulbah, right.13:56
tboimahAhh okay13:56
ubuntouristmulbah, actually, almost right: We would say that 101 binary is 5 decimal, and 111 binary is 7 decimal.13:57
mulbahin my code I side print(b, x) so it print b first13:57
ubuntourist0 binary is 0 decimal, 1 binary is 1 decimal, 10 binary is 2 decimal, 100 binary is 4 decimal, 1000 binary is 8 decimal.13:58
ubuntouristmulbah, you created two variables: x and b. You told it to print the variable named b first and x second.13:58
mulbahdid you see it Mr. Cole13:58
ubuntouristright. I saw.13:59
mulbahokay thanks for understanding13:59
ubuntouristmulbah, but did you understand my "almost right"?13:59
mulbahno14:00
ubuntourist101 does not mean 5 in binary. 101 binary means 5 in decimal.14:00
mulbahoooo thanks for the correction14:00
mulbahI understand your "almost right" now14:01
ubuntouristI wanted it said correctly because later when we're talking about binary, octal, decimal and hexadecimal, it will be confusing if14:01
ubuntourist I say something liike "10 binary" or 10 decimal" and you don't know which way I mean things.14:02
ubuntouristHold a second...14:02
ubuntouristok.14:03
mulbahACTION waiting14:03
ubuntouristWe're going to experiment with that "Ctrl-R" I talked about.  We're going back to the very first "x ="14:04
ubuntouristType "Ctrl-R=" (without spaces) and repeat Ctrl-R until you get to the first "x =" that you typed.14:05
ubuntouristtboimah, You've got it. Press enter.14:05
ubuntouristACTION waits for mulbah.14:05
tboimahshould i print x14:06
ubuntouristOops. Lools like he dropped out.14:06
mulbah07_yeah14:06
ubuntouristNo. we're going to use a different type of print.14:06
ubuntouristmulbah07_, I want your x to be equal to the first x you typed. Use the Ctrl-R=14:07
ubuntouristNot Ctrl-C. Ctrl-R14:07
ubuntouristCtrl-R=14:08
ubuntourist(equal sign.)14:08
ubuntouristNot C. "Ctrl-R="14:08
ubuntouristNo.14:08
ubuntourist=14:09
ubuntouristAnd now Ctrl-R again.14:09
ubuntouristAgain14:09
mulbah07_wow14:09
ubuntouristEnter14:09
ubuntouristGood.14:09
mulbah07_it looks great14:10
*** mulbah has quit (Read error: Connection reset by peer)14:10
ubuntouristmulbah, You just did a "reverse search" through all of your "history", for all of your lines that used "=".14:10
ubuntouristAnd when we found the right one, we pressed enter and it re-did the command.14:11
ubuntouristNow, both of you:14:11
ubuntouristprint(f"{x:o}")14:11
ubuntouristType carefully.14:11
mulbahokay14:11
tboimahdone14:12
ubuntouristGreat.14:12
ubuntouristThat is a special  way to print values. It means we asked python to tell us the OCTAL value instead of the DECIMAL value.14:13
ubuntouristOctal is based on powers of eight -- like octopus, and octogon. octo means eight.14:14
mulbahso that is how to tell python to print OCTAL value14:14
mulbah?14:14
ubuntouristmulbah, yes.14:14
mulbahso what is the f means 14:14
ubuntouristSo 735 OCTAL = (7 * 8**2) + (3 * 8**1) + (5 * 8**0) -- powers of eight instead of powers of ten or powers of two.14:15
ubuntourist111011101 binary = 735 octal = 477 decimal14:16
tboimahokay getting the clear understanding small small14:16
ubuntouristThe same "value" or "quantity" represented three different ways.14:16
ubuntouristtboimah, it's a difficult idea for many people. It will become clearer the more you use it but do not be too worried.14:17
tboimahsure14:17
ubuntouristSo. FINALLY, back to "chmod" and logic...14:18
ubuntouristand using numbers with chmod.14:18
mulbahokay14:18
ubuntouristchmod does other things, but most people only concentrate on the frequently used parts of the command.14:19
mulbahbut Mr. Cole you didn't explain the f is the code what it mean 14:19
ubuntouristit controls USER acccess (that's you, the owner of the file), GROUP access, and OTHER access.14:20
ubuntouristand for each of those three, it controlls READ, WRITE and EXECUTE.14:20
ubuntouristmulbah, I'll come back to your question later.14:20
mulbahokay Sir14:20
ubuntouristSo, we have three types of people -- user, group and other (ugo) 14:21
ubuntouristand three types of pemissions -- read, write and exeute (rwx)14:22
ubuntouristand each of those can be enabled, or disabled (on, or off... true or false... 1 or 0...)14:22
tboimah+ means add and - means remove14:23
tboimahis that right14:24
ubuntouristSo... When we look at "ls -l" we see  entries like "rwxrw-r--" which we can look at like...14:24
ubuntouristrwx    rw-    r--14:24
ubuntourist111    110    10014:25
ubuntourist 7      5      414:25
ubuntourist(Forget about the "l" and "d" and "-" at the start. We're concerned about the permissions, not the type of entry.)14:26
ubuntouristDo you see how those lines relate to each other?14:26
ubuntourist(My three lines above, I mean.)14:27
mulbahyeah14:27
tboimahyes14:28
ubuntouristSo... Don't try it. Without looking tell me what "chmod 777" wiill do to a fiile. What will the "ls -l" show for permissions?14:28
ubuntourist(what will "ls -l" show for permissions if you use "chmod 777" on a file?)14:29
mulbahit will give permission to all the user group and other14:30
tboimahchmod 777 means read, write and execute14:30
mulbahlike -rwxrwxrwx14:30
ubuntouristYes. Both correct.14:30
ubuntouristSo, if you remember how to use octal, it will be much easier than typing 14:31
ubuntouristchmod ugo+rwx14:31
mulbahit's give the user group and other permission to read, write and execute14:32
ubuntouristEspecially if you get something complicated. For example if the permissions on a file are "rw-r--r--" and you want to turn ON execute for the user, and turn OFF read for everyone else,14:32
ubuntouristthe old way would be "chmod u+x,go-r"14:33
ubuntouristThe new way would be "chmod 700"14:33
tboimahwow the old way is more simple then the new way14:33
ubuntouristThe first one says "turn on execute for user", "turn off read for group and other"14:34
mulbahhmmm you think so tboimah14:34
tboimahyeah mulbah14:34
tboimahfor me14:34
ubuntouristThe second one just says "turn on read, write and execcute for user" (it doesn't matter if they are already turned on),14:35
ubuntouristturn off read, write and exccute for group (it doesn't matter if they were already off), and14:35
ubuntouristturn off read, write and exeute for others (it doesn't matter if they were already off)14:36
mulbahokay if you say so tboimah as for me I think the new is far way better the the old way because new thing was of doing things is easy14:36
ubuntouristWith practice, the second way is MUCH easier. Much less typiing. Harder to make mistakes.14:37
mulbahsure 14:37
ubuntouristNow, back to your Python question, mulbah 14:37
mulbahyeah14:37
mulbahmy question was is the meaning of f in the code print(f"{x:o}")14:38
ubuntouristPython has a syntax for formatting information. For example, when you have a number like Pi 14:39
ubuntourist3.14159....14:39
ubuntouristyou can tell Python to only print "3" or "3.14" or a very long "3.14159....7...2..." 14:40
ubuntouristThat is "numeric formatting". You can tell it to print strings that are "left justified" or "right justified" or "centered"14:40
ubuntouristthat's string formatting.14:41
ubuntouristBut numeric formatting can also say "print this number using a different numbering system". Print a number in binary. Print a number in hexadecimal, print it in octal.14:42
ubuntouristLet's try another example. Start up Python and set a variable to any value you want.14:42
mulbahokay14:43
ubuntouristYou pick a variable name and a value. It doesn't matter. Well for now, stick to integers. Not Pi or something after a period.14:43
mulbahdone14:43
ubuntouristOK. Now we'll print your variable several ways:14:44
mulbahokay14:44
ubuntouristThe "f{.........}" means we are using a special type of string called a format string or "f-string".14:44
ubuntouristmulbah is using "mk" and tboimah is using "x" for the variable name. I will use "kc". So where I type "kc" use YOUR variable names not mine.14:45
tboimahokay14:46
mulbahhaha14:46
mulbahokay Mr. Cole14:46
ubuntouristprint(f" The octal value is {kc:o}. The binary value is {kc:b}. The hex value is {kc:x} and the decimal value is {kc}.")14:47
ubuntouristYou can incude text in the f-string. So if you type it the way that I did above, it will print the words along with the values.14:49
mulbahso Mr. Cole what 14:50
tboimahdone14:51
mulbahsorry mistake14:51
ubuntouristf-strings are super-powerful for formatting in Python. There is a LOT more that you can do with f-strings. But that's for a Python class, not a systems administration class.14:51
mulbahokay 14:51
ubuntouristIf you want to read more about the power of f-strings and formatting, I would recommend 14:52
ubuntouristhttps://docs.python.org/3/14:52
ubuntourist(search for "mini-formatting language" I think. Or maybe "mini-format language" or "formatting mini-language"... I forget.)14:53
mulbahokay14:53
ubuntouristIt is so complicated that I don't remember how to use all of it, and often have to go to the web and review.14:53
ubuntouristOK. I think we've covered a lot. 14:54
mulbahsure14:54
tboimahyeah14:54
ubuntouristLook in the Linux Command Line book for how to use those keyboard shortcuts like TAB and Ctrl-R and a bunch of other ones.14:55
ubuntouristThey will speed up your typing a lot if you can practice them.14:55
tboimahokay14:55
mulbahI don't like how time just run fast like that I was really enjoying the class14:55
ubuntouristI think it's in the section after expansions. We can come back to expansions later too. 14:56
ubuntouristmulbah, tboimah I'm glad. You both are interested, curious, smart, and willing to experiment. This will make you REALLY good at systems administration.14:57
mulbahon my computer one shift key is giving problem that why I can take long to type sometime14:57
tboimahokay thanks14:57
ubuntourist(You'll probably get into trouble, and curse yourself for some stupid mistake that wipes out everything. So, we may talk about14:57
mulbahThanks for the motivation Mr. Cole14:57
ubuntouristbackups next. Because all good systems administraters get into deep, dangerous waters, and when we make mistakes,14:58
ubuntouristthey're often big, disasterous mistakes. 14:58
mulbahand you are the best system administration teacher I have ever seen 14:58
tboimahsure14:58
mulbahI mean we have ever seen14:59
ubuntouristJeff and I have a crazy, funny friend. I call him "Hurricane" Flint. But he likes to say "What are the five most important words in the English language?"14:59
ubuntourist"Did", "you", "back", "it", and "up"15:00
mulbahhahahaha15:00
tboimahhahaha15:00
ubuntouristWell, thanks. You guys make it easy to teach.15:00
mulbahand thanks also for the teaching15:01
tboimahokay thank you too for making time to teach us we are very greatful15:01
tboimahfor that15:01
ubuntouristIf you spot any of the newer students that you think "Oh, this kid is smart and curious" use script and scriptreplay to teach them too.15:01
mulbahto be real i really enjoy the teaching today15:01
ubuntouristJeff and I both believe that an excellent way to learn and teach is for you to try to explain what you know to someone who does not15:02
ubuntouristyet know anything. They will ask you questions and ask you to explain something a different way because they did not15:03
ubuntouristunddersstand your first explanation.15:03
ubuntouristAnd, while "Hurricane" Flint says "Did you back it up?" is the most important thing, I think "Did you write documentation and an explanation of what you learned or did?"15:05
ubuntouristis VERY important too. Even when I was a very young child, I forgot a lot. So, at an early  age, I learned to keep very good notes.15:06
ubuntouristAnd it has saved my butt a lot. When I have a disaster, I can go to my backup and my notes and recover.15:06
ubuntouristWell, bye for today.15:06
mulbahi will try to write down what I learned 15:07
mulbahthanks so much for today 🙃🙃🙃🙃15:07
ubuntouristSee you Friday!15:07
tboimahokay15:07
tboimahhave a nice day15:07
mulbahthanks15:08
*** ubuntourist has quit (Quit: Leaving)15:08
*** tboimah has quit (Quit: Leaving)15:08
mulbahexit15:08
*** mulbah has quit (Quit: Leaving)15:08
*** mulbah has quit (Ping timeout: 480 seconds)16:23

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