Chủ Nhật, 1 tháng 2, 2015

Hướng dẫn gán địa chỉ IP trong Debian

Using a static IP can be very useful in case you wish to easily access your RPi without need to get its IP address every time it boots or reconnects to the network (i.e. using SSH, (S)FTP services).
To achieve this there are a few quick steps to be followed.

Thứ Năm, 22 tháng 1, 2015

Domain Controller starts up in Safe Mode

Challenge
After doing a full Virtual Machine restore, Instant Recovery, or testing of a Replica, you will find that the Virtual Machine boots up in what appears to be safe mode.
When the Domain Controller boots for the first time it is actually in Active Directory services restore mode.

Cause
This is normal for this to happen as we're booting from a backup file, however it should reboot automatically.

Solution
Login with the Directory services restore mode account (typically .\administrator) and open a command prompt and run the following:
C:/>bcdedit /set safeboot dsrepair
C:/>bcdedit /deletevalue safeboot
C:/>shutdown -t 01 -r
Afterwards it should reboot in normal mode.

Chủ Nhật, 12 tháng 1, 2014

Basic1_ Tạo button trong C# và tạo sự kiện

Tạo một Form như sau:

  • button 1 có tên là button1
  • textbox có tên là textbox1
Yêu cầu:
  • Nhập vào textbox 1 số n và click vào nút button1, kết quả sẽ hiện ra các button từ 1 đến n có name là btn1, btn2, btn3,...
  • Khi click vào nút btn2 hiện ra messagebox "bạn đã chọn vào btn2".

private void button1_Click(object sender, EventArgs e)
        {
            string x=textBox1.Text;
            for (int i = 0; i <= int.Parse(x); i++)
            {
                Button nut = new Button();
                nut.Text = "Nut thu" + i;
                nut.Name = "nut" + i;
                nut.Location = new Point(200, 50+30 * i);
                this.Controls.Add(nut);
                nut.Click += new EventHandler(nut_Click);
            }

        }


Viết sự kiện nut_Click khi click vào nút.
void nut_Click(object sender, EventArgs e)
        {
            string x = ((Button)sender).Text;
            string n = ((Button)sender).Name;
            if(n=="nut1")
            MessageBox.Show("Ban vua click vao" + x);


        }


Thứ Sáu, 27 tháng 12, 2013

4_ Viết chức năng thêm sửa xóa trong window form

Thiết kê 1 form quản lý sinh viên bao gồm 2 textbox, 4 btn thêm ,sửa , xóa, hiển thị, và 1 datagirdview như hình bên dưới

3_ Thao tác trên cơ sở dữ liệu sử dụng dataset,dataadapter,datatable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;


2_Thực thi câu truy vấn SQL trên C#

1. Lấy ra họ tên và mã số sinh viên từ table sinh viên

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

1_ Kiểm tra Kết nối cơ sở dữ liệu trong C#

Để kết nối với cở sở dữ liệu,  Phải khai báo namespace "System.Data.SqlClient".

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient; //namespace de thao tac voi CSDL