HNHacker News
TopNewBestAskShowJobs

tuhdo

785 karma · joined June 13, 2014

submissionscomments
tuhdo··on Ryzen 5800X vs. M1: Programming benchmarks
My FCLK is also set to 1867, so no decoupling there.
tuhdo··on Ryzen 5800X vs. M1: Programming benchmarks
Many other clickbait articles claimed that M1 is better than the best desktop class CPUs. I only tested the water and found otherwise. The 5900HX is planned and should be within 90% performance of my 5800X within 45W TDP. Not close to the power consumption, but then zen 3 is only on 7nm, while M1 is on 5nm.

The Mac Mini is $699 with only 8GB RAM, that runs out after a few browser tabs. So, for a work machine, you would need at least the 16GB model and add $200 to that. Though the build quality and the panel is excellent.

You could opt for the 5600X. The core count is not relevant in the article, as the benchmarks are mainly single-threaded.

tuhdo··on Operating Systems: From 0 to 1
Well, the "programmers" in operating system and embedded domains are usually electrical engineers who learned how to write code, just enough to apply their domain knowledge. A programmer in the usual sense, that is someone graduated from pure software school, will have a hard time competing with those people.
tuhdo··on Operating Systems: From 0 to 1
Thank you! I already put the book source online. You can use Lyx to edit the book source file.
tuhdo··on Operating Systems: From 0 to 1
Thank you. I will make a donation button once the book is relatively "stable".

About the sentence, sadly, but it is the trend.

tuhdo··on Operating Systems: From 0 to 1
Nice service! I didn't know it exists. Thanks.
tuhdo··on Operating Systems: From 0 to 1
Well, Org is suitable for small notes. But for the scope of this book, it's difficult to make Org work for such a complex layout (largely because I don't want to mess with the CSS).

I used Lyx because it enabled me to focus on the content without all the markup text. Writing Latex in Emacs can reduce the distraction, but not enough. I just wanted to focus on the content at the time. Learning Latex is difficult enough, learning how to use the major mode at the same time doubles the difficulty.

Obviously, I still use Emacs daily for writing code and other things. Just not for writing book.

tuhdo··on Operating Systems: From 0 to 1
Thanks. I will upload the source soon. As it is written in Lyx, not sure everyone will find it comfortable though. You can always open an issue in the meantime though.
tuhdo··on Operating Systems: From 0 to 1
Yes, I'm not native. For that reason I tried to use simple grammar and sentences, and did go through paragraph by paragraph through a grammar checker until the end of chapter 4. I will try to improve it gradually.
tuhdo··on Operating Systems: From 0 to 1
Hi, I would love to hear your feedback. It is the style or the correctness? I am really appreciate if you can show me the few incorrect usages of the grammar.
tuhdo··on Operating Systems: From 0 to 1
Thanks. I will fixed it.
tuhdo··on Operating Systems: From 0 to 1
Well, the book is not Linux-specific but only leverages Linux as a development environment.
tuhdo··on Operating Systems: From 0 to 1
In the Volume 3, it is said that:

"In protected mode, the IA-32 architecture provides a normal physical address space of 4 GBytes (2 32 bytes). This is the address space that the processor can address on its address bus. This address space is flat (unsegmented), with addresses ranging continuously from 0 to FFFFFFFFH. This physical address space can be mapped to read- write memory, read-only memory, and memory mapped I/O. The memory mapping facilities described in this chapter can be used to divide this physical memory up into segments and/or pages."

It correlates to my experience of developing in protected mode in QEMU. Once entered protected mode, I can access to any address above 0x10000 without being wrapped around. When I was writing my first kernel (https://github.com/tuhdo/os-study) in real-mode, indeed A20 must be enabled.

tuhdo··on Operating Systems: From 0 to 1
It is complete, if you finish the first 2 parts, which consists of 8 chapters. Then you can work on your own by reading the Intel manual volume 3 "System Programming Guide", or learning from OSDev wiki. The first two parts provide a foundation to use such resources, which I think is more important than a step by step guiding how to write an OS.
tuhdo··on Operating Systems: From 0 to 1
I graduated from that guide :) You can see the repo here, written entirely in NASM: https://github.com/tuhdo/os-study

The problem is that the guide is out of date in terms of toolchain, and you need to figure out many things by yourself, especially if you want to develop on Linux. My book helps you to understand how to learn and write x86 with Intel manuals (this is really important!), understand how to craft a custom ELF binary that is debuggable on bare metal, which in turn requires you to understand a bit of how debugger works.

Once you get gdb working, it is much easier to learn how to write an operating system.

tuhdo··on Operating Systems: From 0 to 1
Author here. Yes, it's a x86 operating system. However, rather than getting around A20, it focused on protected mode instead.

The book not only teaches x86, but how to use the official resources from the hardware manufacturer to write the OS. In sum, a reader when reaching part 3 for writing the OS, he will need to use the official document, in this case, the "System Programming Guide" manual from Intel to write C code that complies with the documents. Once he learned how to do so, learning other platforms will be much easier given how complex x86 is.

tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
So you can put it on the web for complete Emacs newbies to read rather than forcing them to learn Info reading. However, Spacemacs does integrate info+ that makes Info reading much more pleasant, along with helm-info command that I can say Emacs becomes the best info reader every.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
> Well, I didn't find how to make do without it yet, so I would rather stick with the word "critical" for now.

What is "make do"? Do you mean running make? Btw, Spacemacs can do the same with the feature I listed above. The different is just it doesn't display the tab by default and only show you when you need it. That said, if you want to try, open .spacemacs file, search "dotspacemacs-configuration-layers" and add "perspectives" (without double quotes) below any layer there. Then, use "SPC L s" to switch between "tabs" (the default one is "@spacemacs". Enter a non-existent name and you have a new "tab". The "tabs" are collections of related buffers. If you create any new buffer, it is local in an active "tab" only.

"SPC L n" to go to next "tab". "SPC L p" to go to previous "tab". "SPC L k" to close current "tab". "SPC L a" to add a buffer to current "tab".

> Oh, that's pretty neat. Actually, still not the same thing as command mode, because it seems there's some convention to chose the command first, and after pressing Enter passing any arguments interactively. Not that it's bad, but a bit different from how it's generally done in shells.

Well you need to forgo Vim for awhile and concentrating on Spacemacs way. Then going back and compare.

> Really? Uhm, no, not really. Actually you have to type :map (as in "key map"), and if you don't know what to type you type in :h whatever.

That's not the same thing. Try pressing "Control-h k", then press "SPC b s" you will get a command that is bound to the key binding. If you want similar thing to ":map", then press "C-h b" to show the interactive cheatsheet. If you are in a major mode, it shows all the key bindings belong to that major mode first and foremost, than maps of other modes (such as minor modes) below.

tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
He said that the Vim UI is good (aka the modal editing) but everything else is crap. So, Evil gives that interface and better platform.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
> However, `SPC b s` also doesn't what I was looking for. It opens a buffer, not a tab

If you are looking for workspaces i.e. organizing buffers into logical group, use Perspective: https://github.com/syl20bnr/spacemacs/tree/master/contrib/pe....

> And it doesn't even look for them in the cwd, but does I-haven't-figured-out-what-yet instead.

As another commenter suggested, you can use :cd. However, you can use a better interactive interface and use "SPC f f" or "SPC f h". Spacemacs is, after all, Vim + Emacs.

Emacs has that kind of visual tabs but Spacemacs does not integrate it since it gets in the way more than being useful.

> If you are wondering why that SPC stuff isn't the equivalent to command-mode with ":" bound to SPC: commands are easy to define even in vim, they can have descriptive names due to their nature and I don't have to remember them, as I can use auto-complete! For example, I have :Rename and :Remove. Actually, I don't even remember if it's :Remove or :Delete, I just use autocompletion every time I need it and find out.

That kind of auto-complete is really bare. If you want something like that, try pressing "SPC :" or "Alt-x" in Spacemacs. You can search in any order you like, not prefix, i.e. if you look for command "list-package", either "list pa" or "pa list" gives you the command.

I mean, in Vim, to get help for a key binding, I have to type something like "Ctrl+W". Really? In Emacs, you get it by pressing "C-h k" then press the key binding you don't know which command is bound to it. You even get a cheatsheet like style in Emacs. For example, if you don't know what the commands in "SPC f" does, simply press "SPC f ?" and you get an interactive cheatsheet that you can easily narrow donw. Press "C-z" to open its description.

tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
There's a reason it's called Spacemacs, not NeoVim and major features are centered around the SPC leader key. There are certain things you must learn from Emacs if you want to get the benefit of it, such as Emacs packages. To make it easier to learn, there's a popup with keys and commands there. If you press ?, it brings a cheatsheet like interactive window and you can narrow it down by start typing and press `C-z` to open each command description. For example, if you want to know what each command in `SPC f` does, pres `SPC f ?` then press `C-z` on a command and you get a description on upper window.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
Maybe you should learn the Spacemacs way (which is the combination of Vim and Emacs) rather than expecting it the Vim way. To create new buffer, `SPC b s` and enter new buffer name. To change directory and get into it, use `SPC f f` or `SPC f h` depends on your preference.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
> * Toggling if search results should be highlighted (:set hls, :set nohls)

After you search, you get persistent highlighting. To turn it off, "SPC s c". All the toggling features are in "SPC t" group.

> * Opening the filename under the cursor in a new window (^W f)

`SPC f h` then press `C-c o`. The key bindings are consistent in other Helm commands as well. It opens a window side by side. Nothing is misisng, sorry. Spacemacs can even do things like [these](http://tuhdo.github.io/helm-projectile.html).

If you have any question, ask it on Spacemacs chatroom: https://gitter.im/syl20bnr/spacemacs

tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
Here is your tutorial, from a Vimmer: http://ian.mccowan.space/2015/04/07/Spacemacs/
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
> - The Spacemacs doc is on their repo, not in Emacs! (except if you manually fire a buffer with SPC f f ~/.emacs.d/doc/DOCUMENTATION.md)

You can explore the doc for each layer by "SPC f e h". You can even jump to source from there.

> - Emacs has an interactive interface for editing configuration variables. You will arrive to this interface from the Emacs doc, but it does not have Spacemacs-like keybindings and I'm not even sure it's supposed to work with Spacemacs

Everything that works in stock Emacs should work in Spacemacs. Stock Emacs key bindings are always there. Spacemacs stuff, as its name implies, is in the SPC key.

> - I could not find the doc for ex/vim commands. I suspect there is no equivalent to ":h :foo"

I think it should exist. Maybe you need to ask the gitter chatroom. Stuffs like s/foo/bar works for me. However, even NeoVim wants to remove it: https://github.com/neovim/neovim/issues/1089

> - In vim, it is possible from any mode to get back to the normal mode by typing 'ESC'. In Emacs, C-g aborts a keybinding. However those two are not unified by Spacemacs.

You do it with evil-escape: https://github.com/syl20bnr/evil-escape, which is built-in Spacemacs by default and press "fd to escape everything. You can change it to anything you want.

> - I use vim with several buffers. However launching "emacsclient -t foo.txt bar.txt" will open them sequentially, and I can not use :n / :N to go back and forth.

The next version you can use "SPC b n" and "SPC b p" to go back and forth. However, you can use "SPC b s" to switch between buffers and press "C-c o" to open another window side by side. To split window, use "SPC b -" to create a window below and "SCP b /" to create a window right. Jump to each window based on the number on its modeline, i.e. "SPC 1" jumps to window 1, "SPC 2" to jump to window 2.

> - The fact that there are several interactive interfaces for switching buffers and/or opening files is confusing. Typing a file-name in helm-mini creates a "fundamental" buffer that is not a file. I lost some work because of this.

It's a feature. It means that when you switch to a non-existent buffer, you can press RET to create it. It's quite handy to create a scartch buffer of a specific major mode. If you want to open a file, don't use a command that open buffer but a command that open files. I believe in Vim I can create empty buffers.

tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
I'm pretty sure you can do the same thing with expand-region and smartparens combined and is more general than manipulating sexp.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
It's not for Vim anymore but can adapt to many editing styles.
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
Well it's still in Beta though but I must say it's still excellent. This is from an Emacs user, currently using holy-mode (basically another way of saying Emacs mode in Spacemacs terminology and it's actually a mode configured for Emacs users).
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
Also, if you have problems, ask the community: https://gitter.im/syl20bnr/spacemacs
tuhdo··on Spacemacs – Emacs advanced kit focused on Evil
Great that you are a Spacemacs user now and glad that you like my tutorials.

So, could you be more specific about how vim-sexp works? If you want to visual select sexp from symbol and expanding outward, uses expand-region: https://github.com/magnars/expand-region.el. Same for string. Then you can use smartparens: https://github.com/Fuco1/smartparens to wrap around by simply pressing "(". It is all in Spacemacs now, and you can explore further with evil-lisp-state commands, bound to ", k".

Page 1 of 5Next →