Adonis Edge Template throws E_INVALID_EXPRESSION: Invalid expression <undefined> passed to (if) block - templating

I am trying to do something like this.
#each(user in users)
#if(user.something)
<h2>something</h2>
#else
<h2>something else</h2>

I found that Edge templating engine doesn't support space after any tag, That's what was causing problem.

Related

What Is the Replacement for the #Decorator Directive?

I'm upgrading my dart code from angular 1 to angular 4.
This line now gives an error in my IDE:
#Decorator(selector: '[citable]')
Annotation must either be a const variable or const construction invocation.
I was able to fix this error on #Input by including the formDirective. What directive should I use for #Decoration? I can't find any recent mention of #Decorator in a web search for AngularDart.
I tried adding const after selector:. Then I get a syntax error.
The replacement is #Directive.

HHVM non-deterministic behaviour of the typechecker

I've noticed that calling hh_client is not always returning correct result. For example: I have following pieces of code:
backend\ConvertMessage.hh:
<?hh // strict
namespace ApiBackend\ConvertMessage {
enum Status: int {
success = 0;
// ... error codes
};
// ... some other classes
};
other place in project:
throw new \SoapFault(
'Server',
\ApiBackend\ConvertMessage\Status::getNames()[$result->status]
);
Sometimes, after doing some changes in project I get following error message: Could not find static method getNames in type ApiBackend\ConvertMessage\Status (Typing[4090])
When I remove a semicolon after one of closing curly brackets, hh_client stops displaying error. But when I insert semicolon back on its place, typechecker still gives me No errors! message.
This is not the only file that causes this problem - it happens to all enums.
It seems to me that it is problem with some cache of either hh_client or hh_server.
Thanks in advance for helping me with solving this problem (and sorry if my english is not too good).
You are probably using an outdated version of HHVM. This problem sounds an awful lot like this race condition, which was fixed in HHVM 3.5.0 and newer (and was backported into the 3.3.3 LTS release). Notably, 3.4.x still had the bug.
What version of HHVM are you using?

Emacs css-mode not loading

I'm not sure why, but on my Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4) css-mode is not loading and with M-x css-mode gives this error in Messages:
Symbol's function definition is void: apropos-macrop
or
File mode specification error: (void-function apropos-macrop)
my css file (ending in .css) is in Fundamental. I just tried it on a 23.1.1 and CSS mode comes up and works fine.
Update: Traced problem to my autoloads. i.e., comment out autoloads
;(load "~/modes/autoloads" 'install)
and the problem goes away. I'm not sure what to hack with an autoloads file. Any way to "step" through an autoloads? Here's my autoloads: http://gmcongo.org/temp/autoloads
In Emacs 24.4 and the bleeding edge versions leading to it (like 24.3.50+), apropos-macrop has been replaced by macrop. In css-mode.el, replace the call to apropos-macrop with a call to macrop and the error goes away.
Building upon the existing correct answer, you can create an alias in your ~/.emacs instead of editing css-mode (if for example, it came in a package with your distribution):
;; For css-mode, temporarily.
(defalias 'apropos-macrop 'macrop)

XML parsing in Ruby

I am using a REXML Ruby parser to parse an XML file. But on a 64 bit AIX box with 64 bit Ruby, I am getting the following error:
REXML::ParseException: #<REXML::ParseException: #<RegexpError: Stack overflow in
regexp matcher:
/^<((?>(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*))\s*((?>\s+(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*\s*=\s*(["']).*?\3)*)\s*(\/)?>/mu>
The call for the same is something like this:
REXML::Document.new(File.open(actual_file_name, "r"))
Does anyone have an idea regarding how to solve this issue?
I've had several issues for REXML, it doesn't seem to be the most mature library. Usually I use Nokogiri for Ruby XML parsing stuff, it should be faster and more stable than REXML. After installing it with sudo gem install nokogiri, you can use something like this to get a DOM instance:
doc = Nokogiri.XML(File.open(actual_file_name, 'rb'))
# => #<Nokogiri::XML::Document:0xf1de34 name="document" [...] >
The documentation on the official webpage is also much better than that of REXML, IMHO.
I almost immediately found the answer.
The first thing I did was to search in the ruby source code for the error being thrown.
I found that regex.h was responsible for this.
In regex.h, the code flow is something like this:
/* Maximum number of duplicates an interval can allow. */
#ifndef RE_DUP_MAX
#define RE_DUP_MAX ((1 << 15) - 1)
#endif
Now the problem here is RE_DUP_MAX. On AIX box, the same constant has been defined somewhere in /usr/include.
I searched for it and found in
/usr/include/NLregexp.h
/usr/include/sys/limits.h
/usr/include/unistd.h
I am not sure which of the three is being used(most probably NLregexp.h).
In these headers, the value of RE_DUP_MAX has been set to 255! So there is a cap placed on the number of repetitions of a regex!
In short, the reason is the compilation taking the system defined value than that we define in regex.h!
This also answers my question which i had asked recently:
Regex limit in ruby 64 bit aix compilation
I was not able to answer it immediately as i need to have min of 100 reputation :D :D
Cheers!

Double closure fails in GSP

In a GSP file I write something like this:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
But I receive the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
C__STS_Projekte_TischtennisManager_grails_app_views_league__showGameSheet_gsp:
49:expecting '}', found ')' # line 49, column 134.
heets.find{it.matchnumber==1 })
The problem seems to be the double closure as I've found a bug report here.
Unfortunately the solution from the bugreport with the %= and % at the beginning and the end of the tag is not working for me.
Are there any other workarounds or solutions for this double closure problem?
I'm using Grails 1.3.7.
You may have to split this up in to two lines.
Try assigning the find results to a separate var first
<% def r = tgs.singleGameSheets.find{it.matchnumber==1} %>
${r*.awayPlayer.fullname()}
I would recommend firstly to do this sort of data processing in the controller and hand data that is as well prepared as possible down to the view.
If you are unable to do that, I would recommend trying to use parenthesis:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
becomes
${(tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname())}
That has worked for me on past occasions where I had to do ${(someCollection.findAll { someClause })}

Resources