Posts

Redirect windows grep output

Problem Redirect "grep pattern file > output.txt" after grep command is not working as grep considers all text after pattern as input file names Solution Put redirection before grep command and separate with ";" Example: 1>output.txt;grep pattern file

Continue ordered list numbering automatically

Basic HTML structure is <h2> Section 1 </h2> <ol> <li> Item list 1 <li> Item list 2 </ol> <h2> Section 2 </h2> <ol> <li> Item list 3 <li> Item list 4 </ol>   Our goal is to do numbering through all list items. We do it with CSS counter properties. body { counter-reset : rule; } ol { list-style : none ; padding-left : 40px ; } ol > li :before { counter-increment : rule; content : counter(rule) ". " ; float : left ; margin-left :- 30px ; width : 20px ; text-align : right ; } First, define our counter 'rule' on body element level. Then disable standard numbering by setting list-style to 'none'. Next create a number before each list item using CSS content property and incrementing counter. Other CSS rules are used to make numbering look similar to standard. Result: Section 1 Item list 1 Item list 2 Section 2 Item list 3

How to compress directory with 7-Zip without adding directory path

Window context menu has a handy 7-Zip actions to compress selected directory, but it has one problem: it puts directory into archive. Here is command line how to avoid that: 7z a -r -tzip [directory].zip .\[directory] \* That's not too handy to type it, so it's very simple to add command to the Total Commander bar. Command: 7z.exe Parameters: a -r -tzip %N.zip .\%N\*

How to export data into UTF-8 without BOM in Visual Basic

Create stream for UTF-8. Set sqlStream = CreateObject("ADODB.Stream") 'Init stream sqlStream.Open sqlStream.Position = 0 sqlStream.Charset = "UTF-8" Write your data into the stream. Dim binaryStream As Object Set binaryStream = CreateObject("ADODB.Stream") binaryStream.Type = 1 binaryStream.Mode = 3 binaryStream.Open 'Skip BOM bytes sqlStream.Position = 3 sqlStream.CopyTo binaryStream sqlStream.Flush sqlStream.Close binaryStream.SaveToFile sqlFilename, 2 binaryStream.Close