Total Pageviews

Thursday, June 21, 2018

Pack Unpack Jar

sudo service stop
cd /opt/tomcat/webapps
sudo mkdir tmp; cd tmp
sudo jar -xvf ../myapp.war
#make edits...
sudo vi WEB-INF/classes/templates/fragments/header.html
sudo vi WEB-INF/classes/application.properties
#end of making edits
sudo jar -cvf myapp0.0.1.war *
sudo cp myapp0.0.1.war ..
cd ..
sudo chown tomcat:tomcat myapp0.0.1.war
sudo rm -rf tmp
sudo service start

Wednesday, August 2, 2017

Bulk unfollow people on LinkedIn

If you are using chrome go the page that shows who you are following (LinkedIn) and run this code in the chrome developer console. It will go and click the unfollow button for you. I had to scroll down on the page first so all the profiles would load before I ran the script.
  1. var buttons = $("button"),
  2. interval = setInterval(function(){
  3. var btn = $('.is-following');
  4. console.log("Clicking:", btn);
  5. btn.click();
  6. if (buttons.length === 0) {
  7. clearInterval(interval);
  8. }
  9. }, 1000);

Sunday, July 23, 2017

http URL not calling in Angular


Http uses rxjs and is a cold/lazy observable, meaning that you should subscribe to it to make it work.
  this.http.get(`http://swapi.co/api/people/1`).map((response:Response) => {
                console.log(response.json());
                response.json();
            }).subscribe();
Or if you want to subscribe from somewhere else , you should return the http.get method like this : :
 getAllPersons():Observable<any>{
    console.log("Here");
       return this.http.get(`http://swapi.co/api/people/1`).map((response:Response) => {
        console.log(response.json());
        response.json();
    });
    } 
and then :
   getAllPersons().subscribe();

building and Deploying Google Firebase cloud functions

https://firebase.google.com/docs/functions/get-started

$ firebase deploy --only functions
$ firebase deploy --only functions:addMessage

Tuesday, July 18, 2017

Cannot set variable of undefined

https://stackoverflow.com/questions/38807643/error-uncaught-in-promise-typeerror-cannot-set-property-isadmin-of-null

when variable not set in function "then" block, this doesnt work, need to a copy of "this" reference with in the calling function.



down voteaccepted
Either you can use arrow function
firebase.database().ref('/userProfile/' + user.uid).once('value')
.then((snapshot) => {
or use
var self = this;

firebase.database().ref('/userProfile/' + user.uid).once('value')
.then(function(snapshot) {
   self.isAdmin = true;
otherwise this doesn't point to the current function when it's called.

Monday, July 17, 2017

promise-polyfill error while using Firebase in Angular


ERROR in ./~/firebase/app/shared_promise.js

Module not found: Error: Can't resolve 'promise-polyfill'

Solution: 
npm install promise-polyfill --save-exact

Friday, July 14, 2017

continuous integration | angular cli + firebase + travis ci

https://houssein.me/continuous-integration-angular-firebase-travisci