BOSE: Noise masking sleepbuds

I bought myself the noise masking sleepbuds from BOSE to combat loisy upstairs neighbors who stomp all the time at night and early morning:

I tried them for two nights and I like the technology, unfortunately, I did not keep them because they were not comfortable for side sleepers.

The sleepbuds fit well in the ear and produce soothing music (you have a big selection from the phone app), however I found that any external speakers that can generate white noise can do the same effect.


You might also like:

She will open the door for me

It’s been said, on the first day of their marriage, wife and husband decided and agreed not to open the door for anyone!
On that day first, husband’s parents came to see them, they were behind the door.

Husband and the wife looked at each other, husband wanted to open the door, but since they had an agreement he did not open the door, so his parents left.

After a while the same day, wife’s parents came, wife and the husband looked at each other and even though they had an agreement, wife with tears on her eyes whispered, I can’t do this to my parents, and she opened the door.

Husband did not say anything, years passed and they had 4 boys and the fifth child was a girl.
The father, planned a very big party for the new born baby girl, and he invited everyone over.
Later that night his wife asked him what was the reason for such a big celebration for this baby while we did not
do it for the others!
The Husband simply replied, because she is the one who will open the door for me!

You might also like:

You can’t steal this meme!

Suppose you find a nice meme:

You try to steal it:
But nope, you are not allowed to steal it:

But you insist and steal it anyway:


You might also like:

15 Useful Batch files programming recipes

In the Batchography book, I cover basic to advanced Batch files programming topics. Since the book was published in 2016, I kept blogging about Batch programming language.

Here’s a collection of some useful recipes:

  1. Check if the script is running as an Administrator
  2. String substitution
  3. Number counting
  4. Batch files and Unicode
  5. Read from a text file, one line at a time
  6. Switch/case in Batch files
  7. Auto reinterpret/compile changed files
  8. Reading from a file
  9. Tokenizing command output
  10. Polyglot: Python and Batch files
  11. Polyglot: Batch file + self compiling C++
  12. Embedding binaries inside Batch files
  13. Interactive Batch files
  14. Writing a game – The Hangman
  15. Batchography: Parsing INI files from a Batch file

 

flower separator
batchography-good-resDo you want to master Batch Files programming? Look no further, the Batchography is the right book for you.

Available in print or e-book editions from Amazon.

flower separator


flower separator

You might also like:

Can you solve this puzzle?

I got this silly puzzle via chain mail:

Can you solve it?

Maybe you will be able to, but don’t beat yourself up if you don’t get it right.

You might also like:

When it comes to keyboards, I am super picky!

When I got my first computer, I got attached to its keyboard (The Honeywell 101WN model). In fact, I kept the keyboard until I bought a new computer with no PS/2 ports on it.

It was a sad moment when I realized that I have to move on and find a new keyboard.

While I could have bought a PS/2 adapter, I needed the “Windows” key which is available on newer keyboards.

I think a big majority of programmers love their keyboards and their layout, just like me.

I am very picky when it comes to keyboards. If I don’t like the keyboard, I might not like the whole laptop for instance.

It took me a while to get used to the old MacBook Pro’s keyboards but just after I started liking their keyboards, Apple changed the mechanism to the butterfly mechanism and made the keyboards repulsing in my opinion. I won’t buy a new MacBook because of their keyboards. The same goes for Microsoft Surface laptops. I did not like their toy-like keyboards and therefore won’t buy, endorse or use a Microsoft Surface book or laptop . The most pleasant keyboards so far are the IBM / Lenovo keyboards. That’s why all of my PC laptops are a Lenovo X or T series.

You might also like:

Batchography: Detect Windows Language

To detect the Windows Operating system language, it is enough to query the registry. We use the “reg query” command and then parse the output.

@echo off

setlocal

:: https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh361638(v=office.14)

for /F "usebackq tokens=3" %%a IN (`reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage`) DO (
  set lang_id=%%a
)
:: 0409 English ; 0407 German ; 040C French ; 0C0A Spanish

if "%lang_id%"=="0409" (
  echo English detected
) else if "%lang_id%" == "040C" (
  echo French detected
) else (
  echo Note: Unknown language ID %lang_id%!
)

echo LangID=%lang_id%

You can learn about advanced Batch scripting techniques in the Batchography book.
flower separator
batchography-good-resDo you want to master Batch Files programming? Look no further, the Batchography is the best book on the topic and the most up to date!

Available in print or e-book editions from Amazon.

 


You might also like:

Infectious laughter recordings

Are you feeling down? Did you know that laughter is infectious?
I suggest you bookmark this page and return to it when you are feeling depressed. Listen to the laughter below and brighten up.

Enjoy!

Male laughing:

Male laughing hysterically:

Male giggling:

Female laughing:

Female laughing hysterically:

Female giggling:

All of them together:

You might also like:

Batchography: what happens when you redirect ‘cls’ to a file?

Let’s assume you have a Batch file (test.bat) with the following contents:

@echo off
echo 1
cls
echo 2

And then you run this Batch file and redirect its output to a text file called “out.txt”:

C:>test.bat >out.txt

What do you think the output would be?

At first, I thought it would be:

1
2

But little did I know that when ‘cls’ is invoked in a context where stdout is redirect to a file, then a form feed character (0xC) is emitted instead:

I was curious, so I disassembled ‘cmd.exe’ to verify my findings. Lo and behold, indeed, ‘cmd.exe’ does that:

int __stdcall eCls(struct cmdnode *a1)
{
  HANDLE hStdOut;
  HANDLE v2;
  SMALL_RECT ScrollRectangle; 
  COORD dwDestinationOrigin;
  CHAR_INFO Fill;
  struct _CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;

  if ( FileIsDevice((char *)1) )
  {
    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if ( GetConsoleScreenBufferInfo(hStdOut, &ConsoleScreenBufferInfo) )
    {
      dwDestinationOrigin.Y = -ConsoleScreenBufferInfo.dwSize.Y;
      dwDestinationOrigin.X = 0;
      *(_DWORD *)&ScrollRectangle.Left = 0;
      ScrollRectangle.Bottom = ConsoleScreenBufferInfo.dwSize.Y;
      ScrollRectangle.Right = ConsoleScreenBufferInfo.dwSize.X;
      Fill.Char.UnicodeChar = 32;
      Fill.Attributes = ConsoleScreenBufferInfo.wAttributes;
      ScrollConsoleScreenBufferW(hStdOut, &ScrollRectangle, 0, dwDestinationOrigin, &Fill);
      ConsoleScreenBufferInfo.dwCursorPosition = 0;
      v2 = GetStdHandle(0xFFFFFFF5);
      SetConsoleCursorPosition(v2, 0);
    }
    else
    {
      cmd_printf(page_feed);
    }
  }
  else
  {
    cmd_printf(page_feed);
  }
  return 0;
}

(Lines 29 and 34 are of interest)

In conclusion, be aware if you redirect a Batch file to another file and compare the result. If the Batch file uses CLS, you have to account for the form feed character showing up!
flower separator
batchography-good-resDo you want to master Batch Files programming? Look no further, the Batchography is the best book on the topic and the most up to date!

Available in print or e-book editions from Amazon.

 


You might also like:

 

Batman: The Dark Night – Life Size figure

I recently discovered that I like the Batman character. He has a blend of strength and high intellect. Additionally, he’s a human with no superpowers and therefore one can relate to him.

The following picture is life-size statue of Batman taken from a souvenir shop in Downtown LA.

You might also like: