archive

Woocommerce - Display Featured Products at top of Category Page

烂漫一生 提交于 2020-07-14 10:59:31
问题 I want to have a section at the top of each product category page that shows three featured products at random from that category. Beneath this would be the regular archive loop. What's the best way to achieve this, without using a plugin? 回答1: Below code can help you: add_filter('posts_orderby', 'show_featured_products_orderby',10,2); function show_featured_products_orderby($order_by, $query){ global $wpdb ; if( ($query->get('post_type')=='product') && (!is_admin()) ){ $orderby_value = (

Rename duplicate files in a zip file Java

别来无恙 提交于 2020-06-29 07:28:10
问题 I have several files including duplicates which I have to compress into an archive.Do you know some tool able to rename duplicate files before creating the archive ex(cat.txt, cat(1).txt, cat(2).txt ...)? 回答1: I have created the following code that easily removes duplicates: static void renameDuplicates(String fileName, String[] newName) { int i=1; File file = new File(fileName + "(1).txt"); while (file.exists() && !file.isDirectory()) { file.renameTo(new File(newName[i-1] + ".txt")); i++;

Python zip multiple directories into one zip file

帅比萌擦擦* 提交于 2020-06-22 19:19:30
问题 I have a top directory ds237 which has multiple sub-directories under it as below: ds237/ ├── dataset_description.json ├── derivatives ├── sub-01 ├── sub-02 ├── sub-03 ├── sub-04 ├── sub-05 ├── sub-06 ├── sub-07 ├── sub-08 ├── sub-09 ├── sub-10 ├── sub-11 ├── sub-12 ├── sub-13 ├── sub-21 ├── sub-22 ├── sub-23 ├── sub-24 ├── sub-25 ├── sub-26 ├── sub-27 ├── sub-28 ├── sub-29 I am trying to create multiple zip files(with proper zip names) from ds237 as per size of the zip files. sub01-01.zip:

Command line for 7z to extract specific files from specific folders inside an archive

℡╲_俬逩灬. 提交于 2020-05-26 04:23:18
问题 I'm writing a Python script where I need to call 7z to extract some files kept inside a directory in an archive without extracting the complete archive. The archive contains multiple directories and I need to extract some files from a particular directory. Let's say, "abc.7z" is an archive which contains multiple directories, i.e "temp", "windows", "system", "data". I want to extract some .exe files from directory "system" only because those .exe files might be present in other directories

what is mongodb archive format?

老子叫甜甜 提交于 2020-05-16 19:00:25
问题 I've backed up some mongoDBs using their archive option, but I can't simply untar them. When I go through some steps to decompress the data it looks like the archive is the whole DB in one big file. I wanted to get at the files for the individual collections. Is there a way to do that? $ tar -xvf valk.archive tar: Unrecognized archive format tar: Error exit delayed from previous errors. $ file valk.archive valk.archive: gzip compressed data, original size 13953183 $ gunzip valk.archive gunzip

Update zipfiles with PowerShell 5 or >. Working code looking for improvement

时光毁灭记忆、已成空白 提交于 2020-05-16 04:08:28
问题 Windows 10 64-bit. PowerShell 5.1 Update zipfiles with PowerShell 5 or >. Working code looking for improvement. 1.1.txt, 1.1.3.txt and 1.txt go in FileGroup0000000001.zip 11.txt and 11.1.txt goes in FileGroup0000000011.zip 2.1.3.6.txt, 2.1.3.6.7.txt, 2.1.txt, and 2.txt go in FileGroup0000000002.zip Update zipfiles with PowerShell 5 gci, regex, $Matches, foreach {$_ PadLeft}, Compress-Archive, and Remove-Item . Avg 29ms 9 files (48KB) 3 archives on ten runs. For testing clear your desktop.

Update zipfiles with PowerShell 5 or >. Working code looking for improvement

落花浮王杯 提交于 2020-05-16 04:05:56
问题 Windows 10 64-bit. PowerShell 5.1 Update zipfiles with PowerShell 5 or >. Working code looking for improvement. 1.1.txt, 1.1.3.txt and 1.txt go in FileGroup0000000001.zip 11.txt and 11.1.txt goes in FileGroup0000000011.zip 2.1.3.6.txt, 2.1.3.6.7.txt, 2.1.txt, and 2.txt go in FileGroup0000000002.zip Update zipfiles with PowerShell 5 gci, regex, $Matches, foreach {$_ PadLeft}, Compress-Archive, and Remove-Item . Avg 29ms 9 files (48KB) 3 archives on ten runs. For testing clear your desktop.