public void checkAttributeDefinition(String strAttrName) throws Exception{
System.out.println("Context user:" + context.getUser());
String attName = strAttrName;
AttributeType attrType = new AttributeType(attName);
if(attrType != null) {
attrType.open(context);
System.out.println("Attribute Schema: " + attrType.getName());
System.out.println("Max Length: " + attrType.getMaxLength());
System.out.println("Is Multivalue: " + attrType.isMultiVal());
System.out.println("Choices::" + attrType.getChoices());
System.out.println("Is Multiline: " + attrType.isMultiLine());
System.out.println("Is Range value: " + attrType.isRangeVal());
System.out.println("Is Single value: " + attrType.isSingleVal());
System.out.println("Is Hidden value: " + attrType.isHidden());
System.out.println("Default Value:" + attrType.getDefaultValue());
System.out.println("Data Type:" + attrType.getDataType());
System.out.println("Attribute Description:" + attrType.getDescription());
String queryTrigger = "print attribute \"" + attName + "\" select trigger dump |";
System.out.println("Trigger::" + MqlUtil.mqlCommand(context, queryTrigger));
System.out.println("Is Dimension Attribute: " + UOMUtil.isAssociatedWithDimension(context, attName));
if (UOMUtil.isAssociatedWithDimension(context, attName)) {
System.out.println("Attribute Dimension:" + attrType.getDimension(context));
}
}
String queryType = "list type * select name attribute[" + attName + "] dump |";
String result = MQLUtils.mql(context, queryType);
String[] tempArr = result.split("\\n");
StringList attDefinedType = new StringList();
for(String strType: tempArr) {
String[] tempType = strType.split("\\|");
if(tempType.length > 1 && "True".equalsIgnoreCase(tempType[1])){
attDefinedType.add(tempType[0]);
}
}
if(attDefinedType.size() > 0){
System.out.println("Defined on Fllowing Types::<" + String.join(",", attDefinedType) + ">.");
}
}
MxUpdate Samples
attribute
exec program mxupdate --update --path E:\EPLM_workspace\Enovia-5-3\40_mxupdate\datamodel\attribute\ --attribute "NSN Network Element Type";
type
exec program mxupdate --update --path E:\EPLM_workspace\Enovia-5-3\40_mxupdate\datamodel\type\ --type "Conflict Mineral Declaration";
person
exec program mxupdate --update --path C:\workspace\EPLM\vendor\dbschema\user\person\ --person admin_platform;
run tcl script
40_mxupdate/datamodel/type/TYPE_Conflict Mineral Declaration.tcl
query bus with where clause
1 | temp query bus Part * * where ((current == Approved) && |
query bus with Date
1 | temp query bus "NSN Sales Item" * * where "attribute[NSN GSC Base] != '0.0' && attribute[NSN Cost Effective Date] <= 'Jan 07 2020'" dump | limit 5 ; |
mod bus sample
1 | mod bus TYPE NAME REVISION ATTR_NAME ATTR_NEW_VALUE; |
exec prog with method
1 | exec program 'NSNSalesItem' -method queryAndCopyCostsRelatedAttrsToCurrentFields; |
update prog and compile
1 | exec program mxupdate --update --path D:\EPLM_Workspace\Enovia-DEV\40_mxupdate\program\jpo\ --program NSNSalesItem; |
insert and compile prog
1 | insert prog PROG_FILE_PATH; |
mod user
1 | mod person ddong assign role ROLE_NAME; |
check assigned role
1 | print person ddong select assignment; |
Config_Hexo_with_GitHub_via_Windows
Config Hexo with GitHub via Windows
If you want to set up a GitHub website with Hexo in Windows, and you need your website set up with basic functionality, like tags, categories, about, search, theme, visitor count, comments and etc, you can follow the below guide.
Set up the account and repository in GitHub
Create an account in GitHub
Click on the Create New button in the left upper corner, choose New Repository.
In the Repository name, input [your_GitHub_account].github.io such as “damontung.github.io”, select the checkbox Initialize this repository with a README, and click on button Create repository.
In the home page of the new repository, choose tab Settings. In the GitHub Pages section, change Source from None to main branch, and click on Save button next to it.
Install Git
Git is the tool to manage your repository on GitHub.
Download the Git, and install it.
After installation, right click on any folder, and choose Git Bash Here to open Git Bash. To bind your GitHub account and email to the Git tool on your local computer, run the below commands.
git config --global user.name [your GitHub account]
git config --global user.email [your GitHub email address]
Install Node.js
Hexo is a framework based on Node.js.
Download Node.js, and install it. Run the below command to validate the Node.js status after installation.
1 | node -v |
npm is the package manager for JavasSript. Run the below command to check the npm status.
1 | npm -v |
Install Hexo
Hexo is a framework which is helpful to build a blog. See https://hexo.io/ for details.
Create a folder as the base folder for Hexo. Run cmd command, run cd to change the folder to the Hexo base folder, and run the below command to install Hexo.
1 | npm install -g hexo-cli |
Run the below command to install Hexo Git deployer
1 | npm install hexo-deployer-git --save |
Run the below command to initialize Hexo
1 | hexo init |
Hexo basic commands
Initialize Hexo after installation
1 | hexo init |
Start Hexo server. You can stop the server by pressing Ctrl + C.
1 | hexo server |
After the server start, open the below link in browser, and you can see the initial page for Hexo
1 | http://localhost:4000/ |
Create a new page, like tags, categories, about me, etc
1 | hexo new page [page_name] |
Create a new post
1 | hexo new [post_name] |
Generate the website for .md files
1 | hexo generate |
Deploy the website to GitHub
1 | hexo deploy |
Generate the website for .md files and deploy the website to GitHub
1 | hexo deploy --generate |
Clean the cache. It may be necessary after the change on a post, a page or a configuration file.
1 | hexo clean |
Hexo folder structure and basic setup
node_modules: the folder to save Node.js modules for Hexo
themes: the folder for themes
source: the folder to save the source markdown (.md) files
scaffolds: the folder for templates
public: the folder to save the HTML pages after generation
_config.yml: the root configuration file
themes/[theme_name]/_config.yml: the theme configuration file
source/_posts: the folder to save the post markdown (.md) files
add CNAME file in the source folder with following your own domain if you have and add CNAME record to your domain
blog.ddong.online
Update the root configuration file for the below parameters
url: https://damontung.github.io/
highlight:
enable: true
line_number: true
auto_detect: true
or replace url with your custom domain
url: https://blog.ddong.online/
highlight:
enable: true
line_number: true
auto_detect: true
Change Hexo theme
Check the Hexo themes from https://hexo.io/themes/.
For example, if you want to download the Next theme and use it, follow the below steps.
a. Run the below command to download the Next theme to themes folder.
1 | git clone https://github.com/theme-next/hexo-theme-next themes/next |
b. Change the theme parameter to next in the root configuration file
1 | theme: next |
c. Change the parameters in the theme configuration file to use another scheme and add social links if necessary.
1 | scheme: Gemini |
d. Update the file custom.styl under folder \themes\next\source\css_custom, and change the parameter as below
1 | // Custom styles. |
About Markdown
Markdown is a text-to-HTML formatting syntax for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). See https://www.appinn.com/markdown/ for Markdown syntax details.
Here is some common syntax.
italic text
bold text
http://www.url.com
[url tile](url address)
header 3
- list item 1
- list item 2
text before small code block
text after
code block line 1
code block line 2
You can choose a Markdown editor like MarkdownPad to edit Markdown files. The editor has a preview functionality which is very helpful for editing.
Install Awesomium 1.6.6 SDK and restart the computer, if LivePreview is not working for MarkdownPad and the error message is This view has crashed!
Link to a local image
Update the root configuration file as below. After the configuration change, there will be a folder created when using command hexo new [post_name] to create a new post, and the folder name will be the same as post name.
1 | post_asset_folder: true |
You can copy your image file to the post folder, and use the below Markdown syntax to add an image in a post. With this approach, the image will be showing in the post, but it is not showing in the home page.
1 |  |
You can install the below package and then use the below Markdown syntax to add an image to a post, and the image will be showing in both the post and home page.
1 | npm install https://github.com/CodeFalling/hexo-asset-image --save |
Update the theme configuration file for the menu parameter.
menu:
tags: /tags/ || tags
categories: /categories/ || th
Run the below command to create the page for tags
hexo new page tags
Update the file \source\tags\index.md
---
title: tags
date: 2018-03-06 14:38:05
type: "tags"
comments: false
---
Run the below command to create the page for categories
hexo new page categories
Update the file \source\categories\index.md
---
title: categories
date: 2018-03-06 14:39:05
type: "categories"
comments: false
---
Add the page: about me
Update the theme configuration file for the menu parameter.
menu:
about: /about/ || user
Run the below command to create the page for about
hexo new page about
Update the file \source\about\index.md
---
title: about me
date: 2018-03-06 14:19:41
---
### About me
This is my blog.
Add search functionality
Install the Hexo search package via the below command
npm install hexo-generator-searchdb --save
Add the below parameters to root configuration file.
search:
path: search.xml
field: post
Change the below parameter in theme configuration file.
local_search:
enable: true
Create a new post
Run the below command to create a new post
hexo new [post_name]
Update the file \source_post[post_name].md. See below for example.
---
title: Hello World
date: 2018-03-06 14:19:41
tags: [Windows]
categories: Windows
---
###Hello
Hello! This is my first blog.
printf("Hello world!");
Deploy to GitHub
If you are using HTTP to deploy your website to GitHub, you may get a pop-up dialog to input your GitHub account and password when running command hexo deploy during deployment.
In this case, the root configuration file is configured as below.
deploy:
type: git
repo: https://github.com/damontung/damontung.github.io.git
name: damontung
email: damontung@163.com
branch: master
If you are using SSH to deploy your website to GitHub, you can follow the below steps.
a. Run the below command via Git Bash to generate a key pair.
ssh-keygen -t rsa -C "your_GitHub_email_address"
b. Use the default file path C:/User/[Windows_account]/.ssh/, and input the passphrase if necessary
c. Open the file C:/User/[Windows_account]/.ssh/id_rsa.pub, and copy the entire file content
d. Log on to GitHub, click on Avatar on the left upper corner, choose Settings, choose SSH and GPG Keys, click on button New SSH Key, input the Title with any value, paste the entire file content from last step as Key, and click on button Add SSH Key
e. If the passphrase is not empty in the step b, and you don’t want to reenter your passphrase every time you use your SSH key, you can run the below commands to add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
f. Run the below command via Git Bash to check the SSH connection
ssh -T git@github.com
The successful result should be like below.
Hi XXX! You’ve successfully authenticated, but GitHub does not provide shell access.
g. Run the below command to deploy website to GitHub
hexo deploy
In this case, the root configuration file is configured as below.
deploy:
type: git
repo: git@github.com:damontung/damontung.github.io.git
branch: master
Count of Visitors
Open the theme configuration file and update the parameters as below
busuanzi_count:
enable: true
total_visitors: true
total_visitors_icon: user
total_views: true
total_views_icon: eye
post_views: true
post_views_icon: eye
Add comments for website
Create a new GitHub repository website_comments to save the comments for the website
Request a GitHub OAuth application via the link https://github.com/settings/applications/new, or via navigation by GitHub homepage -> Avatar on the left upper corner -> Settings -> Developer Settings -> OAuth Apps -> Request a new application. Input the parameters as below, and register application
Application name: website_comments
Homepage URL: https://damontung.github.io/
Authorization callback URL: https://damontung.github.io/
Note down the Client ID and Client Secret on the application page.
Update the theme configuration file to add the below parameters
gitalk:
enable: true
clientID: [above_client_id]
clientSecret: [above_client_secret]
repo: website_comments
owner: ddong
admin: ddong
distractionFreeMode: true # Facebook-like distraction free mode
createIssueManually: false
Create a file gitalk.swig under folder next/layout/_third-party/comments. See below for the file content.
{% if theme.gitalk.enable %}
{% if page.comments %}
{% endif %}
{% endif %}
Update the file index.swig under folder next/layout/_third-party/comments to add the below code
{% include 'gitalk.swig' %}
Update the file comments.swig under folder next/layout/_partials to add the below code
{% elseif theme.gitalk.distractionFreeMode %}
<div id="gitalk-container"></div>
Errors & Tips
Error message:
After the change on a post, a page or a configuration file, the change is not reflected on the site.
Solution:
Clean the cache by running the command hexo clean
Error message:
The LivePreview functionality is not working for MarkdownPad editor. The error message is The view has crashed!.
Solution:
Install Awesomium 1.6.6 SDK from this link and restart the computer
Error message:
If you are using SSH to deploy your Hexo contents to GitHub, you got an error message Could not read from remote repository when you are running the command hexo deploy to deploy the site to GitHub via cmd.
Solution:
Use Git Bash to run the command, instead of cmd
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1 | $ hexo new "My New Post" |
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
1 | $ hexo deploy |
More info: Deployment