Skip to content

Instantly share code, notes, and snippets.

@csiebear
csiebear / MainForm.cs
Created January 30, 2019 07:44
C#(03)-SimpleTutorial-OpenCloseSubForm
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@csiebear
csiebear / R_Boxplot_v2.R
Created July 24, 2018 14:26
S01_P2_加工時間資料集的盒鬚圖加上敘述統計值
#讀取資料
mydata=read.table("30minUp_2.txt")
#檢視資料
summary(mydata)
#繪製一個盒鬚圖
boxplot(mydata$V1, staplewex = 1, xlab = "Process Time", col = "gray")
#加上標題
title("Process time boxplot")
#在指定位置加上數值說明
text(y = boxplot.stats(mydata$V1)$stats, labels = boxplot.stats(mydata$V1)$stats, x = 1.25)
@csiebear
csiebear / R_Boxplot_v1.R
Last active July 24, 2018 14:14
Draw a boxplot and add the some value in boxplot
#創造一個測試的資料集
c<-1:100
#對c會製一個盒鬚圖,並存入test_boxplot
test_boxplot<-boxplot(c, ylab = "value", col = "gray")
#檢視boxplot的敘述統計的值
test_boxplot$stats
#透過text在目前的繪圖系統中的指定位置加入文字
text(y = boxplot.stats(c)$stats, labels = boxplot.stats(c)$stats, x = 1.25)
@csiebear
csiebear / LBC.cpp
Created June 17, 2018 05:01
Line Balance Calculation
//作者:李碩軒
//日期:2018/06/17
//說明:LBC為Line Balance Calculation的縮寫,目的在於計算生產線中,分段後的可能線平衡綠。
//首先要根據可能的切點,找出所有可能組合,放到第一個可產出文件:AllPossibleSubset.txt。此處找出集合的方法,請參考http://www.applied-math.org/subset.pdf
//再設定第二個檔案串流,讀取AllPossibleSubset,然後計算可能解的數量(由於一個可能解,後面都會有一個\n,所以看有幾個\n就有幾組解)
//再逐一計算每個可能解於三種零件的分段工時加總,分別放到topSeg,botSeg,stdSeg(也就是生產上/下/立 管的生產線的分段加工時間加總)
//最終將檔案輸出到ConstraintResult.txt
#include <iostream>
#include <vector>
#include <algorithm>
@csiebear
csiebear / SearchSpecificCharAppearTimes.sql
Created January 24, 2018 09:37
Using the replace to find the specific char appearance times
/*
程式目的:查詢特定字元於某資料庫欄位(字元)出現次數。
範例解釋:以123x456x123x456此字串為例,找尋字元x出現的次數,結果顯示會查詢到3次x
詳細解釋可參考http://shuohsuanli-bear.blogspot.tw/2018/01/sql.html
程式撰寫者:李碩軒
日期:2018/01/24
*/
SELECT
T.STRING
@csiebear
csiebear / TestConnect.sql
Created May 2, 2017 03:24
After connecting SQL Server,try to query some data
<?php
$conn = mssql_connect("Localhost SQL Server Name", "sa", "Password");
//select the database table and check if it exists or not
if($conn){
echo '連接伺服器成功(Connection success)<br>';
}else{
echo '連接伺服器失敗(Connection fail)<br>';
}
//The below two lines is help to remove the error message
$result = mssql_query("SET ANSI_NULLS ON") or die(mssql_get_last_message());
@csiebear
csiebear / NotepadForm.cs
Created May 1, 2017 14:06
Windows Notepad example_savefiledialog setting
private void ToolStripMenuItem_13_Click(object sender, EventArgs e)
{
//new one savefiledialog
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
//Rename the title as 儲存檔案(Differentiate the dialog title from the 另存新檔)
saveFileDialog1.Title = "儲存檔案";
//Set the default name
saveFileDialog1.FileName = "新記事本檔案.txt";
saveFileDialog1.Filter = "Text File | *.txt";
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
/*
課本練習題
課本名稱:新思維系列 Visual C# 2015 程式設計
題目:撰寫一個程式,令它使用二維陣列存放下列元素,然後在二維陣列內搜尋最
大值及最小值,並顯示其索引。
二維陣列:
{ { 21, 22, 23, 23, 25, 26 }, { 11, 12, 13, 14, 15, 16 }, { 1, 2, 3, 4, 5, 6 } }
程式撰寫者:李碩軒
日期:2017/03/14
*/
@csiebear
csiebear / PHP_LDAP.php
Last active November 19, 2016 08:23
Test php ldap function and list some data
//First part,for testing the AD server is work or not
//Second part,for searching the specified CN and listing them
<?php
$ldaphost="domain name";
$ldapconn=ldap_connect($ldaphost);
if($ldapconn)
echo "Connect success<br>";
else
echo "Connect Failure";
//For simplification,you can wirte $ldapconn = ldap_connect($ldaphost)or die("Could not connect to ".$ldaphost);
@csiebear
csiebear / PHP_LDAP_1.php
Last active October 4, 2021 11:20
Test php ldap function
//domain name(or URL),account,password should replace with actual string
<?php
//For testing the AD server is work or not
$ldaphost="domain name";
$ldapconn=ldap_connect($ldaphost);
if($ldapconn)
echo "Connect success<br>";
else
echo "Connect Failure";
//For simplification,you can wirte $ldapconn = ldap_connect($ldaphost)or die("Could not connect to ".$ldaphost);