HTML table sort

Check if you could go with any of the below mentioned JQuery plugins. Simply awesome and provide wide range of options to work through, and less pains to integrate. 🙂 https://github.com/paulopmx/Flexigrid – Flexgrid http://datatables.net/index – Data tables. https://github.com/tonytomov/jqGrid If not, you need to have a link to those table headers that calls a server-side script … Read more

Sort directory files by creation datetime in Windows filesystem

On windows the CTime is the creation time, use the following: <?php $files = array(); foreach (new DirectoryIterator(‘/path’) as $fileInfo) { $files[$fileInfo->getFileName()] = $fileInfo->getCTime(); } arsort($files); After this $files will contain an array of your filenames as the keys and the ctime as the values. I chose this backwards representation due to the possibility of … Read more

How to sort a list of dictionaries by a value of the dictionary in Python?

The sorted() function takes a key= parameter newlist = sorted(list_to_be_sorted, key=lambda d: d[‘name’]) Alternatively, you can use operator.itemgetter instead of defining the function yourself from operator import itemgetter newlist = sorted(list_to_be_sorted, key=itemgetter(‘name’)) For completeness, add reverse=True to sort in descending order newlist = sorted(list_to_be_sorted, key=itemgetter(‘name’), reverse=True)