Re-enabling Repeating Keys In Yosemite

When programming, I and millions like me like to keep my hands on the keyboard and minimize the number of times that I have to spend time going through the process of lifting my hand off the keyboard to reach for the mouse, do something with the mouse, and return the hand to the keyboard. Being able to perform all editing functions from the keyboard is very efficient.

Thus, if an environment supports something like vim emulation, I’m all over it.

After upgrading to Yosemite I found that navigating in my JetBrains IDEs vim was dead. Even though key repeating is set in the keyboard preferences, keys won’t repeat. Worse, letters that can take accents pop up a menu that then expects me to choose and accent, e.g.

PressAndHold_and_Add_New_Post_‹_James_Reuben_Knowles_—_WordPress

Press and Hold Popup Menu

I recognize this as behaviour derived from iOS devices, and can sympathize with non-programmers scratching their head asking, “Why would anybody want keys to repeat? There are no words that contain kkkkkkkkkkkkkkkkkkkkk.” But, they are not programmers using keyboard navigation.

To disable this behaviour, enter the following command in a terminal.

defaults write -g ApplePressAndHoldEnabled -bool false

You’ll need to restart your programs to pick up this new default behaviour, however.

Apparently this new behaviour appeared in Lion, but with Yosemite is seems to be a default forced on everybody.

Posted in Mac | Leave a comment

Updating Array Elements in CoffeeScript Loops

Notes on updating array elements in CoffeeScript loops.

CoffeeScript doesn’t use the JavaScript C-style for(;;) loops. When one wishes to conditionally modify the array that’s being iterated over, how one might go about it may not be obvious at first.

If I wish to update an array without otherwise disturbing it, the “obvious” answer will not work:

shouldUpdate = (colour) ->
    .... details ....

colours = ['red', 'green', 'blue']
for colour in colours
    colour = "foo" if shouldUpdate(colour)

This is because the compiler produces code like:

for (_i = 0, _len = colours.length; _i < _len; _i++) {
  colour = colours[_i];
  if (shouldUpdate(colour)) {
    colour = "foo";
  }
}

Note that in line 2 the value in colours[_i] is copied to a separate variable colour, thus assigning to colour will not affect the array itself.

If we wish to modify the array in place, then we can tell CoffeeScript to provide us with the index thus:

shouldUpdate = (colour) ->
    .... details ....

colours = ['red', 'green', 'blue']
for colour, index in colours
    colours[index] = "foo" if shouldUpdate(colour)

There may be a slicker way to do this, but for now it suits my purposes.

 

Posted in Programming | Tagged , , , , , , , | Leave a comment

Maximize a Window in OS X 10.10 (Yosemite)

One of the changes in Yosemite is that the green maximize button on windows no longer maximizes, but puts the window into full screen mode. For how I work, this is a productivity killer. I don’t see any setting to revert this behaviour. However there is a workaround.

Hold down the Option key when clicking on a window’s green button to maximize. This will take a little time to build a new habit.

Update

Apparently one can also double-click the window’s title bar, which I’m quite happy to see.

 

 

Posted in Mac | Tagged , , , , , | Leave a comment

Getting MySQL Working After OX 10.10 Yosemite Upgrade

I updated my development computer to OS X 10.10 (Yosemite) and found MySQL was dead. These are notes on what I did to get MySQL running again.

Update the latest MySQL off of their website. At the time of this writing, that is Mac OS X 10.9 (x86, 64-bit), DMG Archive from the MySQL download site.

I found that MySQL would run but MySQL Workbench couldn’t connect. It turns out that the data directory is kept under each version. Thus, when I updated from 5.6.17 to 5.6.21 MySQL was pointing to a fresh new database.

The new version is installed in /usr/local/mysql-5.6.21-osx10.8-x86_64, with the MySQL data files in the data subdirectory. I renamed the data subdirectory to ensure I have a backup and made a copy of the old directory.

sudo cp -rp ../mysql-5.6.17-osx10.7-x86_64/data .

It appears that MySQL is working fine now. Note that this will only work for incremental revisions. If you’re reaching across minor version numbers (such as 5.5 to 5.6), the changes in structure will probably not work. (You did make a backup of the original data directory, didn’t you?)

 

 

Posted in Mac | Tagged , , , , | Leave a comment

Setting the Probotix Comet Configuration to Find Your G-Code Library

Personal notes on how to get the LinuxCNC software that comes with the Probotix Fireball Comet CNC to find your personal library of G-code files.

The Probotix Comet controller software (AXIS) by default looks for extra G-code files in /home/probotix/emc2/nc_files.

If one does not wish to store files there, one can edit the /home/probotix/configs/Comet/Comet.ini to point it to the directory of choice.

Change the  PROGRAM_PREFIX parameter to point to the directory of choice. (As always, please back up files before hacking them.)

This will allow one to, for example, load a standard preamble with the G-code:


o<preamble> call

or otherwise allow one to create a library of useful routines.

 

Posted in CNC & Robotics | Tagged , , , , , | Leave a comment

Probotix Comet CNC Startup and Shutdown

These are my notes on starting and stopping the Probotix Fireball Comet CNC mill.

Danger

I’m not kidding about danger. There is one cardinal rule.

The motor control box must never have power without the AXIS control software running.

The AXIS control software (the Comet icon on the desktop) must and I repeat must be running before power is applied to the stepper motor control box, and must remain running as long as power is applied to the stepper motor control box.

Why This Is Important

The motor control box translates signals from the computer’s parallel port into motion and spindle control. The AXIS software controls the signals to the parallel port. If the motor control box is powered on before the AXIS software is running, or the AXIS software is exited before the motor control box has been powered off, then the parallel port and thus the motor control box will be thrown into an unknown, unpredictable, and uncontrolled state and the mill can start operating by itself.

Think about how dangerous this is:

  1. The spindle can start without warning and the red emergency stop button will not be operable. (I had this happen to me.)
  2. The motors can start moving  without warning and the red emergency stop button will not be operable. These motors are powerful and can crush fingers.

A powerful uncontrolled robotic cutting tool is not something to leave to chance.

Steps

Now that I’ve beat that horse to death, here are the steps to safely start up and shut down a Comet:

Start Up

  1. Start the computer
  2. Double click on the Comet program icon and leave it running.
  3. Power on the controller box.
  4. Ensure the emergency stop button on the machine is out (off). Twist the knob to reset it.
  5. Turn on the (virtual) machine power on. Push F2 or click on the orange power button icon on the top tool bar of the AXIS software.
  6. Use Home All button to put the CNC into a known state.
  7. Use the machine to make all manner of wonderful creations.

Shut Down

  1. Turn off the controller box.
  2. Exit the AXIS (Comet) program. You can use the X in the upper right-hand corner.
  3. Turn off the computer. In the top right hand corner of the screen there is a power symbol. Click on this to bring up the menu and select Shut Down….

Restarting LinuxCNC

If you ever need to restart LinuxCNC power off the stepper motor controller box first. The motor control box must never have power without LinuxCNC running. (Did you think that I was done beating that horse?)

I have had problems having LinuxCNC crash when trying to restart it. If this happens, reboot the computer. There is a power symbol in the top right corner of the screen. Click on this to bring up the menus and select Restart….

 

Posted in CNC & Robotics | Tagged , , , , , , , | Leave a comment

Contact Form Updated

The venerable cformII plugin has been retired as it’s not supported  any more, and spam bots started pinging my mailbox.

I’m hoping the that the shiny new contact form plugin works well.

 

Posted in Announcements | Leave a comment