converter

Facelet selectOneMenu with POJOs and converter problem

无人久伴 提交于 2019-12-08 08:17:59
问题 I want to have a facelet page with a formular and a dropdown menu. With the dropdown menu the user shoul select a POJO of the type Lieferant: public class Lieferant extends AbstractPersistentWarenwirtschaftsObject { private String firma; public Lieferant(WarenwirtschaftDatabaseLayer database, String firma) { this(database, null, firma); } public Lieferant(WarenwirtschaftDatabaseLayer database, Long primaryKey, String firma) { super(database, primaryKey); this.firma = firma; } public String

Default ValueConverter for a class in WPF

≡放荡痞女 提交于 2019-12-08 08:17:37
问题 I'm just about to start a new project of mine and am currently evaluating some techniques for localization, modularity etc. I have (at least in my opinion) a pretty good approach to localization but now I struggle to find a good solution for databinding. I want to bind values of textfields etc. (UIElements in general) to a specific method in the DataContext of the form. The method looks like this: public void GetValue(string name) where name is a "path" in the form of "node/subnode/subsubnode

Why can't my php generated word document be opened?

試著忘記壹切 提交于 2019-12-08 07:06:31
问题 In my xampp htdocs folder I got two files: An image and a php script. I tried to create a word document with an image. This is the code I used: $image = 'img.png'; $imageData = base64_encode(file_get_contents($image)); $src = 'data: '. mime_content_type($image).';base64,'.$imageData; header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=document_name.doc"); echo "<html>"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows

convert eye-tracking .edf file to ASC/CSV format

天大地大妈咪最大 提交于 2019-12-08 05:57:27
问题 I have a recording of tracking data in .edf format (SR-RESEARCH eyelink). I want to convert it to ASC/CSV format in python. I have the GUI application but I want to do it programmatically (in Python). I found the package pyEDFlib but couldn't find an example to how convert the eye-tracking .edf file to .asc or .csv. What will the best best way to do it? Thanks 回答1: If I trust the page here: http://pyedflib.readthedocs.io/en/latest, you can run through all the signals in the file this way:

Vaadin converter for java.sql.Timestamp

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 03:23:52
问题 I am working with PostgreSQL database and timestamp columns have class java.sql.Timestamp. Even if this class extends java.util.Date, when I edit PopupDateFiels, I obtain error Unable to convert value of type java.util.Date to model type class java.sql.Timestamp. No converter is set and the types are not compatible. Default converter factory is unable to work properly. I tried to write dateField.setConverter(new DateToSqlDateConverter()); or dateField.setConverter(StringToDateConverter.class)

selectOneMenu with complex objects, is a converter necessary? [duplicate]

╄→гoц情女王★ 提交于 2019-12-08 03:01:26
This question already has answers here : Conversion Error setting value for 'null Converter' - Why do I need a Converter in JSF? (2 answers) Closed 4 years ago . Is a Converter necessary for a <h:selectOneMenu> or <p:selectOneMenu> with arbitrary user-created classes as its values? I mean, is the following code supposed to work without a converter? <p:selectOneMenu value="#{bean.language}"> <f:selectItems value="#{bean.allLanguages}" /> </p:selectOneMenu> and @Named(value = "bean") @ConversationScoped public class Bean { private Language language; // appropriate getter and setter are present

python unhexlify not working as expected

落花浮王杯 提交于 2019-12-08 02:48:21
Whenever a program opens a file it sees the file as binary data. It translates it to a higher interpretive language i.e. octal, hex, ascii , etc. In this case it displays hexadecimal in the LH pane and ansi (windows 7 so it should be CP1252) in the RH pane. The 3 pictures below illustrate the original view, then the desired alteration, and the 3rd is the actual change made by the code: with open(tar,'rb') as f: data = binascii.hexlify(f.read(160)) if old in data: print 'found!' data = data.replace(old, new) else: print 'not found' with open(tar+'new', 'wb') as fo: binascii.unhexlify(data) fo

How can a bot receive a voice file from Facebook Messenger (MP4) and convert it to a format that is recognized by speech engines like Bing or Google?

坚强是说给别人听的谎言 提交于 2019-12-08 01:28:39
问题 I'm trying to make a bot for Facebook Messenger using Microsoft's Bot Framework that will do this: Get a user's voice message sent via Facebook Messenger Convert speech to text Do something with it There's no problem with getting the voice message from Messenger (the URL can be extracted from the message the bot receives), and there's also no problem with converting an audio file to speech (using Bing Speech API or Google's similar API). However, these APIs require PCM (WAV) files, while

How to convert hex to string or text in php

百般思念 提交于 2019-12-07 23:50:54
问题 I want to encrypt a message to string(text) format but I don't know the function which can convert Hex to String: here is my page : <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php // on commence par définir la fonction Cryptage que l'on utilisera ensuite function Cryptage($TEXT, $Clef) { $LClef = strlen($Clef); $LTEXT = strlen($TEXT); if ($LClef < $LTEXT) { $Clef = str_pad($Clef, $LTEXT, $Clef, STR_PAD_RIGHT); } elseif (

How can I dynamically change the converter on DataGridTextColumn binding in WPF?

会有一股神秘感。 提交于 2019-12-07 20:05:10
问题 I really don't understand WPF and XAML, and inherited some terribly written code, so I may be butchering this, but here goes. I inherited a DataGrid bound (in code behind) to a list of Person objects, where the necessary DataGridTextColumns are specified in XAML (presumably to allow styling). <DataGrid x:Name="PersonGrid" ItemsSource="{Binding}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Path=LastName}" MaxWidth="Infinity" MinWidth="150" Header="Last