How to use if inline helper in glimmer application - glimmer.js

when i tried to use if helper in glimmer application.It gives me an error like Uncaught Error: Compile Error: if is not a helper

EDIT: Starting with v0.8.0 there is an inline if.
The version of Glimmerjs you are using does not have an inline if helper, you can either implement it yourself or upgrade your Glimmerjs project to v0.8.0.
To create the helper, run ember g glimmer-helper if, and then edit the file with the following:
// src/ui/components/if/helper.ts
export default function helper([cond, truthy, falsy]) {
return cond ? truthy : falsy;
}
To update, I suggest using ember-cli-update. On top of upgrading your dependencies, you will also have to update your components to the new <Capital> syntax.

Related

TypeError: expect(...).toBeObservable is not a function - Jasmine marbles

I am trying to write a basic ngrx effects testing. However I keep getting the error as TypeError: expect(...).toBeObservable is not a function.
This is a new project setup with Angular 7. I had no issues with my previous projects which ran in angular 4.
Initially thought it could be something to do with packages so upgraded all packages to the most latest but no luck yet.
I event tried to test a very simple observable as expect(effects.test$).toBeObservable(5); but it gives the same error. As mentioned in the title I am using jasmine-marbles and the version is 0.4.1.
You need to init the test scheduler and add matchers in before each or toBeObservable will not be defined:
import { addMatchers, initTestScheduler } from 'jasmine-marbles';
beforeEach(() => {
...
initTestScheduler();
addMatchers();
});

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.

Register custom constraints

I'm trying to upgrade Grails 2.3.7 project to Grails 3.2.3. In 2.3.7, I used custom constraints and register them in /conf/Config.groovy using:
org.codehaus.groovy.grails.validation.ConstrainedProperty.registerNewConstraint('description', my.validation.DescriptionConstraint)
Then I can use something like this in domain:
static constraints = {
approvedDate(description: '>= applyDate')
}
However, in Grails 3.2.3, When I put above command (and remove org.codehaus.groovy from package name) in /conf/application.groovy I got following error:
Error occurred running Grails CLI: No signature of method: groovy.util.ConfigObject.registerNewConstraint() is applicable for argument types: (groovy.util.ConfigObject, groovy.util.ConfigObject) values: [[:], [DESCRIPTION_CONSTRAINT:[:]]]
I've notice that validation class is somewhat changed in Grails 3. However using constraint class from Grails-validation still got the same error.
All validation plugins I found were long abandoned before Grails 3. And I can't find any document for register new constraint in Grails 3.2.
Calling ConstrainedProperty.registerNewConstraint in /grails-app/init/BootStrap.groovy works. (tested with Grails 3.2.4)
class BootStrap {
def init = { servletContext ->
grails.validation.ConstrainedProperty.registerNewConstraint('description', my.validation.DescriptionConstraint)
// The rest of bootstrap code
}
}
Note. Previously, I call it from main() in /grails-app/init/Application.groovy. It works for running application. However, it does not work with integration test.
Another way you can create the runtime.groovy under config and register your constraints in the runtime.groovy as in grails 2.x.x:
org.codehaus.groovy.grails.validation.ConstrainedProperty.registerNewConstraint('description', my.validation.DescriptionConstraint)

Repetitive method name/signature for method compilation error when using #I18nFields

I get repetitive method name/Signature compilation failure when i try to use i18nFields in my domain class to support multiple languages.
Grails Version : 2.3.7 ( I tried with 2.3.4 and got the same issue and upgraded)
Documentation from Grails followed for this was http://grails.org/plugin/i18n-fields
My Domain class looks like
package com.sampleapp.domain
import i18nfields.I18nFields;
#I18nFields
class Products {
def name
static constraints = {}
static i18nFields = ['name']
}
My Config.groovy has the below line included to specify the locale
// internationalization support - testing
i18nFields {
locales = ['en','es']
}
BuildConfig.groovy plugin definition
plugins {
// plugins for the build system only
build ":tomcat:7.0.47"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or":hibernate4:4.1.11"//
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
// compile ":jquery-ui:1.10.2.2"
runtime ":resources:1.2.1"
// Uncomment these (or add new ones) to enable additional resources capabilities
runtime ":zipped-resources:1.0.1"
runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
compile ':platform-core:1.0.RC6'
compile ":cache-headers:1.1.5"
runtime ':spring-security-core:2.0-RC2'
// internationalization
compile ":i18n-fields:0.8.1"
}
The compilation error is
grails-workspace\Test\grails-app\domain\com\sampleapp\domain\Products.groovy: -1: Repetitive method name/signature for method 'void setName_es(java.lang.String)' in class 'com.sampleapp.domain.Products'.
# line -1, column -1.
The Error is repeated for the name property for both en and es locales twice.
There is no error if i remove the i18nFields annotation and the sample app worked fine before this. I verified GGTS repetitive method name/signature error in controllers post for similar error in controller. I have also verified to ensure that groovy version is correct and in my case it is 2.1
Can somebody please give me any pointers on where i should look to resolve this issue.
This problem shows up when you are trying to use Java > v7 with any version of Grails < 2.3.7. Either downgrade your jvm or upgrade your grails.
Thanks for trying (and for making me know via github ;) )
The issue was known but hadn't been tackled yet.
The previous answer (commenting out methods) is not exact, event though it follows the right track, because the problem comes from new changes in Grails that will cause a collision in getters and setters.
The solution I've found is to separately create the property and the getter/setter, and it seems to work.
I'm releasing a new version as soon as it can be fully tested in a project, but code is already available in https://github.com/jorgeuriarte/grails-i18n-fields-plugin/tree/redis_integration (version 0.9-redis-SNAPSHOT) in case you want to use it.
Probably it has something to do with the new Binding mechanism in grails 2.3. Maybe the getters and setters are set automatic now?
When I comment out these two lines in ClassI18nalizator.groovy the error disappears. It seems to work at least partly. I can use the fields in scaffolding. It's not a real solution but maybe a hint for someone who understands grails better than me.
private def getSetterMethod(field) {
// setter should return void. that's why the return statement.
//return new AstBuilder().buildFromString("i18nfields.I18nFieldsHelper.setValue(this, '${field}', value); return;").pop();
}
private def getGetterMethod(field) {
//new AstBuilder().buildFromString("i18nfields.I18nFieldsHelper.getValueOrDefault(this, '${field[0..-7]}', '${field[-5..-1]}')").pop();
}
After that I run into a second issue:
No signature of method: groovy.util.ConfigObject.contain() is
applicable for argument types: (java.lang.String) values: [en_US]
I solved it by adding redisLocale to Config.groovy
i18nFields {
locales = ['de_DE', 'en_US']
defaultLocale = "en_US"
redisLocales = ['de_DE', 'en_US']
}

HDF5 example not working

I tried building the first example here and got errors. Right on the first line there's a missing include statement, but I managed to figure out it should be
#include "hdf5.h"
But even after fixing that I got more errors:
$ h5cc ./example1.c
./example1.c: In function ‘main’:
./example1.c:66:4: error: too few arguments to function ‘H5Dcreate2’
In file included from /usr/include/hdf5.h:27:0,
from ./example1.c:6:
/usr/include/H5Dpublic.h:104:14: note: declared here
Any idea how to solve it?
The example code was written for release 1.6 of hdf5, and as such will simply not compile on a 1.8 release without modification.
If you want to get the code to work on 1.8, you need to enable 1.6 compatibility, which means passing in the flag:
-DH5_USE_16_API
to the h5cc command line like:
h5cc -DH5_USE_16_API ./example1.c
and it should compile correctly; otherwise you will have to rewrite the code to make use of the 1.8 API.

Resources