import java.nio.charset.Charset; public boolean isAscii(String v) { Charset.forName("US-ASCII").newEncoder().canEncode(v); }
My Tech Notes
Search This Blog
Java: check if a String contains only ASCII
Eclipse: Disable auto escaping when pasting
- In the preferences menu deselect: Java > Editor > Typing > Escape text when pasting into a string literal
- Disable smart insert mode: Edit > Smart Insert Mode [Ctrl+Shift+Insert]
Shell scripts to count files and sum up file sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ $# -ne 1 ] && echo "$(basename $0) <dir>" && exit 1 | |
[ ! -d $1 ] && echo "$1 is not a directory." && exit 1 | |
find "$1" -type f | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ $# -ne 1 ] && echo "$(basename $0) <dir>" && exit 1 | |
[ ! -d $1 ] && echo "$1 is not a directory." && exit 1 | |
if [ $(uname) == "Darwin" ]; then | |
find "$1" -type f -print0 | xargs -0 stat -f '%z ' | paste -sd+ - | bc | |
else | |
find "$1" -type f -printf %s\\n | paste -sd+ | bc | |
fi |
Fix Windows 10 Update KB5034441 Error 0x80070643
The reason KB5034441 failed to install with error 0x80070643 is that there is not sufficient space in WinRE recovery partition. The solution is:
Manually resize your WinRE recovery partition by 250 MB
- Open a Command Prompt window (cmd) as Administrator.
- Check WindowsRE status:
reagentc /info
If the WinRE is installed, there should be a “Windows RE location” with a path to the WinRE directory. An example is, “Windows RE location: [file://%3f/GLOBALROOT/device/harddisk0/partition4/Recovery/WindowsRE]\\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE.” Here, the number after “harddisk” and “partition” is the index of the disk and partition WinRE is on. - Disable the WindowsRE:
reagentc /disable
- Shrink the OS partition and prepare the disk for a new recovery partition.
- Run
diskpart
- Run
list disk
- Select the OS disk (This should be the same disk index as WinRE.), run
sel disk OS_DISK_INDEX
e.g.sel disk 0
if disk 0 is the OS disk. - Find the OS Primary partition, run
list part
- Select the OS Primary partition, run
sel part OS_PARTITION_INDEX
- Shrink the OS Primary partition by 250MB, run
shrink desired=250 minimum=250
- Run
- Delete the WinRE recovery partition
- In diskpart, select WinRE partition, run
sel part WinRE_PARTITION_INDEX
- Delete the WinRE partition, run
delete partition override
- In diskpart, select WinRE partition, run
- Create a new WinRE recovery partition.
- First, check if the disk partition style is a GUID Partition Table (GPT) or a Master Boot Record (MBR). To do that, run
list disk
. Check if there is an asterisk character (*) in the “Gpt” column. If there is an asterisk character (*), then the drive is GPT. Otherwise, the drive is MBR. - If your disk is GPT, run
create partition primary id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
followed by the commandgpt attributes =0x8000000000000001
- If your disk is MBR, run
create partition primary id=27
- First, check if the disk partition style is a GUID Partition Table (GPT) or a Master Boot Record (MBR). To do that, run
- Format the new WinRE recovery partition, run
format quick fs=ntfs label="Windows RE tools"
To confirm that the WinRE partition is created, runlist vol
Exit from diskpart, runexit
- Re-enable WinRE, run
reagentc /enable
To confirm where WinRE is installed, runreagentc /info
Now you should be able to install KB5034441 via Windows Update
See also
Compress sparse files preserving their holes
use -S option for tar
tar -Sczvf sparse_file.tar.gz sparse_file
Subscribe to:
Posts (Atom)