converter

Primefaces Calendar with Converter doesn't update correctly upon ajax “valueChange” event

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 05:10:56
问题 I want my p:calendar to work both by clicking on a date in the calendar popup, as well as by editing the date directly in the text input field. This works fine: <p:calendar value="#{myBackingBean.date}"> <p:ajax event="valueChange" listener="#{myBackingBean.updateDate()}" /> <p:ajax event="dateSelect" listener="#{myBackingBean.selectDate()}" /> </p:calendar> However, as soon as I add a converter (see below), the new date is no longer set for "valueChange" events (when the date is edited by

JSF javax.faces.convert Converter getAsString Object null

泪湿孤枕 提交于 2019-12-23 04:52:30
问题 I am working on an application and I used JSF within this application, I wrote a Java class which implements this interface JSF javax.faces.convert , and also overwrite the method getAsString of Converter, here is the Java doc of this method: java.lang.String getAsString(FacesContext context, UIComponent component, java.lang.Object value) But sometimes, the value here is Null , sometimes it works well, does anybody know that why this value is null here? how to prevent it to happen? 回答1: It

JS array string patch name to array(object)

末鹿安然 提交于 2019-12-23 04:28:28
问题 i have trouble with js array. I have patch name(string) look like ( "user.joey.friends.0.franc" ) and i need to "compress" to look like this: console.log( parseArray( "user.joey.friends.0.franc" ) ); //Object { user: { joey: { friends: { 0: { franc: 1 } } } } } Any ideas, how to do that ? 回答1: Here's a non recursive way to get you most of the way there. function compress(str) { var split = str.split('.'), obj = {}, current = obj, i; for (i = 0; i < split.length; i++){ current[split[i]] = {} ;

python unhexlify not working as expected

旧街凉风 提交于 2019-12-23 04:15:10
问题 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

How to convert all *.potx files to *.pptx files with VBA?

 ̄綄美尐妖づ 提交于 2019-12-23 04:14:20
问题 I have a folder of ~20 *.potx files and I would like to convert all *.potx files to *.pptx, then delete the *.potx files. 回答1: The following will loop through all your templates, convert, and delete the template files. Sub loopFiles() Dim fso As New FileSystemObject Dim fil As File Dim fold As Folder Set fold = fso.GetFolder(yourFolder) For Each fil In fold.Files If InStr(1, fil.Name, ".potx") > 0 Then Application.Presentations.Open fil.Path ActivePresentation.SaveAs Replace(fil.Path, ".potx"

How to convert mysql time

痞子三分冷 提交于 2019-12-23 03:38:22
问题 My time in mysql is in the form hh:mm:ss How can I convert that to 12 hour time and also remove the seconds, because they are all 00. ex: 14:30:00 mysql $finalresult = mysql_query("SELECT * FROM events WHERE clubID IN (" . implode(',', $clubIDs) . ") ORDER BY date ASC, TIME(startTime) ASC"); while($finalrow = mysql_fetch_assoc($finalresult)) { $originaltime = $finalrow['startTime']; $newtime = TIME_FORMAT($originaltime, '%h:%i %p'); } 回答1: Use TIME_FORMAT: SELECT TIME_FORMAT('14:30:00', '%h:

convert YUV422 to RGB24

痞子三分冷 提交于 2019-12-23 03:32:17
问题 I tried to write an YUV422 to RGB24 converter, but the result of the converted data seems to be strange. The result is a violet touched greyscale Picture with some light green dots... Does anyone has an idea? inline void convert_yuv442_2_rgb24(const unsigned char* source, unsigned char* destination, unsigned long width, unsigned long height) { unsigned char data[3]; for(unsigned long i = 0, c = 0; i < width * height * 2; i += 2, c += 3) { // 16Bit YUV422 -> 24Bit YUV data[0] = source[i+0];

Converting very large files from xml to csv

≡放荡痞女 提交于 2019-12-23 03:29:21
问题 Currently I'm using the following code snippet to convert a .txt file with XML data to .CSV format. My question is this, currently this works perfectly with files that are around 100-200 mbs and the conversion time is very low (1-2 minutes max), However I now need this to work for much bigger files (1-2 GB's each file). Currently the program freezes the computer and the conversion takes about 30-40 minutes with this function. Not sure how I would proceed changing this function. Any help will

Java program that converts binary numbers to decimal numbers. The input is a string of zeros and ones

拟墨画扇 提交于 2019-12-23 03:05:01
问题 I have to create a java program that converts binary to decimal using the following steps. Being new at this I did something, but I don't know what I did wrong or how to continue. public class BinaryToDecimal { public static void main(String args[]){ long sum = 0; int result; String s = "1001010101011010111001011101010101010101"; for(int i = s.length()-1; i <= 0; i--){ result = (int)Math.pow(2, i); if(s.charAt(i) == '1') sum=sum + result; } System.out.println(sum); } } Use a loop to read

Fahrenheit to Celsius program improvement and choosing the output

与世无争的帅哥 提交于 2019-12-23 02:45:07
问题 I just started programming in C a few days ago and I want to improve my program but not sure how to do it. This program is a Fahrenheit to Celsius and vice versa converter. I did it in the simplest way possible. But now I want to do it so that I have 2 functions c2f and f2c which take the temperature as a parameter and when I run the program I want do choose whether I want to covert from F to C or from C to F (something like TempConverter -f 32 this should only convert 32 into celsius and