Running elasticsearch and Kibana as docker container

docker pull elasticsearch:8.3.1
docker pull kibana:8.2.1
docker network create es_net
docker run -d --name elasticsearch --net es_net -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:8.3.1
docker run -d --name kibana --net es_net -p 5601:5601 kibana:8.3.2
# go into console container
$ docker exec -it <elasticsearch_container_id> /bin/sh
# create enrollment token
$ bin/elasticsearch-create-enrollment-token --scope kibana
# go into console container
$ docker exec -it <kibana_container_id> /bin/sh
# get kibana verification code
$ bin/kibana-verification-code
# go into console container
$ docker exec -it <elasticsearch_container_id> /bin/sh
# reset password for elasticsearch
$ bin/elasticsearch-reset-password -a -u elastic

Encrypting and decrypting file using AWS KMS

create CMK (Customer managed key)

aws kms create-key --description [your key description] --region ap-southeast-2 

Create alias for the code

aws kms create-alias --target-key [key_id] "alias/[your alias]"

Encrypt file – encrypt file command always return base64 encoded text so you need to pipe base64 –decode command to decode the base64 string. Save the encrypted text out put in to [encrypted_file name].

–output – return the output in text

–query.- since the output values is json object you can pick the value from json object using output flag and specifying the property you would like to return. And out case it would be CiphertextBlob

aws kms encrypt --key-id [key-alias] --plaintext file://[your text file] --cli-binary-format raw-in-base64-out --output text --query CiphertextBlob | base64 --decode > [enrypted_file name]

Decrypt file – note: here you don’t need to specify which key you should be using to decrypt the text. Looks like it stores the last created key somewhere in cache to figure out which key to use to decrypt the data.

Note – you don’t specify the key when decrypting the file, because which key to use it’s embedded in the encrypted text so, you don’t have to specify the key. As long as you have access to the key and you specify the same region, it will successfully decrypt the file.

aws kms decrypt --ciphertext-blob fileb://[encrypted_file_name] --query Plaintext --output text | base64 --decode

Since by default CMK only allows 4 KB data to be encrypted/decrypted, if your requirement is to encrypt/decrypt more data, you should generate data-key using following command.

aws kms generate-data-key --key-id "alias/[your key name]"

output:
{
"CiphertextBlob":"xxx",
"PlainText":"xx",
"KeyId":"arn:xx"
}

Please store the CiphertextBlob at the end of each encrypted text.

You can use PlainText to encrypt the any amount of data and append the CiphertextBlob at the end of encrypted text. That way when you decrypt the data, CiphertextBlob contains the details about the encryption key. With Ciphertextblob alone, you can not decrypt the data as you require access to the KMS key in AWS.

Configuring internet on VirtualBox CentOS 8.0

  1. Make sure you have the network interface installed on Virtualbox. make sure DHCP is enabled.

 

2. Create Three networks of VM.

 

3. enable Network on OS

 

 

Configuring certbot on amazon linux

Download EPEL

sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/

Install repository package

sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm

Enable EPEL

sudo yum-config-manager --enable epel*

Verify repo

sudo yum repolist all

Restart httpd if needed

sudo systemctl restart httpd

install certbot

sudo yum install -y certbot python2-certbot-apache

run certbot

sudo certbot

to create certificate – use the following command if you are using apache server

certbot –apache -d [domain name] -d [domain name]

–agree-tos – use the flag for auto agree to tos

–redirect – use redirect flag if you would like to append redirect config in .d file for the domain, silently.

to automate cert renewal, schedule following command in cron tab

certbot renew –no-self-upgrade

How to remove empty lines in Visual Studio Code

How to remove empty lines in Visual Studio Code

Trying to figure out a way to remove those extra blank new lines in Visual Studio code is really simple. The method is similar to other IDE.

Visual Studio Code is fantastic code editor. It has most of the features of a good IDE and it’s free. Today I opened a code file of a developer and found out that there were many empty lines between programming expressions. In order to reduce the total number of lines I wanted to delete the extra lines.

Method 1:

Here are step by step instructions to remove those empty lines.

  1. Open your code in Visual Studio Code
  2. From Edit Menu, select Replace or use a short cut key (command + Option + F on Mac or Ctrl + H on Windows)
  3. In the find box type \n\n
  4. In the replace box type \n
  5. Make sure the ‘Use Regular Expression’ is selected
  6. Select ‘Replace All’ button

Method 2:

The above method should remove all the empty line however, if it didn’t then follow these steps:

  1. Open your code in Visual Studio Code
  2. From Edit Menu, select Replace or use a short cut key (command + Option + F on Mac or Ctrl + H on Windows)
  3. In the find box type ^(\s)*$\n
  4. Leave the replace box empty
  5. Make sure the ‘Use Regular Expression’ is selected
  6. Select ‘Replace All’ button

If you can’t find the above steps, here is a picture.

UiPath certificate questions and possible answers – updated

NOTE: Please note the answer which is might not be correct answers are they are just opinions.

You can download a working example of REframework from here

You can download security hash workflow from here

You can download yearly report workflow from here

How can you provide more details to explain the purpose of the activities in a workflow?

Annotation – Annotation is one of the way you can explain more details about the activities in workflow.

How can you dynamically change parts of a select?

One of the way you can use change the selector is to store dynamic part in variable and use the variable as selector.

Let’s say you have selector which type email in input textbox. And you would like to change the textbox to password dynamically.

You can create a variable called emailid and store the value as “email” text and change the select as “<webctrl id=’”+ emailid +”’ tag=’INPUT’ />”. When you change the value of emailid to “password” the type into activity try to put value in input box with id value as “password”

 

Which of the following types of variables can be defined in UiPath Studio?

In variable tabs, you can create variable as string, int32, Boolean, object and array[T]. you can also define other variable type by choosing “Browser for Types” option in drop down. “Browser for types” allows you to choose variable types like datatable, datarow, browser etc.

Is there any way to hide the execution of one activity in the logs?

Each activity have property called “Private”, you can find it in “MISC” property group. By clicking Private, the UiPath studio treat them as private activates and would not write to log

What direction can the arguments of a workflow have?

There are three kids of direction of arguments In, Out and in/out.

In  – In arguments are used to pass the variable values from parent workflow to child

Out – out argument are used to return the variable values from child workflow to parent workflow.

In/Out – in/out argument are used when the variable values can be change in parent and child workflow.

Which emails are deleted if you use Get IMAP Mail Messages with the DeleteMessages property set to true?

Only the emails that were marked as previously read,

Why is renaming activities considered to be one of the best practices?

For better readability and maintainability

Can you store a Selector in a variable?

Yes, you can store selector in a variable.

What can be used to debug a workflow?

You can use breakpoint, highlighter and slow stop. Breakpoint use to stop the execution when you are debugging the workflow. The highlighter is used when you would like to see which activities are getting executed and slow stop is used when you would like to slow down the debug processing.

What robots can be selected when you start a job from Orchestrator?

The one in which allocated to the same environment as the job – Jobs are tied to the environment and you can only choose robots to execute jobs which are in same environment.

What is the best way of restricting the access of a person to a limited number of pages in Orchestrator?

Create group and restricting access via group – creating group is the best way to restricting access for new users. When you create access control based on users, it might be difficult to manage when individual leaves or change the position.

What robot state is displayed on the Robots page while a job is being executed?

Busy

What happens when a new version of a package is published?

You need to update package to newer version – when you published new version of package, UiPath does not automatically update the package in workflow as it might break the workflow, instead it allows use to choose which version of package workflow needs. So you might have multiple version of same package and have different workflow running different version.

What do the Items in the Orchestrator queues consist of? Select all the options that apply.

Data for jobs to execute – Queue are the set of data which will get use by jobs. And jobs process the workflow from packages. And it’ not necessary to have queue item to run the process. Queue item as used to help run multiple robots to speed up the executions.

How can a process be executed on three different robots?

You can assign jobs to robots, you can run jobs by selecting on robot on desktop – you can create job which are in same environment as three different robot and run the job. Or you can log on to machine where the robots are running and choose the jobs to run.

 “Add Assets” in Orchestrator has the following option:

You can add asset by robot or you can add asset as single value.

This is a reliable selector for a dynamic web page: webctrl idx=’144′ tag=’IMG’/

No – it’s not idx is not a good selector. Idx attribute is not idel for selector when there is dynamic page. Idx – stands for the index number of the element. Given that the website is dynamic, there are higher number of chances that the number of element will be change hence idx. If you have options, look for class property or name property in parent element to make the selector reliable.

Where should you store the environment settings that are prone to changes?

Assets on orchestrator, or setting file excel or JSON file – best way to store the settings which are common for robots is assets. Seond best options is to store in excel or json file. Excel and json file are less secure option as they are part of package and they get copied to local machine where the jobs are running. Hence, person who have access to machine on which the jobs are running can change the file content.

You want to build a Dispatcher process to populate an Orchestrator Queue for parallel processing on multiple robots. Which activity should you use to add a queue item for each work item?

Add Queue Item – by adding queue item, the initial state of queue item is new. When you add by Add Transaction item – initial state will be Transaction

In the UiPath Robotic Enterprise Framework template, in the Main workflow, the State Machine includes the following states:

Init – Init process initialize the application, kill any past application and get any configuration settings from orchestrator or excel files

Get transaction Data – get list of transactions to process

Process Transaction – this state actually process the transaction and increment transaction number to next one

End Process – this state close the applications

Which of the following statements are true? Select all the options that apply.

The recorder is used to create a skeleton for the UI automation

The Desktop recorder generates partial selectors

How should exceptions be handled? Select all the options that apply.

By using Try Catch activities inside the workflow for unexpected application exceptions.

By validating data using conditional blocks for business exceptions.

How can you retrieve the value stored in a Queue Item variable?

Use the SpecificContent property

Downloading a report from a web application takes a variable amount of time, but a pop-up window is shown when the download is finished. What should you do to check whether the file has been fully downloaded before continuing the process?

Use the On Element Appear activity and indicate the download pop-up window

If a large item collection is processed using For Each, which activity enables you to efficiently exit the loop after a specific moment?

Break activity – break activity is used to break out from for each, while and do while activity

In the UiPath Robotic Enterprise Framework template, if a System Error is encountered in the Init state of the Main workflow, which state is executed next?

End

What happens in the Init state of the Main workflow, in the UiPath Robotic Enterprise Framework template?

The robot reads the configuration file and initializes all the required applications.

Where should credentials be stored? Select all the options that apply.

Asset, encrypted on windows

What is the difference between a Click activity whose SimulateClick property is checked and another one with the same property unchecked?

The activity with the SimulateClick flag unchecked moves the mouse cursor over the target element, while the one with the flag set does not move the mouse cursor.

What layout should be used for UI navigation and data processing?

Sequence

UiPath Robotic Enterprise Framework, the value of MaxRetryNumber in the Config.xlsx file should be set to a number greater than 0 to enable the retry mechanism in the following cases:

Retry of login activity

One of the steps in your process is to authenticate on a web application. How can you check if the login succeeded or not?

Use an Element Exist activity to check whether the login succeeded by searching for an element that is only displayed in that case.

Which of the following are considered best practices?

Start your new sequence with a short annotation meant to explain the purpose of the workflow.

Think about the exceptions that might occur during the execution of the process.

In the UiPath Robotic Enterprise Framework template, in the Get Transaction Data state of the Main workflow, what happens before the next transaction item is retrieved?

We check if a stop signal was sent from Orchestrator

In the UiPath Robotic Enterprise Framework template, if a System Error is encountered in the Process Transaction state of the Main workflow, which state is executed next?

Init

What is the best way to select a row with a certain value from a column in Excel?

Use a Read Range Activity to retrieve the contents of the Excel file, and then use a Select method to identify the desired row.

Is it possible to retrieve the color of a specific Excel cell?

Only with an OCR Engine.

How does the Anchor Base activity work?

It searches for an UiElement by using another UiElement as anchor.

Which of the following SQL statements can be executed by using the activity called Execute Non Query?

You can use insert, update and delete activity to run the execute non query activity as these statement does not generate any result

Which activity provides the easiest way to loop through all the rows in a DataTable?

For Each Row – For each row allows easiest way to iterate through row in DataTable.

You need to collect employees data and send it by email as an Excel file. What type of workflow is the most suitable for the final part, which adds the file attachment, formats the email, and sends it?

Sequence – getting emails and processing it does not require complex business processing and there are no multiple state involded as well so above problem can be solved by using sequence workflow.

What robots can be selected when you start a job from Orchestrator?

Any robot in the same environment as the process to be executed – To execute job, robot have to be in same environment. And robot can be assigned to multiple environment as well. So if you have robots which can run production workflow you can use same robot to run test processes as long as you configured your assets to  read test settings instead of production.

 “Add Assets” in Orchestrator has the following option:

You can add asset by “Value Per Robot” and “Single Value”

What types of assets can be stored in Orchestrator?

Bool, String, Integer, Credential

What happens if you try to end the execution of a job by clicking the Kill/Terminate button in Uipath Orchestrator?

The execution process is killed.

Where can the logging level of a robot be changed from?

The robot settings, which are accessed via the UiPath Robot icon in the System tray.

Orchestrator, in the Edit Robot section, the Settings tab.

The best way of managing variable values within a workflow, so that they can be shared on different robots and environments is:

Using assets defined in Orchestrator.

What is the best practice to stop an ongoing job in Orchestrator?

By cancelling it and using a Should Stop activity inside the workflow.

One of the actions below is not required when starting processes with UiPath Orchestrator.

Creating a queue in Orchestrator – not all jobs require queue item to exists to run processes.

In the UiPath Robotic Enterprise Framework template, in the Get Transaction Data state of the Main workflow, what happens before the next transaction item is retrieved?

We check if a stop signal was sent from Orchestrator

How should a UiPath developer handle frequent changes in the project files?

By using a source control solution, such as SVN, TFS, etc. – with new version you can store workflow in GIT as well.

 

After adding an Invoke Workflow File activity and selecting the workflow to invoke, you need to:

Click Import Arguments, and then bind the arguments to the local variables or to some default values – by adding import argument UiPath studio, import the argument and create placeholder for argument in local workflow. From there you can either assign local variable as default value or hard code default values. By adding edit argument, you can only edit the imported argument.

How can you retrieve the value stored in a Queue Item variable?

Use the SpecificContent property – you can define like queueitem.SpecificContent(“property anme”).ToString  – to retrieve the value. By default the value of property is objct so you need to convert to string or integer based on your requirement.

How can you improve a selector?

By replacing the dynamic parts of an attribute with wildcards.

By using intermediate containers for a better matching of the UI element.

In the UiPath Robotic Enterprise Framework template, where can the GetAppCredentials workflow retrieve credentials from?

Orchestrator Asset

In the UiPath Robotic Enterprise Framework template, what happens if the processing of a transaction item fails with an Application Exception or a System Error?

All used applications are closed and then re-initialized.

The execution of the transaction item is retried if the MaxRetryNumber config value is greater than 0.

 

What is the best way to select a row with a certain value from a column in Excel?

Use a Read Range Activity to retrieve the contents of the Excel file, and then use a Select method to identify the desired row.

In the UiPath Robotic Enterprise Framework template, if a System Error is encountered in the Process Transaction state of the Main workflow, which state is executed next?

Init

You want to build a Dispatcher process to populate an Orchestrator Queue for parallel processing on multiple robots. Which activity should you use to add a queue item for each work item?

Add Queue Item

In which workflow in the UiPath Robotic Enterprise Framework template is the TransactionNumber global variable incremented by default?

SetTransactionStatus workflow

In the UiPath Robotic Enterprise Framework template, in the Main workflow, what is the default type of the TransactionItem variable?

QueueItem

What are the functions of the Outline panel?

It shows the structure of the workflow

If the Activities are properly named, it can be used to search and select specific Activities used inside the workflow

Which of the following are considered best practices?

Start your new sequence with a short annotation meant to explain the purpose of the workflow.

Include a Should Stop activity at the end of the workflow.

Think about the exceptions that might occur during the execution of the process.

One of the steps in your process is to authenticate on a web application. How can you check if the login succeeded or not?

Use an Element Exist activity to check whether the login succeeded by searching for an element that is only displayed in that case.

Downloading a report from a web application takes a variable amount of time, but a pop-up window is shown when the download is finished. What should you do to check whether the file has been fully downloaded before continuing the process?

 

 

In a Try Catch activity, how many times is the Finally section executed if no error occurs in the Try section?

Once

While automating an installation wizard, a pop-up window may or may not appear. What can you use to close the window without stopping the workflow?

Use a Click activity inside a Try Catch activity.

Use a Click activity with the ContinueOnError property set to True.

What happens in the Init state of the Main workflow, in the UiPath Robotic Enterprise Framework template?

The robot reads the configuration file and initializes all the required applications.

Which statement about the UiPath Robotic Enterprise Framework template is false?

The framework can be used only if you get the input data from the UiPath​ ​server​ ​queues.

Where should you store the environment settings that are prone to changes?

In Orchestrator, as assets

Inside config files (.xml, .json, .xlsx, etc.)

Which one of the statements below regarding the GetAppCredentials workflow included in UiPath Robotic Enterprise Framework is true?

It​ ​first​ ​tries​ ​to​ ​fetch​ ​​a​ ​credential ​​from​ ​Orchestrator.

In the UiPath Robotic Enterprise Framework template, if a System Error is encountered in the Init state of the Main workflow, which state is executed next?

End Process