Setting the supported file types for a MFCBrowseEdit control in File mode? [duplicate] - mfc

how to give default file name extension in CMFCEditBrowseCtrl::EnableFileBrowseButton? How the arguments should be passed? I tried like following code.
CMFCEditBrowseCtrl py_file_path;
py_file_path.EnableFileBrowseButton(_T"PY",_T"*.py");
But it is not displaying the .py files. It says "no items matches". I guess there is some problem with the lpszDefExt and lpszFilter values i use. Could anyone tell me what is the value of those arguments to list all .py files?

You need to set it like this:
CMFCEditBrowseCtrl py_file_path;
py_file_path.EnableFileBrowseButton(_T("PY"), _T("Python files|*.py||"));
The final argument is a filter string, where the description and filter are delimited by |.

Related

Is there a way to fill a LATEX template from a txt file?

I wonder if there is a way to do a LATEX template with different section, tables, enums, etc. and fill all of that with a corresponding txt or json file, so that I can compile different pdf with just changing the input file.
I know there is the textinput command but I would like to have one file for different input fields.
Like so:
%foo.tex
\section{\secOne}
\textOne
\section{\secTwo}
\begin{enumerate}
\item \it21
\item \it21
\end{enumerate}
#foo.txt
secOne:
first section
secTwo:
second section
textOne:
this is a test
it21:
foo
it21:
bar
What are options here?
Is it common to use a .tex file to achive this?
Or can I also just use a formated txt file and seperate lines to fill out the template?
If I am not wrong you are planning on making a compiler that will translate your text document to latex format tex file. You can make your own compiler using python. I was working on a similar project but not with latex but with power point it is more of a populator. If you want to have a glance here is the repo https://github.com/altair00/XL-PPTX
I don't know if this will help you but this will give you an idea how to do what you are planning on doing.

GAMS: Filename cannot be used as valid UEL

I trying to merge a large data set in gams. The file should consist of multiple gdx files with several names. The programme merges the files as I would like them to however: it replaces the names of the file to be merged with File_1, File_2, File_3 and so on. I would like to see the name of the gdx file in the merged file (and so far the script I wrote worked fine).
I'm receiving the following error for each line:
***Filename cannot be used as a valid UEL
Existing name: ImpactYesPGTNoLDViolation-D1-PG10-LDI-LDE0.001-LB0.0045-PDC0-D10
Replaced with File_1
Why does this happen? Could it be that the existing name is too long? I tried finding out more about this error but so far have not found any information on it. And is there anyway to fix it? I need the information of the existing name in order to further process the output.
You are right. This name is too long to be used as UEL (aka label). You can only use up to 63 characters. You can read more about this and other limitations for UELs here

Reading dates from filenames

I want to extract dates from the suffixes of files in a particular folder. The contents of such a folder look something like:
Packed_Folder_1_2016.06.10
Packed_Folder_1_2016.08.06
Packed_Folder_1_2015.09.03
packed_Folder_1_2015.01.08
... (so on and so forth, always in the same path just different suffixes)
There is no pattern to the dates. I need to make a VS form (2013) to read the name of the files and store the date differences.
Notice how the filenames always follow a pattern? It's always Packed_Folder_1_####.##.##, where the last part is a date.
So what you want to do is list the file names in the folder, and try to find a file that matches the pattern. You could use a regular expression to match the filename (it would be something like R"(Packed_Folder_1_\d{4}\.\d{2}\.\d{2})").
You are talking about Forms, so I am assuming you are able to use Visual C++. If that is the case, you can check FileSystemWatcher Class.
You instantiated it with a given path ( file or directory ), and it will trigger events based on some changes on the target (simple change, creation, rename - you can select which one). You could then update your reference, in case its change suits your needs.

Type "p" Annotations with Plain Text files

I am trying to understand whether GATE is able to extract annotations of type "p" from plain text files which are UTF-8 encoded.
HTML files and PDF files work just fine and "p" annotations are added when these 2 file types are being analysed.
I tried using different PRs but i do not seem to be able to get type "p" annotations under Original Markups.
Is there a way to achieve this for Plain Text files?
I think you should use Annotation Set Transfer PR which will move "p" annotations from Original Markups to Default set. Then you will be able to use them according to your requirements.

How to use the original filename in a multi file template in resharper?

I have a multi file template in resharper and I can use $NAME$ macro to get the name of the original file to use to name the other files in the template. But I also want to use the $NAME$ of the original file in the content of the other file template.
Is this possible? I can't see a macro which seems suitable for the internal variables as onlt the Current File Name seems available.
Anyone know if this is possible or how I might workaround this?
As a workaround, you may create a parameter $FILENAME$ (macro "Current file name without extension") in the first file e.g. in the comments, like:
class Foo
{
//$FILENAME$
}
Then you may call this parameter in other files of the multifile template - this parameter will contain the name of the first file since the first file will be generated before other ones.
Unfortunately, there isn't a macro that will give you this. I've added a feature request that you can vote on and track (and more specific detail as to what your requirements are would be useful) - http://youtrack.jetbrains.com/issue/RSRP-415055
It is possible to write your own macros as part of a plugin, but there isn't a sure-fire way of getting the name of the first document in the created file set. The IHotspotSessionContext instance that is passed to the macro via IHotspotSession.Context property includes an enumerable of IDocument, from which you can get IDocument.Moniker, which will be the full path for file based documents. However, there's no guarantee of the order of the enumerable - it's backed by a hashset. You might be able to rely on implementation details (small set, no removes) to be able to use the first document as the original, but there is really no guarantee of this.