小编com*_*oro的帖子

创建 MySQL 函数需要 SUPER 权限

我有一个简单的 MySQL 函数来比较版本:

CREATE FUNCTION `compareVersions` (
  versionA VARCHAR(50),
  versionB VARCHAR(50)) RETURNS INT DETERMINISTIC NO SQL
BEGIN
  DECLARE a1 INT;
  DECLARE b1 INT;
   DECLARE c1 INT;
    DECLARE d1 INT;
  DECLARE a2 INT;
  DECLARE b2 INT;
   DECLARE c2 INT;
    DECLARE d2 INT;  SET a1 = SUBSTRING_INDEX( `versionA` , '.', 1 );
  SET b1 = SUBSTRING_INDEX(SUBSTRING_INDEX( `versionA` , '.', 2 ),'.',-1);
  SET c1 = SUBSTRING_INDEX(SUBSTRING_INDEX( `versionA` , '.', -2 ),'.',1);
  SET d1 = SUBSTRING_INDEX( `versionA` , '.', -1 );
  SET a2 = …
Run Code Online (Sandbox Code Playgroud)

php mysql phpmyadmin create-function

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

如何在 Flutter 插件中请求权限?

我正在尝试使用一个简单的 Flutter 插件(语音识别包装器),但不知道如何在 Android 23 或更高版本上请求适当的权限。在 Dart 部分我有:

  Future requestPermissions() => 
  _channel.invokeMethod("speech.requestPermissions");
Run Code Online (Sandbox Code Playgroud)

在安卓部分:

  public class SpeechRecognitionPlugin implements MethodCallHandler, RecognitionListener,
    PluginRegistry.RequestPermissionResultListener {
Run Code Online (Sandbox Code Playgroud)

插件注册:

  public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "speech_recognition");
    SpeechRecognitionPlugin speechRecognitionPlugin = new 
    SpeechRecognitionPlugin(registrar.activity(), channel);
    channel.setMethodCallHandler(speechRecognitionPlugin);
    registrar.addRequestPermissionResultListener(speechRecognitionPlugin);
  }
Run Code Online (Sandbox Code Playgroud)

方法调用:

else if (call.method.equals("speech.requestPermissions")) {
        Log.d(LOG_TAG, "speech.requestPermissions");
        if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
                Manifest.permission.RECORD_AUDIO)) {
            Toast.makeText(activity.getApplicationContext(), "This application needs the Record Audio permission for recognition to work", Toast.LENGTH_LONG).show();
        } else {
            Log.d(LOG_TAG, "Requesting permissions");
            ActivityCompat.requestPermissions(activity,
                    new String[]{Manifest.permission.RECORD_AUDIO},
                    1);
        }
        result.success(hasRecordAudioPermission()); …
Run Code Online (Sandbox Code Playgroud)

permissions android flutter

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

具有通用指数的OpenGL ES GLSL Mandelbrot

我已经成功地在GLSL(OpenGL ES)上实现了几个分形,但我似乎无处可去Mandelbrot集的变化,其中指数是任意正数.

我在复杂的极坐标中进行取幂,但算法在某处是错误的,因为指数= 2比经典的Mandelbrot集出现的其他东西.

目前的代码如下:

precision mediump float;

uniform sampler2D palette;
uniform float centerX;
uniform float centerY;
uniform float scale;
uniform float iterations;
uniform vec2 resolution;
uniform float exponent;
#define maxiter 65535

vec2 cplx_polar(vec2 z) {
    return vec2(length(z), atan(z.y,z.x));
}

vec2 cplx_polar_add(vec2 z1, vec2 z2) {
    //https://math.stackexchange.com/a/1365938
    return vec2(sqrt(z1.x*z1.x + z2.x*z2.x + 2.*z1.x*z2.x*cos(z2.y-z1.y)),
    z1.y+atan(z2.x*sin(z2.y-z1.y),(z1.x+z2.x*cos(z2.y-z1.y))));
}

vec2 exponentiate(vec2 z) {
    return pow(z.x, exponent)* vec2(cos(z.y), sin(z.y));
}

void main() {
    vec2 center = vec2(centerX, centerY);
    vec2 coord = vec2(gl_FragCoord.x, gl_FragCoord.y) / resolution; …
Run Code Online (Sandbox Code Playgroud)

fractals glsles

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

Ant move将新行放在属性的末尾

我在Eclipse中有一个Ant任务来从文件中获取版本:

<loadfile property="version" srcfile="version.txt">
  <filterchain>
    <linecontainsregexp>
      <regexp pattern="^#define version .(\d{1,10})\.(\d{1,10})\.(\d{1,10})\.(\d{1,10})."/>
    </linecontainsregexp>
    <replaceregex 
         pattern="^#define version .(\d{1,10})\.(\d{1,10})\.(\d{1,10})\.(\d{1,10})..*$" 
         replace="\1.\2.\3.\4" />
  </filterchain>
</loadfile>  
<echo message="Version ${version}"/>    
Run Code Online (Sandbox Code Playgroud)

版本显示没有换行符.在代码中我想使用移动任务的属性:

<move file="${dir}\file.exe"
      tofile="${outputdir}\output-${version}-xxx.exe" 
      overwrite="true" 
      force="true" />
Run Code Online (Sandbox Code Playgroud)

但它失败了

BUILD FAILED build.xml:26: Failed to copy path\file.exe to path\output_directory\output-1.0.0.0
-xxx.exe due to output-1.0.0.0
-xxx.exe (Název souboru ?i adresá?e nebo jmenovka svazku je nesprávná)
Run Code Online (Sandbox Code Playgroud)

(最后一行表示文件名无效,显然它在中间包含换行符).

我哪里错了?这是房产本身吗?甚至添加线

<replaceregex pattern="&#10;" replace="" flags="s"/>    
Run Code Online (Sandbox Code Playgroud)

或其他尝试从属性中删除换行没有改变任何东西.

eclipse ant

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