How to change Jekyll filename format - ruby

I'm using a collection called now that takes a date format and lists it newest to oldest. I've determined naming my files _now/YYYY-MM-DD-title.md (just like posts) will automatically assign dates to the collection, but I'm required to add a title to it. This means my files look like:
_now/
2019-02-28-now.md
2019-01-15-now.md
2019-01-01-now.md
...
I'd prefer if I didn't need to append -now to each file.
Does anyone know how to configure the filename format of a collection? I'm hoping for something in the configuration options, maybe like:
collections:
now:
filename: date
I'm essentially looking for the opposite of this: Jekyll Filename Without Date

Related

Keras - using predefined training / validation split

I'm working with Tensorflow/Keras. I have two text files (train_{modality_name}.txt and val_{modality_name}.txt). They contain the split I want to use for the images I'm processing.
The format of these files is the following:
example_0_path category_id
example_1_path category_id
...
example_N_path category_id
and my folder structure is like this:
/labels
train_X.txt
val_X.txt
/data
/modality_1
...
/modality_M
(e.g. data/sketch/abbey/id)
How can I make use of the files?
'flow_from_dataframe' did the job, additionally it was necessary to preprocess the txt with pandas. This tutorial was very helpful: https://medium.com/#vijayabhaskar96/tutorial-on-keras-imagedatagenerator-with-flow-from-dataframe-8bd5776e45c1
Still having problems with matching target size of the arrays (labels seem to have the wrong format)

Automate downloading of multiple xml files from web service with power query

I want to download multiple xml files from web service API. I have a query that gets a JSON document:
= Json.Document(Web.Contents("http://reports.sem-o.com/api/v1/documents/static-reports?DPuG_ID=BM-086&page_size=100"))
and manipulates it to get list of file names such as: PUB_DailyMeterDataD1_201812041627.xml in a column on an excel spreadsheet.
I hoped to get a function to run against this list of names to get all the data, so first I worked on one file: PUB_DailyMeterDataD1_201812041627
= Xml.Tables(Web.Contents("https://reports.sem-o.com/documents/PUB_DailyMeterDataD1_201812041627.xml"))
This gets an xml table which I manipulate to get the data I want (the half hourly metered MWh for generator GU_401970
Now I want to change the query into a function to automate the process across all xml files avaiable from the service. The function requires a variable to be substituted for the filename. I try this as preparation for the function:
let
Filename="PUB_DailyMeterDataD1_201812041627.xml",
Source = (Web.Contents("https://reports.sem-o.com/documents/Filename")),
(followed by the manipulating Mcode)
This doesnt work.
then this:
let
Filename="PUB_DailyMeterDataD1_201812041627.xml",
Source = Xml.Tables(Web.Contents("https://reports.sem-o.com/documents/[Filename]")),
I get:
DataFormat.Error: Xml processing failed. Either the input is invalid or it isn't supported. (Internal error: Data at the root level is invalid. Line 1, position 1.)
Details:
Binary
So stuck here. Can you help.
thanks
Conor
You append strings with the "&" symbol in Power Query. [Somename] is the format for referencing a field within a table, a normal variable is just referenced with it's name. So in your example
let Filename="PUB_DailyMeterDataD1_201812041627.xml",
Source = Xml.Tables(Web.Contents("https://reports.sem-o.com/documents/" & Filename)),
Would work.
It sounds like you have an existing query that drills down to a list of filenames and you are trying to use that to import them from the url though, so assuming that the column you have gotten the filenames from is called "Filename" then you could add a custom column with this in it
Xml.Tables(Web.Contents("https://reports.sem-o.com/documents/" & [Filename]))
And it will load the table onto the row of each of the filenames.

List of properties of list items in Applescript

I'm getting a list of files in applescript like so:
set _resourcesFolder to folder (((path to me) as string) & "Contents:Resources:")
set _signatureFiles to files of _resourcesFolder whose name extension is in {"html", "webarchive"}
Then I want to get the properties these items in separate lists. Tried it like so:
set _signatureNames to displayed name of _signatureFiles
set _signatureDate to modification date of _signatureFiles
This doesn't work. But this does:
set _signatureNames to displayed name of files of _resourcesFolder whose name extension is in {"html", "webarchive"}
set _signatureDate to modification date of files of _resourcesFolder whose name extension is in {"html", "webarchive"}
Why so?
In your first snippet, you define two lists: _resourcesFolder and _signatureFiles
In your second snippet, your code is asking for the displayed name and the modification date of one of those lists. This fails because you are addressing the list, not the items in the list.
In your third snippet, you correctly address the items individually, and all is swell.
The only other method available (based on your original snippet) is to repeat through the files in _signatureFiles and create the lists or records as part of the repeat. Your code in the third snippet is the only way to do it in a single command.

OpenTBS Replace Text

Is it possible to replace text without having to create a TAG?
I'm using a template to fill some data in a word document. One of the things I need to fill is the revision number, something like: "1º Revision" ([onshow.rev])
But the generated file can be re-submited several times, and I need to increment the revision for each time, but since the tag [onshow.rev] is gone from the first time, I can't do it anymore.
Is it possible the replace just the text "1º Revision" with something line "2º Revision"?
thks
With TinyButStrong, You can directly modify the contents using $TBS->Source.
But, with OpenTBS over TBS, you have to take care that only the current sub-file is actually accessible by $TBS->Source.
For example, if you are working on an Ms Excel sheet, then you have to do a $TBS->PlugIn(OPENTBS_SELECT_SHEET, $Sheet) in order to select the sheet to modify.
Here is how to replace your item in the template :
$TBS->Source = str_replace("1º Revision", "2º Revision", $TBS->Source);

Changing the timezone strings of date_lang.php

CodeIgniter stores timezones for its date class in
system/language/english/date_lang.php
I would like to change the strings in this file so that
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
would instead be
$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';
Is this possible at all?
Any change I make to the UM__ portion of one line makes it show as a blank on the dropdown. The remaining (unchanged) lines appear OK.
I have also tried to clone this file to application/language/english/ with similar bad results.
Any insights on this?
It looks like this would require hacks to the date_helper.php file which I am not willing to do.
Instead, the date class in CI has the timezones() function which allows you to convert from, for example, UM5 to -5. In that case one can wrap this function around the U__ value coming from the view/dropdown -- and then save it to DB as -5 or some other INT.
Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the U__ and INT timezone formats. As far as I know, there is no CI function to convert from -5 to UM5.
So, for the user, I pull the U__ format into the view to autopopulate the dropdown.
For timezone conversions and such, I use the INT format.

Resources