Threads for susam

  1. 35

    Pretty ironic to see this post hosted on a .sh domain name. Yes, .io domains are harmful but so are .sh domains!

    1. 16

      true!! I wish someone had informed me before I hitched my life to a .sh domain. i hope my post helps someone avoid similar regrets.

      1. 1

        Well the web isn’t (yet) hotel california, domains can move hinthint

        1. 3

          easier said than done when my email is hosted on that domain as well & everyone polling my RSS feed would need redirection 😥 plus, all my historical links would break. i would like to move but it’s a lot of work and churn for a site that i’ve built up for years.

          1. 4

            I hosted my website, RSS feeds, and email on a .in domain for 16 years. Then I decided to move everything to a .net domain. Since my entire setup is version controlled, it took only a few commits to move my website and email from the old .in domain to the new .net domain:

            The migration went well without any issue. There has been no loss of RSS feed subscribers. The web server access logs show that all the RSS clients and aggregators were successfully redirected to the new domain.

            1. 4

              receive emails for both old and new domains

              I agree with you that it’s not hard to switch domains (I’ve also done it myself), but, because I used my old domain for email, I’m essentially forced to keep paying for it. Otherwise, someone could just buy up my old domain and start receiving my emails. I’ve gone through the process of updating my email for just about every service I know, but even after four years I still get the occasional email sent to my old domain. Maybe if I can go five years without receiving any emails for my old domain I’d feel more comfortable giving it up, bit even then it still feels like a security risk.

              Switching domains for ethical reasons seems moot if you still have to keep paying for it.

    1. 4

      You could also get there by jumping to a null pointer?

      1. 3

        Yes!

        C:\>DEBUG
        -A
        1165:0100 JMP 0
        1165:0103
        -G
        
        Program terminated normally
        -
        

        And then

        -N JUMPER.COM
        -R CX
        CX 0000
        :3
        -W
        Writing 00003 bytes
        -Q
        
        C:\>JUMPER
        
        C:\>
        
      1. 2

        why not use asdf or something like that?

        1. 4

          Some of the scaffolding (Makefile, test macros, etc.) in the project is more than a decade old which I have copied from project to project over these years. Back then I was not aware of ASDF. Since this old scaffolding has been working fine for me, when I began rewriting MathB.in in Common Lisp, I just copied the same scaffolding over to this project. As a result, the thought of introducing ASDF for building and packaging never occurred to me. I might consider it though in future depending on my available leisure time and priorities.

        1. 6

          I don’t use Vim a lot these days but several years ago, when I was an avid Vim user, one of my favourite Vim features was the blockwise-visual mode that can be started with the Vim key sequence ctrl-v. It is very nifty for making rectangular selections and move around columns of text.

          I use Emacs these days which offers a very similar functionality in the form of rectangular-mark-mode that can started with the Emacs key sequence C-x SPC.

          1. 2

            Long ago I installed a plugin named visualDrag.vim. I still have it installed and bound to my arrow keys in visual mode. It lets you use ctrl-shift-v to go into rectangular visual mode and then shift just the selected characters around, shift everything else to make it work.

          1. 2

            Hey, I’d add an && break to make it stop once a success is reached:

            for ttl in {1..30}; do ping -4 -c 1 -t $ttl example.com && break; done | grep -i from | nl -s ' ' -w 2
            
            1. 2

              Thanks! This makes the output much neater. I have updated this command in my post to include the && break now.

              1. 4

                I don’t know if this was happening before I suggested improvements, but grep is buffering more than a single line and doesn’t output til the end. This made it much more real time:

                for ttl in {1..30}; do ping -4 -c 1 -t $ttl example.com && break; done | grep --line-buffered -i from | nl -s ' ' -w 2
                

                (https://unix.stackexchange.com/a/293289)

            1. 3

              What’s the agenda for the meeting this Tuesday?

              1. 2

                On Tuesday, we will read the first couple of pages of the handbook and discuss the first few introductory problems in the problem set. We will keep an updated schedule and study plan available here: https://offbeat.cc/cses/. Right now it says,

                Current plan: Problems 1-6; Pages 3-11 (Oct 19-21)

                In case that looks like a slow schedule, indeed our reading sessions tend to be slow-paced most of the time. We pick only about one or two topics in most meetings. As a meeting host, I focus on spending a decent amount of time with each concept with the intention of developing good intuition for the subject matter, as opposed to covering too many items in the same meeting.

                1. 3

                  Thanks.

              1. 1

                Gearing up for the second edition of our Offbeat Computation Club meetings. The first series of meetings was about analytic number theory. After 120 meetings across 7 months, it was finally concluded in the beginning of this month. The next series of meetings is going to be on solving the CSES Problem Set. The book club meetings will focus on going through a few pages of the CSES handbook together in each meeting as well as on discussing techniques to solve each problem in the problem set. This topic was chosen by popular demand from the current members of the club.

                I have always been fond of puzzles (mathematical, programming, or otherwise) since my childhood days despite being a considerable time sink and despite having very little utility in life. Nevertheless, I enjoy doing it, so one of the things I am specifically interested in this series of meetings is to look at the same problem from multiple perspectives thus gaining a deeper appreciation of the underlying patterns that lead to interesting mathematical properties related to the problem. I am noting down some of these interesting patterns and observations as virtual boards at https://offbeat.cc/cses/boards/#problem-notes.

                I have been working on our club website and the schedule for the last few days. I am hoping to make the website completely ready in this weekend. If this kind of club activity sounds like fun to you and you want to participate in our meetings, see https://offbeat.cc/cses/ for more details.

                1. 1

                  Hi, I’m potentially interested in attending, but the website isn’t very clear on what section of the book and/or what problems will be discussed at the meet. Could you clarify, please?

                  1. 1

                    Thank you for your interest in the book club! It is very likely that we will read the entire book and discuss all the problems in the problem set.

                    The format of the meetings is going to be quite similar to how it was for our previous series of meetings on analytic number theory. The blog post “Our 100th Meeting” offers a glimpse into our meeting style and format.

                    The meeting log of previous meetings shows that we read about 2-3 pages of the book in every meeting. It is very likely going to be similar for this new series of meetings on the CSES problem set and handbook. However, in this new series of meeting we will also focus a lot on solving problems and seeing a problem from different perspectives. We have decided to spend about 20% time reading the book and 80% time discussing the problems.

                    1. 1

                      Ah, so you read the book during the meeting rather than in advance? And solving the problems during the meeting, too?

                      I am more used to clubs where you read a set text (a book, or a chapter, or an article) in advance and then discuss together, but I am still interested, maybe see you on Tuesday :)

                      1. 1

                        The most serious participants do read the book in advance. As a meeting host, I too read the book in advance. But we read the book together once again line by line during the meetings. We pause at the end of every section to give everyone a chance to add their comments and insights about the section.

                        So essentially the meeting host and the serious participants do a second pass over the chapters of the book during the meetings. The first pass is typically done privately in advance. For something like analytic number theory where the textbook was very dense, I think a two pass detailed reading approach like this was very helpful in thoroughly understanding the material. I am not yet sure if the same approach would work well for a less dense material like the CSES problem set and handbook. We will see what works well in our meetings and what does not as we make progress. We will then fine tune the meeting style accordingly.

                  2. 1

                    What (coding) language do you speak in the meeting itself? C++?

                  1. 19

                    Gopher Protocol was created at the University of Minnesota for searching and retrieving documents. Its original design featured green text on a black background.

                    Isn’t that the colour of a green monochrome monitor? Pretty sure it would have appeared white on white monochrome and amber on amber monochrome. I see the same problem a couple of paragraphs later.

                    Linux used white text on a black background.

                    A green monochrome monitor would have displayed green text instead.

                    1. 26

                      Yeah, this article is… not exactly well-researched. For instance, it gets the date of the WWW’s beginning wrong by about three years (1987 vs. 1990, or even 1989 at the earliest, if you take the date when the proposal was submitted).

                      It also gets the timeline on the “evolution of the color blue” (!?) backwards, stating (about its use in Windows 3.1, in 1992), that “Microsoft uses the “hyperlink blue” for active states when a user clicks on different drives, folders and icons. This is incredibly important because it shows the slow evolution of this blue from being a layout color to being an interactive color, preceding the time when blue would have been added to Mosaic by almost exactly a year.” But it was already used as the active selection colour in some interface elements (menus, in particular) as early as Windows 1.01 and, of course, in Windows 3.0, almost two years before Windows 3.1. In that sense, its use as an “interactive colour” in Windows 3.0 precedes the entire WWW by a few months (its use in 1.01 should probably be discounted – probably due to palette limitations, there is no single active state colour in Windows 1.01). As with many other things in history, it may well be that this idea of “evolution” from B&W everything to blue as an “interactive” colour to blue as the interactive colour is just our wishful thinking because we want to make history neat and digestible.

                      Also in terms of methodology: it misses a bunch of important questions about Viola, which supported stylesheets (albeit not CSS), such as whether Viola’s stylesheets gained sufficient traction or not. It may well be that no particular browser made the hyperlinks blue, it just turned out to be a popular colour in early stylesheets, or a common user customisation in TkWWW or Viola, and it was made into the default by other browsers, not as a conscious decision, but as a de-facto process. In this case, it’s not that anyone made it blue, it’s just that it slowly become to be accepted as being supposed to be blue, and browsers slowly followed suit.

                      I’m also not very convinced that the original Mosaic interface was black-and-white. I know the screenshot shows it that way but if it’s from an SGI machine, and the dithering on the titlebar makes me think that it is, then it may not be the original colour, as even the earliest IRIS 4D models had colour output. In that case, the changelog for the default anchor representation is somewhat less definitive (e.g. hyperlinks may have been blue and dark purple, respectively, even before that, just without the underline, or there may have been no differentiation between visited and unvisited links etc.)

                      1. 2

                        The edit period has passed but in case anyone reaches this via Google way later, there is a point that I want to add, since nobody called me on it, and I don’t want it to unwittingly become e-folklore.

                        I was partly misremembering the “interactive” colour in Windows 3.0. In its default theme (see Note 1), Windows 3.0 did use blue as the active window colour, and as the active selection colour in some programs (e.g. Program Manager), but not in others, like the File Manager, where the active selection colour was still black, much like Windows 2.x. It was also not quite the dark shade of blue that we’ve come to associate with hyperlinks nowadays, but closer to the default background colour in Windows 2000. Of course, the hyperlinks in the help system were green.

                        The waters of history are muddy and they don’t always align neatly. More often than not, the primary reason why we discern a pattern of evolution is that we simply discard the messy details. This, IMHO, is one of these cases. Do we take blue to have been an “interactive colour” in Windows 1.01, even though it was only used as the active selection colour in some parts of the interface? Does its use as active window indicator count, in which case we also ought to count Amiga Workbench 2.0’s use of blue, in 1990? Do we take colour themes into account – modern systems don’t really support it (or any kind of customisation, for that matter), but this wasn’t always the case. What about systems that used more indicators to signal “interactivity” – Motif, for example, used selections for text boxes, bevels for menus and so on?

                        Note 1: It’s worth remembering that Windows 3.x supported a lot of them and that, besides the funny/eye-scorching ones like Hotdog Stand, this may have actually been useful in the era of low colour count and poor-quality monitors.

                    1. 10

                      Reading Chapter 8 - Periodic Arithmetical Functions of Gauss Sums from the book Introduction to Analytic Number Theory (Apostol, 1976).

                      A bunch of us who met each other on IRC networks began meeting once everyday for 40 minutes and reading through a couple pages of this book. In the last 3 months, we have covered more than half of the book and we are now reading chapter 8. The two very interesting functions this chapter introduces are Ramanujan’s sum and Gauss sum. While some of us were familiar with Ramanujan’s sum, none of us had any prior knowledge of Gauss sum, so this whole chapter has been a fun ride.

                      1. 6

                        I was inspired by this to play hooky and implement a tiny Forth core inspired by Wasm3’s clever interpreter. The basic NEXT / DUP / DROP / etc. stuff is about 80LOC, under 200 bytes. I called it Tails because it tail-recurses and it runs fast.

                        https://lobste.rs/s/wmuvxw/tails_tiny_forth_core_written_as_hack_for

                        1. 7

                          I called it Tails because it tail-recurses and it runs fast.

                          My greatest ambition is to write a Forth and name it Sally. (I don’t have a lot going on.)

                          1. 5

                            This is quite nicely done! Thank you for sharing it here.

                            Off-topic: I noticed that you have named your C++ file with the .cc extension. Your GitHub repo too shows that you and your workplace uses .cc and .hh extensions for C++ source and header files. Do you remember how you ended up using the .cc extension for the first time? Did you pick up this style from another code base you were working on? I ask this because I don’t see this style very often these days. I did a poll on Twitter sometime back about it. It turns out 9 out of 10 use the .cpp extension these days!

                            1. 2

                              Huh. I don’t remember why, or when, I started. The work projects I contribute to tend to be repos that I created, and we don’t have any strong company-wide standard I’m aware of, so I wasn’t following someone else’s lead.

                              I might have picked up this naming convention at Apple, but I don’t remember what I was naming files back then. If WebKit or Chrome uses .cc, that may well have been the seed crystal I picked it up from.

                              1. 1

                                You forgot .C…. I’ve seen that way too often.

                              2. 1

                                wow - this is impressive, thanks for sharing! :)

                              1. 1

                                Update: The post URL containing the demo page has now moved to https://susam.github.io/texme/examples/demo.html.

                                1. 2

                                  Working on https://muboard.net/.

                                  I wrote this tool initially for our analytic number theory book club. We meet roughly once everyday and study a couple of pages of an analytic number theory book together. During the meeting sessions, I often share my screen and use this tool to scribble some mathematics to expand some steps not explained in the book or illustrate a new theorem we are trying to understand with some examples. The tool also supports archiving the scribbled mathematics snippets as distributable, self-rendering board files too.

                                  After a couple of weeks of using this tool, I released it as an open source project at https://github.com/susam/muboard and received good feedback on the tool. In this weekend, I intend to expose some of the internal properties of the tool as configurable options to the user and expand the documentation to explain these configurable options in detail.

                                  1. 2

                                    Nice work, I love seeing new tools for writing math on the web! My side project recently has been prosemirror-math, which is my attempt to make wysiwyg math editing on the web a little more tolerable. It’s a plugin for ProseMirror that others can hopefully use / modify to add better math support to their markdown editors, etc..

                                    1. 1

                                      ProseMirror Math looks great. Thanks for sharing. Good luck with your project!

                                    2. 2

                                      Interesting. I just finished basic IntelliSense support for MathJaX for a vscode extension that I use with my SSG to render math on the server side. Unfortunately, most of my math is handwritten, and it’s too painful to typeset it, so I’m currently investigating a way to convert handwriting from my tablet to the MathJaX subset of LaTeX automatically.

                                      1. 2

                                        For OCR, there’s some freemium software called MathPix, which does a pretty great job. However they limit your monthly snips on the free version.

                                    1. 1

                                      Cool! A very minor glitch: in the example document you have a_1 = a_2 = dots = a_k = 1, which renders “dots” literally where you wanted an ellipsis “…”. I’ve long since forgotten all the TeX I knew, but adding a backslash before “dots” fixed it.

                                      1. 1

                                        Hi @snej! That was indeed an error. Thanks for reporting it. Fixed it now.

                                      1. 3

                                        Sorry for having the first comment you receive be a (minor) complaint about a platform you likely weren’t targeting. On Firefox on Android, attempting to type ,help makes the help text briefly appear before quickly vanishing. This makes it a tad difficult to understand what this does without resorting to finding it on your GitHub. :P

                                        (Without having looked into it from a computer, and therefore meaning I don’t know what’s actually happening, my guess would be that this is something to do with changing content when the cursor position changes?)

                                        1. 6

                                          Hi @zgrep, Thank you for reporting this issue with detailed information. It helped me to reproduce the issue with Firefox on Android. The issue was caused by a second input event being fired when the text input field was being changed by the tool itself. Apparently, this behaviour seems to occur only with Firefox on Android. This behaviour does not seem to occur with the other browsers I had earlier tested with like Firefox on macOS, Chrome on macOS, iOS, and Android.

                                          I have now pushed a fix to resolve this issue. The issue you faced should be resolved now. Thanks, once again, for taking a close look at this tool, reporting this issue, and helping me to improve it!

                                        1. 1

                                          Working on fixing a bug submitted to me two years ago: https://github.com/susam/uncap/issues/10. This is a tiny and lightweight key remapping tool for Windows, primarily used by Vim and Emacs users. This issue got introduced in the last release (0.3.0) which broke backward compatibility with an earlier release (0.2.2). Here is how the timeline looked:

                                          • Version 0.2.2 and earlier did not remap injected key strokes. For example, the on-screen keyboard injects keys. Extended keys like “Start Mail” or “Select Media” also cause injected key strokes. This tool ignored injected key strokes to avoid a remap loop (more details here).
                                          • Version 0.3.0 began remapping injected key strokes. This became problematic for users who want to remap non-injected key strokes but don’t want to map injected key strokes. For example, a user who wants to map actual ctrl of the keyboard to something else but do not want to map ctrl injected by an advanced configurable mouse (an example here).

                                          My plan is to disable the injected-key-remapping feature by default, so that the default behaviour becomes the same as that of version 0.2.2, and then make the injected-key-mapping feature available via a command-line option. Now, this would still be problematic for users of version 0.3.0 who have become used to injected-key-remapping by default. That is unfortunate. Either way, I am going to create problems for one set of users. If I don’t fix this, version 0.2.2 users see a different default behaviour in version 0.3.0. If I fix this, version 0.3.0 users will now see a different default behaviour.

                                          Lesson learnt: Even if it is a personal hobby project, as long as it has got at least one other user, do not alter the default behaviour. Introduce any changes to default behaviour with an optional flag or CLI option.

                                          1. 7

                                            On the confusion of what a scripting language is, there is a ton of overlap and it’s not always clear which to choose.

                                            A lot of my own projects started out as bash/zsh because it seemed small and the project fit a shell script well. But as they grow and become more critical, I regret not having things like tests and more robust error handling. Several times I tried starting such projects in Python, but converted to Bash when I found I wasn’t making as much progress as I wanted.

                                            I recall that Git also started out as a collection of Bash & Perl scripts, which is why it took so long to port to Windows.

                                            1. 2

                                              If that bit about Git is true, it isn’t in its own git history. The first commit is a few c files.

                                              1. 9

                                                I never questioned it because my terminal would report the current process as bash or Perl most of the time during a checkout

                                                Edit: I found it. Linus describes commit as being a few calls to Linux utilities, and push as being just rsync.

                                              2. 1

                                                There are a couple of different testing tools for shell, FYI.

                                                1. 2

                                                  I have written my own simple test runner (example). The actual tests go into a test file (such as this). It works in a very simple way. If the test function fails with a non-zero exit code, it is a test failure, otherwise it is a success. It has served me pretty well so far.

                                                  Also, since I don’t target bash alone but target sh instead, so that the scripts can run on more number of shells, I run the tests with bash, ksh, and zsh on Debian and Mac as well as with dash, posh and yash on Debian (example) to weed out any Bashisms.

                                                  1. 2

                                                    Nice work. It’s good to see someone else considering shell portability too.

                                                    While I generally target sh, I’ve added a configure argument to set the target shell, which gets used for invocations throughout the Makefile. A little wrapper script then loops through, tests in a series of shells (currently only dash, bash and mksh though), runs the test suite, and also compares the sha1 sums of all built files. The last part is mostly because the project is a shell library/toolset and part of that is a tool to “build” more distributable scripts from a source project, which it uses to build itself.

                                                  2. 1

                                                    I’m aware of bats, and by relation, the Test Anything Protocol. I think I’ll be digging into both of those a little more in the new year.

                                                    1. 2

                                                      There’s also https://github.com/kward/shunit2/, which I find quite helpful.

                                                1. 2

                                                  At some point wouldn’t all of the HTTP headers and the TLS dance use up more bandwidth than the contents of the website itself? :)

                                                  1. 2

                                                    It typically takes about 200-300 bytes to serve a single byte file. A few temporarily hosted examples:

                                                    So, yes, members of 0.4 KB club would indeed be using up more bandwidth than the content being served.

                                                  1. 3

                                                    I know this “N KB Club” meme is becoming trite now but someone asked for it, so this had to be done! :-)

                                                    1. 6

                                                      10 KB club is cringe.

                                                      – This post made by 1 KB club

                                                      1. 4

                                                        1K?! LUXURY! When I was young 12 bytes and a piece of cheese was all we ever needed.

                                                        1. 4

                                                          You try and tell the Electron users of today that, they won’t believe you!

                                                          1. 3

                                                            I’ll just put an end to this by registering the 1 bit club and implement the only two possible websites myself.

                                                      1. 11

                                                        I usually put these 23 lines in a blank ~/.vimrc:

                                                        syntax on
                                                        colorscheme murphy
                                                        set textwidth=72
                                                        set tabstop=4
                                                        set shiftwidth=0
                                                        set expandtab
                                                        set autoindent
                                                        set number
                                                        set hlsearch
                                                        set incsearch
                                                        set showcmd
                                                        set hidden
                                                        set ruler
                                                        set autochdir
                                                        set nojoinspaces
                                                        set wildmenu
                                                        set listchars=eol:$,tab:>-,nbsp:~,trail:~
                                                        set guioptions=ic
                                                        autocmd BufNewFile,BufRead *.md set filetype=markdown
                                                        autocmd BufNewFile,BufRead *.html,*.css,*.js,*.json,*.yml,*.yaml setlocal tabstop=2
                                                        autocmd BufNewFile,BufRead *.go,Makefile* setlocal tabstop=8 noexpandtab
                                                        autocmd BufWinEnter * syntax keyword Todo TODO
                                                        autocmd BufWinEnter * syntax match Error /\s\+$/
                                                        

                                                        My ~/.vimrc on my home system that I use for day-to-day activities is a little larger. Here is a copy of it: github.com/susam/dotfiles - vimrc.

                                                        On similar lines, I recently shared a small 50 line ~/.emacs helpful for quickly setting up a Common Lisp development environment here: github.com/susam/emacs4cl.

                                                        1. 2

                                                          +1 for syntax on. I know “I don’t NEED syntax highlighting” is the new cool thing to do, but I need every bit of help I can get disambiguating syntax!

                                                          Also wow I didn’t know about wildmenu. Thanks for that!

                                                          1. 2

                                                            It’s worse for me. At this point I get distracted by the highlighting. $work has a custom IDE, and ny first month there I found out how to turn off the highlighting.

                                                            1. 3

                                                              Brains and eyes are different. I’m partially blind so I need every single variation and hint I can get, and you get distracted. That’s why there’s a whole universe of tools and options :)

                                                        1. 2

                                                          Emacs Lisp and Common Lisp.

                                                          I have been teaching Common Lisp at a small online mathematics and computer science literature club (#spxy:matrix.org). One of the biggest hurdles while beginning to learn Common Lisp is that the popular books on the subject recommend Emacs and SLIME as the development environment. For someone unfamiliar with both of them, this can be quite a significant learning curve.

                                                          While there is Portacle to ease the initial effort to an extent, I am working on my own take on this problem: Emacs4CL. This takes a DIY approach to setting up one’s Emacs + SLIME development environment. It provides a tiny ~/.emacs file that shows how to customize Emacs and automate package installation. The accompanying README provides a line-by-line walkthrough of the entire ~/.emacs file to help a beginner to Emacs make an informed decision about which lines from the file to keep and which ones to discard in order to better suit their taste and preference. I did a Show Lobsters post too about it a while ago and the feedback has been good so far.