deprecation-warning

How to suppress specific Lint warning for deprecated Android function?

最后都变了- 提交于 2019-12-20 17:47:08
问题 I use a version switch to support older Android versions. int sdk = Build.VERSION.SDK_INT; if (sdk < Build.VERSION_CODES.HONEYCOMB) { ColorDrawable colorDrawable = new ColorDrawable(shapeColor); //noinspection deprecation viewHolder.shape.setBackgroundDrawable(colorDrawable); } else { viewHolder.shape.setColor(shapeColor); } When build the project with Gradle from the command line the following warning is output by Lint: app/src/main/java/com/example/MyApp/CustomListAdapter.java:92: warning:

Java Deprecated APIs and SuppressWarnings “deprecation” - practical approach

℡╲_俬逩灬. 提交于 2019-12-18 16:52:21
问题 I have seen many examples of using the Deprecated annotation on APIs in order to mark them as 'need to be replaced soon'. However, in almost all of these cases the code developers not only kept using the deprecated APIs, but also suppressed the deprecation warning. It seems like the best intentions of the API developers end up creating more code which is irrelevant to the implemented business logic - if an API is deprecated but is continually used with the associated warnings being suppressed

React 16.7 - React.SFC is now deprecated

南笙酒味 提交于 2019-12-18 13:52:42
问题 I use to declare stateless components like this: const example: React.SFC<IExample> = ({propsType}) => (); However the SFC is now deprecated, maybe this twitter post from Dan Abramov explains why. What should we use now that SFC is deprecated? 回答1: You should use React.FunctionComponent : Rename React's SFC to 'FunctionalComponent This PR renames React.SFC and React.StatelessComponent to React.FunctionComponent , while introducing deprecated aliases for the old names. So your example would

Gradle warning: variant.getOutputFile() and variant.setOutputFile() are deprecated

狂风中的少年 提交于 2019-12-17 09:19:30
问题 I am using the following simplified configuration in an Android application project. android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { minSdkVersion 8 targetSdkVersion 20 versionCode 1 versionName "1.0.0" applicationVariants.all { variant -> def file = variant.outputFile def fileName = file.name.replace(".apk", "-" + versionName + ".apk") variant.outputFile = new File(file.parent, fileName) } } } Now that I updated the Gradle plug-in to v.0.13.0 and Gradle to v.2.1.

Preprocessing in scikit learn - single sample - Depreciation warning

为君一笑 提交于 2019-12-17 06:07:29
问题 On a fresh installation of Anaconda under Ubuntu... I am preprocessing my data in various ways prior to a classification task using Scikit-Learn. from sklearn import preprocessing scaler = preprocessing.MinMaxScaler().fit(train) train = scaler.transform(train) test = scaler.transform(test) This all works fine but if I have a new sample (temp below) that I want to classify (and thus I want to preprocess in the same way then I get temp = [1,2,3,4,5,5,6,....................,7] temp = scaler

signin for server-side apps and plus deprecation

天涯浪子 提交于 2019-12-11 10:26:01
问题 I have a server side application that requires that a user sign in using his browser and then the server continues to use that token to do stuff on its own. I'm using the flow described here, pretty much verbatim, but with a few additional scopes: https://developers.google.com/identity/sign-in/web/server-side-flow. In this flow, Google takes over through the login process. I create an auth2 object with gapi.auth2.init(), then I call .grantOfflineAccess() on that object, and later I get a

Rails 5 deprecation warning for tests

橙三吉。 提交于 2019-12-11 06:36:23
问题 I'm trying to update from rails 4.2.6 to rails 5.0.0.1 but get the following warning when running my tests: DEPRECATION WARNING: ActionController::TestCase HTTP request methods will accept only keyword arguments in future Rails versions. Examples: get :show, params: { id: 1 }, session: { user_id: 1 } process :update, method: :post, params: { id: 1 } (called from block in at /home/ubuntu/workspace/my_app/test/controllers/tractions_controller_test.rb:25) I've been making the appropriate changes

C++: Deprecation warning when overriding a deprecated virtual method

☆樱花仙子☆ 提交于 2019-12-10 17:08:01
问题 I have an pure virtual class that has a pure virtual method that should be const , but unfortunately is not. This interface is in a library, and the class is inherited by several other classes, in separate projects. I'm trying to make this method const without breaking compatibility (at least for some time), but I cannot find a way to produce a warning when the non-const method is overloaded. The following is an example of what I was able to produce so far: Stage 0 : Before the change. Only

Resize PyTorch Tensor

天大地大妈咪最大 提交于 2019-12-10 14:27:06
问题 I am currently using the tensor.resize() function to resize a tensor to a new shape t = t.resize(1, 2, 3) . This gives me a deprecation warning: non-inplace resize is deprecated Hence, I wanted to switch over to the tensor.resize_() function, which seems to be the appropriate in-place replacement. However, this leaves me with an cannot resize variables that require grad error. I can fall back to from torch.autograd._functions import Resize Resize.apply(t, (1, 2, 3)) which is what tensor

Numpy DeprecationWarning on boolean indexing

十年热恋 提交于 2019-12-10 14:18:29
问题 This code import numpy as np def some_method(y, threshold): print type(y), y.shape, y.dtype c = np.zeros(y.shape) c[y > threshold] = 1 Results in <type 'numpy.ndarray'> (484L,) [('target', '<f8')] DeprecationWarning: using a boolean instead of an integer will result in an error in the future c[y > threshold] = 1 I can't find anything on this in Google nor in the numpy release notes. I'm assuming this is about indexing by booleans? I don't understand how this could possibly result in an error