Skip to main content

Posts

Showing posts from October, 2021

Find time from time ranges (including overlapping ranges)

 This is a very simple problem. In this trying to find a given time from ranges of times. So, I have a collection which stores different time ranges (including overlapping time ranges). The job is to find or search if a time provided by user exists in time ranges collection. Example: Let's assume I have following collections of time ranges: 1. 07:00 - 09:00  2. 13:45 - 15:15 3. 16:25 - 18:10 4. 08:30 - 10:00 Now, need to find if time 09:30 is present in that collection or not. If it finds it shall print true, otherwise false. Similarly it can be use to check other times too. Solution: To store time ranges, what I did is converted start and end time to decimal numbers respectively and stored them in STL's set (multiset) used to address overlapping ranges. As we know that set data structure in STL is a tree (Red Black Tree / Balanced Binary tree).  Time Complexity:  1. set::insert - If N elements are inserted, Nlog(size+N). Implementations may optimize if the range is already sor

Network Shell Utility (netsh, An useful usage)

 In Windows OS, there is a command known as netsh or network shell. It is a command line utility included in Microsoft Windows NT lines of the operating system, beginning with Windows 2000. It allows local/remote network configuration as well as it can be used to display network configuration. Today, we can see how 'netsh' can be leveraged to display wireless passwords. It happens we may forget the wireless password(s) after connecting a device to many wireless networks since it gets stored as a part of the network profile. That said, we enter password for a wireless network for the first time and it gets stored, and then the next time onwards the device gets connected to the wireless network once it is available. We don't need to key in a password again. As a result, we may forget passwords and may get challenged to remember and connect to any other device.  In this post, we will see how can we leverage netsh command to get/retrieve wireless network passwords from a device