Archives
Categories
Syndication
Author Archives: Oliver Gorwits
WinXP to OS X Switch Notes
My wife has just switched her WinXP system to OS X (both on a Mac Mini), and here are some of the tools that helped along the way: Abee is a free utility which helps migrate from Microsoft Outlook Contacts … Continue reading
Posted in OS X
Comments Off
Perl on a Windows 7 laptop
I’ve been setting up my Windows 7 laptop to have as complete a Perl development environment as possible. I don’t have a choice about the operating system in this case, but I am used to the Unix-style environment, which I’d like to maintain. One option is to use Cygwin and just dive into there for everything. However I do want some of my code to work natively under Windows so there is still a need to run Perl tests at a Windows console. I might as well develop there too, if I can. I’ve ended up with the following steps, which are in places bodgy hacks, but show the principle works at least: Git for Windows Strawberry Perl Vim fix Windows Console perldoc fix local::lib cpanm installer Local CPAN mirror First thing is to install Git for Windows, known as msysgit (don’t alter any of the Windows PATH settings at install time). It’s a great little system which ships with Bash, Vim, and a suite of other handy tools. On this platform you probably want to set the End Of Line character(s) to ensure consistency. I have the following in my ~/.gitconfig: [core] editor = vim eol = lf [color] ui = true The bundled Perl in msysgit is a little ancient (5.8.8). Download and install the excellent Strawberry Perl distribution. Our goal is to have perl within the msysgit environment be Strawberry Perl’s perl. Move C:\Program Files\Git\bin\perl.exe out the way (to perl-g.exe) and copy C:\strawberry\perl\bin\perl.exe in its place (there are no symbolic links under Windows). By changing the Perl though, you knacker parts of Git which use Perl (for example git commit –interactive). The way to fix this is to keep a copy of the original msysgit perl (as above) and then edit any of the scripts in C:\Program Files\Git\libexec\git-core to have #!/usr/bin/perl-g at the top. Here’s a list: git-add–interactive git-svn git-difftool git-relink git-send-email The msysgit bundled Vim also needs some help, in the form of syntax files. I downloaded and installed GVim for Windows, and copied the .vim files from C:\Program Files\Vim\vim73\syntax to C:\Program Files\Git\share\vim\vim73\syntax but perhaps there’s a less brute-force way. At the least, you should get hold of perl.vim and pod.vim. The Windows console program leaves a lot to be desired. I found a reasonable alternative in the form of Console2, an open source project hosted on Sourceforge. Download and install that (well, copy to Program Files). You’ll definitely want to edit its Settings so under Hotkeys, set Close tab and Rename tab to an alternative, or None (by doing Clear then Assign for each). Also under Settings in the Console section I set the Shell to be C:\Program Files\Git\bin\sh.exe –login -i and the Startup dir to be a folder I created in my user area for Perl development. Now, pinning the Console2 application to the Start Menu means it can be opened straight into msysgit’s Bash. At the shell I installed my own vimrc file to ~/.vimrc, and created a ~/.bash_profile containing the following: alias ll="ls -l –color" alias view="vim -R" export TERM=vt100 Strawberry Perl ships with many useful tools in its bin directory. Some of them are Windows batch files (.bat) because the expectatation is that you’re running Perl from the native Windows console. In this setup we’re within a Bash shell so they don’t work. One thing you’ll probably miss is perldoc, so create a ~/bin directory and in ~/bin/perldoc put the following: #!/usr/bin/perl require 5; BEGIN { $^W = 1 if $ENV{‘PERLDOCDEBUG’} } use Pod::Perldoc; exit( Pod::Perldoc->run() ); I always use a local::lib area for the modules used in my development, and Strawberry Perl ships with this module. Simply run the llw32helper program from the normal Windows console and it’ll ask you for the new local::lib location then set Registry entries appropriately. One reboot later and perl -V should include this new library path. From Strawberry Perl’s CPAN shell (perl -MCPAN -e shell) I only install one module – App::cpanminus. This provides a new tool, cpanm, for installing modules. Note that since the previous local::lib setup, App::cpanminus is installed to that location rather than Strawberry Perl’s standard library path. The final step is to have a local CPAN mirror. This means I can work on the Windows 7 laptop from a remote part of a Scottish Hebridean island, for instance, fully off-line. This uses the CPAN::Mini and CPAN::Mini::Webserver modules, both installed via the cpanm utility. The minicpan command line app will create the mirror for you. The minicpan_webserver app fires up an interface at http://localhost:2963/. Here are example commands used with this setup, which I’ve made into Bash aliases (also set your ~/.minicpanrc as per the docs): minicpan -l /path/to/local/minicpan -r http://your.cpan.mirror.example.com/ cpanm –mirror file:///C:/path/to/local/minicpan –mirror-only -v Module::Name A remaining niggle is that cursor keys don’t seem to work in less (Ctrl-N and Ctrl-K are alternatives). I’ve not yet found a fix for this; however they do work in Vim. Another issue I found is that, bizarrely, cpanm sometimes fails unless the -v option is provided. Also with cpanm it seems more successful at unpacking dist tarballs when treating the local platform as UNIX rather than WIN32 so I hacked the script to do that. I wish I were more capable on this platform to begin to debug this (please email me if you want to collaborate). That’s pretty much where I’m at, right now. I’d welcome constructive feedback on this process in the comments (at blogs.perl.org if you’re reading a syndication). My deep thanks and respect to all the developers of the above tools and libraries, who have made this possible…. Continue reading
Posted in perl
Comments Off
Starting irssi in screen at reboot
Another short aide-mémoire. My IRC client is irssi, running in a screen session on my linux server in London. I connect to it via SSH, but if the server restarts I want this all set up automatically. Fire up crontab … Continue reading
Posted in linux
2 Comments
Fixing character encoding with irssi and screen
Yes, this old chestnut. Time and again I forget the steps to get a new (Debian-ish) system working properly such that I can ssh in and reattach to a screen’d irssi session and have character encoding work properly. That is, … Continue reading
Posted in linux
Comments Off
Django Admin App Views
Following my previous post about configuring Django models, I’m now ready to work on the view. Remember, this is simply within the “Admin” app which ships with Django, and below is a non-exhaustive set of options: ModelAdmin Derived Class Options … Continue reading
Django Models
I’ve been working on a small Django app recently, and started by cleaning up its model definitions. Here’s a quick (but not exhaustive) list of useful configuration options: Model Meta Options db_table = “string” managed = False (whether SQL is … Continue reading
FreeRADIUS EAP and CRLs
Just a quick note about a gotcha, which will hopefully help someone searching for the answer… In FreeRADIUS 2, if you want to use a Certificate Revocation List (CRL) along with the EAP module, then following the instructions in the … Continue reading
MythTV Transcoding (2): In-place Auto Transcoding
I’m doing a series of posts here on automated transcoding of recordings in MythTV. The idea is to explain the basics, then evolve the design to end up with recordings suitable for playback on the iPad, which is a little … Continue reading
Posted in mythtv, transcoding
2 Comments
MythTV Transcoding (1): The Beginning
I’m going to do a series of posts here on automated transcoding of recordings in MythTV. The idea is to explain the basics, then evolve the design to end up with recordings suitable for playback on the iPad, which is … Continue reading
Posted in mythtv, transcoding
Comments Off