Testing on the Toilet

So, has your company started following you to the toilet as well? It seems the idea of “testing on the toilet”, where code snippets and sometimes code testing techniques are printed and attached on the toilet walls, was started by Google (please correct me if I am wrong).

I was surprised the other day to enter the toilet, only to find those one pagers with code testing techniques attached above the urinary gutters!

tot-2

It is one thing to want your employees to be productive and another thing to follow them to the toilet where they hope to have a moment of peace and quiet while they relief themselves!

What about number two you ask? Well, they follow you inside as well:

tot-1

Personally, I find that unacceptable. Instead, put some jokes, something a bit lighter and funny! 🙂

Do you agree?

You may also like:

The “21 Cards Magic Trick” revealed!

Today I am going to reveal to you a magic card trick that I have been using since a long time ago. I don’t remember where and how I learned this trick, most likely from a magic book.

This trick is really nice and easy to perform. Just make sure you do not perform it more than once or twice (at most) in the same setting, otherwise the participants will start to figure it out. Continue reading “The “21 Cards Magic Trick” revealed!”

Introducing COMPEL: A command based interpreter and programming language

imageToday I open source and share with you my final year project called COMPEL for my Computer Science degree from the American University of Science and Technology in Lebanon.

I started the project back in early 2006 and worked on it for something close to 6 month while maintaining a part time job, freelance jobs and my part time studies.

Today, 8 years later, when looking back at the amount of work I did and the level of professionalism, I am still satisfied with the COMPEL project.

I hope you will find this project useful! Continue reading “Introducing COMPEL: A command based interpreter and programming language”

Introduction to writing x86 assembly code in Visual Studio

Hello,

In this technical blog post, I am going to give you a head start on how to write assembler code and compile it directly from the Visual Studio IDE.

If you are interested in x64, please check this article.

image

You are expected to be familiar with:

  • The Intel x86 assembly language and writing basic assembly code
  • Understanding of various calling conventions (stdcall, cdecl and fastcall)

Okay, let’s get started! Continue reading “Introduction to writing x86 assembly code in Visual Studio”

Change hard disk volume serial number

A few years ago, I wrote an article explaining how to change the volume serial number.

Volume Serial Number Changer

This program does not work properly now under Windows Vista or Windows 7 unless executed as administrator. Following many suggestions, I updated the tool to support the latest Windows version.

Please note that after you change the serial number you may need to reboot the PC for the settings to take effect.

Download:

Note: You may need to download and install the Microsoft Visual C++ 2010 Redistributable Package (x86).

Early MS-DOS and Word for Windows source code released

Hello everyone,

What I am sharing made the news already, but in case you missed it, here it is:

On ~March 25, 2014, the Computer History Museum (CHM) announced today that it has, with permission from Microsoft Corporation, made available original source code for two historic programs:

  • MS-DOS, the 1982 “Disk Operating System” for IBM-compatible personal computers [link]
  • …and Word for Windows, the 1990 Windows-based version of their word processor [link]

For more reference, please check here:

http://www.computerhistory.org/press/ms-source-code.html

 

Enjoy!

Resetting NTFS files permission in Windows – Graphical Utility

Update 04/30/2017:

New version 1.2.0 released with Unicode support and lots of bug fixes!

Download the reset permission tool from the download section below. 

The post entitled “Resetting NTFS files security and permission in Windows” is very useful to show you how to reset the files permissions from the command line.

However, not all readers are savvy with following system commands and for that reason, I made a small graphical utility to automate NTFS resetting files permissions and taking their ownership:

Usage

This utility needs administrator privilege in order to run. To use it, first click on “Choose folder” to select the folder you want to reset permissions then press “GO” to proceed.

It is also possible to edit the commands, change or add new commands before you press the “GO” button.

Explanation of user interface:

The options:

  • Reset files permissions: This is the basic option. You may uncheck it if you want to carry other operations.
  • Take ownership: Sometimes it is necessary to take ownership of the files before resetting their permission. For that reason please check this option if needed.
  • Apply for all sub-directories: Use this option to apply the selected commands recursively.
  • Reset hidden and system files: This command will make invisible files visible.
  • Don’t follow links: this option applies to the “Reset files permission” and “Take files ownership” options only.
  • More options: see the section below.

The action buttons:

  • GO: executes the commands in the “Command that will be executed” text box.
  • HELP: takes you to this blog post
  • ABOUT: Shows the version and about text

Advanced

This is a new feature introduced in version 1.1.0.  When you press this button, you get two options:

  • Add to Explorer folder context menu
  • Remove from Explorer folder context menu
  • Backup / Restore permissions. Those two features are explained in details in this article here.

Note: always press “GO” after you select any of the advanced options.

When the ResetPermission utility is added to the Explorer folder context menu, you will be able to right-click on any folder and then choose a new option called “Reset Permission”.

Check this screenshot:

resetperm-ctxmenu

How it works

To keep the explanation short and less technical, this utility is just a shell that uses the following utilities from Microsoft:

All the commands that are going to be executed are showed to you beforehand.

You have a chance to tweak the commands before you press “GO” and execute them.

Checkout the free tools:
Pic2Pdf
WifiShare
Windows Error Reporting – Local crash dump collection graphical tool
MAC address changer on Windows

Backing up / Restoring the files permissions

Don’t you wish you could undo all the permission changes you did because your system became unstable due to misusing this utility?

Now you can, with the two new “Backup permissions” and “Restore permissions” functionalities. Please read more about that in this article.

Disclaimer

Please use this utility at your own risk. Backup the permissions beforehand if you have to.

I am not responsible for mishaps due to using this tool recklessly (for example trying to reset system or root folders permission), however, I display a warning when this tool is about to be used on a root folder:

ResetPermission-1.1.3-Root-Warning

Check the “How it works” section above then please refer to Microsoft TechNet site for information about the tools used.

Download

Download WifiPasswordReveal

Download the utility executable – use the password: lallouslab

Note: Windows Defender might block this attack. Add a folder exclusion to Windows Defender to solve the issue.

Download the source code
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.

 

12/19/2016 – Very important – ResetPermissions.exe is NOT a virus or trojan, read on:

ResetPermission tool continues to be plagued by Antivirus falsely reporting it as a Trojan or virus!

It is a shame that even in 2016, AntiVirus solutions are very poor at distinguishing malware from good ware.

If you follow this VirusTotal link here, you will see that as of 12/19/2016, only 2/41 falsely detect the ResetPermission.exe as a virus and the remaining AntiVirus solutions detect correctly.

What is more shameful is that “top” and “reputable” AntiVirus solutions like “Windows Defender” from Microsoft, “BitDefender”, “Kaspersky Antivirus” among many other AVs do a very poor job telling which is a malware and which is not!

In the AntiVirus hacker’s handbook book that I co-authored, I explain how Anti-Virus solutions are not optimal and just give you a false sense of security!

If you want to learn more about the Antivirus industry and how their technology is outdated, then read Part IV (Chapters 16 and 17) in the Antivirus Hacker’s handbook. Part IV is written in simple English and does not require you to be a computer geek to understand what the A/V industry is all about!

flower separator

Please support my efforts and time put into writing this utility by donating through PayPal:

Thank you.
flower separator

Interesting Batch programming articles:

You might also like:

Partition tables explained

Introduction

partition_viewer

I’ve always been curious about how disks are partitioned, and how the partition table looks like. This article will explain the format of the partition table and will provide a small tool (Partition Viewer) to demonstrate what we explained.

The information in this article apply for x86 systems, I don’t know about disk partitioning on other systems.
You are not required to have prior knowledge about disk partitioning; The goal of this article is to provide just the needed knowledge to understand disk partitioning, hence many details are left out for the readers to investigate by themselves.

Please note that this article does NOT cover the GPT (GUID Partition table). Continue reading “Partition tables explained”

Resetting NTFS files security and permission in Windows

UPDATE:

I have released a new graphical user interface utility to reset the files permissions.

Try it out!

I was running Vista with two NTFS partitions (C: and D:), then formatted C: partition and installed Windows 7. The second partition (D:) had some files security set on files and folders.

After Windows 7 was installed, some files on drive D: were not accessible anymore and I was getting “Access Denied”. I tried to right-click/properties on the folders that were not accessible and changed their owner and changed permissions but still some folders were still inaccessible not matter what I did.

After some research, it turned out the tool “cacls” that allows one to display or change ACLs (access control lists) can help to reset ACLs. In Windows 7 it is called “icalcs”.

To reset files permissions, follow these easy 3 steps:

Step 1: Run “cmd” as Administrator.

Note: In MS Windows 8 and above, press the Win+X keys, then choose “Command Prompt (Admin)”.

Step 2: Go to the drive or folder in question, for example:

CD /D D:

Step 3: To reset all the files permissions, type:

icacls * /T /Q /C /RESET

That’s it! After that, the files permissions were reset and I could access them back again.

Very Important note:

Step 3 is irreversible. Make sure you backup the permissions before you proceed!

It is possible that “icacls” might fail. For that try to take ownership of the files first. Just before Step (3), please type the following command:

takeown /R /F *

flower separator

Download the graphical utility instead!

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

You might also like:

The “CON” Folder

I just received a funny email today, reading:

TRY IT NOW , IT WILL NOT CREATE ” CON ” FOLDER.
YOU WON’T BELIEVE THIS !!!!!!!! An Indian discovered that nobody can create a FOLDER anywhere on the computer which can be named as “CON”. This is something pretty cool…and unbelievable… At Microsoft the whole Team, including Bill Gates, couldn’t answer why this happened!

TRY IT NOW , IT WILL NOT CREATE ” CON ” FOLDER.

What is funny about it is that people forward emails without research or verification.

As a programmer and as most programmers know, the “CON” is a special device name which stands for console. There are many other reserved devices names in the DOS/Windows OS, such as: AUX, NUL, LPT1, COM1, etc….

However, you would be able to create use such names if you pass a complete file as: “\\.\c:\con”. As an example, follow these steps:

  1. Start -> Run -> Cmd
  2. type: “notepad \\.\c:\con.”
  3. now go to “My Computer” -> “C:” and notice the file named “CON”
  4. Notice that you won’t be able to delete that file simply by selecting it and pressing DEL. If you ask why, it is because (again) Explorer is passing the name “CON” to the operating system’s DeleteFile() API and not its full name
  5. Now to delete this file, simply type “del \\.\c:\con.” in the command prompt

If you want another “CON” (console) trick, here’s one that allows you to create a text file without using notepad or any other text editing tools:

  1. Go to command prompt and type:
  2. copy con hello.txt
  3. start typing anything you want here, for everything you type here will go into the “hello.txt” file
  4. When you want to finish, simply press CTRL+Z (which will show as ^Z on the screen) and press ENTER

If you wonder what’s the CTRL+Z (aka ^Z) it simply marks the EOF (End Of file).

Visual Studio and some useful keyboard shortcuts

Hello

I will present a short and handy list of useful keyboard shortcuts:

Key Meaning
*Make text selection then Shift+( This will surround the selected text with “(” and “)”
*Make text selection then Shift+{ Same as above but with { } surrounding
Ctrl+Ins/Shift+Ins To Copy / Paste (aka Ctrl+C/+V)
Ctrl+SPACE or Alt+RIGHT Toggle the autocompletion combobox
Ctrl+T To test a resource dialog
F12 When cursor is over an identifier, it goes to definition
Ctrl+- and Shift+Ctrl+- To navigate back and forth
Alt+F, J To go to Recently Opened Project

Hope you find them useful!

(*) You need Whole Tomatoes Visual Assist

Panasonic BL-Cxx network cameras

Recently I had the chance to explore the two network cameras from Panasonic: BL-C1 and BL-C10.

Both cameras have built-in web servers and can be plugged to the network and operate standalone. They can also be configured to get static IP address or make use of a DHCP server.

Once the camera is set up, the user can explore its features by accessing its IP address via web protocol, example: http://192.168.1.253:80/ .

From there on you can see the camera image stream (pseudo-stream), control brightness/image quality, add users so they can access the camera, control timers, sensors, etc…

BL-C1 is a simple model where it provides nothing more than image capturing facility and motion detection which works by comparing an image with a previous image and see if the difference is within the user defined threshold.

The BL-C10 is a bit more complex model allowing you to control the camera’s eye direction. You can move the view to all the four directions. There is no motion detection, though one can implement this feature from the software, there is human detection sensor (“by picking up the infrared light naturally emitted from people and animals”).

The cameras come with a software CD containing set of user manuals and a windows application to control the cameras. For developers, they can download C SDK written and provided by Panasonic. You may compile the code using Visual Studio or (did not try it) any other C compiler. The C code is highly portable and should also work on other operating systems such as Unix. In case you want to program the camera using a different programming language, then you may download the CGI programmer’s document and start forming your own HTTP requests in order to talk with the camera’s webserver.
Now using CGI, to control the camera’s direction, one for example can call this web address: http://camera_ip_address:80/nphControlCamera?Direction=HomePosition