Posts

java - How to make an html-file appear on localhost with Spring Boot? -

i using spring boot , have html-file "index.html", , have class "functions". basically, want happen when functions-class run, , when go localhost:8080, html-template appears @ localhost. how should this? here segment of functions-class: public class functions{ @requestmapping("/") public void gethomepage(){ //return html-template } } the html-file called "index.html" , in src/main/resources/static-folder. thank you! first of all, put index.html template file in src/main/resources/templates instead of in src/main/resources/static . your class functions must spring mvc controller; can make controller adding @controller annotation. return name of template in gethomepage() method: @controller public class functions { @requestmapping("/") public string gethomepage() { return "index"; } } this basic spring web mvc; see tutorial serving web content guide on spring ...

javascript - How to read Current logged-in user using Angularjs -

could me, how read current logged-in user id, name using angularjs ? well, on callback service, stores users, can put required credentials in i.e. angular-storage , use further in application

How to install manually package for sublime text on osx? -

trying install third-party st3-livereload package sublime text ( https://github.com/grafikart/st3-livereload ) on osx manually (there no package in package manager). when extracting folder zipped archive in macos>packages folder, doesn't work sublime cause needed .sublime-package extension. git instruction macos in repository not worked me too. don't worry .sublime-package files, these installed when using package control. the instructions on link repository use outdated url. here how install package using git : cd ~/library/application\ support/sublime\ text\ 3/packages/ git clone https://github.com/grafikart/st3-livereload livereload

angularjs - prevent user to access if has not logged in (only login/register views) -

i creating app ionic. need when user not logged, , him go state/page not log/register view, app move login or register. but code generates loop. $rootscope.$on('$statechangestart', function(event, tostate, fromstate){ if(!userfactory.isloggedin() && (tostate.name !== 'login' || tostate.name !== 'register') ){ event.preventdefault(); $state.go('login'); }else if(tostate.name == 'login' || tostate.name == 'register'){ $state.go(tostate.name); } }); ** update ** i removed else if statement, problem same. $rootscope.$on('$statechangestart', function(event, tostate, fromstate){ if(!userfactory.isloggedin() && tostate.name !== 'login' ){ event.preventdefault(); $state.go('login'); } }); any solution? thanks! pd: sorry poor english.

hql - Hibernate select elements of collection with a given property -

entity project has collection property contributors mapped @onetomany relationship entity user @entity @table( name = "projects" ) public class project { ... @onetomany @jointable(name = "project_contributors") private list<user> contributors = new arraylist<user>(); ... } i need check if contributors has user id contributorid before adding it. trying hql query, quite innept. what trying: query query = session.createquery( "select p.contributors project p p.id = :pid , p.contributors.id = :cid" ); query.setparameter("pid", projectid); query.setparameter("cid", contributorid); @suppresswarnings("unchecked") list<user> res = (list<user>) query.list(); but gives error illegal attempt dereference collection [project0_.id.contributors] element property reference [id] is there samaritan give me little push? another try made is "select p.con...

java - How to call a method only when the app has been launched? Please see details -

i have method in i'm fetching user's details , data firebase database. the problem method getting called twice or thrice after launching app , again when i'm navigating other activity. i have put method in oncreate method this: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); checkauthstate(); } i sure haven't called checkauthstate() in onstart() or onresume() methods. this how i'm navigating other activity: @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: onbackpressed(); return true; } return super.onoptionsitemselected(item); } please let me know why checkauthstate() getting cal...

mapreduce - Aggregate pipes together in Hadoop -

so have giant pipe in cascade looks this: k1 - v1 k1 - v2 k1 -v3 k2 - v4 k2- v5 k2-v6 is there anyway aggregate them using every pipe such output looks along these lines: k1 - {v1, v2, v3} k2 - {v4, v5, v6} thank you! edit: my code far: i calling every pipe outputpipe = new every(outputpipe, fields.all, somebuffer()); and overriding operate method in buffer: @override public void operate( flowprocess flowprocess, buffercall buffercall ) { tupleentry group = buffercall.getgroup(); // current argument values grouping iterator<tupleentry> arguments = buffercall.getargumentsiterator(); // create tuple hold our result values string result = ""; string key = ""; if (arguments.hasnext()) { tupleentry argument = arguments.next(); key = argument.getstring("key") + "\t"; } while (arguments.hasnext()) { ...