convert

Convert Java Map to Scala Map

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a java map: java.util.Map > and I would like to convert it to the scala map: Map[SomeObject, Set[OtherObject]] I have used mapAsScalaMap but the result is not quite what I want, the result is: Map[SomeObject, java.util.Collection[OtherObject]] . How can I fix it to also convert the collection to a set? NOTE: actually my original problem was to convert google's ArrayListMultimap to a MultiMap[SomeObject, OtherObject] but since this was not possible I've split the problem. If you have a solution for the original problem, I'll also

How to convert a regular win32 (VC++ vcproj) project to a Qt project?

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I convert existing vcproj files to project files that the QT add-in to Visual Studio recognizes and treats as valid Qt projects? Should I just bite the bullet and create new projects to replace the old ones, and then add existing code? I am using QT 4.6 and VS 2008 with Qt Add-in 1.1.2. Original vcproj files have NOT been generated with QMake. 回答1: Using Visual Studio 2010+ it is now possible to convert a project to a Qt Addin project, using the "Convert project to Qt Add-in project" feature of the Qt Addin. The following steps are

Android: Convert xml using xslt

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to transform some xml using an xsl-file and output the result somehow (I'm using Android Api Level 8). My current activity looks like this, but the transformer stays null. LogCat throws an System.err with org.apache.harmony.xml.ExpatParser$ParseException , saying the xml is not well-formed, but I made sure it is. I found a hint in LogCat that says SystemId Unknown just before the above error message. What am I doing wrong? import java.io.OutputStream; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import

Convert UTC date time to local date time

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: From the server I get a datetime variable in this format: 6/29/2011 4:52:48 PM and it is in UTC time. I want to convert it to the current user’s browser time using JavaScript. How this can be done using JavaScript or jQuery? 回答1: Append 'UTC' to the string before converting it to a date in javascript: var date = new Date('6/29/2011 4:52:48 PM UTC'); date.toString() // "Wed Jun 29 2011 09:52:48 GMT-0700 (PDT)" 回答2: This is an universal solution: function convertUTCDateToLocalDate(date) { var newDate = new Date(date.getTime()+date

Convert SVN Subdirectory to Git

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to ditch SVN for Git. My current SVN repository setup has projects under trunk ( /trunk/projecta , /trunk/projectb , etc. with tags and branches at /tags/projecta-1.0 , etc.). I would like to create distinct Git repos for each of these projects by pulling them out of SVN using git-svn. I've successfully pulled the entire SVN repo down to a local Git repo but all of the projects exist in the same Git repo now. Is it possible to pull them apart at this point? 回答1: This is tricky. To get, e.g., the tags for a project, all its tags

How do I convert an HttpRequestBase into an HttpRequest object?

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: inside my ASP.NET MVC controller, I've got a method that requires an HttpRequest object. All I have access to is an HttpRequestBase object. Is there anyway I can somehow convert this? What can/should I do?? 回答1: Is it your method, so you can re-write it to take HttpRequestBase ? If not, you can always get the current HttpRequest from HttpContext.Current.HttpRequest to pass on. However, I often wrap access to the HttpContext inside a class like mentioned in ASP.NET: Removing System.Web Dependencies for better unit testing support. 回答2: You

Can we convert a byte array into an InputStream in Java?

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn't find it. I have a method that has an InputStream as argument. The InputStream cph I have is base64 encoded so I had to decode it using BASE64Decoder decoder = new BASE64Decoder(); byte[] decodedBytes = decoder.decodeBuffer(cph); Now how do I convert decodedBytes again to InputStream ? 回答1: Use ByteArrayInputStream : InputStream is = new ByteArrayInputStream(decodedBytes); 回答2: If you use Robert Harder's Base64 utility , then you can do:

How to convert Php source code to Asp.net code

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am developing an application on mybloglog. I got the source code in php.I dont have any idea about php. Thats why I want to convert Php source code to Asp.net code. Any Help Please 回答1: Hope this helps PHP to ASP.NET 1.x Migration Assistant The PHP to ASP.NET Migration Assistant is designed to help you convert PHP pages and applications to ASP.NET. It does not make the conversion process completely automatic, but it will speed up your project by automating some of the steps required for migration. 回答2: Sorry but you'll have to rewrite this

How to convert an entire MySQL database characterset and collation to UTF-8?

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I convert entire MySQL database character-set to UTF-8 and collation to UTF-8? 回答1: Use the ALTER DATABASE and ALTER TABLE commands. ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; Or if you're still on MySQL 5.5.2 or older which didn't support 4-byte UTF-8, use utf8 instead of utf8mb4 : ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci; ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8

Convert bitmap array to YUV (YCbCr NV21)

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to convert Bitmap returned by BitmapFactory.decodeFile() to YUV format (simillar to what camera's onPreviewFrame() returns in byte array)? 回答1: Here is some code that actually works: // untested function byte [] getNV21(int inputWidth, int inputHeight, Bitmap scaled) { int [] argb = new int[inputWidth * inputHeight]; scaled.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight); byte [] yuv = new byte[inputWidth*inputHeight*3/2]; encodeYUV420SP(yuv, argb, inputWidth, inputHeight); scaled.recycle(); return yuv; } void