目前最新的Nodejs LTS已不再支持Windows7。如需在Windows7上安装Nodejs,需安装12.19.1或之前的版本。
参考链接
- windows安装Node JS及配置,by 兰若惜.
目前最新的Nodejs LTS已不再支持Windows7。如需在Windows7上安装Nodejs,需安装12.19.1或之前的版本。
最近遇到一个奇特的需求,要求构建一个评估系统,分为前后端。它的前端是桌面应用程序,后端也是桌面应用程序。前后端之间的通信是通过前端导出一个数据包文件,然后交给后端导入完成的。由于熟悉Nodejs前后端开发,我选择Electron加Vuejs的解决方案。具体的技术选型如下:
Electron(原名为Atom Shell)是GitHub开发的一个开源框架。它允许使用Node.js(作为后端)和Chromium(作为前端)完成桌面GUI应用程序的开发。Electron现已被多个开源Web应用程序用于前端与后端的开发,著名项目包括GitHub的Atom和微软的Visual Studio Code。
一个基础的Electron包含三个文件:package.json(元数据)、main.js(代码)和index.html(图形用户界面)。框架由Electron可执行文件(Windows中为electron.exe、macOS中为electron.app、Linux中为electron)提供。开发者可以自行添加标志、自定义图标、重命名或编辑Electron可执行文件。
Vue.js是一款流行的JavaScript前端框架,旨在更好地组织与简化Web开发。Vue所关注的核心是MVC模式中的视图层,同时,它也能方便地获取数据更新,并通过组件内部特定的方法实现视图与模型的交互。
Vuejs适合开发单页应用程序。
IndexedDB 是一种底层 API,用于在客户端存储大量的结构化数据(也包括文件/二进制大型对象(blobs))。该 API 使用索引实现对数据的高性能搜索。虽然 Web Storage 在存储较少量的数据很有用,但对于存储更大量的结构化数据来说力不从心。而 IndexedDB 提供了这种场景的解决方案。
IndexedDB 是一个事务型数据库系统,类似于基于 SQL 的 RDBMS。 然而,不像 RDBMS 使用固定列表,IndexedDB 是一个基于 JavaScript 的面向对象数据库。IndexedDB 允许您存储和检索用键索引的对象;可以存储结构化克隆算法支持的任何对象。您只需要指定数据库模式,打开与数据库的连接,然后检索和更新一系列事务。
indexedDB的API不够友好,建议使用localForage,支持类Storage API语法的客户端数据存储polyfill,支持回退到Storage和Web SQL
使用如下命令构建Vuejs项目脚手架:
1 | npm install -g @vue/cli |
在上一节创建Vuejs项目的基础上,使用如下命令为Vuejs项目添加Electron支持,从而生成桌面应用程序:
1 | vue add electron-builder |
使用如下命令为项目添加Sqlite3数据库支持:
1 | npm install sequelize --save --registry https://registry.npm.taobao.org |
使用如下命令构建32位Electron安装程序:
1 | npm run electron:build -- --ia32 |
或者
1 | yarn electron:build --ia32 |
请参考 Electron:运行npm run build构建环境失败解决方案。
当遇到如下错误时, 解决方法很简单,打包项目路径不能包含中文路径。
1 | .electron-builder\Cache\nsis\nsis-3.0.3.2\Bin\makensis.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE |
请参考Blank screen on builds, but works fine on serve。
electron支持macOS、Windows、Linux。在Windows平台,electron仅支持 Windows 7 或更高版本, 旧版操作系统已不再支持(并且无法运行).
看了吴菁老师的几个Simulink教学视频,很不错,记录一下。
Cesium在很早之前就支持GLTF模型动画,例如:
1 | var czml = [ |
这种方法存在一定局限性,只能支持全局动画,不能控制动画的起止。但最近版本中,Cesium进行了一定改进,可以支持在一定程度上控制GLTF动画了。示例代码如下:
1 | var czml = [ |
这段示例代码的原理还有待分析,我将launchvehicle.glb导入blender 2.90中,但并没有看到上述代码中的三段动画。按照链接Model Articulations “Number” variable的说法,这三段动画是通过GLTF扩展实现。
为了使Cesium与整个网页的背景融合,需要去掉Cesium的黑色星空背景,具体方法如下:
1 | viewer.scene.skyBox.destroy(); |
Cesium样条插值主要有三种:Linear、Lagrange、Hermite。理解Cesium样条插值对生成平滑飞行路径十分关键。
在数学的数值分析领域中,内插或称插值(英语:interpolation)是一种通过已知的、离散的数据点,在范围内推求新数据点的过程或方法。求解科学和工程的问题时,通常有许多数据点借由采样、实验等方法获得,这些数据可能代表了有限个数值函数,其中自变量的值。而根据这些数据,我们往往希望得到一个连续的函数(也就是曲线);或者更密集的离散方程与已知数据互相吻合,这个过程叫做拟合。
与插值密切相关的另一个问题是通过简单函数逼近复杂函数。假设给定函数的公式是已知的,但是太复杂以至于不能有效地进行评估。来自原始函数的一些已知数据点,或许会使用较简单的函数来产生插值。当然,若使用一个简单的函数来估计原始数据点时,通常会出现插值误差;然而,取决于该问题领域和所使用的插值方法,以简单函数推得的插值数据,可能会比所导致的精度损失更大。
在数值分析这个数学分支中,样条插值是使用一种名为样条的特殊分段多项式进行插值的形式。由于样条插值可以使用低阶多项式样条实现较小的插值误差,这样就避免了使用高阶多项式所出现的龙格现象,所以样条插值得到了流行。
给定$n$个离散数据点(称为节点)${\displaystyle (x_{k},y_{k})}(x_{k},y_{k}),{\displaystyle k=1,2,…,n}$。对于${\displaystyle x,(x\neq x_{k},k=1,2,…n)}$,求${\displaystyle x}$所对应的$y$的值称为内插。
$f(x)$为定义在区间$[a,b]$上的函数。${\displaystyle x_{1},x_{2},x_{3}…x_{n}}$为$[a,b]$上 $n$ 个互不相同的点,$G$ 为给定的某一函数类。若$G$ 上有函数$g(x)$ 满足:
$$g(x_{i})=f(x_{i}),k=1,2,…n$$
则称 $g(x)$为 $f(x)$ 关于节点 $x_{1},x_{2},x_{3}…x_{n}$ 在 $G$ 上的插值函数。
Cesium摄像头进入地面下的Bug已经在Cesium 1.66版本中修复。
1 | var viewer = new Viewer('cesiumContainer', { |
我们知道,在使用美国GPS时,需要获得三颗GPS卫星信号,才能够定位自身位置。那么其背后的原理是什么呢?很简单,用数学语言表述,就是通过求解三个球的交点。通常三个球的交点会有两个点,排除位置较高的那个点,剩下的点就是我们空间位置点。
This guide begins with an introduction called, ‘So what’s plain English?’
The guide then looks at the main ways to make writing clearer.
The guide then looks at the difficult subject of apologising, and deals with some of the myths that can get in the way of clear communication.
The guide finishes with a summary and a list of words to avoid.
First let’s say what plain English isn’t and destroy some of the myths about it.
Most experts would agree that clear writing should have an average sentence length of 15 to 20 words.
Do you want your letters to sound active or passive - crisp and professional or stuffy and bureaucratic?
There are times of course when it might be appropriate to use a passive.
Try to call the reader ‘you’, even if the reader is only one of many people you are talking about generally. If this feels wrong at first, remember that you wouldn’t use words like ‘the applicant’ and ‘the supplier’ if you were speaking to somebody sitting across a desk from you.
When you are talking to your reader, say exactly what you mean, using the simplest words that fit. This does not necessarily mean only using simple words - just words that the reader will understand.
At the end of this guide there is a list of a few of the words that we suggest you avoid. But for most words you will have to decide yourself whether they are suitable.
Jargon is a type of language that is only understood by a particular group of people. You can use jargon when writing to people who will understand the terms and phrases. It can be a useful form of shorthand. But try to avoid using specialist jargon on the general public.
So in general, keep to everyday English whenever possible. And again, imagine talking to your reader across a table.
Sit!
Brush your teeth.
Please send it to me.
These are all commands - officially called imperatives. They are the fastest and most direct way of giving someone instructions.
However, if we asked a hardened bureaucrat to write these expressions, we would end up with something like the following.
A nominalisation is a type of abstract noun. (Is that plain English?) In other words, it is the name of something that isn’t a physical object, such as a process, technique or emotion.
Nominalisations are formed from verbs.