Smarty : round up to decimal - smarty

I have been looking for few hours now and can't figure out a solution.
I need a way to round up a price to it's upper decimal, in my template (smarty, I can't edit any php file)
I tried with the round function, but can't figure out how to give the mode parameter "PHP_ROUND_HALF_UP".
Here is what I got so far, that makes a standard round
{(($x+7.5+($x-15)*0.3)/15)|round:"1"}
But it returns 3.2 for x=35 instead of 3.3
Tell me if you need any additional infos.

A bit of sleep and here comes a solution !
Instead of looking for a function, I found that nifty use of ceil :
{(((($x+7.5+($x-15)*0.3)/15)/0.1)|ceil)*0.1}
Simple math, thanks php.net comments !

Related

How do you make a function for a n-pointed star? in mathematica

Im trying to make a function named star for an n-pointed star with radius 1, center (0,0) and start line is (0,1) with an angle n(((n-1)/n)*Pi). How??
My end goal is to make the star on the image I posted:
What mathematica functions do I use? graphics, Line, Table??
If possible id love an example :D.
I have not gotten far, the only code I have written is: star[n_] := Graphics[Table[Line[{}, {}], {}]];
Try
star[n_]:=Graphics[Line[Table[{Cos[t*(n-1)^2/n*Pi],Sin[t*(n-1)^2/n*Pi]},{t,0,n}]]];
star[5]
star[13]
Take it apart, look at what just the Table[...] gives you. And exactly why does that use {t,0,n} instead of {t,0,n-1}. And why does it have (n-1)^2/n in it, what does that do? Then look up the documentation for Line[...] and see what it accepts for input and how the output of Table[...] provides that.
Then the challenging part is that you have to reverse engineer my thought process to figure out what I was thinking and how I got to t*(n-1)^2/n*Pi. If you believe you understand all this then see if you can rewrite the calculations in a different way and still get the same result. And then can you find a way to make this much simpler and easier to understand exactly what it is doing and exactly why?

Oracle reports builder number wraping

I was wondering how to make your numbers wrap in report fields, i tried to set vertical elasticity to expand and to variable, but if i run out of width it's just showing stars instead of numbers. Tried looking everywhere didn't find any other solutions besides the elasticity ones. I am using 11.1.12.0 version of the reports builder tool. Appreciate your help in advance.
Found an answer in oracle community forum, it seems you have to convert numbers to characters if you want the wrap effect, hese is the answer. "You may have to create a place to hold the summary value converted to char, or use a format trigger, but, as it's a very big number, if you are going to use a mask, I think you'll need to enter a very long mask, like '999G999G999G999G999G999G999G999G999G999G999G999G999G999G999G999G999G990D00'
because I don't think oracle has something like excel's masks: #,##0.00"

swi-prolog [lists]

Hey i was working on this little method i guess you call them messing around trying to get my grip on swi-prolog before I have my big project assigned in a week or so at university. Its pretty obvious what it does say i say "colors(yellow,F). it will give me banana, lemon and so on...
colors(C,F):-fruits(F,C)
Now my question is i know i can use list_to_set(F, (something else)), to make the output into one list instead of having to hit ';' to get all of the fruits. THOUGH... is there anyway i can incorporate the list making into the actual method?
cheers!
Okay found out how to:
colors(C,F):-findall(C,fruits(F,C),C).
simple enough, just had to stick it in there. Thanks Anyways!

Erlang and current date time

I would like to get a current date time with erlang.
I have tried using the code below;
{{Year,Month,Day},{Hour,Min,Sec}} = erlang:localtime().
But sometimes it got an error like '** exception error: no match of right hand side value {{2012,5,6},{23,40,58}}'
Looks like there is a problem with 1 digit. I try searching couple of webs but still cannot find a way to cope this.
I believe this is quite an easy one but as a erlang newbie, I cannot resolve this. I try my best.
Env:
Erlang {"OTP APN 181 01","R15B01"} installed with windows binary version
Windows XP
Thanks in advance,
No, there is no problem with 1 digit. It should match perfectly well (check with {{Year,Month,Day},{Hour,Min,Sec}} = {{2012,5,6},{23,40,58}}). Most likely you have already assigned one of the variables to something earlier in the function.

JMeter mathematical function

I have one random variable and one variable which I read from page. How can I subtract or multiply that two variables and where or in which component in JMeter.
Check out the functions page for Jmeter. It has tons of cool math tools that you can plug anywhere in your script.
You'll most likely end up doing a jexl command, which would look something like this: ${__jexl2(${var1}-${var2})}
The above did not work for me. How ever i was able to resolve my problem with :
${__jexl(vars.get("YOUR_VARIABLE")+1)}

Resources