如何在Ubuntu 18.04上打包和发布Snap应用程序

news/2024/7/5 19:09:03

The author selected the Electronic Frontier Foundation to receive a donation as part of the Write for DOnations program.

作者选择了电子前沿基金会来接受捐款,这是Write for DOnations计划的一部分。

介绍 (Introduction)

One of the largest challenges in application development is the final step of distributing the finished product to your users or customers. Many existing application deployment methodologies lack user-friendliness and security, or do not provide methods for automatically updating an application once it has been installed.

应用程序开发中最大的挑战之一是将成品分发给您的用户或客户的最后一步。 许多现有的应用程序部署方法缺乏用户友好性和安全性,或者不提供安装应用程序后自动更新的方法。

Snap is a modern application packaging format with powerful sandboxing and security features, including file system isolation, automatic updates, and integrated dependency management. Snap applications, known as Snaps, can be downloaded and installed using a command-line program, much like apt or yum. Ubuntu comes with Snap pre-installed, meaning that there is a wide audience for Snap applications.

Snap是一种现代的应用程序打包格式,具有强大的沙箱和安全功能,包括文件系统隔离,自动更新和集成的依赖性管理。 可以使用类似于aptyum的命令行程序下载和安装称为Snap的Snap应用程序。 Ubuntu预先安装了Snap,这意味着Snap应用程序的受众广泛。

In this tutorial, you will create a Snap application and publish it on the Snap Store.

在本教程中,您将创建一个Snap应用程序并将其发布在Snap Store上 。

先决条件 (Prerequisites)

To complete this tutorial, you will need:

要完成本教程,您将需要:

  • One Ubuntu 18.04 server set up by following the Initial Server Setup with Ubuntu 18.04, including a sudo non-root user.

    通过对Ubuntu 18.04进行初始服务器设置来设置一台Ubuntu 18.04服务器,包括sudo非root用户。

  • An application that you wish to package and release as a Snap. This may be a complex application that you created, a common open-source project, or a simple “Hello, world!” program. If you don’t already have an application, Step 1 of this tutorial will cover how you can create a Hello World program in Go.

    您希望打包并作为Snap发布的应用程序。 这可能是您创建的复杂应用程序,常见的开源项目,也可能是简单的“ Hello,world!”。 程序。 如果您还没有应用程序,那么本教程的第1步将介绍如何在Go中创建Hello World程序。

  • An account on the Snapcraft Developer Dashboard.

    Snapcraft开发人员仪表板上的帐户。

Once you have these ready, log in to your server as your non-root user to begin.

准备就绪后,以非root用户身份登录到服务器以开始。

第1步-使您的应用程序准备好打包 (Step 1 — Getting Your Application Ready for Packaging)

Firstly, you’ll prepare your application for packaging as a Snap application by ensuring that everything required is present in a single directory.

首先,通过确保所需的所有内容都在单个目录中,您将为打包为Snap应用程序准备应用程序。

Start by creating a new directory for your Snap and moving into it:

首先为快照创建一个新目录并移至该目录:

  • mkdir ~/your-snap

    mkdir〜/ 您的快照

  • cd ~/your-snap

    cd〜/ 您的快照

Next, if you already have an application, put a complete copy of the source code for your application into the directory that you just created. The process here will vary significantly depending on the exact application that you’re packaging, however in the case that the source code is stored in a Git repository, you can git init a repository in the directory and pull down all of the relevant code.

接下来,如果您已经有一个应用程序,请将应用程序源代码的完整副本放入刚创建的目录中。 根据您要打包的确切应用程序,此处的过程将有很大不同,但是,如果源代码存储在Git存储库中,则可以在目录中git init一个存储库并下拉所有相关代码。

If you don’t yet have an application that you’d like to package, you may create a “Hello World” program to use instead. If you would like more context on writing this program with Go, check out the How to Write Your First Program in Go tutorial.

如果您还没有要打包的应用程序,则可以创建一个“ Hello World”程序来代替。 如果您想了解更多有关使用Go编写该程序的信息,请查看如何在Go中编写第一个程序教程。

You can do this by first creating a new Go file and opening it using your preferred text editor:

为此,您可以先创建一个新的Go文件,然后使用首选的文本编辑器将其打开:

  • nano helloworld.go

    nano helloworld.go

Next, add the following code to the file:

接下来,将以下代码添加到文件中:

helloworld.go
helloworld.go
package main
import "fmt"
func main() {
  fmt.Println("Hello, world!")
}

Then save and exit the file.

然后保存并退出文件。

If you don’t have Go installed, you can install it using the following command:

如果您尚未安装Go,则可以使用以下命令进行安装:

  • sudo apt install golang-go

    sudo apt安装golang-go

Once Go is installed, you can run your new program to check that it is working:

安装Go之后,您可以运行新程序以检查其是否正常运行:

  • go run helloworld.go

    去运行helloworld.go

You’ll see the following output:

您将看到以下输出:


   
Output
Hello, world!

You’ve prepared your application for packaging as a Snap. Next, you will install the software required to begin the packaging process.

您已经准备好将应用程序打包为Snap。 接下来,您将安装开始打包过程所需的软件。

第2步-安装Snapcraft (Step 2 — Installing Snapcraft)

In this step, you’ll download and install Snapcraft, which is the name of the official Snap application packaging tool. Snapcraft is available from the Snap Store, which is built into Ubuntu by default. This means that you can install Snapcraft from the command-line using the snap command.

在此步骤中,您将下载并安装Snapcraft,这是Snap应用程序官方包装工具的名称。 Snapcraft可从Snap Store获得,Snap Store默认内置于Ubuntu中。 这意味着您可以使用snap命令从命令行安装Snapcraft。

The snap command is equivalent to the apt command, but you can use it to install software from the Snap Store, rather than packages from the Apt repositories.

snap命令与apt命令等效,但是您可以使用它来从Snap Store安装软件,而不是从Apt存储库中安装软件包。

In order to install Snapcraft, run the following command:

为了安装Snapcraft,请运行以下命令:

  • sudo snap install snapcraft --classic

    sudo snap install snapcraft-经典

You use the --classic command argument so that Snapcraft installs without the strict sandboxing features that Snaps normally use. Snapcraft requires this argument as it needs more privileged access to your system to reliably package applications.

使用--classic命令参数可以使Snapcraft的安装没有Snaps通常使用的严格沙箱功能。 Snapcraft需要此参数,因为它需要对系统有更多特权以可靠地打包应用程序。

Once you’ve installed Snapcraft, you’ll see the following:

安装Snapcraft之后,您将看到以下内容:


   
Output
snapcraft 3.9.8 from Canonical✓ installed

Finally, you can double-check the Snapcraft installation by running:

最后,您可以通过运行以下命令仔细检查Snapcraft安装:

  • snapcraft --version

    snapcraft-版本

This will display something similar to:

这将显示类似于以下内容:


   
Output
snapcraft, version 3.9.8

Now that you’ve installed Snapcraft, you can begin to define the configuration and metadata for your Snap application.

现在,您已经安装了Snapcraft,可以开始定义Snap应用程序的配置和元数据。

第3步—定义快照的配置和元数据 (Step 3 — Defining the Configuration and Metadata for Your Snap)

In this step, you will begin to define the configuration, structure, and metadata for your Snap application.

在此步骤中,您将开始为Snap应用程序定义配置,结构和元数据。

Begin by ensuring that you are still working in your Snap application directory:

首先,请确保您仍在Snap应用程序目录中工作:

  • cd ~/your-snap

    cd〜/ 您的快照

Next, create and edit the snapcraft.yaml file using your preferred text editor:

接下来,使用您喜欢的文本编辑器创建和编辑snapcraft.yaml文件:

  • nano snapcraft.yaml

    纳米snapcraft.yaml

You’ll use the snapcraft.yaml file to store all of the configuration for your Snap application, including the name, description, and version, as well as settings related to dependency management and sandboxing.

您将使用snapcraft.yaml文件存储Snap应用程序的所有配置,包括名称,描述和版本,以及与依赖项管理和沙箱相关的设置。

Begin by defining the name, summary, description, and version number for your application:

首先定义应用程序的名称,摘要,描述和版本号:

snapcraft.yaml
snapcraft.yaml
name: your-snap
summary: A summary of your application in 78 characters or less.
description: |
  A detailed description of your application.
  The description can have multiple lines.
version: '1.0'

The name of your Snap needs to be unique if you wish to publish it on the Snap Store—search for other applications with the same name to make sure that it isn’t already taken.

如果要在Snap Store中发布快照 ,则快照的名称必须唯一。请搜索具有相同名称的其他应用程序,以确保尚未使用。

Next, you can define the command(s) that you wish to associate with your application. This will allow your Snap to be used directly from the Bash command-line as a normal command.

接下来,您可以定义要与应用程序关联的命令。 这将使您的快照可以作为常规命令直接从Bash命令行使用。

Add the following to your snapcraft.yaml file:

将以下内容添加到您的snapcraft.yaml文件中:

snapcraft.yaml
snapcraft.yaml
. . .
apps:
  your-snap-command:
    command: your-snap

your-snap-command is the name of the command that you want to define. For example, you may wish to use the command helloworld to run your Hello World program.

your-snap-command是要定义的命令的名称。 例如,您可能希望使用命令helloworld来运行Hello World程序。

You use command: your-snap to tell Snapcraft what to do when the application command is run. In the case of the Hello World program, you would use the value helloworld to reference the helloworld.go file, which will allow Snapcraft to run your program successfully.

您可以使用command: your-snap告诉Snapcraft在运行应用程序命令时该怎么做。 对于Hello World程序,您将使用值helloworld来引用helloworld.go文件,这将使Snapcraft成功运行您的程序。

This results in the following example configuration:

这将导致以下示例配置:

snapcraft.yaml
snapcraft.yaml
apps:
  helloworld:
    command: helloworld

If the command name matches the Snap name exactly, you’ll be able to run it directly from the command-line. If the command does not match the Snap name, the command will be automatically prefixed with the name of the Snap. For example, helloworld.command1.

如果命令名称与Snap名称完全匹配,则可以直接从命令行运行它。 如果命令与快照名称不匹配,则该命令将自动以快照名称作为前缀。 例如, helloworld.command1

Finally, you can define the parts that make up your Snap application. Snap applications are made up of multiple parts, which are all of the components that make up your application. In many cases, there is only one part, which is the application itself.

最后,您可以定义组成 Snap应用程序的部分。 Snap应用程序由多个部分组成,这些部分构成了您的应用程序。 在许多情况下,只有一部分,即应用程序本身。

Each part has an associated plugin. For example, for components of your application written in Ruby, the ruby plugin is used, and for components written in Go, the go plugin is used.

每个部分都有一个关联的插件。 例如,对于使用Ruby编写的应用程序组件,使用ruby插件,对于使用Go编写的组件,则使用go插件。

You can use the Snapcraft list-plugins command to identify the correct plugin(s) for your application:

您可以使用Snapcraft list-plugins命令为您的应用程序识别正确的插件:

  • snapcraft list-plugins

    snapcraft列表插件

This will output a list similar to the following:

这将输出类似于以下内容的列表:


   
Output
ant catkin-tools conda dump gradle make nil python rust autotools cmake crystal go kbuild maven nodejs qmake scons catkin colcon dotnet godeps kernel meson plainbox-provider ruby waf

The most common plugins are those for common programming languages, such as Go, Rust, Ruby, or Python.

最常见的插件是用于通用编程语言的插件,例如Go,Rust,Ruby或Python。

Once you have identified the correct plugins for your application, you can begin to add the parts configuration to your snapcraft.yaml file:

为您的应用程序确定正确的插件后,即可开始将parts配置添加到snapcraft.yaml文件中:

snapcraft.yaml
snapcraft.yaml
. . .
parts:
  your-snap:
    plugin: plugin-name
    source: .

You use the source configuration parameter to specify the relative path to the source code for your application. Usually this will be the same directory as the snapcraft.yaml file itself, so the source value is a single dot (.).

您可以使用source配置参数来指定应用程序源代码的相对路径。 通常,该目录与snapcraft.yaml文件本身位于同一目录,因此source值是单个点( . )。

Note: If your application component has any dependencies that are required for either building or running it, you can specify these using the build-packages and stage-packages attributes. The specified dependency names will then be automatically fetched from the default package manager for your system.

注意:如果您的应用程序组件具有构建或运行它所需的任何依赖关系,则可以使用build-packagesstage-packages属性指定这些依赖关系。 然后将从系统的默认程序包管理器中自动获取指定的依赖项名称。

For example:

例如:

snapcraft.yaml
snapcraft.yaml
parts:
  your-snap:
  plugin: plugin-name
  source: .
  build-packages:
  - gcc
  - make
  stage-packages:
  - libcurl4

Some Snapcraft plugins have their own specific options that may be required for your application, so it’s worthwhile reviewing the relevant manual pages for your plugin:

某些Snapcraft插件具有您的应用程序可能需要的特定选项,因此值得阅读有关插件的相关手册页:

  • snapcraft help plugin-name

    snapcraft帮助插件名称

In the case of Go applications, you would also specify the go-importpath. For the Hello World configuration, this results in the following example configuration:

对于Go应用程序,您还可以指定go-importpath 。 对于Hello World配置,这将导致以下示例配置:

snapcraft.yaml
snapcraft.yaml
parts:
  helloworld:
    plugin: go
    source: .
    go-importpath: helloworld

You can leave your snapcraft.yaml file open to add further configuration in the next step.

您可以将snapcraft.yaml文件保持打开状态,以在下一步中添加更多配置。

You’ve defined the base configuration for your Snap application. Next, you’ll configure the security and sandboxing aspects of your application.

您已经为Snap应用程序定义了基本配置。 接下来,您将配置应用程序的安全性和沙箱方面。

步骤4 —保护您的Snap应用程序 (Step 4 — Securing Your Snap Application)

Snap applications are designed to run within a sandboxed environment, so in this step you’ll configure sandboxing for your Snap. Firstly, you’ll need to enable sandboxing for your application, known within Snapcraft as confinement.

Snap应用程序旨在在沙盒环境中运行,因此在此步骤中,您将为Snap配置沙盒。 首先,您需要为您的应用程序启用沙箱功能,在Snapcraft中被称为confinement

Add the following to your snapcraft.yaml file:

将以下内容添加到您的snapcraft.yaml文件中:

snapcraft.yaml
snapcraft.yaml
. . .
confinement: strict

This will enable sandboxing for your application, preventing it from accessing the internet, other running Snaps, or the host system itself. However, in most cases, applications do need to be able to communicate outside of their sandbox like when they need to access the internet or read/write to the file system.

这将为您的应用程序启用沙箱功能,从而阻止其访问Internet,其他正在运行的Snap或主机系统本身。 但是,在大多数情况下,应用程序确实需要能够在沙箱外部进行通信,例如当它们需要访问Internet或读取/写入文件系统时。

These permissions, known within Snapcraft as interfaces, can be granted to your Snap application using Plugs. Using Plugs, you can have fine-grain control over the sandboxing for your application, to give it the access that it requires and nothing more (principle of least privilege).

可以使用插件将这些权限(在Snapcraft中称为接口)授予Snap应用程序。 使用Plugs,您可以对应用程序的沙箱进行细粒度的控制,使其具有所需的访问权限,而仅此而已( 最低特权原则 )。

The exact interfaces that are required will vary depending on your application. Some of the most common interfaces are:

所需的确切接口将取决于您的应用程序。 一些最常见的接口是:

  • audio-playback - Allows audio output/playing sounds.

    audio-playback -允许音频输出/播放声音。

  • audio-record - Allows audio input/recording.

    audio-record -允许音频输入/记录。

  • camera - Allows access to connected webcams.

    camera -允许访问连接的网络摄像头。

  • home - Allows access to non-hidden files within your home directory.

    home -让你的home目录内访问非隐藏文件。

  • network - Allows access to the network/internet.

    network -允许访问网络/互联网。

  • network-bind - Allows binding to ports to operate as a network service.

    network-bind -允许绑定到端口以作为网络服务运行。

  • system-files - Allows access to the entire file system of the host machine.

    system-files files-允许访问主机的整个文件系统。

The full list of available interfaces can be found within the Snapcraft documentation under Supported Interfaces.

可用接口的完整列表可在Snapcraft文档中的“ 支持的接口”下找到。

Once you’ve identified all of the required interfaces for your application, you can begin to assign these to plugs within your snapcraft.yaml file.

确定了应用程序的所有必需接口后,就可以开始将这些接口分配给snapcraft.yaml文件中的plugs

The following example configuration will allow the application to access the network and users’ home area:

以下示例配置将允许应用程序访问网络和用户的本地区域:

snapcraft.yaml
snapcraft.yaml
. . .
plugs:
  your-snap-home:
    interface: home
  your-snap-network:
    interface: network

Save and exit your file.

保存并退出文件。

The name of the Plug should be a descriptive name to help users identify the purpose of the Plug.

插件的名称应为描述性名称,以帮助用户确定插件的用途。

You’ve enabled sandboxing for your Snap and configured some Plugs to grant limited access to system resources. Next you’ll finish building your Snap app.

您已经为Snap启用了沙箱功能,并配置了一些插件以授予对系统资源的有限访问权限。 接下来,您将完成构建Snap应用程序。

步骤5 —构建和测试您的Snap应用程序 (Step 5 — Building and Testing Your Snap Application)

Now that you’ve written all of the required configuration for your Snap, you can proceed with building it and testing the Snap package locally.

既然您已经为Snap编写了所有必需的配置,则可以继续构建它并在本地测试Snap软件包。

If you’ve been following along using a Hello World program as your application, your complete snapcraft.yaml file will now look similar to the following:

如果您一直在使用Hello World程序作为应用程序,那么完整的snapcraft.yaml文件现在将类似于以下内容:

snapcraft.yaml
snapcraft.yaml
name: helloworld
summary: A simple Hello World program.
description: |
  A simple Hello World program written in Go.
  Packaged as a Snap application using Snapcraft.
version: '1.0'
confinement: strict

apps:
  helloworld:
    command: helloworld

parts:
  helloworld:
    plugin: go
    source: .
    go-importpath: helloworld

plugs:
  helloworld-home:
    interface: home
  helloworld-network:
    interface: network

In order to build your Snap application, run the snapcraft command from within the directory for your Snap:

为了构建您的Snap应用程序,请从Snap目录中运行snapcraft命令:

  • snapcraft

    快艇

Snapcraft will then automatically launch a virtual machine (VM) and begin building your Snap. Once complete, Snapcraft will exit and you will see something similar to the following:

Snapcraft然后将自动启动虚拟机(VM)并开始构建Snap。 完成后,Snapcraft将退出,您将看到类似以下内容:


   
Output
Snapped your-snap_1.0_amd64.snap

You can now install your Snap locally in order to check that it is working:

现在,您可以在本地安装Snap,以检查其是否正常工作:

  • sudo snap install your-snap.snap --dangerous

    sudo snap安装您的快照 .snap --dangerous

The --dangerous command argument is required as you are installing a local Snap that has not been signed.

在安装尚未签名的本地快照时,需要--dangerous命令参数。


   
Output
your-snap 1.0 installed

Once the installation process is complete, you can then run your Snap using its associated command. For example:

安装过程完成后,即可使用其关联的命令运行Snap。 例如:

  • helloworld

    你好,世界

In the case of the example Hello World program, the following output would be:

对于示例Hello World程序,将显示以下输出:


   
Output
Hello, world!

You can also view the sandboxing policy for your Snap to make sure that the assigned permissions have been properly granted:

您还可以查看快照的沙箱策略,以确保已正确分配分配的权限:

  • snap connections your-snap

    快速连接您的快照

This will output a list of Plugs and interfaces, similar to the following:

这将输出一个插件和接口列表,类似于以下内容:


   
Output
snap connections your-snap Interface Plug Slot Notes home your-snap:your-snap-home :home - network your-snap:your-snap-network :network -

In this step, you built your Snap and installed it locally to test that it is working. Next, you’ll publish your Snap on the Snap Store.

在此步骤中,您构建了Snap并将其安装在本地以测试其是否正常运行。 接下来,您将在Snap Store上发布Snap。

第6步-发布快照 (Step 6 — Publishing Your Snap)

Now that you’ve built and tested your Snap application, it’s time to release it on the Snap Store.

现在,您已经构建并测试了Snap应用程序,是时候在Snap Store上发布它了。

Begin by logging in to your Snap Developer account using the Snapcraft command-line application:

首先使用Snapcraft命令行应用程序登录到Snap Developer帐户:

  • snapcraft login

    snapcraft登录

Follow the prompts to enter your email address and password.

按照提示输入您的电子邮件地址和密码。

Next, you need to register the name of the application on the Snap Store:

接下来,您需要在Snap Store中注册应用程序的名称:

  • snapcraft register your-snap

    snapcraft注册您的快照

Once you’ve registered the Snap name, you can push the built Snap package to the store:

注册Snap名称后,可以将构建的Snap软件包推送到商店:

  • snapcraft push your-snap.snap

    snapcraft推动您的快照 .snap

You’ll see output similar to the following:

您将看到类似于以下内容的输出:


   
Output
Preparing to push 'your-snap_1.0_amd64.snap'. Install the review-tools from the Snap Store for enhanced checks before uploading this snap. Pushing 'your-snap_1.0_amd64.snap' [===================================================================================================] 100% Processing...| Ready to release! Revision 1 of 'your-snap' created.

Each time you push to the Snap store, the revision number is incremented, starting at one. This is useful to help identify the various different builds of your Snap.

每次推送到Snap存储时,修订号都会从1开始递增。 这对于帮助识别Snap的各种不同版本很有用。

Finally, you can release your Snap to the public:

最后,您可以将Snap公开发布:

  • snapcraft release your-snap revision-number channel

    snapcraft发布您的快照 修订号 频道

If this is the first time you’ve pushed to the Snap Store, the revision number will be 1. You can also choose between releasing to the stable, candidate, beta, and edge channels, if you have multiple versions of your application at different stages of development.

如果这是您第一次推送到Snap Store,则修订号将为1 。 你也可以释放到选择stablecandidatebeta ,以及edge 渠道 ,如果你有不同的发展阶段应用程序的多个版本。

For example, the following command will release revision 1 of the Hello World Snap to the stable channel:

例如,以下命令会将Hello World Snap的修订版1释放到stable通道:

  • snapcraft release helloworld 1 stable

    snapcraft发布helloworld 1稳定版

You’ll see output similar to the following:

您将看到类似于以下内容的输出:


   
Output
Track Arch Channel Version Revision latest amd64 stable 1.0 1 candidate ^ ^ beta ^ ^ edge ^ ^ The 'stable' channel is now open.

You can now search for your application on the Snap Store and install it on any of your devices.

您现在可以在Snap Store中搜索您的应用程序并将其安装在任何设备上。

In this final step, you uploaded your built Snap package to the Snap Store and released it to the public.

在最后一步中,您将构建的Snap软件包上载到Snap Store并发布给公众。

结论 (Conclusion)

In this article you configured and built a Snap application, and then released it to the public via the Snap Store. You now have the foundational knowledge required to maintain your application and building new ones.

在本文中,您配置并构建了Snap应用程序,然后通过Snap Store将其发布给公众。 您现在已经拥有维护应用程序和构建新应用程序所需的基础知识。

If you wish to explore Snaps further, you may wish to browse the full Snap Store. You may also wish to review the Snapcraft YAML Reference to understand more about it and identify additional attributes for your Snap configuration.

如果您想进一步探索Snaps,则不妨浏览完整的Snap Store 。 您可能还希望查看《 Snapcraft YAML参考》以了解有关它的更多信息,并确定Snap配置的其他属性。

Finally, if you’d like to investigate Snap development further, you may enjoy reading about and implementing Snap Hooks, which allow Snaps to dynamically react to system changes such as upgrades or security policy adjustments.

最后,如果您想进一步研究Snap的开发,您可能会喜欢阅读并实现Snap Hooks ,它们使Snap能够对系统更改(例如升级或安全策略调整)动态做出React。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-package-and-publish-a-snap-application-on-ubuntu-18-04


http://www.niftyadmin.cn/n/3648608.html

相关文章

··· Socks Online - 在内部网也能使用QQ ···

Socks Online - 在内部网也能使用QQ(1)互联在线 一、背景现在许多人常用QQ(OICQ)上网聊天,但有时候在办公室或公司内部无法使用。原来的QQ不支持Http Proxy,新的QQ要求会员方能使用,给用户带来许多不便。有没有一个简单的方法在内部网也可以使…

Android网络开启、关闭整理

Android网络开启、关闭整理 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211…

.nsh 怎么样运行_如何在Ubuntu 18.04上使用nsh运行安全的远程命令

.nsh 怎么样运行介绍 (Introduction) It can often be difficult to manage multiple machines on a daily basis. While Secure Shell (SSH) is a good choice for remote access, the protocol itself has some drawbacks in both convenience and security. 每天通常很难管理…

WINAMP SDK 常见问题回答(FAQ)

WINAMP SDK 常见问题回答(FAQ) 这里有一些收集的问题,我们不想每个人重蹈覆辙,希望这里变成知识仓库,能够帮助大家。1、我不知道怎样用sdk,你可以帮助我写一个插件吗?一个好的方法就是去下载sdks,然后去察看或修改代…

EventBus的手写

在上一篇文章我讲了EventBus源码,现在我们来手写一下EventBus 使用 MainActiviity public class MainActivity extends AppCompatActivity {private TextView mTv;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceSta…

node.js 创建服务器_如何使用HTTP模块在Node.js中创建Web服务器

node.js 创建服务器The author selected the COVID-19 Relief Fund to receive a donation as part of the Write for DOnations program. 作者选择了COVID-19救济基金来接受捐赠,这是Write for DOnations计划的一部分。 介绍 (Introduction) When you view a webp…

WINAMP 配置文件

WINAMP 配置文件很简单,就没有翻译了 ;-)Configuration Files Any skin file is not complete without first finishing up the configuration files. These configuration files control such things as the background and foreground colo…

Android AES加密算法及其实现

昨天老大叫我看看android加密算法。于是网上找了找,找到了AES加密算法。(当然还有MD5,BASE64什么的http://snowolf.iteye.com/blog/379860这篇文章列举了很多,但是基本都是j2se平台的,android平台不一定支持,但是AES算…