- Hombrew
- Python 2.7.5
- Django 1.5.2
- Apache 2.2.25
- Postgres 9.2.4
- R 3.0.1
- Virtualenv
Monday, September 16, 2013
Creating a Mountain Lion development environment
So I had to set up a new dev environment at work on Mountain Lion. It uses the following components
Labels:
Apache,
Django,
Homebrew,
MacOS,
mod_wsgi,
Mountain Lion,
postgres,
python,
R,
RPy2,
Virtualenv
Friday, September 13, 2013
Understanding Django static files
In struggling to setup a new development/production server on Mountain Lion, I came across this good explanation of django static files and how to configure them.
http://bitsoul.com/2012/10/04/understanding-django-static-files-for-beginners/
Also, this link was also helpful in setting up the environment
http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/
Cheers.
http://bitsoul.com/2012/10/04/understanding-django-static-files-for-beginners/
Also, this link was also helpful in setting up the environment
http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/
Cheers.
Wednesday, August 28, 2013
Zipping a python dict of lists
Have a python dictionary containing lists. Want to zip the lists together, but don't know the keys. Solution provided from Stackoverflow
http://stackoverflow.com/questions/9828072/zipping-a-python-dict-of-lists
http://stackoverflow.com/questions/9828072/zipping-a-python-dict-of-lists
Tuesday, August 20, 2013
How to install mod_wsgi on Mountain Lion
There are apparently changes Apple made in XCode between Lion and Mountain Lion that cause the standard install method to fail. The conventional fix that comes up most often in a Google search at the time of this writing is to create a symlink between the new name of a Toolchain folder and the old name that the installer is supposedly looking for, like this
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
I did this and tried to make mod_wsgi using Homebrew but it throws a cryptic apxs error. Long story short, I eventually compiled mod_wsgi from source myself, but it continued to through various errors, even though things seemed to be configured properly. I went back to a different Mountain Lion machine I had configured earlier using MacPorts. When I did that machine, I had no problems with mod_wsgi or the need for this toolchain symlink. Examining the Portfile for mod_wsgi gives the key. The missing element is adding the --disable-framework flag to the config file. After that, everything works fine.
This flag should be added to the Homebrew Formula for mod_wsgi. I have never made a Formula before, but maybe one day I will do it. Below is the Gist showing what I did and how it worked.
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
I did this and tried to make mod_wsgi using Homebrew but it throws a cryptic apxs error. Long story short, I eventually compiled mod_wsgi from source myself, but it continued to through various errors, even though things seemed to be configured properly. I went back to a different Mountain Lion machine I had configured earlier using MacPorts. When I did that machine, I had no problems with mod_wsgi or the need for this toolchain symlink. Examining the Portfile for mod_wsgi gives the key. The missing element is adding the --disable-framework flag to the config file. After that, everything works fine.
This flag should be added to the Homebrew Formula for mod_wsgi. I have never made a Formula before, but maybe one day I will do it. Below is the Gist showing what I did and how it worked.
Monday, August 12, 2013
Fix locate command on Mountain Lion
So apparently upgrading to the Macintosh system Mountain Lion (10.8) breaks the unix "locate" command because it deletes the "nobody" user that was used to own the database.
I found this gist that gives instructions how to get it working again. However, in my case I also had to enable the root user and then log in as root in Terminal and run the command
/usr/libexec/locate.updatedb
as root. Then it finally worked. Sheesh.
Thursday, July 25, 2013
Understanding R plot margins
Came across this great VISUAL explanation of the differences between margins (mar) and outer margin (oma) regions. This is very helpful.
How to subset RPy2 dataframe
This example demonstrates how to create subsets of RPy2 data frames using single or multiple criteria. I also wanted to test if using Github Gist is a better way the display code snippets on this blog than using Bloggers formatting tools.
And linked gist is here
And linked gist is here
Thursday, April 4, 2013
How to remap Home/End key bindings in Mac OSX Mountain Lion
This is taken straight from here. Content is copied in case the link dies. I needed to redo the key bindings for Sublime after I upgraded the OS to 10.8. So here it is:
To get your Home and End keys working properly on Mac OS X (in my case, Mountain Lion, although this should work in prior versions back to at least Tiger), simply open the Terminal and do this:
$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ nano DefaultKeyBinding.dict
Put these lines in that file, including the curly braces:
{
/* Remap Home / End keys to be correct */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
}
Press Ctrl+O and then Enter to save the file, and Ctrl+X to exit. Restart your computer to have it take full effect.
To get your Home and End keys working properly on Mac OS X (in my case, Mountain Lion, although this should work in prior versions back to at least Tiger), simply open the Terminal and do this:
$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ nano DefaultKeyBinding.dict
Put these lines in that file, including the curly braces:
{
/* Remap Home / End keys to be correct */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
}
Press Ctrl+O and then Enter to save the file, and Ctrl+X to exit. Restart your computer to have it take full effect.
Subscribe to:
Posts (Atom)