Monday, November 28, 2016

change the cache dir of netbeans 8.0.2

if you are looking for changing the default cache location of your netbeans 8.0.2 (this is the version i have, this might work for other versions as well) follow the below steps:
1. Make sure netbean is closed
2. Locate the netbeans.conf file (mostly it will be there @C:\Program Files (x86)\NetBeans 8.0.2\etc)
3. Open the notepad as admin (Notepad++ was giving some weird error, dono what)
4. change the location under the property : netbeans_default_cachedir  from "${DEFAULT_CHACHEDIR_ROOT}/8.0.2" to something like "D:/software/netbeanse/cache/8.0.2".

Hope this helped you, please leave your comment if it did. Thank you!

Monday, November 14, 2016

AngularJS Pagination with Filtering example

If you are looking for an working example on Pagination with Filtering using AngularJS, copy paste the following code in note pad and save as Pagination.html:

Additional notes: this example can filter more than one field.
Do let me know if it was helpful by commenting at the bottom! Thanks.

<html>
<head>
    <title>AngularJS Pagination Sample</title>
   <script src="./lib/angular.min.js"></script>
   <!--<script src="./lib/angular-resource.js"></script>-->
    <script src="./lib/ui-bootstrap-tpls-0.11.0.js"></script>
    <link href="./styles/bootstrap.min.css" rel="stylesheet" />
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
   <script src="http://code.angularjs.org/1.4.8/angular.js"></script>
   <script src="http://code.angularjs.org/1.4.8/angular-resource.js"></script>
   <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"></script>  -->
    <meta charset="utf-8" />

    <script>
        (function () {
            var app = angular.module('paging-app', ['ui.bootstrap']);

            app.controller('MainCtrl', function ($scope, filterFilter) {
                $scope.list = [];
$scope.userList = [{"status":null,"role":"role1","permission":null,"username":"user1","password":null,"email":"user1@domain.com","samlresponse":null},{"status":null,"role":"role1","permission":null,"username":"user2","password":null,"email":"user2@domain.net","samlresponse":null},{"status":null,"role":"role1","permission":null,"username":"user3","password":null,"email":"user3@domain.com","samlresponse":null}];
                $scope.pageSize = 5;

                $scope.init = function () {
                    for (var i = 0; i < $scope.userList.length; i++) {
                        $scope.list.push({username:$scope.userList[i].username, email:$scope.userList[i].email});
                    }
                };
var array = [];
                $scope.$watch('search.name', function (term) {
                    var obj = { username: term }
var obj2 = { email: term}
                    $scope.filterList = filterFilter($scope.list, obj);
array = filterFilter($scope.list, obj2);
for (var i = 0; i < array.length; i++) {
if($scope.filterList.indexOf(array[i]) == -1){
$scope.filterList.push(array[i]);
}
}

                    $scope.currentPage = 1;
                });
            })

            .filter('start', function () {
                return function (input, start) {
                    if (!input || !input.length) { return; }

                    start = +start;
                    return input.slice(start);
                };
            });

        }());
    </script>
</head>
<body ng-app="paging-app">
    <br />
    <div class="container" ng-controller="MainCtrl" ng-init="init()">
        <div>
            <input type="text" class="form-control" placeholder="Search" ng-model="search.name" />
            <br />
        </div>
        <div>
            <div ng-repeat="item in filterList | start: (currentPage - 1) * pageSize | limitTo: pageSize"
                 class="alert alert-success col-md-12">
                <span ng-bind="item.username"></span>
<span ng-bind="item.email"></span>
            </div>
            <pagination total-items="filterList.length" items-per-page="pageSize" ng-model="currentPage" max-size="5" class="pagination-sm"></pagination>
        </div>
    </div>
</body>
</html>

Wednesday, June 18, 2014

How to reset the key

$ ssh-keygen -p
Enter file in which the key is (/Users/tekkub/.ssh/id_rsa):
Key has comment '/Users/tekkub/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

Friday, March 7, 2014

Microsoft | Word | 2010 - normal.dotm error while opening Word doc 2010

1. Locate the normal.dotm file in the user profile path: %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm

2. Rename the file name Normal.dotm as Normal_old.dotm

3. Now try to open the document again, this should fix the issue.

Thursday, October 3, 2013

Deploy war in tomcat (run in eclipse)

I am using apache 7. When started in command prompt everything works as expected but if I start same from eclipse then I was not able to access it and find the

settings.

Looks like eclipse uses by default 'Use workspace metadata' and deploy path to 'wtpwebapps' in server settings. Follow the below steps to change these and you will be

able access localhost:8080 when you start server in eclipse.

1. In eclipse servers tab at bottom, right click, where you can see start, stop etc, and select properties.
2. In properties window, select general, then select Switch Location.
3. Now you can see Tomcat v7.0 Server at localhost, open it.
4a. If there are any modules deployed, temporarily remove them and close out tab to save this change, otherwise go directly to step 4c below.
4b. If you removed any modules, restart server after step 4a and proceed to step 4c.
4c. In server location, select radio button 'Use tomcat installation', and select 'webapps' in deploy path.
Save and start server in eclipse. Now you will be able to access the server.

5. You need to setup the admin user name /password in conf\tomcat-users.xml as below:

Add the below code in the xml:
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>

  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>

  <role rolename="admin"/>
  <user username="admin" password="admin" roles="manager,manager-gui"/>

6. Restart the server from eclipse.
7. access the tomcat using localhost:8080/manager -> enter the user : admin and password : admin.
8. Deploy the war file
9.  access it using localhost:8080/project_name

If the above procedure does not work, change the port number as below:
- double click on the tomcat 7.0... server in the eclipse to open overview screen
- change the default port (HTTP/1.1) for example 8080 to 8001 and do change other ports for AJP and tomcat admin as well.
- then follow the steps 1 to 9.

Thursday, September 26, 2013

Setup Stash a Git management solution

Setup Stash a Git management solution
In this post, i will be discussing about the stash setup.  Statsh is a Git repository management solution from

Atlassian. (More on this is available in their confluence web site:

https://confluence.atlassian.com/display/STASH026/Getting+started

In order to use stash you need following installed:

- Need to buy stash account
- Need to have a stash account and password
- Account -> add ssh key.  ( you can generate it if it does not exist using)
- Make sure you have full access to write/read etc in the stash repo.

You are all set to access the stash.

Setting up the remote repo:

Modify the existing project (for example: ssh://git@stash.dev-sample.net:7999/stash/project1.git) to your local

repo:

1. Create a folder for the project. Say in C:\Workspace\Stash_project_1
2. Enter the below command:
>git clone ssh://git@stash.dev-sample.net:7999/stash/project1.git
you will see below output:
Cloning into 'project1'...
remote: Counting objects: 332, done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 332 (delta 87), reused 332 (delta 87)
Receiving objects: 100% (332/332), 2.16 MiB | 427.00 KiB/s, done.
Resolving deltas: 100% (87/87), done.

3.  Make the changes in the local repo.
4.  Its time to commit the changes:

> git commit -a

It will show text editor for comments.  Enter the comments and press esc key -> wq! (to save the command and quit)

> You might see something like below:

You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

> If you want to change anything like user.name or user.email.  Please go ahead and execute the above command and

do a amend that follows.  Now are you all set.

5.  Login into stash and check the project: : Stash -> repo: Project1.
- you should be able to see commits under the commit tab.

Create a new branch:
======================

1. Go to the local repo path (make sure it has the .git folder in it, other wise, you need to make it as one).
2.  Enter the below command to create a branch called SampleBranch1.

git checkout -b SampleBranch1

3.  Below command is used to push the branch to the remote repo.

git push origin SampleBranch1

4. Run the below command to check if the branch is created.  (* indicate new branch)
git branch


Checkout from a branch:
git clone -b SampleBranch1 --single-branch  ssh://git@stash.dev-sample.net:7999/stash/project1.git

Keep checking this space for more info on stash. Thanks for checking my blog

Thursday, January 24, 2013

misfire trigger in QUatz

ISsue: the QUatz trigger was getting misfired when it got picked by scheduler.
Resolution: There was a "C" in the calendar name in the table qrtz_triggers. HEnce updated that as null, this fixed the issue.