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:

Statistics about Lebanon

I found this information on the internet, if you find inaccuracies, let me know please.

Statistical facts

  1. Lebanon has 18 religious communities
  2. It has 40 daily newspapers
  3. It has 42 universities
  4. It has over 100 banks (that is banks and not branches of a bank)
  5. 70% of the students are in private schools
  6. Many of the Lebanese people are Christians (The highest percent in all the Arab countries)
  7. There’s 1 doctor per 10 people in Lebanon (In Europe & America , there’s 1 doctor per 100 people)
  8. The name LEBANON appears 75 times in the Old Testament
  9. The name CEDAR ( Lebanon ‘s tree) appears 75 times too in the Old Testament!!
  10. Beirut was destroyed and rebuilt 9 times (this is why it’s compared to The Phoenix).
  11. There’s 3.5 Million Lebanese in Lebanon
  12. There’s around 15 Million Lebanese outside Lebanon !!!
Other interesting facts:
  1. Lebanon , the country, was occupied by over 16 countries:
    (Egyptians-Hittites-Assyrians- Babylonians- Persians- Alexander the greats Army- the Roman Empire Byzantine- the Arabian Peninsula-The Crusaders- the Ottoman Empire- Britain-France- Israel- Syria)
  2. Byblos (city in Lebanon ) is the oldest, continuously living city in the world.
  3. Lebanon ‘s name has been around for 4,000 yrs non- stop (it’s the oldest country/ nation’s name in the world!)
  4. Lebanon is the only Asian/African country that doesn’t have a desert.
  5. There are 15 rivers in Lebanon (all of them coming from its own mountains)
  6. Lebanon is one of the most populated countries in its archeological sites, in the world!!!
  7. The first alphabet was created in Byblos (city in Lebanon )
  8. The only remaining temple of Jupiter (the main Roman god) is in Baalbeck ,Lebanon (The City of the Sun)
  9. The name of BYBLOS comes from the BIBLE!!!
  10. Lebanon is the country that has the most books written about it.
  11. Lebanon is the only non-dictatorial country in the Arab world (Yes, we do have a President!)
  12. Jesus Christ made his 1st miracle in Lebanon , in Qana (The miracle of Turning water into wine).
  13. The Phoenicians (Original People of Lebanon) built the 1st boat, and they were the first to sail ever!
  14. Phoenicians also reached America long before Christopher Columbus did.
  15. The 1st law school in the world was built in Lebanon , in Downtown Beirut.
  16. People say that the cedars were planted by God’s own hands (This is why they’re called ‘The Cedars of God’, and this is why Lebanon is called ‘God’s Country on Earth.’

I love Lebanon ….. may God bless my homeland forever….

First trip to Lebanon
First time To Lebanon? The Untold tips and tricks

You might also like:

Apple’s Measure App

If you have iOS 12+ then you should try Apple’s Measure app. It is really handy.

You can measure:

  • Bookshelves
  • Picture frames
  • Window sizes
  • Door sizes
  • etc…


You might also like:

If your plan is for 100 years, educate children

If your plan is for 1 year, plant rice.
If your plan is for 10 years, plant trees.
If your plan is for 100 years, educate children.

You might also like: