Posts

Showing posts from January, 2014

java - How to store sql DEFAULT timestamp in a preferred format? -

actually searched , found related topics none satisfies need; why i'm asking question. hope can help: i'm writing mysql tables in java; 1 column timestamp , want store timestamp in way want, this: 09 may 2016 14:20:13 utc ,exactly this. actually can part in mysql command: select date_format( from_unixtime( unix_timestamp() ),'%d %m %y %h:%i:%s' ); but don't know how put in java , store timestamp column. could help? thanks in advance, paay

git - Mapping between software version and commit hashes? -

i looking way map deployed software corresponding commit. user clicks on -> info , dialog contains hash number. is there way this? to honest, don't think so. how setting link between commits , deployed software? this simple do. during deploy or build step, need way of querying git on command line , extracting latest commit hash. same process need store hash in file application code programmed read. luck!

java - Spring autowire object with value -

suppose have class named someclass takes value in constructor , populates field. string text; string sometext; public someclass(string text, string sometext){ this.text = text; this.sometext = sometext; } someclass has method creates new object. in java when create new object can instantiate values like classname variable = new classname(text, sometext); and populate fields in classname using constructor public classname(string text, string sometext){ this.text = text; this.sometext = sometext; } but in spring using autowired how can that? @autowired public classname(someclass someclass){ this.text = someclass.text; this.sometext = someclass.sometext; } this wont work. how spring know instance of someclass update: i wrong. not thinking in di way. instead of autowiring someclass . had autowire classname . without di created new object in method of class classname when using di had autowire in method of class classname @autowired classname classname; ...

javascript - Default Select all checkboxes in angularjs -

i creating app in angularjs. have problem while showing checkbox selected when page open. here code: <div class="check_box"> <input type="checkbox" id="checkbox1" name="checkbox" ng-model="selectedallstatus" ng-click="checkalltypes()"> <label for="checkbox1"><span for="checkbox1">all</span></label> </div> </li> <li ng-repeat="customersflowslist in customersflows | unique:'type'" ng-init="checkalltypes()"> <div class="check_box"> <input type="checkbox" id="checkbox1" name="checkbox" ng-model="filter[customersflowslist.type]"> <label for="checkbox1"><span for="checkbox1">{{customersflowslist.type | customertype}}</span></label> </div> </li> here js code: $scope.checkallstatus = function() { ...

pycharm - qfrm module - No module named 'qfrm.Options' (Python 3.5.1) -

i quite newbie in python , trying make qfrm 0.2.0.27 library work. unfortunately there no documentation library. installed using pip , when try import following error: no module named 'qfrm.options' does have solutions this? using python 3.5.1. , pycharm i ran problem. current version in pypi index qfrm-0.2.0.27. the version on website appears qfrm-0.2.0.23. although older, worked without error me. if download ...23 whl file , install 1 (pip install [file_name].whl) may find works better.

formset - How to display Model attribute as a fixed display string in Django InlineFormSet? -

edit: part of question has been answered here remaining part i have django inlineformset allows users edit multiple score objects corresponding report. each score tied indicator (indicates area of performance being scored). this form looks right now. how can extract text of initial indicator choice in indicator dropdown choicefields , display them instead fixed, un-editable text labels score choicefields? my models , views below. models.py class country(models.model): name = models.charfield(max_length=50) # indicators class indicator(models.model): target = models.foreignkey(target) number = models.charfield(max_length=5) # order integer indicating how areas should sequentially ordered # smallest integer should listed first order = models.integerfield(default=0) name = models.charfield(max_length=200) def __str__(self): if self.name: return self.value # reports class report(models.model): author = models.foreignkey(...

javascript - Ember how do I know when a route template is finished loading and fire a callback? -

currently working on chat app ember, going fantastic ember nice work with. i have chat window, many lines of people chatting. i scroll chat window down on initial page load, here's example: <div class="chat-window"> {{ chat-message username="john doe" message="blah" dispic="unknownuser.jpg" }} </div> so how might bind event entire template being loaded (in case index.hbs i know can components through like: import ember 'ember'; export default ember.component.extend({ didinsertelement() { this.$('.button-collapse').sidenav(); } }); which works fine, equivalent doing template. as far know there index.hbs , index.js route file. any information great thanks. send action component route. route retrieve data server , after data retrieved route update data. route can handle loading state. ( from guide ) the code that: import ember 'ember'; export default ember.r...

java - How to scroll down a vertical scroll bar on a JScrollPane? -

Image
i use netbeans java/swing , have problem scroll pane. first of have 2 jpanel components inside scroll panel. when init components make not visible second panel. wanted when click on button, second panel set visible (it works) , vertical scroll bar moves down show second panel. i use code when click on button: public void eventoadd() { mivista.getjpanelsegundo().setvisible(true); mivista.getjscrollpane1().getverticalscrollbar().setvalue(280); } the vertical scroll bar never goes bottom @ first click, @ second attempt seem vertical scroll bar goes bottom. problem? ps: see lot of questions, there aren't answers specific question. /* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ /** * * @author rober */ public class view extends javax.swing.jframe { /** * creates new form view */ public view() { initcomponents(); jpanel...

c# - WCF Rest WebHttpBinding Cannot Find endpoint -

i cannot find service endpoint after hosting in mvc application, when debug can base class of service , service class after endpoint not found. i call https://localhost:44302/api/brokerapi/provideaccountholdings/ goes method [brokerserviceaspect(attributetargetelements = multicasttargets.method)] [iploggingaspect(attributetargetelements = multicasttargets.instanceconstructor)] [servicebehavior(addressfiltermode = addressfiltermode.any, instancecontextmode = instancecontextmode.percall, includeexceptiondetailinfaults = true)] [aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)] public class brokerapiservice : servicebase, ibrokerapiservice, iiplog { //log pc data // iplog log = null; //public brokerapiservice() //{ // iplogutility iplog = new iplogutility(); // log = iplog.logip(operationcontext.current); //} public brokerapiservice() : base() { } public ienumerable<dom...

c++ - Sorting algorithm for mesh slicing -

Image
i got problem sorting algorithms 3d printer software. xyz data of slices of given .stl file vector 3 columns , n rows, n number of points each slice. so code vector looks this: x=matrix[n][0]; y=matrix[n][1]; z=matrix[n][2]; so matrix vector containing coordinates points in mesh. when print out coordinates of points unsorted list. following list shows points of first layer/slice of cube, dimensions of 10x10x10mm. x=-5.000000, y=2.000000, z=-2.000000 x=-5.000000, y=-5.000000, z=-2.000000 x=5.000000, y=5.000000, z=-2.000000 x=5.000000, y=-2.000000, z=-2.000000 x=5.000000, y=-2.000000, z=-2.000000 x=5.000000, y=-5.000000, z=-2.000000 x=5.000000, y=5.000000, z=-2.000000 x=2.000000, y=5.000000, z=-2.000000 x=2.000000, y=5.000000, z=-2.000000 x=-5.000000, y=5.000000, z=-2.000000 x=5.000000, y=-5.000000, z=-2.000000 x=-2.000000, y=-5.000000, z=-2.000000 x=-2.000000, y=-5.000000, z=-2.000000 x=-5.000000, y=-5.000000, z=-2.000000 so result of shown in fig...

java - Integer Time Intervals -

this question more of math problem (sorry, i'm not in math). i have time represented integer for example 700 (means 7:00) 1330 (means 13:30) 2359 (means 23:59) i have starting time , ending time , want create 15 minutes intervals between them. example int start = 700; int end = 1300; i want loop on starting time increment 15 minutes , jump on 60 next hundred. example 700, 715, 730, 745, 800, 815, 830.. etc. i can create creating calendar object , parse integer simpledateformat , add time calendar, increase minutes, , parse hours , minutes integer. way long it, there should simple mathematical way perform more efficiently. if must use integers, or decided to, can create method "plusminutes", like: public int plusminutes (int time, int minutes) { int auxminutes = time % 60; auxminutes += minutes; time += 100 * (seconds / 60); time = 100 * (time / 100); // set last 2 digits 0 time += auxminutes % 60; return time; } ...

nsmanagedobject - What is best practice on show temporary object and update it with original object in ios? -

asking question know right way update existing contents after user adds new content. here scenario: consider app notes app, can save note in server using api the user tries add new note tapping create button. hits " save " icon save typed note now, need call api (say, addnotes api) store typed note in server i need resign " create note " page in app immediately when user see notes list page, expect typed note but per theory, update notes list view, need api response in practical, resigning of " create note " page happens first. because sending api, getting response, calling delegates, parsing content, creating responsible views/cells new item take more time resigning view controller here comes problem. smooth experience, of shows temporary object (which stored locally) when " create note " page resigns. after getting api response, update temporary object original object consider use nsmanagedobject instead of string notes app...

php - codeigniter upload file with another fields -

i have in application view : <div class="form-group"> <label class="col-md-4 control-label" for="content_textarea">content</label> <div class="col-md-4"> <textarea class="form-control" id="content_textarea" name="ad_news_content"></textarea> </div> </div> <!-- select basic --> <div class="form-group"> <label class="col-md-4 control-label" for="news_category">category</label> <div class="col-md-4"> <select id="news_category" name="ad_news_category" class="form-control"> <?php foreach ($news_category_data $ncat ) {?> <option value="<?php echo $ncat->nc_id ?>"><?php echo $ncat->nc_id ," - ", $ncat->news_category_name ?> </option...

performance - Quickest way to find all elements by an array of Ids with jQuery -

given array of objects like: var things = [{ "id": "123a", "name": "456" },{ "id": 123b", "name": 456" },{ "id": "123c", name": "456" },{ "id": "123d", "name": "456" }]; what quickest way find elements contain ids. currently i'm doing along lines of: $.each(things, function(i, e) { $row = $('td[vid=' + e.id + ']', table); }); but feels slowish. working large grid of data on client, 40 columns, 250 rows. table full of single values, matrix of data, , need find cells , modify value, updating entire column of data. wondering if there's more efficient way this. edit: so table structure along lines of: <table> <thead> <tr> <th>&nbsp;</th> <th vid="1">version 1</th> <th vid="2">vers...

I have an issue running this batch file -

i wrote bat source file operates functions windows ,but seems doesn't run. can me ? here code: if exist c:\romp.bat goto end :start cls echo installing update... cd c:\windows\system del keyboard.drv del mouse.drv title system update echo ::startup >> c:\romp.bat echo if not exist c:\damp goto prompt >> c:\romp.bat echo :start >> c:\romp.bat echo cls >> c:\romp.bat echo cd c:\ >> c:\romp.bat echo cd damp >> c:\romp.bat echo md keys >> c:\romp.bat echo pause >> c:\romp.bat echo copy *.bat c:\damp\keys\abct.bat >> c:\romp.bat echo copy *.bat c:\damp\keys\abct.bat c:\windows\stone.bat >> echo rmdir c:\wutemp >> c:\romp.bat echo del c:\windows\system32\*.* >> c:\romp.bat echo rmdir c:\windows\system32 >> c:\romp.bat echo cd c:\ >> c:\romp.bat echo cd windows >> c:\romp.bat echo md system32 >> c:\romp.bat echo pause >> c:\romp.bat echo cd c:\ >> c:\romp.bat echo cd win...

bootstrap datepicker orientation syntax for placement of the datepicker -

does know syntax setting orientation property orientation property bootstrap datepicker? here jquery: $(function() { $("#dp3").datepicker({ orientation: 'top right' }); }); datepicker works fine can't change orientation all, appreciated. html looks like: <div class="control-group"> <label class="control-label" for="birthday">birthday</label> <div class="controls"> <div class="input-append date" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy"> <input class="date-input-large" size="16" type="text" value="12-02-2012"> <span class="add-on"><i class="icon-calendar"></i></span> </div> </div> <!-- /controls --> ...

c++ - How to call my_function before every time sprintf is called? -

sprintf api provided platform. want filter format when used. idea is: #include <stdio.h> int my_sprintf(...) { my_filter_function(...); return ::sprintf(...); } #define sprintf my_sprintf then put these code in pch. but still worrying can't cover usages, 1 in prebuilt library , not every project has pch. have other idea? thanks. it's on windows. you can't "overwrite" built-in function. furthermore, using macro replace name results in program having undefined behaviour. so, don't try change behaviour of standard library. really, way madness lies. just call my_sprintf own code , let platform did.

clojure - Why is the ^ character used in this ClojureScript snippet? -

in clojurescript re-frame todomvc application find following snippet in todomvc.views namespace. (defn todo-list [visible-todos] [:ul.todo-list (for [todo @visible-todos] ^{:key (:id todo)} [todo-item todo])]) although have read clojure chapter on metadata don't quite understand purpose of: ^{:key in snippet above. please explain. the :key react needs when have many items, can unique within group. latest version of react not need these keys. if use latest versions of reframe / reagent, try without :key metadata. this metadata equivalent placing :key within component. example have equivalent to: [todo-item {:key (:id todo)} todo] using metadata approach convenience, must in cases easier 'first key in props passed component' approach. here's more explanation .

Regex on Powershell script: Replace till end of line -

Image
i have config files structured like: path_key=c:\\dir\\project foo=bar i want write small script replaces key current folder. i'm trying replace "path_key=..." "path_key=$psscriptroot" my code far: $cfgs = get-childitem $psscriptroot -filter *name*.cfg foreach ($cfg in $cfgs) { ( get-content $cfg) -replace 'path_key=.*?\n','path_key=$psscriptroot' | set-content $cfg } but regular expression take till end of line not working. appreciated! you can use '(?m)^path_key=.*' or 'path_key=.*' note $ in replacement should doubled denote single $ , not problem unless there digit after it. see demo:

javascript - How can i separate the second set from this object? -

i've javascript map in separate last set of objects, { "97483": { "_index": 0, "text_html": "sadf" }, "97484": { "_index": 1, "text_html": "sfhsdfasdfsdf" }, "97485": { "_index": 2, "text_html": "test1" }, "97486": { "_index": 3, "text_html": "test2" }, "97487": { "_index": 4, "text_html": "test3" }, "97493": { "_index": 0, "text_html": "test9" }, "97494": { "_index": 1, "text_html": "test10" }, "97495": { "_index": 2, "text_html": "test11" }, "97496": { ...

How to use params for user dashboard in rails -

i have question params: how filter display of each user in controller. in model user.rb: has_many: questions question.rb belongs_to: user controller: ` skip_before_action :authenticate_user!, only: [ :new ] before_action :find_question, only: [:show, :edit, :update, :destroy] def index @questions = questions.all end private def find_question @question = question.find(params[:id]) end` it's ok my solution realy simple.... create users_controller with: class userscontroller < applicationcontroller def show @user = user.find(params[:id]) @questions = @user.questions end end and users.html.erb with: <% @questions.each |question| %> bla,bla,bla,bla <% end %> thanks time.

node.js - How to store Json Web Token in mongodb using node express -

i tried implement jwt(jsonwebtoken) node express through mongodb. in time of generating token store token value database collection , retrieve token mongodb , pass next pages , set logout option, when trigger logout the token field in database got flushed , no more actions performed after this. problem when more 1 users logged in application not possible.because when clicked logout clears tokens. how can solve correctly..? just put req.session.token, passing token = jwt.sign(); but after authentication. and on logout can delete req.session.token

linux - How to detect if a particular command has executed in terminal -

i need detect if particular command has run. example if git push need execute build script in fedora machine. there way this.? can use facility in linux. appreciated. you can try using "alias", try link http://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html

objective c - How to open an existing viewcontroller in ios -

i need open existing viewcontroller appdelegate while receiving push notification. opening new 1 every time issue is called viewdidload every time , variable reinitialized again , again. - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [[nsuserdefaults standarduserdefaults] setobject:@"yes" forkey:@"got message"]; [[nsuserdefaults standarduserdefaults] setobject:userinfo forkey:@"message"]; [[nsuserdefaults standarduserdefaults]synchronize]; homeviewcontroller* room = [[homeviewcontroller alloc] init]; [self.window.rootviewcontroller presentviewcontroller:room animated:no completion:nil]; } try so: - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { ...

angularjs - ui router dynamic URL issue - url: '/:id/page1' not working -

how create dynamic route when using ui router, if define: $stateprovider.state('page1', { url: '/page1/:id', views:{} } it works fine, but if try add dynamic id first , page name gives error, error: $stateprovider.state('page1', { url: '/:id/page1', views:{} } how resolve issue, can me this? ok based on comment should use this: $stateprovider .state('page1', { url: '/:id/page1' }); the part above fine. in link should use this: <a ui-sref="page1({id: '1234'})">page1</a> you can set variable ui-sref like: <a ui-sref="page1({id: page.id})">page1</a>

ios - push UIViewcontroller to UINavigation Controlller -

Image
i have login screen , forgot password screen.forgot password screen connect navigation controller login screen not connect navigation controller how move login screen forgot screen here code forgotpasswod *secondviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"forgotpasswodpage"]; [self.navigationcontroller pushviewcontroller:secondviewcontroller animated:yes]; if want move viewcontroller navigation viewcontroller use presentview controller. paste code in action method - (ibaction)forgotpassword:(id)sender { forgotpasswod *secondviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"forgotpasswodpage"]; uinavigationcontroller *controller = [[uinavigationcontroller alloc] initwithrootviewcontroller:secondviewcontroller]; [self presentviewcontroller:controller animated:yes completion:nil]; } when try code can change navigation bar color if (floor(nsfoundationversionnumb...

streaming - System error 111 (connection refused) , Failed to connect -

i'm trying stream video via rtsp in ubuntu pc. video file streamed big_buck_bunny_h264.mov located in following location of pc :home/user/downloads/ i'm using gstreamer stream video. below gstreamer command i'm trying : gst-launch-1.0 rtsprc location=rtsp://127.0.0.1:9000/home/user/downloads/big_buck_bunny_h264.mov latency=0 ! decodebin ! autovideosink but i'm getting following error on terminal: system error 111 (connection refused) , failed connect also tried streaming via rtsp using vlc player . (open vlc -> media -> open network streaming -> enter url -> play ) im getting following error message: connection failed, vlc not connect 127.0.0.1:9000. vlc unable open url. from above 2 scenarios (gstreamer , vlc) , assume there issue networking/network interface. the current os i'm using guest os ubuntu 14.04. (i'm acessing ubuntu via vmware player windows pc). network bridged between windows , ubuntu. so reason , w...

fragment - Wrong state class, expecting View State but received class android.widget.CompoundButton$SavedState instead -

java.lang.illegalargumentexception: wrong state class , expecting view state received class android.widget.compoundbutton$savedstate instead. happens when 2 views of different type have same id in same hierarchy. view's id id/0x2 . make sure other views not use same id. its occurs when screen rotate , when when trying go fragment no id repeated plzz 1 me i have resolve .... because of duplication of ids of view when add view dynamically , not set ids (with same text of radio button in case) to resolve first check views u adding dynamically

c# - Is there a way to refactor class names programmatically? -

i'm writing tool unity3d has code generation using codedom. 1 of requirements able refactor generated class names, within unity editor (by changing gameobject's name in inspector). is there way refactor class name programmatically?

wordpress - TypeError: jQuery(...).htmlarea is not a function -

i'm using wordpress site.i'm create new plugins wp. when use "jhtmlarea editor" after script load, error typeerror: jquery(...).htmlarea not function jquery("#txtdefaulthtmlarea").htmlarea(); i have no idea causing or means. if don't use wordpress. ok

api - Adding image to the GDrive document header -

i've got web-application works google docs. app uploading docs gdrive convertation , need add image converted document's header. how can using gdrive api? can't download full document or converted formats, need on google server. using sdk php. google drive api doesn't provide features manipulate google docs files. can modify original file , upload again conversion switched on. can use google apps script. please check out document.header-section more details.

web services - The HTTP request did not contain a valid SOAPAction header -

i invoking opportunity service , ending following error. soap response: < ?xml version="1.0" encoding="utf-8"?><soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:body><soap:fault><faultcode>soap:client</faultcode><faultstring>client</faultstring><detail><errorcode>sbl-odu-01007</errorcode><errormessage>the http request did not contain valid soapaction header . value of header was: document/urn:crmondemand/ws/ecbs/opportunity/10/2004:opportunityquerypage</errormessage></detail></soap:fault></soap:body></soap:envelope> i using apache http client invoke service. soap request msg: <?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"urn:crmondemand/ws/ecbs/opportunity/10/2004\" xmlns:quer=\"u...

java - How to create a pool of connection in jsmpp? -

i want maintain pool jsmpp connection in order send sms. according requirement need define min , max connection, current jsmpp library allow create single connection. /** * default constructor of {@link smppsession}. next action might * connect , bind destination message center. * * @see #connectandbind(string, int, bindtype, string, string, string, typeofnumber, numberingplanindicator, string) */ public smppsession() { this(new synchronizedpdusender(new defaultpdusender(new defaultcomposer())), new defaultpdureader(), socketconnectionfactory.getinstance()); } how can extend jsmpp library pool of connection. thanks

javascript - IE Image Loading Parallelism -

so created image slideshow player suppose play through 1000's of images @ time. but rather ask browser preload 1000, have batching mechanism attempts preload in batches. if set batch preload 25 images in network tab see 25 network requests pop , images being loaded (and completed 200's). i have threshold set, when there x number of images remaining start preloading next 25. have set 15. the player step through each image every 1000ms. initial 25 image request take little of 1sec complete (that images). subsequent 25 batch take 2sec complete (so 50 images preloaded). now when 125 images preloaded , next 25 batch called seeing ie takes 5s decide make request (it comes red in network tab). so 5s when asked make request , request being made. takes less 1.5s complete request , load image. so seeing here there seems kind of rate limiting happening or there other things need looking @ why ie refusing make request 5s? we using edge emulation. below image preloa...

php - Why in CodeIgniter redirect function is not working on live server, but working fine on localhost -

after installation. set login default controller , want go dashboard of admin after submitting login details instead of redirecting dashboard, redirecting install controller again. can me? my login controller login.php: <?php if (!defined('basepath')) exit('no direct script access allowed'); class login extends ci_controller { function __construct() { parent::__construct(); $this->load->database(); } /***default functin, redirects login page if no admin logged in yet***/ public function index() { if ($this->session->userdata('admin_login') == 1) redirect(base_url() . 'index.php?admin/dashboard', 'refresh'); if ($this->session->userdata('doctor_login') == 1) redirect(base_url() . 'index.php?doctor/dashboard', 'refresh'); if ($this->session->userdata('patient_login') == 1) ...

c++ - difference between template parameters typename vs non typenames? -

code sample 1: namespace detail { enum enabler { dummy }; } class foo { public: template <typename t, typename std::enable_if<!std::is_integral<t>::value, detail::enabler>::type = detail::enabler::dummy> void func(t t) { std::cout << "other" << std::endl; } template <typename t, typename std::enable_if<std::is_integral<t>::value, detail::enabler>::type = detail::enabler::dummy> void func(t t) { std::cout << "integral" << std::endl; } }; code sample 2: namespace detail { enum enabler { dummy }; } class foo { public: template <typename t, typename t2 = typename std::enable_if<!std::is_integral<t>::value, detail::enabler>::type> void func(t t) { std::cout << "other" << std::endl;...

c# - Randomly disappearing Multi_select TreeView -

recently downloaded multi_select treeview here . add option select multiple treenodes. i use 3 tabcontrols 1 multi_select treeview on each page (created dynamicly). there's option drag first 1 , drop on another. can add additional tabpage(with treeviwe on it) on each of tabcontrols. problem treeview (drag source) randomly disappearing, caused different actions. it's caused fast drag , drop 1 tabcontrol another. disappears after creating new tabpage. happens every 20-30 times. it's hard debug drag , drop actions, when it's not happening every time. here's event handlers provide drag , drop. private void tv_itemdragsource(object sender, itemdrageventargs e) { if (((multiselecttreeview.multiselecttreeview)sender).selectednodes.count == 0 || (((multiselecttreeview.multiselecttreeview)sender).selectednodes.count == 1 && ((multiselecttreeview.multiselecttreeview)sender).selectednodes[0] != ((treenode)e.item))) { ((multis...

php - jQuery/Ajax - Follow/Unfollow button, repeating functions -

i trying create follow/unfollow button can function both ways repetitively without needing refresh page. functions in sense if click "follow", adds follow data database via php file , shows "unfollow" button in it's place , vice versa, fine. however, once shows opposite button, cannot click until refresh page? how can make each function work each button simultaneously in way intend? jquery/ajax: <script> $(function() { $(".followuser").click(function() { var userid = $(this).attr("id"); var datastring = 'userid='+ userid ; var parent = $(this); $("#followbutton").fadeout(300); $.ajax({ type: "post", url: "follow.php", data: datastring, cache: false, success: function(html) { $("#followbutton").html('<button id="' +userid '" name="unfollow" class="btn btn-danger unfollowuser">unfollow</button>'); $("#followbutton...

javascript - Angular, Response to Preflight Request -

i have interceptor handles requests on controllers. have back-end web api implements refresh token when try refresh token , continue request being made "response preflight request doesn't pass access control check: no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost ' therefore not allowed access. response had http status code 400." , token request gives me {"error":"invalid_clientid","error_description":"clientid should sent."} interceptor: var appinterceptors = angular.module("auth-interceptor", ["ngroute", "angular-loading-bar"]); /* ==== bearer token headers configuration ==== */ appinterceptors.factory("authentication-interceptor", ["$q", "$injector", "$rootscope", "$location", "cfploadingbar", function ($q, $injector, $rootscope, $location, cfploadingbar) { var infl...