hugo-md文档书写时的格式说明

前言

在决定使用github-hugo自动化流程后,第一个面临的问题就是,这个文档头的格式到底是什么样的,因为现在你要手写,就需要彻底搞清楚, 以便达到正确和高效。

阅读查找了gohugo.io的所有相关页面,找到以下两个相关的内容基本上说的很清楚了:
https://gohugo.io/content/front-matter/
https://gohugo.io/content/archetypes/

头格式

md只是文档的类型,但是里面的内容遵循怎样的格式呢? hugo目前支持3中toml,yaml,json,三种格式的文件头。识别符号分别如下

  • toml: +++
  • yaml: —
  • json: {}

toml示例:

+++
title = "spf13-vim 3.0 release and new website"
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
date = "2012-04-06"
categories = [
  "Development",
  "VIM"
]
slug = "spf13-vim-3-0-release-and-new-website"
+++

Content of the file goes Here

yaml示例:

---
title: "spf13-vim 3.0 release and new website"
description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ]
date: "2012-04-06"
categories:
  - "Development"
  - "VIM"
slug: "spf13-vim-3-0-release-and-new-website"
---

Content of the file goes Here

json示例:

{
    "title": "spf13-vim 3.0 release and new website",
    "description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.",
    "tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ],
    "date": "2012-04-06",
    "categories": [
        "Development",
        "VIM"
    ],
    "slug": "spf13-vim-3-0-release-and-new-website",
}

Content of the file goes Here

字段变量

文档可以包含很多变量。

必要字段

  • tile: 内容的标题
  • description: 内容的描述
  • date:日期
  • taxonomies:分类字段,包括tag和categories

可选字段

  • aliases: 别名
  • draft: 是否是草稿
  • publishdate: 定时未来发布的时间
  • type: 内容的格式,可以从内容自动识别
  • isCJKLanguage:是否时CJK
  • weight: 排序的权重
  • markup: 时markdown格式还是reStructuredText
  • slug: url尾部的token
  • url: 完整的url

hugo markdown引擎的配置

finish!

Hanging Sockets and Power Consumption – Basics, Part 3

很好的文章,就mobile 空socket 的耗电状态做了深入的分析.

更完整的内容参见:trepn-whitepaper-apps-power

from:https://developer.qualcomm.com/blog/hanging-sockets-and-power-consumption-basics-part-3

Continuing our series on mobile apps and their effect on battery drain, I’ll pick up where the three guidelines in Wayne Lee’s last post left off, especially #3: “Know what your app is doing with the hardware and when it’s doing it.”

One common way that mobile apps use too much power is through hanging sockets –network connections that the app is no longer using, but which the server thinks are still alive because the app has not closed them. The subsequent query from the server results in needless battery drain.

Here’s more background on the problem and how you can deal with it.

“Wake up. It’s time to go to sleep.”

Applications often “forget” to close their socket after they are done with it. Then, after some amount of time without data activity, the server times the socket out and closes it.

Socket termination in TCP requires a four-way handshake, so the server has to send a FIN packet to the device, which usually takes the device from the low-power dormant state to the higher-power active state. The device goes idle for a bit, then back to dormant. It’s like waking somebody up to tell them that it’s time to go to sleep.

Look at the example in the diagram. The red (1) shows the device jumping from dormant to active mode to send and receive data normally for a few seconds. Once finished, the cellular radio drops to a power-saving idle mode (2) in case that it’s needed again. After about 15 seconds of inactivity, the radio goes dormant (3).

    The diagram shows inefficiencies in Socket Termination activity on a device, the multiple steps it goes through to send/receive data and why it’s important to close sockets.

But the app has left the socket open (hanging). The server doesn’t like loose ends, so it sends its FIN packet to the device. This rouses the radio from dormant to active again (4), the same as if it were sending/receiving data for the app. Worse yet, the radio follows the normal curve back down to idle for another 15 seconds, wasting more power (5).

Begin to get the idea?

The phone has to bring up the radio for a simple, easily avoidable handshake because the server has asked the device for something that the app should have provided in the first place. If no other traffic moves between the device and the network, the connection is a complete waste of several hundred milliamperes.

Assuming that the app uses the network four times in an hour, the simple fix of having the app close the socket when finished can reduce network power consumption by about 20 percent, which would be the difference between eight and ten hours of standby power.

The lesson is: Program your app to close sockets when it has finished with them. Otherwise, the phone consumes power to bring up the radio for a needless handshake with the server.

Next Steps

So, to paraphrase Wayne, you need to know what your app is doing with the cellular radio, when it’s doing it and how to turn it off when the app no longer needs it.

Questions? Visit the Trepn Profiler Support Forum or let me know in the comments below.

cosmic 编译器未调用函数优化

Q. Can the compiler automatically remove unused functions from my application?

A. Yes, the default behavior includes all code linked however, you can add the +split compiler command line option to split the object into multiple sections. i.e. One section per function such that individual functions may be removed by the linker if they are not called. You then mark one or more segments in the link command file with the -k (keep) option to specifiy which segments need to be kept. Typically, you just need to add the -k segment option to the segment containing the vecotr table. This usually coversl all of the applications call trees.

stvd-cosmic

有源滤波电路的等价无源滤波电路

目前的filterlab filterpro等元件生成的参考模型都是基于有源运放的。如果我们需要无源的等价电路,一个简单的近似等价方法:

先根据自己需要用软件设计出有源滤波器电路,然后将生成的滤波电路中的运放去掉,将RC网络中原来接运放输出端的那个回路点直接改接到地。

GPS Tracker系列漫谈(一)

序:

鉴于最近朋友的提议,打算将有关GPS Tracker 的相关知识做一个不断更新的漫谈系列,方便相关的朋友了解和讨论。同时也将对一些网络上以售卖为目的错误宣传予以指正。话题没有提纲,本人将根据随机想到的话题随意展开,如果希望了解相关话题对相关细节感兴趣的朋友,也可以留言,我会在后面的章节展开。

切入正文:

什么是GPS Tracker?

首先顺带说一下GPS,gps是一套通过卫星完成定位的系统,细节可在维基上搜索“GPS”。GPS目前已经不仅专指美制GPS导航系统,已经成为一个定位系统的泛称,所以你经常会听到北斗gps导航系统这样的叫法。

什么是GPS Tracker,参见其英文本意,就明白是GPS定位器。其主要功能为获取当前设备的gps坐标位置,结合地图或者专业GIS,人们就可以知道目标当前的实际空间位置。为什么说是空间位置,因为除了人们用的比较多的平面坐标,gps还能获取3维的海拔高度参数。

根据使用范围,GPS Tracker 也可分为很多类型,海事,军事,车载,个人,宠物等,不同的产品和方案都会有很大的参数差别和要求,可能使用不同的卫星,采用不同的物理信道,使用不同的定位系统等。后面的文章我们主要介绍民用的车载和个人GPS Tracker。对特殊行业GPS 感兴趣的朋友可以留言,以便进一步补充。

 

手机多基站定位中RXLEV跟接收信号强度(dbm)的对应关系

在开发手机多基站定位的过程中,会获取手机当前基站周边的其他基站的接收侧信号等级rxlev,当我们要做多基站定位时,要转化成基站侧的信号强度。 RXLEV跟接收信号强度的对应关系如下表:(信号依次增强)

RXLEV = 0                             RX < -110 dBm

RXLEV = 1        -110 dBm =< RX < -109 dBm

RXLEV = 2        -109 dBm =< RX < -108 dBm

RXLEV = 3        -108 dBm =< RX < -107 dBm

RXLEV = 61       -50  dBm =< RX <  -49 dBm

RXLEV = 62       -49  dBm =< RX <= -48 dBm

RXLEV = 63                           RX >  -48 dBm