Velocity Templates and Newlines
If you're reading this article you've probably encounted the same problem as I have. I was trying to put a newline '\n' character in the value of a variable in a Velocity template. Attempt 1: I assumed \n would work... ``` #if ( !$foo ) #set ( $foo = "There was no foo set in the Context.\nPlease do something about it." ) #end ``` This produced There was no foo set in the Context.\nPlease do something about it. as the value of $foo. Attempt 2: I just thought this was worth a shot :D ``` #if ( !$foo ) #set ( $foo = "There was no foo set in the Context. Please do something about it." ) #end ``` And the template failed to compile Solution: Basically, the easiest way I found is to place the newline, carriage return or other special character in the context. java public Template handleRequest( HttpServletRequest request, HttpServletResponse response, Context context ) { ... context.put( "nl", "\n" ); context.put( "cr", "\r" ); ... } And in your template: ``` #if ( !$foo ) #set ( $foo = "There was no foo set in the Context.${nl}Please do something about it." ) #end ``` Maybe not the best solution but it works for me. If you expect to use it across your entire application I suggest you override VelocityServlet.createContext in your Servlet to add these characters to every context in your application. Example: ```java
protected Context createContext( HttpServletRequest request, HttpServletResponse response ) { Context context = super.createContext( request, response ); context.put( "nl", "\n" ); context.put( "cr", "\r" ); return context; }
From Solo Tool to Team Infrastructure: Scaling Gluon for Production
When I first built Gluon on my Mac mini, I was solving a personal problem: monitoring Claude agents without losing my mind to tmux logs. But when teams join the picture, everything changes — security, governance, observability, and the fundamental role of the developer. Here's what production infrastructure for autonomous agents looks like.
Ralph Loop: Teaching AI Agents to Work Autonomously (Without Burning Your Budget)
How Gluon's Ralph Loop enables autonomous Claude execution with built-in safety rails — circuit breakers, multi-signal completion detection, and cost controls that scale from simple tasks to complex workflows.
Scraper MCP: Context-Efficient Web Scraping for LLMs
I built an open-source MCP server that reduces LLM token usage by 70-90% through server-side HTML filtering, markdown conversion, and CSS selector targeting. Here's why context efficiency matters—and how Scraper MCP solves it.