12/6/17

How to Create Wi-Fi Hotspot in Ubuntu 17.04 (Support Android)

How to Create Wi-Fi Hotspot in Ubuntu 17.04 (Support Android)

This quick tutorial is going to show you how to create a WiFi hotspot in Ubuntu 17.04 laptop with support for Android devices.
First of all you need to connect to your Ubuntu laptop to a wired network, disable Wifi, and then do following steps:
1. Go to top-right corner network applet, select Edit Connections from drop-down menu.
In pop-up window, click the Add button.
edit-network-connection
2. Then choose Wi-Fi in the next ‘choose a connection type dialog’.
choose-wifi
3. Now in the new created WiFi hotspot, do:
  • In Wi-Fi tab, type in Connection name, SSID, and choose mode HotSpot.
  • In Wi-Fi security tab, choose an encrypted type and set a password.
  • In IPv4 Settings tab, select mode “Share to other computers”
  • wifi-hotspot
4. After saved the changes, enable Wi-Fi in the network menu, and it should automatically connected to this hotspot.
If not, select ‘Connect to Hidden Wi-Fi Network’ from network menu, and choose the new created hotspot from drop-down menu:
hidden-network
5. Finally your network menu will look like:
connect-to-hotspot
On you mobile phone or other devices, select connect to this Wi-Fi hotspot and enjoy!

11/3/17

CORS with spring-boot and angularjs not working

Add this class near to the place you create Application.java

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class SimpleCORSFilter implements Filter {

private final Logger log = LoggerFactory.getLogger(SimpleCORSFilter.class);

public SimpleCORSFilter() {
log.info("SimpleCORSFilter init");
}

@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {

HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;

response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With, remember-me");

chain.doFilter(req, res);
}

@Override
public void init(FilterConfig filterConfig) {
}

@Override
public void destroy() {
}

}

10/31/17

Find the Git Commit User — Jenkins Pipeline


I recently started to use Jenkins 2 Pipeline scripts to setup Continuous Delivery Process. I wanted to get the email of the Git user who has done the commit for that particular build. Initially idea was to use following global variables set by the Jenkins Git Plugin.
  • GIT_AUTHOR_NAME and GIT_COMMITTER_NAME
  • GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL
Somehow, things didn’t work as per the plugin documentation. So, I decided to use Git client with shell or batch scripts. Following is how it is done in both Linux and Windows environments.
In Windows — as usual some tricks required 
def commiterDetails = bat (
script: 'git --no-pager show -s --format=%%ae',
returnStdout: true
)
def commiter = extractCommiterEmail(commiterDetails)
def extractCommiterEmail(details) {
def arr = details.tokenize('\n')
def email = arr[2].trim()
return email
}

In Linux
committerEmail = sh (
script: 'git --no-pager show -s --format=\'%ae\'',
returnStdout: true
).trim()

9/26/17

Fix bug Intel Graphics Update tool for Linux* OS (the public key is not available: NO_PUBKEY 611B903CAB97EA77)

Fix bug "the public key is not available: NO_PUBKEY 611B903CAB97EA77"

$ sudo apt update
...                       
Err:7 https://download.01.org/gfx/ubuntu/17.04/main zesty InRelease   
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 611B903CAB97EA77
...                             
Reading package lists... Done                                                                                                                 
W: GPG error: https://download.01.org/gfx/ubuntu/17.04/main zesty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 611B903CAB97EA77
E: The repository 'https://download.01.org/gfx/ubuntu/17.04/main zesty InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.



Solution:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 611B903CAB97EA77
sudo apt-get update

8/28/17

Evolution - how to connect to the Office 365 service.

Office 365 (Evolution) - Configure Evolution


Best Effort Support Only

This document contains instructions on using a non-Microsoft email client, such as Apple Mail or Thunderbird. Microsoft does not recommend these clients for use with Office 365, and there are often significant limitations in client functionality as a result.
Because of this, the DoIT Help Desk is only able to offer best effort support for these clients, and certain issues may require the use of a Microsoft client in order to be resolved. For more information on Office 365 client support, please see: Office 365 - Which clients/protocols will be supported?.

This document explains how to connect to the Office 365 service.
Important: Use of Linux/Evolution is not supported and therefore the Help Desk will not be able to provide any type of troubleshooting. Use these instructions as a general overview for connecting your Office 365 account UW-Madison's implementation.
To configure the Evolution client to access the Office 365 environment, follow the steps below. Note that these instructions use Evolution 3.6.2 and the evolution-ews plugin version 3.6.
  1. If you have not already done so, install the evolution-ews package using your favorite package manager. This document assumes evolution-ews version 3.6. Mileage may vary on other versions.
  2. Launch Evolution
  3. Add a new account by going to Edit | Preferences and choose Add from the Mail Accounts menu.
  4. Click Continue
  5. Enter your name as you'd like it to appear and "netid@wisc.edu" or "first.lastname@wisc.edu" or "name@domain.wisc.edu" for Email Address, click Continue
  6. The account information screen will find incorrect information. Click Go Back
  7. On the resulting window, enter the following information for each field:
    • Server Type: Exchange Web Services
    • Username: netid@wisc.edu
    • Host URL: https://outlook.office365.com/EWS/Exchange.asmx
    Note: for further server/account details, see - Office 365 - Server and Account Configuration Settings. Some additional details can be found at Cardiff University support site.
  8. Click Fetch URL
  9. You will be prompted for your password. Enter your test NetID password.
  10. Host URL and OAB URL should be successfully discovered. Click Continue
  11. Click Continue to accept Receiving Options
  12. Enter any name for the account, and click Continue
  13. Click Apply
  14. If prompted, enter your test NetID password once more.
  15. Setup is complete. Email and calendar data will take some time to sync.

See Also:

8/18/17

Configure Jenkins with Github, Artifactory and Sonar Qube

Configure Jenkins with Github,Artifactory and Sonar Qube

To configure and use Gitlab, SonarQube, Jfrog Artifactory in Jenkins
Requirements on Jenkins Server:
1) Install java latest version (jdk1.7&jdk1.8)
2) Install Maven-3.3.9
3) Gitlab plugin
4) Git plugin
5) Credential plugin
6) Artifactory Plugin
7) SonarQube Plugin
1. To configure Gitlab with Jenkins, a common user account needs to be created. Log in to the Gitlab page below as an administrator.
a) Go to “Admin area” page using the settings symbol at top right corner
b) Click on “New User” button which takes you to the below screen
2. Enter the desired account details in respective fields and hit save.
a) An email with a link to reset the password will be sent to the email address entered above
b) Log out of current page and Log in from User account
b) Password page as shown below will be displayed to enter a new password
3. An “Access Token” needs to be setup in order to use it with Jenkins to get metadata from Gitlab
a) Go to Profile Setting, click on “Access Tokens” and create a new token:
b) Type the desired Token Name
c) Click “Create Personal Access Token
4. A personal Access Token string is generated as shown above
a) Copy and securely save the above token to avoid regeneration. However, you can create a new one if you lost or mess it up!
5. Log out of User Gitlab account and log back in as an Administrator.
6. Give the “user” account developer permissions to your new project/group
7. To do that, go to “Admin area” page
8. Hit on the respective Group or Project to add the user as shown below
9. For instance, type “user” to grant them developer permissions and hit “Add users to group
10. To configure Gitlab details in jenkins , so that jenkins can fetch up/checkout/get the code from the gitlab source control repositories we need to configure jenkins with the Gitlab server details in the jenkins configuration. Open up Jenkins page and navigate to “Manage > Configure System,” and scroll down to the “Gitlab” section. You’ll need to enter your Gitlab details into Jenkins.
11. Click on the Credentials drop down list to add “Gitlab Api Token” and enter the API token(that was asked to save securely in step 4) in jenkins as shown below.
12. Advance to the next step and make sure that “Kind” credential is selected in the dropdown. If it doesn’t appear, you need to add the “credentials” plugin.
13. In case, if that doesn’t work, install the “Plain Credentials” plugin and restart Jenkins. After that it should be selectable.
14. Go back to Jenkins page and navigate to “Manage -> Global Tool Configuration,” and scroll down to the “Git” section. Specify the path where you installed the Git (should be latest version — 2.11) and save it.
15. Enter the local Git location as shown above.
16. We can now see, Jenkins is configured into our Gitlab.
17. A job to continuously build our application can be setup using the main screen of Jenkins following the below steps
a) Click on create a new “freestyle” job:
b) Scroll down to Source Code management, select Git, and enter your repo details:
C) Scroll down to “Build Trigger”, and select “Poll SCM” option by enabling the poll SCM and entering a cron expression**** in the Schedule text box we can get Jenkins to poll the Git repository for any changes at scheduled time.
18. Click on save button and trigger a build, make changes to your code commit and push it. Now it will automatically notify Jenkins to build your code.

Configure Artifactory repository details in Jenkins:

We use JFrog Artifactory as binary repository mangment tool. Nexus is also another binary repository management toll widely used.
1-we need to have common user to communicate between Jenkins and artifactory, login to the Jforg Artifactory console as an administrator.
a) Go to Admin area navigate to Users Click on “New User” button which takes you to the below screen.
b) Enter the desired fields and make sure to tick Disable UI Access (We are using this user only for connectivity between Jenkins and Jforg Artifactory not to access the UI) Click save.
c) On Jenkins console navigate to “Manage Jenkins” scroll down and go to “Artifactory ”location and configure as shown below and click on test connection. You will find Artifactory version if connection is success .

Configure Maven path in Jenkins:

To build the java based appication we use maven as a build tool. Firstly, we install maven in the jenkins box/server, Next go to Jenkins page click on “Manage > Global Tool Configuration,” and scroll down to the “Maven” section. You’ll need to enter the path where you have installed maven into Jenkins.

Configure Sonar Qube details in Jenkins:

To run unit tests, code coverage tests and to perform code coverage analysis we use Sonar Qube and we want to publish code coverage analysis in Sonar Qube for every successful build job.
a) Login to Jenkins as administrator click on Manage Jenkins and navigate to Manage Plugins to install “SonarQube Plugin
b) Goto Configure System of Jenkins to provide “SonarQube” server details as below.
c) Then configure SonarQube to jobs in Jenkins, go to build session enable “Prepare SonarQube Scanner environment” to inject environment variables related to the chosen SonarQube installation.
d) Add post-build step to configure “Execute SonarQube Scanner”.
Note: Always mention the sonar.projectKey=JobName(your/respective job name)
e) Analysis properties allows to pass some configuration parameters to SonarQube.
f). Once job is success you will find the output by clicking on “SonarQube”.