converter

How to send a person to a 404 page if f:viewParam / converter returns null?

匆匆过客 提交于 2019-12-02 06:12:27
问题 Lets say you had a page with a view param, like /widgets?widgetId=1 <f:metadata> <f:viewParam name="widgetId" value="#{widgetIdMB.widgetId}" converter="#{widgetIDConverter}" /> </f:metadata> So, less say your converter throws a ConverterException , because someone tried to navigate to /widgets?widgetId=1000000 , which doesn't exist in the database. Is there a way to send the person to the 404 page when that happens? EDIT: I used a converter to convert the value. If the value can't be looked

Need <f:convertNumber> to throw error when fractions or separator characters are used

我的梦境 提交于 2019-12-02 06:05:58
I have an InputText component wired to a Bean property of int type. However, I'm forced to use NumberConverter only Even when I specify integerOnly = true , it accepts doubles by removing the fractional part and no error is thrown in Validation phase My question is, is there a way for NumberConverter to throw conversion exception and error message (preferably client side, I mean, when I tab out of the field) We are using JSF 1.2 (Actually, NumberConverter's getAsObject() has this code which should be throwing exception when converting from BigDecimal to Integer when there is a loss of

How to convert GPS coordinates to decimal in Lua?

自古美人都是妖i 提交于 2019-12-02 05:50:54
I need to convert GPS coordinates from WGS84 to decimal using Lua. I am sure it's been done before, so I am looking for a hint to a code snippet. corrected question: Code to convert DMS (Degress Minutes Seconds) to DEG ((decimal) Degrees) in Lua? examples: Vienna: dms: 48°12'30" N 16°22'28" E or Zurich: dms: 47°21'7" N 8°30'37" E The difficulty I find is to get the numbers out of these strings. Especially how to handle the signs for degree (°) minutes (') and seconds ("). So that I would have for example a table coord{} per coordinate to deal with. coord {1} [48] coord {2} [12] coord {3} [30]

DateTime string format in c#

淺唱寂寞╮ 提交于 2019-12-02 05:39:11
I have a project that contain 3 string variables. DateFormatStr is the format string I need to use to output dates. DateFormatFrom is the start date a request will apply from FilloutDateTo is the end date the request will apply to. The problem is that I don't want to manually specify the dates. As you can see in my example below (a working example), I need to specify the dates, but is there a way to make it that the from date has time 00:00:00 and the end date has time 23:59:59? string DateFormatStr = "MM/dd/yy hh:mm:ss tt"; string DateFormatFrom = "12/04/14 00:00:00"; string FilloutDateTo =

How to convert Hex string to Decimal

懵懂的女人 提交于 2019-12-02 05:18:30
问题 When I try this, Decimal m = Decimal.Parse(columns[1], System.Globalization.NumberStyles.AllowHexSpecifier); I get an ArgumentException saying this, The number style AllowHexSpecifier is not supported on floating point data types. and columns[1] = 4B414D000000011613C3 btw. what am I doing wrong and how do I fix it ? 回答1: Decimal is floating point type, like Single , Double and so you can't parse by standard means strings like 4B414.D000000011613C3eAF // <- '.' decimal point; 'e' exponent sign

QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka converter

烂漫一生 提交于 2019-12-02 04:44:37
I need to handle YUV data from H/W decoding output on Android. Actually, I'm using Nexus4 and the decoding output format is QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka type. But I need YUV420 Planar format data, it need to be converted. Could you share the converting function or any way? 来源: https://stackoverflow.com/questions/21797923/qomx-color-formatyuv420packedsemiplanar64x32tile2m8ka-converter

Can't play mp4 converted file - JavaFX 2.1

狂风中的少年 提交于 2019-12-02 04:31:15
I have converted my .mov video to .mp4 , but when I play the video in my javafx application, it doesn't work, I can hear the audio of the video file but without pictures ! maybe the .mp4 is not in the right codec! any idea or solution? UPDATE With the same code I have played another mp4 video, in the same conditions (plateforme, JFX Version, ...), so I'm concluding that I have problem with this mp4 converted file, ie the software that I'm using to convert the mov file doesn't generate the approriat mp4 format that is supported by JFX 2.1. The following code sample demonstrates playing an h.264

Format date in <f:selectItem(s) itemLabel> using DateTimeConverter

不想你离开。 提交于 2019-12-02 04:26:43
I have a <h:selectOneMenu> that has <f:selectItems> with CategoryHistory objects loaded in it. I only show the Date date field as itemLabel . That works but I want to format the date: I created a converter that extends javax.faces.convert.DateTimeConverter and change the fields in the constructor. But my dates only show in default format :( DateAndTimeConverter.java import javax.faces.bean.ManagedBean; import javax.faces.convert.Converter; import javax.faces.convert.DateTimeConverter; import javax.faces.convert.FacesConverter; @FacesConverter(value = "dateAndTimeconverter") @ManagedBean public

Qt Converting base64 to QImage returns null

笑着哭i 提交于 2019-12-02 04:12:22
问题 I have problem. I've to convert base64 to QImage, but after that image is always null. Here's code: void convertAll(QString path) { QDir *dir = new QDir(path); QDirIterator *iter = new QDirIterator(*dir); QVector<QFile*> files; QTextStream cout(stdout); cout << "Finding files...\n"; cout.flush(); while (iter->hasNext()) { iter->next(); if (iter->fileInfo().completeSuffix() == "txt") files.push_back(new QFile(iter->filePath())); } delete iter; cout << "Converting files to images...\n"; cout

Convert IPv4 to IPv6 manually

霸气de小男生 提交于 2019-12-02 03:54:40
After read this article i have a question: In the exapmle in this link there is explanation hot to convert 192.168.25.234 into equivalent IPv6 address so in the example this address become C0A8:19EA and it says that this can be written into the following 128-Bit IPv6 link-local address: FE80:0000:0000:0000:0000:0000:C0A8:19EA or FE80::C0A8:19EA So my question is how C0A8:19EA become FE80:0000:0000:0000:0000:0000:C0A8:19EA ? The C0, A8, 19 and EA are just 192, 168, 25 and 234 displayed in hex. The FE80 is a well-known prefix for link local. The rest is always all zero in this case (or for the