converter

How to solve “Conversion Error setting value '2013-10-26' for 'null Converter'” in h:inputText with Date value?

天涯浪子 提交于 2019-12-01 21:54:25
when I press the insert button, I get the error indicated on the title Conversion Error setting value '2013-10-26' for 'null Converter' <h:form id="formulario"> <h:outputLabel for="date">Plazo</h:outputLabel> <h:inputText id="date" required="true" requiredMessage="Campo Obligatorio" value="#{aaaNewDetalles.criterioAaa.plazo}"/> <h:message for="date" style="color: red;"/> <h:commandButton actionListener="#{aaaNewDetalles.add()}" value="Ingresar"/> </h:form> the form is managed by this class: @ManagedBean(name = "aaaNewDetalles") @ViewScoped public class aaaNewDetallesBean { private

JSF List Converter

岁酱吖の 提交于 2019-12-01 19:40:57
问题 How do I write a converter for a list of items of class A in JSF2? I have written a converter for class A, but the items show up using the default toString() function: "A@hashcode". I need to use a converter rather than a backing bean method so that validation can take place (Hibernate Validator). more info This is how I use the list: <h:inputText id="destinations" value="#{rule.destinations}" converter="gr.panayk.vinyls.Destination"/> Where #{rule.destinations} is of List<Destination> type.

.NET Library for CGM File Conversion

不羁岁月 提交于 2019-12-01 18:13:05
I have been working on a utility to convert various files to PDF for easy printing/emailing. I'm trying to add support for CGM files but have not been able to find any libraries to help me do so. Is this something that I can possibly do natively within C#? Or are there any .NET based libraries that could help me convert CGM files? JCGM Using IKVM you could pull in the Java JCGM library. It has support for rendering to a Java Graphics object and no dependencies on other libraries. I'm not sure if IKVM will support all the required Swing calls but its definitely got support for some: AWT/Swing a

Equivalent in C# of Python's “struct.pack/unpack”?

若如初见. 提交于 2019-12-01 17:52:23
I am a seasoned Python developer and have come to love a lot of its conveniences. I have actually known C# for some time but recently have gotten into some more advanced coding. What I'm wondering is if there's a way to "parse" a byte array in C# into a set of (differently sized) items. Imagine we have this: Python: import struct byteArray = "\xFF\xFF\x00\x00\x00\xFF\x01\x00\x00\x00" numbers = struct.unpack("<LHL",byteArray) print numbers[0] # 65535 print numbers[1] # 255 print numbers[2] # 1 newNumbers = [0, 255, 1023] byteArray = struct.pack("<HHL",newNumbers) print byteArray # '\x00\x00\xFF

@Inject not working in AttributeConverter

空扰寡人 提交于 2019-12-01 17:51:14
I have a simple AttributeConverter implementation in which I try to inject an object which have to provide the conversion logic, but @Inject seem not to work for this case. The converter class looks like this: @Converter(autoApply=false) public class String2ByteArrayConverter implements AttributeConverter<String, byte[]> { @Inject private Crypto crypto; @Override public byte[] convertToDatabaseColumn(String usrReadable) { return crypto.pg_encrypt(usrReadable); } @Override public String convertToEntityAttribute(byte[] dbType) { return crypto.pg_decrypt(dbType); } } When the @Converter is

Converter from @PathVariable DomainObject to String? (using ControllerLinkBuilder.methodOn)

China☆狼群 提交于 2019-12-01 17:35:25
I'm trying to call Spring's ControllerLinkBuilder.methodOn() with a non-String type, which always fails. And I don't know which kind of Converter to use and where to register it. Here's my Controller: @RestController @RequestMapping("/companies") class CompanyController { @RequestMapping(value="/{c}", method=RequestMethod.GET) void getIt(@PathVariable Company c) { System.out.println(c); Link link = linkTo(methodOn(getClass()).getIt(c)); } } The System.out.println(c) works well. My Company Domain object get's fetched from DB. (I'm using DomainClassConverter ) But the other way doesn't work:

Converter from @PathVariable DomainObject to String? (using ControllerLinkBuilder.methodOn)

守給你的承諾、 提交于 2019-12-01 17:08:38
问题 I'm trying to call Spring's ControllerLinkBuilder.methodOn() with a non-String type, which always fails. And I don't know which kind of Converter to use and where to register it. Here's my Controller: @RestController @RequestMapping("/companies") class CompanyController { @RequestMapping(value="/{c}", method=RequestMethod.GET) void getIt(@PathVariable Company c) { System.out.println(c); Link link = linkTo(methodOn(getClass()).getIt(c)); } } The System.out.println(c) works well. My Company

Inject managed-bean property into custom converter

早过忘川 提交于 2019-12-01 16:05:38
How can I inject a property of a managed-bean into a custom converter? For instance, a generic List so that I can extract my object from the list inside the converter? Mr.J4mes In several case, when you need to inject a bean such as ManagedBean, EJB, etc. into a Converter or a Validator , you can try annotating your Converter or Validator as a ManagedBean. For example, you can try this: @ManagedBean @RequestScoped public class MyConverter implements Converter { @EJB private MrEJBBean mrEJBBean; @ManagedProperty(value="#{mrsManagedBean}") private MrsManagedBean mrsManagedBean; @Override public

Inject managed-bean property into custom converter

我与影子孤独终老i 提交于 2019-12-01 15:57:37
问题 How can I inject a property of a managed-bean into a custom converter? For instance, a generic List so that I can extract my object from the list inside the converter? 回答1: In several case, when you need to inject a bean such as ManagedBean, EJB, etc. into a Converter or a Validator , you can try annotating your Converter or Validator as a ManagedBean. For example, you can try this: @ManagedBean @RequestScoped public class MyConverter implements Converter { @EJB private MrEJBBean mrEJBBean;

Converting sparse matrix to ARFF using awk

人盡茶涼 提交于 2019-12-01 14:40:27
I am working with an extremely large data set in a sparse matrix format. The data has the filing format (3 tab separated columns, where the string in the first column corresponds to a row, the string in the second column corresponds to the attribute and the value in the third column is a weighted score). church place 3 church institution 6 man place 86 man food 63 woman book 37 I would like to convert this to arff format using awk (if possible) so that using the above as an input, I can obtain the following output: @relation 'filename' @attribute "place" string @attribute "institution" string