Skip to main content

Posts

Showing posts from January, 2018

googletest on Ubuntu

Running gtests on your C++ programs using g++ on Ubuntu: Installation Install CMake: sudo apt install cmake Switch to home directory and: git clone --depth 1 https://github.com/google/googletest.git Build it: cd ~/googletest mkdir build cd build cmake -Dgtest_build_samples=ON -Dgtest_build_tests=ON ~/googletest make make test ./googlemock/gtest/sample1_unittest Install the googletest and googlemock .a and .h files: sudo cp -r -v ~/googletest/googletest/include/gtest /usr/local/include sudo cp -r -v ~/googletest/googlemock/include/gmock /usr/local/include sudo cp -v ~/googletest/build/googlemock/lib*.a /usr/local/lib sudo cp -v ~/googletest/build/googlemock/gtest/lib*.a /usr/local/lib TEST() and code in same file - Test Fail To compile and run: g++ 01sqrt_fail.cpp -lgtest -lpthread -o 01sqrt_fail ./01sqrt_fail Output: TEST() and code in same file - Test Pass To compile and run: g++ 01sqrt_pass.cpp -lgtest -lpthread -o

MNO LAN: Use same MNOs SIM card in your IoT devices like GL-MiFi

One of the big issues with IoT is somehow enabling two end nodes to communicate with each other in the presence of  Network Address Translation (NAT) Now days most ISPs (and Mobile Network Operators or MNOs) use NAT by default and assign you local IP addresses in 10.*.*.* subnet. You usually have to pay an extra fee to get static global IP addresses assigned to you - this could be a security concern. If your end nodes run embedded linux, the following solutions can be used: Use DDNS and UPnP together DDNS is not usually free, but the manufacturer of your embedded linux device (routers from goodlife of Vstarcam's IP camera) might provide you this service for free as it uses almost nil resources on the server side. Most ISPs have UPnP support disabled on their gateway. In a home environment, if you have your own static global IP for your home router, you can use UPnP and DDNS to your advantage. An end node will use UPnP to request your WiFi Router to open ad forward certain

TurboPower

We all want our smartphone to charge quickly. And different phone manufacturers have either created their own propriety method of charging (Oppo VOOC or MediaTek PumpExpress+ or Motorola's TurboPower or OnePlus's Dash) or have opted to comply with a industry wide standard like Qualcomm's Quick Charge series of standards). These technology work my allowing a phone to tell the charger to step up the voltage beyond 5 volts so that the power available to the phone for charging the battery is more than what a good 5 volt / 2 ampere wall/car charger can supply. I have a Moto G4 plus and I wanted to make sure that I had access to fast charging at home/office, in car or while travelling. So I went ahead and got the following accessories My Moto G4 plus along with the various charging accessories Voltmeter USB Voltmeter Stick This small device is what allowed me to check at what voltage/current the various chargers were charging my phone or regular devices. It h

Food Silicone food savers + Glass bottles

Plastics! Cancer! Correlation! And so we move away from plastic bottles to glass bottles. But glass bottles pretty but fragile. So what do we do? We get food huggers!!! Food huggers seemed onle somewhat useful to me all this while until now The silicone rubber food huggers will protect the bottom of the bottles - I was worried that I might end up banging them on the floor when I have a sip in the middle of the night. Color Glass bottles  + Silicone food hugger  = Amazon.in links: Food huggers/savers Glass bottles Note: The food huggers come as a set of 4. Only the two larger ones have diameters large enough for the glass bottles linked to above. The smaller two won't fit. So if you get 6 bottles, you will need to order 3 sets of food huggers. Of the 12 pieces of food huggers, you will end up using only 6 of them. Various sized food huggers seem to be colored differently to match the color of the vegetable/fruit they are supposed to prot

Adding new elements to OpenWrt's LuCI on GL-MiFi

If you are an IoT enthusiast who uses devices that run OpenWrt (routers from Goodlife , or MT7688 ), you would have considered creating a plugin for LuCI so that you can expose the functionality of any sensors/actuators that you may have connected to your OpenWrt box via OpenWrt's builtin web console. This article on openwrt.org's wiki will tell you exactly how to do that. As maybe obvious from the page, if you want to create dynamically generated web content, you will need to write lua scripts. When trying out the steps from the wiki article for my GL-MiFi , I had to modify the file locations for placing various script like so: new_tab.lua had to be placed in: /usr/lib/lua/luci/controller/ myapp cbi_tab.lua  had to be placed in: /usr/lib/lua/luci/model/cbi/ myapp-mymodule cbi_file can be put in the same place as mentioned: /etc/config view_tab.htm  had to be placed in: /usr/lib/lua/luci/view/ myapp-mymodule Once I had the placed the files in the right location,