You might think you have dodged a bullet
But you weren't the one getting shot barbarically
Statically, you'd not moved an inch since you were born
Thinking others are doing the same, harmonically
You can't see beyond the tip of your nose which can only go so far
But the others were moving ahead; evolving naturally
Thinking not to worry, everything is under control
But things were getting out of your grasp, gradually
I've been switching to Emacs packages which are lighter and use the internal Emacs system,
instead of creating their own. This time I wanted to try
Flymake, the syntax checker that comes with Emacs. At
first it wasn't very appealing because I thought it would only show the error on mouse hover! So I tried to see what options I
have for displaying the error messages when text cursor moves over them.
I was looking for a way to transliterate(translate) English numbers to Persian numbers in Go.
Such functionality is usually found in programming languages, but I wasn't expecting too much from Go.
It's very easy to do in Raku:
say 567.trans: '0'..'9' => '۰'..'۹'
=output ۵۶۷
say TR/0..9/۰..۹/ given 567
=output ۵۶۷
For Go I found xstrings module which has a
Translate
function. But the solution I came up with was using
NewReplacer
function from Go's internal strings
module:
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.NewReplacer(`0`, `۰`, `1`, `۱`, `2`, `۲`, `3`, `۳`, `4`, `۴`, `5`, `۵`, `6`, `۶`, `7`, `۷`, `8`, `۸`, `9`, `۹`).Replace(`567`))
}
Go playground link
After I finished watching Daniel Sockwell's FOSDEM 2022 Raku
presentation, I thought this is a good opportunity to play with
Raku's slangs, something I hadn't done before.
What is Daniel's talk(and upcoming module) and my module going to solve?
- Write less but more readable test code
- Get a useful test description and failure message
If you use cmp-ok
, you get a good error message; but without a test
description it's sometimes hard to understand. Also cmp-ok
and other test functions(most of them, use-ok
being an
exception for example) do not output anything on a successful test, unless you provide the description yourself. I
personally think that test sub routines should generate a description if one is not provided. But of course that
cannot be done with simple functions. Maybe the Test module needs to be rethought in the future?
When I created my Raku programming language website with
Hugo static site generator, I had to manually create the syntax highlighted
html files for code examples shown in the front page, because Hugo used
Chroma(written in Go and uses a
mostly similar API to Pygments) for syntax highlighting which didn't
support Raku. So I opened an issue on Chroma, the discussion showed that you cannot just convert
the Raku lexer from Pygments to Chroma; You would need to create some functions manually, and
Chroma needed a new Emitter
interface which would take the LexerState
as an argument, because
Raku has some complex syntax; the Raku lexer in Pygments had functions for finding closing
brackets matching the opening brackets, and for regex nesting in tokens
, regexes
and
rules
. In the end I realized functions for token nesting were unnecessary.
Recently I forked the flycheck-raku (by @widefox) to the Raku GitHub organization.
And did some improvements to it and published it on melpa, so others can easily install and update it.
For those who don't know, flycheck is a tool for syntax checking Gnu Emacs buffers.
You can install flycheck-raku using use-package:
(use-package flychek-raku :ensure t)
Previously if you used flycheck-raku
on a project, it would show errors on use SomeModule;
,
even though the module was in the lib
directory of the project. And this would make flycheck
kinda
useless, because it wouldn't show further errors.
I wanted to create something that makes it easy for me to see movie ratings.
I decided to create it as a SPA. In order to do so, I had to find a good framework.
I looked at a few well known frameworks, but did not like any of them!
I was going to give up, but then I saw Elm.
I had seen it being mentioned here and there, but I had never looked into it.
So I decided to give it a try and started reading the
guide and the docs.
I liked what I saw, so I did a bit more reading before starting the project.
App::Football is a command line program I wrote in Raku.
football
lets you access information regarding football(soccer!) teams, leagues, tables, fixtures, scores and players.
It uses another module I wrote called WebService::FootballData which is a Raku interface for
football-data.org API.
To install App::Football, you need to first install Raku
and Zef, then run:
zef install App::Football
The README file has some useful examples,
but here are more examples and screenshots:
football --team=bayern --fixtures --timeframe=p30 --venue=away
Raku programming language uses some unicode characters as operators, quotation marks, etc.
In this post I'm going to explain how to type those characters in Emacs using
input methods.
First, you might want to see a list of those characters and their ASCII equivalents
here.
There is also a doc for entering unicode characters.
You may specifically want to look at XCompose for a system-wide solution.
There are at least two input methods you can use to enter the unicode characters used in Raku.
rfc1345 and TeX.
Magrent 1.0 adds context menu items to torrent info hash(when hash is selected) and The Pirate Bay torrent pages and links.
Changes in this version:
- Add support for The Pirate Bay torrent URLs and links
- Add context menu items for torrent info hashes
- New design for Magrent panel
- Use new action buttons(Australis) with backwards compatibility.
- New icon
- Notify user when torrent source is not accessible.
- Add torrent source name to the notification title
For a long time I'v wanted to push my Parser project which was a university project for Principles of Compiler Design course to GitHub. Now I’v found the time to do it and you can download it here.
2 years ago I started learning Perl, soon Perl became my favourite programming language. It was then that our professor gave us the scanner project for C language. He told us that we can use the programming language of our choice. We were also allowed to use regular expressions. So I thought Perl is the best language for writing the project. In a month I read Learning Perl book and other necessary stuff and became ready to write the scanner. Scanner was my first Perl project. When I gave the project to professor, he said that I was the first person who has written the project in Perl :)
I had Arch linux on my computer and needed Windows for gaming; Windows installs its own boot loader, so I had to re-install grub. The following is what I did to restore grub.
I suppose that you know what you're doing! For example you need to know in which partition linux is installed.
Boot Arch linux from live CD.
Create a directory for chroot environment:
Mount the root partition and other necessary device and file systems:
About a month ago I decided to try a new linux distribution. I was using Ubuntu and was even waiting for Ubuntu 12.10. I chose Arch Linux for testing, and Installed it on my netbook. I really liked the installation process! Then I chose Xfce as Desktop Environment. After a few days I decided to move from Ubuntu to Arch Linux.
When I read an article about a window manager, I was reminded of Tiling Window Managers so I decided to check window managers before moving. After some reading and comparing, I chose xmonad as my window manager.