convert

How can I convert a BouncyCastle X509Certificate to an X509Certificate2?

匿名 (未验证) 提交于 2019-12-03 02:53:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there any way to convert a Org.BouncyCastle.X509.X509Certificate to System.Security.Cryptography.X509Certificates.X509Certificate2 ? The inverse operation is easy, combining Org.BouncyCastle.X509.X509CertificateParser with System.Security.Cryptography.X509Certificates.X509Certificate2.Export() . 回答1: Easy!! using B = Org.BouncyCastle.X509; //Bouncy certificates using W = System.Security.Cryptography.X509Certificates; W.X509Certificate2 certificate = new W.X509Certificate2(); certificate.Import(pdfCertificate.GetEncoded()); And now I can

C++: how to convert ASCII or ANSI to UTF8 and stores in std::string

匿名 (未验证) 提交于 2019-12-03 02:53:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My company use some code like this: std::string(CT2CA(some_CString)).c_str() Is there anyway that I can put this header back to UTF8 and store into a std::string or const char*? I know there are a lot of smarter ways to do this, but I need to keep the code sticking to its original one (i.e. sent the header as std::string or const char*). Thanks in advance. 回答1: This sounds like a plain conversion from one encoding to another encoding: You can use std::codecvt<char, char, mbstate_t> for this. Whether your implementation ships with a suitable

How to Convert a WPF inch unit to Winforms pixels and vice versa?

匿名 (未验证) 提交于 2019-12-03 02:53:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a window that designed at WPF and I used that on center of a WinForms owner. Now, I want to move the owner form and at the moment my WPF window has also to be moved in the center of the form! But I have a problem, Only when window is in the center of the form that form in the center of the screen. And otherwise act in a different form than the Windows coordinates. I just add the displacement values of the form to window location. Now I have come to the conclusion that the coordinates of the pixels on WPF Windows are

Convert joda.time.DateTime to java.sql.Date and retain time zone

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following scenario: Swing control that returns a Calendar object Intermediate DateTime object that I use to do heavy date/time manipulation (joda) Database connection ( OraclePreparedStatement ) that only takes a java.sql.Date object My problem is that the Calendar and DateTime objects are properly displaying the date in GMT (which I want), but when I convert to java.sql.Date in order to send to the database, the date is converted to the local time zone. For example: Calendar and DateTime are 2012-08-13T23:59:59.000Z (correct GMT)

How to convert cv::Mat to pcl::pointcloud

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to get from a opencv Mat pointcloud to a pcl::pointcloud? The color is not important for me only the points itself. 回答1: you can do this like: pcl::PointCloud<pcl::PointXYZ>::Ptr SimpleOpenNIViewer::MatToPoinXYZ(cv::Mat OpencVPointCloud) { /* * Function: Get from a Mat to pcl pointcloud datatype * In: cv::Mat * Out: pcl::PointCloud */ //char pr=100, pg=100, pb=100; pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_ptr(new pcl::PointCloud<pcl::PointXYZ>);//(new pcl::pointcloud<pcl::pointXYZ>); for(int i=0;i<OpencVPointCloud.cols;i++) { /

Convert a &#039;System::String ^&#039; to &#039;const char *&#039; in vc++

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I convert a 'System::String ^' to 'const char *' in vc++? My code: String ^Result1= "C:/Users/Dev/Desktop/imag.jpg"; IplImage *img1 = cvLoadImage(Result1, 1); if I do like above it will generate following error. error C2664: 'cvLoadImage' : cannot convert parameter 1 from 'System::String ^' to 'const char *' Please help me. 回答1: It's like this: How to convert from System::String* to Char* in Visual C++ System::String ^ str = "Hello world\n"; //method 1 pin_ptr<const wchar_t> str1 = PtrToStringChars(str); wprintf(str1); //method 2

MVC3 WebImage helper: resize is converting transparent background to black

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create a thumbnail using MVC3's WebImage helper. The original image is a .png with a transparent background. When I try and resize it with the following: var image = blob.DownloadByteArray(); new WebImage(image) .Resize(50, 50) .Write(); The resulting thumbnail replaces the original transparent background with a black background. 回答1: This above answer is great but i did some fine-tuning and implemented the "keep ratio" of the image so that we don't end up with stretched images. using System; using System.Collections.Generic;

Convert a String to int in Rust?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Note: this question contains deprecated pre-1.0 code! The answer is correct, though. To convert a str to an int in Rust, I can do this: let my_int = from_str:: (my_str); The only way I know how to convert a String to an int is to get a slice of it and then use from_str on it like so: let my_int = from_str:: (my_string.as_slice()); Is there a way to directly convert a String to an int ? 回答1: You can directly convert to an int using the str::parse:: () method . let my_string = "27".to_string(); // `parse()` works with `&str` and `String`! let

Convert float array image to a format usable for opencv

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i wonder if there is a easy way to convert my float array image to iplimage, which can be handled by opencv. Of course i could create an empty iplimage with the same size and just copy ever pixel from my float array image to the emplty iplimage, but is there more elegant solution to this. Maybe a faster less memory consuming method, since the source images are pretty large and the copy process would take a while. Best regards, Zhengtonic 回答1: You can do something like this (assuming 32 bit floats): float* my_float_image_data; CvSize size;

How to convert a string to timestamp with milliseconds in Hive

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a string '20141014123456789' which represents a timestamp with milliseconds that I need to convert to a timestamp in Hive (0.13.0) without losing the milliseconds. I tried this but unix_timestamp returns an integer, so I lose the milliseconds: from_unixtime(unix_timestamp('20141014123456789', 'yyyyMMddHHmmssSSS')) >> 2014-10-14 12:34:56 Casting a string works: cast('2014-10-14 12:34:56.789' as timestamp) >> 2014-10-14 12:34:56.789 but my string isn't in that form. I think I need to reformat my string from '20141014123456789' to '2014