MySQL hỗ trợ tiếng Việt.
Implement Vietnamese Collation in MySQL
MySQL has yet to integrate support for Vietnamese Collation (Bug #4745). You can, in the meantime, add the missing collation simply by replacing the Index.xml file in <MySQL Server 5.x>\share\charsets directory with this Index.xml, which implements the Vietnamese collation for both utf8 and ucs2 charsets. As a result, you will have native support for both sort and compare operations in MySQL 5.x Community Server. (Be sure to restart the database server for it to read in the new collations.)
Using MySQL Administrator or Query Browser tool, you can set the Charset and Collation for Table and Columns when you get to MySQL Table Editor dialog. With the modified Index.xml installed, you can see the new Vietnamese Collations after selecting either utf8 or usc2 for Charset.
With the new collations, you can run the query as follows, assuming your table has a column with one character of the Vietnamese alphabetical set in each row:
SELECT letter FROM letters WHERE letter='a' COLLATE utf8_vietnamese1_ci;
would return ‘a’, ‘à’, ‘ả’, ‘ã’, ‘á’, ‘ạ’, and their capitals, not necessarily in any order. The same result would also be returned for any diacritical variation of the character ‘a’ in the WHERE clause.
On the other hand, the query
SELECT letter FROM letters WHERE letter='a' COLLATE utf8_vietnamese2_ci;
would return only ‘a’ and ‘A’.
To put the result set in Vietnamese alphabetical order, add the ORDER BY clause with appropriate collation:
SELECT letter FROM letters WHERE letter='a' COLLATE utf8_vietnamese1_ci ORDER BY letter COLLATE utf8_vietnamese2_ci;
References:
Aethros 9285 và 928X trên Karmic 9.10
Trên Ubuntu Karmic 9.10, các card wifi này đều hoạt động, nhưng tín hiệu kém, yếu hơn nhiều so với khi chạy trên windows.
Để có tín hiệu mạnh hơn, ta phải làm 2 việc:
- Cài đặt wicd thay cho Gnome network manager.
sudo apt-get install wicd
- Cài đặt module backport cho kernel
sudo apt-get install linux-backports-modules-karmic
Có 2 lệnh vậy thôi mà làm mình mất 2 ngày để lục lọi từ ubuntuforums đến các thể loại hầm bà lằng khác! Thật sự bó tay!
Lật ngược cái webcam lại nào!!!
Sau hai ngày lăn lộn, cuối cùng cũng lộn ngược được cái webcam của ASUS K40IN về đúng chiều! Chấm dứt 2 hôm cầm lộn ngược máy tính để skype
Thêm dòng này vào trong /etc/apt/sources.list.d/libv4l.list: deb http://ppa.launchpad.net/libv4l/ppa/ubuntu karmic main
Rồi chạy lệnh:
sudo apt-get install libv4l-0
Với mỗi 1 chương trình dùng webcam, ví dụ như skype, thay vì chạy lệnh /usr/bin/skype để kích hoạt chương trình, ta phải chạy một lệnh loằng ngoằng hơn: LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype
Done!
Ubuntu Karmic 9.10 on ASUS K40IN T6600
dinhtrung@dinhtrung-laptop:~$ lspci
00:00.0 Host bridge: nVidia Corporation MCP79 Host Bridge (rev b1)
00:00.1 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.0 ISA bridge: nVidia Corporation MCP79 LPC Bridge (rev b3)
00:03.1 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.2 SMBus: nVidia Corporation MCP79 SMBus (rev b1)
00:03.3 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.5 Co-processor: nVidia Corporation MCP79 Co-processor (rev b1)
00:04.0 USB Controller: nVidia Corporation MCP79 OHCI USB 1.1 Controller (rev b1)
00:04.1 USB Controller: nVidia Corporation MCP79 EHCI USB 2.0 Controller (rev b1)
00:08.0 Audio device: nVidia Corporation MCP79 High Definition Audio (rev b1)
00:09.0 PCI bridge: nVidia Corporation MCP79 PCI Bridge (rev b1)
00:0b.0 SATA controller: nVidia Corporation MCP79 AHCI Controller (rev b1)
00:10.0 PCI bridge: nVidia Corporation MCP79 PCI Express Bridge (rev b1)
00:15.0 PCI bridge: nVidia Corporation MCP79 PCI Express Bridge (rev b1)
00:16.0 PCI bridge: nVidia Corporation MCP79 PCI Express Bridge (rev b1)
02:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce
G102M] (rev b1)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
04:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
dinhtrung@dinhtrung-laptop:~$
dinhtrung@dinhtrung-laptop:~$
dinhtrung@dinhtrung-laptop:~$ lsusb
Bus 001 Device 002: ID 04f2:b071 Chicony Electronics Co., Ltd 2.0M UVC WebCam / CNF7129
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1c4f:0003 SiGma Micro
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
dinhtrung@dinhtrung-laptop:~$
Nói chung vấn đề lớn nhất gặp phải với dòng máy này là:
- Không cấu hình được Touchpad.
- Webcam bị lộn ngược.
- Wifi chập chờn lúc được lúc không.
Còn lại thì ổn cả.
Sử dụng Google Calendar trên Thunderbird
Để sử dụng được Google Calendar trên Thunderbird, ta phải cài 2 extension là Lightning và Provider for Google Calendar.
1.Mở Thunderbird 3.03, Công cụ > Tiện ích.
2.Trong thẻ Lấy thêm tiện ích, nhập vào từ khóa Lightning và Enter, rồi nhấn vào tiện ích Lightning.
3. Nhập tiếp Google Calendar để tìm kiếm Provider for Google Calendar, rồi cài thêm tiện ích này.
4. Khởi động lại Thunderbird.
Sau khi khởi động lại, ta có thể bắt đầu cấu hình Lightning để đồng bộ dữ liệu với Google Calendar như sau:
- Mở Lightning bằng cách chọn Sự kiện và tác vụ > Lịch.
- Chọn Tập tin > Lịch mới.
- Chọn Google Calendar.
- Mở trang calendar.google.com, bấm vào danh sách lịch và chọn Cài đặt lịch cho cuốn lịch muốn đồng bộ.
- Nhấp vào nút XML ở phần Địa chỉ lịch. Cóp vào trong Thunderbird.
Điền Form với jQuery Populate.
jQuery Populate là một plugin giúp tự động điền dữ liệu vào form từ một chuỗi JSON. Plugin này giúp ta tự động điền giá trị của Form ngay khi người dùng mở trang web, hoặc cập nhật thông tin từ server.
Với PHP5, ta có thể cung cấp json dễ dàng nhờ hàm json_encode() được tích hợp sẵn.
Ví dụ đơn giản:
<form id="my-form" method="post">
<label>Username</label>
<input name="username" value="" id="username" maxlength="40" type="text"><br>
<label>Role</label>
<select name="role" id="role">
<option value="0">admin</option>
<option value="1">editor</option>
<option value="2">user</option>
</select><br>
<label>Sex</label>
<input name="sex" value="male" class="check" id="aa8da" type="radio">
<input name="sex" value="female" class="check" id="c19cb" type="radio">
<input name="sex" value="unknown" class="check" id="ccf23" type="radio">
<hr>
<input name="submit" value="Gửi" id="submit" type="submit">
<input name="reset" value="Nhập lại" id="reset" type="reset"><br>
</form>
<button type="button" id="populate-form">Populate Default Values<button>
<button type="button" id="request-populate-form">Request and Populate</button>
<script type="text/javascript">
$(document).ready(function(){
$("#populate-form").click(function(){
$("#my-form").populate({"username" : "Username that you like", "Role" : 1, "Sex" : "unknown"});
});
$("#request-populate-form").click(function(){
$.getJSON("populate.php", function(jsonobj){$("#my-form").populate(jsonobj)});
});
});
</script>
Ở form trên, có 2 nút. Nút Populate Default Value demo việc sử dụng jQuery Populate để điền form ngay khi người dùng mở trang web.
Nút Request and Populate demo việc gửi một truy vấn tới server, cụ thể là tới file populate.php để lấy các giá trị cần điền vào form. Trên server ta cần tạo thêm một PHP file tên là populate.php với nội dung sau:
<?php
$data = array('username' => 'demo', 'role' => 2, 'sex' => 'unknown');
echo json_encode($data);
?>
Trung đổi số điện thoại, mong mọi người update giúp.
Hi all,
Tuần vừa rồi mình mất máy di động nên giờ số điện thoại cũ : 01685287522 mình không còn sử dụng nữa.
Hiện tại mình đang dùng hai số này:
- 0926843166
- 01997785235
Mong mọi người update lại giúp Trung nhé. Thanks.
Sử dụng tính năng tạo bài viết qua Email trên WordPress
WordPress cho phép ta tạo các bài viết thông qua Email.
Sau khi đăng nhập vào WordPress admin (http://yourname.wordpress.com/wp-admin), ta chọn mục Trang web của tôi.
Trong trang này, ta thấy ở phía bên phải có cột Post by Email. Bấm dấu kiểm trong hộp đó, ta nhận được một địa chỉ email đặc biệt để gửi bài viết tới.
Ngoài ra, ở ngay cột trước đấy, ta còn có thể yêu cầu WordPress lấy tin từ Facebook, Twitter và đăng tải lên ngay khi ta viết tin trên các ứng dụng này. Quy trình sẽ bao gồm việc đăng nhập vào tài khoản Facebook hay Twitter để xác nhận.
Xóa dữ liệu trùng lặp trong MySQL
Với 3 lệnh đơn giản, ta có thể lọc toàn bộ một bảng MySQL, xóa đi các dòng có một trường giống nhau.
mysql > CREATE TABLE new_table as
--------> SELECT * FROM old_table WHERE 1 GROUP BY [tên_cột_cần_lọc];
mysql > DROP TABLE old_table;
mysql > RENAME TABLE new_table TO old_table;
Peace of cake, huh?
leave a comment