A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

iPhone: No new pictures or videos were found on this device

(Windows) Sometimes photos get "stuck" on the iPhone, and the usual method of right-clicking on the iPhone in My Computer and importing doesn't work. It errors: "No new pictures or videos were found on this device".

The fix is to rename the file C:\Users\[username]\AppData\Local\Microsoft\Photo Acquisition\PreviouslyAcquired.db

NOTE: AppData will probably be hidden - you must make hidden files and folders visible in Windows Explorer options.

(source)

Prevent Windows from restarting after an update

Windows Vista/7: Start > search for gpedit.msc. Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Update and enable "No auto-restart for scheduled Automatic Updates installations".

All non-Home users can apply the same policy change by adding a new key to the registry. Go to Start > Run/Search for regedit. Navigate to HKEY_LOCAL_MACHINE SOFTWARE Policies Microsoft Windows WindowsUpdate AU. Create a new 32-bit DWORD value named NoAutoRebootWithLoggedOnUsers and give it a value of 1.

(source)

Oracle commands for MySQL/PostgreSQL users

Oracle tips for MySQL users:
  • Simple range: SELECT * FROM (SELECT * FROM foo) WHERE ROWNUM <= 100; -- equivalent of MySQL's LIMIT clause, only for start of table
  • Wrong range: SELECT * FROM (SELECT rownum r, f.bar FROM schema.foo f) WHERE r > 100 AND r <= 200; -- Selects a range, but order will be inconsistent, even if you add ORDER BY to inner select
  • Right range:
    SELECT * FROM (
        SELECT q.*, ROWNUM r FROM (
            SELECT * FROM schema.foo ORDER BY id
        ) q
    ) WHERE r >= 100 AND r < 200
    (source)
  • SELECT last_name FROM employees WHERE last_name LIKE '%d_g\_cat%' ESCAPE '\';
    • matches dog_cat, foodig_catbar, etc.
    • _ = any single character
    • % = any characters
    • \_ = literal _ (underscore)
    • ESCAPE '\'; -- set the escape character to \ (backslash)
  • SELECT ...... WHERE REGEXP_LIKE (instance_name, '^Ste(v|ph)en$');
  • ALTER USER foo IDENTIFIED BY "newpassword456!" REPLACE "oldpassword123!"; -- change password (REPLACE is new in 9.2)

Programming principles

* SOLID
* YAGNI
* KISS
* DRY
* TDD
* small methods, one level of abstraction per method (also methods over branches). No snappy abbreviation for this one :(

Programming quotes

Defensive code is the difference between fragility and robustness --gloryhack

Outlook 2007: Don't remove line breaks

Microsoft :'-(

Outlook 2007:
Tools | Options | Preferences | E-mail Options
Untick "Remove extra line breaks in plain text messages"

(source)