Sunday, September 17, 2023

Rift on Linux: A Decade Later


It's been almost a decade since I last tried running Rift on Linux. Back then, the experience was sluggish due to state of Direct X emulation.

However, I recently decided to give Rift another go, since it's now available on Steam via Proton. To my surprise, the performance was perfect! Steam has packaged the emulation so well that almost all of my games run smoothly.

What a difference a decade makes for gaming on Linux!




Running well on the potato APU 



Sunday, February 19, 2023

Enabling TRIM in Virtualbox VM

I'm back to using Linux as a desktop for the umpteen time since the days of RedHat 5.2. This time it looks like I might just stick to it since it finally feels "right" as a desktop (most importantly my Windows games and apps runs under Wine).  

This time Linux feels right as a desktop.

One of the first things after moving is to install Virtual machine manager for development.  In goes Virtualbox, and then tried to "fstrim -v /" and got "discard not supported".

Turns out that discard has to be explicitly turned on using "VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --device 0 --nonrotational on --discard on"





Friday, November 4, 2022

using UMT to create virtual machines using Apple Virtualization on M1 macbook

 

I'm documenting this mostly for myself so that I the steps to redo if I forget.

Background:

Setup up VM using Apple Virtualization (as opposed to QEMU) using UMT https://mac.getutm.app/


We need  ARM64 versions of:

1) linux kernel

2) ramdisk

3) linux image

I use Ubuntu and the cloud images has all the items ready for use.

Linux Kernel file

in https://cloud-images.ubuntu.com/jammy/current/unpacked/

Look for "jammy-server-cloudimg-arm64-vmlinuz-generic" and download

rename the file to gz and gunzip the file.

```mv jammy-server-cloudimg-arm64-vmlinuz-generic jammy-server-cloudimg-arm64-vmlinuz-generic.gz && gunzip jammy-server-cloudimg-arm64-vmlinuz-generic.gz```

Ramdisk

Look for " jammy-server-cloudimg-arm64-initrd-generic" and download

Virtual Disk Image

Download image file from https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.tar.gz   and untar the file






Optional: resize img file  

(This assumes you already have qemu installed via brew)

If you want to add additional 80G to the disk space for example.

```/opt/homebrew/bin/qemu-img resize -f raw jammy-server-cloudimg-arm64.img +80G```


Obtain iso file for cloud init



My personal setup

system login credentials are baked into user-data.yaml

which builds an iso file called 'seed.iso'. which will be used for below instuctions.


alternatively for a basic one see this version

additional reference : https://github.com/frederickding/Cloud-Init-ISO


Finally, set up VM

Launch UTM

1) Add VM
2) Select Virtualize


3) Select Linux




4) select Apple Virtualization
5) Uncompressed Linux kernel select "jammy-server-cloudimg-arm64-vmlinuz-generic"
6) Linux ramdisk select "jammy-server-cloudimg-arm64-initrd-generic"
7) Linux Root FS image select "jammy-server-cloudimg-arm64.img"
8) boot iso select "seed.iso" ( for user and package provisioning)
9) boot argument enter :    console=hvc0 root=/dev/vdb (depends on the order of your storage devices, in this instruction /dev/vda is the iso file, and dev/vdb is the disk)
10) continue and set the rest of the VM resources or leave it default, 












11) save, then start VM

12) you will see a prompt, shortly, the cloud init scripts will update, provision the user and my cloud init will restart system 







13) log in with configured user  and verify diskspace ```df -h```
as with the hyper-v version, I don't seem to require to resize2fs













Sunday, October 31, 2021

Error building gotk3 in Msys2 [Golang]


While building Go program that requires Gotk3 under Msys2, this error may appear during the build.

go build github.com/gotk3/gotk3/gdk: invalid flag in pkg-config --libs: -Wl,-luuid

Run this command to fix the misconfiguration in the packaged gdk PC file and rebuild.

bash -c "sed -i -e 's/-Wl,-luuid/-luuid/g' /mingw64/lib/pkgconfig/gdk-3.0.pc"

Saturday, July 31, 2021

Hyper-v integration with Debian: how to get IP address via powershell

For powershell query to obtain network adapter information of the Debian Buster vm I've installed,

I need to install hyper-v daemon 


```sudo apt-get install hyperv-daemon```


Powershell will be able to query the network information  once it's installed in the guest.

get-vm | ?{$_.State -eq "Running"} | select -ExpandProperty networkadapters | select vmname, macaddress, switchname, ipaddresses


VMName   MacAddress   SwitchName     IPAddresses

------   ----------   ----------     -----------

buildVM 00155D7B6A07 Default Switch {172.25.28.124, fe80::215:5df0:f37b:6a07}

Friday, August 2, 2019

tailing mongo oplog with Perl

I haven't used Perl for over a decade, and I recently got curious to see  how Perl is with respect to the popular languages like Go and Python. Turns out Perl is far from stagnant with nice stuff such as carton package management.

As a practice I decided to try tailing the mongo oplog with Perl. I've written the code with Go and Python to deal with Mongo oplog  not long ago so it's still fresh. Turns out it's fairly easy to do for Perl


Fun!




use MongoDB;
print "hello ";
use feature ':5.10'; # for say
use Data::Dumper;
my $mongo_client = MongoDB::MongoClient->new(host=>'192.168.106.195',port=>7017);
=begin comment
obtaining oplog from "local" db
Every mongod instance has its own local database,
which stores data used in the replication process,
and other instance-specific data. The local database is invisible to replication: collections in the local database are not replicated.
=cut
my $db = $mongo_client->get_database('local');
my $ops_col = $db->get_collection('oplog.rs');
my $cursor = $ops_col->find({});
$cursor->tailable_await(1);
while(true){
say "polling\n";
while ( my $doc = $cursor->next ) {
say Dumper($doc);
}
sleep(2);
}

Saturday, January 14, 2017

Tiny-DNN: Development "as fast as possible" guide

I'm writing this as a simple instruction/refernce to get started using Tiny-DNN to build stuff as fast as possible.

I'm doing this on Ubuntu on Windows 10, Any recent Ubuntu system should have similar if not the same methods of starting.

if you don't have cmake and the gnu c++ compiles:
sudo apt-get install build-essential
sudo apt-get install cmake

(Optional)
if you want to build tiny-dnn with Intel Threading Building Blocks:

sudo apt-get install libtbb-dev

1) clone repo:

git clone https://github.com/tiny-dnn/tiny-dnn

2) Build
cd tiny-dnn

the most simple option is
cmake . 


If you're building with TBB then:
cmake -DUSE_TBB=ON

the build should end with no errors.


3) Building a program:

create a simple program 

for my system, I have to add "#include " to get the program to compile or it will start emitting build errors such as:




I'm going to use one of the sample code in the documentation that constructs a MLP.

// filename: sample.cpp
#include 
#include "tiny_dnn/tiny_dnn.h"
using namespace tiny_dnn;
using namespace tiny_dnn::activation;
using namespace tiny_dnn::layers;

void construct_mlp() {
    network net;

    net << fc(32 * 32, 300)
        << fc(300, 10);

    assert(net.in_data_size() == 32 * 32);
    assert(net.out_data_size() == 10);
}
int main()
{
        construct_mlp();
}

once done compile it (/mnt/e/linuxbuild/tiny-dnn being the directory that was cloned from github and built in #1 and #2)

g++ -pthread -std=c++11 -I /mnt/e/linuxbuild/tiny-dnn sample.cpp

The compiler should build a.out binary successfully.



Monday, September 14, 2015

Using Android Support V7 Appcompat on Eclipse

Had an interesting request - customer wanted to convert the Android Studio project to Eclipse - I did that and found a couple of weird errors including:


error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

when importing the Android Support V7 AppCompat library into Eclipse. The solution is fairly simple!

Just change the Android SDK to 23 (the latest/ Right click on appcompat project and click on Android, choose Build) and the errors will be gone.


Tuesday, June 30, 2015

SocketIO on Windows



I found recently that I was unable to install SocketIO on my Windows development platform.

The installation will throw out some errors.

It turns out that EngineIO on npm is the older version and will not work with SocketIO.


The workaround is to :


npm install Automattic/engine.io-client --save
on your local node project.

SocketIO will work after that.

Wednesday, June 10, 2015

Babel NodeJS Starter project

This is a starter skeleton NodeJS that I built for my use. I hope you will find it useful as well.
The ES6 files that you write will reside in ES6 folder:
Do note that you will need to append the suffix "-ES6" to your file. For example
hello-ES6.js
gulp watch will pick up the change and transpile it to ES5 in ./dist folder.
the gulp file resides in the ./gulp folder.
Issue 'gulp build' to rebuild all files. 'gulp clean' removes the entire dist/ directory 'gulp watch' will compile files that are newly created or modified - this is the option that you would want to issue when coding as it will run in the background and automatically pick up any changes.
There are some sample ES6 files in ES6 folder and a sample index.js file to test the transpile.
The requirements for this are :
  • NodeJS
  • Gulp
  • Babel
In this cloned repository: issue
'npm init'
Node will download the required modules.

The location of the code is:

Friday, May 1, 2015

Monogame 3.4 SDK templates( Visual Studio 2013) not found after installing

I've installed Monogame SDK under a normal user account. The installer prompted for an administrator account and correctly detected that VS 2013 is present. 

Once done I was unable to find the templates in my normal user account, turns out that the templates were installed in the
  Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#

directory. Copy the files into the same directory structure in the normal user account and the project templates will show up.

Sunday, October 12, 2014

Windows GIMP 2.8.14 + Wacom bug

The current version of GIMP for Windows has a Wacom bug, if you're using the tablet to paint, you may find that the brush lags heavily.

The bug is identified in libcairo2.

To work around, you can install an older version of GIMP, copy out libcairo-2.dll, libpixman-1.0.dll and libpng15-15.dll and overwrite those in 2.8.14


Bug is here:

https://bugzilla.gnome.org/show_bug.cgi?id=736220

Saturday, August 9, 2014

Android Studio - Failed to load JVM DLL message

If you have a fresh installation of Android Studio, you may find it  not able to start with the error "Failed to load JVM DLL" dialog; despite having a proper JDK and JAVA_HOME installed.



You will need to install Visual C++ 2010 x64 runtime found at:

http://www.microsoft.com/en-us/download/confirmation.aspx?id=14632

That should resolve the launcher problem.


Saturday, July 19, 2014

Workaround for Linux+Wine to fix games screen that is too big for display

If you've set your game(World of Warcraft for me) to run at a lower resolution than your current  desktop resolution in Linux, you may find that there will be a viewport showing part of the game and you have to pan around with your mouse.

It's a little ... annoying.

It happens to both my ATI card and Nvidia card running proprietary drivers.

This hasn't always happened. Version 1.0 of Wine for example doesn't exhibit this behaviour.


The workaround is a little clunky; before running the game, use xrandr  to check the available modes and then use xrandr to set the game resolution

e.g. launching a terminal and running xrandr:

chocobo:~$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
DVI-I-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-I-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080      60.0*+
   1680x1050      60.0  
   1280x1024      75.0     60.0  
   1152x864       75.0  
   1024x768       75.0     60.0  
   800x600        75.0     60.3  
   640x480        75.0     59.9  
HDMI-0 disconnected (normal left inverted right x axis y axis)

It shows DVI-I-1 connected on my setup, so if my game runs at 1024X768, I'll run the command

xrandr  --output DVI-I-1  --mode 1024x768 


The desktop will resize to this resolution.

Start your Wine game. It should fit the viewport on your monitor.

Once you exit, set the resolution back to the default desktop setting:

 xrandr  --output DVI-I-1  --mode 1920x1080




Tuesday, July 15, 2014

2D Maze generation: Java code using Growing Tree algorithmn

Ported the maze generation Python code found in
http://pcg.wikidot.com/pcg-algorithm:maze to Java as a coding exercise.

""You are in a maze of twisty little passages, all alike."
-Adventure"

You can find the code on Github :

https://github.com/rebooting/Growing



Sunday, July 6, 2014

Updating Rift to use Glyph Launcher on Wine

From July onwards, Rift game will be launched from the Glyph Launcher.

If you are using Wine to run Rift,  the Rift Launcher will attempt to install Glyph and may crash out. The fix is quite simple:

Set Wine to emulate XP. The installer will run successfully. I did not have any luck using Vista as suggested by some.



Add a new shortcut to the GlyphClient.exe found in C:\Program Files\Glyph\GlyphClient.exe to your PlayOnLinux drive and launch it.

It should find Rift and you can go ahead and patch or play it!




Thursday, June 19, 2014

The shy Ion-Delete-Button in Ionic Framework

Took me a while to figure this out. I was trying out Ionic framework for one of my mobile side projects. The learning curve was fairly low if you know a bit of AngularJS-- I got stumped on a simple UI issue however.

I wanted to put a delete button beside the items of my list so my code was like:

<div ng-app="jsApp">
    <div ng-controller="Ctrl1">
        <ion-content>
            <ion-list >
                <ion-item>
                    <ion-delete-button class="ion-minus-circled"></ion-delete-button>Hello, list item!</ion-item>
            </ion-list>
            
        </ion-content>
    </div>
</div>




Hmm.. where's the delete button? Turns out you had to use show-delete="1" directive in the tag.


<div ng-app="jsApp">
    <div ng-controller="Ctrl1">
        <ion-content>
            <ion-list show-delete="1" >
                <ion-item>
                    <ion-delete-button class="ion-minus-circled"></ion-delete-button>Hello, list item!</ion-item>
            </ion-list>
            
        </ion-content>
    </div>
</div>






the source code http://jsfiddle.net/rebooting/5BSNE/

That being said I enjoyed using Ionic Framework a lot, it's a very clean framework.

Wednesday, June 18, 2014

Stop command from being commited to BASH History

I haven't seen this in the older bash environments before so I guess it must be fairly recent. To prevent commands from being committed to history, simply add a space in front of the command. 

Couldn't be more simpler!



Monday, June 16, 2014

Golang: Serving static content using Gorilla

Using the identical directive from ServeMux  "http.Handle("/static/", http.FileServer(http.Dir("./static/")))" for Gorilla to serve static files wasn't working - the directory listing works but clicking on any of the files listed would produce a 404.

There seems to be two ways to configure the mux to serve static content in Gorilla Mux(highlighted in blue)

package main

import (
    "github.com/gorilla/mux"
    "net/http"
)

func main() {
    r := mux.NewRouter()
    r.HandleFunc("/", HomeHandler)

    //This won't work
    //http.Handle("/static/", http.FileServer(http.Dir("./static/")))

    //These will work
    //first alternative
    http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))


    //second alternative
    
    r.PathPrefix("/images/").Handler(http.StripPrefix("/images/",
            http.FileServer(http.Dir("images/"))))
    
    http.Handle("/", r)

    http.ListenAndServe(":3000", nil)
}

func HomeHandler(rw http.ResponseWriter, req *http.Request) {

    rw.Write([]byte("You are at /"))
}







Thursday, June 12, 2014

Misplaced semiconlon and debugging fun in Javascript

This is frustrating and funny at the same time. I've been stuck at this simple condition statement wondering my nulled variable didn't check out true ... for about 5 minutes.

Turns out I totally missed ';' at the end of the if statement, which ended the condition and executed the next block of code anyway.


listview_tasks=null;


...


if(!listview_tasks);
{
    Ti.API.info("why am I here?");

}

Argh.

I blame the tiny font I'm using on my IDE. 

Time for a break me thinks.