Finisky Garden

NLP, 软件工程, 产品设计

Google Ads是许多独立博客赢利维持自身运转的方案之一。不过近些年前已经不大流行了,因为转化率低,没有很大的基础流量支持,其实很难赚到钱。独立博客的流量如果不做PR的话,主要还是靠搜索引擎。而提升流量的根本需要有对应的用户群,相较而言,微信公众号、头条号上的平台流量足够大,用户粘度更高,赢利方式也更为多样,对作者来说更易变现。现在这年头还玩独立博客的人,我想都是有一份自己的坚持,一块独立的领地,完全自由掌控的感觉,想靠这个赚钱还是算了。

言归正传,说说Google AdSense如何添加到博客里。

阅读全文 »

If you use Visual Studio 2017 and create an .NET Core projects the first time, the following errors might appear:

The current .NET SDK does not support targeting .NET Standard 2.0. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0. XXXProject C:Files (x86)Visual Studio\2017.NET.Sdk.NET.TargetFrameworkInference.targets

Another related issue is .NET Core project load failed. Both errors point out that the corresponding .NET SDK is missing.

If you follow the instructions to install .NET Core SDK with a random version from here: https://aka.ms/dotnet-download . Most likely that the issue cannot be resolved.

阅读全文 »

Recently we use Grafana to monitor ASP.NET Core apps. We have an interesting observation that sometimes the "allocated memory" is larger than "working set". After investigation, we found the root cause is that the app uses native dlls which operates on unmanaged memory which is not managed by GC. Therefore, how to correctly collect memory related metrics in C#?

We will explain these related concepts in this post.

阅读全文 »

kubernetes dashborad是用来查看cluster各项指标的Web UI。但是直到目前依然不支持用户级别的语言设置。它默认根据浏览器的语言设置作为自己的界面语言,这样对于中文Chrome用户来说略有不便:k8s dashboard作为一个管理工具,由于需要中文反译回英文,严重影响了工作效率。感受一下中文界面:

k8s dashboard中文界面

阅读全文 »

The error looks like this:

$ python test.py
Traceback (most recent call last):
  File "test.py", line 3, in <module>
  ...
  File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/__init__.py", line 18, in <module>
    from apex.interfaces import (ApexImplementation,
  File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/interfaces.py", line 10, in <module>
    class ApexImplementation(object):
  File "miniconda3/envs/torch/lib/python3.7/site-packages/apex/interfaces.py", line 14, in ApexImplementation
    implements(IApex)
  File "miniconda3/envs/torch/lib/python3.7/site-packages/zope/interface/declarations.py", line 483, in implements
    raise TypeError(_ADVICE_ERROR % 'implementer')
TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.

Refer to this issue: https://github.com/NVIDIA/apex/issues/116

Install the latest version resolved the issue:

pip uninstall apex

git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install

A weird problem that execute "import torch" in bash works but when you run it in Jupyter notebook:

ImportError Traceback (most recent call last)
<ipython-input-4-8ba1970b60ce> in <module>
 6 import random
 7 
----> 8  import torch
 9 import torch.nn as nn
 10 

~/miniconda3/envs/tf/lib/python3.6/site-packages/torch/__init__.py in <module>
 79 del _dl_flags
 80 
---> 81  from torch._C import *
 82 
 83 __all__ += [name for name in dir(_C)

ImportError: dlopen: cannot load any more object with static TLS
阅读全文 »

When I use kubectl to deploy a service:

$ kubectl --kubeconfig=C:\Users\xxx\.kube\config apply -f deploy.yaml --namespace=xxx
a SchemeError was raised:
EXEC(0,0): Error : SchemaError(io.k8s.api.apps.v1beta1.RollingUpdateStatefulSetStrategy): invalid object doesn't have additional properties

阅读全文 »

最近爬取几个页面总是失败,遇到如下错误:

# The HTTP request to the remote WebDriver server for URL http://localhost:xxx/ session timed out after 60 seconds.

后来发现原因是页面加载缓慢,debug发现页面其实已经在浏览器中成功渲染,只是还在等待一些后台javascript加载完毕,然后超时报错。

考虑到许多javascript都是广告、统计等一些附加内容,用selenium爬取页面时仅需要其中的html,无须等待所有javascript加载完毕。因此,想看看如何禁止ChromeDriver加载javascript,仅下载html。

搜了下"Selenium Disable JavaScript in ChromeDriver",发现了几种方案,最终用Page load strategy解决问题,小结一下各种方案的坑。

阅读全文 »
0%