Tag Archives: OS X

OS X Server 5 Shenanigans

OS X Server 5 for OS X 10.10. and 10.11, while a significant improvement to Lion Server for OS X 10.7, still behaves oddly when mixing SSL and non-SSL requests. Whereas before it wanted every request redirected to the SSL pipe, now it will let you do either. It won’t, however, let you do both.

WordPress will try to do both. Why? I dunno. It should work, and did on plain Apache 2, but OS X Server 5 puts up a proxy to the WAN and serves from a different port. This is not presented upfront to the Server.app user, but is most likely in the docs. RTFM much? Ha-ha! No.

The affect this had on my WordPress install is instead of logging in being presented with a page that merely stated,

You don’t have permission to view this page.

Or some such equally helpful information. A little web searching turned up the answer. To overcome this the following can be added to wp-includes/http.php

/* Adding this BS for OS X Server 5 being a dick... */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS']='on';
}

I saw a post on wordpress.net that said to put this into config.php, but that did not work for me. Neither did the mod_rewrite mumbo-jumbo in that thread and apparently it didn’t for the OP, either.

I admit being ignorant to what HTTP_X_FORWARDED_PROTO is, but it appears to be a HTTP header from an Apache mod Apple is running. Unique to them or something well known? I dunno. I don’t pretend to try to keep up with this stuff any longer. That’s why I went to WordPress; So I wouldn’t have to.

Save list of folder contents

[UPDATE] Revisited this one and made it a little nicer. It is faster and gives a total count of directories and files, skips invisibles (but you can undo that), and doesn’t error on item names longer than 31 characters. Confirmed to run on 10.4, YMMV.

This AppleScript will create a file containing a tree style list of all files inside the chosen directory and save that list in a file created in that directory. The list file will include the path of the listed directory as well as the date and time it was saved and a tally of me bananas… er, folders and files under the starting directory.

The default directory in the choose dialog is the folder of the Finder’s frontmost window unless there are no Finder windows. In which case the default is the Desktop folder.

It does not follow aliases (not sure about symlinks) and will indicate an alias by placing ” [alias]” behind the file name.

This is actually a modified version of a script that’s been around the web for years.

-- http://strawhousepig.net/

set fileList to ""
set d_count to 0
set f_count to 0
global fileList, d_count, f_count

on listFolder(f, s)
list folder f as alias without invisibles
repeat with i in the result
set finfo to (info for alias (f & i))
if folder of finfo then
set d_count to d_count + 1
set fileList to fileList & s & i & "/" & return
listFolder(f & i & ":", s & " ")
else
if alias of finfo then
set f_count to f_count + 1
set fileList to fileList & s & i & " [alias]" & return
else
set f_count to f_count + 1
set fileList to fileList & s & i & return
end if
end if
end repeat
return {fileList, d_count, f_count}
end listFolder

try
tell application "Finder" to set cwd to (POSIX path of (folder of window 1 as string)) as POSIX file
on error
set cwd to path to desktop folder
end try
set theFolder to (choose folder "Select a folder to list:" default location cwd) as string

--This will get the name of the folder for use in the name of the generated file
set folderName to name of (info for (theFolder as alias))

--This will get the Unix style path of the folder for info purposes inside the file itself
set folderPath to POSIX path of theFolder

set infoList to listFolder(theFolder, "")
set fileList to "# File list of: " & folderPath & " on " & (current date) & return & item 2 of infoList & " folders and " & item 3 of infoList & " files total." & return & return & item 1 of infoList

set listFile to ((theFolder) as text) & "!File list of this folder (" & folderName & ")" & (do shell script "date \"+ %Y-%m-%d %H%M\"") & ".txt"

tell application "Finder"
set newFile to (open for access file listFile with write permission)
set eof newFile to 0
write fileList to newFile
close access newFile
open listFile as alias
end tell

Mac ready “lightbox” close widget

I use a Mac, you use a Mac. Our close window button is in the top left corner of the window so it’s convenient when a JavaScript pop-over puts the “button” there, though most don’t. A few I run into I’ve decided to throw some CSS at to fix them.

/**** Mac ready "close" widget ****/
/* WordPress admin "More info..." */
div#TB_ajaxWindowTitle {
position:absolute;
top:0px;
left:25px;
float:none !important;
display:inline !important;
}
div#TB_closeAjaxWindow {
display:inline !important;
float:left !important;
clear:left !important;
}
/* Amazon */
div.ap_close {
left: 24px !important;
}
span.ap_closebutton {
float:left;
clear:left;
}
/* "Fancybox" */
a#fancybox-close {
left:-15px !important;
}
/* "MultiBox" */
div.MultiBoxClose {
left:-26px !important;
}
/* Disqus profile */
a.dsq-modal-close-btn {
position:absolute !important;
top:10px !important;
left:10px !important;
}

This would of course go into your user defined CSS file. Which in Safari can be added at Safari > Preferences | Advanced – Style sheet:

Steam client for Macintosh

What a pile. All it is is a web browser. That’s pretty much it. And a poor one at that.

Instant beefs:

  • It installs games as hidden files not applications.
  • It runs a process named ‘ipcserver’ that remains alive after you quit the client.
  • The UI is non/sub-standard.
  • It doesn’t clean up after itself if you relaunch after force quitting it which then prevents it from starting* (though the ‘ipcserver’ seems to have no trouble starting).

To overcome that last item (which throws an error stating “steam engine instance already exists”) you have to manually remove a couple of files from /private/tmp. In Terminal type rm /private/tmp/*-steam-mstr-* and press return, then launch Steam.

*[UPDATE] Newer clients (the About window doesn’t actually list a version. More Steam on Mac “goodness” 😐 ) will launch after a force quit by apparently recycling the left over files which needed to be removed manually before.