Optimize performance
Khanh is a full stack web developer with over 15 years of experience developing for the web
Search for a command to run...
Khanh is a full stack web developer with over 15 years of experience developing for the web
No comments yet. Be the first to comment.
Elevate your bus reservation experience (or even movie, theater, train, ship, plane tickets) with the React Bus Seat Map Picker – a sophisticated and meticulously crafted script designed exclusively for bus seat bookings. Engineered with strict TypeS...

In previous blog, I migrated all posts from my WordPress to Hashnode at https://blog.donamkhanh.com. Now I create a simple landing page for my main domain and hosted on Github Page. You can access at https://donamkhanh.com. In feature, I'm going to h...

I just finished migrating my blog from Wordpress (self hosted on DigitalOcean) to Hashnode. How did I migrate? I don't have too many articles on Wordpress but I don't like doing it manually so the first thing I did was look to see if there was an aut...

Dự án mình đang làm có yêu cầu sử dụng Azure Active Directory (AAD) để lưu trữ thông tin người dùng & xác thực đăng nhập các kiểu. Ngoài các trường thông tin cơ bản mà AAD hỗ trợ ra thì dự án mình cần lưu thêm 1 số thông tùy chọn khác cho người dùng....

Introduction This is a concise front-end application developed with Angular. You can create a beautiful form with drag and drop visualization. You can get inspiration from it to make a draggable form; at the same time, you can also modify it to suit ...

Dự án e-store tôi đang thực hiện đã sang phase II. Do đã tạo một số lượng không nhỏ các shop demo (khoảng 1500 - mặc dù yêu cầu là 5000 cái :() nên chức năng update toàn bộ các shop là chức năng bắt buộc phải có trong phase II này.
Ban đầu cứ nghĩ việc này khó, nhưng đến khi bắt tay vào làm mới thấy chẳng khó tý nào nếu không muốn nói là dễ :p
Với 3 yêu cầu này, không khó để thực hiện. Tuy vậy tôi vẫn bị vướng 1 chỗ & vẫn chưa nghĩ ra cách giải quyết nào triệt để, đó là vấn đề khi lấy toàn bộ các tên shop (shop code = thư mục) để copy file vào. Nếu trên môi trường Windows, chưa có cách nào khả thi hơn ngoài việc đọc dữ liệu trong DB. Cách này đơn giản nhưng khoảng thời gian để đọc từ DB ra cũng chẳng phải ít :( Còn trên Linux thì có vẻ dễ chịu hơn nếu như safe_mode = off :-" Tôi dùng command để đọc các thư mục shop hiện có, loại trừ đi mấy thư mục hệ thống. Hàm cụ thể như sau:
/** * get all shop * @author khanhdn * @return array */ function getAllShop() { $shops = array('shop_temp');
if(!isLinuxOS()) { $query = db_query("SELECT shop_code FROM {shop_setting} ORDER BY shop_code");
while($rs = db_fetch_array($query)) { if(is_dir('../'.$rs['shop_code'])) { $shops[] = $rs['shop_code']; } } } else { $systemFolder = array( 'system' ,'sites' ,'scripts' ,'profiles' ,'googlecheckout' ,'themes' ,'tmp' ,'googleerror.log' ,'googlemessage.log' ,'index.php' ,'mysqldumper' ,'phpinfo.php' );
$shopFolder = array(); exec('cd ../; ls;', $shopFolder);
$shops = array_diff($shopFolder, $systemFolder); }
return $shops; }
Thật ra thì đây chỉ là cách làm đối phó. Nếu hệ thống lớn chắc chắn vẫn không ổn. Chắc là phải làm việc ở mức thấp hơn nữa :-s