You are here: News
Akatombo Media logo
English 日本語

Akatombo Web Log

Thursday, April 27, 2006

Ignore whitespace in a Subversion diff

Doing some work on a software project, in which part of the modifications I’m doing involve changing the indents on the code to make it conform to the coding conventions I follow and make it easier to easily read the code at a glance.  When I have finished doing that though, I want to go back and make sure I haven’t inadvertently screwed something up in the actual code while I was changing the spacing.

svn diff doesn’t have a built in option for ignoring whitespace, but gnu diff does, so we use that.

to use a different diff command us the --diff-cmd parameter to svn diff, and to pass options to that command use the -x parameter.

If I was going to run the command in gnu diff directly I would use diff -uw /path/to/file1 /path/to/file2

In svn I want to diff against the latest version in the working copy (BASE) so I only need to pass in the file to diff and no revision info

Here is the command:

svn diff --diff-cmd diff -x -uw /path/to/file

Now at some point I have to see if I can figure out how to hack the subversion bundle for textmate to make that option available to me in the nice html highlighted view.

Posted by UltraBob on 04/27 at 07:29 PM
8 Comments | No Trackbacks | Permanent Link

TextMate Find in Project Extremely Slow

I was having some extremely aggravating problems with Find in Project in TextMate where the program would suck up to 750Mb of RAM and take over 20 minutes to return a search result.  Allan, and a couple other people whose names escape me at the moment, helped me to debug the problems I was having.  It seems that if your project file is very large or has large files in it, this type of problem is likely to occur.  I am working on a fairly large project, but still it wasn’t of a size that seemed outrageous.  We checked for a symbolic link loop in the folders, and no problem there.

Finally I asked if pdf files were treated as text files because I had a fair number of pdfs in the project.  Everyone said that pdf files should be treated as binaries, but told me how to check.  Right click (or control-click in the absence of a two button mouse) on a pdf file in the project drawer.  If you see “Treat files with “.pdf# Extension as Text” as the bottom-most option in the contextual menu that pops up your problem is different than mine, maybe you have a bunch of log or cache files that are being searched?

My contextual menu said treat as Binary which means that somehow TextMate had gotten set up to treat PDFs as text and it was searching all of them.  So now the problem is solved, searches only take a minute or two now.  On the good news front, it appears that Allan is working on a threaded find operation (meaning you’ll be able to keep editting as the machine searches) and working on making it so that TextMate doesn’t have to keep every matched file open in memory.

UPDATE: It looks like the latest cutting-edge-release addresses the issue with peak memory for find in project.

[FIXED] Peak memory usage when doing Find in Project should no longer be that of having all files loaded into memory.

I haven’t tried it out or anything yet, but if it truly fixes that: Very nice!  Thanks Allan.

Posted by UltraBob on 04/27 at 11:09 AM
3 Comments | Permanent Link

Wednesday, April 19, 2006

Using PHPfi with TextMate

<UPDATE> This bundle has been included with the latest version of phpfi (2.1).  I’m thrilled that this code will now automatically be available to the group of people who need it.  If you code in PHP on the mac, check out phpfi whether you use textmate or not, it truly is a fantastic reference, especially if you like to go offline to do your coding.</UPDATE>

I couldn’t find any information about it anywhere, so I took it upon myself to figure out how to make a command in TextMate to allow it to do automatic function lookup in PHP based on the existing .  The advantage of being able to use Documentation for Word command in the PHP bundle which allowed a user to go find an entry in the online manual for the selected word in Textmate.  The biggest advantage to using PHP for looking these things up is that you don’t have to be online to lookup a function.  I generally find that I’m more productive and focused when I go offline to program.  It keeps me away from the temptation to go online to look something up real quick, coming back 3 hours later staggering and wild-eyed from a wild information intake bender.

Without further ado, here is a screenshot of the bundle, settings and all.  Click the thumbnail to view it full size.  A rough explanation of how it works is below the image.

phpfi bundle in textmate

The hardest part about figuring out how to do this was that php interface to other problems is Applescript, but TextMate doesn’t support Applescript.  I searched the manual and mailing list and the rest of the web in hopes of finding a way to make Textmate execute some Applescript code (later on I found information that would have been very helpful on the TextMate wiki), but was having no luck.  Then I remembered that TextMate can execute shell commands, so I went in search of a shell command for executing Applescript and found it in osascript This applescript requires an argument (the currently selected word in TextMate) and arguments weren’t allowed until 10.4 so it would likely not work in pre-Tiger versions of Mac OS X.  The -e parameter lets you feed the Applescript in line by line instead of giving osascript a file to load and execute, so that is what we did.

if grep <<<${TM_CURRENT_WORD:-!} -Esq '[a-zA-Z0-9_]+'
then osascript -e 'on run argv' -e 'set theSelection to item 1 of argv ' \
-e 'tell application "PHP Function Index"' -e 'activate' \
-e 'set the searchString to theSelection' -e 'end tell' -e 'end run' $TM_CURRENT_WORD
fi

We pass in $TM_CURRENT_WORD as an argument and the applescript passes that word onto PHP as search term.  I was very happy to get it to work, because this is the first time I’ve ever been able to make Applescript do anything useful for me.  Either the ways I generally think I would like to use Applescript are different than what Applescript is actually intended to do, the applications I’ve tried to do these things with don’t have complete enough Applescript support, or I just don’t know what I’m doing with Applescript.  I think it is mostly the last one, but I get the feeling that there were liberal doses of the second option in there too.

At any rate I’m very happy that I can now use phpfi with TextMate, and now I have to dive into an extremely tight programming deadline.

Posted by UltraBob on 04/19 at 09:32 AM
24 Comments | No Trackbacks | Permanent Link

Monday, April 17, 2006

Blog translation packages - brainstorming session

We have been working on ideas for a few new services to offer here at Akatombo Media, and one of the things I’m considering rolling out in the very near future is a service for translating an English blog into Japanese (with the reverse possible should I find a market that demands it).  Inspired in part by Andrew’s comment on a previous post about Japanese blogging, the idea is still in the formative stages, but a fair idea of how things will work is beginning to emerge.  This post is an attempt to get my thoughts together, and recruit some early users to put the service through its paces before we make it available to the world at large.

So here are the details of the basic idea:

Target: People (primarily small to medium-sized non-Japanese owned or managed businesses, but anyone who wants it really) with an English blog, who would like to have a Japanese blog mirroring the content on their English site updated nearly as quickly and written by a native speaker.

System: Depending on the client’s blog setup, we would like to automate the service as much as possible.  In most cases it should be as easy as you posting your entry in English, and it showing up on your blog in Japanese by the same time the next business day.

Setup: You will, of course, be required to have a blog ready that can handle posts in Japanese.  We can help you get that set up at our normally hourly rate, or if you want a design specifically targeted at the sensibilities of the Japanese web user in your demographic target, we can agree on a price for the design of your Japanese site ahead of time.  Just contact us and we’ll get started on a proposal for your site.

Pricing: We’ll have to work to find the sweet spot for pricing, but at the moment I’m thinking that we’ll probably charge a monthly fee based on some type of average monthly posting amount.  If you are posting every day you’ll pay more than if you are posting once a week, and if you write all long posts you’ll pay more than someone who writes the same amount of brief posts. 

Selective translation: We may also be able to offer translations of only some of the posts that you put up, but one of the key points of the service is simplicity, so this would only be possible under certain conditions.  The bright side is that if this is what you need, we can help you to meet those conditions.

Further Thoughts: It seems to me like it might be desirable to some, that comments to the site also be translated.  This would require a greater workload and more back and forth between you and us for each interaction with users, but it is certainly a possibility if there is a demand for it.  Translating comments one-way (we translate all new comments that come in from users, and provide a report daily) would be even more readily doable.

So what do you think?  Would you find a blog translation service useful?  If so, would you like to be one of the pilot customers of the service at a temorarily discounted rate?  Let me know, and if you’d like your comment to be private, please feel free to use the contact form

Posted by UltraBob on 04/17 at 04:38 PM
4 Comments | No Trackbacks | Permanent Link

Friday, April 14, 2006

test

This is just a test to see whether my feed shows up in a service when I post to it.

Posted by UltraBob on 04/14 at 01:33 PM
Leave a Comment! | No Trackbacks | Permanent Link


Page 3 of 14 pages
« First  <  1 2 3 4 5 >  Last »