27 November 2022

Why a Macbook is no longer good for Linux programmers

I have relatives who use a Mac because somebody told them it's a good quality product or because they want to go with the brand-hype created around the Macbook. I understand brand-craze or the desire for a product that makes one feel good or something that offers the right features. So if a programmer is comfortable with (and actually wants) a Macbook (after evaluating if it’s really going to help be productive), let them buy one. The rest of them would be more-than-happy with any other good computer which has Linux installed. For non-technical people who don't understand why many Linux programmers abhor the Macbook, I'm listing out the reasons here so that you don't inadvertently purchase them a Mac, thinking you are doing something nice for them (there was a time when I heard a relative was planning to buy me an expensive Apple product for my birthday, and I promptly sent back a message through the grapevine that I'm not fond of Apple products).

Linux is not Unix.

There’s no more of the “good build quality” that was once synonymous with Apple. There’s no more of the good design decisions either. 


I’ve used Mac’s for almost four years, and the only thing I’ve liked about it is the absolutely amazing display quality. Besides, for programmers who work on Linux, it’s far better to have a computer that runs Linux and has a hardware architecture that is compatible with the software they commonly use.

Reasons not to use a Macbook

  • No Type A USB ports: This is by far the biggest horribly deranged decision that Apple has taken. Not having Type A USB ports means that you can’t use your existing pen drives or mouse unless you buy a Type C USB 3 adapter. What drove this decision? Greed?
  • No cut and paste in Finder: You can’t right-click to cut a file and paste it. You are expected to copy it to a destination folder and then come back and delete the original file. There is of course a shortcut, and you can drag and drop the file to move it, but somebody in Apple doesn’t seem to understand good engineering.
  • Hardware architecture changed: Macbooks now have an ARM-based architecture. I’ve already had trouble compiling certain programs on it. I've also had trouble building some Docker containers that used x86-based programs, because of this underlying ARM architecture.
  • Glassy monitor: Even when I turn the monitor away from any windows, and it’s facing a wall, I still see my own reflection and the wall on the monitor. Constant glare.
  • Key functionality like Home and End don’t work: There are keyboard shortcuts for the Home and End buttons, but they don’t work when using the Terminal. They’ve also wrongly named “Backspace” as “Delete”. Programmers use Home, End, Del, Page Up, Page Down, and Backspace a lot. Not having these keys tends to get frustrating.
  • Caps-Lock and other keys sometimes not detected: This is one example of the poor build quality. When I press the caps-lock key, the key press does not always get registered. The same happens even for the Ctrl and Command keys. This is on a brand new Macbook.
  • Ctrl sometimes; Command sometimes: In Linux, a lot of functionality just uses Ctrl+some.other.key. On Mac, it’s sometimes Ctrl and sometimes Command. I know the functionality can be changed to some extent in settings, but it doesn't always work out the right way. Why did Apple have to meddle with such a basic functionality?
  • Terminal not available on right click: For a programmer, one of the little pleasures in life is to open up any folder, right click on an empty space there and open a Terminal. That’s not available on Mac. It can be enabled, but being disabled by default shows that a Mac is clearly not designed for programmers. There are more terminals that can be installed.
  • Headphone not detected on startup: I keep my headphones plugged in, and when I start the Mac, sound plays through the default speakers. Only when I disconnect the headphone jack and re-connect it, the sound is played via the headphone. An example of poor testing procedures.
  • Vim lazy exit won’t work: The vim editor has a shortcut for saving and exiting. You can press Esc and then Shift+ZZ. It’s called the “lazy exit”. On a Mac, if you’ve opened a file using sudo, the lazy exit won’t work. You’ve got to use the “hard-working” exit ;-) Esc, wq!. Or Esc, x.
  • Keyboard backlight not available at login screen: Yet another example of poor testing. At the login screen, the keyboard backlight does not turn on.
  • psutil won’t work without sudo: This is meant to protect programs from accessing other program’s memory, but it’s really annoying that if I’m using a Python program that uses psutil, I’m expected to run the program each time as sudo python3 prog.py and type the password. The least that the designers of the OS (Operating System) could have done, was to provide a modal box that asks and marks a program as trusted, so that Users won’t have to keep using sudo.
  • psutil functions like io_counters not available: So if I want to create a Python program to measure network I/O, it’s not easy. Wonderful.
  • bashrc and profile don’t work: Apple shifted those files to /etc/profile, so it’s only after a lot of searching that you get to have your aliases and startup scripts work. Then after restarting, you realize that even that doesn't work. Use ~/.zshrc.
  • Barely any good default favourites in Finder: Normally, it helps to have commonly used folders like Home, Downloads, Desktop etc. in the Finder favourites pane on the left by default. But no. You are expected to drag and drop them to create it.
  • Icons don’t auto-align in Finder: Even setting the icons to snap to grid and making it the default for all, won’t make it work for all folders.
  • Properties being “Get Info”: In Windows and Linux, when you want to see the properties of a file, you right click and find the properties option at the bottom of the menu. In Mac, you’ve got to adapt to recognizing it as “Get info”, and it’s not at the bottom of the menu. Nice in some ways, but annoying in other ways.
  • Workspaces need work: Being able to use Ctrl+Alt+Arrow keys to switch between workspaces is one of the pleasures of using Linux. Mac OS seems to allow it only if you go to settings and enable it. Moreover, the “hot corners” tend to get confusing when one accidentally takes the mouse pointer to one of the corners and all windows suddenly disappear.
  • Can’t dual-boot Linux natively: On modern Mac’s that have a silicon chip, you can’t install a dual-boot Linux OS on the Mac anymore. Great way to create a monopoly and drive away people.
  • Bash history not enabled by default: There are plenty more people asking about this. It was a silly decision not to save history...and then make it even more difficult to find the right options to enable history.
  • Exit does not exit: If you select the "Quit" option from the menus on the top right, the application does not actually quit. You are expected to go to dock and right click and exit. This gets annoying when using apps like GEdit, where if it's opened from the terminal, you can't proceed unless it has fully exited.
  • Shutdown does not shutdown: Select shutdown from the menu, and the Mac does not shutdown. You have to select shutdown again for it to shutdown. Who are these people ruining the Mac UX?
  • Updates downloaded for different version: I was shown update suggestions for some software and a suggestion for upgrading to the next version of MacOS. I didn't want to upgrade, but I decided to update the other software. So I start the time-and-resource-consuming 1.5GB update and lock screen. I come back after a while to see that the downloaded update encountered some error. After another try, I realize that these updates are meant for the next version of Mac OS. Why on earth did it download before the OS was upgraded? Such large updates even for installed software are another issue with Apple.
  • Renaming is a pain: Right click to rename a file or folder, and even though the name is shown as highlighted, when you start typing, you realize that the text isn't getting edited. Then you have to right click or click again to make it work. 
  • Pointless audio previews: If you click the middle of a video file, it starts playing the audio from the file, when you just wanted a video player to open the file. So you have to be careful to click at the edge of the file icon. Who designed this usability nightmare?

There may be more points I’d include soon. Linux is far more customizable and programmer-friendly. Do a favour to your Linux programmers, and give them a computer that has Linux installed natively. It is especially helpful when they need to test locally and deploy onto Linux-based servers. There's more discussed on Workplace Stackexchange.

03 November 2022

Adjusting subtitles of a video

 

Many of us have been through the annoying feeling of viewing a video where the subtitles are off by one or two seconds. This is especially true when it's a foreign language video, and the subtitles are extremely important. Have you ever thought of using a software to adjust it? Well, there are plenty of them.

I tried Gnome Subtitles recently, and under the "Timings > Adjust" menu option, I could shift multiple selected subtitles by the number of seconds I wanted to adjust them (make sure the name of the video and the subtitle file are same, in order to ensure that the video opens up automatically when you open the subtitle file). Quite a handy tool! For more recent versions of Ubuntu, you can use many other software, including KDenLive.

You can also adjust subtitles using VLC or FFMPEG.

The SRT file

Although called "SubRip" files, the SRT stands for SubRip Text (in web format, they are Subtitle Resource Tracks). The time that each subtitle should be displayed is represented as <hour>:<minute>:<second>,<millisecond>. There's even support to specify the font colour, font style and even the coordinates to display the text at.

Generating subtitles

There are people whose jobs involve performing audio transcription. They'd listen to audio, type in the text and the time at which the text appears. The process is very cumbersome because they need to constantly move forward and backward along the audio track, while needing to type what they hear. This means their hands are always occupied. So some enterprising individuals decided to create a foot-operated pedal which the transcriptionists could use to control the audio playback. The pedal allowed them to rewind, pause, play or fast forward.

Of course, today there are machine learning algorithms which detect speech and automatically generate subtitles. Even if the transcription is incorrect at places, it's easier for the transcriptionist to fix it. 

I'll leave you with an amusing "interview" of a person who is quite confident that he does not require subtitles.