Show Upload Progress with Python aiohttp and tqdm

March 11th, 2017 No comments

I wanted to be able to show file upload progress for my Python asyncio-based library but could not find any obvious solution using aiohttp and tqdm. Here is what I created. Essentially I intercept the calls to reading a file and update the tqdm progress bar accordingly.

The key elements look like this:

    class tqio(io.BufferedReader):
        def __init__(self, file_path):
            super().__init__(open(file_path, "rb"))
            self.t = tqdm(desc="Upload",

        def read(self, *args, **kwargs):
            chunk = super().read(*args, **kwargs)
            return chunk

Read more…

Categories: Utility Tags: , ,

Python asyncio and tkinter Together with TCP and UDP

February 3rd, 2017 No comments

I finally figured out at least one way to have a Python tkinter app use asyncio event loops, so I thought I should share it. In the end, the solution was simply running an asyncio event loop on another thread. I hope one day Python will merge the two event loops, but for now this works OK.

I have this on pastebin also:

The key points are extracted here:

        # Thread that will handle io loop
        def _run(loop):

        ioloop = asyncio.new_event_loop()
        asyncio.run_coroutine_threadsafe(_connect(), loop=ioloop)  # Schedules connection
        t = threading.Thread(target=partial(_run, ioloop))
        t.daemon = True  # won't hang app when it closes
        t.start()  # Server will connect now

Read more…

Categories: Utility Tags: , , ,

Can Humans Fail the Turing Test? Yes.

June 30th, 2016 1 comment

I had the unfortunate experience of having to talk to CenturyLink about something, so I thought I would give the “Live Chat” feature a try. I wanted to know how much it would cost to have service for three iPhones and whether or not they would pay any cancellation fees with my current carrier.

I was asking too much. I am still not convinced that I was talking to a real human being; maybe I just have too much faith in humanity to believe this was a human operator.

Here is the transcript of the chat that took 15 minutes to get nowhere.

Read more…

Categories: Uncategorized Tags:

Fixed Poor Netflix Performance with pfSense

June 3rd, 2016 1 comment

I was having terrible Netflix performance when connecting through my pfSense 2.3 router (running on XenServer 6.5), but Netflix was fine when I bypassed pfSense altogether or when I connected to Netflix through my StrongVPN connection passing through pfSense.

After much research, investigations, and Wiresharking, I made the following three configuration changes that seem to have fixed the problem.
Read more…

Categories: Uncategorized Tags: , , , ,

Hello world!

May 10th, 2016 No comments

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Categories: Uncategorized Tags:

My iPhone Leaf Fell Out

April 26th, 2016 No comments

I hope this is a unique problem, but my month-old iPhone SE with the “fancy” inlaid Apple logo on the back had a leaf failure. The “color matched stainless steel logo” on the back is made of two separate pieces, the apple and the leaf, which are pressed into place.

My leaf fell out.

At a genius bar Apple replaced the phone free of charge, but they did not know how to classify the problem. I was the first they had heard of such a problem.

I suspect it was sucked out by a car holder I use with a sticky pad that holds the phone in place.


Categories: Uncategorized Tags:

Run iMovie HD (and maybe other older applications) in Yosemite (and now El Capitan)

January 23rd, 2015 149 comments

I was disappointed to see that I could no longer run iMovie HD (available here) after upgrading to Mac OS X 10.10 Yosemite. The Finder gave me an error saying, You can’t use this version of the application “iMovie HD” with this version of OS X. You have “iMovie HD” 6.0.3. I was delighted to discover a workaround that works, well, for now. Here’s how.

UPDATE, Sept 2015: Looks like this trick works in El Capitan too.

UPDATE, Nov 2015: Skip straight to Rolando’s comment below for the best solution yet, or download the already-modified iMovie from this this related post right here on this blog.

iMovie HD error message on Yosemite
Read more…

MSP430 (or Arduino) Library for PCF8574 I2C Port Expander

August 8th, 2014 10 comments

port-expanderI bought an 8-port general purpose IO expander for adding ports to my MSP430 projects via I2C, but I couldn’t find any library for accessing it. Fortunately the I2C communication with the on-board Texas Instruments PCF8574 chip is pretty straightforward, so after studying the LiquidCrystal_I2C library, which uses the PCF8574 for communicating with the popular 16×2 LCDs, I made my own library for this port expander. You are welcome to it. I release it as Public Domain code.

Download PortExpander_I2C
Read more…

Setting up Bluetooth to Bluetooth Master with HC-05 for my 16×2 LCD Office Door Sign

July 30th, 2014 1 comment

For my office door I’ve made a sign using a 16×2 LCD display controlled by an MSP430 and connectable via Bluetooth. A button lets me cycle through canned messages like, “The doctor is in,” and “At lunch.” Via Bluetooth I can give it an ad hoc message that I had not pre-programmed.

Door sign using 16x2 LCD, MSP430, Bluetooth, 433Mhz radio

Door sign using 16×2 LCD, MSP430, Bluetooth, and 433Mhz radio

Read more…

DNS is a Hog (for DNS) on iOS

June 14th, 2014 No comments

I can’t imagine how DNS services on my iPhone could chew up 5.7 MB of data in two weeks. These are tiny little queries being made, aren’t they?


Categories: Uncategorized Tags: , ,