convert

Type mismatch: cannot convert from void to ArrayList<String>

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Why am I getting this error for this code? I have the correct imports for ArrayList an Collections private ArrayList<String> tips; public TipsTask(ArrayList<String> tips){ this.tips = Collections.shuffle(tips); } 回答1: Collections.shuffle(tips); Collections.shuffle return void, you cannot assign void to a ArrayList . you could do for example: 回答2: The problem is that Collections.shuffle method doesn't return anything. You can try this: private ArrayList<String> tips; public TipsTask(ArrayList<String> tips){ this.tips = new ArrayList<String>

How to convert UTC datetime column to local time in datagridview?

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am doing work on a new logging database that I have decided to use UTC datetime to store all datetime values since our company spans timezones and multiple sources and timezones are logging events. That is working great. However the problem that I cannot get my head around is formatting the datetimes in my datagridview for my user application. Our applications use mostly LINQ to SQL to manipulate our data from generic SQL CRUD calls, so I am hoping I can mask/format the DGV to get the conversion or some LINQ function rather than having to

Convert date from one format to another using SQL*Loader control file

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The data from the infile is in the format MM/DD/YYYY how do I tell the control file to load it into the database as YYYYMM ? 回答1: When you specify the columns in the INFILE declare just identify the format the data is held in. Like this load data infile 'whatever.csv' into table t23 fields terminated by ',' trailing nullcols ( col_1 integer , col_2 char , col_3 date "MM/DD/YYYY" , col_4 date "MM/DD/YYYY" , col_5 char ) Don't worry about the "to" date format. That is only for display purposes. Oracle stores dates in its own internal

How can i implicitly convert my class to another type?

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For example implicitly MyClass myClass = new MyClass(); int i = myClass; 回答1: You need to define this in the MyClass file. public static implicit operator int(MyClass instance) { if (instance == null) { return -1; } return instance._underlyingValue; } 回答2: class MyClass { public static implicit operator int(MyClass myClass) { // code to convert from MyClass to int } } Take a look there : implicit 回答3: This MSDN entry covers what you want exactly, should do the trick. 文章来源: How can i implicitly convert my class to another type?

play streaming in VideoView, convert url to rtsp

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to play youtube video and record video in the same layout. To perform this I search for youtube api and found that android version need to be higher than 2.2, this ok but, i want to use VideoView. I saw some post here about this issue and decide eventually to use this code to watch video in VideoView. videoView = (VideoView) findViewById(R.id.your_video_view); Log.d(TAG,getUrlVideoRTSP(current_url) + " id yotube1 " ); //here type the url... videoView.setVideoURI(Uri.parse(getUrlVideoRTSP(current_url))); videoView.setMediaController

How to convert RGB images to grayscale in matlab without using rgb2gray

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm currently using code: i = imread('/usr/share/icons/matlab.png'); for k=1:1:m for l=1:1:n %a(k,l)=m*n; a(k,l) = (.299*i(k,l,1))+(.587*i(k,l,2))+(.114*i(k,l,3)); end end imshow(a); It shows only a white screen. Also the newly generated dimensions are n x m x 3 whereas it should be only m x n x 1. If I use mat2gray it display the image like this 回答1: Since the image is a PNG, imread() is returning an integer image , with intensity values in the range [0 255] or equivalent, depending on the original bit depth. The conversion formula makes a

How to convert pretrained FC layers to CONV layers in Pytorch

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to convert a pre-trained CNN (like VGG-16) to a fully convolutional network in Pytorch. How can I do so? Any tip would be helpful. 回答1: hopefully it's not too late. I'm not entirely sure which parts you want to retain, but if you want to manipulate a pre-trained model or re-use parts of it, my approach would be the following: Download the pre-trained model, e.g. import torch import torch.nn as nn from torchvision import models model = models.resnet101(pretrained=True) Extract the parts you're interested in and create a new model from

How to convert String to Hex and Hex to String?

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I made simple program for sending and receiving data to serial port in java. I connect serial port device with loop back testing (Rx to Tx). it works fine. but i can't send and recive hex data to serial port and recive serial port. In my device there are FT232BL chip is used.So is there any dll or other library required to send and receive hex data to serial port device. my code is below. enter code here package x.rayimagecapture; import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; import java.awt.event

Convert microsecond timestamp to datetime in Python

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm pulling a cookie expiration date from Google Chrome. From what it looks like, Chrome is storing cookie expirations with a timestamp that uses 1601-01-01 00:00:00 UTC as the epoch. My current implementation is as follows: stamp = int(result[3]) date = datetime.datetime.fromtimestamp(stamp / 10000000.0) print date.year However, this is producing the wrong date (off by about a year). What am I doing wrong here? 回答1: Another option, getting tzinfo from the standard library since Python 3.2 (for older Python versions you can get if from pytz

Convert RGB to RGBA in C

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to copy the contents of a byte array representing an image in RGB byte order into another RGBA(4 bytes per pixel) buffer. The alpha channel will get filled later. What would be the fastest way of achieving this? 回答1: The fastest was would be to use a library that implements the conversion for you rather than writing it yourself. Which platform[s] are you targeting? If you insist on writing it yourself for some reason, write a simple and correct version first. Use that. If the performance is inadequate, then you can think about