Tuesday, April 28, 2020

Springboot cron example



package com.auspix.satori.auspixMonitor;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import chan.SinaDataMinProvider;

@SpringBootApplication
@EnableScheduling
public class AuspixMonitorApplication {

private static final Logger log = LoggerFactory.getLogger(AuspixMonitorApplication.class);
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
public static final String[] RICS = {"sh000001","sz300234","sz300273","sz300636","sz300669","sz300702"};

public static void main(String[] args) {
SpringApplication.run(AuspixMonitorApplication.class, args);
}

@Scheduled(cron = "0 0,15,30,45 9-14 * * ?")
public void monitorMin15() throws Exception {
monitor();
}

@Scheduled(cron = "0 0,5,10,15,20,25,30,35,40,45,50,55 9-14 * * ?")
public void monitorMin5() throws Exception {
monitor();
}

private void monitor() throws Exception {
log.info("monitorMin15, the time is now {}", dateFormat.format(new Date()));
List<String> diResultList = SinaDataMinProvider.monotorDi(RICS);
log.warn(diResultList.toString());
List<String> dingResultList = SinaDataMinProvider.monotorDing(RICS);
log.warn(dingResultList.toString());
}

}

Friday, April 24, 2020

Python (or other programming language) Home work for kids

Python (or other programming language) Home work:
Unit 1:
1. Write/Print "I'm Paul, I'm learning Python" 10000 times
with blank line, all upper case ...
2. Print all numbers between 1 to 2000
print even numbers only, print even numbers which can divide 3
3. Calculate the sum the event numbers from 1 to 1000
4. How many numbers contain 4 in any digits for the number between 1 to 1000 (good, hard to search)

Unit 2:
1. Same with Day 1 but with functions
2. Calculate Fibonacci
3. Put "Rock Paper Scissors" randomly for 10000 times, are they really random? (good)
4. Print the unrecognized Chinese characters in random order
5. Put the unrecognized Chinese characters in a file, and read the file, print the characters in random order to help review

Unit 3:
1. Make a function to convert fahrenheit to celsius, and vice versa
2. Make a function to calculate min/max/avg/mid for a number array
3. Make a function to convert kilometers to miles, and vice versa
4. Make a function to convert liter to galon, and vice versa
5. Make a function to convert meter to centimeter, and vice versa
6. How to make it a module and call later

Unit 4:
The Three Little Pigs
1. Read a text book file, and tell me how many words in this book, which word appears most?
2. Read a text book file, and tell me how many letters in this book, which letter appears most?
3. Read a text book file, and tell me which line is longest line?
4. Read a text book file, and add line length to every line's beginning.

Unit 5:
How to make unit 4 smarter (AI), the input could be
convert 12 km to miles, or convert 3 liter to galon or 300 centimeter to meter

Unit 6:
1. greatest common factor
2. least common multiple

Unit 7:
Frog jumping
How many Friday and 13 during the latest 1000 years?

Unit 8 (File read/write):
Read stock daily data file, add name to every line
Read stock daily data file, calculate percentage, ma5, ma10 and write back to the file

Unit 9 (network and library):
Retrieve all League of Legends champions skins picture and write them into local hard disk, the folder name is organized by the champion name

Unit 10 (database):
1. Save the daily data file of Unit 8 to MongoDB
2. Save all League of Legends skins of Unit 9 to MongoDB

Thursday, April 16, 2020

Remove a file within the dependency jar from moven ear

https://stackoverflow.com/questions/2830837/remove-file-from-dependency-jar-using-maven

Parent pom has multiple children and all children refers to a scheduler task except 1. Child 1 is deployed to VM1 JBoss, child 2 is deployed to VM2 JBoss ..
For JBoss configuration, it contains the item for scheduler tasks (like cron information) which is not needed on child 3. In this case, needs exclude the spring-tasks.xml from the core*.jar.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>remove-****</id>
<goals>
<goal>remove</goal>
</goals>
<phase>package</phase>
<configuration>
<fileset>
<directory>target/***_MDB-${revision}/lib/**Core-${revision}.jar/META-INF/spring/context</directory>
<includes>
<include>**/spring-tasks.xml</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>

Wednesday, March 25, 2020

道德经 -> 股票操作指南


道德经

[原文]

道可道,非常道。名可名,非常名。无,名万物之始;有,名万物之母。故常无,欲以观其妙;常有,欲以观其所徼。此两者同出而异名,同谓之玄,玄之又玄,众妙之门。

[译文]
能表述的股票之道,不是一直不变的。哪怕再有名的,也不是一直不变的(连道指的成份股和股票名字本身,都不是一直不变的)。空仓,是一切的开始(刚开户呢),开始买入持有,是之后一切的根基。所以空仓的时候,要仔细观察是否有机会可以开始慢慢建仓;满仓的时候,要仔细观察是否有应该撤退的信号。买入和卖出,本质一样只是名称不同。它们组合在一起,旋转又旋转(买入又卖出,卖出又买入),是一切盈利的来源。

[原文]
天下皆知美之为美,斯恶已;皆知善之为善,斯不善已。故有无相生,难易相成,长短相形,高下相倾,音声相和,前后相随。是以圣人居无为之事,行不言之教,万物作焉而不辞,生而不有,为而不恃,功成而弗居。夫唯弗居,是以不去。

[译文]
大家都说好的股票,就不再是好的股票;大家都说是利好的消息,就不再是利好消息。所以买入卖出不断变化,盈利难易都是相对的,K线长短形状,上涨和下跌,各种利好利空的消息,操作前后都会跟随而来。所以股神要顺应趋势,不试图指点别人炒股,赚钱了别人自然能看到,任何股票符合条件都可以考虑买入,股票是公司发行的,没必要一直持有做股东,一直观察而不是买入后就不管了,股票拉升结束后不再持有。正因为不再持有,所以能保有盈利,不会被随后的下跌把利润抹去。

Sunday, January 19, 2020

游泳池成本和维护

1.
我家刚刚自己刷完,不过我家的是混凝土的。不知道涂料选择有没有区别。
你Google一下,悉尼很多网站有实体店的。我在墨尔本,只有2-3家可以选,倒也省心。
具体来说先用强力洗涤剂洗一遍去除油污,彻底冲洗干净。等24小时表面干透之后就可以涂了。注意清洗的时候不要用容易掉毛的东西,用刷子就行。
涂料是特殊的(Chlorinated Rubber),我买的20L,将近$700。可以用普通的油漆滚筒。当然要用好一点的不掉毛的滚筒。
涂的时候比刷墙简单因为没什么边界。但是注意路线不要困住出不来了。至少2遍,刷完之后再等72小时干透再放水。

3. 我公司专业挖,填泳池,园艺,微信haby2016,添加时备注园艺即可,期待为您服务!
4.
如果你够handy,买一个robot vacuum,每年固定支出少于$1500。

游泳池费高的不是维护,而是维修和换parts,

Liner每6-10年就要换,小1万几乎跑不掉。
pump每5年左右要换,1000左右
heater每5-8年要换,3000-4000
如果是salt water pool, salt cell每几年1000,整个system2000。

我家游泳池非常大,每年opening, closing都是自己做,每年不到1000的维护。
5.
怕麻烦花1000多买个机器人,每天花2分钟清理下机器人就行了。

Liner,heater,pump用10年以上没问题,不知道为啥有人换那么勤干嘛。。。
6.
填了吧,我能帮您做,我的微信号:gary861105.电话:647-278-1105. 或扫描下方二维码,

7.
另外liner不考虑外观情况下15年没问题,pump换一个500左右,但目前10年没换过,saltsystem也是

8.
斜对面邻居找的葡萄牙人花7000, 三个人干大约前后一周填: 打掉四周,侧壁及设备运走,底部打烂,铺上草坪, 基本看不出有过泳池.
9.
填泳池可能影响排水(邻居排水)
填不需要 permit.
10. 自己开关
11. Pump Submersible Pool Pump


  1. Pump
  2. Buy 

Meditation 冥想

  1. 呼吸
1.1 腹式呼吸
1.2 OM呼吸
1.3 鼻
1.4 耳呼吸
1.5 快速呼吸
  1. 七轮

介绍及练习

English Tips and Sentences

English Tips and Sentences:
1.
The richest person is not one who has the most, but one who wants the least.
2.
Don't put all your eggs in one basket!
3.
I hear and I forget;
I see and I remember;
I do and I understand.
聞之不若見之, 見之不若知之,知之不若行之, 學至於行而止矣。
4.
The road ahead will be long. Our climb will be steep.
5.

keep fingers crossed for no more delays.