convert

How to convert a unicode string to its unicode escapes?

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: here )? 回答1: Note this loops over UTF-16 code units, not actual code points. 回答2: I assume you're doing code-generation (of JavaScript, maybe?) QString is like a collection of QChar . Loop through the contents, and on each QChar call the unicode method to get the ushort (16-bit integer) value. Then format each character like "\\u%04X" , i.e. \u followed by the 4-digit hex value. NB. You may need to swap the two bytes (the two hex characters) to get the right result depending on the platform you're running on. 回答3: wchar_t *input; wstring

convert unix timestamp php

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a database that stores the time for me. I insert it from PHP using date ( 'Y-m-d H:i:s' ); I then use this function to convert it to a unix timestamp in PHP function convert_datetime ( $str ) { list ( $date , $time ) = explode ( ' ' , $str ); list ( $year , $month , $day ) = explode ( '-' , $date ); list ( $hour , $minute , $second ) = explode ( ':' , $time ); $timestamp = mktime ( $hour , $minute , $second , $month , $day , $year ); return $timestamp ; } What I now need to do is convert this timestamp to the date and time

How can I convert an RGB image into grayscale in Python?

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to use matplotlib to read in an RGB image and convert it to grayscale. In matlab I use this: img = rgb2gray ( imread ( 'image.png' )); In the matplotlib tutorial they don't cover it. They just read in the image import matplotlib . image as mpimg img = mpimg . imread ( 'image.png' ) and then they slice the array, but that's not the same thing as converting RGB to grayscale from what I understand. lum_img = img [:,:, 0 ] I find it hard to believe that numpy or matplotlib doesn't have a built-in function to convert from rgb

MySQL convert YEARWEEK to date

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've a YEARWEEK() converted value from MySQL 201439 I want to convert it back to the starting date of that week number, using MySQL, possible? e.g. SELECT xxx('201439'); and return '2014-09-16' 回答1: You can use STR_TO_DATE function with format you need http://sqlfiddle.com/#!9/9eecb7d/2017 SELECT STR_TO_DATE(CONCAT(YEARWEEK(NOW()),' Monday'), '%X%V %W'); SELECT STR_TO_DATE(CONCAT('201439',' Monday'), '%X%V %W'); 回答2: You need to be careful that the yearweek is in the expected "mode". (See https://dev.mysql.com/doc/refman/5.7/en/date-and-time

convert selected datetime to date in sqlalchemy

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a database of test records with one column 'test_time' defined as datetime. I want to query how many distinct dates there are as I want to dump test results to csv according to dates. I now have the following: distinct_dates = list(session.query(Test_Table.test_time).distinct()) But this gives me a list of datetime not date. Certainly I can convert it in Python but when I am using sqlite. I did this SELECT DISTINCT DATE(test_time) FROM Test_Table . I cannot come up with the equivalent in sqlalchemy. 回答1: That would be by using the

Convert to ARC - LLVM compiler 3.0 Error

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I opened up an older project of mine and chose Convert to Objective-C ARC from the Edit/Refactor menu. I am getting the following error: Apple LLVM compiler 3.0 Error Error in format of file: /Users/myUserName/Library/Developer/Xcode/DerivedData/ProjectName-fkjvtdsoypoyrdcedtarbtypupor/Build/Intermediates/ProjectName.build/Debug-iphoneos/ProjectName.build/ProjectName-arc.migrate/remap Is this one of those situations where I need to manually delete some files/folders in Finder and then try it again? I just deleted everything in the "Build"

convert exponential to decimal in python

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an array in python that contains a set of values, some of them are 2.32313e+07 2.1155e+07 1.923e+07 11856 112.32 How do I convert the exponential formats to the decimal format Additional: Is there a way I can convert the exponent directly to decimal when printing out in UNIX with awk? 回答1: I imagine you have a list rather than an array, but here it doesn't make much of a difference; in 2.6 and earlier versions of Python, something like: >>> L = [2.32313e+07, 2.1155e+07, 1.923e+07, 11856, 112.32] >>> for x in L: print '%f' % x ...

convert QVideoFrame to QImage

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to get every frames from a QMediaPlayer and convert it to QImage (or cv::Mat ) so I used videoFrameProbed signal from QVideoProbe : connect(&video_probe_, &QVideoProbe::videoFrameProbed, [this](const QVideoFrame& currentFrame){ //QImage img = ?? } But I didn't find any way for getting QImage from QVideoFrame ! How can I convert QVideoFrame to QImage ?! 回答1: You can use QImage's constructor: QImage img( currentFrame.bits(), currentFrame.width(), currentFrame.height(), currentFrame.bytesPerLine(), imageFormat); Where you can get

Convert latitude and longitude into esri arcGIS MapPoint

匿名 (未验证) 提交于 2019-12-03 02:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am having trouble in converting the latitude and longitude values into android esri arcGIS map Point. Here's my code to get latitude and longitude values from GPS coordinates: LocationManager lm ; String towers ; double lat ; double longi ; TextView txt ; lm = ( LocationManager ) getSystemService ( Context . LOCATION_SERVICE ); Criteria crit = new Criteria (); towers = lm . getBestProvider ( crit , false ); Location location = lm . getLastKnownLocation ( towers ); if ( location != null ) { lat = location . getLatitude (); longi =

Convert images to webP using Pillow

匿名 (未验证) 提交于 2019-12-03 02:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to convert .jpg images to webp format using PIL . I'm using the this code: from PIL import Image import glob, os for infile in glob.glob("*.jpg"): file, ext = os.path.splitext(infile) im = Image.open(infile).convert("RGB") im.save(file + ".webp", "WEBP") But I get the following error on running it: Traceback (most recent call last): File "webp.py", line 7, in <module> im.save(file + ".webp", "WEBP") File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1444, in save save_handler = SAVE[format.upper()] # unknown format