How to add date stamps to record journal entries - date

Basically I want the document to serve as some kind of journal, to record what I've done every day, so I need to add a date stamp in every entry. It should be like this:
9/14/2015
added a comma to the poem.
9/15/2015
comma deleted.
I know \date{\today} will add the date of the last compilation, but that's not what I want, and the google results are mostly about this (might be I'm search for the wrong key word).

The isodate package provides commands to switch between different date formats. You can use the following command to print a date, see the manual for details.
\printdate{09/14/2015}
The list in your example looks like a revision history, if so, take a look at the vhistory package.
Here is an example:
\documentclass{article}
\usepackage[english,num,USenglish]{isodate}
\dateinputformat{american} % mm/dd/yyyy
\usepackage{vhistory}
\begin{document}
\begin{versionhistory}
\vhEntry{1.0}{\printdate{09/14/2015}}{Olivier Ma}{added a comma to the poem.}
\vhEntry{1.1}{\printdate{09/15/2015}}{Olivier Ma}{comma deleted.}
\end{versionhistory}
\end{document}

Related

How to remove the file extension using a snippet variable. List of snippet variables

I use vscode.
I want to use costum snippets, but {TM_FILENAME} has an extension name.
How can I delete the extension from {TM_FILENAME}?
like this:`
In file MyModule.js:
Transform: ${TM_FILENAME/(\w+)\.js/\1/g}
Output:
MyModule
You can use TM_FILENAME_BASE to get only the filename:
${TM_FILENAME_BASE}
Actually, since the question was posed a few new built-in variables have been added,
including TM_FILENAME_BASE. See snippet variables documentation. So there is no need to do a transform just to get the filename without the extension.
Here is the current list of snippet variables:
TM_SELECTED_TEXT The currently selected text or the empty string
TM_CURRENT_LINE The contents of the current line
TM_CURRENT_WORD The contents of the word under cursor or the empty string
TM_LINE_INDEX The zero-index based line number
TM_LINE_NUMBER The one-index based line number
TM_FILENAME The filename of the current document
TM_FILENAME_BASE The filename of the current document without its extensions
TM_DIRECTORY The directory of the current document
TM_FILEPATH The full file path of the current document
CLIPBOARD The contents of your clipboard
WORKSPACE_NAME The name of the opened workspace or folder
CURRENT_YEAR The current year
CURRENT_YEAR_SHORT The current year's last two digits
CURRENT_MONTH The month as two digits (example '02')
CURRENT_MONTH_NAME The full name of the month (example 'July')
CURRENT_MONTH_NAME_SHORT The short name of the month (example 'Jul')
CURRENT_DATE The day of the month
CURRENT_DAY_NAME The name of day (example 'Monday')
CURRENT_DAY_NAME_SHORT The short name of the day (example 'Mon')
CURRENT_HOUR The current hour in 24-hour clock format
CURRENT_MINUTE The current minute
CURRENT_SECOND The current second
CURRENT_SECONDS_UNIX The number of seconds since the Unix epoch
For inserting line or block comments, honoring the current language:
BLOCK_COMMENT_START Example output: in PHP /* or in HTML <!--
BLOCK_COMMENT_END Example output: in PHP */ or in HTML -->
LINE_COMMENT Example output: in PHP // or in HTML <!-- -->
vscode v1.66 will add two new variables:
CURSOR_INDEX 0-based
CURSOR_NUMBER 1-based
The above two work with multiple cursors so that each cursor position (same as a selection) will have an incremented integer inserted.
For an example of this, see https://stackoverflow.com/a/69946559/836330
It looks like v1.40 will add:
WORKSPACE_FOLDER Path of workspace directory
RANDOM Insert 6 random digits
RANDOM_HEX Insert 6 random hex digits
See https://github.com/microsoft/vscode/pull/82529 and https://github.com/microsoft/vscode/pull/79764
v1.53 will add the relative path from the root folder to the current file:
RELATIVE_FILEPATH
UUID
See https://github.com/microsoft/vscode/pull/114208 and https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_53.md#new-snippet-variables
You can't do this at the moment but there's a feature request on the vscode GitHub page for what you want: https://github.com/Microsoft/vscode/issues/6920.
[EDIT]
My answer above is now out of date - you can use the ${TM_FILENAME_BASE} variable as mentioned by other contributors.
You can try something like this if you know the file extension,
${TM_FILENAME/(.js)//}
It will turn FileName.js to FileName

Bulk change date to present date with ExifTool

I have a bunch of images with different create dates. I want to normalize them all to a given date (say today's date) using a batch file (Windows). Can ExifTool set dates? I only see documentation and examples for shifting dates. To shift the date to present, I would need to somehow read the date for each file, calculate the difference, and then shift. That would be ok, but I don't know how to read the create date into a variable using ExifTool.
One obstacle for me is that I don't speak Perl. I do Python, and there is pyexiv2. This allows to write the "date", but I can't see anywhere if that is just create date or all dates.
Edit
Here shows using, for example,
exiftool -AllDates='2010:08:08 15:35:33' -overwrite_original IMG_01.jpg
in Ubuntu linux, but I could not get that to work in Windows.
As a hack, I tried
exiftool -AllDates+=2015:03:02 IMG_8220.JPG
which set the dates to the time executed, probably because the shift was so completely crazy. But I'd like to have control, and, specifically be able to change YYYY:MM:DD without changing the time.
Consequently, help still appreciated.
I crossposted to the ExifTool forum, and ExifTool author Phil Harvey responded that you need to use double quotes. The single quotes from the linked blog post don't do it in Windows.
So, one would use
exiftool -AllDates="2010:08:08 15:35:33" IMG_01.jpg
I tested it and (of course) it worked.

How do I merge several calendar (iCal format) into one in Perl?

I have several non-overlapping ical files that I want to merge into one ical file.
What is the preferred way to do this?
After reading correct (self)-answer from #knarf and Format iCalendar files at support.google.com, I succesfully used this:
mergeIcal() {
sed -e '$d' $1
sed -e '1,/VEVENT/{/VEVENT/p;d}' $2
}
This take whole first argument file but not last line (footer) and concatenate second argument file without header.
Event duplication will be automatically dropped when loaded by most common Calendar Agent.
I ended up concatenate every file without their header/footer and adding header/footer manually.
(I can't accept my own answer whithin 2 days)
There are a couple of options (ordered IMHO least useful to most useful for your task):
If you prefer to use the "standard" DateTime set of modules for datetime manipulation, you can parse in and print calendars using DateTime::Format::ICal . However, that module parses iCal formatted data but not files.
For purpose of parsing/combining multiple files, you can use iCal::Parser . From SYNOPSIS (see line #3 from the botom):
use iCal::Parser;
my $parser=iCal::Parser->new();
my $hash=$parser->parse($file);
$parser->parse($another_file);
my $combined=$parser->calendar;
Or
use iCal::Parser;
my $combined=iCal::Parser->new->parse(#files); #### BINGO!!!!!
However, this module doesn't print the resulting merged data back into a file, at least that I know of.
Data::ICal set of modules has both parsing and printing, with main module Data::ICal capable of generating a file.
I wasn't able to find out how to merge the different calendars officially, but it should be fairly trivially to do by looping over second calendar object's entries and properties (one's an arrayref one is a hash) and using add_entry() and add_property() of the first calendar object to merge.
I think you should also be able to convert ical::Parser merged data into Data::ICal, since the former produces lists of Text::vFile::asData objects (with dates replaced by DateTime objects); and the latter has parse_object() method to parse Text::vFile::asData objects.

Excel/VBA - Copy and paste data into a worksheet in a specific row based on date

I have what I think is a pretty simple question.
I have a report that is updated daily. A specific range (B5:AC5) from one worksheet needs to be copied to a different worksheet on a daily basis. This doesn't need to be done automatically, I'd just like to add the code for it into a formatting macro I've created.
I have two issues with this:
I want the data to be pasted in the row that corresponds with that specific day. Column A in worksheet "Daily" has the list of working days for that month. So all I need is for the macro to find today's date in Column A in "Daily", and paste b5:AC5 from "Matrix" in b?:ac? in that row on "Daily".
I also need it to be a paste special, with only the values being pasted.
I'm very new to VB, but can usually follow code logic pretty well. Let me know if you need any more information from me. Thank you so much!
Assuming that your range will always be in B5:AC5, here is what I came up with:
Sub FindToday()
Dim FoundDate As Range
Set FoundDate = Worksheets("Daily").Columns("A").Find(DateValue(Now), LookIn:=xlValues, lookat:=xlWhole)
If Not FoundDate Is Nothing Then ' if we don't find the date, simply skip.
Worksheets("Matrix").Range("B5:AC5").Copy
FoundDate.Offset(0, 1).PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, False, False ' You can see that the first argument in PasteSpecial is set to only paste values.
End If
End Sub
I tested this as best I could given your information. I put a set of ascending numbers in the B5:AC5 range, with formulas, put a set of ascending dates for one month in the Daily sheet, and it seems to do what you're looking for.
Hope this helps.

LaTeX command for last modified

Is there a LaTeX command that prints the "last modified" date of the actual document? Since LaTeX projects consist of more than one file this command ideally prints the date of the actual file, not that of the project.
pdfTeX provides the primitive \pdffilemoddate to query this information for files. (LuaTeX uses its own Lua functions for the same thing.) Since pdfTeX is used by default in all LaTeX distributions in the last few years (at least), there's no harm in using the new functionality unless you're dealing with very old production systems. Here's an example:
\documentclass{article}
\begin{document}
\def\parsedate #1:20#2#3#4#5#6#7#8\empty{20#2#3/#4#5/#6#7}
\def\moddate#1{\expandafter\parsedate\pdffilemoddate{#1}\empty}
this is the moddate: \moddate{\jobname.tex}
\end{document}
(Assuming the file has been modified since year 2000.)
The package filemod seems to do exactly what you need. To get the last modified date of the file you just include the package in the usual way:
\usepackage{filemod}
and the modification time of the current document is printed by:
\filemodprintdate{\jobname}
you can also print the modification time, and there are many options to format the output.
Unfortunately, TeX does not provide commands for such information; the only way to get such information is
by running a non-TeX script to create a TeX file before running LaTeX and including this file in your main LaTeX document somehow, or
by running the external script from TeX (which only works if the so-called write18 or shellescape feature is enabled; you'd have to consult the manual of your TeX implementation for this, and not have a stubborn sysadmin).
It is possible that extended TeXs do support file info commands (luaTeX perhaps?), but it's not part of TeX proper.
If you are using an automated build system, you could ask it to generate a file (perhaps named today.sty) which depends on all the source files.
In make that might look like:
today.sty: $LATEX_SRCS
echo "\date{" > $#
date +D >> $#
echo "}" >> $#
and \usepackage{today.sty}.
The will use the date of the first build after a file changes, and won't update until either you delete today.sty or alter another source file.
thank dmckee
LATEX_SRCS = test.tex
define moddate
date +%Y%m%d%H%M%S
endef
today.sty: $(LATEX_SRCS)
#echo "\def\moddate{"$(shell $(moddate))"}"> $#
There is the getfiledate LaTeX package (it was part of my LaTeX distribution by default). It seems to be designed to automatically output a paragraph like:
The date of last modification of file misc-test1.tex was 2009-10-11  21:45:50.
with a bit of ability to tweak the output. You can definitely get just the date. However, I couldn't figure out how to get rid of newlines around the date and how to change the date format. To be honest I think the authors implemented it exactly for the single purpose they needed it, and it is rather cumbersome for general use.