Saturday, March 13, 2021

Steam: taskbar menu lag

Problem:

When I access Steam's menu via the taskbar, after clicking on a menu (e.g. Friends, Settings, Exit Steam), there's a 15-20 secs delay before it would actually trigger the action. This behavior only appears when accessing the menu options via the taskbar. It works fine when accessing the menu via the tray icon in the notification area. Steam user Oracle experienced the same issue and captured this clip to demonstrate the issue.

Solution:

In my case, updating the AMD integrated graphic card driver resolved the issue.

  1. download and install AMD Radeon software
  2. retart pc
  3. go to Device Manager (run devmgmt.msc)
  4. go to Display adapters > AMD Radeon(TM) Graphics > Update Driver > Search automatically for driver
  5. once it installed the latest driver, I opened Steam and the menu works as expected

Ref:

Thursday, March 11, 2021

Git: fatal: protocol error: bad line length character: logi

 I was getting this error when I tried to clone a git repro

fatal: protocol error: bad line length character: logi


Solution:

add username in front of the hostname, e.g.

git clone ssh://username@hostname/repo

Sunday, January 3, 2021

OBS: audio out-of-sync

I was recording a video using OBS Studio (26.1.0). Everything is fine at the beginning, but after 5-6 mins, the audio started to get out-of-sync with the video.

To resolve it, in the Audio Mixer panel, click on the gear icon for Desktop Audio > Properties, then uncheck "Use Device Timestamps"

Ref:
Question / Help - Audio gets out of sync | OBS Forums

Saturday, January 2, 2021

Python: cannot load Activate.ps1 in Visual Studio Code

When running a Python script inside a virtual environment in Visual Studio Code, it shows the following error in the terminal:

env\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.

One option is to change the ExecutionPolicy. Another option is use set cmd as the default terminal instead of powershell. Personally I prefer the latter.

To change the default terminal:

  1. Ctrl + Shift + P
  2. type: Select Default Shell
  3. select Command Prompt

Ref:
powershell - Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system - Stack Overflow

Tuesday, November 24, 2020

Git: Enable auto stash for rebase

For the current repository:

git config rebase.autoStash true

For global:

git config --global rebase.autoStash true

Sunday, July 12, 2020

UE4: Using Visual Studio Code for UE4 c++ project

It's possible to get UE4 to work with Visual Studio Code without installing Visual Studio.

My setup:
  • Windows 10
  • Visual Studio Code 1.47.0
  • Unreal Engine 4.24.2
Install Build Tools for Visual Studio
From the Visual Studio Downloads page, scroll down until you see Tools for Visual Studio under the All downloads section and select the download for Build Tools for Visual Studio.

Open vs_BuildTools.exe. Under Workloads, select C++ build tools. On the right, make sure to keep the optional component MSVC vXXX - VS 2019 C++ x64/x86 build tools and Windows 10 SDK checked. You can uncheck Testing tools core features - Build Tools and C++ AddressSanitizer (Experimental) to save some space.

Under Workloads, select .Net desktop build tools. You can uncheck all the optional components to save ~1.68 GB. You will be prompted to reboot once the installation is completed.

Change default editor to Visual Studio Code
Open UE4, you should now be able to create a new c++ game project. Once the project is generated, open UE4 and go to Edit > Editor Preferences.... Under General > Source Code, change Source Code Editor to Visual Studio Code. Then restart UE4.

Generate Visual Studio Code project files
Now when you right-click on your .uproject in Windows Explorer, Generate Visual Studio project files should now create MyProject.code-workspace for Visual Studio Code.

Configure build task in Visual Studio Code
In Visual Studio Code, install the c++ extension if you haven't already. To configure the build task, go to Terminal > Configure Default Build Task..., select MyProjectEditor Win64 Development Build. Press Ctrl + Shift + B to build the project, and hot reload should work as expected.


Ref:
Configure Visual Studio Code for Microsoft C++

Saturday, July 11, 2020

Haxe: Compile heaps.io game through hashlink/c code on Win10

Here is my setup
  • Windows 10
  • Visual Studio 2017
  • haxe 4.0.5
  • hashlink 1.11 
  • heaps 1.8.0
note: cpp targeting is not currently supported by heaps
note: hashlink 1.11 comes with x64 libraries, so we'll be compiling our game for x64. If you want to target x86, you will likely need to compile hashlink yourself to get the x86 libs for linking.

Main.hx -- this is the hello world sample from heaps.io
class Main extends hxd.App {
    override function init() {
        var tf = new h2d.Text(hxd.res.DefaultFont.get(), s2d);
        tf.text = "Hello World !";
    }
    static function main() {
        new Main();
    }
}

build.hxml
-lib heaps
-lib hldx
-hl out/main.c
-main Main


Compile it into c code
haxe build.hxml


We will use Visual Studio to compile the c code
  1. start menu > x64 Native Tools Command Prompt for VS
    1. alternatively, open cmd and run vcvars64.bat (since we are targeting x64)
      for VS 2017, it should be located at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat
  2. cd "path to your project directory"
  3. cl /Ox /Fo:main.obj /Fe:main.exe out/main.c /I out /I C:/HaxeToolkit/hl-1.11.0-win/include /link /LIBPATH:C:/HaxeToolkit/hl-1.11.0-win libhl.lib ssl.lib ui.lib directx.lib openal.lib fmt.lib
If everything goes well, a main.exe would be created in your project's directory. This is what the output looks like
C:\my_game>cl /Ox /Fo:main.obj /Fe:main.exe out/main.c /I out /I C:/HaxeToolkit/hl-1.11.0-win/include /link /LIBPATH:C:/HaxeToolkit/hl-1.11.0-win libhl.lib ssl.lib ui.lib directx.lib openal.lib fmt.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27035 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

main.c
Microsoft (R) Incremental Linker Version 14.16.27035.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
/LIBPATH:C:/HaxeToolkit/hl-1.11.0-win
libhl.lib
ssl.lib
ui.lib
directx.lib
openal.lib
fmt.lib
main.obj

C:\my_game>


If you want to hide the console window, call hl.UI.closeConsole() at startup as ncannasse suggested.


Ref:
How to compile c files generated by HashLink
Error on Compile C generated files using CL.EXE
How to compile x64 code with Visual Studio in command line?
How to resolve the module machine type 'X86' conflicts with target machine type 'x64' Visual Studio
HashLink/C Compilation - Haxe - The Cross-platform Toolkit
Getting started with Haxe/C++ - Haxe - The Cross-platform Toolkit
MSVC compiler options
MSVC linker options 
[SOLVED] Error when compiling heaps to cpp Windows - Heaps.io