Med (Linux memory editor) version 3.6.1


I released version 3.6.1 for my hobby project, Med (Linux Memory Editor). There are several great changes in UI (since 3.5), especially the larger window, due to more components in the UI.

Named scans

Now it supports named scans (the bottom part of the window).

New UI

I create this named scans feature because sometimes I need to scan for several values of interested. For example, a game character A’s experience point and character B’s experience point. By using named scans, I can scan these two values without destroying the scan result of each others. This makes my (game cheating) life become much easy.

Improved memory editing

Memory edit

Memory editing is now improved with preview the values in int32, float32, and float64 (double as in C/C++). This is useful for me to discover the pattern surrounding the game character status. For example, there is a game I played, the character has non-rounded float32. This causes me failed to search the values for various trial. Lastly I found the address by scan unknown. By using these three values preview, I can discover the values easier without doing actual scanning.

Furthermore, memory editing now supports “entering” the value according to the scan type (the Enter button). In the versions prior to 3.6, memory editing can only directly edit the hexadecimal. This is troublesome to edit the float values. Previously, I have to create a new memory address in the stored list, then edit the value. But now, I can update the values directly.

Besides that, in the memory editing, it supports “string” scan type, for entering the string directly.
WARNING: Longer string may cause the memory overflow.
NOTE: Entering string is not null-terminated. Add the null (0) value at the end if necessary.

Lastly, I fixed the cursor in the memory editing (hexadecimal area).

Brave and Chromium


I have switched my primary web browser to Brave. But also found that Chromium (or any alternative web browser) is necessary. Since I am a software developer, sometimes need to implement ads related feature. Brave will block ads by default. That’s why I need an alternative web browser that I can freely to turn off the adblock. Though I can turn off the adblock in Brave, it will affect my browsing experience. As a result, using an alternative web browser for development on ads related feature is necessary.

Godot and C#


In my previous post, I wrote about my hobby project with Godot.

Limitations of GDScript

But I personally feel that, Godot script, namely GDScript, is not my favourite. Though GDScript is good enough to do anything, it is not what I like. Firstly, it is Python-like language. In my opinion, using indentation as scope is annoying, because I cannot auto-indent using Emacs. Due to my first programming language is C, and heavy use on JavaScript, braces (curly brackets {}) are easier to read.

Besides that, GDScript doesn’t have array operations similar to JavaScript, such as forEach. C# has List class with ForEach method. There are similar methods like map and reduce using LINQ.

Moreover, C# supports lambda expression. This is which GDScript cannot support. Even Python cannot do multiple lines lambda expression.

Comparing C# and GDScript, C# may be slower for development, but learning C# will be more useful than GDScript, as C# is a general purpose programming language. And C# has richer syntax.

Another reason I choose C# over GDScript is the testing. As a web developer, TDD (test-driven development) is a useful approach to make the product more stable. Development in GDScript doesn’t allow me to test my functions by writing test cases. If I choose C#, I can install Machine.Specifications (or MSpec) and Fluent Assertions through NuGet, then write the tests.

In fact, Godot supports native script using GDNative. This allows you to develop your module using C or C++ language. I like C and C++, but they are less efficient comparing to the modern programming languages. They are inefficient for development, as there is no garbage collection. Smart pointer is not garbage collection. However, C++ is acknowledged as best language for game development, according to Google Search.

Setup Godot Mono in Arch Linux

This section is Arch Linux specific.

Firstly, read this, and install godot-mono-bin. Secondly, install MonoDevelop and msbuild (msbuild-16-bin).

Once using Godot Mono to create a project, a solution file (.sln) and a project file (.csproj) will be created. These files are compatible with MonoDevelop. If you cannot open, probably you are using wrong version of msbuild.

To setup .NET Core in MonoDevelop, go to Edit > Preferences > Projects > SDK Locations > .NET Core, edit the location of the dotnet CLI as /opt/dotnet/dotnet, it will detect the SDK and runtime automatically.

Note: /usr/bin/dotnet cannot work, because it is a script.

Then, you can build your C# module using either MonoDevelop or Godot (Mono support). One great thing is, we can use both C# and GDScript together in the same project.

About NuGet

Unluckily, not every package manager acts like npm (Node) or bundle (Ruby). To install packages through NuGet, best approach is to use MonoDevelop.

Best web application framework I like


So far, in my opinion, Ruby on Rails is the best web application framework that I have used. Compared to others, it is very complete (by installing extra gems) and mature, provides everything that I need.

Version manager

There are two version managers: rvm and rbenv. I prefer rvm. It allows to work on different projects with different Ruby versions. Node has similar manager, nvm. Python has similar feature, but acts differently, using venv or virtualenv. In Python, we need to install the specific version, and create the environment by specifying our Python version. Contrarily, rvm or nvm will download and build the corresponding version.

Lambda expression

Ruby supports lambda or anonymous function, which can also be seen in JavaScript, as callback function. Newer languages such as C# and C++11 also support the syntax. The syntax is so useful when handling array. Python can support lambda expression, but it cannot support multiple lines like JavaScript.

REPL

Ruby on Rails has also very powerful REPL. With rails console, you can access the models easily, and manage the database through models.

Node can do similar, but it requires to write the script to setup the context. Meaning, we need to write the script so that REPL can access the controllers and models.

Debugging

Debugging in Rails can be done like client side JavaScript debug keyword, which require byebug gem. By using pry-byebug, we can debug the script line by line easily.

Migrations

Migrations and ORM in Rails simplify the development, as we need not to take care how the database should be structured, but focus on the models design, especially relationships like one-to-one, one-to-many, and many-to-many.

Migrations is commonly used in various web application frameworks, including .NET, Django, Laravel, etc. Node can implement migrations using sequelize and sequelize-cli.

Pagination

Kaminari gem allows to access the ActiveRecord with pagination related methods.

Serializer

By using ActiveModel::Serializers, we can make our JSON output more consistent.

Mailer

Mailer, which act exactly like Controller. And greatly, we can write preview page for the emails, in HTML or text.

CSRF protection

For the security, we can do protect_from_frogery to protect from CSRF.

BDD/TDD

Since we always need to test our code, BDD or TDD makes our development more stable and interesting.

By using rspec and factory_bot gems, we can do our testing easier, including mocking data and stub the methods.

Time travelling

Related to BDD, by using ActiveSupport::Time, we can test our code by specifying the date. Need not to use a date parameter through out all the function calls.

Job

We can do background job by using ActiveJob and also SideKiq.

Cache (SQL)

By default, the ActiveRecord (model) querying will use cache, example.

Drawback

Though Ruby on Rails is powerful, there is one limitation. There is no official support on Windows, which we cannot find the binary installation of the latest version of Ruby and Rails for Windows.

The only workaround for Windows installation is using WSL (Windows Subsystem for Linux). And this feature only available on Windows 10 and Windows Server 2019.

Meaning in older version Windows, probably needs to use virtualization like Docker or Vagrant. (I never tried before.)

Advantages

I prefer Ruby on Rails over Node, because Node has too many modules doing similar jobs, for example crypto-js and node-crypto-js. Too many options cause me to use extra effort to find out which one is better.

I prefer Ruby over Python, because of the lambda expression.

In my opinion, the advantage of Ruby on Rails is because of Ruby language itself.

To print the output, we can do puts something, instead of console.log(something) (JavaScript). Parentheses are optional to call the function, similar to Perl.

We can pass the hash to the function without braces, such as foobar(a: 1, b: 2). But in JavaScript, we need to do foobar({ a: 1, b: 2 }); in PHP, foobar(['a' => 1, 'b' => 2]); in Python foobar({'a': 1, 'b': 2}).

When developing using Ruby on Rails, we can apply Twelve-Factor and Design Patterns. We focus on code readability (using RuboCop), refactoring, and testing.

You can find a curated list of useful gems as well.

Godot and hobby project


Game engine

Previously I found a game engine LOVE (Lua language). Then I planned to learn about it. But then I read about Godot, which uses GDScript with similar syntax like Python. So, I choose Godot over LOVE because I have better experience in Python.

I planned to work on edutainment project since long time ago. Since I have extra time recently, so I invested little time on my hobby project. Using Godot, I revived my old project.

Godot provides a fantastic IDE. It allows to edit the UI, adjust any UI components easily. It provides almost everything I wanted: scene graph, everything is node, audio, video, texture, input, etc. The below is the screencasting of the auto play (with manual input) of the Tetris game.

(The new project is not open source.)

 

I am outdated

I like to play games (I believe everyone likes to play games). But most modern games are beyond my capability. There are several reasons:

  1. I am primarily using Linux.
  2. Not enough time to play game.
  3. I don’t have gaming computer.
  4. Though I like play story focused games like JRPG, I don’t like to invest time to collect items, level-up, etc, so I get used to use cheat engine (that’s why I created [memory editor](https://github.com/allencch/med)).
  5. Mobile games are mostly money-draining AND time-draining.

Because of the above reasons, I feel that it would be better for me to create my own game that fits my taste. Gaming of the 私, by the 私, for the 私.

The games that I love most are Dai Koukai Jidai 2 (大航海时代2) and Taikou Risshiden 5 (太阁立志传5). The reasons I love these two games:

  1. Not resource hungry like modern 3D games.
  2. Good story with the realistic history and background.
  3. Combination of JRPG, simulation (business), sandbox.
  4. Player can choose a protagonist from several characters. Each has its own story line, and they are in the same world.
  5. Realistic game play. E.g., earn interest from bank (Koukai2), monthly meeting and send gift to make friends (Taikou5), etc

I can’t find any other game that can fulfil the above conditions.

 

Bash history for each project


Previously, I tried to use zsh when I am working, so that my default bash history will not be filled with project related commands, especially git commands. Because some of my bash history are useful like ffmpeg related commands. So, I tried to distinct project work and non-project work with zsh and bash, so that they have different shell histories.

However, there are two problems when I use zsh,

  1. All my projects use the same zsh history. The old history may be lost if I have too many commands (depends on HISTSIZE variable).
  2. zsh is slow with git auto-completion.

However, zsh has one thing better than bash, that is, auto-completion navigation. Let’s say your directory has various sub-directories, double tab will bring to directory navigation that can be controlled with arrow keys. This is useful for me to navigate to non-alphabetic directories, like the directory with CJK characters.

Due to the slowness of git auto-completion as mentioned above, I decided to find an alternative solution, so that I can use bash instead of zsh, and separate the shell history from non-project work. At the end, I come out with this,

#!/bin/bash

# source any shell script, like rvm or nvm

touch "$PWD/.bash_history"
history -a
export HISTFILE="$PWD/.bash_history"
history -r
export PS1='\[\033[1m\]\u@\h \[\033[0m\]\w$(__git_ps1 " (%s)")\$ ' # custom prompt to differentiate from default prompt

So, add the above content to a file like init.sh in the project directory. Whenever starting with the project, run

source ./init.sh

Hence, the .bash_history will be saved and used in the project directory.

Firefox batch download extension: DownloadSelected


In my previous post, I mentioned about DownThemAll on Firefox 56. Now the latest release of Firefox is version 61, but there is no update of DownThemAll for Firefox Quantum support. Using older unsupported version like Firefox 56 is not a good idea, because there will have no security update. Firefox ESR 52 is slower than Firefox 56 as I have mentioned.

Since I have spare time recently, I spent some days to write a Firefox extension, DownloadSelected, to solve my problem.

DownloadSelected demo

The screenshot above shows a list of URLs, which I used Greasemonkey script to generate. Then highlight, right-click, and DownloadSelected. I don’t write any UI elements to indicate the download progress, but I put the progress to the console. Once the files are downloaded, they will be archived into a zip file and a Save As dialog will be shown. The source code can be found here.

This is not a replacement or alternative extension to DownThemAll, but this extension solve my fundamental problem. Main features are:

  1. Bulk download
  2. Download only selected text
  3. Downloaded filenames are based on HTML text instead of URLs
  4. Quantum and Google Chrome compatible