Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Demo



  Use rsync to delete mass files quickly in Linux

Yesterday I encountered an issue to delete many log files in my Linux workstation, there were around 100,000 files to be deleted. These are log files and they grow very fast, and we need to delete them frequently. Usually we would use rm -rf * to delete these files, but we may need to wait for a relative long time if there are too many files. So we must adopt some unusual way. Fortunately, we can use rsync to delete mass files in one shot. 1. Install rsync yum install rsync 2. Create a new empty...

   rsync,delete file, demo     2012-11-13 10:44:50

  Using DateInterval class in PHP

DateInterval is (amongst others) a relatively new addition to the date extension in PHP 5.3. It allows to describe an interval in time, and you can perform actions with that interval. Basically, it allows to calculate with dates in a very easy way, and do even more fun stuff with it.Unfortunately no documentation exists today for DateInterval and friends, but PHP is open-source so you can easily have a peek at the code to see what’s happening under the engine. This is more or less what th...

   PHP,DateInterval,Class,PHP 5.3,Demo     2011-10-21 10:35:54

  A New Experimental Feature: scoped stylesheets

Chromium recently implemented a new feature from HTML5: scoped stylesheets, aka. <style scoped>. A web author can limit style rules to only apply to a part of a page by setting the ‘scoped’ attribute on a <style> element that is the direct child of the root element of the subtree you want the styles to be applied to. This limits the styles to affect just the element that is the parent of the <style> element and all of its descendants. Example Here’s a...

   HTML5,Style,Draw,Use case     2012-03-23 12:11:47

  JS code to check different mobile devices

Today I come across a code snippet which uses JavaScript to check different mobile devices and then loads different CSS files accordingly. As we know that there are mobile devices with different screen sizes, it's always troublesome for web developers to develop cross browser and cross device compatible codes. Hope this one can help those who develop web apps on mobile devices. // Check whether it's a mobile device // wukong.name 20130716 if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (...

   JavaScript,Mobile device,Detection     2013-11-28 05:25:10

  CSS filter effects in action

CSS filter effects in action Ever since CSS filter effects landed in WebKit, I thought about theirs practical implementation. How will they fit with the current web design trends? At this time, my initial impressions are that the best way to showcase the power of CSS filters is something like an image gallery. With so many CSS filters to choose from, it will be fun to create image galleries in the future. Further in this article we’ll cre...

   CSS,filter effect     2012-05-02 05:57:11

  Understand diff in Unix

diff is an important tool program in Unix. It is used to compare differences of two files, it is the foundation for code version control. If you type : $ diff <file_before_change> <file_after_change> diff will tell you what's the difference between these two files. The result may not be so easy to understand, so now I will show you how to understand diff. 1. 3 formats of diff diff has 3 formats due to historic reasons. normal diff context diff unified diff 2. Demo files For easy d...

   diff,Unix,version control,git     2012-09-03 10:49:36

  File upload once again

File upload is one of the oldest operation of web design. After 20 years, it's still has no big change, difficult to handle, lack of interaction and poor user experience. Web developers have thought many methods to improve the experience of uploading file in web apps, they developed various plugins based on different JavaScript libraries. However, because of the difference among different web browsers, there is no common interface which makes these plugins work properly or easily on all web brow...

   Web design, File upload, Asynchronous,HTML5     2012-09-02 11:52:21

  Fuzzy search algorithm in Sublime Text

Fuzzy string searching is the technique of finding strings that match a pattern approximately (rather than exactly. In many editors, we can easily find the Find menu item to do exact matching. While in Sublime Text and some other editors, we can use fuzzy string searching as well if we just want to have an approximate match. There is some algorithm implemented in Sublime Text to implement achieve this. First the search query is split into characters, join them with a regex wildcard, and then run...

   Sublime Text,Fuzzy search     2013-10-14 22:49:38

  Different types of keystore in Java -- JKS

JKS is Java Keystore, a proprietary keystore type designed for Java. It can be used to store private keys and certificates used for SSL communication, it cannot store secret keys however. The keytool shipped with JDKs cannot extract private keys stored on JKS. This type of keystore usually has an extension of jks. Next we will show how to operate the JKS keystore with pure Java code. Create JKS keystore The simplest method to create a JKS keystore to create an empty keystore. We can first get an...

   DEMO,EXAMPLE,KEYSTORE,JKS     2014-09-05 20:21:51

  Different ways of handling concurrent job in GoLang

GoLang provides very good support of concurrency and the way to make some code to run concurrent is pretty simple and straightforward. Adding a simple go before a normal function call will make the function call asynchronous. In real cases normally people would concurrently run some jobs to improve the speed and efficiency. One important part of running jobs concurrently is about aggregating results so that the consequent function call would be able to proceed. There are multiple ways handling t...

   COMPARISON,WORKER POOL,WAITGROUP,CONCURRENT     2021-05-15 11:13:53