converter

convert an int to list of individual digitals more faster?

a 夏天 提交于 2019-12-23 02:32:26
问题 All, I want define an int(987654321) <=> [9, 8, 7, 6, 5, 4, 3, 2, 1] convertor, if the length of int number < 9 , for example 10 the list will be [0,0,0,0,0,0,0,1,0] , and if the length > 9, for example 9987654321 , the list will be [9, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>> i 987654321 >>> l [9, 8, 7, 6, 5, 4, 3, 2, 1] >>> z = [0]*(len(unit) - len(str(l))) >>> z.extend(l) >>> l = z >>> unit [100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1] >>> sum([x*y for x,y in zip(l, unit)])

How to convert raw BGRA image to JPG using GStreamer 1.0?

依然范特西╮ 提交于 2019-12-23 01:46:31
问题 I'm trying to display a raw image (1.8MB) with gst-launch-1.0 . I understand that the data needs to be encoded to JPG before this can be achieve. If image was already stored as a jpg file the story would be quite simple: gst-launch-1.0.exe -v filesrc location=output.jpg ! decodebin ! imagefreeze ! autovideosink However, I need to assemble the pipeline to display a raw BGRA 800x600 image (looks the same as the above) that was dumped to the disk by a 3D application. This is what I've done so

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

家住魔仙堡 提交于 2019-12-23 01:12:37
问题 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")

infix to postfix converter

时光怂恿深爱的人放手 提交于 2019-12-22 18:39:11
问题 I have been working on this infix to postfix/polis notation converter. Although, I do not feel the solution is adequate. Specifically the j (EDIT: Now called index) variable is bugging me. Do you guys have any suggestions? Or perhaps there is a much better way to accomplish it? Or do I just worry too much? public static string[] InfixToPostfix(string[] infixArray) { var stack = new Stack<string>(); var postfix = new string[infixArray.Length]; int index = 0; string st; for (int i = 0; i <

C# How are arrays stored in memory

百般思念 提交于 2019-12-22 12:36:08
问题 I guess my main question is, will this always work as long as I don't re-initialize (new byte[#]) the array that was passed as the parameter? static unsafe decimal GetDecimal(byte[] ba) { decimal* decimal_PTR; fixed (byte* byte_PTR = &ba[0]) { decimal_PTR = ((decimal*)byte_PTR); } return *decimal_PTR; } I'm not sure how C# handles arrays in memory. I didn't even know they were managed types until about an hour ago. I just want to know if I pass in a decimal as a byte[], will it always return

wpf how to use a converter for child bindings of multibinding?

删除回忆录丶 提交于 2019-12-22 11:01:42
问题 I need a multibinding of bunch boolean properties but with inversing some of these like an example: <StackPanel> <StackPanel.IsEnabled> <MultiBinding Converter="{StaticResource BooleanAndConverter}"> <Binding Path="IsInitialized"/> <Binding Path="IsFailed" Converter="{StaticResource InverseBooleanConverter}"/> </MultiBinding> </StackPanel.IsEnabled> </StackPanel.IsEnabled> But I got a InvalidOperationException from a InverseBooleanConverter with message "The target must be a boolean". My

Convert HTML to RTF in java?

本小妞迷上赌 提交于 2019-12-22 10:53:51
问题 I need to convert HTML to RTF, and I am using this code: private static String convertToRTF(String htmlStr) { OutputStream os = new ByteArrayOutputStream(); HTMLEditorKit htmlEditorKit = new HTMLEditorKit(); RTFEditorKit rtfEditorKit = new RTFEditorKit(); String rtfStr = null; htmlStr = htmlStr.replaceAll("<br.*?>", "#NEW_LINE#"); htmlStr = htmlStr.replaceAll("</p>", "#NEW_LINE#"); htmlStr = htmlStr.replaceAll("<p.*?>", ""); InputStream is = new ByteArrayInputStream(htmlStr.getBytes()); try {

Ghostscript: convert PDF to EPS with embeded font rather than outlined curve

蹲街弑〆低调 提交于 2019-12-22 09:55:48
问题 I use the following command to convert a PDF to EPS: gswin32 -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -dLanguageLevel=2 -sOutputFile=test.eps -f test.pdf I then use the following command to convert the EPS to another PDF (test2.pdf) to view the EPS figure. gswin32 -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -dEPSCrop -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=test2.pdf -f test.eps I found

Extract specific parts of PDF documents [closed]

三世轮回 提交于 2019-12-22 09:40:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . i have multiple (30) PDF files, each containig 48-96 pages. The layout of all pages is identical, there are just other contents (numbers, graphs). Background: These pages are PDF Reports of fibre cable measurements, and I have to sort them by attenuation of the cables. Due to confidential issues, I unfortunatly

Display formatted decimal numbers in Primefaces 4 [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-22 09:18:51
问题 This question already has an answer here : Displaying a number in 2 point decimal format in jsf (1 answer) Closed 2 years ago . I have a database table with a float field and I want to display it through Primefaces. I want to display the numbers formatted as (one thousand, for example): 1.000,00 I tried: <p:column sortBy="#{item.value}" filterBy="#{item.value}"> <f:facet name="header"> <h:outputText value="#{epoBundle.ListUpbTitle_value}"/> </f:facet> <h:outputText value="#{item.value}"/> <f