FAQ Database Discussion Community


Is there analog of fmt:formatNumber in velocity like in jsp?

jsp,formatting,velocity,template-engine
Now I am migrating my jsp to velocity template. I cannot find solution how to migrate following code line: <fmt:formatNumber minFractionDigits='2' value='${campaign.budget div 100}'/> Does velocity can something like this?...

Mocha test is not waiting for Publication/Subscription

javascript,testing,meteor,mocha,velocity
Stack Using Mocha + Velocity (0.5.3) for Meteor client-side integration tests. Let's assume that I have autopublish package installed. Problem If a document on the MongoDB was inserted from the server, the client-side mocha tests will not wait for the subscription to synchronise, causing the assertion to fail. Code example...

How to turn off Velocity unit testing in Meteor?

javascript,unit-testing,meteor,mocha,velocity
I'm using the mike:mocha package and I'm trying to figure out how to disable testing. There are times when I have to demo the app I'm working on in my local machine. For those situations, I would like to run the application without the green dot on the top right....

How to make a redirect in velocity template?

apache,tomcat,velocity
How to redirect to http://google.com in the code .vm file? (I mean within #if <redirect to Google here> #else ... #end statement) Doing setRequestURI('http://google.com') or similar doesn't work and I'm not sure if it is possible at all. Thank you. Can anybody explain please?...

How to get VelocityEngine template from an external URL through getTemplate() method?

java,google-app-engine,velocity
I am working on an AppEngine-java project. I am using VelocityEngine as a templating tool to customize a Html file. I have placed my template file at google-cloudstorage. All i want is to initialize that file as a 'Template' through the getTemplate() method in Java. I need help here.. ..just...

How can I change velocity by a certain factor for a certain time, while remaining consistent at different framerates?

algorithm,game-physics,velocity,frame-rate
This is for a game, and I want the velocity of a certain object to decrease at a rate of 98% per frame, when the framerate is 30 frames per second. But, the framerate can be anything between 30 and 60 frames per second. The best solution I came up...

How can I make each block move in the opposite direction once they reach a certain point on the side of the screen?

java,object,block,velocity
I am trying to get three different blocks to move back and forth from one side of the screen to the other. If the block on the far right reaches the game frame's width, it's velocity is reversed and it starts moving to the left side. However, my problem exists...

How do I Escape a Double Quote in Velocity 2.0?

java,velocity
I'm using Velocity 2.0. I've created a method in a custom tool that finds and returns a substring between two strings. This method takes three arguments: the initial string, a beginning subsequence, and an ending subsequence. I've verified that this is working with unit tests. My question is this: how...

Send email with template (Mandrill JSON)

json,email,html-email,velocity,mandrill
Hi I've created an html email template using Apache Velocity . I'm trying to send email through Mandrill Json API. There is something known as html template in Mandrill. But is there a way to send my html subject content generated by velocity to be passed as a String value...

Velocity Engine split() returns String instead of Array

maven,velocity,maven-archetype
I am using mvn archetype:generate to templatize some stuff in my project. I'm running into some trouble with the Maven 3.2.2 Velocity Engine split() method. I havent been able to figure out specifically what version of Velocity Maven is using. #set($foo = "one:a, two:b, three:c") $!foo $foo.split(",") #foreach($bar in $foo.split(","))...

Java Velocity loop add div around every 3 items

java,loops,foreach,velocity
I'm using the following foreach loop #foreach( $product in $allProducts ) <p>$product</p> #end to get <p>something</p> <p>something</p> <p>something</p> <p>something</p> <p>something</p> <p>something</p> Is it possible to wrap a div every 3 items in Velocity? For example to get the following result: <div> <p>something</p> <p>something</p> <p>something</p> </div> <div> <p>something</p>...

Is there any java based template engine to parse dynamic messages like apache vm does for generation?

java,apache,velocity
Hi i am working in an java application which needs to extract some info/data from a some fixed structure messages. For example; The price of mango is Rs.10 The message structre will be always in the format: The price of $item is Rs. $amt Is there is framework any java...

Resetting and changing speed on SKActions

swift,sprite-kit,velocity,skaction
Is there a way to change the velocity/speed of a skaction and also to reset the skaction? let wait = SKAction.waitForDuration(5.0) let moveRight = SKAction.moveByX(300, y:0, duration: 1.0) let sequence = SKAction.sequence([wait, moveRight]) let endlessAction = SKAction.repeatActionForever(sequence) node.runAction(endlessAction) This code works but the things i would like to change is...

Velocity and acceleration measurement in a video

opencv,processing,velocity,frames,units-of-measurement
I am trying to find a method to calculate the velocity and acceleration of a tracked object, lets say a ball falling. I am using Processing 2 to make this program, and I know the distance from the camera to the object and it can calculate its position in every...

Create a formula for velocity based on rotation in 3d?

math,3d,rotation,velocity
So I have a bit of a math problem. Here are the pieces. Input: Rot = Rotation (degrees). This is the rotation of the "player". This is also the yaw. Vel.X = This is the left/rightward movement that would be happening if it weren't rotated Vel.Z = Same as last...

How do I access request parameters in kademi templates?

html,templates,velocity,kademi
I've been developing a website with Kademi and i'm trying to implement a date range search, I've got the date range adding parameters to the URL ?startDate=02/05/15&endDate=12/12/2015 But I don't know how to retrieve these values in kademi templates. How do I do this?...

Liferay Velocity Templates & Structures. Get Children of Children?

templates,liferay,velocity
I'm working with Structures and Templates within Liferay 6.1. When trying to get children of rows it appears that the only way to access the information using a loop is with code similar to this: #foreach ($this in $example.getSiblings()) <h2>$this.getData()</h2> <p>$this.getChildren().get(0).getData()</p> #end Does anyone know how it would be possible...

How to use Velocity NumberTool for big currency numbers

java,formatting,velocity
I'm using the Joda Money.class for currency in my project. I'm using the NumberTool for formatting numbers inside a Velocity template. context.put("number", new NumberTool()); I convert Money values into ints for placing these values inside a Velocity template. example: // 123435 €1234.35 priceInCents = price.getAmountMinorInt(); I want to format this...

Apache Velocity IfNotNull

java,velocity
This link describes how to use if not null condition in velocity. userdirective = org.apache.velocity.tools.generic.directive.Ifnull userdirective = org.apache.velocity.tools.generic.directive.Ifnotnull But looking inside velocity tools jar there is no such class org.apache.velocity.tools.generic.directive.Ifnotnull. What am I missing here?...

Liferay Velocity Structure and Template. Repeatable Fields

templates,liferay,structure,velocity
I am using a structure a little like this with levelOne and levelTwo both being repeatable. levelOne levelTwo levelThree When using a foreach loop to display the data I can only seem to find the first instance of levelTwo and levelThree. I have tried an absolute ton of methods to...

How do I get Spanish characters to display properly using a Velocity template?

java,velocity
I'm using Velocity and a message resource bundle to generate html pages. When I specify Mexico as my locale, my messages-es_MX.properties gets processed as the source for the message resources. This is as I expect it to be. But the characters (áéíóúüñ¿¡) aren't displayed properly. My message property: customer.greeting=áéíóúüñ¿¡ For...

How do you insert the current year into InteliJ IDEA Copyright template?

intellij-idea,velocity
I'm trying to make an Apache Velocity template for MIT license in IntelliJ IDEA copyright settings. I want it to print 2015-${current_year} where the year is. Here is what I've tried to put in Settings → Copyright → Copyright Profiles → MIT → Copyright text: #set ($current_year = $dateTool.getCurrentDate('yyyy')) Copyright...

Liferay variable $user vs $realuser

java,liferay,velocity
There are number of variables available in liferay for custom TPL files.I have found that on below link of liferay. http://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/variables-available-to-layout-a-template-liferay-portal-6-2-dev-guide-09-en But I have confusion on below variables.I am not able understand differrent between $user and $realuser. can anybody help on this? Thank you....

Adding dates and time to bundled templates in PhpStorm

templates,phpstorm,velocity
I want to add some data to the default phpDoc comments. In this case, the one for classes. I can add string text, but some of the conventional variables do not work. See below: /** * Class ${NAME} #if (${NAMESPACE}) * @package ${NAMESPACE} #end * @copyright ${YEAR} * @date ${YEAR}-${MONTH}-${DAY}...

Spring + Velocity Email template not rendering Html on mail body

java,spring-mvc,velocity
I am trying create Email Template in spring + velocity .I am getting Email from this and content from template as well but the html in my template of velocity is not rendered on mail body. Here is my java function of sending email template public void sendMail(String to, String...

Velocity template localization

java,localization,velocity
I'm working on a task that's using Velocity to generate an email from a template. One of my requirements is that the email message be localized, based on a Locale submitted by the user. I've got this working for the most part, using Velocity's ResourceTool to pull in a MessageBundle....

How to configure Java velocity template engine in Eclipse?

java,velocity
I am new in Java velocity template engine. I have created a dynamic web project in Eclipse and placed required jar files (velocity-tools-1.4.jar , velocity-dep-1.4.jar, commons-collections-3.2.1.jar & commons-lang-2.3.jar) in WebContent --> web-inf --> lib folder and configured my web.xml. I have created a servlet and a vm file. But when...

Use main args with SpingBoot & velocity

java,spring,velocity,args
I am making a program and I need to read from main args but I don't know how to proceed. my code public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } controller @Controller public class SampleControler { @Autowired private Checker checker; @RequestMapping("/monitoring") String...

Calculate new position post rotation

jquery,html,math,transform,velocity
I'm having trouble centering a div post rotation. Here's my fiddle: https://jsfiddle.net/cfy2ztdz/ Move between slides with keyboard 1 & 2 You can see that it finds the middle perfectly without rotation, but post rotation, moving back to 1, moves off page - instead of back to the middle. Where's my...

ResourceNotFoundException on existing path

java,io,velocity,resource-loading
I have the following class: public class EmailService { static { Velocity.setProperty("resource.loader", "class"); Velocity.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(); } public void sendTerminalModerationStatusChangedEmail(Terminal terminal, String to) { ... Template subjectTemplate = null; try { subjectTemplate = Velocity.getTemplate(existedPath, "UTF-8"); } catch (URISyntaxException e) { e.printStackTrace(); } ... } } In debug I see that...

C/C++ language file generation with Apache Velocity

java,c++,apache,velocity,directive
I need to generate a C/C++ source file and I thought to use velocity because I already have the sample output file and only need to change some dynamic parts from the sample. The problem is that the template file contains a lot of #define's and #include's. Is there a...

Creating a Velocity template for Dynamic Data List (Liferay 6.2)

templates,liferay,velocity,freemarker,datalist
I'm currently working with liferay 6.2 but i'm having problems to create a Display Template for a Dynamic data list. I'm trying to follow this guide: https://dev.liferay.com/discover/portal/-/knowledge_base/6-2/make-it-pretty-creating-custom-displays#display-templates But the FreeMarker example doesn't work. I'm trying to create a template in Velocity (since i have more knoledge than FreeMarker): My code...

Velocity inline if-else block to add a classname

velocity
I want to set a conditional classname on some element in velocity. For example, if I currently have: <div class="aClass">some content</div> then I want to add another class name conditionally. I thought something like this would work: <div class="aClass #if($foo == 'bar')someClass{else}anotherClass#end">some content</div> but it doesn't work that way, and...

How to retain SKSpriteNode velocity after collision with physicsBody?

ios,sprite-kit,velocity,skspritenode,skphysicsbody
In my game i don't want to decrease velocity of my SKSpriteNode after collision with any physicsBody. Currently velocity of my SKSpriteNode is decresing very much after collision with physicsBody. What did i tried : I tried to get velocity in -(void)update:(CFTimeInterval)currentTime method & i provide it to my SKSpriteNode...