我的创作纪念日

机缘

笔记

   刚开始写博客时只是想把平时所积累的知识做一个记录,方便自己查看(就像做笔记一样),毕竟自己亲手写的东西,可以加强记录; 而且,作为一名普通的程序员,常年撰写代码,缺乏与他人的交流,也希望通过写博客的方式来锻炼与他人交际沟通方面的能力。除此之外,我也有经常阅读博客或者一些技术文章的习惯,很欣赏写博文记录自己的技术成长以及经验心得的这些大佬,所以也想自己尝试一下。
 


收获

收获

  在创作早期的过程中,其实过程是很艰难的,毕竟老话说得好:万事开头难。我一开始写的内容都是从我的笔记中摘抄的,经常用到的内容,比如 还在找数据库日期如何格式化嘛?看这一篇文章就够了,后面写的多了,也就大概掌握了一些技巧和东西,比如这篇文章:什么是原码、反码和补码,阅读量破万,也给我吸粉不少。在此期间我还结识了一些大佬,比如@跟着飞哥学编程、@跟着飞哥学编程和@跟着飞哥学编程,这其中@跟着飞哥学编程给了我很大的帮助,虽然他并没有直接教我什么,如果没有他一直的鼓励和支持,就不会有现在的我,这是我第一次从陌生人身上得到了一种莫名的认同感和归属感,自此,我也相信自己可以创作出更优质的博文。
 


日常

  对于我来说,创作是生活中必不可少的一部分,就像读书一样,写作业是我的“精神食粮”,但是人要工作的嘛,所以大部分时候,我都会,让我天天更文可能不行,不过偶尔来个更文是可以的,正可谓子曰:“学而时习之,不亦说乎?”
 
二进制

 


成就

  我认为写的最好的,应该是下面这段控制台日历的代码,因为这是初学 Java 语言时,第一次完全靠自己写出来,思路也是自己想的,所以我觉得这是写的最好的,没有之一:

/**
 * 项目说明:利用Java控制台文本库实现日历的特效
 * 开发日期:2020年4月26日
 * 开发人员:兰柯万 QQ-1733100391
 */
import java.util.Random;
import java.util.Scanner;
import java.math.BigDecimal;
import java.math.BigInteger;
import static javaconsole.JavaConsole.*;
import java.util.Scanner;

/**
 *    Copyright (c) [Year] [name of copyright holder]
 *    [Software Name] is licensed under Mulan PSL v2.
 *    You can use this software according to the terms and conditions of the Mulan PSL v2.
 *    You may obtain a copy of Mulan PSL v2 at:
 *             http://license.coscl.org.cn/MulanPSL2
 *    THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *    See the Mulan PSL v2 for more details.
 *
 *
 *                      Mulan Permissive Software License,Version 2
 *
 *    Mulan Permissive Software License,Version 2 (Mulan PSL v2)
 *    January 2020 http://license.coscl.org.cn/MulanPSL2
 *
 *    Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
 *
 *    0. Definition
 *
 *       Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
 *
 *       Contribution means the copyrightable work licensed by a particular Contributor under this License.
 *
 *       Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
 *
 *       Legal Entity means the entity making a Contribution and all its Affiliates.
 *
 *       Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
 *
 *    1. Grant of Copyright License
 *
 *       Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
 *
 *    2. Grant of Patent License
 *
 *       Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
 *
 *    3. No Trademark License
 *
 *       No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
 *
 *    4. Distribution Restriction
 *
 *       You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
 *
 *    5. Disclaimer of Warranty and Limitation of Liability
 *
 *       THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 *    6. Language
 *
 *       THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
 *
 *    END OF THE TERMS AND CONDITIONS
 *
 *    How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
 *
 *       To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
 *
 *       i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
 *
 *       ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
 *
 *       iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
 *
 *
 *    Copyright (c) [Year] [name of copyright holder]
 *    [Software Name] is licensed under Mulan PSL v2.
 *    You can use this software according to the terms and conditions of the Mulan PSL v2.
 *    You may obtain a copy of Mulan PSL v2 at:
 *                http://license.coscl.org.cn/MulanPSL2
 *    THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *    See the Mulan PSL v2 for more details.  
 */

/**
 * 根据输入的日期
 * 展示对应的月历
 */
public class Date {

	static int year;
	static int month;
	static int day;
	static String base = "一二三四五六日";
	static int date[] = {31,28,31,30,31,30,31,31,30,31,30,31,};

	public static void main(String[] args) {
		//T0D0 Auto-generated method stub
		
		Init();			/*初始化日期	*/
		getInput();		/*读取数据		*/
		printDate();	/*进行转换		*/
		

	}
	public static void Init(){
		//Initialized
		Random r = new Random();
		set_color(0x0, r.nextInt(15)+1);
		set_size(120,80);
		set_title("兰柯的日历");
		hide_cursor();
		
		gotoxy(50,0);
		set_color(r.nextInt(15)+1, r.nextInt(15)+1);
		System.out.println("万年日历V2.1.1版");
		set_color(0, r.nextInt(15)+1);
	}

	public static void getInput(){
		//deal with
		Random r = new Random();
		Scanner in = new Scanner(System.in);
		System.out.print("请输入年月日(空格隔开):");
		year = in.nextInt();
		month = in.nextInt();
		day = in.nextInt();
		
		System.out.printf("\n\n");
		set_color(0, r.nextInt(15)+1);
		in.close();
	}

	public static void printDate(){
		
		Random r = new Random();
		int i;	
		int week = 0;	// 用来存储每年的1号是星期几
		int sum = 0;		// 用来存放输入年份的总天数
		/*用于处理月份第一天*/
		int Today = 1;
		int Toweek = 0;
		/*判断是否为闰年*/
		if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) date[1] = 29;
		// 处理闰年问题
		for (i = 1; i < year; i++) {
			if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
				week += 2;
			}  else	{
				week += 1;
			}
		}
		
		//得出输入年份的天数
		for (i = 0; i < month - 1; i++) {
			sum += date[i];
		}
		/*算出输入年份到月份第一天的天数*/
		Today = sum;		
		Toweek = week;
		//得出此时是星期几
		sum += day;
		week = (sum+week)%7;
		// 计算特殊情况,如果刚好整除的话,说明是周末
		if(week == 0) {
			week = 7;
		}
//		System.out.println("week = "+week);
	
		//Export informations
		System.out.println(year + "年" + month + "月" + day + "日是星期" +base.charAt(week - 1)+"!");
		set_color(0x0, r.nextInt(15)+1);
		System.out.println("===================================================\n\nMon\tTue\tWed\tThu\tFri\tSat\tSun\n\n===================================================\n");
//		System.out.println("Toweek = "+Toweek);
		Toweek = (Today+Toweek) % 7;
		
//		System.out.println("Toweek = "+Toweek);
		for (i = 0; i < Toweek; i++) {
			System.out.print("\t");
		}
		int cnt = Toweek + 1;
		for (i = 1; i <= date[month - 1]; i++,cnt++) {
			set_color(0x0,r.nextInt(15)+1);
			System.out.print(i + "\t");
			if (cnt%7==0) {
				System.out.println("\n");
			}
			
		}
		System.out.println("\n\n===================================================");
	}
}

下面是实现效果,加上了一些控制台函数的第三库,所以效果还可以:
 
实现效果


憧憬

希望未来会越过越好

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值