Keyboard Shortcuts for macOS

•November 22, 2017 • Leave a Comment

Text Navigation, Selection, and Editing

  1. Home / End: Command ( ⌘ ) + up arrow / down arrow
  2. Page up / down: Option ( ⌥ ) + up arrow / down arrow
  3. Beginning of line / End of line: Command ( ⌘ ) + left arrow / right arrow
  4. Previous word / Next word: Option ( ⌥ ) + left arrow / right arrow
  5. Select all: Command ( ⌘ ) + A
  6. Select from cursor to previous word / next word: Shift ( ⇧ ) + left arrow / right arrow
  7. Select from cursor to beginning of line / end of line: Command ( ⌘ ) + Shift ( ⇧ ) + left arrow / right arrow
  8. Select from cursor to beginning of document / end of document: Command ( ⌘ ) + Shift ( ⇧ ) + up arrow / down arrow
  9. Cut / Copy / Paste: Command ( ⌘ ) + X / C / V
  10. Undo / Redo: Command ( ⌘ ) + Z / Y
  11. Check Spelling and Grammar: Shift ( ⇧ ) + Command ( ⌘ ) + Colon ( : )

Applications

  1. Quit application: Command ( ⌘ ) + Q
  2. Switch between applications: Command ( ⌘ ) + Tab
  3. Switch between windows in the same application: Command ( ⌘ ) + Backquote ( ` )
  4. Open Preferences for the Active App: Command ( ⌘ ) + Comma ( , )
  5. Open new document or window: Command ( ⌘ ) + N
  6. Close Window: Command ( ⌘ ) + W
  7. Zoom in or out of a Safari window: Command ( ⌘ ) + Plus Sign ( + ) or Command ( ⌘ ) + Minus Sign ( – )
  8. Expanding Save As Dialog in Finder: Command ( ⌘ ) + (“Cmd+”)
  9. Open new tab in Chrome: Command ( ⌘ ) + T
  10. Chrome history: Command ( ⌘ ) + Y or Command ( ⌘ ) + Shift ( ⇧ ) + H

Folders

  1. Open Desktop Folder: Command ( ⌘ ) + Shift ( ⇧ ) + D
  2. Open Documents Folder: Command ( ⌘ ) + Shift ( ⇧ ) + O
  3. Open Utilities: Command ( ⌘ ) + Shift ( ⇧ ) + U
  4. Open iCloud Drive from the Finder: Command ( ⌘ ) + Shift ( ⇧ ) + I
  5. View a Quick Look Slideshow of Selected Files: Option ( ⌥ ) + Command ( ⌘ ) + Y
  6. Jump to the AirDrop Folder on Your Mac From The Finder: Command ( ⌘ ) + Shift ( ⇧ ) + R
  7. Empty Trash with no confirmation: Command ( ⌘ ) + Shift ( ⇧ ) + Option ( ⌥ ) + Delete

System

  1. Spotlight Search: Command ( ⌘ ) + space bar
  2. Select and Launch Apps with your Keyboard: F4 (Launchpad) + Arrow Keys
  3. Lock Screen: Command ( ⌘ ) + Control ( ⌃ ) + Q
    1. Keyboards with Eject ( ) button: Command ( ⌘ ) + Control ( ⌃ ) + Eject (  )
  4. Log Out of your macOS user account: Shift ( ⇧ ) + Command ( ⌘ ) + Q
    1. Bypass the log out dialog: Option ( ⌥ ) + Shift ( ⇧ ) + Command ( ⌘ ) + Q
  5. Force Quit an application: Command ( ⌘ ) + Option ( ⌥ ) + Esc
  6. Hide or Show the Dock: Command ( ⌘ ) + Option ( ⌥ ) + D
  7. Display and Control Accessibility: Option ( ⌥ ) + Command ( ⌘ ) + F5

Other

  1. Get details on any word: Command ( ⌘ ) + Control ( ⌃ ) + D
  2. Finder QuickView: Space bar
  3. Take a screenshot of the entire desktop: Command ( ⌘ ) + Shift ( ⇧ ) + 3
  4. Take a screenshot of an application: Command ( ⌘ ) + Shift ( ⇧ ) + 4
    1. Press the spacebar to toggle between draw and select

[Most of these are learned and/or from memory while others were compiled and abbreviated from the excellent articles “15 macOS Keyboard Shortcuts To Improve Your Productivity” and “Ten More macOS Keyboard Shortcuts to Improve Productivity” published 2017/10/13 and 2017/10/20 respectively.]

Other resources to consult:

Advertisements

Useful HTTP Response Headers for IIS and ArcGIS JavaScript Web Applications

•February 6, 2017 • Leave a Comment

This is in addition to a question I answered on Stack Overflow where someone had asked how to turn off IE compatibility mode (hint: set “X-UA-Compatible” to “IE=edge”).

These additional response headers are useful in making ArcGIS Server REST endpoints accessible across sites without adding XSS vulnerability.

Useful HTTP Response Headers for IIS and ArcGIS JavaScript Web Applications
Access-Control-Allow-Credentials true
Access-Control-Allow-Headers Origin,X-Requested-With,Content-Type,Accept
Access-Control-Allow-Methods GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin *
X-UA-Compatible IE=edge

Learning Python

•February 12, 2015 • Leave a Comment

Books

Learn Python the Hard Way, 3rd Edition” is available online for free or you can buy the eBook.

Several Packt Publishing titles also come to mind:
Learning Python Design Patterns
Expert Python Programming
Python Tools for Visual Studio
Raspberry Pi Cookbook for Python Programmers
BeagleBone for Secret Agents
Python for Secret Agents
Python Programming for Arduino

I would suggest creating an account with them and signing up for their daily special.

Some people don’t like O’Reilly but I find their books are pretty good as well:
Head First Python

IDE

One thing Python lacks is a solid IDE but that’s changed now that Microsoft has made Visual Studio Community 2013 available for free. Couple this with the Packt title, “Python Tools for Visual Studio“, listed earlier and you have a viable platform.

Some people swear by IDLE; I like Google’s PyScripter myself.

There’s also a great stackoverflow article listing many of the IDEs available and their feature set.

Python 2.x vs 3.x

There’s a war of sorts going on in the Python community since the release of version 3.x which breaks some existing 2.x code. The general consensus is to steer people towards 3.x unless they have to support 2.x legacy code or require a plug-in that’s not supported in 3.x.

Globally disable OnSwipe on iPad

•August 18, 2011 • Leave a Comment

Yep, I stole this entry’s title from the support article in the WordPress support forums.

Please do all those iPad owners a favor and disable OnSwipe on your blog. It does nothing to enhance or beautify your blog. In fact, it does the opposite and removes your individualization thus making all WordPress blogs look (and bounce) the same (boring).

How to Compile a Simple OpenGL Program (Part I : Symantec C++ 7)

•May 22, 2010 • 1 Comment

The other day, I was searching through my collection of discs and was distracted by a shiny thing: Symantec C++ 7.

Symantec C++ 7 is a complete development environment for Windows 16-bit & 32-bit and runs under MS-DOS, Windows 3.1, Windows NT, & Windows 95. While looking through the contents of the disc, I spied an OpenGL samples folder with one specifically named Book which I believe to be a reference to The Book.

I’ve always been fascinated by computer graphics so I decided to see how this compiler, released in 1995, held up today and try out the samples. The software includes an installer but more importantly, a folder is included on the disc from which the compiler and IDE can be run directly making this task easy to accomplish.

I copied the SC folder (BIN, HELP, INCLUDE, LIB, SAMPLES, etc.) to the local hard drive and then wrote a command script to set the environment for it:

@echo off
title Symantec C++ 7
set SYMANTEC7=C:\Tools\Symantec7
set include=%SYMANTEC7%\Include
set lib=%SYMANTEC7%\Lib
path %SYMANTEC7%\bin;%SYMANTEC7%\redist32;%PATH%
echo ----------------------------------------------------------
echo SCW32 : Windows 32-bit front-end
echo ----------------------------------------------------------

I also placed a shortcut in the Start Menu to execute the command script with the following settings:

Shortcut Name: Symantec C++ 7

Target: %COMSPEC% /k C:\Users\Public\bin\Symantec7.cmd

Start In: C:\Tools\Symantec7\Samples\win32

Comment: Set environment for Symantec C++ 7 for Windows

Icon: %SystemDrive%\Tools\Symantec7\bin\SCW32.EXE,0

I started SCW32 (the 32-bit version of the IDE) and voila! I opened up one of the OpenGL projects, compiled, and executed it:

OpenGL Sample of an array of teapots with different material colors.

OpenGL sample of an array of teapots with different material colors.

Very cool. In looking at the project definition, I noticed it was a single C file. Knowing there were 69 68 individual projects, I wondered how I could simplify this so it would be easier to compile all the examples. Fortunately, in addition to the project files, which are proprietary to Symantec C++, there are makefile equivalents for each project. Unfortunately, the make utility included with Symantec can’t seem to build them (I’ll figure out why at some other point in time).

The easier solution for the time being was to figure out what information the compiler needed to compile each source file into an executable. Reading through the makefiles for the options and linkage and then experimenting lead me to this:

sc -mn -C -WA -S -3 -a8 -g TEAPOTS.C glaux.lib glu32.lib opengl32.lib gdi32.lib

Here’s an explanation of the command line options used for Symantec C++ 7:

-mn
Memory model = Win32s, Windows 95, Windows NT
-C
No inline function expansion
-WA
Windows Executable
-S
Always generate stack frame
-3
80386 code (4 : 80486; 5 : Pentium)
-a8
Alignment of struct members
-g
Generate debug info
glaux.lib glu32.lib opengl32.lib gdi32.lib
The libraries necessary for linking

Armed with this knowledge, there are a couple of ways to compile all the examples. The simplest method is to use a shell “for” loop:

for %c in (*.c) do sc -mn -C -WA -S -3 -a8 -g %c glaux.lib glu32.lib opengl32.lib gdi32.lib

Interestingly, this works fine in Windows XP and all the examples compile. But in Windows 7 (64-bit), as it loops through each source file, some examples will compile, others generate an “OPTLINK” exception, and then the compiler will finally hang. The exceptions and hanging seem to be arbitrary as they occur at different points in the loop. Yet, no problems are encountered if each command is executed manually.

An example of the OPTLINK exception.

An example of the OPTLINK exception.

The “for” loop could be speeded up by pre-compiling the headers beforehand with the -HX compiler option.

Another method would be to create a makefile to incorporate all the projects with dependencies to build all & clean all. I’ll leave this as an exercise to perform at a later time.

In the end, this was a fun exercise getting to know an old friend. I’m surprised at how well the compiler (SC) has held up through the years despite all the changes made Windows but even more so that the IDE (SCW32) functions so well. Even though the size of the buttons and dialogs point to a time where 800×600 was king, the interface was ahead of its time and maybe even better than Visual Studio in some ways.

My interest in OpenGL has also been rekindled, especially in regards to Android, although I consider my desires to be more experimental in nature. I’m not a graphics artist so I don’t believe I’ll be publishing anything serious. But it’s still fun to play with.

The next step is to compile these examples with Visual Studio but before doing so, I’m going to slight detour into some history which involves Teapot

I Was Never A Real Programmer* But…

•March 28, 2010 • Leave a Comment

What I miss is the experience I enjoyed when programming close to the metal. Whether it was learning from Peter Norton or Tom Swan how to write assembly code, reading Ray Duncan’s treatise on MS-DOS, working with the intricacies of UNIX, or delving into the guts of an Apple II, I was never that far from the core of the machine. [Okay, maybe a bit more isolated from the hardware with UNIX.]

Today, we deal with operating systems and shells that try to protect us from ourselves: Windows 7, Snow Leopard, KDE, Gnome.

Today, we deal with frameworks that sit on top of the operating system and further abstract us from the underlying hardware: Microsoft’s .NET Framework to Apple’s Cocoa.

Today, we deal with frameworks that sit on top of the web browser, from jQuery to Dojo to Flash to Silverlight just to name a few, to insulate us from the network underpinnings.

Today, we no longer have to create custom file formats to store records because we have databases to perform that work for us: Oracle 11g, Microsoft SQL Server 2008, MySQL. Or we can save our data as XML.

Don’t get me wrong. Most of these things make development so much easier.

I’m glad I no longer have to create the framework to implement the functionality of a user-interface. Does the computer have CGA, EGA, or VGA? What interrupt trips when the mouse is moved? How do I respond to it? Doing it once or twice was enough to give me the experience and understanding I needed.

I no longer have to develop code to write out and read custom file formats, translate data from big-endian to little-endian, or ensure my binary file is the right size. Better still, now I can more easily share my data with others and vice -versa.

Instead, I get to concentrate on the logic and relationships to actually solve the problem at hand. I don’t even have to know what operating system my application is running on; the application is “happy” as long it has connectivity to the database.

But I still miss those opportunities when I had to drill down and really learn what was going on behind those plastic keys I press. I may have crashed and burned occasionally, spectacularly even, but I always came away educated further and having fun with it all. And the experiences are something I’ll never forget.

[While writing this, I’m reminded of an illustration on the growth of GIS from niche to enterprise within an organization contained within Focus on GIS Component Software Featuring ESRI’s MapObjects written by Robert Hartman. Perhaps another related article?]

* A tip of the hat to those Real Programmers out there.

ESRI Make A Map (βeta)

•November 21, 2009 • Leave a Comment

ESRI has made an interesting web application available that allows you to plug a map into your own page. After navigating to the “Make A Map” site,

  1. Type in a location (city or zip code)
  2. Select a predefined demographic layer
  3. Resize the map window as needed
  4. Post the “iframe” code into your page or link to the provided URL of your customized map

So, here’s my customized map 🙂