tag:blogger.com,1999:blog-24272719562780003512024-03-12T22:04:27.006-07:00My Tech Tipslakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-2427271956278000351.post-38577217089392099932019-01-15T08:00:00.002-08:002019-01-20T01:59:35.634-08:00How to choose IP address range for resources for AWS virtual private cloudYou will often need to allocate an IP address range when you design the network of an AWS VPC.<br />
Since VPC is a small network of resources(EC2, RDS etc.) you can use IPV4 private addresses.<br />
There are 3 classes of private IP Addresses.<br />
<table style="background-color: white; border-collapse: collapse; color: #222222; font-family: arial, sans-serif; font-size: small; table-layout: fixed; width: 600px;"><tbody>
<tr class="ztXv9" style="border-bottom: 1px solid rgb(235, 235, 235);"><th style="color: black; font-weight: bolder; height: 26px; overflow-wrap: normal; padding: 0px 10px 0px 0px; text-align: left;"><b> Class</b></th><th style="color: black; font-weight: bolder; height: 26px; overflow-wrap: normal; padding: 0px 10px; text-align: left;"><b>Private</b> Networks </th><th style="color: black; font-weight: bolder; height: 26px; overflow-wrap: normal; padding: 0px 10px; text-align: left;">Subnet Mask</th></tr>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);"><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px 0px 0px;"> A</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">10.0.0.0</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">255.0.0.0</td></tr>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);"><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px 0px 0px;"> B</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">172.16.0.0 - 172.31.0.0</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">255.240.0.0</td></tr>
<tr style="border-bottom: 1px solid rgb(235, 235, 235);"><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px 0px 0px;"> C</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">192.168.0.0</td><td style="height: 26px; overflow-wrap: normal; padding: 0px 10px;">255.255.0.0</td></tr>
</tbody></table>
<br />
For this post I choose IP addresses starting from 10.0.0.0.<br />
<br />
<br class="Apple-interchange-newline" />
IPv4 Address has four fields separated from dot like below.<br />
<br />
xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx<br />
<br />
ex : binary form : 11111111.11111111.11111111.11111111<br />
decimal form : 255.255.255.255<br />
<br />
Each field can be varied from 0000 to 1111. That is from decimal, 0 to 255 and we have 32 bits in IP address.<br />
<br />
IP address can be divided into two parts.<br />
<br />
1. Host portion<br />
2. Network portion<br />
<br />
The network portion of the address is the part of IP address which is reserved to identify the network. The host portion of the address is the part of IP address which is reserved for the individual resources on the network.<br />
<br />
Let's say I want allocate IP address range for 256 machines.<br />
<br />
Then it can be represented as 10.0.0.0/24. This is called CIDR notation. In CIDR notation we can say what IP address slot is reserved for the resources in network. In our example 24 means first 24 bits are reserved for the network part of the IP addresses and rest 8 bits are reserved for host part of the IP addresses.<br />
<br />
That means 10.0.0.0 to 10.0.0.255 can be taken from any computer in the network.<br />
<br />
ex: 10.0.0.1 , 10.0.0.2 etc.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis8ahvfq6VQqoJSKd412TMws9NSTq53hw-s-ui0TKraJ1a7e6vaLofHKUZD9VmWMySAReMkVMjzbDG8PWykBE4NUJdEH-kZNwid0CRN8WXLmN5KvW-H6Xt__s-k_bJoUPbJuxmUKZrhmw/s1600/cidr.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="268" data-original-width="603" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis8ahvfq6VQqoJSKd412TMws9NSTq53hw-s-ui0TKraJ1a7e6vaLofHKUZD9VmWMySAReMkVMjzbDG8PWykBE4NUJdEH-kZNwid0CRN8WXLmN5KvW-H6Xt__s-k_bJoUPbJuxmUKZrhmw/s400/cidr.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">bit division in cidr</td></tr>
</tbody></table>
<br />
So 10.0.0 will be unchanged and can be used to identify the network.<br />
<br />
Hope this helps. Please post a comment if something unclear.<br />
<br />
Thank you.<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-7670453385336489262018-09-03T10:27:00.002-07:002018-09-03T10:35:29.413-07:00How to start angular developmentThis blog post aim to start the development environment with Angular as quickly as possible.<br />
<br />
<b><u>Prerequisites</u></b><br />
<ol>
<li>Install npm and node latest versions<br />In my computer, node version : v8.10.0, npm version : 3.5.2</li>
<li>Install angular cli. Use below command to install angular cli.<br /><b><span style="color: #cfe2f3;">npm install -g @angular/cli</span></b><br />My Angular CLI version : 6.1.2. Type <b><span style="color: #cfe2f3;">ng -v </span></b>to see angular CLI version.</li>
<li>Install visual code editor. This editor is great tool with lot of helper plugins to start with angular development. </li>
</ol>
<div>
Now time to create new angular project!</div>
<div>
<br /></div>
<div>
1. Type below command to create a new project called test-app</div>
<div>
<br /></div>
<div>
<span style="color: #cfe2f3;"><b>ng new test-app</b></span></div>
<div>
<br /></div>
<div>
This will create basic project scaffolding to start with. Now go to test-app folder and start a development server from there</div>
<div>
<br /></div>
<div>
<b><span style="color: #cfe2f3;">cd test-app</span></b></div>
<div>
<b><span style="color: #cfe2f3;">ng serve --open</span></b></div>
<div>
<b><span style="color: #20124d;"><br /></span></b></div>
<div>
This will open browser window automatically at <b><a href="http://localhost:4200/">http://localhost:4200/</a></b> url.</div>
<div>
<br /></div>
<div>
Now time to hack the generated project code and create an awesome project!</div>
<div>
Type <span style="color: #cfe2f3;"><b>code .</b></span> to open the code in visual code editor.</div>
<div>
<br /></div>
<div>
<br /></div>
lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-43343602285181580402018-07-02T09:13:00.000-07:002018-07-05T08:46:02.680-07:00Boost the speed of calculating Large Primes with GolangFollowing points are used<br />
<br />
1. Check whether the last digit of the integer can be divided by 2 or not<br />
2. Check whether the sum of all digits of the integer can be divided by 3 or not<br />
3. Check whether the last digit of the integer can be divided by 5 or not<br />
4. If all the above checks fails Check whether there is an integer from 7 to square root of number which is divide the number<br />
<br />
<br />
<br />
<br />
<script src="https://gist.github.com/laki88/59ac5182512cc2f92b48d7e213c8828e.js"></script>
<div style="display:none"> package main
import (
"fmt"
"math"
"strconv"
)
func main() {
fmt.Printf("275489 is a prime : %t", isPrime(275489))
}
func isPrime(num int) bool {
if !canBeDivideBy2(num) && !canBeDivideBy3(num) && !canBeDivideBy5(num) {
isPrime := true
//If the number can not be divided by 2, 3 or 5 divide from 7 to squre root of the number to check the existence of a factor
for i := 7; i <= int(math.Sqrt(float64(num))); i++ {
if num%i == 0 {
isPrime = false
break
}
}
return isPrime
}
return false
}
// If the last digit can be divided by 2 whole number can be divided by 2
func canBeDivideBy2(num int) bool {
numAsStr := strconv.Itoa(num)
lastNum, _ := strconv.Atoi(string(numAsStr[len(numAsStr)-1]))
return lastNum%2 == 0
}
// If the digit sum can be divided by 3 whole number can be divided by 3
func canBeDivideBy3(num int) bool {
numAsStr := strconv.Itoa(num)
sum := 0
for i := 0; i < len(numAsStr); i++ {
iThNum, _ := strconv.Atoi(string(numAsStr[i]))
sum += iThNum
}
return sum%3 == 0
}
//If the last digit can be divided by 5 whole number can be divided by 5
func canBeDivideBy5(num int) bool {
numAsStr := strconv.Itoa(num)
lastNum, _ := strconv.Atoi(string(numAsStr[len(numAsStr)-1]))
return lastNum%5 == 0
} </div>lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-38430843223968901412018-07-02T00:36:00.001-07:002018-07-02T02:08:09.399-07:00Check last JRE access timeJRE will create and update a file in a directory called <b>oracle_jre_usage</b> located in<br />
<ul>
<li>Windows : %ProgramData%\Oracle\Java\.oracle_jre-usage\ </li>
<li>All other operating systems: ${user.home}/.oracle_jre_usage/</li>
</ul>
<div>
ex: I have used ubuntu 18.04. So when I start intellij idea it will create a file like below<br />
<br />
<b>l<i>akshman@lakshman-Latitude-3580:~/.oracle_jre_usage$ vim 9e360713136aba0a.timestamp</i></b><br />
<br />
File content is as follows<br />
<br />
<b><i>/usr/lib/jvm/java-8-oracle/jre</i></b><br />
<b><i>1530512372457</i></b><br />
<b><i>~ </i></b><br />
<br />
As you can see the last access time can be found in timestamp format.<br />
<br />
From JDK 8u171 and later updates and JDK 10 and later, usage tracking can be disabled by using <b>jdk.disableLastUsageTracking </b>property.<br />
<br />
ex:<i><b> java -Djdk.disableLastUsageTracking=true -jar lastUsageTracking-executable.jar</b></i></div>
lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-38776999411791611232017-07-05T11:38:00.001-07:002017-07-23T20:24:32.069-07:00PDF generation with Apache FOPWhat is Apache FOP?<br />
Apache FOP is a print formatter driven by XSL formatting objects(XSL-FO). It is a library to read XSL FO objects and generate documents with specified output format. Here I have used pdf as the output format.<br />
<br />
What is XSL?<br />
<br />
XSL is a language for expressing stylesheets. It describes how to display data in an XML file.<br />
<br />
What is XSL FO?<br />
<br />
XSL FO is a part of XSL which is a markup language for XML document formatting. Follow <a href="http://w3schools.sinsixx.com/xslfo/default.asp.htm" target="_blank">W3school tutorial</a> for XSL FO.<br />
<br />
How Apache FOP generate PDFs.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1MlojSdTCY8ekgWt98owfHW7xT1RrwxcDs6mBcsxjHdbvC_xdGuN8n9m8xB6Wvg7qudUqQCcDh3UKbiHtQnTTTZ970crQ3G5rGZ1NHc1Zq-1y-w-lQja_tBtIBg2fNL68aaBXIgrCNd0/s1600/How_FOP_works.png" imageanchor="1"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1MlojSdTCY8ekgWt98owfHW7xT1RrwxcDs6mBcsxjHdbvC_xdGuN8n9m8xB6Wvg7qudUqQCcDh3UKbiHtQnTTTZ970crQ3G5rGZ1NHc1Zq-1y-w-lQja_tBtIBg2fNL68aaBXIgrCNd0/s320/How_FOP_works.png" width="240" /></a><br />
<br />
I have generated javaFX form to enter the data and when I click the print button after filling data, PDF will be created in a folder called PDFs. source code for this available in <a href="https://github.com/laki88/PatientDischargeForm">https://github.com/laki88/PatientDischargeForm</a>.<br />
<br />
<br />
<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-44077453424913568432017-03-23T05:53:00.002-07:002017-03-23T05:53:27.638-07:00JDBC drivers and connection stringsRecently I was fixing a bug in gadget creation in WSO2 DAS 3.1.0 in which gadget creation throws errors on some database types. So I have to check for major database types for gadget creation and I came up with following database drivers and connection strings and little more information their JDBC drivers.<br />
<br />
MySQL<br />
Driver class : com.mysql.jdbc.Driver<br />
Connection string : jdbc:mysql://localhost:3306/databaseName<br />
<br />
You can download JDBC driver from <a href="https://dev.mysql.com/downloads/connector/j/">their official site.</a><br />
<br />
MSSQL<br />
Driver class : com.microsoft.sqlserver.jdbc.SQLServerDriver<br />
Connection string :jdbc:sqlserver://hostName:1433;database=databaseName<br />
<br />
You can download MSSQL driver from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=11774" target="_blank">microsoft site</a>. According to the JRE it comes from several flavours as below.<br />
<br />
• Sqljdbc41.jar requires a JRE of 7 and supports the JDBC 4.1 API <br />
• Sqljdbc42.jar requires a JRE of 8 and supports the JDBC 4.2 API <br />
<br />
Apart from official MSSQL driver there are other supported drivers like jtds as well. You can find more information about them by referring <a href="http://stackoverflow.com/questions/6943553/list-of-jdbc-drivers-for-sql-server-2008-comparison" target="_blank">this stackoverflow question.</a><br />
<br />
PostgreSQL<br />
Driver class : org.postgresql.Driver<br />
Connection string : jdbc:postgresql://localhost:5432/databaseName<br />
<br />
You can download the PostgreSQL driver from <a href="https://jdbc.postgresql.org/download.html" target="_blank">their official site</a> and it also comes in different flavours depend on the Java version. It would be very easy to work with PostgresSQL if you are using <a href="https://postgresapp.com/">postgres.app</a>. For mac users, note that to uninstall all previous versions of PostgreSQL versions to work with postgres app.<br />
<br />
DB2<br />
Driver class : com.ibm.db2.jcc.DB2Driver<br />
Connection string : jdbc:db2://myhost:5021/mydb<br />
<br />
You can download db2 JDBC driver from <a href="http://www-01.ibm.com/support/docview.wss?uid=swg21363866">their official site</a>.<br />
<br />
Oracle<br />
Driver class : oracle.jdbc.OracleDriver<br />
Connection string : jdbc:oracle:thin:@hostName:1521/wso2qa11g<br />
<br />
You can download Oracle JDBC driver from <a href="http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html" target="_blank">their official site</a>.<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-3753758746263484742017-02-28T09:37:00.001-08:002018-07-01T22:46:50.328-07:00Simple wait and notify example in JavaThis example demonstrate wait and notify example. Main thread(ThreadA) will create threadB and will start threadB. After threadB started, it just print that it is started and will go to WAITING state by calling wait(). Meanwhile threadA goes to sleep for 3 seconds and will print that it is awaked and will notify threadB by calling notify(). This will cause to threadB goes to RUNNABLE state. Then it will resume the threadB's execution and will print that it is notified.<br />
<br />
<script src="https://gist.github.com/laki88/94fcb12bdea21437e5c8bcd91315cff7.js"></script>
<br />
Note that when we call wait() and notify(), it should call inside synchronised context. Otherwise it will throw<span style="color: #20124d;"> <span style="color: #f4cccc;">java.lang.IllegalMonitorStateException</span><span style="color: #20124d;">.</span></span> We have to pass a lock object to the synchronised block. That object will be blocked during the execution of synchronisation block. In this case I pass the threadB itself as the lock object.lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-87572410606976172932017-01-23T22:17:00.004-08:002017-01-23T22:17:47.350-08:00Customize the place where tomcat instance creating for wso2 4.4.x serversWSO2 4.4.x servers run on an OSGIfied tomcat. It creates the tomcat instance on <CARBON_HOME>/lib/tomcat directory. You can customize this path to your own one by changing the property "<span style="background-color: white; color: green; font-family: Menlo; font-size: 9pt; font-weight: bold;">catalina.base</span>" in wso2server.sh.lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-8678967747237865192016-04-29T04:36:00.000-07:002018-05-20T09:51:19.660-07:00Policy add using Rest API in WSO2 EMMYou can add a policy using REST API given in EMM. For the use the dynamic registration client given.<br />
below sample curl command will return client id and secret<br />
<br />
<br />
<div class="p1">
<span class="s1"><b>curl -k -H "Content-Type: application/json" -X POST -d '{"owner":"admin","clientName":"admin_emm","grantType":"refresh_token password client_credentials","tokenScope":"prod"}' https://localhost:9443/dynamic-client-web/register</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">This will return a response like below</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">
</span></div>
<div class="p1">
<span class="s1"><b>{"client_secret":"YCnfi_jp9Tso0qyRcbGxaQnYctga","callback_url":null,"client_id":"xJvKvUHNYqfK1MeQ_VybtBfF5MAa","client_name":"admin_admin_emm"}</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Use the client id and secret by encoding using base64 to generate access token using below command</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">
</span></div>
<div class="p1">
<span class="s1"><b>curl -k -d "grant_type=password&username=admin&password=admin&scope=default " -H "Authorization: Basic eEp2S3ZVSE5ZcWZLMU1lUV9WeWJ0QmZGNU1BYTpZQ25maV9qcDlUc28wcXlSY2JHeGFRblljdGdh" -H "Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">This will return a response like below</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">
</span></div>
<div class="p1">
<span class="s1"><b>{"scope":"default","token_type":"Bearer","expires_in":3600,"refresh_token":"97c3c78b8c2c4e2ccd5424ffc7259d3e","access_token":"60a810d5baa3361af9aa5e6d8cf76ea9"}</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Use the generated access token to call the policy publishing API. </span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Below is a sample curl command to create black list policy</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">
</span></div>
<div class="p1">
</div>
<div class="p1">
<span class="s1"><b>curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 60a810d5baa3361af9aa5e6d8cf76ea9" -d @'operation.json' -k -v https://localhost:9443/mdm-admin/policies/active-policy</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Resource path : </span>/active-policy</div>
<div class="p1">
URL : /mdm-admin/policies/active-policy</div>
<div class="p1">
HTTP Method : POST</div>
<div class="p1">
Request/Response format : application/json</div>
<div class="p1">
<br /></div>
<div class="p1">
Sample payload in operation.json is </div>
<div class="p1">
<br /></div>
<div class="p1">
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;">{</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "policyName": "black list",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "description": "",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "compliance": "enforce",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "ownershipType": "ANY",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "profile": {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "profileName": "black list",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "deviceType": {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "id": 1</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> },</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "profileFeaturesList": [</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "featureCode": "APP-RESTRICTION",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "deviceTypeId": 1,</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "content": {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "restriction-type": "black-list",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "restricted-applications": [</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "appName": "app name1",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "packageName": "package1"</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> },</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "appName": "app name2",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "packageName": "package2"</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> },</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> {</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "appName": "app name3",</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "packageName": "package3"</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> }</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> ]</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> }</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> }</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> ]</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> },</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "roles": [</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> "ANY"</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"> ]</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;">}</span><br />
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"><br /></span>
<span style="color: #666666; font-family: ubuntu mono, menlo, monaco, consolas, courier new, monospace;"><br /></span></div>
<div class="p1">
After making above curl command you will get successful response as below</div>
<div class="p1">
<br /></div>
<div class="p1">
<span class="s1"><b>* Trying 127.0.0.1...</b></span></div>
<div class="p1">
<span class="s1"><b>* Connected to localhost (127.0.0.1) port 9443 (#0)</b></span></div>
<div class="p1">
<span class="s1"><b>* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256</b></span></div>
<div class="p1">
<span class="s1"><b>* Server certificate: localhost</b></span></div>
<div class="p1">
<span class="s1"><b>> POST /mdm-admin/policies/active-policy HTTP/1.1</b></span></div>
<div class="p1">
<span class="s1"><b>> Host: localhost:9443</b></span></div>
<div class="p1">
<span class="s1"><b>> User-Agent: curl/7.43.0</b></span></div>
<div class="p1">
<span class="s1"><b>> Accept: */*</b></span></div>
<div class="p1">
<span class="s1"><b>> Content-Type: application/json</b></span></div>
<div class="p1">
<span class="s1"><b>> Authorization: Bearer 60a810d5baa3361af9aa5e6d8cf76ea9</b></span></div>
<div class="p1">
<span class="s1"><b>> Content-Length: 460</b></span></div>
<div class="p1">
<span class="s1"><b>> </b></span></div>
<div class="p1">
<span class="s1"><b>* upload completely sent off: 460 out of 460 bytes</b></span></div>
<div class="p1">
<span class="s1"><b>< HTTP/1.1 200 OK</b></span></div>
<div class="p1">
<span class="s1"><b>< Date: Fri, 29 Apr 2016 11:19:39 GMT</b></span></div>
<div class="p1">
<span class="s1"><b>< Content-Type: application/json</b></span></div>
<div class="p1">
<span class="s1"><b>< Content-Length: 76</b></span></div>
<div class="p1">
<span class="s1"><b>< Server: WSO2 Carbon Server</b></span></div>
<div class="p1">
<span class="s1"><b>< </b></span></div>
<div class="p1">
<span class="s1"><b>* Connection #0 to host localhost left intact</b></span></div>
<div class="p1">
</div>
<div class="p1">
<span class="s1"><b>{"statusCode":201,"messageFromServer":"Policy has been added successfully."}</b></span><br />
<span class="s1"><br /></span>
Created policy bundle will show in policy management window of EMM UI.</div>
lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-89307786559264767502016-04-27T07:23:00.001-07:002016-04-27T07:23:36.335-07:00Application Whitelist and Blacklist Feature in WSO2 EMMIt can be white listed and black listed applications in WSO2 EMM 2.1.0 onwards.<br />
<br />
What is Application White List?<br />
White listed applications are the only applications that allowed run on device. Any other application which does not appear on the list will not be allowed to run on the device.<br />
What is Application Black List?<br />
Black listed applications are the applications that are not allowed to run on the device.<br />
<br />
Application black lists and white lists can be deployed on devices as device policies. Follow the below steps to create black list.<br />
<br />
1. Enroll a device on EMM.<br />
2. Create an app restriction policy<br />
i) Go to the EMM main window by issuing below url to the browser address bar<br />
https://localhost:9443/emm/<br />
ii) Click policy add button as shown in below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBb01L4EnQwGRDjynhC5W4Dw3WbNpzLSugEj6d6yHogvZIBWeXGTAkKiFMuHHJBp2Lk4I07Qu9ggS_cNyfworv0V5BUb2sq4psAgzZRdsEArZ8MftCMMRijEAw0nWCmGXIlUsn4F8WJd8/s1600/policy_add.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBb01L4EnQwGRDjynhC5W4Dw3WbNpzLSugEj6d6yHogvZIBWeXGTAkKiFMuHHJBp2Lk4I07Qu9ggS_cNyfworv0V5BUb2sq4psAgzZRdsEArZ8MftCMMRijEAw0nWCmGXIlUsn4F8WJd8/s640/policy_add.png" width="640" /></a></div>
iii) Choose the platform. ex : I choose android platform.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLVgd_Mb2l4rsl_CYvGBvSSixr_zUQLFseZSab1oN8-n_yZnRH60i3oTuvWfOo3REwygqbBge5BO_A4zmhENVsTLdnPUAj5lUgn0nrXrL88GFutRrCI0qRlluDvvM54zdlylub6qt2Us8/s1600/choose_platform.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="104" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLVgd_Mb2l4rsl_CYvGBvSSixr_zUQLFseZSab1oN8-n_yZnRH60i3oTuvWfOo3REwygqbBge5BO_A4zmhENVsTLdnPUAj5lUgn0nrXrL88GFutRrCI0qRlluDvvM54zdlylub6qt2Us8/s640/choose_platform.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
iv) Click Applications Restrictions profile and click Off toggle button to On the profile<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWP-IVTfZquKO2kohWf2TMO8lEon-eOnfvumkikI7P3DDmu4WirLr8lGkktY3vV3AdhjXwmpZuo158taYyFR6u9v_PKPcOBigjMwryN6o76ggzd5CmRjaham0pkEPTbfQO381UbackIq8/s1600/Click_app_restriction.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWP-IVTfZquKO2kohWf2TMO8lEon-eOnfvumkikI7P3DDmu4WirLr8lGkktY3vV3AdhjXwmpZuo158taYyFR6u9v_PKPcOBigjMwryN6o76ggzd5CmRjaham0pkEPTbfQO381UbackIq8/s640/Click_app_restriction.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
v) Choose black list from select box and add applications as below. Note that to add a description about the application in App Name/Description column and to add the package name of the application in Package Name column. Click continue button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7E8dzkkInzcMPA7VCLy-xtrbb1Y1XiwTc42uyYQ1vqnozRwFTGFbu7_7vObj7Z8Rzr5WIZ4nzCBJyPx6I8Dz4aBUdfffPo0JuFmpenXrLocuSJvmetS7sJXZ34xJ6qq4RNA91QSeSYhQ/s1600/create_black_list.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7E8dzkkInzcMPA7VCLy-xtrbb1Y1XiwTc42uyYQ1vqnozRwFTGFbu7_7vObj7Z8Rzr5WIZ4nzCBJyPx6I8Dz4aBUdfffPo0JuFmpenXrLocuSJvmetS7sJXZ34xJ6qq4RNA91QSeSYhQ/s640/create_black_list.png" width="640" /></a></div>
<br />
<br />
vi) Select device owner type, user or role and policy action level from current wizard<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPc1qafAnNb6XY42e2t7GvQMEm-AVTULzd71dyhxghRvYZFDGF8Pq2kqIq3kUYCF-XWRCr8msabyqryCL_7Q3B_QkZi4q2PH4xqF7rTvyHa-S8iMyfeiQcRizUrkg4-gLBDHLRxJajMVQ/s1600/assign_policy_group.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="324" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPc1qafAnNb6XY42e2t7GvQMEm-AVTULzd71dyhxghRvYZFDGF8Pq2kqIq3kUYCF-XWRCr8msabyqryCL_7Q3B_QkZi4q2PH4xqF7rTvyHa-S8iMyfeiQcRizUrkg4-gLBDHLRxJajMVQ/s640/assign_policy_group.png" width="640" /></a></div>
vii) Type a policy name and description about policy and click publish to Device button from current wizard<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-V2YAWycn4NVHbKmxkOTxibU2ZgOLQjQuw0ZHJ6PbgY2hxETEkysLBfUs-cn8f4lJiMF7Y75oNAZnFSi6-esbWXepjFZ1Wkerx6j-VkkraK9IhcdNusd-4gadewdWyQ3ZWmc1KfIELmg/s1600/publish_to_device.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="382" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-V2YAWycn4NVHbKmxkOTxibU2ZgOLQjQuw0ZHJ6PbgY2hxETEkysLBfUs-cn8f4lJiMF7Y75oNAZnFSi6-esbWXepjFZ1Wkerx6j-VkkraK9IhcdNusd-4gadewdWyQ3ZWmc1KfIELmg/s640/publish_to_device.png" width="640" /></a></div>
<br />
viii) Now click the policy view button and you will redirect to below page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhel-N6eyTpppHpFkiCxYbwCY3ri-4bzKPro0MTpyzqeq5DrPdsLj-mqW6UP9yqj5UWNL0Zx7kXQdTD2X0AQC1OrJHTaTbd0oUZFSI8nlRUNH0TdFKf2h4h4UYvfDd1Zls8610c6S3iRrA/s1600/policy_listing_page.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="346" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhel-N6eyTpppHpFkiCxYbwCY3ri-4bzKPro0MTpyzqeq5DrPdsLj-mqW6UP9yqj5UWNL0Zx7kXQdTD2X0AQC1OrJHTaTbd0oUZFSI8nlRUNH0TdFKf2h4h4UYvfDd1Zls8610c6S3iRrA/s640/policy_listing_page.png" width="640" /></a></div>
<br />
<br />
ix) Now click the APPLY CHANGES TO DEVICES button to change take effect as below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWS7YjcYKxTBdPPcC_leSBg3QaKg3_ZTqrYUPuGFqa5PQLu5RcLvl5NYz1igzY1CAfUzEEJpscM4HbtIDotfjMToEfhjBxIBC2JK60UeCAwfi1mdUnb8mOj01YYKbLmVehLCRaiiZB6NI/s1600/policy_applying_to_device.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWS7YjcYKxTBdPPcC_leSBg3QaKg3_ZTqrYUPuGFqa5PQLu5RcLvl5NYz1igzY1CAfUzEEJpscM4HbtIDotfjMToEfhjBxIBC2JK60UeCAwfi1mdUnb8mOj01YYKbLmVehLCRaiiZB6NI/s640/policy_applying_to_device.png" width="640" /></a></div>
<br />
You can follow the same steps as above to create a white list as well.<br />
<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com4tag:blogger.com,1999:blog-2427271956278000351.post-6161000103270832322016-04-07T06:38:00.000-07:002017-03-05T23:53:14.708-08:00WSO2 APP Manager(APPM) and WSO2 Enterprise Mobility Manager (EMM) integrationThere are two separate cases for APPM and EMM integration<br />
<br />
1. APPM and EMM on a single JVM. ex : EMM standalone pack.<br />
2. APPM and EMM on separate JVMs. ex : clustered scenario<br />
<br />
For the first case, EMM standalone vanilla pack should work without changing any configuration.<br />
<br />
For the second case, There are some configurations which should be done. Follow the below steps to configure APPM and EMM on separate JVMs.<br />
<br />
1. If you run APPM and EMM on same machine change the port offset of one pack. Let's change the port offset of APPM pack.<br />
<br />
i) Change the port offset of carbon.xml to 10 which is in <APPM_HOME>/repository/conf directory.<br />
ii) Since APPM default authentication mechanism is SAML SSO change the port of IdentityProviderUrl also in app-manager.xml<br />
<br />
ex : Change the port as shown in light green<br />
<br />
<SSOConfiguration><br />
<br />
<!-- URL of the IDP use for SSO --><br />
<IdentityProviderUrl>https://localhost:<span style="color: #6aa84f;">9453</span>/samlsso</IdentityProviderUrl><br />
<br />
<Configurators><br />
<Configurator><br />
<name>wso2is</name><br />
<version>5.0.0</version><br />
<providerClass>org.wso2.carbon.appmgt.impl.idp.sso.configurator.IS500SAMLSSOConfigurator</providerClass><br />
<parameters><br />
<providerURL>https://localhost:<span style="color: #6aa84f;">9453</span></providerURL><br />
<username>admin</username><br />
<password>admin</password><br />
</parameters><br />
</Configurator><br />
</Configurators><br />
<br />
</SSOConfiguration><br />
<br />
iii) Change the port offset to 9453 for all the ports found in sso-idp-config.xml which is located in <APP_HOME>/repository/conf/identity directory.<br />
<br />
Now setting port offset is done.<br />
<br />
2. Now create a mobile app by going to App Manager publisher. publish it and it will be available in APPM store.<br />
3. Create an OAuth application in EMM by following article <a href="http://lakitechtips.blogspot.com/2016/01/how-to-map-existing-oauth-apps-in-wso2.html">How to map existing oauth apps in wso2</a>.<br />
4. Open the app-manager.xml in APPM and find for a configuration called <b>MobileAppsConfiguration</b>. change ActiveMDM property to WSO2MDM.<br />
<br />
ex: <Config name="ActiveMDM">WSO2MDM</Config><br />
<br />
Change the MDM properties named as WSO2MDM as follows. Change the port to EMM port of ServerURL and TokenApiURL. Here client key and client secret is which returned from EMM when OAuth application is created.<br />
<br />
<MDM name="WSO2MDM" bundle="org.wso2.carbon.appmgt.mdm.restconnector"><br />
<Property name="ImageURL">/store/extensions/assets/mobileapp/resources/models/%s.png</Property><br />
<Property name="ServerURL">https://localhost:9453/mdm-admin</Property><br />
<Property name="TokenApiURL">https://localhost:9453/oauth2/token</Property><br />
<Property name="ClientKey">veQtMV1aH1iX0AFWQckJLiooTxUa</Property><br />
<Property name="ClientSecret">cFGPUbV11yf9WgsL18d1Oga6JR0a</Property><br />
<Property name="AuthUser">admin</Property><br />
<Property name="AuthPass">admin</Property><br />
</MDM><br />
<br />
5. Enrol your device in MDM.<br />
6. Now you can install apps using app manager store to devices enrolled in EMM.<br />
<br />
<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-91465235993954442822016-04-04T01:45:00.002-07:002016-04-07T06:38:53.496-07:00Hide asset types feature in WSO2 App ManagerIn WSO2 App Manager 1.2.0 (currently on development) onwards, there is a feature to hide specific app types from publisher and store. There is a configuration in app-manager.xml which located in <APP_Manager_HOME>/repository/conf directory, called EnabledAssetTypeList.<br />
<br />
If you want to hide web app and sites, comment the relevant asset types from this configuration as shown in below and restart the server<br />
<div>
<br />
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #007700;"><EnabledAssetTypeList></span>
<span style="color: #888888;"><!--<Type>webapp</Type>--></span>
<span style="color: #007700;"><Type></span>mobileapp<span style="color: #007700;"></Type></span>
<span style="color: #888888;"><!--<Type>site</Type>--></span>
<span style="color: #007700;"></EnabledAssetTypeList></span></pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
</div>
<div>
<br /></div>
lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com1tag:blogger.com,1999:blog-2427271956278000351.post-6610234480277075322016-01-24T07:47:00.001-08:002016-01-24T21:23:28.941-08:00How to map existing OAuth applications in WSO2 API Manager User InterfaceYou can create OAuth applications using <b><i>OAuthAdminService</i></b> admin service. You can follow the below steps to see how mapping of existing OAuth applications via store UI works.<br />
<br />
1. Change the <b><i>mapExistingAuthApps</i></b> property value to true in <APIM_HOME>/repository/deployment/server/jaggeryapps/store/site/conf/site.json file.<br />
2. Change the <b><i>HideAdminServiceWSDLs</i></b> property to true in <APIM_HOME>/repository/conf/carbon.xml file.<br />
4. Restart API Manager instance so that to take effect the changes in carbon.xml<br />
3. Create a project in SOAPUI with following URL<br />
<b> <u>https://localhost:9443/services/OAuthAdminService?wsdl</u></b><br />
4. Get the request window for <b><i>registerOAuthConsumer</i></b> operation and make a request as the below picture depicts.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzym_u4Q-8RIp35BqHYYlM1vedI0RvQs1cPrd93qEVdyH9WpNWMIG6wFuuAbugu8GXKW1hMkvg_30AAl-9Rx7WqHFW1zt7swKOreRFytuYWWC_MqxT-_u3_68YEixvEmwgcf4u5A0v0nM/s1600/Screen+Shot+2016-01-24+at+9.04.21+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="117" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzym_u4Q-8RIp35BqHYYlM1vedI0RvQs1cPrd93qEVdyH9WpNWMIG6wFuuAbugu8GXKW1hMkvg_30AAl-9Rx7WqHFW1zt7swKOreRFytuYWWC_MqxT-_u3_68YEixvEmwgcf4u5A0v0nM/s320/Screen+Shot+2016-01-24+at+9.04.21+PM.png" width="320" /></a></div>
When you make a request, it will create a OAuth application in API Manager.<br />
<br />
5. Now go to the my subscription page in store. You can see <b><i>Provide keys</i></b> button next to <b><i>Generate keys</i></b> button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR6OtQ8-cG8awpNcINR1psYov3b5bmG6XPLeO7-sRsC2uWjRPEn2jFaUsIPxay8qVkERiAT7fZfSwD2St52jMJm4gfD-PWdkvcOKcVlwNhDg1Q46JH2dJFmtSd7Ey9woKgULVOAlIieBs/s1600/Screen+Shot+2016-01-24+at+9.10.03+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR6OtQ8-cG8awpNcINR1psYov3b5bmG6XPLeO7-sRsC2uWjRPEn2jFaUsIPxay8qVkERiAT7fZfSwD2St52jMJm4gfD-PWdkvcOKcVlwNhDg1Q46JH2dJFmtSd7Ey9woKgULVOAlIieBs/s320/Screen+Shot+2016-01-24+at+9.10.03+PM.png" width="320" /></a></div>
6. Now click the <b><i>Provide keys</i></b> button and give the consumer key and secret generated as the response in 4th step as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2mrc9by7qjMqbabjw1sd-XdzolAwQRkaOuRdMe6GT9VIPoiE-xfD3Y6n52M7DVOVMx4HQDt1FsX5aCxDOZiFjmYpAMUttyAeYh9jJ5z4Qnyse3qB0hGXFDA3oflCta4c74LdqS_6MoOY/s1600/Screen+Shot+2016-01-24+at+9.12.27+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2mrc9by7qjMqbabjw1sd-XdzolAwQRkaOuRdMe6GT9VIPoiE-xfD3Y6n52M7DVOVMx4HQDt1FsX5aCxDOZiFjmYpAMUttyAeYh9jJ5z4Qnyse3qB0hGXFDA3oflCta4c74LdqS_6MoOY/s320/Screen+Shot+2016-01-24+at+9.12.27+PM.png" width="320" /></a></div>
7. Click the save button. After save button clicked access token will automatically generated. You can click the regenerate button to regenerate access token for this OAuth Application.<br />
<br />lakihttp://www.blogger.com/profile/01669069507582164121noreply@blogger.com3tag:blogger.com,1999:blog-2427271956278000351.post-72072005146586451692015-04-18T07:44:00.000-07:002016-04-04T02:12:39.789-07:00How to change WSO2 BAM admin user password<br />
This guide is for WSO2 BAM 2.5.0 version<br />
To change the default admin password open the <i>user-mgt.xml</i>(<BAM_HOME>/repository/conf/) edit the Password as follows.<br />
<br />
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #007700;"><AdminUser></span>
<span style="color: #007700;"><UserName></span>admin<span style="color: #007700;"></UserName></span>
<span style="color: #007700;"><Password></span>newPassword<span style="color: #007700;"></Password></span>
<span style="color: #007700;"></AdminUser></span></pre>
<br />
Change the admin passwords of below datasources of bam-datasource.xml in <b><BAM_HOME>/repository/conf/datasources</b> folder accordingly.<br />
<br />
WSO2BAM_CASSANDRA_EVENT_INDEX_SOURCE<br />
WSO2BAM_CASSANDRA_DATASOURCE<br />
WSO2BAM_UTIL_DATASOURCE<br />
WSO2BAM_HIVE_INCREMENTAL_DATASOURCE<br />
<div>
<br /></div>
<div>
Now password has changed to a new one.</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-80350490557449244812015-02-08T05:42:00.000-08:002015-04-18T07:49:21.850-07:00How to run integration ui tests in WSO2 API ManagerGo to tests-ui folder reside in below path.<br />
<div>
<br />
<div>
<div class="p1">
<span class="s1"><b>/platform/branches/turing/products/apimgt/1.9.0/modules/integration/tests-ui</b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">and run below command</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">
</span></div>
<div class="p1">
<span class="s1"><b>mvn clean install -Dwebdriver.firefox.bin=<path to firefox executable></b></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">make sure to use firefox 22 version. you can get it from <a href="https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/22.0/">[1]</a>.</span></div>
<div class="p1">
<br /></div>
<div class="p1">
<span class="s1">ex: </span></div>
<div class="p1">
mvn clean install -Dwebdriver.firefox.bin=/Users/lakshman/Documents/software/fireFox22/Firefox.app/Contents/MacOS/firefox-bin<br />
<br />
If you want to debug the test case, you can use <b>-Dmaven.surefire.debug</b> property<br />
<br />
ex:<br />
mvn clean install -Dwebdriver.firefox.bin=/Users/lakshman/Documents/software/fireFox22/Firefox.app/Contents/MacOS/firefox-bin -Dmaven.surefire.debug<br />
<br />
<br />
[1] <a href="https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/22.0/">https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/22.0/</a></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-2427271956278000351.post-31989276839041351862015-02-08T02:35:00.000-08:002015-04-18T07:48:58.057-07:00Root cause of getting 404 error when do rest call to google places apisWhen we do call any rest api starting with <span class="pln" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 0px; padding: 0px; vertical-align: baseline;">https</span><span class="pun" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="com" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 0px; padding: 0px; vertical-align: baseline;">//maps.googleapis.com<span style="color: #880000;"> </span>(ex: google location api) from an application other than a normal browser I observed we are getting 404 error message as the response. </span><br />
<span class="com" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 0px; padding: 0px; vertical-align: baseline;"><br /></span>
<span style="font-family: inherit; line-height: 1.5;"><u><b><i>What we can do to prevent this</i></b></u></span><br />
<br />
<ul>
<li><span style="font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5;">Add </span><span style="font-family: inherit; font-style: inherit; line-height: 1.5;"><b>host: maps.googleapis.com</b></span><span style="font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5;"> </span><span style="font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5;">parameter to the request header when application send rest call to that api</span></li>
</ul>
<br />
<span style="font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5;"><br /></span>
<span style="line-height: 24px;">In WSO2 ESB we can use below property before send mediator. It will add above parameter to request header when ESB send rest call to </span><span style="line-height: 24px;">maps.googleapis.com.</span><br />
<b><span style="line-height: 24px;"><br /></span>
<span style="font-family: Times, Times New Roman, serif;"><span style="background-color: white; color: #262626; line-height: 16px;"><property name="REQUEST_HOST_HEADER" value="</span><a href="http://maps.googleapis.com/" style="background-color: white; color: #1155cc; line-height: 16px;" target="_blank">maps.googleapis.com</a><span style="background-color: white; color: #262626; line-height: 16px;">" scope="axis2"></property> </span></span></b>Anonymousnoreply@blogger.com1tag:blogger.com,1999:blog-2427271956278000351.post-64425205733322980472014-10-12T06:26:00.001-07:002014-10-12T06:45:06.788-07:00Useful Tips for Developers who used Mac<h3>
These tips can be used in OSX 10.9</h3>
<h4>
1. Open the finder window at current terminal location.</h4>
<span style="font-family: Verdana, sans-serif;"> <b><i>open .</i></b></span><br />
<h4>
2. Open a terminal at a finder window</h4>
you have to create your own shortcut for this. follow below steps to do that<br />
<ul>
<li>Go to <i>System Preferences </i>-> <i>Keyboard</i> -> <i>Shortcuts</i> -> <i>Services</i></li>
<li>Tick the checkbox at <i>New Terminal at Folder</i></li>
<li>Click the <i>none</i> text(light grey) in right side of <i>New Terminal at Folde</i>r checkbox</li>
<li>Press your own shortcut key combination</li>
</ul>
I experienced this shortcut is not available until you access this feature via context menu.<br />
<div>
<ul>
<li>Right click on a finder window -> <i>Services</i> -> <i>New Terminal at Folder </i></li>
</ul>
</div>
<div>
and one thing I noticed is until you restart the machine, It takes some time to open the terminal after you press the shortcut keys.<br />
<h4>
<span style="font-family: Times, Times New Roman, serif;">3. Create new empty text file using terminal</span></h4>
<div>
<b><i> <span style="font-family: Verdana, sans-serif;">touch <textfile_name>.txt</span></i></b></div>
</div>
<h4>
4. Open a text file using terminal, Write something to it and Exit from it</h4>
<div>
<span style="font-family: Verdana, sans-serif;"> <b><i>vi <textfile_name></i></b></span><br />
<ul>
<li><span style="font-family: Times, Times New Roman, serif;">if you want to write something on file, press <b><i>i</i></b></span></li>
<li><span style="font-family: Times, 'Times New Roman', serif;">if you write nothing on file and wants to exit, press <i><b>q</b></i></span></li>
<li><span style="font-family: Times, Times New Roman, serif;">if you write something on file and wants to save it and quit, press <b><i>wq</i></b></span></li>
<li><span style="font-family: Times, Times New Roman, serif;">if you write something on file and wants to quit without saving it, press <b><i>q!</i></b></span></li>
</ul>
</div>
<h4>
5. Search inside files using grep command</h4>
<div>
<span style="font-family: Verdana, sans-serif;"><b><i>grep "text to search" -R .</i></b></span></div>
<div>
Here <i>R</i> option used to search recursively. <i>dot(.)</i> is used to say that search from current folder</div>
<h4>
6. View hidden files using terminal</h4>
<div>
<b><i> <span style="font-family: Verdana, sans-serif;">ls -al</span></i></b></div>
<div>
<i>a</i> is used to say show all files <i>l</i> parameter is used to say long list(descriptive manner) the files</div>
<div>
<br /></div>
<div>
I referred below articles to write this.</div>
<div>
[1] <a href="http://stackoverflow.com/questions/2012623/creating-an-empty-txt-file-on-mac-os-without-opening-an-application-first">http://stackoverflow.com/questions/2012623/creating-an-empty-txt-file-on-mac-os-without-opening-an-application-first</a></div>
<div>
[2] <a href="http://superuser.com/questions/72774/search-through-text-files-in-mac-os-x">http://superuser.com/questions/72774/search-through-text-files-in-mac-os-x</a></div>
<div>
[3] <a href="http://stackoverflow.com/questions/420456/open-terminal-here-in-mac-os-finder">http://stackoverflow.com/questions/420456/open-terminal-here-in-mac-os-finder</a></div>
<div>
<br /></div>
Anonymousnoreply@blogger.com2