See here for details:
https://apilevels.com/
android dependencies
Android dependencies conflict resolve
今天在编译Android应用“草书字典”时突然发现以下错误:
1 | Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-18.0 (com.google.guava:guava:18.0) and jetified-listenablefuture-1.0 (com.google.guava:listenablefuture:1.0) |
大意是说com.google.common.util.concurrent.ListenableFuture这个class出现在不同的package中,属于重复依赖,gradle无法处理,要手动处理一下。
在app.gradle文件中加入如下一行就好了。
1 | implementation 'com.google.guava:guava:27.0.1-android' |
Hexo Usage
Hexo Usage
How to Write a new post
- Generate new post in your terminal:
hexo new "Your post name" - Open your project by
vscode, then open file:source\_post\Your post name.md - Edit your post with vscode, hexo support
markdownandejsfiles
Clean cache
- After finish editing, you can type
hexo cleanin your terminal to clean the cache,cleanis short forcleanhere.
1 | hexo clean |
Generate static files
- After finish editing, you can type
hexo gin your terminal to generate static files,gis short forgeneratehere.
1 | hexo g |
Publish your post
- Type
hexo dto deploy your post to github.io,dis short fordeployhere.
1 | hexo d |
View your post
- open
zdd.github.ioto see your post, good job!
you can use npm run deploy to combine generate and deploy in a single command.
View post locally
- Run
hexo sin terminal, then openlocalhost:4000to see your post, this is very convenient to check your post before publish.
1 | hexo s |
404 File not found
When you encounter the 404 error, make sure to do the following
- Check your
source\_post\Your post name.mdfile name, make sure it is the same as the title in the file. - run
hexo cleanto clean the cache - run
hexo gto generate static files - run
hexo dto deploy your post to github.io
Tags not working
- Make sure you have a
tagsfolder undersourcefolder - Install easy tag plugin by
npm install hexo-easy-tags-plugin --save - Delete
.deploy_gitfolder - Run
hexo cleanto clean the cache - Run
hexo gto generate static files - Run
hexo dto deploy your post to github.io - Force refresh your browser by
Ctrl + F5
Make sure tags config in themes\next\_config.yml is correct, remember to set amount to a large number
1 | tagcloud: |
How to add tags
- Run
hexo new post "tags" - Make sure tags/index.md has the following content
1
2
3
4
5---
title: tags
date: 2023-06-30 23:21:34
type: "tags"
---
Add multiple tags for a post
- Add tags in the front matter of your post, for example:
1
2
3
4
5
6
7---
title: Hexo Usage
date: 2023-04-16 22:03:56
tags:
- hexo
- blog
---
Insert Read more tag to post
1. Insert `<!-- more -->` in your post, for example:
1
2
3
4
5
6
7
8
9
10
11
12
---
title: Hexo Usage
date: 2023-04-16 22:03:56
tags:
- hexo
- blog
---
# Hexo Usage
## How to Write a new post
<!-- more -->
# other content
ng-template
ng-template
顾名思义,ng-template是一个模板元素,通常与结构化指令ng-if, ng-for, ng-switch及模板变量配合使用.
ng-template配合ng-if
1 | <ng-template [ngIf]="true"> |
在实际编程中,我们一般不用上面的写法,而是采用指令的简写形式,也就是用*ngIf代替[ngIf]。
1 | <div *ngIf="true">Hello, world!</div> |
这段代码编译后的结果和第一段代码是相同的。关于指令的简写形式,请参考这篇。注意:在ng-template上使用指令的简写形式是无效的,必须使用属性绑定的方式,下面的代码无法正常工作。
1 | <ng-template *ngIf="true"> |
作为elseBlock使用
假设有如下需求,当condition为true时,显示Hello, world!,否则显示Goodbye, world!, 该如何实现呢?
我们可以在ngIf指令后面添加else关键字,然后在else后面添加一个模板引用变量,然后定义一个ng-template并用该模版变量标识之,如下所示:
1 | <div *ngIf="condition else otherTemplate">Hello, world!</div> |
如果你使用的是Angular17及以上版本,那么你可以使用built-in control flow语法。
1 | @if(condition) { |
If-then-else
如果两个分支对应的模板都很大,那么可以采用这种方式,使结构更清晰,代码更易读。
1 | <div *ngIf="condition; then thenBlock else elseBlock"></div> |
同样的,如果你使用的是Angular17及以上版本,那么你可以使用built-in control flow语法。
1 | @if(condition) { |
看到了吗,built-in control flow语法的可读性更强,更符合人类的思维方式。
References:
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment