convert

How to convert a file:// uri into content:// uri?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have found that on my device, the default media display tool is not showing me the same if Ihave a uri that is: file : //mnt/sdcard/DCIM/Image.jpg When I go through picking the image with the built in intent I get this: content : //media/external/images/media/247 These both display the same file, but I don't have any sharing options when I use the first one. My question is, how can I find the content Uri given the file Uri? 回答1: I was making the file, so I had a File object file . So I do this now to get Uri for the file as a

convert BSTR to const char* [duplicate]

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Possible Duplicates: Which is better code for converting BSTR parameters to ANSI in C/C++? How to convert char * to BSTR? Hi guys, I am very new to C++, any one have any idea how i can convert BSTR to const char*? 回答1: A BSTR is actually a WCHAR* with a length prefix. The BSTR value points to the beginning of the string, not to the length prefix (which is stored in the bytes just “before” the location pointed to by the BSTR ). In other words, you can treat a BSTR as though it is a const WCHAR* . No conversion necessary. So your question is

Cast/Convert BigInt to Varchar in MySQL

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How might I Cast/Convert BigInt to Varchar in MySQL? 回答1: mysql> select Cast( 12345678901234567890 as char) ; +-------------------------------------+ | Cast( 12345678901234567890 as char) | +-------------------------------------+ | 12345678901234567890 | +-------------------------------------+ 回答2: I think you can't cast to varchar , try char instead. Or are you trying to modify the type of an existing field of a table? Then you have to do for example: ALTER TABLE MODIFY COLUMN mycolumn varchar(50); 文章来源: Cast/Convert BigInt to Varchar in

Convert a number enclosed in parentheses (string) to a negative integer (or float) using Python?

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In Python, what is the simplest way to convert a number enclosed in parentheses (string) to a negative integer (or float)? For example, '(4,301)' to -4301, as commonly encountered in accounting applications. 回答1: The simplest way is: my_str = "(4,301)" num = - int ( my_str . translate ( None , "()," )) 回答2: Since you are reading from a system that put in thousands separators, it's worth mentioning that we are not using them the same way all around the world, which is why you should consider using a locale system. Consider: import

How to convert NSDictionary to custom object

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a json object: @interface Order : NSObject @property (nonatomic, retain) NSString *OrderId; @property (nonatomic, retain) NSString *Title; @property (nonatomic, retain) NSString *Weight; - (NSMutableDictionary *)toNSDictionary; ... - (NSMutableDictionary *)toNSDictionary { NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; [dictionary setValue:self.OrderId forKey:@"OrderId"]; [dictionary setValue:self.Title forKey:@"Title"]; [dictionary setValue:self.Weight forKey:@"Weight"]; return dictionary; } In string this is:

Convert gregorian date to persian(jalali) date in angular 2 and Ionic 2

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm familiar with one package located in npm for converting gregorian date to persian (jalali), but i don't know how should i use it in ionic 2 angular 2 projects. Jalali-date or this package for angular 1: ADM-dateTimePicker is it possible to convert this package to angular 2? any idea? or tutorial are welcome... 回答1: ok, i wrote convertor for this purpose, first add a provider in your project: the next step: import this service in your code: import { PersianCalendarService } from '../../providers/persian-calendar-service/persian

Not able to convert Bitmap to perfect Base64 String in Android?

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on an application in which I need to capture an Image from camera. After capture, I have to convert the Bitmap to Base64 . After converting to Base64, I have to send that String to SERVER. I am using below code for this task: ByteArrayOutputStream baos = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b = baos.toByteArray(); base64Image = Base64.encodeToString(b,Base64.DEFAULT); Problem : When I convert that Base64 to image, I am getting INCOMPLETE IMAGE. The same result is happening

Convert map object to numpy array in python 3

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In Python 2 I could do the following: import numpy as np f = lambda x: x**2 seq = map(f, xrange(5)) seq = np.array(seq) print seq # prints: [ 0 1 4 9 16] In Python 3 it does not work anymore: import numpy as np f = lambda x: x**2 seq = map(f, range(5)) seq = np.array(seq) print(seq) # prints: <map object at 0x10341e310> How do I get the old behaviour (converting the map results to numpy array)? Edit : As @jonrsharpe pointed out in his answer this could be fixed if I converted seq to a list first: seq = np.array(list(seq)) but I would prefer

Cannot convert value of type &#039;Meme!&#039; to expected argument type &#039;@noescape (Meme) throws -&gt; Bool&#039;

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is the code: @IBAction func deleteMeme(sender: UIBarButtonItem) { if let foundIndex = MemeRepository.sharedInstance.memes.indexOf(selectedMeme) { //remove the item at the found index MemeRepository.sharedInstance.memes.removeAtIndex(foundIndex) navigationController?.popViewControllerAnimated(true) The error happens at the .indexOf method at (selectedMeme) . Cannot convert value of type Meme! to expected argument type @noescape (Meme) throws -> Bool Meme! is a struct for my app. How do I work through this? struct Meme { var topText :

C# Convert object to Decimal

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to convert an object with the value 0.39999999999999997 to a decimal variable without losing the precision. object d = 0.39999999999999997; I've tried the following methods. decimal val1 = Convert.ToDecimal(d); // val1 = 0.4 object val2 = Convert.ChangeType(d, Type.GetType("System.Decimal")); // val2 = 0.4 decimal val3 = decimal.Parse(d.ToString()); // val3 = 0.4 decimal val4 = (Decimal) d; // val4 = 0.4 I know the this is not a problem with the decimal data type not being able to store this value as illustrated below. decimal