Monthly Archives: January 2011

Dynamically redirect non-www to www (or vice versa) without hardcoding using .htaccess

After much searching and testing, this is what I’ve up up with: Redirect www to non-www RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] Redirect non-www to www RewriteCond %{HTTP_HOST} !^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L] or RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(.+)$ [NC] RewriteRule ^(.*)$ http://www\.%1/$1 [R=301,L]

Posted in Tech Tips, Web Development | Tagged , , | Leave a comment

firefox greasemonkey directory mac

If you’re looking for the greasemonkey directory for firefox on mac os x, look no further. The installed user scripts can be found here: /Users/user/Library/Application Support/Firefox/ Profiles/(your-profile-name).default/gm_scripts

Posted in Software, Tech Tips | Tagged , , | 1 Comment

How To Enable Color in Terminal on Mac OS X for Root

This method will work for all users on your system, because you will be editing the system-wide profile and not a user-specific one. Step 1: Edit /etc/profile You will need to have root privileges to do this. You can open the file in TextEdit by going to File->Open and when the dialog pops up press Command-Shift-G to open the “Go to Location” dialog, then type in /etc/profile. Open the file called “profile” which should now be highlighted in your list of files. After opening that file, add the following two lines to the bottom: export CLICOLOR=1 export LSCOLORS=ExFxBxDxCxegedabagacad The colors can be configured as stated in the ls manual, which can be accessed in terminal via “ls man” Look for the section LSCOLORS. Here is what it says about the colors you can use to configure the display: LSCOLORS The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color. The color designators are as follows: a black b red c green d brown e blue f magenta g cyan h light grey A bold black, usually shows up as dark grey B bold red C bold green D bold brown, usually shows up as yellow E bold blue F bold magenta G bold cyan H bold light grey; looks like bright white x default foreground or background Note … Continue reading

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

Adobe Illustrator Could Not Find The Linked File [Solved]

I’ve written an app for OS X that will take an Adobe Illustrator file with broken links / liked files, and run through those trying to relink them automatically. Instructions Open the Adobe Illustrator (.ai) file with Illustrator. This application has been confirmed to work with Illustrator versions CS3, CS4, CS5, and CS6, and Adobe Creative Cloud Choose “Ignore” or “Ignore / Apply to All” to the messages about the missing files when the document is opening. Those are typically something like “Could not find the linked file / Choose Replace to select another file or Ignore to leave the link unchanged.” Run the Fix Linked Files App that you downloaded / installed. You will be prompted for a directory to search (recursively) for the missing linked files. By default this is set to three levels up from where the Adobe Illustrator file with the missing linked files is located. Please note: If you choose the root folder ( / ) or a folder with many files in it, it may take some time for the system to search for the linked files. I would suggest choosing the most restrictive path possible to start with. After the app has completed, any linked files found will be updated (and will show up normally) in Adobe Illustrator. Save the AI file and the linked files will continue your workflow with all the linked resources now fixed! Next time you open this file all of the resources will remain fixed and you will … Continue reading

Posted in Mac, Software, Tech Tips | Tagged , , , , , , , , , , , , , | 31 Comments

How to Remove the <ul> container with the wp_nav_menu function

Although WordPress has an option to remove the container from the wp_nav_menu function, that is generally for the <div> and not the <ul> that wraps the <li> items. So, while you can use the options to remove the <div>, the <ul> will stay. It might be good to use a filter method like add_filter( ‘wp_nav_menu’, ‘remove_ul’ ) to accomplish the filter I have below, but that the filter was not being applied at the time of writing, so I (used to) recommend changing the echo option to false, and returning the value of the wp_nav_menu function to a variable, and then running a regular expression on it to remove the encompassing </ul><ul> and </ul>. This code worked for me, running WordPress 3.0.4: $options = array( ‘echo’ => false ,’container’ => false ); $menu = wp_nav_menu($options); echo preg_replace( array( ‘#^<ul [^>]*>#’, ‘#</ul>$#’ ), ”, $menu ); Use Site Pages as a Default Fallback If you want it to use the site’s pages as a default (if no menu is specified and the function is called), you can add an additional function and change the options array as shown: function default_page_menu() { wp_list_pages(‘title_li=’); } $options = array( ‘echo’ => false ,’container’ => false ,’fallback_cb’=> ‘default_page_menu’ ); $menu = wp_nav_menu($options); echo preg_replace( array( ‘#^<ul [^>]*>#’, ‘#</ul>$#’ ), ”, $menu ); Update: A Better Way to Remove the <ul> element I think as of WordPress 3.1 they added a new parameter to make it easier to get rid of the </ul><ul> that wraps the … Continue reading

Posted in Tech Tips, Web Development | Tagged , | 9 Comments

Applescript: Unhide / Restore All Windows

I got tried of accidentally hitting the CMD-H key and having a window disappear. So I wrote this little script and then assigned it to CMD-SHIFT-H to restore (unhide, unminimize) all hidden or minimized windows. Works on OS X 10.6, 10.7, 10.8, and 10.9 Snow Leopard, Lion, Mountain Lion, and Mavericks. Feel free to post improvements in the comments. I also think it would be cool to figure out the last window that was hidden, something like tell previous application and just restore that one. But this works for now. tell application “System Events” repeat with theApplication in application processes if visible of theApplication is not true then set visible of theApplication to true end if end repeat end tell You can also do this with an Application like Terminal.app: tell application “System Events” repeat with theApplication in application “Terminal” if visible of theApplication is not true then set visible of theApplication to true end if end repeat end tell Sometimes if you have “Minimized” instead of “Hidden” an application, it still won’t come back into the foreground when using the previous methods, so you can also try something like this: do shell script “open ‘/Applications/Utilities/Terminal.app'” This works by telling the application to “open” again which should also bring it to the front.

Posted in Mac | Tagged , | 1 Comment

Facebook Forced Profile Upgrade

I’ve been trying to avoid upgrading my face book profile. But it seems that Facebook is now forcing users to upgrade. When I signed on I received this message: Coming Soon: Your New Profile In the next few days you’ll be upgraded to the new profile, which offers more ways to show and tell your story. While Facebook continues to introduce new features, many of the features involve creating ways to link people to places, websites, organizations, and, of course, other people. The more links and “relationships” Facebook can create, the more data-mining they can do, and the more targeted advertising they can develop. Did you wonder why they wanted to launch an e-mail service?!

Posted in Marketing, Social Media | Tagged , | 2 Comments

googleapis latest jQuery

From JQuery: http://code.jquery.com/jquery-latest.min.js From Google, currently the latest of the 1.x family (1.4) http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

Posted in Web Development | Tagged | 1 Comment

A sort of “text-to-speech” iPhone app which can help Children

Just finished reading the article about the VerbalVictor iPad / iPhone app, where a father has invented an app to allow his son, who is unable to speak, to to use the iPad to communicate, in a familiar voice. Victor has a rare genetic disorder that delays development of a number of skills, including speech. To help him and others with disabilities, his father, Paul, and some of his students at Wake Forest University in Winston-Salem have created an application for the iPhone and iPad that turns their touch screens into communications tools. The VerbalVictor app allows parents and caregivers to take pictures and record phrases to go with them. These become “buttons” on the screen that Victor touches when he wants to communicate. A picture of the backyard, for example, can be accompanied by a recording of a sentence like “I want to go outside and play.” When Victor touches it, his parents or teachers know what he wants to do. The full article can be found here: Father Invents ‘VerbalVictor’ App To Help Disabled Son ‘Speak’ Thru iPad

Posted in Mac | Tagged , | Leave a comment

How to e-mail a Screen Grab / Screen Shot (Windows & Mac)

If you have a WINDOWS machine: 1) Hit the Print Screen key on your keyboard. It’s usually in the upper right and marked “PrntScrn” or “PrtSc”. 2) Try to Paste directly into a email you’ll send to us (either by holding down the “Ctrl” key and pressing the “V” key, or by right-clicking the blank screen and selecting “Paste”). If your email program doesn’t let you do that, then: 3) Click the green Start button on the lower left of your screen. 4) Navigate to All Programs -> Accessories, and open the Paint program. 5) Paste into the Paint program, either by holding down the “Ctrl” key and pressing the “V” key, or by right-clicking the blank screen and selecting “Paste.” 6) Save the file (from File -> Save) as a .JPG (choose “Save as type” JPEG). 7) Attach that file in an email. If you have a MAC: 1) Hold down the Shift key and the Command key (which may have an Apple logo and/or a “four-leaf clover” type symbol). Then, while still holding down these keys, press the 3 key. This will save the screenshot as a file on your Desktop. If you hit the 4 key instead, it will give you a target allowing you to drag a box around only the item that you want to take a screenshot of. 2) Attach that file in an email.

Posted in Tech Tips | Tagged , , , | Leave a comment