Sunday, January 28, 2024

Two-factor Authentication

How many times a day do you find yourself trying to quickly remember yet another 6-digit code sent via SMS and quickly type it as part of logging in to various sites and services? This is one of those situations where a computer should be more helpful - after all, it KNOWS the code it just received! Why make you memorize it and then type it again?

Took me a lot of Googling to find this solution. While not perfect, it's workable, and I use it daily. Hat tip to "A Better Way to Copy Two-Factor Codes on macOS"

Add this to your .zprofile

2fa(){ sqlite3 "$HOME/Library/Messages/chat.db" "select text from message order by date desc limit 1" | grep -oE '[0-9]{2,}' | pbcopy }

Note that Terminal must be granted Full Disk Access. 

As you can see, this sequence of commands queries your Messages database for the last text message received, then grabs a sequence of numbers from it, and places it on Mac's clipboard, ready for you to paste.

To use, just issue 2fa command (you can certainly call it anything else) in Terminal after receiving that SMS, and - voila! - the code is ready to be pasted (command-V).

Alternatively, place the above command in .command file, do chmod +x, and drag it to the Dock (to the right of the separator). Then just click it once to execute.

Tuesday, September 14, 2021

VirtualBox does not survive macOS updates

Lately, macOS updates break VirtualBox with "Kernel driver not installed (rc=-1908)" error. Not only is this highly annoying and oh-so-expected, but a reasonable solution (that does not involve reboots into Recovery mode, endless uninstalls and reinstalls, etc.) to this error is not terribly easy to find. After some poking around, I came across this and it worked:

1) restart the Mac

2) % sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart

VirtualBox runs fine again. Whew!


P.S. Why am I still bothering with VirtualBox???

Thursday, February 20, 2020

Don't Save

I noticed that the latest version of Microsoft Office applications lost the ability to activate "Don't Save" button on Save dialog boxes with Command+D shortcut. Looks like they are complying with a rather long-term change in the MacOS to a new shortcut - Command+Delete. Well, I can't very well use that shortcut with my left hand which is really used to hitting Command+D by now, can I? Some googling revealed a solution. See https://osxdaily.com/2011/08/15/return-the-dont-save-keyboard-shortcut-to-commandd-in-mac-os-x-lion/ for details. Issue the following command in Terminal to get your Command+D back:
defaults write NSGlobalDomain NSSavePanelStandardDesktopShortcutOnly -bool YES
Voila, no need to retrain myself!

Friday, January 3, 2020

Using AppleScript for a Complicated Apple Mail Rule

My son's daycare sends us an e-mail with a link to pictures they take of kids during the day. It's adorable. I like to forward this e-mail to both sets of grandparents. One small problem - he only goes there 3 days per week, but e-mails arrive daily. Mission - avoid spamming the grandparents. The daycare used to put the day of the week in the Subject line and that made it very easy to set up rules in the Mac Mail app to handle the automatic forwarding. Lately, all Subjects are the same. So, AppleScript to the rescue - forward the message only if it arrives on specified days of the week. Disclaimer - I do not know AppleScript. Not even a little bit. So it's a lot of Googling and trial and error to get these occasional scripting attempts of mine to work. Here's what I cobbled together:


using terms from application "Mail"
on perform mail action with messages these_messages for rule theRule
repeat with eachMessage in these_messages
set theDate to the date received of eachMessage
set theWeekday to weekday of theDate
--display alert (theWeekday)
if theWeekday = Monday or theWeekday = Wednesday or theWeekday = Friday then
tell application "Mail"
set addressList to {"user1@yahoo.com", "user2@gmail.com"}
set theMessage to forward eachMessage --with opening window
tell theMessage
repeat with i from 1 to count addressList
make new to recipient at end of every to recipient with properties {address:item i of addressList}
end repeat
delete bcc recipients
delete cc recipients
end tell
send theMessage
end tell
end if
end repeat
end perform mail action with messages
end using terms from

Save the script to ~/Library/Application Scripts/com.apple.mail and set up a rule in Mail app with "Run AppleScript" action pointing to this script.

Tidbits to note: the if statement checks whether the message was received on specific weekdays I am interested in; I had to use a list ("addressList") and subsequently iterate over it to accommodate multiple recipients. 



Wednesday, October 30, 2019

If macOS 10.15 Catalina (and also 10.15.1, unfortunately) broke your ability to connect to certain Wi-Fi access points because the captive portal (splash page) does not appear, manually launching /System/Library/CoreServices/Captive Network Assistant seems to help. Thanks https://poweruser.blog/macos-catalina-wifi-issue-captive-portal-broken-45610cc016b5 for the suggestion!

Wednesday, December 6, 2017

VirtualBox "Wrong SSL Certificate Format" Error

VirtualBox (v5.2.2 as of this writing) on my Mac (MacOS 10.13.1) frequently fails to check for updates, etc. with the following error message: "Wrong SSL Certificate Format." I looked around periodically but could not find a solution. Until I stumbled on this: replace ~/Library/VirtualBox/vbox-ssl-cacertificate.crt with content from https://www.virtualbox.org/attachment/ticket/12340/vbox-ssl-cacertificate.crt Problem solved. Finally!

Wednesday, January 4, 2017

Wish List for Apple in 2017

Everyone is writing about what to expect or what they would want in the world of tech and gadgets in 2017. Here are my wishes for Apple:


  • Cool new iPhone - new camera, better/bigger screen. Need a reason to upgrade from 6
  • iOS improvements - simpler lock screen (iOS 10 really bungled it up), more intelligence, more customization (preference for maps, browsers, etc.)
  • Photo management is appalling! All I want is a single place (cloud) where all of the family's photos will end up. Is that too much to ask???
  • Free storage for backups. Do not make me pay $3/month - it's not cool
  • Music in iOS automatically blares the first song in alphabetic order when I connect the phone to car's media interface. Mine happens to be "ABCs" from "Baby Loves Jazz" album. Super annoying! Can I choose some other behavior to be the default instead?
  • iOS/Apple TV - need to support multi-user login. Why is Apple TV stuck with my kid as the only user???
  • MacBook Pro 2016 is slow and expensive. TouchBar seems unnecessary. Meh... I want a better laptop to replace mine from 2014. Could it be a tablet? Perhaps...
  • Continue freeing us from wires. Bluetooth earbuds - good (but VERY expensive). Wireless charging, please!
  • Siri has a LONG way to go on accuracy of recognition for speakers with [HHHeavy Russian] accent
  • Either miniaturize key Apple Watch components (heart rate monitor, Taptic engine, etc.) and stick them into rings/bracelets/third-party watches/phone/etc., or make a MUCH better-looking watch (like, making it round might be a good start).
  • Where is Augmented (or mixed)/Virtual Reality?
  • Home AI... Learn from Mark Zuckerberg's 2016 project. Need voice pickup/speaker/camera/WiFi/other sensors in each room + a bunch of AI-based features. 


And while I am at this...


  • Google - make Maps smarter. When I open the app in the morning, take a wild guess and offer "work" as the destination automatically, please (Apple's maps do that, but the navigation is - well, you know). Also, can you please add speed limit info? 


  • Wireless service providers - give up on data caps already. You know it's going to happen eventually - just do it already! Unlimited talk + unlimited data. Let's go!


  • Amazon - make Prime Video app for Apple TV. Your app on my TiVo does nothing to enhance my enjoyment of The Grand Tour. Quite the opposite!


  • Dunkin Donuts - please make your loyalty card available for Apple Pay. You promised this over a year ago. What gives?


  • Everyone - can we ditch the passwords already? Pretty please? How about some biometrics instead? Fingerprints, iris scans, face recognition, voice recognition, whatever... 


  • Anyone - see the last bullet regarding home AI in my Apple wish list. Make a device in the shape of a light bulb that combines all these features. One for each room for easy retrofitting!

VirtualBox Attached Media Conflict

This is for posterity sake, in case the same error happens again. Somehow, an image of VirtualBox Guest Additions media got "stuck" in the VM settings and my Windows 10 VM refused to load. Scary error in VirtualBox...

The solution was simple, but took a while to flail and eventually Google my way to it: How-To: Resolve Attached Media Conflicts in VirtualBox

Edit corresponding .vbox XML file and remove <Image> element from <DVDImages>:



Tuesday, January 5, 2016

David Pogue via RSS

Yes, I use RSS. Every day. I have a large collection of feeds and it is my preferred way of following a bunch of websites, publications, authors, etc.

David Pogue's posts and videos on Yahoo Tech used to be accessible at https://www.yahoo.com/tech/author/david-pogue/rss but this URL has gone silent recently. Not sure if it's a bug in Yahoo or a conscious effort to limit access to their content by users who are bypassing their native web pages.

Took me a while but I finally found a way to follow David again - via Tumbler. The new URL is http://pogueman.tumblr.com/rss.

Thursday, December 31, 2015

Terminology Mapping

Terminology mapping is always an exercise in fitting a square peg into a round hole. If that wasn't problematic enough, I am convinced that if you know too little about the subject matter, you will make a terrible hash of it; and if you are too immersed in it, you will get paralyzed by granularity mismatches and other nuances in meaning and practice. You must be simpleminded enough, bordering on idiocy but not falling into it, to get anything decent (assuming it is even within the realm of possibility) accomplished. Gotta love it.

Monday, July 21, 2014

Printer Setup

Next time I forget how to set up my printer (little laser Samsung ML-1665 attached via USB to my QNAP TS-219P+ NAS), here's the reminder:

Tuesday, May 27, 2014

QNAP and TimeMachine troubles

Both of my Mac laptops (running MacOS X 10.9.3 Mavericks) stopped recognizing my NAS – QNAP TS-219P+, firmware version 4.1.0 (yes, it's a beta) – for TimeMachine backup. After trying all the obvious troubleshooting steps – disabling and re-enabling TimeMachine in NAS interface, restarting everything, etc., I decided to call QNAP technical support. I was pleasantly surprised – no holding, polite technician on the line, asked to remotely connect to my Mac via TeamViewer. Here's what he did:

  1. In the web interface of the NAS, disable AFP in Control Panel / Win/Mac/NFS
  2. Disable TimeMachine in Backup Station
  3. ssh into the NAS, and delete all TimeMachine files (yes, including the backups) by doing this: rm -r /share/MD0_DATA/.timemachine 
  4. (He found the MD0_DATA directory by doing df -h)
  5. Re-enable TimeMachine in Backup Station (enter your password there); AFP gets re-enabled automatically
  6. Wait for a bit...
The Macs magically saw TimeMachine share! One laptop prompted me for username (TimeMachine) and password – I must have done something with its keychain, while the other happily started the backup as if nothing at all happened.

Moral of the story – in the question of QNAP vs. Synology, I still prefer QNAP. Oh, and once in a while, when you get really stuck, it's ok to call tech support. QNAP's is excellent.

Tuesday, January 31, 2012

Booting up instead of giving the boot

I am of a firm opinion that computers should not be allowed to die. Any computer, regardless of how old it is, should be functional. It doesn't matter if there is no reason to have it be functional. Who cares for a reason? It's a computer - it must run!

That is an easy tenet to abide by if your hardware is 2 years old. But how about a Windoze box I bought at a fire-sale price 10 years ago from an on-line dealer well known for low prices and just as well known for low quality hardware?

Dragonfire

Whatever was on its poor little hard drive has stopped booting a long time ago. So, Ubuntu Linux it is, right? Right!

Download the installer image, burn the CD, try to boot the computer - no go! All sorts of errors on reading the disk - looks like CD-ROM reader is not doing all that well.

Create bootable USB stick with same image. Try to boot the computer from USB - no go.

Ok, where's BIOS screen? This thing has some ancient VIA motherboard and I can't remember which keyboard key will drop me into BIOS screen on boot! I tried everything - ESC, all the Function keys, everything! For days I did this! Finally, I got it! Do you know what key does the trick on this one? "Delete"! Not even "Backspace" - unbelievable!

VIA Mainboard VPSD

Ok, so the usual weird lineup of USB-related devices, like "USB-ZIP" are listed in BIOS setup. You just know right away that this ain't going to work - this thing can't possibly support USB boot. Sure enough - no dice.

Give up? No way! There's one last resort (before breaking open the case and trying a a different hard drive, etc.) - Plop Boot Manager. This software claims to enable USB booting on hardware that does not support it. Magic! Download, burn the image to CD, and try to boot the computer with it. It works! I guess with this boot loader being so tiny, even this dying CD-ROM drive has enough oomph to read it. USB stick with Ubuntu installer goes in, I choose "USB" from Plop menu and - voila! - i'm in Ubuntu Installer.

Plop Boot Manager

So, "Delete" to get in BIOS; Plos Boot Manager on CD; and Ubuntu installer on a USB stick. Oneiric Ocelot, here I come!

Sunday, November 27, 2011

Windows speaks your language, but only for a large fee

Microsoft, what is wrong with you? We had guests visiting this weekend from abroad and they wanted to buy a laptop here. We found a great deal on a refurbished HP Pavilion dm4 (i5, 4GB, 14", 500GB for $530) at MicroCenter. THe laptop came preloaded with Microsoft Windows 7 Home Premium (64-bit). Once we had the machine charged and running at home, the first thing the owner wanted to do is to change the localization to Russian. Not an unreasonable thing to do, in my opinion - the guy speaks Russian and prefers to have his computer be localized to his native language. They all do that, right? I mean, look at an activation sequence of any Apple product - first question is always about the language you prefer. Linux is same, for that matter. Windows - not so much...

Imagine our surprise when we found out that this particular flavor of Windows 7 can not be localized at all! Only Windows 7 Ultimate (and Enterprise editions) are capable of downloading and applying Language Packs. This is unbelievable! Do you know how much it costs to upgrade Home Premium to Ultimate? Take a guess... Keep in mind that Apple charged $0 for next to last major OS upgrade and only $29 for the latest one. Here comes the answer - Microsoft wants $155 for the upgrade!!! Again, this is Windows 7 to Windows 7 - just changing flavors! Seriously, guys? I mean, compare that to the overall cost of the laptop!!!

So what are the poor owners of this useless Home Premium edition to do? Return the laptop and pay the restocking fee? Shell out big bucks to Microsoft just to get something that should be (and is on other OSs) so commonplace as to not even occur to ask or wonder about? Well, not without hitting Google first.

First bit of information - we're clearly not the first people asking this question. Duh! Second - here and there folks talk about attempts at circumventing this ridiculous crippleware. They look scary - regedit is prominently featured in convoluted instructions. But what do we have to loose?

The best instructions we came across are from WinCert.net. The author(s) did a very nice job by providing download links to actual language packs and decent instructions for installation/configuration. We decided to go for it. I'll spare you the details, including sneaky behavior by Windows in trying to hide the .cab file from us, etc. Suffice it to say that with a silent prayer, crossing all fingers and toes and rebooting after a particularly alarming registry change, the laptop booted up with a greeting in Russian. Whew!

What can I say - this was yet another in a long series of experiences which reaffirmed my deepest antipathy for Windows. No, other OSs are not perfect, but at least they "speak" your language!

Thursday, July 21, 2011

One day with Lion

Having upgraded to MacOS X 10.7 Lion the minute it became available (as one should), I collected some observations (in no particular order) during the first day with Lion. Here we go:

  • install from App Store - painless. Getting a semblance of an invoice from Apple - not so painless. Getting it reimbursed - we'll see about that...
  • natural scroll direction - first thing to get disabled (Trackpad preferences). The idea sounds good in principle, and makes sense on iPhone/iPad, but I am not feeling like going against 20 years worth of muscle memory.
  • new "scrollers" is the hallmark of Lion's GUI changes. While I do not miss old scrollbar arrows (good riddance!), the absence (until you begin to scroll) of an indicator of whether there's more stuff above or below the window edge is concerning...
  • "back" in browsers - another preference change to get back gesture-based "back" button activation. How come?
  • dashboard is better accessible now - that is a good thing
  • TimeMachine on 3rd party support broken. Awaiting a firmware update from QNAP.
  • Spotlight triggered a VERY long re-indexing of the drive
  • 2GB of RAM minimum - my older Apple Mac mini "Core 2 Duo" 1.83 is out of luck
  • dock icon badges with white outline scale down very poorly. Apple, are you kidding me???
  • dropped Java Runtime (though available for download automatically)
  • no waking up from sleep on trackpad movement? need to either click (which is weird on new trackpads) or hit a key. ANother unnecessary annoyance.
  • Citrix "AGAdminService" was taking up >90% of CPU resources - uninstalled here.
  • TechTool Pro 5 seems to take too much CPU as well - disabled it
  • Adium's Skype plugin does not work - disabled. By the way, tried new iChat with Yahoo Messenger capability - nice, but I am too used to Twitter feed in my Adium, so will stick with that
  • new scrollbars do not always get well-positioned in older software - NetNewsWire's left-most panel
  • Finder preference - new windows default to "All My Files" - I do not think so!
  • so there is no more ~/Library? Yawza! My Mac is morphing into an iPad right in front of my eyes! Option+Go in Finder to get to ~/Library...
  • three candy widgets at top left are no longer candy. Too small - ever heard of Fitts's law? And .-+ edge-to-edge on mouseover look ugly! Will try going to Appearance = Blue to get the candy back.
  • New GrowlMail v1.3 is available.
  • Mail.app - letterbox is finally native! Nice organization of reply threads. Favorite bar - Microsoft Entourage idea?
  • dialog boxes pop up a bit too aggressively
  • WTF did they do with Address Book GUI? Apple, where is your legendary simplicity?
  • native whole-disk encryption

Friday, June 18, 2010

E-books: converting among common formats and generating Stanza catalogs

Today's post is about e-books - more specifically, getting them from my Mac into my iPhone to be read with Stanza. Here is how:

Download e-books from the Internet. If you like books in Russian, check out WebReading. Please note that books there are in a format called fb2 - these need to be converted into epub - a format recognized by many e-book readers, including iPhone's Stanza.

To organize the books on your Mac I suggest the popular Calibre - a free and open source e-book library management application. The interface is a bit unorthodox, but it does the job nicely. Calibre is capable of converting an e-book into a variety of formats, including PDF for reading right on your computer. For my purposes, I converted my e-books to epub.

Next, I wanted to store my e-book collection online so that I can access and download them into Stanza app on my iPhone. I found a free Java-based application that makes that very easy - calibre2opds. This utility scans the Calibre library and generates a catalog that Stanza requires. Resulting files are saved into the same directory as the Calibre library. All that is left to do is to upload the entire directory to a webserver.

Get Stanza app here.

Once your e-book library is online, launch Stanza on your iPhone, click on "Get Books" at the bottom, then "Shared" at the top and finally "Edit." Click "Add Book Source" and use the following URL format: http://www.your-web-server.com/your-calibre-library-directory/_catalog/catalog.xml

Enjoy your e-book collection on your iPhone!

Monday, April 12, 2010

Connect to Remote Desktop Services as Admin on a Mac

So there's an option to connect to a Windows box as administrator with
mstsc /admin

On a Mac using Remote Desktop Connect, type
host_name /console
in "Computer:" filed of new connection window to get the same effect.

Thursday, March 18, 2010

VirtualBox Shared Folders with Ubuntu

Basically:

mkdir MOUNTED_FOLDER
id
sudo mount -t vboxsf -o uid=USER_ID SHARED_FOLDER_NAME MOUNTED_FOLDER

from: valibuk.net Accessing Mac OS X harddrive from Ubuntu in VirtualBox via shared folders

Sunday, March 7, 2010

Home Network Topology, March 2010

I came across a number of questions about home network topology, and decided to diagram mine and share. I am by no means an expert in networking, so if you have a suggestion or two on optimizing this layout, I would be most grateful.

Internet connectivity is provided by Verion FiOS and they installed Actiontec MI424WR in my basement. I have no objections to it as a router (able to control the firewall, no problems with outbound VPN, etc.), but its wireless is limited to 802.11g and didn't cover the entire house. So I looked for a wireless Access Point and settled on TRENDnet TEW-637AP (that was a over a year ago; I am sure there are other worthy products available now). I turned off Actiontech's wireless and TRENDnet took over - it's been exceptionally stable and I am very happy with it. It is set to 802.11n only.

TRENDnet was wired directly into Actiontech. A bit later it dawned on me that my network was limited to 100GB and I bought an unmanaged Gigabit switch (D-Link DGS 2208) and inserted it between my Actiontech and TRENDnet. I then wired the rest of the network to this switch.

The rest should be fairly self-expanatory. Upper left part of the picture shows my office setup. Note that I use Airport Express in wired mode to stream iTunes to my Logitech speakers (love sound quality!). I have a Network Attached Storage (NAS) box - Hammer Storage myshare. It's a fine NAS box, the only thing that bothers me is that the vendor promised a software upgrade with additional features, including iTunes server, and never delivered. On the plus side, it includes a decent print server and turns my super-cheap HP LaserWriter 1020 into a network printer (1020 is not Mac-compatible according to HP, and they are correct - I make it work but it takes a lot of weird contortions).

Did you notice my Newton Message Pad 2100? Very much alive and well!

Lower right is my AV setup - especially proud of my Mac mini - it is running Boxee and works great. Sound system (Bose LifeStyle 35) is not shown here because it is not on the network.

Not to forget my Slingbox - this amazing little gadget lets me watch my own cabe TV on my computer whenever and wherever I want, and I find myself using it frequently. Two thumbs up!

Also not shown are a bunch of assorted computers that are either not hooked up at all or are rarely used.

Lastly, my iPhone 3G is out of luck because I disabled 802.11g. 3G signal is good around here and I am not finding WiFi connectivity for iPhone all that necessary at home.

What's your home network like?

Thursday, January 28, 2010

iPad thoughts

Before reading any media reactions, wanted to jot down some of my thoughts after watching Steve's announcement

  • A Mac for couch potato. Hinges on new MacBook Pros do not keep the screen up when trying to use the laptop in the most ergonomic position anyway, so the tablet should be a perfect substitute
  • I see it as a "stay home device" - save for using it as a portable video player or a game platform
  • Appears perfect for consuming information (text-based, video); likely has similar limitations as iPhone re: data entry
  • Communication - without a user-facing camera falls short. Various chats require typing; video-conferencing is far better
  • Cons to applications in healthcare - bulky, fragile, limited data entry, though 30-pin connector allows for peripherals
  • Mobility factor - seems good to carry around the house, up-to-date WiFi built-in. Larger version of iPod Touch, but at home there's no need for it to fit into a jeans pocket.
  • Furthers cloud-based computing - would make sense to keep most if not all data (calendar, address book, bookmarks, RSS subscriptions, video content) in the cloud and sync
  • Con - iPhone OS instead of Mac "desktop" OS - introduces limits; encourages more spending at the App Store
  • Con - needs a user-facing camera
  • If something like Boxee can be built for iPad, I wonder if it could be a contender to a big-screen TV