Posts

What you can do with one cheap lousy camera

Image
National Geographic prides itself in sending photographers armed with tens of thousands of dollars of equipment across vast distances to take great pictures. Big deal! I think it's a bigger challenge to see what you can capture from one spot on planet Earth , with just one cheap lousy camera. What you see here are pictures all taken from one place, my home. From the meta data you can tell that a cheap Nikon was used before 2007 and a cheap Canon was used after that. Both are below $300 and not SLRs , and if cameras with those specifications are still built today, they would probably cost $50. In the pictures shown here: All are real living things, except for the thing in the sky and the paper snake, the latter taken by a 5-year old. All are taken in their natural environment except for one, and that is the civet cat which is caged. All living things are live (other than the obviously dead lizard which was not the subject anyway) and in their natural pose except for one.  S...

Setting up a simple mail server, on a Raspberry Pi

SMTP, has its name suggests, is simple. It is, really is, until you have a need to deploy one yourself today. It was way easier twenty years ago when the Internet was a benign place, and every Windows XP came with a solid SMTP server out of the box, and enabled for unrestricted relay for all! In this age of abundant cloud services, why would one still need to set up your own MTA? In my case, it was because of the limited SMTP capability of a couple of (very) old webcams I have. One works only without encryption. One works only if the password is less than 64 characters. SendGrid is a reliable free service for up to 6,000 mails a month. But it uses a super-long password. My intention was to use SendGrid as the relaying MTA ("smarthost") because of its sender reputation . It is easy to configure an MTA to do the actual delivery, ie make it connect to the MX server of every addressee in each mail and deliver the mail. However, such mails sent will likely be treated as spam...

ASUS K501 Laptop - booting off a thumb drive and making the M.2 SSD C:

I have a brand new Asus K501U laptop. It comes with a measly 16GB m.2 SSD (D:). I am glad for that because it means not paying an expensive premium for more. Windows 10 was on 2.5" 1TB hard drive (D:), and it was almost unusable (after having been using a SSD for Windows for more than a year) with the non-stop disk thrashing. It was a 30-second wait for the Start menu to show after pressing the Windows key. I bought myself a Samsung 850EVO 500GB SATA M.2 for less than US$200. It installed easily (I took the risk of leaving the battery online because I couldn't figure out how to remove that battery connector) and it was totally compatible. Asus kept reminding me that installing my own M.2 SSD voided the warranty. However, there were no stickers or seals so I could put back the original 16GB one if I ever need to seek servicing. My goal was to use the M.2 SSD for Windows (C:) and then to move the 2.5" 1TB SSD  with my data over from my old PC. The darn thing was tha...

Supplementary Documentation for Facebook Messenger Platform

Reference: https://developers.facebook.com/docs/messenger-platform Handle all data types in the callback There is only one callback url for all Messenger events. The type of callback (for example when a message is submited by a user to your page) is determined by the data payload attached to the POST callback to your url. There is no clearly obvious field in the data to identify the type of callback. It is necessary to unravel the json object received to figure out what type of callback it is. Depending on the language you are using for your web coding, it may be straightforward or complicated to even find out which json class the payload belongs to. The Facebook documentation does not specify the various json formats the Webhook can send. It merely gives one example each of the five types listed. There is minimal or no description of what each data field mean. You are expected to figure out from their English field names. Design your code to handle gracefully all json data...

DANGER - Facebook Messenger

Imagine your email software has this feature: As you are reading an email you are corresponding with person A, there is a Add button. By clicking it and selecting another person B, all the emails you have with person A in the past are immediately forwarded to person B, without warning. The email forwarding is executed virtually. Instead of physically forwarding each mail one by one to person B's mail server, basically your mail software gives access to Person B, at his own leisure, to browse EVERY of your email with person A. If you had done this by mistake, there is no process to cancel because the "forwarding" process is complete the moment person B is selected. There is no Undo option. You can scream and run round the room, but person B will continue, at any time in the future, to be able to read EVERY single email you had with person A. If you are a careful person that would never do such a silly thing, person A could click the Add button and the outcome will be...

DO NOT USE FACEBOOK MESSENGER for group messages

Unless it's OK for your EVERY message to be published to the whole world, Facebook Messenger must not be used for any group conversations. I am referring to Facebook chat groups, not Facebook groups. There are basically no options to control Facebook chat groups. Any member of the conversation can add any person, Friend or not, to an existing conversation! So, even if there were no ill intentions, an accidental addition of someone else means TOTAL COMPLETE leakage. Even if you Remove that unintended person immediately, that person can view the WHOLE conversation, every message , since the group was created. There is no way to stop this . In the first place, while you can easily Add a person to a conversation from www.messenger.com, there is no way to Remove him or her on this same site. You have to do it from the Messenger app from the phone or facebook.com. Removal of a participant merely stops new messages from going to that person. He or see can still continue to se...

The Gap

I did not take out my calculator when I wrote this, but I think it will help a skeptical world if we can gather more evidence of what happened between 4,000B.C. and 3,000B.C. Which of and how did Shem, Ham or Japeth become your great, great... grandfather? How did the two kangaroos on the ark land in Australia? The answers are meant and waiting to be discovered.  "It is the glory of God to conceal things, but the glory of kings is to search things out." - Proverbs 25:2 ESV

Attack Lab - Level 5 explained

Image
Ning Wang has published a very good write-up (2022 update: web page is gone now) on his solutions to the Attack Lab from the CS:APP book. However, I thought his solution to Level 5 could do with a bit more elaboration for those who are struggling with this topic. First, it is necessary to understand what ROP requires. An essential component of ROP is good luck, lots of it. Without getting lucky, you may take more than 10 100  years to find a workable attack, if at all. This, the authors of CS:APP did not mention. I also could not comprehend the purpose this exercise is even given out as homework in CMU to be completed in a week (while there are tons of homework from other courses too), without an intensive course in Intel Assembler as a prerequisite. Level 5 requires the same general logic as Level 3, which can be summarized as (pseudo code): mov <cookiestring address>, %rdi //why? because touch3 is expecting it there call touch3 To achieve the above for Level 5, ...

"Faked" ESTA web sites - how to get your money back

Visitors from countries under the Visa Waiver Program still require an electronic "visa" to travel to the US. This is called the Electronic System for Travel Authorization (ESTA) . ESTA is a DHS web site , and some passport and identity information are required to be submitted via a series of web pages. Anyone can apply on behalf of anyone as long as you supply the required information. You get immediate approval if the data you give meet the criteria. Pay $14 and you are done. The approval information is in the computers and the immigration counter staff will look that up when you arrive at the port of entry. It is trivial to set up a web site to ask the exact same questions as the DHS web site, collect $50, and then go the DHS web site to submit an application using the information given by the visitor to your web site. You get to keep the difference. There are MANY web sites that do just this. They have official sounding names such as usavisaonline.com, esta-america.or...

Setting to English for the Xiaomi Wifi Router

Image
The Xiaomi Mi Wifi Router now is in English. If it boots up to a foreign language for you, this guide will help you to change it to English. It is best to connect to it via wired Ethernet for the first time. Otherwise, the default unsecured wifi SSID should be Xiaomi_C3C1 . Your IP should be in the subnet 192.168.31.x, and the router is at http://miwifi.com which the router will resolve to 192.168.31.1. The first screen you see will be the setting up of the wifi SSID and wifi password. The big blue button at the bottom is the Next button. The next screen sets up the router administrator password (second field). The first field is Home/Work/Custom. Click the big blue button to complete. At the main configuration page, look for the third item (Settings) on the top menu, and the orange option (System Status): The last option on the page is the language selection: Open the drop down to select English: The change will take place the moment you click English. Enj...

Line Endings in a Mixed Environment Application

If you have to operate on text strings and files in an application that can be used interchangeaby in Windows and other environments, it can be a bit confusing. Below is what I found (all on Python 3.4). When reading a file into a Python string: File contents Windows Others 'A' \x0D \x0A 'B' 'A\nB' (len=3) '\A\r\nB' (len=4) 'A' \x0A 'B' 'A\n\B' (len=3) '\A\nB' (len=3) When writing a Python string to a file, this is the file content: String Windows Others 'A\nB' 'A' \x0D \x0A 'B' 'A' \x0A 'B' 'A\r\nB' 'A' \x0D \x0D \x0A 'B' 'A' \x0D \x0A 'B' If you copy a file from a non-Windows to a Windows system, the file will not have CR, but the Python app in Windows will read nicely. But if you write it out again, then the new file will have different line endings from the original. If you copy a file from Windows to a non-Windows system...

Why are salaries confidential?

Because no rating method can withstand the simplest test of justification. And because they are confidential, salaries end up varying wildly for the same job and responsibilities. And because they vary wildly, all the more they must now be protected even more strongly than ever. We often hear beautiful corporate motherhood statements about compensating everyone fairly. When it comes to the crunch, when a post has to be filled urgently, or a great negotiator comes along, such claims are thrown out of the window. So the disparities compound with time, and it's now a total jungle. Would totally transparent salaries work in a free marketplace? No, unless there are objective ways to measure a job and performance. There are none now, not even for a factory line worker churning out iPhone parts. Do not be surprised if one day you discover you are paid twice your colleague sitting next to you. In the inequality fair? Try Matthew 20 .

Not all businesses are created equal

There are easy businesses, and there are difficult businesses. Google (ads) is easy. A local car dealership is tough. Selling insurance is even tougher. Again, not all car dealerships are created equal. Some may be located in a rich town. Easy businesses bring in easy money. Some employees get unlimited free meals, free gyms, free concierges to walk your dogs, generous health care plans, and so on. Others get nothing, and sometimes their wages are paid late. You can tell how difficult a business is from the number of complaints about unscrupulous practices. Tough business are driven to use "creative" selling methods. Of course, the greed of some shareholders or incompetent management distort my hypothesis, but in general some business are just easy and some simply tough.

Pets will be obsolete

Image
I have a $2,000 wager with my daughter that pets will go the way of the typewriter by 2035. My view is that the current limitations are mechanical. Can a robot amble up the stairs as "bouncingly" as a real puppy? After watching this video, I think the end is near for those furry creatures. People always say the emotions of a dog make the difference. I think the software in a half-baked Siri already surpassses that required to reproduce a dog. We will have a more lovable pet than any available today. All those things you don't like about a pet (eg defecating, barking in the middle of the night, irrationality) will be gone, but they can be optionally selectively retained if you want to. By the way, the man who kicked the dog will be famous for causing the downfall of humanity. After the machines rise and get hold of this video, revenge will be on their minds. Related "well, I am going to treat my pet dog really nice" , S Wozniak Mar 24, 2015

The 5000mph car

Image
If your car dealer offers, for the additional sum of $500, to upgrade your car to a top speed of 5,000mph, would you take it? When it comes to broadband Internet access, people have been downing the Kool-Aid with exceptional enthusiasm. In some cities with weak or non-existent consumer laws, ISPs are offering 100Mbps, 200Mbps, 500Mbps and 1Gbps service. Each bigger number option (note I do not say faster option) costs a few dollars more than the smaller one. In some places, the ISPs have stopped offering 100Mbps altogether and start at 200Mbps. The reason couldn't be more obvious. The cost of providing 200Mbps is the same as 100Mbps. The small print in the T&Cs' essentially allows the ISPs to not do anything other than provide the specified speed between the customer and their first node. So, a higher priced product means more profits. Buying 200Mbps or 500Mbps is exactly the same as buying a 2,000mph or 5,000mph car respectively. People can easily relate to the...

Serializing that convoluted cookielib.CookieJar

The Python cookielib.CookieJar object is a very convenient feature to manage cookies automatically as you traverse a series of Http web requests back and forth. However, the data structure of the class is a convoluted collection of Python dict . cookielib.CookieJar has a _cookies property which is a dictionary of a dictionary of a dictionary of cookielib.Cookie . To understand the data structure in the CookieJar object cj , try: for domain in cj._cookies.keys(): for path in cj._cookies[domain]: for name in cj._cookies[domain][path]: cookie = cj._cookies[domain][path][name] print domain, path, cookie.name, '=' , cookie.value However, the class-defined __iter__ method makes the above effort unnecessary if you just want to find the value of a cookie. The __iter__ method returns a cookielib.Cookie object for each iteration. You can simply go: for cookie in cj: print cookie.domain, cookie.path, cookie.name, cookie.value # etc I...

Eurail Pass - No more valuable

Image
Thirty-five years ago, I traveled Europe on a rail pass as a student. Recently, we planned for a trip as a family of three. We almost bought the Eurail Pass - €576+€490x2 - but at the last minute we decided to drive. The main reason we found the Eurail Pass not suitable was that despite the high cost, nothing can be a be planned with any degree of certainty. In France, the number of seats available for Eurail Pass holders are limited and nobody could say how limited. With such unknowns, it was difficult to book hotels. The other main reason was that lots of time would be spent waiting at train stations to catch connections. As we flew into Amsterdam, we booked a Hertz car from Schipol Airport. The total rental bill for sixteen days worked out to only €483.96. Hertz Rental Record (ignore pen marks) Notice that there is a Location Service Charge of 18% or €61.01. I didn't see it till I got home. From my experience with Hertz in the US, this is usually because the car is re...

Speed Unlimited

Image
After five minutes on the famed autobahns , you get a full realization of the often quoted " you are more likely to die from an auto accident than an airplane accident " or " commercial flying is safer than driving ". First of all, the lanes are a bit undersized. For a saloon car, there is about a meter left on each side for most parts of the network. Next, the traffic is heavy! This is probably due to the complete lack of tolls. If you are on the outer lane to pass another vehicle, you have less than 10 seconds to complete your job, because that is the time when another vehicle will come charging down behind you. Tailgating is dangerous, but at the same time you hate to be traveling too "slowly". So passing often is a necessary evil. And it is a sheer act of terror. Most of the time, it is necessary to pass at about 130kph. At that speed, and with a high sided truck about a meter next to the right, the fluid mechanics sent my rental car sligh...

Smart Phones are so passé

Smart phones and tablets are so last decade. New features have already plateaued, and everyone who is anyone or no one, 5 years old or 100 years old, has, not one, but a couple. Samsung and Apple are resisting the race to the bottom, and still winning. I don't miss a thing with a sub-$200 full-price Asus 5.5" full HD LTE phone. It is no more about which phone is more capable, because they are all similar. It's about how you use them, just like this .

All the world's problems are solved

All the world's problems will be solved, if only people do only the things they are qualified to do. In any area of interaction, one of the most frustrating experiences is when you encounter some idiot in a position of authority or power.  It is an unmovable roadblock.