Posts

Showing posts from July, 2012

Rails 4 w/ Heroku RSolr::Error::Http (RSolr::Error::Http - 404 Not Found -

my setup: rails 4, heroku websolr addon. the solr search been working fine months rails 4 (production) application. 1 day quit , went through following stackoverflow answers , none of them worked. answer 1 , answer 2 , answer 3 since didn't have java installed @ 1 point, pretty tedious go through, need mention before answer went through 3 answers before solved it, did above may have enabled it. took me full day of sifting through answers , gut application , remove solr altogether. i solved going heroku dashboard, clicking websolr addon icon took me websolr page heroku app. deleted index there default , set new 1 new name. once new index has been created, copy , paste text in field labeled configure heroku application lastly, went terminal , entered these commands. $ heroku config:add websolr_url=[url_goes_here] $ heroku restart everything works fine now.

java - Want to randomly choose word from text file and instead printing everything from text file -

i want compiler randomly choose word text instead of printing text file. right code below printing text file. think there wrong getword method because when call getword method main function error . public class textfile { protected static scanner file; protected static list<string> words; public textfile(){ words = openfile(); } private list<string> openfile() { //list<string> wordlist = new arraylist<string>(); try { file = new scanner(new file("words.txt")); } catch (filenotfoundexception e) { system.out.println("file not found"); } catch (exception e) { system.out.println("ioexception"); } return words; } public void readfile() throws filenotfoundexception { //arraylist<string>

immutability - Correct way to permanently alter a JavaScript string -

in ruby, if want modify string , have change original string, can use ! bang character. string = "hello" string.capitalize! > "hello" string > "hello" in javascript, can't find equivalence. modifying string uppercase instance returns original string after first instance. var string = "hello"; string.touppercase(); > "hello" string > "hello" i know can save variable such var uppercasestring = string.touppercase(); but seems inefficient , undesirable purposes. i know must obvious, missing? the return value of touppercase new string capitalized. if want keep , throw away original, use this: string = string.touppercase(); btw, when entering js statements on command line of node.js , similar environments, prints result of evaluating each expression, why see uppercase version if type string.touppercase(); as have deduced has no effect on original string.

spring mvc - How to pass multiple form parameter in "th:action" using themleaf -

i trying pass parameter in th:action <form class="form-inline" th:object="${search}" method="get" action="search.html" th:action="@{'/hotels/'+${search.location}+'/'+${search.adults}+'/'+${search.datecheckout}+'/'+${search.datecheckin}}" id="search-hotel-form"> <select class="selectpicker form-control input-lt" th:field="*{location}" id="city"> <option value="delhi">delhi</option> </select> <input type='text' th:field="*{datecheckin}" id="datetimepicker1" /> <input type='text' th:field="*{datecheckout}" id="datetimepicker2" /> </form> then spring mvc contoller part @requestmapping(value = "/hotelsparam/{datecheckin}/{datecheckout}/{location}", method = requestmethod.post) public modelandview searchhotel(@

php - How can i get campaign's web id when campaign is created using API in Mailchimp? -

i using api version 1.3 of mailchimp create campaign programmatically in php. i using mcapi class method campaigncreate() create campaign. campaign created , returns campaign id in response string. but need web id (integer value of campaign id) can use open campaign using link on website. for example: lets want redirect user link - https://us8.admin.mailchimp.com/campaigns/show?id=941117 , need id value 941117 when new campaign created.for getting string 6ae9ikag when new campaign created using mailchimp api please let me know if knows how campaign web id (integer value) using mailchimp api in php thanks i found answer wanted share here.hope helps someone i campaign id string when createcampaign() method of mcapi class used. you need use below code web id (integer value of campaign id) $filters['campaign_id'] = $campaign_id; // string value of campaign id $campaign = $api->campaigns($filters); $web_id = $campaign['data'][0]['web_

HTML/CSS Border Around Multiple Elements -

Image
i'm trying border around image , paragraphs items can't figure out how it. encased them in divs , added class them background color , border effects nothing. i'm shooting for: this html code looks section: <div class="pair"> <a href="gpa_calc_screen.png"> <img src="gpa_calc_screen.png" alt""> <!--relative img path --> </a> <p> custom gpa calculator, , think first real app made. going georgia tech, , college in general, vital asset. although @ gt don't operate on plus/minus system, added setting in can edit if want. </p> </div> and here css: .pair div { display: block; /*padding: 5px; clear: right; width: 100%; border-radius: 5px; border-width: 3px; border-color: red;*/ background: red; } you don't need add div in

ios - Regex for date and replace its occurrence in string using stringByReplacingMatchesInString -

i need regex date this, "dd/mm/yyyy hh:mm:ss pm" , want separate string components using regex match in nsstring . for example if string is, 30/06/15 11:46:37 pm: person1: testing 30/06/15 11:46:40 pm: person1: hello... 30/06/15 11:46:52 pm: person2: hi 30/06/15 11:47:06 pm: person1: how doing and output components in array should be, person1: testing person1: hello... person2: hi person1: how doing you can suggest better idea parse string contains chat text above mentioned. try this, nsstring *string = @"30/06/15 11:46:37 pm: person1: testing 30/06/15 11:46:40 pm: person1: hello... 30/06/15 11:46:52 pm: person2: hi 30/06/15 11:47:06 pm: person1: how doing"; nserror *error = nil; nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:@"([0-9]{1,2})+\/+([0-9]{1,2})+\/+([0-9]{1,2})+ +([0-9]{1,2})+:+([0-9]{1,2})+:+([0-9]{1,2}) +(am|pm): " options:nsregularexpressioncaseinsensitive error:&error]; nsstring *m

c# - Cannot publish web app : Fail to copy -

i able publish web applications thousand times, i'm stuck error (sorry not perfect french translating) error 23 fail copy file : "blabla\bll.dll." "blabla\bll.dll" cannot find file 'blabla\bll.dll'. what about? edit: it's in packagetmp files one of awsome colleague suggested delete "obj" file... worked, don't know learned that. solved problem completely.

directory structure - Python Create a Folder -

i have folder named d:\myfolder\subdir1\subdir2 contains file named garbage. how create folder under same directory named garbage? script not working, receiving error oserror: [errno 17] file exists: 'd:\myfolder\subdir1\subdir2\garbage'. here code snippet: if os.path.exists(newloc): print('exists ', newloc) if not os.path.isdir(newloc): print('create ', newloc) os.makedirs(newloc) else: print('creating ', newloc) os.makedirs(newloc)

visual c++ - CTreeCtrl: How to clear the focus of selected item -

am new mfc, want replicate exact ctrl + page down , ctrl + page up behavior regular page down / page up keys without supporting keys ( ctrl / shift ). have been trying clear focus of item getting selected automatically on striking keys page up , page down . i've tried code not working: case vk_next: // pagedown case vk_prior: // pageup lhitem = getfocuseditem(); if (isselected(lhitem)) { ctreectrl::setitemstate(lhitem, 0, tvis_selected); } break; can please me in solving it the code need written in onselchanging & onselchanged event handler functions void ctreectrl::onselchanging(nmhdr *pnmhdr, lresult *presult) { htreeitem hnew = pnmtreeview->itemnew.hitem; htreeitem hold = pnmtreeview->itemold.hitem; m_bolditemselected = hold && (ctreectrl::getitemstate(hold, uint(tvis_selected)) & tvis_selected); if (getselectedcount() > 1) { if (m_bpgupstate || m_bpgdownstate) { //chec

How to create an event emitter with elixir, the otp way -

what best way in elixir create foreground process tick on every given amount of time? my main problem approach like: defmoulde ticker def tick do_something() :timer.sleep(1000) tick end end works, wrong design. it's not ticking every second, every second plus time do_something() complete. spawn process handle "something" still there small lag. also, i'm trying build mix app, there genservers involved, , main foreground process (the 1 i'm asking here) should call servers every x seconds. there otp way of doing this? i think timer:apply_interval/4 should suit needs. used this: defmodule tick def tick io.inspect(:tick) end end :timer.apply_interval(:timer.seconds(1), tick, :tick, []) the arguments in order interval, module name, function call , arguments call with. can send messages genservers inside function. check out full documentation here: apply_interval/4 another thing consider if tick function ever sending

php - Adding column if not exists in sql Opencart -

i creating model in open cart. using vqmod writing code in model. want alter table adding coloumn if not exists in table. here code. $field_name = 'geozoneid'; $col = $this->db->query("select ".$field_name." ".db_prefix."order"); if (!$col){ $this->db->query("alter table ".db_prefix."order add ".$field_name." int(11) first"); $zone_id=array(); $zone_id=$this->db->query("select zgz.geo_zone_id `oc_zone_to_geo_zone` zgz zone_id = (select shipping_zone_id oc_order order_id = '".$order_id."' ) "); $zone_id=$zone_id->row['geo_zone_id']; $query=$this->db->query("update `oc_order` set geozoneid ='".$zone_id."' order_id ='".$order_id."'"); } else { $zone_id=array(); $zone_id=$this->db->query("select zgz.geo_zone_id `oc_z

javascript - Magnific popup transparent png as grey -

i facing problem magnific popup - when transparent png opens, transparent parts grey. have searched solution without success. while changing img.mfp img background color white changes shows white color , not me. need have whole background - black opacity 0.01 (if not mistaken)...i did not changed relevant code in css or js related magnific popup. can help? in forward solved: i have found out, problem "shadow image" behind picture, if anyone, change code .mfp-figure:after in css changed , works charm :) .mfp-figure:after { content:''; position:absolute; left:0; top:40px; bottom:40px; display:block; right:0; width:auto; height:auto; z-index:-1; box-shadow:0 0 8px rgba(0, 0, 0, 0.6); background:#444444; opacity: 0;

c# - Entity Framework SaveChanges() not reflecting on entities -

i have winforms project , database running on sql server has 2 tables, student , standard . first created ado.net entity data model database wizard thing. have datagridview control has bindingsource datasource. note: databindingprojection class created able populate datagridview properties both student , standard entities i have code: var query = context.students .include(s => s.standard) .select(s => new databindingprojection { studentid = s.studentid, studentname = s.studentname, dateofbirth = s.dateofbirth, height = s.height, weight = s.weight, standardname = s.standard.standardname, standard_standardid = s.standard.standardid }).tolist(); mylist = new bindinglist<databindingprojection>(query.tolist()); dat

cassandra - Exception in thread "main" java.lang.AbstractMethodErrorat org.apache.spark.Logging$class.log(Logging.scala:52) -

hi getting below exception while running spark application. application read text file using spark , persisting same cassandra db. exception in thread "main" java.lang.abstractmethoderror @ org.apache.spark.logging$class.log(logging.scala:52) @ com.datastax.spark.connector.cql.cassandraconnector$.log(cassandraconnector.scala:142) @ org.apache.spark.logging$class.logdebug(logging.scala:63) @ com.datastax.spark.connector.cql.cassandraconnector$.logdebug(cassandraconnector.scala:142) @ com.datastax.spark.connector.cql.cassandraconnector$.com$datastax$spark$connector$cql$cassandraconnector$$createsession(cassandraconnector.scala:152) @ com.datastax.spark.connector.cql.cassandraconnector$$anonfun$4.apply(cassandraconnector.scala:149) @ com.datastax.spark.connector.cql.cassandraconnector$$anonfun$4.apply(cassandraconnector.scala:149) @ com.datastax.spark.connector.cql.refcountedcache.createnewvalueandkeys(refcountedcache.scala:36) @ com.dat

Python reload file -

i have script computes stuff. uses inputs separate file 'inputs.py'. in 'inputs.py' few variables: a = 2.3 b = 4.5 c = 3.0 in main file import them with from inputs import * if change in 'inputs.py' , execute script again still uses old values instead of new ones. how can reload file? reload(inputs) does not work. many in advance! if using python 3.x , reload names have been imported using from module import name , need - import importlib import inputs #import module here, can reloaded. importlib.reload(inputs) inputs import # or whatever name want. for python 2.x , can - import inputs #import module here, can reloaded. reload(inputs) inputs import # or whatever name want.

javascript - Reinvoke function on model update in AngularJS -

first off, apologize in advance if terminology or approach off - come structural engineering background , trying learn javascript , angularjs through small pet project. my question is: how re-invoke function updateme() within service whenever model updates. sample code , plunker below. initially, code run fine , result calculated. if a or b updated, updated values propagated controllers, value of result not updated. i've tried playing around $scope.$watch() couldn't work, nor sure right approach. in actual project, function in question depends on several properties of myservice object, , generates json data plotted n3-charts . want make plot interactive regenerating data when user updates property of myservice object. angular .module('app', []); //some function evaluated when data in myservice changes function updateme(x, y) { return x * y; } //define service (to provide data multiple ctrls) function myservice() { var myservice = this; m

java - Hibernate error - QuerySyntaxException: administrator is not mapped error -

full error message: 11:49:51,896 info [stdout] (http-localhost-127.0.0.1-8080-1) javax.ejb.ejbexception: java.lang.illegalargumentexception: org.hibernate.hql.internal.ast.querysyntaxexception: administrator not mapped [select ad administrator ad ad.adminid='123' , ad.password='123'] @stateless public class manageadministrator implements manageadministratorremote { @persistencecontext(unitname = "jpadb") private entitymanager entitymanager; public manageadministrator() { } public administrator createadministrator(administrator adminid ) { entitymanager.persist(adminid); system.out.println("inside create administrator"); entitymanager.flush(); return adminid; } public list retrievealladministrators() { string q = "select ad " + administrator.class.getname() + " ad"; query query = entitymanager.createquery(q); list adm

sql server - ADOConnection cant get table names on SQL LocalDB -

i have sql database mdf file , want connect file adoconnection , sql client 11.0 provider adoconnection connects there no table ! adoconnection.gettablenames() returns "" my code : adoconnection1.connectionstring := 'provider=sqlncli11.1;integrated security=sspi;persist security info=false;user id="";data source=(localdb)\v11.0;initial file name="";server spn="";' +'attachdbfilename="g:\projects\delphi\pasargad insurance\db\main.mdf";'; adoconnection1.connected := true; adoconnection1.gettablenames(redit.lines); when connect database sql server managment studio, tables exists edit : i removed "initial file name" , adoconnection failed connect : an attempt attach auto-named database file "g:\projects\delphi\pasargad insurance\db\main2.mdf" failed. database same name exists, or specified file cannot opened, or located on unc share i switched tracing of loca

Will spawned processes inside docker container utilize all cpu cores on container host by default? -

i have been trying find out whats default behavior of docker regards usage of host cpu cores? know if utilize multiple cpu cores each process inside container, or if run processes on 1 cpu core on host? you want read cpu sharing , constraint docs - basically, yes, if go default container use 100% of cpu, can control constraint on cpu usage --cpu-period , --cpu-quota more information on how cpu period , quota work, see kernel docs

c# - Implementing a pool with a time limit -

continuing question: correct way implement resource pool i'm thinking implementing maximum amount of time user of pool allowed continue hold on object pool, i'm not sure of right way implement such thing. so, have this: ifoo getfoofrompool() { if (_sem.wait(waittimeout)) { return pop(); } throw new waittimeoutexception("timed out waiting foo instance"); } so _sem semaphore , pop pop off instance stack (initializing if needed), far good. when caller done ifoo , return stack so: void releasefoo(ifoo p) { if (p == null) { throw new argumentnullexception("foo parameter null"); } push(p); _sem.release(); } and wrap wrapper class using idisposable ensure foo gets returned pool. client side, looks this: using (var f = mypool.getdisposablefoo()) { // stuff... } what i'd have such if // stuff takes long (or hangs), ifoo recycled , calling code throw exception. so thought of doin

c# - TCPIP Socket Listener Performance Issue -

i have straightforward windows service implements c# tcpip socket listener service. service proprietary simple protocol. works accurately , reliably under heavy load. however, performance inadequate purpose has serve, , have been working fix this. i don't know architecture officially called. basic asynchronous implementation (iasyncresult state objects, acceptcallback(), readcallback(), etc.). here basic performance issue: part of response request, service has make call out remote service (operated independent service provider). typically, responses operation take (approximately) 1 second. however, if load 20 test clients (running independent consumers multiple machines), 1 second responses remote service stretch out 5 seconds or more. have used tracing confirm of 5 seconds "within code conducts remote transactions". tracing confirms server handling requests concurrently expected , not stacking them up. that said, have done independent testing proves r

How to remove rejected Facebook events from Google Calendar? -

i synced google calendar facebook events subscribing proper url: webcal://www.facebook.com/ical/u.php?uid=xxxx&key=xxxx unfortunately when invites me event , reject (remove myself list of invited people) event still appears on google calendar. it's quite tolerable when event lasts 1 hour, it's annoying when it's duration week or longer - messes whole display. unfortunately way have been able unsubscribe calendar under google calendar settings, , manually add facebook events required

visual studio - C++ idioms when declaring template class members and constructors -

although both of following compile (with visual studio 2013), 1 of them more "correct" respect c++ idioms? speak particularly respect explicit template parameters when calling base class constructors , declaring members. standard have view on this? there practical reason prefer 1 on other? template<class t> class bar1 : public base<t> { public: bar1() : base() {} bar1(t value) : base(value) {} bar1(bar1 const & other) : base(other.value) {} void foo(bar1 const & other) { // foo related activity. } }; template<class t> class bar2 : public base<t> { public: bar2() : base<t>() {} bar2(t value) : base<t>(value) {} bar2(bar2<t> const & other) : base<t>(other.value) {} void foo(bar2<t> const & other) { // foo related activity. } }; this question relies on called injected-class-name . [class] a class-name inserted scope i

c++ cli - What is %c equivalent for String.Format in .NET? -

i tried find way port "%c" formatting in printf style function .net language, failed. example, how can write: char code = 'a'; sprintf(text,"oops! %c",code); in c++/cli tried did not give me 'a'! edit: first tried format value character 'a' or 'b' or 'c'... environment visualstudio 2008, cli/cpp, .net 3.5. wrote test code show did. string^ text; char charc = 'a'; text = string::format("(1) oops! {0}",charc); outputdebugstring(text); char charv = 1; text = string::format("(2) oops! {0}",charv + 0x60); outputdebugstring(text); text = string::format("(3) oops! {0}",(char)(charv + 0x60)); outputdebugstring(text); int intv = 1; text = string::format("(4) oops! {0}",(char)(intv + 0x60)); outputdebugstring(text); result different expected. (1) oops! 97 (2) oops! 97 (3) oops! 97 (4) oops! 97 above code seems working differently code suggested others. , feel sor

javascript - jQuery: Remove a function call -

i have function plugin looking … $('.parallax-sections').parallax(); i want function responsing in onresize event , applied window larger 700px. $(window).on("resize", function (e) { if ($(window).width() < 700) { // remove or disable function again ??? //$('.parallax-sections').parallax(); } else { $('.parallax-sections').parallax(); } }); you can disable , enable it. $('.parallax-sections').parallax(); $(window).on("resize", function(e) { if ($(window).width() < 700) { $('.parallax-sections').parallax('disable'); } else { $('.parallax-sections').parallax('enable'); } }); docs

javascript - Unable to pass values from one js file to another js file protractor e2e testing -

below code unable return value genericutil.js homepage.js i trying implement page objects along hybrid driven framework. //genericutil.js: var blnflag; genericutilities = function(){ this.objclick = function(objlocator){ element.all(objlocator).then(function(items) { if (items.length == 1) { element(objlocator).click(); blnflag='true'; console.log("inside if" + blnflag); } else { blnflag='false'; console.log("inside else" + blnflag); }; }); return blnflag; }; }; module.exports = new genericutilities(); //home_page.js: var blnflag; var gu = require("../genericutilities/genericutil.js"); var home_page = function(){ this.clickcontinue = function(){ blnflag = gu.objclick(home_page_obj.btncontinue); console.log("after return" + blnflag ); }; };

Proper way to return a string in C -

i have following code: char* get_address_string(package* pkg){ char *c; sprintf(c, "%02x:%02x:%02x:%02x:%02x:%02x", pkg->address[0], pkg->address[1], pkg->address[2], pkg->address[3], pkg->address[4], pkg->address[5]); return c; } the code works fine. however, know not proper way return string in c. receiving warning "c used uninitialized in function". what proper way write function in c? c pointer, no memory allocated. return value ok, that's how can done in c. but need allocate memory.

rest - Restful web service giving error of Response does not contain any data -

i writing restful web service in symfony2. same service working fine on localhost returning response data not on server. print_r() response variable , showing data array. $user = new users(); $user->setusername($paramfetcher->get('email')); $password = $paramfetcher->get('password'); $user->setusertype('business'); if($password==""){ $user->setpassword(rand(0,1000)); }else{ $user->setpassword($password); } $data['userdetails']['id'] = $user->getid(); $data['userdetails']['username'] = $user->getusername(); $data['userdetails']['password'] = $user->getpassword(); $data['userdetails']['usertype'] = $user->getusertype(); $em->persist($user); $em->flush(); //print_r($data); print_r($buss); $response[]=array("code"=>

python 2.7 - How to use map() to convert (key,values) pair to values only in Pyspark -

i have code in pyspark . wordslist = ['cat', 'elephant', 'rat', 'rat', 'cat'] wordsrdd = sc.parallelize(wordslist, 4) wordcounts = wordpairs.reducebykey(lambda x,y:x+y) print wordcounts.collect() #prints--> [('rat', 2), ('elephant', 1), ('cat', 2)] operator import add totalcount = (wordcounts .map(<< fill in >>) .reduce(<< fill in >>)) #should print 5 #(wordcounts.values().sum()) // trick want map() , reduce() need use reduce() action sum counts in wordcounts , divide number of unique words. * first need map() pair rdd wordcounts, consists of (key, value) pairs, rdd of values . this stuck. tried below, none of them work: .map(lambda x:x.values()) .reduce(lambda x:sum(x))) and, .map(lambda d:d[k] k in d) .reduce(lambda x:sum(x))) any in highly appreciated! finally got answer, --> wordcounts .map(lambda x:x[1]) .reduce(lambda x,y

angularjs - App security without helper tools like Sails.js -

sails , express provide built-in, configurable protection against known types of web-application-level attacks. http://sailsjs.org/documentation/concepts/security is mean using angularjs, express, mongodb without sails or similar helpers need handle security scenarios hand? , when not aware of them, app vulnerable attacks? is mean using angularjs, express, mongodb without sails or similar helpers need handle security scenarios hand? yes. sails provides solutions, still need use them. configuration necessary because security concerns vary application application. sails gives implementation of avoidance techniques, i.e. major work. need choose of techniques relevant application , how wish use them. normally, simple setting variable true or false. and when not aware of them, app vulnerable attacks? definitely. every app/site vulnerable. question rhetorical. awareness primary requirement mitigation/avoidance. remember no amount of security ever eno

ruby on rails - Why doesn't this ActiveRecord SQL != query do the opposite of the equivalent = query? -

i have following piece of ar/sql code returning following value: post.joins(:comments).uniq.count # => 20 when refine below, reduced value expect: post.joins(:comments).uniq.where('comments.user_id = ?', user.id).count # => 9 so when run same code match negated, expect opposite bunch of records - ie count of 11. instead this: post.joins(:comments).uniq.where('comments.user_id != ?', user.id).count # => 20 i want say, "find posts comments comment made other ." have misunderstood how negation behaves in sql? i should specify i'm using rails 3.2.18, doesn't seem allow where.not() syntax found in rails guide (it raises argumenterror: wrong number of arguments (0 1)). the second query responding question: find posts @ least 1 comment not made ... looks user has commented in 9 posts. else has made comment in posts.

php - Check which ECHO comes with ajax success -

i have 2 kind of echo in ajax processing script. 1 error messages , other 1 form processing success. this how look. if (strlen($password) != 128) { $errormsg = "<div class='alert alert-danger alert-dismissible' role='alert'>\n"; $errormsg .= "<strong>oops!</strong> system error, invalid password configuration.\n"; $errormsg .= "</div>\n"; echo $errormsg; } and other 1 is // print message based upon result: if ($stmt->affected_rows == 1) { // print message , wrap up: $successmsg = "<div class='alert alert-success alert-dismissible' role='alert'>\n"; $successmsg .= "your password has been changed. receive new, temporary password @ email address registered. once have logged in password, may change clicking on 'password modification' link.\n"; $successmsg .= "</div>\n&

html - How to display divs in a row responsively -

i'm trying make site using 6 divs in 2 rows this. [ ] [ ] [ ] [ ] [ ] [ ] and when make browser smaller want displayer this: [ ] [ ] [ ] [ ] [ ] [ ] i've tried float, @media, inline-block , div containers doesn't work @ all, because display this: [ ] [ ] [ ] [ ] [ ] [ ] please guys, tell me how resolve because i've tried many methods none worked. thank help. the key element you're looking display: inline-block; for div. can give flexible widths element fit in outer div. look here , try out here: http://jsfiddle.net/01ntlun5/ regards!

angularjs - Strange error with date input in angular -

i'm trying set today max date in date input. every time choose today in date picker, model value undefined. has met same problem this? html code: <form name="myform" class="item"> <input type="date" ng-model="date" max="{{maxdatestr}}" name="dateinput"> <p> date: {{date | date:'yyyy-mm-dd'}}</p> <p>myform.$valid : {{myform.$valid}}</p> <p>myform.dateinput.$error.max : {{myform.dateinput.$error.max}}</p> </form> js code: angular.module('angularapp',[]) .controller('myctrl', function($scope, $filter) { $scope.maxdatestr = $filter('date')(new date(), 'yyyy-mm-dd'); $scope.date = new date(); }); my code on codepen after debug in chrome, found when choose max date, value pass ngmodelcontroller.$parsers had time e.g. thu jul 02 2015 16:54:00 gmt+0800 (cst). when run max validator returns f

JSON Structure Data Manipulation in MongoDB -

i new mongodb , facing problem data structure. hierarchy of data not visible. instance, have data in format of { "fcilty_id" : 154, "acct_no" : 2.14782e+008, "string_dc_cd" : 8, "string_dts" : "25-jan-14", "string_id_no" : 1, "string_item_no" : 0, "child_of_cd" : "", "bintype_no" : 244, "ptxt_code_str" : "8.1.71.4.0.0.0.13", "ptxt_desc_txt" : "dc date =", "value_no" : 2.37024e+007, "value_freetext_txt" : "", "value_dts" : "25-jan-14" } { "fcilty_id" : 154, "acct_no" : 2.14782e+008, "string_dc_cd" : 8, "string_dts" : "25-jan-14", "string_id_no" : 1, "string_item_no" : 2, "child_of_cd"

wordpress - Page Not Found Error Multisite Website Posts -

i'm having strange issue multisite connected sites receiving "page not found" error on posts , custom post types. pages/post still exist, information on them. when visit them, receive error. here's 1 of websites in question: chromahue i'm not sure what's going on. have multisite on, , have "wordpress mu domain mapping" plugin mapping them domains needed. working fine couple weeks ago, , i'm getting issues. switching permalink structure, , switching seems have solved issue.

php - Having issue with authclient in Yii2 -

i integrated social authentication based on tutorial: http://stuff.cebe.cc/yii2docs/guide-security-auth-clients.html here configuration file: 'authclientcollection' => [ 'class' => 'yii\authclient\collection', 'clients' => [ 'facebook' => [ 'class' => 'yii\authclient\clients\facebook', 'clientid' => 'my_id', 'clientsecret' => 'my_secret', ], 'linkedin' => [ 'class' => 'yii\authclient\clients\linkedin', 'clientid' => 'my_id', 'clientsecret' => 'my_secret', ], ], ], my problem is, when click on social buttons redirects login page. tried that: public function onauthsuccess($client) { $attributes = $client->getuserattributes(); die(print_r($attributes)); ...

Currently try to get rails support for sql server 2005. -

i looking make rails application pulling requests sql server 2005. hard install needed drivers using following commands gem install activerecord -v 3.2.0 gem install activerecord-sqlserver-adapter -v 3.2.0 now set yml file follows. development: <<: *default host: 192.168.1.160 adapter: sqlserver mode: odbc dsn: ierp85_dev database: ierp85_dev username: name password: pass now run server uncover message could not load 'active_record/connection_adapters/sqlserver_adapter'. make sure adapter in config/database.yml valid. if use adapter other 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add necessary adapter gem gemfile. i go gem file , add line gem 'activerecord-sqlserver-adapter', '~> 3.2.0' bundle install in gemfile: activerecord-sqlserver-adapter (~> 3.2.0) x86-mingw32 depends on activerecord (~> 3.2.0) x86-mingw32 rails (= 4.1.8) x86-mingw32 depends on a

webkit - Python WebkitGTK memory leak(clear function) -

i have backbone 1 page application need run hours moving along different routes. have created simple script on python runs browser , on full screen. import sys gi.repository import gtk, gdk, webkit class browserwindow(gtk.window): def __init__(self, *args, **kwargs): super(browserwindow, self).__init__(*args, **kwargs) self.connect("destroy", gtk.main_quit) self.webview = webkit.webview() self.webview.connect("load-finished", self._load_finish) self.webview.connect("navigation-requested", self._navigation_requested) settings = self.webview.get_settings() print settings.get_property("enable-page-cache") settings.set_property("enable-page-cache", false) self.webview.set_settings(settings) self.webview.load_uri("http://www.google.com/") self.add(self.webview) self.show_all() def _load_finish(self, view, frame):

java - Where is Spring MVC context path set? -

i not sure how context path set. when rename .war file in tomcat on autodeploy , web page goes localhost:8080/newdirectory expected, reason wherever there's call pagecontext.request.contextpath in spring based page, still returns old context path. i tried override context path setting: <context path="/newdirectory" docbase="appname" override="true"></context> in server.xml doesn't work. my question is, spring read context path from? used maven , did see there's <appcontext>/${project.artifactid}</appcontext> in pom.xml , mean need rename artifactid newdirectory ? i have tried adding <context path="/newdirectory"...> in /meta-inf/context.xml (which know ignored anyway due server.xml changes). thanks in advance answer. every pagerequest current httpservletrequest object , context path of current request , append .jsp (that work if context-path resource accessed @ changes)

ios - How can I pause music coming from another app in my own app? -

i'm new xcode , trying figure out how can pause music coming in app such itunes or spotify not run in background of app. there command i'm missing or have have button shut off? please have @ audio session programming guide . have create audio session category avaudiosessioncategorysoloambient .

python - How to Generate Fixtures from Database with SqlAlchemy -

i'm starting write tests flask-sqlalchemy, , i'd add fixtures those. have plenty of data in development database , lot of tables writing data manually annoying. i'd sample data dev database fixtures , use those. what's way this? i use factory boy to create model factory do: import factory . import models class userfactory(factory.factory): class meta: model = models.user first_name = 'john' last_name = 'doe' admin = false then create instances: userfactory.create() to add static data give kwarg create userfactory.create(name='hank') so seed bunch of stuff throw in loop. :)

Nodebb--[nodebb-plugin-custom-pages] Custom Static pages -

i have set community site on nodebb , i'm having issues custom static pages plug-in. initially, when nodebb reloaded content delete. after fixing issue hosting nodebb site elsewhere, realized nodebb plugins still live locally. custom static pages not working. site has capability of supporting 1 custom static page , rest show error: http://i.stack.imgur.com/zqxag.png (this not type of error, it's recent 1 keeps coming up.) need integrate static pages on site. ideas how can fix issue? or suggestions option incorporate static pages on nodebb? thanks! i faced same issue custom static pages plugin. found out after restart wasn't creating tpl files in build/public/templates folder. causing page not found error you. a hacky fix worked me create tpl file name of route. solved error , able see custom page. proper fix worked me these steps in order uninstall plugin stop nodebb app install plugin via command-line i.e npm install nodebb-plugin-custom-pages rem

Sending push notification toast to windows phone using Parse api through php web services -

i need send push messages web service windows phone. able achieve console, need using php script code have tried: $url = 'https://api.parse.com/1/push'; $appid = 'xxx'; $restkey = 'xxx'; $push_payload = json_encode(array( "where" => '"devicetype"=>"winrt"', "data" => array( "alert" => "this alert text." ) )); $rest = curl_init(); curl_setopt($rest,curlopt_url,$url); curl_setopt($rest,curlopt_port,443); curl_setopt($rest,curlopt_post,1); curl_setopt($rest,curlopt_postfields,$push_payload); curl_setopt($rest,curlopt_httpheader, array("x-parse-application-id: " . $appid, "x-parse-rest-api-key: " . $restkey, "content-type: application/json")); $response = curl_exec($rest); echo $response; var_dump($response); }

php - escape-data mysqli function wont work -

i trying move mysql mysqli. connecting fine , simple queries seem work. however, want escape_date function , keeps tell me notice: undefined variable: conn in $data = mysqli_real_escape_string($conn, $data); here's code. function called when form data being processed. ini_set('display_errors',1); error_reporting(e_all); // connect database $servername = "localhost"; $username = xxx; $password = xxx; $dbname = xxx; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } else { echo '<p>you connected</p>'; } // escaping data function function escape_data($data){ // address magic quotes if (ini_get('magic_quotes_gpc')){ $data = stripslashes($data); } $data = mysqli_real_escape_string($conn, $data); //return escaped value return

python - How to change this regular html form into django form? -

i want change following html form: @transaction.atomic def register(request): if request.method == "post": fname = request.post['first_name'] lname = request.post['last_name'] mobile = request.post['mobile'] """this section replaces multiple characters blank value mobile number has nothing except numeric values """ rep = ['+', '-', ' ', '.'] in rep: mobile = mobile.replace(i, '') company = request.post['company'] email = request.post['email'] u = user.objects.create_user(mobile, email, '1234', first_name=fname, last_name=lname) u.save() p = userprofile.objects.create(user=u, company=company, mobile=mobile) p.save() return httpresponse("registration complete! please head on <a href='/login/'>login

c# - Elipse fill issues with listview WP8.1 UAP -

Image
i wanting position of item in list appear left of description reason making font messed , placing in center shown in image. wanting mimic same image have on map coresponds listview poistion. <datatemplate x:key="imagetextlistinboxtemplate"> <stackpanel orientation="horizontal" width="470" height="85"> <border height="40" width="40" margin="10,10,0,10" verticalalignment="top"> <image source="/sampleimage.png" stretch="uniformtofill"/> </border> <stackpanel orientation="vertical" verticalalignment="top" margin="0,10,0,0"> <grid width="40" height="40"> <ellipse fill="blue" strokethickness="3"/> <textblock foreground="white" verticalalign

Refresh ads in Google DFP -

having dfp refresh issues when following directions on site. i've tried other method seen here: refresh dfp ads without luck. have plugin created stick ad units widgets , works fine. trying update refresh ads , not refresh anything. when try add button refresh ads manually test makes ads disappear completely. here code that's in head: <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createelement('script'); gads.async = true; gads.type = 'text/javascript'; var usessl = 'https:' == document.location.protocol; gads.src = (usessl ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getelementsbytagname('script')[0]; node.parentnode.insertbefore(gads, node); })(); </script> <script type='text/javascript&#

apk - Android product flavors are not considered when using CPU ABI split in build.gradle -

i want make apk split based on cpu abi according http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits , want split apk product flavor. so build.gradle file has following product flavors plain , market . want apk split performed when building market flavor. android { productflavors { plain { } market { splits { abi { enable true reset() include 'armeabi', 'armeabi-v7a', 'x86', 'mips' universalapk true } } } } } however, when invoke gradle assembleplaindebug , assemblemarketdebug , both of them produces multiple apk. there wrong configuration above? i'm using com.android.tools.build:gradle:1.2.3 . i've been looking way while , haven't found solid solution. splits having run before resolving buildtypes , productflavors. the a

Haskell - Declaring the type of multiple functions -

i find myself writing multiple functions same type. let's call type functype . might write this: funca :: functype funcb :: functype funcc :: functype funcd :: functype -- implementations this feels lot of unnecessary typing (typing in tapping on keyboard, not declaring types of functions). there maybe way more concisely? want along lines of: (funca, funcb, funcc, funcd) :: functype -- implementations i tried google came empty. if isn't feature of language, why not? missing something? doing wrong if find myself needing this? do tried without parentheses. funca, funcb, funcc, funcd :: functype in haskell 2010 report , can see in chapter 4 (declarations , bindings) type signature ( gendecl ) looks this: vars :: [context =>] type and vars this: var-1 , … , var-n which form you're looking for. sidenote: haddock apply documentation if finds around type signature to every symbol in ( vars ) list.

javascript - Cannot retrieve array data in js -

as name suggests cannot retrieve array data in js. code have var iconattribs = document.queryselectorall(icon); var file = iconattribs[icns].getattribute("data-file"); $(document).on("dblclick", iconattribs,function() { new createframe(350,505,file,true,"application test!"); }); the problem code shows this: file:anoscalculator/anoscalculator.html! file:pacman/patrickman.html! file:anosbrowser/anosbrowser.html! whne console.log("file:"+file+"!"); . should when apply function createframe parameters width,height,content_src , isresizable .` the var file used fill in of content_src . not work.what should load app specified app src based on data retrieves data-file attribute in 1 of .icon divs. each icon has different value. icon images work not files. icon calculator image should open calculator app becaouse of code: $(".tdata0").append("<div class = 'icon' data-file='anoscalculato

android - Remote removing admin rights for application -

how can remove administration rights (devicepolicymanager.removeactiveadmin(component name)) of application application. in particular, i've got working code uninstalling application other application: intent removerintent = new intent(intent.action_delete); removerintent.setdata(packageuri); startactivity(removerintent); but target app has admin rights, , wonder - can remove them same method, remove app? you can't disable administrator rights other application. but can show information dialog (to inform user disable admin rights). , start device admin settings using intent: intent intent = new intent(); intent.setcomponent(new componentname("com.android.settings", "com.android.settings.settings$deviceadminsettingsactivity")); context.startactivity(intent); it works me.

javascript - window.load and document.ready still waiting for DOM -

in case, need check height of images (100% width). $(window).load(function() { var heightimage = $('ul.images li[style*="display: list-item"] img').height(); $(window).resize(function() { var heightimage = $('ul.images li[style*="display: list-item"] img').height(); $('ul.images').css("height", heightimage + "px"); }).resize(); }); with method of .load function, waits contents ready loaded after check height of images. if use $(document).ready(function() { it doesn't check images height. weird when inspect element, loads .ready function , gives me height of image. if, .ready function, in case, works when there activity in web, such when inspect element. how solve this. can help, please? in advance. hope helps $('ul.images li[style*="display: list-item"] img').load(function() { var heightimage = $(this).height(); $(window).res

c# - ServiceStack.Text and DeserializeFromString where Json names are illegal -

i've been using servicestack.text deserializefromstring long time, in new project i've hit issue. the json need parse objects has following format: {"http://someurl.com/":{"http://otherurl.org/schema#name":[{"value":"val1","type":"val2"}]}} so object name prefixed url, can't match class member name. i've tried using datacontract map names, returns null objects. is there way of doing using servicestack.text, or need parse json manually? any appreciated. edit: with bit of playing about, managed solve issue using datacontract attributes. failing because classes specified weren't prefixed correctly. managed solve so: [datacontract] public class schools { [datamember(name = "http://demo.talisaspire.com/")] public items items { get; set; } } [datacontract] public class items { [datamember(name = "http://purl.org/vocab/aiiso/schema#code")] public ienumerabl