Mercurial Hosting > reactionary
annotate src/learn.html.luan @ 92:7a56c17befab default tip
translation
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 02 May 2025 20:20:12 -0600 |
parents | 76baf48ea36b |
children |
rev | line source |
---|---|
40 | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | |
3 local pairs = Luan.pairs or error() | |
4 local Io = require "luan:Io.luan" | |
91 | 5 local Site_translator = require "luan:gpt/Site_translator.luan" |
6 local get_lang = Site_translator.get_lang or error() | |
7 local text_writer = Site_translator.text_writer or error() | |
40 | 8 local Shared = require "site:/lib/Shared.luan" |
9 local head = Shared.head or error() | |
10 local header = Shared.header or error() | |
91 | 11 local luan_url = Shared.luan_url or error() |
40 | 12 |
13 | |
14 local content = { | |
15 intro = { | |
52 | 16 title = [[Introduction]] |
40 | 17 content = function() |
18 %> | |
72 | 19 <p>Learning reactionary programming will give you a deep understanding of programming and will enable to you to write your own programs and websites. However this is not enough to get a job in depraved modern culture. Modern culture will expect you to use tools popular with them, so you would have to learn one of those. Probably the least horrible programming tool used by modern culture is <a href="python.html">Python</a>, so I would recommend learning that if you want a job.</p> |
40 | 20 |
64 | 21 <p>The next 4 lessons are basic computer literacy. Even if you are not interested in programming, these would be useful skills.</p> |
41 | 22 |
40 | 23 <p>I will develop this course incrementally based on demand. Whenever anyone completes the content here, I will add another lesson/section. This way I won't waste my time writing content that no one will use.</p> |
24 | |
25 <p>This course will be designed for you to learn reactionary programming in a logical sequence. I will focus on finding relevant resources, and I will only write explanations when nothing else is available on the subject. I will focus on web development since that is what I know best.</p> | |
26 | |
41 | 27 <p>I will often say "Do X" without saying how to do X. A big part of programming is figuring out how to do things. Your two main resources are Google and ChatGPT. If you get stuck, you can ask me.</p> |
40 | 28 |
29 <p>ChatGPT has become an essential programming tool. So the only task for this lesson is to play with ChatGPT. Later you can ask it technical questions.</p> | |
41 | 30 |
70
c934772a6c2e
remove discord and disearch
Franklin Schmidt <fschmidt@gmail.com>
parents:
67
diff
changeset
|
31 <p>If you have any questions, you can ask me on <a href="https://mikraite.arkian.net/Reactionary-Software-f1999.html">my forum</a>.</p> |
40 | 32 <% |
33 end | |
34 } | |
35 editor = { | |
52 | 36 title = [[Text Editor and JSON]] |
40 | 37 content = function() |
38 %> | |
72 | 39 <p>A text editor is a basic tool for reactionary programmers. We use simple flexible tools. Modern culture uses an <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">IDE</a> which is big, <a href="https://mikraite.arkian.net/Changed-my-mind-about-IDE-s-tp2769.html">complicated</a>, and inflexible. We don't use such tools.</p> |
42 | 40 |
41 <p>I reviewed the available text editors and I think <a href="https://www.sublimetext.com/">Sublime Text</a> is the best one available. So please download it and learn how it works.</p> | |
42 | |
43 | 43 <p><a href="https://en.wikipedia.org/wiki/JSON">JSON</a> is the most popular text data format. I think JSON was the last good programming idea from modern culture, developed around 2001, before modern culture became fully depraved. Do your own research on JSON to understand it. It is fairly simple.</p> |
42 | 44 |
44 | 45 <p>I paired Sublime Text with JSON because Sublime Text uses JSON files for its <a href="https://www.sublimetext.com/docs/settings.html">settings</a>. (Actually not quite pure JSON because it includes comments which are lines starting with <code>//</code>.) Experiment with Sublime Text settings to learn more about both Sublime Text and JSON.</p> |
40 | 46 <% |
47 end | |
48 } | |
41 | 49 bash = { |
52 | 50 title = [[Bash - Command Line Shell]] |
41 | 51 content = function() |
52 %> | |
49 | 53 <p><a href="bash.html">Bash</a> is the other basic tool for reactionary programmers. I was hoping to just reference existing Bash tutorials in this lesson, but they are all horrible, so I am writing my own. So for this lesson, please read <a href="learn_bash.html">my tutorial</a>.</p> |
41 | 54 <% |
55 end | |
56 } | |
62 | 57 regex = { |
58 title = [[Regular Expressions]] | |
59 content = function() | |
60 %> | |
61 <p><a href="https://en.wikipedia.org/wiki/Regular_expression">Regular expressions</a>, or regex for short, are used for searching or matching text. Since this is such a common need, regex are found everywhere in programming. Since you just learned Bash, you can learn regex with the <a href="https://en.wikipedia.org/wiki/Grep">grep</a> command that uses regex.</p> | |
62 | |
63 <p>Unlike with Bash, there are a few decent grep tutorials, so I don't have to write my own. Here they are:</p> | |
64 | |
65 <ul> | |
66 <li><a href="https://vegastack.com/tutorials/regular-expressions-in-grep/">Regular Expressions in Grep</a></li> | |
67 <li><a href="https://cs.nyu.edu/~mohri/unix08/lect4">Regular Expressions</a></li> | |
68 <li><a href="https://www.gnu.org/software/grep/manual/grep.html">GNU Grep</a></li> | |
69 </ul> | |
70 | |
71 <p>I suggest that you just read through these tutorials so that you get a sense for how regex and grep work. You don't need to practice anything here. You can come back to these tutorials later when you have a real need for regex or grep.</p> | |
72 | |
84 | 73 <p>The details of regex vary by implementation. Luan uses <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html">Java regex</a>. |
83 | 74 |
62 | 75 <p>If you become a serious programmer, then you should have a deeper understanding of regex. In that case I recommend the book <a href="https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/">Mastering Regular Expressions</a>.</p> |
76 <% | |
77 end | |
78 } | |
41 | 79 hg = { |
52 | 80 title = [[Mercurial - Source Control]] |
41 | 81 content = function() |
82 %> | |
67 | 83 <p>Thankfully <a href="mercurial.html">Mercurial</a> is well documented. Read <a href="https://hgbook.red-bean.com/">Mercurial: The Definitive Guide</a> up to (and including) chapter 9.</p> |
54 | 84 |
85 <p>To get started with Mercurial, download Mercurial from <a href="https://www.mercurial-scm.org/">their website</a> and install it. Then do:</p> | |
86 | |
87 <code block> | |
88 ~/learn $ hg version | |
89 Mercurial Distributed SCM (version 5.2.2) | |
90 (see https://mercurial-scm.org for more information) | |
91 | |
92 Copyright (C) 2005-2019 Matt Mackall and others | |
93 This is free software; see the source for copying conditions. There is NO | |
94 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
95 ~/learn $ | |
96 </code> | |
97 | |
67 | 98 <p>If this works, it is installed properly. Next <a href="https://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html#sec:tour-basic:username">set up your Mercurial configuration file</a> which is <code>~/.hgrc</code> on a Mac or <code>/c/Users/$(whoami)/mercurial.ini</code> on Windows <a href="https://www.msys2.org/">MSYS2</a>. My <a href="https://www.mercurial-scm.org/doc/hgrc.5.html">hgrc</a> file looks like this: |
54 | 99 |
100 <code block> | |
101 [ui] | |
102 username = Franklin Schmidt <fschmidt@gmail.com> | |
103 | |
104 [auth] | |
105 hghosting.prefix = https://hg.reactionary.software/repo/ | |
106 hghosting.username = fschmidt@gmail.com | |
107 hghosting.password = xxxxxxxxxx | |
108 | |
109 [extensions] | |
110 hgext.extdiff = | |
111 | |
112 [extdiff] | |
113 cmd.dm = diffmerge | |
114 </code> | |
115 | |
56 | 116 <p>You should register on <a href="https://hg.reactionary.software/">our Mercurial hosting service</a> and use your email as the username and the assigned password in <code>.hgrc</code>. The last two blocks set up <code>hg dm</code> to call <a href="https://sourcegear.com/diffmerge/">DiffMerge</a> by using the <a href="https://wiki.mercurial-scm.org/ExtdiffExtension">Extdiff extension</a>.</p> |
54 | 117 |
118 <p>Now you can play with <a href="https://hg.reactionary.software/repo/test/">https://hg.reactionary.software/repo/test/</a> like this:</p> | |
119 | |
120 <code block> | |
121 ~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest1 | |
122 no changes found | |
123 updating to branch default | |
124 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
125 ~/learn $ hg clone https://hg.reactionary.software/repo/test/ hgtest2 | |
126 no changes found | |
127 updating to branch default | |
128 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
129 ~/learn $ ls -Fd h* | |
130 hgtest1/ hgtest2/ | |
131 ~/learn $ cd hgtest1 | |
132 ~/learn/hgtest1 $ touch file.txt | |
133 ~/learn/hgtest1 $ e file.txt | |
134 ~/learn/hgtest1 $ cat file.txt | |
135 some text | |
136 ~/learn/hgtest1 $ hg status | |
137 ? file.txt | |
138 ~/learn/hgtest1 $ hg add file.txt | |
139 ~/learn/hgtest1 $ hg status | |
140 A file.txt | |
141 ~/learn/hgtest1 $ hg pull | |
142 pulling from https://hg.reactionary.software/repo/test/ | |
143 no changes found | |
144 ~/learn/hgtest1 $ hg commit -m 'add file.txt' | |
145 ~/learn/hgtest1 $ hg push | |
146 pushing to https://hg.reactionary.software/repo/test/ | |
147 searching for changes | |
148 remote: adding changesets | |
149 remote: adding manifests | |
150 remote: adding file changes | |
151 remote: added 1 changesets with 1 changes to 1 files | |
152 ~/learn/hgtest1 $ cd ../hgtest2 | |
153 ~/learn/hgtest2 $ hg pull | |
154 pulling from https://hg.reactionary.software/repo/test/ | |
155 requesting all changes | |
156 adding changesets | |
157 adding manifests | |
158 adding file changes | |
159 added 1 changesets with 1 changes to 1 files | |
160 new changesets aab34516d8dc | |
161 (run 'hg update' to get a working copy) | |
162 ~/learn/hgtest2 $ hg update | |
163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
164 ~/learn/hgtest2 $ hg status | |
165 ~/learn/hgtest2 $ cat file.txt | |
166 some text | |
167 ~/learn/hgtest2 $ e file.txt | |
168 ~/learn/hgtest2 $ cat file.txt | |
169 some text | |
170 and more | |
171 ~/learn/hgtest2 $ hg status | |
172 M file.txt | |
173 ~/learn/hgtest2 $ hg pull | |
174 pulling from https://hg.reactionary.software/repo/test/ | |
175 searching for changes | |
176 no changes found | |
177 ~/learn/hgtest2 $ hg dm | |
178 ~/learn/hgtest2 $ hg commit -m 'and more' | |
179 ~/learn/hgtest2 $ hg push | |
180 pushing to https://hg.reactionary.software/repo/test/ | |
181 searching for changes | |
182 remote: adding changesets | |
183 remote: adding manifests | |
184 remote: adding file changes | |
185 remote: added 1 changesets with 1 changes to 1 files | |
186 </code> | |
187 | |
41 | 188 <% |
189 end | |
190 } | |
86 | 191 java = { |
192 title = [[Java 8]] | |
193 content = function() | |
194 %> | |
91 | 195 <p><a href="java.html">Java</a> is not an easy language to learn and if you later use Python or Luan then you won't use Java much. So why learn it first? Because it will give you a core understanding of programming. Also, ChatGPT understands Java very well, so this can help you learn it. And lastly because Java will help you understand Luan.</p> |
86 | 196 |
197 <p>To learn Java, you will need the following resources:</p> | |
198 <ul> | |
199 <li><a href="https://docs.oracle.com/javase/8/docs/api/overview-summary.html">Java 8 API Specification</a> - This is the reference for the different types of Java objects and what they do. I will refer to this a lot.</li> | |
200 <li><a href="https://www.amazon.com/Java-Programming-Language-4th/dp/0321349806/">The Java Programming Language</a> - This is the core reference text for Java.</li> | |
89 | 201 <li>You should get a Java book for beginners. Unfortunately they are all quite bad. The least bad ones I could find are <a href="https://www.amazon.com/dp/1265054630/">Java: A Beginner's Guide</a> and <a href="https://www.amazon.com/dp/1119986648/">Java All-in-One For Dummies</a>. You will have to pick a book and read it to learn Java.</li> |
86 | 202 <li>For desktop GUI programming, you will need <a href="https://docs.oracle.com/javase/tutorial/uiswing/">Creating a GUI With Swing</a>, <a href="http://www.miglayout.com/">MigLayout</a>, <a href="https://www.formdev.com/flatlaf/">FlatLaf</a>, and <a href="https://docs.oracle.com/javase/tutorial/2d/">2D Graphics</a>.</li> |
203 </ul> | |
204 | |
205 <p>I am not so sadistic as to have you start with straight Java. That would be too painful. Instead I will have you start with a gentler interface to Java called BeanShell. Here are the steps to learning Java:</p> | |
206 | |
207 <h3>Install Java 8</h3> | |
208 | |
209 <p>Download <a href="https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html">Java (JDK) 8</a> and install it. Your Java book for beginners may have more detailed instructions. Of just ask ChatGPT if you have trouble. After installing the JDK, you can check it like this: | |
210 | |
211 <code block> | |
212 ~ $ java -version | |
213 java version "1.8.0_241" | |
214 Java(TM) SE Runtime Environment (build 1.8.0_241-b07) | |
215 Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) | |
216 ~ $ | |
217 </code> | |
218 | |
219 <h3>Learn BeanShell</h3> | |
220 | |
221 <p>As with Bash, I will write my own <a href="beanshell.html">BeanShell tutorial</a>. Read it.</p> | |
222 | |
223 <h3>Learn Java</h3> | |
224 | |
225 <p>Now it's time to read your Java book for beginners and try writing some Java programs. Refer to <a href="https://www.amazon.com/Java-Programming-Language-4th/dp/0321349806/">The Java Programming Language</a> for details and ask ChatGPT for explanations. You do not need to become a Java expert, so don't spend too much time on this. You just need to get the basic idea of Java.</p> | |
226 | |
227 <% | |
228 end | |
229 } | |
230 luan = { | |
231 title = [[Luan]] | |
232 content = function() | |
233 %> | |
91 | 234 <p>See <a href="<%=luan_url()%>/learn.html">Learning Luan</a>.</p> |
86 | 235 <% |
236 end | |
237 } | |
41 | 238 html = { |
52 | 239 title = [[HTML and CSS]] |
41 | 240 content = function() |
241 %> | |
59 | 242 <p>Google Chrome is the standard client-side web development tool. So the first step is to make sure that you have Chrome installed and running.</p> |
243 | |
72 | 244 <p>Using Chrome, on any page you can right-click in an empty area and from the menu select "View Page Source". This will show you the HTML for the webpage. If you try this on different websites, you will probably notice that my webpages are fairly short and well organized while the webpages of modern culture are unreadable. Another thing to try is to right-click anywhere in a page and select "Inspect". This should open the developer tools with the tab "Elements" selected. In this tab, you get the HTML organized as a tree that can be expanded to collapsed. The "Elements" tab of Chrome developer tools will be your core tool when you work with HTML and CSS. You should play with it and do your own research on it to learn how it works.</p> |
59 | 245 |
246 <p>The next step is to download this website like this:</p> | |
247 | |
248 <code block> | |
67 | 249 ~/learn $ wget -r -k https://www.reactionary.software/ |
250 --2024-01-15 01:31:20-- https://www.reactionary.software/ | |
59 | 251 ... |
252 ~/learn $ cd www.reactionary.software/ | |
253 ~/learn/www.reactionary.software $ ls -F | |
254 about.html hg_dev.html mercurial.html | |
255 bash.html index.html needed.html | |
256 books.html java.html nginx.html | |
257 discussion.html java_fork.html python.html | |
258 existing.html learn.html site.css | |
259 external_link.svg learn_bash.html this.html | |
260 freedit.html lucene.html wysiwyg.html | |
261 </code> | |
262 | |
263 <p><code>index.html</code> is the home page. Find it in Mac Finder or Windows File Explorer, and then drag-and-drop it into Chrome. You should see this website. You can open the files in a text editor to see the HTML. And you can edit these files to see how the web page changes.</p> | |
264 | |
265 <p>There is good documentation on HTML and CSS. Start with <a href="https://www.amazon.com/Cascading-Style-Sheets-Designing-Web/dp/0321193121/">Cascading Style Sheets: Designing for the Web</a>. This was written by the people who invented CSS and explains the core idea. Read the whole book. This book covers almost everything in this website. The only missing piece is <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">flexbox</a>. Next get <a href="https://www.amazon.com/CSS-Definitive-Guide-Layout-Presentation/dp/1098117611/">CSS: The Definitive Guide</a>. You should also read this whole book, but you can do it slowly as you work with CSS. You don't need to read this book right now, you can wait until you have finished the next two lessons.</p> | |
266 | |
267 <p>Just play with HTML and CSS until you get a basic understanding of how they work. You should be able to understand the HTML and CSS of this website.</p> | |
268 | |
269 <p>I left out resources for HTML itself. You should just look up HTML tags with Google or ChatGPT as you encounter them. That is good enough to learn HTML.</p> | |
270 | |
72 | 271 <p>Ideally one should be able to look at web pages around the internet to learn. But unfortunately they are mostly overcomplicated crap that is very difficult to understand. You can try. My personal websites are like this one - very simple, so they don't look professional to modern culture. I can't link to my best commercial website because that would ruin its reputation (because I am infamous). But I can link to some of my old commercial websites <a href="http://test.tleggings.com/">here</a> and <a href="http://test.super-resume.com/">here</a>. These have reasonable HTML and CSS.</p> |
59 | 272 |
72 | 273 <p>I have a few general principles for working with HTML and CSS. First, modern culture claims that HTML is for content and CSS is for styling. This is nonsense. Both HTML and CSS are for layout, don't think of them as being conceptually different. Just use both in the simplest possible way to get the results you want. Don't bother with the useless new HTML5 content tags like <code>header</code>. Just use <code>div</code> and <code>span</code> for most things. Also I use HTML attributes as selectors, not HTML classes. This is just simpler. HTML classes are useless, leave them for modern culture.</p> |
59 | 274 |
275 <p>You will need HTML, CSS, Javascript, and Luan to make a website. So I suggest that you get a basic understanding of each of these and then go back later to study them in greater depth.</p> | |
41 | 276 <% |
277 end | |
278 } | |
279 js = { | |
52 | 280 title = [[JavaScript]] |
41 | 281 content = function() |
282 %> | |
283 <p>later</p> | |
284 <% | |
285 end | |
286 } | |
287 http = { | |
52 | 288 title = [[HTTP]] |
289 content = function() | |
290 %> | |
291 <p>later</p> | |
292 <% | |
293 end | |
294 } | |
295 lucene = { | |
296 title = [[Lucene]] | |
41 | 297 content = function() |
298 %> | |
299 <p>later</p> | |
300 <% | |
301 end | |
302 } | |
40 | 303 } |
304 | |
305 | |
306 local function show_toc(content) | |
307 %> | |
308 <ul> | |
309 <% | |
310 for id, info in pairs(content) do | |
311 %> | |
312 <li><a id="c_<%=id%>" href="#<%=id%>"><%=info.title%></a></li> | |
313 <% | |
314 end | |
315 %> | |
316 </ul> | |
317 <% | |
318 end | |
319 | |
320 local function show_content(content,h) | |
321 for id, info in pairs(content) do | |
322 %> | |
323 <div heading> | |
324 <h<%=h%>><a id="<%=id%>" href="#<%=id%>"><%=info.title%></a></h<%=h%>> | |
325 <a href="#c_<%=id%>">contents</a> | |
326 </div> | |
327 <% | |
328 info.content() | |
329 end | |
330 end | |
331 | |
332 return function() | |
91 | 333 Io.stdout = text_writer() |
40 | 334 %> |
335 <!doctype html> | |
91 | 336 <html lang="<%=get_lang()%>"> |
40 | 337 <head> |
338 <% head() %> | |
339 <title>Learn Reactionary Programming</title> | |
340 </head> | |
341 <body> | |
342 <% header() %> | |
343 <div content> | |
344 <h1><a href="learn.html">Learn Reactionary Programming</a></h1> | |
345 <hr> | |
346 <h2>Contents</h2> | |
347 <div toc> | |
348 <% show_toc(content) %> | |
349 </div> | |
350 <hr> | |
351 <% show_content(content,2) %> | |
352 </div> | |
353 </body> | |
354 </html> | |
355 <% | |
356 end |