小编Top*_*ter的帖子

Android:意图:传递位图而不压缩

我正在开发安卓系统。我需要保存位图而不丢失质量。

我尝试过使用compress()位图方法,将质量设置为 100。这对我不起作用,位图损失了太多质量。我已经用 JPEG 和 PNG 格式进行了测试。

我已经测试过将位图复制到 a ByteBuffer,然后提取byte[]并使用FileOutputStream. 在这种情况下,我无法显示使用这种方式保存的图像,我只能看到一个空白页面。

我的问题是,有什么方法可以在不压缩的情况下将位图保存在SD卡中吗?

编辑:这是我的代码的一部分

public class MainActivity extends ActionBarActivity {

    [...]

    @Override
    protected void onActivityResult(int reqCode, int resCode, Intent handler){
        super.onActivityResult(reqCode, resCode, handler);
        if(reqCode == CAPTURE_IDENTIFIER && resCode == Activity.RESULT_OK){
// THis is that I have tested.
//          Object o = handler.getData();
//          Object o2 = handler.getExtras().getParcelable("data");
//          Object o3 = handler.getExtras().get("data");
//          Object o4 = handler.getParcelableExtra("data");
//          
            prepareCapture();
            startActivityForResult(cameraHandler, CAPTURE_IDENTIFIER);
        }
    }



    private …
Run Code Online (Sandbox Code Playgroud)

java android bitmap

5
推荐指数
1
解决办法
6144
查看次数

VS 2015 C头错误C2039:'int_least8_t':不是''全局命名空间''的成员

当我尝试在 Windows 10 中编译 DOSBox SVN Daum 时,我遇到了 VS2015 中显然新出现的与标头相关的问题。示例:

Severity    Code    Description Project File    Line    Suppression State
Error (active)      the global scope has no "int_least8_t"  dosbox  c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint  23  
Error   C2039   'int_least8_t': is not a member of '`global namespace'' dosbox  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint  23  
Run Code Online (Sandbox Code Playgroud)

我的搜索告诉我,此类问题已经发生在周围的项目中,但我无法解决它。

特别是,我阅读了VisualStudio 2015 RC Issue with Includeshttps://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/,然后更改了 AppData\Local 的内容\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props 到:

<?xml version="1.0" encoding="utf-8"?> 
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets">
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup>
    <IncludePath>D:\dev\include;$(UniversalCRT_IncludePath);$(IncludePath)</IncludePath> …
Run Code Online (Sandbox Code Playgroud)

c include dosbox cstdint visual-studio-2015

5
推荐指数
1
解决办法
2176
查看次数

Laravel:默认现有数据库的字符集和排序规则?

在 Laravel 中,每次运行网站时,

“设置名称'utf8'整理'utf8_unicode_ci'”

正在执行。

我怎样才能避免这种情况?而不是在代码中这样做。我们已经在数据库本身中进行了配置。如何删除数据库配置中的字符集和排序规则?

> config/database.php
> 
> 'database' => [
>     'driver'    => 'mysql',
>     'host'      => env('DB_HOST', 'localhost'),
>     'port'      => env('DB_PORT'),
>     'database'  => env('DATABASE'),
>     'username'  => env('DB_USERNAME', 'forge'),
>     'password'  => env('DB_PASSWORD', ''),
>     'charset'   => 'utf8', // Need to remove or make ''
>     'collation' => 'utf8_unicode_ci', // Need to remove or make ''
>     'prefix'    => env('DB_PREFIX', ''),
>     'strict'    => false, ],
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5

5
推荐指数
1
解决办法
3万
查看次数

react-native捆绑程序可以检测未使用的文件吗?

考虑一个场景,在这种情况下,我们react-native使用release模式构建应用程序,同时具有如下代码:

let img;
if ( __DEV__ ) {
  img = require('./debug-image.png');
} else {
  img = require('./real-image.png');
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,都将debug-image.pngreal-image.png获得捆绑到APK(即使debug-image.png是从未使用过其他任何地方),还是所述捆绑检测该debug-image.png文件没有使用(不包括成捆)?

preprocessor assets bundler babeljs react-native

5
推荐指数
1
解决办法
240
查看次数

React PropTypes - 只允许对象值之一?

考虑有一个键和值映射对象,如下所示:

export const PlaceholderVisibility = {
  Always: undefined,
  Never: null,
  OnFocus: true,
  OnBlur: false
}
Run Code Online (Sandbox Code Playgroud)

您将如何使用PropTypes仅允许现有对象中指定的值?

这是我尝试过的:

import PropTypes from 'prop-types';
export const myTypes = {
  // ...
  visibility: PropTypes.oneOf(PlaceholderVisibility)
}
Run Code Online (Sandbox Code Playgroud)

但我目前正在使用,PropTypes.bool因为这似乎适用于这种情况,但是当例如其中一个值是字符串类型时,这仍然不起作用。

javascript reactjs react-proptypes

5
推荐指数
1
解决办法
3488
查看次数

升级 Angular - 两个或多个项目正在使用相同的根警告

对于Angular 8到9的更新,我是按照官方文档进行升级的。

这建议首先更新到最新版本的 Angular 8,例如:

ng update @angular/core@8 @angular/cli@8

但是,我收到三个警告(全部相同):

npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.16.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN ngx-multi-window@0.3.2 requires a peer of @angular/common@^6.0.0-rc.0 || ^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-multi-window@0.3.2 requires …
Run Code Online (Sandbox Code Playgroud)

angular-upgrade angular angular8 angular9

5
推荐指数
1
解决办法
9382
查看次数

共享苹果付费开发者帐户的选项?

问题:

\n
    \n
  • 这里正确的程序是什么?
  • \n
  • 开发者和帐户持有者都需要付费 Apple 开发者帐户吗?\n
    \n

    (正如在下面的上下文中所说,我的客户已经有一个,我还需要一个付费帐户吗?)

    \n
    \n
  • \n
  • 如果我的客户没有企业帐户,我将如何部署该应用程序?
  • \n
\n

语境:

\n
    \n
  • 我正在尝试使用 Expo 构建我的第一个 iOS 应用程序。
  • \n
  • 我尝试跑步expo build:ios并得到了You have no team associated with your Apple account, cannot proceed.
  • \n
  • 我有一个未付费的 Apple ID
  • \n
  • 我的客户创建了一个“个人”类型的付费开发者帐户。
  • \n
  • 他将我添加到他的团队中,并授予我“管理员”角色。
  • \n
  • 允许我访问证书的复选框呈灰色。显然(根据Stack Overflow)因为他的帐户类型为“个人”
  • \n
  • 我知道我是团队的一员,因为我可以登录 App Store Connect 并管理客户帐户中的所有内容(证书除外)。
  • \n
\n

世博输出:

\n
reto@Retos-Mac-mini test1 % expo build:ios\n\xe2\x9c\x94 Choose the build type you would like: \xe2\x80\xba archive\n\nChecking if there …
Run Code Online (Sandbox Code Playgroud)

ios react-native apple-developer expo app-store-connect

5
推荐指数
2
解决办法
2392
查看次数

修复 phpstan(或 larastan)的 Laravel 范围警告?

使用 phpstan/larastan 分析代码时如何处理 Laravel 中的范围?

我收到此错误:

Call to an undefined method Illuminate\Database\Eloquent\Builder::active().
Run Code Online (Sandbox Code Playgroud)

我需要以某种方式输入提示吗?

我试图避免@phpstan-ignore-next-line

值得一提的是,仅当我在作用域内使用作用域时才会出现上述错误。在其他情况下,成功LaraStan阻止PhpStan警告。

laravel phpstan

5
推荐指数
1
解决办法
1951
查看次数

"__cplusplus"宏扩展到什么?

  • C++宏__cplusplus包含和扩展到什么?
  • __cplusplus即使在最旧的C++实现中,宏总是包含并扩展为数值吗?
  • 使用安全#if __cplusplus 还是我们应该使用而不是那样#ifdef __cplusplus

c++ macros c++11

4
推荐指数
1
解决办法
386
查看次数

开玩笑在导入语句上失败,并显示“意外令牌*”

为什么Jest在简单的导入语句中显示“意外令牌*”失败...

错误日志:

Admin@Admin-PC MINGW32 /d/project (master)
$ npm run test

> MyApp@0.0.1 test D:\project
> jest

FAIL __tests__/App-test.tsx
  ? Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • To have some of your …
Run Code Online (Sandbox Code Playgroud)

javascript typescript jestjs

4
推荐指数
3
解决办法
2713
查看次数