機緣
沒想到不知不覺在CSDN創(chuàng)作就512天了,想到一開始就僅僅想在CSDN記筆記,到現(xiàn)在成為一個小博主,認識到了很多志同道合的伙伴,中間創(chuàng)作我也曾經(jīng)懶惰過,放棄過,但我一次又一次重新進行創(chuàng)作,雖然我是上了大學才開始了解程序員,成為程序員(可能現(xiàn)在還不合格),但我想在這個過程中留下一些什么,去證明我曾經(jīng)也努力過。但現(xiàn)在逐漸成了一種習慣,適應了,改不了了。
收獲
提示:在創(chuàng)作的過程中都有哪些收獲
例如:
- 獲得了6383粉絲的關(guān)注
- 獲得了3565次點贊、3556次評論、149176次閱讀量等
- 認識白佬,山河亦問安,小吉等等等等很多優(yōu)秀的人,可能有的只是在CSDN簡單聊過天,有的加了聯(lián)系方式,經(jīng)常交流,但記憶這東西不可能一下消散,可能以后會忘記,但我現(xiàn)在還記得!
- 還要很多很多其他收獲
?始終相信努力就會有收獲
日常
提示:當前創(chuàng)作和你的工作、學習是什么樣的關(guān)系
例如:
- 創(chuàng)作是否已經(jīng)是你生活的一部分了:是。
- 有限的精力下,如何平衡創(chuàng)作和學習:學習之外是創(chuàng)作,創(chuàng)作之外是學習?;蛘哒f創(chuàng)作也是另一種學習。
成就
提示:你過去寫得最好的一段代碼是什么? 請用代碼塊貼出來
使用JDBC+javafx寫一個簡單功能齊全的圖書管理系統(tǒng)_javafx圖書管理系統(tǒng)_冷兮雪的博客-CSDN博客
package com.hk.sky.bookmanager;
import com.hk.sky.bookmanager.bean.Admin;
import com.hk.sky.bookmanager.controller.LoginController;
import com.hk.sky.bookmanager.dao.AdminDao;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class BookManagerApplication extends Application {
AdminDao adminDao=new AdminDao();
//獲取上一次用戶登錄的信息
Admin admin=adminDao.getLast();
@Override
public void start(Stage stage) throws IOException {
//登錄頁面的資源文件為login/login.fxml
FXMLLoader fxmlLoader = new FXMLLoader(BookManagerApplication.class.getResource("login/login.fxml"));
//設(shè)置登錄窗口的長和寬
Scene scene = new Scene(fxmlLoader.load(), 290, 240);
stage.setTitle("管理員登錄");
stage.setScene(scene);
LoginController loginController=fxmlLoader.getController();
//如果admin不是為null,則說明上一次有用戶登錄,則直接在登錄頁面顯示賬號和密碼
if (admin!=null)
loginController.set(admin.getAccount(),admin.getPassword());
stage.show();
}
//啟動
public static void main(String[] args) {
launch();
}
}
package com.hk.sky.bookmanager.utils;
import java.io.IOException;
import java.sql.*;
import java.util.Properties;
/**
* 封裝數(shù)據(jù)連接,關(guān)閉的工具類
*/
public class DBUtils {
private static String url;
private static String username;
private static String password;
// 讀取配置文件
static {
Properties prop = new Properties();
try {
// DBUtils.class.getClassLoader().getResourceAsStream()方法可以從類路徑中讀取資源文件
prop.load(DBUtils.class.getClassLoader().getResourceAsStream("db.properties"));
// 通過key獲取value
url = prop.getProperty("jdbc.url");
username = prop.getProperty("jdbc.username");
password = prop.getProperty("jdbc.password");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// 將創(chuàng)建連接的方法封裝成靜態(tài)方法,方便調(diào)用
// 如何將url、username、password放到配置文件當中,然后讀取出來
public static Connection getConnection() {
// 創(chuàng)建連接的時候,有會異常:SQLException,不建議拋出,建立捕獲
Connection conn = null;
try {
conn = DriverManager.getConnection(
url,
username,
password
);
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
// 將關(guān)閉連接的方法封裝成靜態(tài)方法,方便調(diào)用
public static void close(ResultSet rs, PreparedStatement pStmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (pStmt != null) {
try {
pStmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
Spring + Spring MVC + MyBatis_冷兮雪的博客-CSDN博客?
package com.example.springbootdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication//SpringBoot項目的入口 啟動注解
public class SpringBootdemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootdemoApplication.class, args);
}
}
package com.example.springbootdemo;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@Controller//當前類為控制器
@ResponseBody//返回的是數(shù)據(jù),而非頁面
/*@RestController*/ //復合注解 = @Controller+@ResponseBody
public class TestController {
//請求映射 url 路由注冊
@RequestMapping("hi")
public String sayHi(String s){
//為空為null 默認值處理
//if (s==null||s.equals("")){} 正常寫法
if(!StringUtils.hasLength(s)){ //Spring中更簡單的寫法 判斷是否有長度
s="張三";
}
return "你好"+s;
}
}
八大排序[超級詳細](動圖+代碼優(yōu)化)這一篇文章就夠了_冷兮雪的博客-CSDN博客?
public static void bubbleSort(int[] arr) {
int len = arr.length;
for (int i = 0; i < len - 1; i++) {
for (int j = 0; j < len - 1 - i; j++) {
if (arr[j] > arr[j+1]) {
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
}
import java.util.Arrays;
public class Main {
public static void bubbleSort(int[] arr) {
int len = arr.length;
for (int i = 0; i < len - 1; i++) {
for (int j = 0; j < len - 1 - i; j++) {
if (arr[j] > arr[j+1]) {
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
System.out.print("第 "+(i+1)+" 趟,第 "+(j+1)+" 次比較后的結(jié)果:");
System.out.println(Arrays.toString(arr));
}
}
}
public static void main(String[] args) {
int[] arr={2,9,7,15,49,10};
System.out.println(Arrays.toString(arr));
bubbleSort(arr);
}
}
憧憬
未來可能無限,先提升自己,希望吃上程序員這碗飯。同時希望交到更多的志同道合的伙伴,一起加油。
文章來源:http://www.zghlxwxcb.cn/news/detail-514780.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-514780.html
到了這里,關(guān)于我的創(chuàng)作紀念日——512的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!