NetBeans template prompts user for variables - templates

I am taking a programming class in college where my professor requires me to include information on the assignment withing a JavaDoc comment block in a specific format. I'm wanting to create a java class template so that when I create my file, I just type in the assignment specific information, and it places it in the template. Is this possible, or do the variables used in netbeans templates have to be pre-defined?

"I'm wanting comments that are generated when the user creates a .java file in netbeans."
Then your best solution is modifying the templates and defining custom User.properties when needed.
In NetBeans 7.2 (latest I think), go to [Tools] -> [Templates], and in the Template Manager window you can expand whatever template for whatever language you like and customize it.
For example, if you expand Java, you can then change the Java Class by highlighting it and selecting [Open in Editor]. At that point, you can easily see the normal javadoc comment block at the top.
/**
*
* #author ${user}
* #professor Mr. LordZardeck's Professor
*/
public class ${name} {
}
If you want to add custom properties, like the above uses the user property, in the Template Manager window, select [Settings]. That will open the User.properties file where you can add properties of your own. If you look at the bottom of the file, the last line is commented out, but it is an example of a custom property, uncommented it is:
user=Your Name <your.name at your.org>
So, with this you can specify static tags that can be auto-created without any work by simply changing the templates (like the professor tag added to the java class template). For a tag whose variable might change from assignment to assignment, you can use the custom user properties to assign those at the start of each assignment, then the templates will auto-fill your assignment information into the auto-generated custom javadoc tags when your template is opened.

Related

Is it possible to modify the templates used during creation of a C++ class by the Unreal Editor's Class Wizard?

I am starting a new project and it will require the creation of many C++ classes. In order to keep the project organized I created coded standards that will keep methods and member variables organized using regions, nothing too complex. However, I do not want to have to modify every new class I make adding the separators(regions) by hand or have to copy paste from another file.
In unity it is possible to modify the template used in the creation of a new script, but i am having trouble finding the same information for the Unreal Engine. I am not using source and if it is required to do so I will probably just copy paste it for every class.
I tried searching online for information on the subject, but the results were less than useful.
You can modify, create, and delete templates in Unreal Engine. Since you are not using Unreal Engine source, the templates are all located in the C:\Program Files\Epic Games\UE_{version}\Templates directory. If you are using Unreal Engine source, then the location will instead be {engine-location}\Templates. In these directories, you can modify the configs, the content, and the source code of each template. And of course, you can create new templates and delete existing ones.
If you do create a new template, then make sure that you do the following steps:
Move the project that you want to make a template out of to one of the Templates folders mentioned above depending on the verison of Unreal Engine you have (source vs non-source).
Update the ProjectName variable in your template's Config\DefaultGame.ini file.
Copy any of the existing templates' Config\TemplateDefs.ini file to your template's Config folder.
Modify the copied TemplateDefs.ini file, specifically the LocalizedDisplayNames and LocalizedDescriptions variables. These are the name and description of your template that show when the template is selected while trying to make a new project in Unreal Engine. Note that you may have to modify the other parts of the TemplateDefs.ini file depending on your project/template.
Lastly, add pictures in your new template's Media folder. Add one picture named {new-template-name}.png, which will be the icon of the template and another picture named {new-template-name}_Preview.png, which will be be the preview of the template that appears alongside the name and description after one clicks on the template icon while trying to make a new project.
For more information, check out these resources:
https://docs.unrealengine.com/en-US/Engine/Basics/Projects/CreatingTemplates/index.html
https://www.youtube.com/watch?v=MYM7iSh-uac

How can I develop a list template for a dynamic list in Liferay with action buttons?

List template in dynamic data list in Liferay
I have already read this post and also another webapplicationdeveloper blogpost but not find any idea to get action button in customly applied template to dynamic data list.
I have also tried including that default record_action.jsp of dynamicdatalist portlet in vm template but its not working and also set the property below
journal.template.velocity.restricted.variables =
in portal-ext property but still I am not getting the action button in my custom template
I have already tried this :
#
set (
$categoriesService = $portal.getClass().forName("com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil").getMethod("getService", null).invoke(null, null))
My answer is: Yessss, it works. But I want use a jstl lib (e.g. <aui> or <ui>) as well. In my opinion the simpliest way to do it is include jsp file to themeServletContext. Put your file.jsp into your theme:
your-theme/docroot/path/to/your/jsp/file.jsp
and paste this piece of code into your vm (for example portal_normal.vm):
$theme.include($themeServletContext, "/path/to/your/jsp/file.jsp")
In this case it unable to find the $theme variable my page displaying the $theme as it is...:(
Please help:
Leave velocity, it's too poor to use taglib, and switch to freemaker language: more powerfull and full support of taglib.
Here there is an example to use freemaker for theme develment, but it's good starting point also to template in dynamic data list.
https://www.liferay.com/it/web/mika.koivisto/blog/-/blogs/using-freemarker-in-your-theme-templates
Look also freemaker guide: http://freemarker.org/docs/index.html

woocommerce advanced templating

i´m developing a theme and for some reason i need to move the default position for breadcrubms (also for many other things) over woocommerce themes. Then i realised to do something like this on my functions.php:
function woocommerce_remove_breadcrumb(){
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
add_action('woocommerce_before_main_content', 'woocommerce_remove_breadcrumb');
function woocommerce_custom_breadcrumb(){
woocommerce_breadcrumb();
}
add_action( 'woo_custom_breadcrumb', 'woocommerce_custom_breadcrumb' );
And then on any template file, output the breadcrumb just with:
<? do_action('woo_custom_breadcrumb'); ?>
And works. My question is more than that. Is this the correct approach for something like this? I mean for anything over woocommerce, not just breadcrumb, for any pice, ratings, titles, buttons, sidebar, and so on.
What i´m thinking on is why woocommerce templates don´t come with more deep code. I mean, why there´s no such a single-content-loop.php template where you can just change the order of things, title, category, content, images, etc. in an easy way rather that hooking into functions?
I think that is an acceptable way to call the breadcrumbs explicitly. Sometimes it is easier to call a specific function than remove everything around it!
As for changing the order of things and getting into advanced customization; there isn't a single file, but a number of files working together. Create a folder in your themes root called 'woocommerce' and copy the following files for a safe override:
woocommerce/woocommerce-hooks.php:
Here are your hooks, including the ones you are overriding in your themes functions.php. Here is where you can experiment with removing and repositioning certain elements on your product page. Search for 'Sidebar' and you will see where the 'woocommerce_sidebar' action is added with the function it references in...
woocommerce/woocommerce-template.php:
Here are the functions used in template files to output content based on conditional statements. For instance, search for the 'Single Product' series and you can see which template files are used for which functions. For instance 'woocommerce_template_single_title' uses 'single-product/title.php' - if you copy over this folder and file you can make very specific edits to just the title section
Between these two files and their accompanying references (like title.php) I believe you can do the things you described. Let me know how it works out! I'm new to woocommerce too!

BitBucket Wiki: Create a hierarchy structure?

I want to create a hierarchy in my wiki like so:
General
FooPages
Foo1
Foo2
Foo3
ODP
Bar
Baz
I would like to create these pages, and use <<toc>> table of contents macros to organize them.
How can I do that? Do I need to clone and edit the wiki on my own machine, or can I do that exclusively through the web interface?
You can (partially) do this, using <<toc / >>.
This will create a TOC for all the headers in files in the root directory.
It will not list headers in file in the sub directories, though.
You can do the same for <<toc FooPages/ >> etc.
You can do this both through the web interface and locally on your machine.
I placed some TOC examples on this Bitbucket wiki page: http://bitbucket.org/marijnvanderzee/build-wiki/wiki/TocTests. You can view the markup there.
Make sure to balance the equal signs on you headers; e.g. use == H2 == instead of == H2.
Both are valid, but at this time, the latter is not recognized by the <<toc>> macro.
Regarding the hierarchy side of this question, it's worth clarifying:
You can create a hierarchical structure by using the Title field when you create or edit a wiki page.
Eg: If you want to create a new file Bar.md inside a new Foo directory, just create a new page and in the Title field write "Foo/Bar.md". It will create the directory and the file at the same time.
I'm not sure if there's a way to just create the directory without adding a file to it straight away.
Regarding the TOC half of this question, I found that I can use the # HeaderTitle syntax in Markdown pages, and Creole's TOC macro will recognise it.

How to override the default text in MATLAB

In MATLAB, when you click File -> New -> Function M-File, you get a file with the following contents:
function [ output_args ] = Untitled( input_args )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
end
Is it possible to override this behaviour, and specify your own text?
(The motivation is that I'm trying to persuade my colleagues to document their m-files more thoroughly, and having default text for them to fill in might encourage them.)
I didn't even know File->New->Function did that.
The way I solved the issue was to write a function that you call via
>>newFunction myNewFunctionName
It then
pops up an inputdlg window, which asks the user for the synopsis and the H1 line and allows to already write help to explain input and output arguments. There, the user also selects whether myNewFunctionName is a function or a class in order to choose the right header and 'function call'
checks whether a function of the same name exists already
asks for a folder to save the function, and
opens the function in the editor
The header is set up so that it's easy to fill in info about input and output. It also automatically lists the username of the person who created the file as well as the date and the Matlab version.
EDIT
For new classes, the template function automatically makes sure that they subclass my general superclass that implements methods such as 'help' (which calls doc(class(obj)) )
Now if the template functionwould also write the algorithm part of the function, it would be really convenient. :)
EDIT2
Here's a link to the function on the file exchange.
I would suggest making your own default m-file template, called default.m for example, and placing it in a folder on the MATLAB path where your colleagues can access it. You should then set the file to be read-only. Your colleagues can then execute any one of the following commands in the MATLAB Command Window when they want to create a new function m-file:
open default.m
open('default.m')
edit default.m
edit('default.m')
The functions OPEN and EDIT will open a file in the MATLAB Editor. Since the file default.m is read-only, if anyone tries to save over it they will get a dialog box warning them as such and asking them to save to a new file (or overwrite it). That should keep them from accidentally modifying the template.
I searched through all text files starting from matlabroot folder, but could not find that template. Seems it's hard-coded, which is weird.
I like Jonas approach. As my two cents, you can download a function (not mine) doing similar things with some customization from here.
After more pondering, I've come up with a solution that I'm happy with, combining Jonas' and gnovice's answers. It's a function that creates a new m-file (with template documentation), and opens it in the editor. It is available from the Matlab Central File Exchange.