Wednesday, June 20, 2007

Trac (Rails): Cannot uplaod attachment - size more than xxx kb

If you get this error when trying to attach a large file to a trac wiki page, simply edit the trac.ini file (located at /conf/trac.ini to contain the following:



[attachment]
max_size = 5242880



That's it. No need to restart the server etc. It should take effect as soon as you save trac.ini.

Sunday, January 14, 2007

Ruby On Rails + FastCGI / fcgi malformed header error

For RoR applications running on fcgi
If you are getting a 500 error on some page and the only error you see on the server side is

FastCGI: comm with server "//public/dispatch.fcgi" aborted: error parsing headers: malformed header 'some text here'


This is NOT because of any configuration issues with fcgi etc. You are doing "puts" somewhere (or trying to write to stdout somehow) in your application.
Just run this to catch the culprit and change puts to logger.debug or just remove it:


find . -name '*.rb' -exec grep -q 'puts' '{}' \; -print

Wednesday, December 20, 2006

Spring: Error message not displayed in JSP after calling errors.rejectValue

I spent about half an hour trying to debug a simple (seemingly stupid) error today.
I had a controller doing some validation and rejecting a value that it didn't like, as follows:

errors.rejectValue("file", "Attachments.file", args, "File");


In the JSP I had the following boilerplate code to display these errors:


<spring:bind path="Attachments.*">
<b>Got some errors? ${status.errorMessages}</b>
<c:if test="${not empty status.errorMessages}">
<div class="error"><c:forEach var="error"
items="${status.errorMessages}">
<img src="<c:url value="/images/iconWarning.gif"/>"
alt="<fmt:message key="icon.warning"/>" class="icon" />
<c:out value="${error}" escapeXml="false" />
<br />
</c:forEach></div>
</c:if>
</spring:bind>


And

no matter what I did, those errors wouldn't display on the JSP!

. Finally I figured that lines <spring:bind path="Attachments.*">....</spring:bind> must be inside the <body> tag of the JSP. Now don't ask me why, but <spring:bind> tag won't get evaluated unless it's in the body of the JSP. Just moved it in the body and poof! it worked :).

Friday, November 17, 2006

Why is my browsing speed so slow on my new Ubuntu machine?

Well, I'm no networking expert and I can't say that this will solve your problem. But then, I had to note it down for my own reference and who knows, may be you are having the same problem!
In a nutshell, on my machine, the DNS lookup was taking way too long - much longer than other windows machines on the same subnet. Turns out the windows boxes were connected to an Active Directory server which also happens to be a local DNS server. Those guys were getting fast response and my poor ubuntu box wasn't!
So, what's the answer? Switch back to windows?????? NO WAY!! :)

Check this out:

http://ubuntu.wordpress.com/2006/08/02/local-dns-cache-for-faster-browsing/


It took me exactly 5 minutes to get this working on my box, and I think I'll recover those 5 minutes within the next two days!
Rock on, Ubuntu!!

Saturday, November 11, 2006

How to install beryl 3D desktop on Ubuntu Edgy 64 bit

To install the popular 3D desktop manager beryl on a 64 bit ubuntu installation can be somewhat annoying if you are a newbie to ubuntu like myself. There are a bunch of sites that tell you how to install berryl package etc. and they are all very good. I followed them and kept getting this error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package bery1

Did you get that too?

Well don't give up hope just yet. Chances are you did the same stupid thing I did. Here's the crux of the problem.

When I added the source repository to /etc/apt/sources.list, I copy/pasted the following:

deb http://ubuntu.beryl-project.org/ edgy main-edgy

THAT's NOT CORRECT!

For a 64 bit processor what you need is this:

deb http://ubuntu.beryl-project.org/ edgy main-edgy main-edgy-amd64

If you add that and update the package list, you should then be able to install beryl along with its dependencies. Here's an article which describes it better:


http://wiki.beryl-project.org/index.php/Install/Ubuntu/Edgy/XGL



And BTW, it's all worth it. Ubuntu with beryl ROCKS!!!

This page is powered by Blogger. Isn't yours?