首页 文章 精选 留言 我的

精选列表

搜索[飞行模拟],共10000篇文章
优秀的个人博客,低调大师

供应链需求预测系统 | 促销模拟器:调整营销参数预测销量波动

预测本身只是手段,而非目的。供应链管理的终极目标,是支持业务决策,尤其是那些充满不确定性的决策——比如促销。每年618、双11、年货节,动辄数百万的促销预算投下去,到底能带来多少销量增长?会不会因为预测失误导致库存积压或缺货?这些问题如果仅凭经验拍脑袋,往往会付出惨痛代价。

优秀的个人博客,低调大师

03.Eclipse下Ndk开发(以文件加密为例模拟一下开发过程)

(创建于2017/12/2) 1.编写native方法 package com.example.ndk_file_encrpty; public class Cryptor { static{ System.loadLibrary("ndk_file_encrpty"); } public native static void encrypt(String normal_path,String crypt_path); public native static void decrypt(String crypt_path,String decrypt_path); } 2.进入eclipse项目src目录下(cd 进入到src目录下,使用命令生成头文件 javah 包名+类型(如 com.renzhenming.utils.JniUtils)),如果是进入的bin目录下使用此命令行的话,得到的头文件只有一些声明,没有生成相应的jni方法 bin目录下生成的是这样的 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class com_example_ndk_file_encrpty_Cryptor */ #ifndef _Included_com_example_ndk_file_encrpty_Cryptor #define _Included_com_example_ndk_file_encrpty_Cryptor #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif src目录下生成的才是我们需要的 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class com_example_ndk_file_encrpty_Cryptor */ #ifndef _Included_com_example_ndk_file_encrpty_Cryptor #define _Included_com_example_ndk_file_encrpty_Cryptor #ifdef __cplusplus extern "C" { #endif /* * Class: com_example_ndk_file_encrpty_Cryptor * Method: encrypt * Signature: (Ljava/lang/String;Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_com_example_ndk_1file_1encrpty_Cryptor_encrypt (JNIEnv *, jclass, jstring, jstring); /* * Class: com_example_ndk_file_encrpty_Cryptor * Method: decrypt * Signature: (Ljava/lang/String;Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_com_example_ndk_1file_1encrpty_Cryptor_decrypt (JNIEnv *, jclass, jstring, jstring); #ifdef __cplusplus } #endif #endif 有一点需要注意的是:对于像这样包名这样命名的情况 8392687.png 因为存在下划线,所以如果你直接按照平常的那种写法去手写,比如写成这样 JNIEXPORT void JNICALL Java_com_example_ndk_file_encrpty_Cryptor_encrypt 是错误的,正确的写法是如上边生成的 JNIEXPORT void JNICALL Java_com_example_ndk_1file_1encrpty_Cryptor_encrypt 在个别下划线的前边加了数字1,目前我也不知道为何,所以遇到这种包名,建议使用命令行生成 3.创建jni目录(eclipse工程是直接在项目根目录创建,将头文件复制进去,然后编写c文件,将对应的方法名复制进去,引入需要的 头文件) 4.添加native支持(右键工程如图,点击add native support后弹出对话框(创建出头文件之后),设置c文件名称,确定即可,然后会自动给你生成Android.mk文件,c文件,然后创建Application.mk文件) 9041421.png 9129687.png 5.确认你的eclipse已经配置了ndk,注意,ndk的版本会有可能发生问题,这样看你的eclipse最多能支持多大版本的ndk了 如果ndk版本过高,会导致你配置目录之后仍然提示你有问题,如图not a valid NDK directory,所以需要降低版本,我设置了r10之后可以了 9272984.png 6.添加ndk相关头文件的支持(右键项目打开properties,发现里边由C/C++General选项,这两个选项是你添加了native surpport之后才有的) 9398312.png 在右边的add选项,添加这三个目录进去(一定要是你ndk中存在的目录,不同版本有不同) D:\application\java\android-ndk-r10e\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.8\include D:\application\java\android-ndk-r10e\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.8\include-fixed D:\application\java\android-ndk-r10e\platforms\android-18\arch-arm\usr\include 7,补充c文件的方法实现 #include <jni.h> #include <com_example_ndk_file_encrpty_Cryptor.h> #include <string.h> #include <stdlib.h> #include <stdio.h> char password[] = "renzhenming"; //加密 JNIEXPORT void JNICALL Java_com_example_ndk_1file_1encrpty_Cryptor_encrypt( JNIEnv *env, jclass jcls, jstring normal_path_jstr,jstring crypt_path_jstr) { //jstring -> char* const char* normal_path = (*env)->GetStringUTFChars(env,normal_path_jstr,JNI_FALSE); const char* crypt_path = (*env)->GetStringUTFChars(env,crypt_path_jstr,JNI_FALSE); //打开文件 FILE *normal_fp = fopen(normal_path, "rb"); FILE *crypt_fp = fopen(crypt_path, "wb"); //一次读取一个字符 int ch; int i = 0; //循环使用密码中的字母进行异或运算 int pwd_len = strlen(password); //密码的长度 while ((ch = fgetc(normal_fp)) != EOF) { //End of File //写入(异或运算) fputc(ch ^ password[i % pwd_len], crypt_fp); i++; } //关闭 fclose(crypt_fp); fclose(normal_fp); } //解密 JNIEXPORT void JNICALL Java_com_example_ndk_1file_1encrpty_Cryptor_decrypt( JNIEnv * env, jclass jcls, jstring crypt_path_jstr, jstring decrypt_path_jstr) { const char* crypt_path = (*env)->GetStringUTFChars(env,crypt_path_jstr,JNI_FALSE); const char* decrypt_path = (*env)->GetStringUTFChars(env,decrypt_path_jstr,JNI_FALSE); //打开文件 FILE *normal_fp = fopen(crypt_path, "rb"); FILE *crypt_fp = fopen(decrypt_path, "wb"); //一次读取一个字符 int ch; int i = 0; //循环使用密码中的字母进行异或运算 int pwd_len = strlen(password); //密码的长度 while ((ch = fgetc(normal_fp)) != EOF) { //End of File //写入(异或运算) fputc(ch ^ password[i % pwd_len], crypt_fp); i++; } //关闭 fclose(crypt_fp); fclose(normal_fp); } 8.在需要的地方调用 package com.example.ndk_file_encrpty; import java.io.File; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void encrypt(View view){ String path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"man.jpg"; String new_path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"man_encrypt.jpg"; Cryptor.encrypt(path, new_path); } public void decrypt(View view){ String path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"man_encrypt.jpg"; String new_path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"man_decrypt.jpg"; Cryptor.decrypt(path, new_path); } } 成功!

优秀的个人博客,低调大师

汽车开卷落料产线仿真模拟数字孪生管理平台量化指标与误差控制规范

本指标适用于汽车开卷落料产线全域静态场景渲染、卷材输送动态仿真、钣金裁切工艺推演、产线多设备协同联动、生产态势可视化、产线全域-工艺模组-精密机构多级尺度漫游、多路产线工控工艺数据实时联动全流程性能校验,所有参数基于标准汽车钣金开卷落料生产线、全工艺设备满载连续运行、全点位传感与视觉设备在线接入、1080P分辨率测试环境,为系统最优工程运行参数。

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册