Posts in category “Tips”

How to delete all bin/obj folders in a complex solution in GitBash

Sometimes we need to delete all the bin/obj folders in a solution to resolve issues in Rider or Visual Studio. I assume you already have your preferred method for this task, but I would like to share my approach here in case someone else is unaware of how to do it in GitBash or MSYS terminal:

#!/bin/bash

set -e

# Find and display directories to be deleted
find . \( -iname "bin" -o -iname "obj" \) -type d -print

# Prompt user for confirmation
read -p "The above folders are going to be deleted, are you sure? [Y/N]: " -n 1 -r
echo    # Move to a new line

# Delete directories if confirmed
if [[ $REPLY =~ ^[Yy]$ ]]; then
    find . \( -iname "bin" -o -iname "obj" \) -type d -exec rm -rfv {} +
    echo "Done"
else
    echo "No"
    exit 1
fi

不确定是不是真的有用,但还是记下来备忘

毕竟自己和父母都会老去,老年痴呆症离我们并不是很遥远。

读《最初的爱,最后的故事》时读到:

在老年痴呆症的早期,特别是对于素食主义者,检查他们血液中的维生素B12的水平,若发现大幅低于正常范围, 注射维生素B12看看效果。若有效果可适当加大剂量并定期补充维生素B12,有病例从痴呆状态复原,智力恢复正常,又健康的活了好几年。

Power shell: Start-Transcript and Stop-Transcript help you log a session.

How to show space and tabs with git-diff

git config diff.wsErrorHighlight all

Reference

Quoting string literals in PL/SQL

We sometimes need to include a single quote in an SQL statement, I believe you already know the normal way, use two single quote characters to express one single quote. However, if you are using oracle 10g or a more recent version, the following way could be better:

This is a new feature of 10g that enables us to embed single-quotes in literal strings without having to resort to double, triple or sometimes quadruple quote characters. This is particularly useful for building dynamic SQL statements that contain quoted literals.

The mechanism is invoked with a simple "q" in PL/SQL only. The syntax is q'[...]', where the "[" and "]" characters can be any of the following as long as they do not already appear in the string.

  • !
  • { }
  • ( )
  • < >

Note that at the time of writing, the quoting mechanism only appears to work with 10g clients/OCI. If used with any software that uses an older Oracle client it fails with ORA-01756: quoted string not properly terminated (confirmed with sqlplus, TOAD and PL/SQL Developer).

If you want samples, see Reference