I just got this working today. The weirdnesses of Cygwin’s half Unix-half Windows nature had stymied me before, but I’ve prevailed!
I’ve got Gnu Emacs 23.3 for Windows installed in c:/emacs, and a fairly recent install of Cygwin on Windows 7.
Saved this script in ~/cygemacs.sh
#!/usr/bin/bash c:/emacs/bin/emacsclientw.exe -n -a "c:/emacs/bin/runemacs.exe" `cygpath -wa $@` |
Then in my ~/.bashrc:
alias ec="~/cygemacs.sh" |
Now I can be all like,
$ ec ~/.minttyrc |
And it opens a new frame in my running Emacs (I have (server-start)
in my ~/.emacs), or starts Emacs and opens the file if Emacs isn’t running yet.
See also: EmasClient at EmacsWiki.
Bonus tips
Yes I’m still using Subversion but also gitting going with Git.
And courtesy of The Lumber Room, in ~/.bashrc and others:
export SVN_EDITOR='c:/emacs/bin/emacsclientw.exe -a c:/emacs/bin/runemacs.exe ' |
And silence that annoying “kill client buffer z0mgbbq?!?” warning:
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) |
Stupid me made the same mistake twice in a row so I’m documenting it for humanity.
I’m updating an old Symfony project to use Symfony 1.3/1.4 and Propel 1.5 through François Zaninotto’s sfPropel15Plugin.
Problem:
I followed the README, right? But…
$ ./symfony propel:build --forms >> schema converting "C:/web/myproject/config/schema.yml" to XML >> schema putting C:/web/myproject/config/generated-schema.xml >> propel Running "om" phing task >> file- C:/web/myproject/config/generated-schema.xml >> autoload Resetting application autoloaders >> autoload Resetting CLI autoloader >> propel generating form classes PHP Warning: call_user_func() expects parameter 1 to be a valid callback, class 'FooPeer' does not have a method 'getUniqueColumnNames' in C:\web\myproject\plugins\sfPropel15Plugin\lib\generator\sfPropelFormGenerator.class.php on line 485 PHP Stack trace: PHP 1. {main}() C:\web\myproject\symfony:0 PHP 2. include() C:\web\myproject\symfony:14 PHP 3. sfSymfonyCommandApplication->run() C:\symfony1.3\lib\command\cli.php:20 PHP 4. sfTask->runFromCLI() C:\symfony1.3\lib\command\sfSymfonyCommandApplication.class.php:76 PHP 5. sfBaseTask->doRun() C:\symfony1.3\lib\task\sfTask.class.php:97 PHP 6. sfPropelBuildTask->execute() C:\symfony1.3\lib\task\sfBaseTask.class.php:68 PHP 7. sfTask->run() C:\web\myproject\plugins\sfPropel15Plugin\lib\task\sfPropelBuildTask.class.php:135 PHP 8. sfBaseTask->doRun() C:\symfony1.3\lib\task\sfTask.class.php:173 PHP 9. sfPropelBuildFormsTask->execute() C:\symfony1.3\lib\task\sfBaseTask.class.php:68 PHP 10. sfGeneratorManager->generate() C:\web\myproject\plugins\sfPropel15Plugin\lib\task\sfPropelBuildFormsTask.class.php:72 PHP 11. sfPropelFormGenerator->generate() C:\symfony1.3\lib\generator\sfGeneratorManager.class.php:126 PHP 12. sfGenerator->evalTemplate() C:\web\myproject\plugins\sfPropel15Plugin\lib\generator\sfPropelFormGenerator.class.php:106 PHP 13. require() C:\symfony1.3\lib\generator\sfGenerator.class.php:84 PHP 14. sfPropelFormGenerator->getUniqueColumnNames() C:\web\myproject\plugins\sfPropel15Plugin\data\generator\sfPropelForm\default\template\sfPropelFormGeneratedTemplate.php:34 PHP 15. call_user_func() C:\web\myproject\plugins\sfPropel15Plugin\lib\generator\sfPropelFormGenerator.class.php:485 ... etc ... |
Solution
I removed too much of the default config in propel.ini..
Make sure this original line is still intact in propel.ini, even though you’ve removed/commented out all the propel.behavior
lines that point to the old sfPropelPlugin:
propel.behavior.default = symfony,symfony_i18n |
So, I had to deal with ISO 8601 formatted dates in JavaScript, and I can’t just use the cool ISO 8601 support in js 1.8.5’s Date.parse because of IE 6. I found a couple of examples out there on blogs but couldn’t get them to work right with my data, and I wasn’t sure I wanted a heavyweight do-it-all solution. I reluctantly reinvented the wheel so I thought I’d share it.
function parseISO8601Date(s){ // parenthese matches: // year month day hours minutes seconds // dotmilliseconds // tzstring plusminus hours minutes var re = /(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d+)?(Z|([+-])(\d\d):(\d\d))/; var d = []; d = s.match(re); // "2010-12-07T11:00:00.000-09:00" parses to: // ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11", // "00", "00", ".000", "-09:00", "-", "09", "00"] // "2010-12-07T11:00:00.000Z" parses to: // ["2010-12-07T11:00:00.000Z", "2010", "12", "07", "11", // "00", "00", ".000", "Z", undefined, undefined, undefined] if (! d) { throw "Couldn't parse ISO 8601 date string '" + s + "'"; } // parse strings, leading zeros into proper ints var a = [1,2,3,4,5,6,10,11]; for (var i in a) { d[a[i]] = parseInt(d[a[i]], 10); } d[7] = parseFloat(d[7]); // Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]]) // note that month is 0-11, not 1-12 // see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC var ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]); // if there are milliseconds, add them if (d[7] > 0) { ms += Math.round(d[7] * 1000); } // if there's a timezone, calculate it if (d[8] != "Z" && d[10]) { var offset = d[10] * 60 * 60 * 1000; if (d[11]) { offset += d[11] * 60 * 1000; } if (d[9] == "+") { ms -= offset; } else { ms += offset; } } return new Date(ms); }; |
A friendly user named Raynos in the new StackOverflow JavaScript chat room helped me with the 0-based month gotcha. Thanks again, Raynos!
Also, the author of Anentropic tipped me off to this effort to promote good-quality JavaScript documentation, like the Mozilla Javascript Reference and Javascript Guide, which are still definitive after all these years. Googling for javascript stuff usually gets you spam sites with lots of ads and less-than-stellar docs. W3schools, I love you, but seriously.
So listen, Google:
I published my second plugin for WordPress today. It lets you configure how long user sessions and the “remember me” cookie last. By default they’re only 2 days and 2 weeks, respectively.
Twofold impetus: a problem with the internal P2 microblog at work when people like me left their browsers open for long periods, and the fact that I access too many WordPress blogs from too many different computers for the 2 week “Remember Me” timeout to be convenient enough. Cranking it up to 22 years!
The WordPress documentation is pretty great BTW.
And it was a little bit interesting to run in to the Year 2038 problem with 32-bit int timestamps. I don’t know, it was fun working around the “infinity” ceiling:
So my trusty network administrator at work was on my case because my workstation has been trying to get to Internet sites directly without a proxy, and my little machine is the top hitter on her firewall deny rules. Normally that’s a symptom of malware, so after a partial day looking for and not finding what was causing it, I formatted my aging XP machine and installed Windows 7, which I’d been meaning to do anyway.
After several days rebuilding everything the way I like it, my machine turned up as the frequentest flyer in the firewall deny logs again! It turns out that Windows 7 has some better tools that made it easier to find what was going on. (more…)
Problem:
Old retiring IIS 5.0 web server has been accepting URLs containing plus (+) for spaces instead of %20 for like 74 years. People have the old URLs bookmarked and stuff so they’ll keep going to them. The content will still exist on the replacement IIS 7 web server. Wouldn’t it be nice to make it transparent?
(Not to mention “foo+bar.pdf” is sane, but “foo%20bar.pdf” reads “foo percent twenty bar”, awkwardly. )
The problem is that IIS7 by default considers naked plusses in the URL as scary and sends a 404.11, URL_DOUBLE_ESCAPED error. Even if you convince it the URL is OK, it no longer maps plus to space and finds a piece of content.
On the old IIS 5.0 server these URLs both work, serving up the document named “foo bar.pdf”:
http://server/foo+bar.pdf
http://server/foo%20bar.pdf
On the new IIS 7 (Windows 2008) server, the second URL works but the first one gives an error.
Solution:
I put this in my application’s web.config file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <requestFiltering allowDoubleEscaping="True" /> </security> <rewrite> <rules> <rule name="RewriteUserFriendlyURL1" stopProcessing="false"> <match url="\+" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="{UrlDecode:{REQUEST_URI}}" /> </rule> </rules> </rewrite> </system.webServer> </configuration> |
the allowDoubleEscaping
directive on line 5 solves the first part of the problem, allowing IIS to handle unescaped plusses. The rewrite rule below passes the requested URI through the UrlDecode function (line 15), which thankfully still remembers the time-tested convention of plus equaling space. Now both forms of the URL work.
(I didn’t really write the rewrite stanza, I just stumbled around with the rewrite URL editor in the IIS Manager until it worked)
Yay!

Update 2010-08-06: It looks like the sfDoctrineActAsTaggablePlugin team has incorporated much of this into the version they released today. I’ll post more when I get a chance to try it out.
This week I used the sfDoctrineActAsTaggablePlugin to add tag behavior to a Symfony project. My goal was to have a user interface similar to WordPress’s, which I like a lot:
Another goal was to use JQuery UI with the nice visual theme I built with their Theme Roller tool (which I had already installed and added to my symfony project).
The documentation was a little bit sparse and I’ll probably end up doing this again, so here are relevant instructions so Future Me and others may also benefit: (more…)
I’m trying the DansGuardian content filtering proxy at home. But it wouldn’t compile on my modern Snow Leopard machine.
(more…)
Problem:
Visual Studio 2005 complains,
Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online. This server version is not supported. You must have Microsoft SQL Server 2005 Beta 2 or later.
Except I have MS SQL Server 2008 Express.
Solution:
Download and install this CTP (Community Technology Preview) which addresses the issue.
The problem:
I like using Subversion to deploy web content to production servers. I check in everything while I’m working on the development copy, then check out onto the server when it’s ready.
Subversion creates a .svn
directory contain readable copies of all your files, which is bad for server-processed files like .php or .aspx that you don’t want readable by, say, Google Hackers.
I have thought about this before but when I went to do it I couldn’t find any clear guides online. I did find this question at Server Fault, which is a newish sister of Stack Overflow, which reminds me kind of Experts Exchange but without the suck. Except that in this case the answers sucked. So I figured it out and added my answer and am posting it here too: (more…)