Skip to content

Instantly share code, notes, and snippets.

View tedliou's full-sized avatar

Ted Liou tedliou

View GitHub Profile
SqlConnection sql = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;Connect Timeout=30");
SqlCommand cmd = new SqlCommand("select * from [Table]", sql);
sql.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
listView1.Items.Insert(0, reader[0].ToString());
listView1.Items[0].SubItems.Add(reader[1].ToString());
SqlConnection sql = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;Connect Timeout=30");
SqlCommand cmd = new SqlCommand("UPDATE [Table] SET test = 'My Name is TedLiou'", sql);
sql.Open();
cmd.ExecuteNonQuery();
sql.Close();
Public Class Form1
Public img4 As Integer = 1
Public img3 As Integer = 0
Public img2 As Integer = 0
Public img1 As Integer = 0
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = True
Timer1.Interval = 10
@echo off
TITLE PocketMine-MP server software for Minecraft: Pocket Edition
cd /d %~dp0
if exist bin\php\php.exe (
set PHPRC=""
set PHP_BINARY=bin\php\php.exe
) else (
set PHP_BINARY=php
)
<iframe src="https://freesecure.timeanddate.com/countdown/i546pcp4/n241/cf110/cm0/cu4/ct0/cs0/ca0/cr0/ss0/cac000/cpc000/pca0bfd5/tcbfd2f0/fs100/szw320/szh135/tat~%E9%87%8E%E8%B1%AC%E9%A8%8E%E5%A3%AB%E4%BE%86%E5%96%94~/tac000/tptTime%20since%20Event%20started%20in/tpc000/mat~~%E9%A8%8E%E5%A3%AB~~%E9%A8%8E%E5%A3%AB~~/mac000/mpc000/iso2016-05-20T00:00:00/bo2" allowTransparency="true" frameborder="0" width="322" height="137"></iframe>
@tedliou
tedliou / 消數字遊戲.cs
Last active April 6, 2016 15:24
依照1~9的順序按下按鈕,看誰速度最快...
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;
namespace 數字消消樂
@tedliou
tedliou / vb_2-1.vb
Created April 7, 2016 04:53
姓名和分數的陣列運用
Public Class Form1
Dim name_(5) As String : Dim copy_name_(5)
Dim score_(5) As Integer : Dim copy_score_(5)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Clear()
TextBox1.Text &= "名字" & vbTab & "分數" & vbNewLine
For j = 0 To 5
name_(j) = InputBox("請輸入名字")
score_(j) = InputBox("請輸入分數")
TextBox1.Text &= name_(j) & vbTab & score_(j) & vbNewLine
@tedliou
tedliou / Program.cs
Created September 17, 2016 10:32
DecimalToBinary
using System;
using System.Collections.Generic;
namespace DecimalToBinary
{
class Program
{
static void Main(string[] args)
{
int question = 87;
@tedliou
tedliou / Wordpress RSS To JSON
Created March 6, 2018 01:07
Wordpress RSS To JSON
<?php
$target_feed = 'http://' . $_SERVER['HTTP_HOST'] . '/feed';
//echo $target_feed;
$target_array = (array) simplexml_load_file($target_feed);
$temp_array = ((array) $target_array['channel'])['item'];
$output_array = array();
foreach ($temp_array as $data) {
@tedliou
tedliou / example_start
Created July 1, 2018 18:31
如何在背景建立 Screen 終端機與發送指令至指定窗口
screen -dmS example
screen -S example -X stuff htop^M