Posts

Showing posts from January, 2014

javascript - Call method whenever form field is typed in -

i have form includes dropdown. user can either select option dropdown in turn fills form field in question, or user can type choice manually form field. want make sure dropdown resets upon user typing in form field. i'm thinking sort of click handler, know ng-click not appropriate here. <form class="form-inline" name="tagform"> <div class="form-group"> <isteven-multi-select input-model="header.tagnames" output-model="tagsoutput" button-label="name" item-label="name" tick-property="ticked" selection-mode="single" on-item-click="header.selecttag(data)"> </isteven-multi-select> </div> <div class="form-group"> <input class="form-control" type="text" id="tag" placeholder="tag" ng-model="header.newtag.tag" ng-required="tr...

javascript - How to split a function variable and use it later on? -

i'm working on hash system website i'm making, although of pages want hash require php id @ end. don't want have .php in hash url i'm trying split can insert later on. an example of on html side. <a href="#!/_radio/profile?id=3">link</a> this have far. works except variable isn't included @ end. var radio = {}; radio = { _jsinit: function () { $(window).bind('hashchange', function () { radio._currentpage(); radio.loadpage(radio._pagename, radio._extra) }); $(window).trigger("hashchange") }, _currentpage: function () { this._pagename = location.hash.replace('#!/', ''); if (this._pagename == "") window.location = "#!/_radio/home"; this.values = this._pagename.split("?"); this._extra = this.values[1]; }, loadpage: function (page, extra) { $('#content').fadeout(200).load('_files/_v2/_pages/' + page + ...

Apache server cannot allocate memory for new process -

i have apache server 32 gb of ram. when start server , execute top see resources show me cpu @ 95 percent. doesn't normal behaviour , after few minutes raises: apache cannot allocate memory fork unable fork new process i don't know how solve problem. tips? i had same problem fix there 2 options: 1- move micro instances small , change solved problem (micro instances on amazon tend have large cpu steal time) 2- tune mysql database server configuration , apache configuration use lot less memory. tuning guide low memory situation such one: http://www.narga.net/optimizing-apachephpmysql-low-memory-server/ (but don't use suggestion of myisam tables - horrible...) this 2 options make problem much less happening .. still looking better solution close process done , kill ones hang in there .

loops - iOS9 Beta and MusicTrackLoopInfo -

has been able loop midi file without problems on ios9 beta? try loop setting numberofloops 0 in musictrackloopinfo, locks app sending random midi player. i've reported it, wondering if has found work around. same code works under other ios versions. musictrackloopinfo loopinfo; loopinfo.loopduration = looplength; loopinfo.numberofloops = 0; ok heard ios9 ship bug in it. terrible. here work around. don't set numberofloops @ all, or set numberofloops = 1; // means loop once make variable (i.e. myvariabletokeeptrackofaddedcopies) keeps track of number of times perform following: in midireadproc @ point before track has finished playing, following: // copy track - doubling length musictrack thetrack=nil; musictrackgetproperty(thetrack, ksequencetrackproperty_tracklength, &tracklen, &tracklenlen); tracklen = 4.0; //<-- real track length musictrackcopyinsert(thetrack, 0, tracklen, thetrack, 0); myvariabletokeeptrackofaddedcopies++; so track...

android - GCM now losing Registration IDs -

i have several apps on google play extensively use gcm , have been working quite time now. but, of sudden (aug 12, 2015), gcm returning "notregistered" when server posts message it. this happening enough cause big problems messaging can no longer trusted. the last part of web response stream is: [{"error":"notregistered"}]} i log registration id along response stream , registration id attempted use same 1 has been used phone. apps new registration id when first ran necessary application uninstalled , reinstalled make app work again. has changed? oddly, (or not) problem has occurred on phones running 5.1 lollipop. did possibly miss breaking change? thanks, dean if using googlecloudmessaging register , 1 possibility these users received upgrade of app. see latest edit eran's answer here .they need re-register gcm. consider using latest registration method using instance ids, has listener token refresh when needed.

php - Unable to replace form with message on submission -

i've created html5 form, incorporates recaptcha, , i've written php script sends email when form submitted. @ moment, script redirects user error or thankyou page, i'm trying adjust dynamically replace form within message within same page. i've tried following script, displays message page loads, before user interaction. php/html: <?php if ($_post) { // load recaptcha library include_once ("autoload.php"); $name = trim(stripslashes($_post['name'])); $email = trim(stripslashes($_post['email'])); $message = trim(stripslashes($_post['message'])); $emailfrom = $email; $emailto = "my@email.com"; $subject = "contact request"; // prepare email body text $body = "<strong>name:</strong> $name <br /> <strong>email:</strong> $email <br /> <strong>message:</strong> $message"; $headers .= 'mime-version: 1.0' . "\r\n"; $headers .= 'con...

apache kafka - suggestion with hadoop project -

i thinking build using big data. ideally is: take .csv put flume, kafka, perform n etl , put in kafka, kafka put flume , in hdfs. once infos in hdfs perform map reduce job or hive queries , chart whatever want. how can put .csv file flume , save kafka? have piece of code not sure if works: myagent.sources = r1 myagent.sinks = k1 myagent.channels = c1 myagent.sources.r1.type = spooldir myagent.sources.r1.spooldir = /home/xyz/source myagent.sources.r1.fileheader = true myagent.sinks.k1.type = org.apache.flume.sink.kafka.kafkasink vmagent.channels.c1.type = memory myagent.channels.c1.capacity = 1000 myagent.channels.c1.transactioncapacity = 100 myagent.sources.r1.channels = c1 myagent.sinks.k1.channel = c1 any or suggestions? , if piece of code correct, how move on? thanks everyone!! your sink config incomplete. try : a1.sinks.k1.type = org.apache.flume.sink.kafka.kafkasink a1.sinks.k1.topic = mytopic a1.sinks.k1.brokerlist = localhost:9092 a1.sinks.k1.r...

ios - Trouble loading data from arrays -

in swift have array follows: var storedlevels = [ 1:[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 7, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 2:[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...

neo4j - Using Cypher within the Clojure Neocons library. Where's the synergy? -

being new both clojure , neo4j i'm sure i'm missing point of neocons library, can't find sensible way of mixing library's "native" functions node/update results returned cypher/tquery. creating node in neo4j via node/create returns: clojurewerkz.neocons.rest.records.node{:id 999, :location-uri http://localhost:7474/db/data/node/999, :data {:url http://clojureneo4j.info :color "blue"}, :relationships-uri nil, :create-relationship-uri http://localhost:7474/db/data/node/999/relationships} node/find "finds nodes using index". in case didn't set 1 , it's possible don't know node's id in future. resort cypher find node other property (in case id sake of argument): (clojurewerkz.neocons.rest.cypher/tquery conn "match (n) id(n) = 999 return n") which returns ({"n" {:properties "http://localhost:7474/db/data/node/999/properties", :create_relationship "http://localhost:7474/db/...

android - Join on two table with same primary key but different data -

Image
i trying join 2 tables identical in structure. want join choose data second table if row same primary key exist in both. instance, if have following tables data - i want join give me - any appreciated. thanks something should work: select table1._id, coalesce(table2.data, table1.data) table1 left join table2 using _id;

blas - LAPACK: Inverting a Matrix without Pivoting -

i have been using following functions invert matrices in lapack: dgetrf() dgetri() however, subroutine dgetrf() considers partial pivoting. question: there other subroutine in lapack/blas replace dgetrf() without pivoting. also, know if there subroutine uses gaussian elimination matrix inversion instead of lu decomposition. the list of computational routines available in lapack can found here - scroll bottom of page, table 2.8. far can tell, methods general matrices use factorization perform inversion. there no subroutine uses ge compute inverse. related pivoting, suspect unless know doing, should not use method without partial pivoting. partial pivoting not terribly expensive in terms of performance, provide improved numerical stability . far aware, gaussian elimination used partial pivoting . in particular algorithm breaks if element on main diagonal 0 (for obvious reason). furthermore if value of pivot maximised numerical accuracy of solution improved. if g...

asp.net mvc - AngularJs push doesn't work -

Image
i'm trying send json value mvc webapi controller... angularjs controller looks this... addmodule.controller('addemployeectrl', ['$scope', '$http', function ($scope, $http) { //to push roleid , rolename addemployee variable $scope.emplist = []; //on-click function $scope.submitchanges = function (addemployeedata) { //to push roleid , rolename addemployee variable var roleitem = { rolename: addemployeedata.role.rolename, roleid: addemployeedata.role.roleid }; $scope.emplist.push(roleitem); //creating variable post other end var addemployee = { username: addemployeedata.username, employeelastname: addemployeedata.lastname, employeefirstname: addemployeedata.firstname, role: $scope.emplist }; $http.post('/api/employeeapi/createemployee/' , json.stringify(addemployee), { headers: { 'content-type': 'application/json...

php - Verify Email and Update MySQL DB Column -

need in creating verify.php / confirm.php site after registration. email being sent email of user confirmation link. need link work this: when link clicked, user directed our site , echo simple message , update column in our database state user verified being unverified user. thanks in advance! i go this: have users table atleast following columns: username (varchar), vrified (bool) , token(varchar). when user registers verified column 0 (unverified) , generate random token , insert other info solicit. won't go on how lots of tutorials on internet on how generate random token. after you're done inserting new user db, need send email confimation link, link have email , token of user. example: www.mysite.com/verify.php?email=users_email&token=generated_token . after email has been sent, on verify.php need check if user exists in db , update user. example queries: <?php $checkuserexists = "select count(username) users email = users_emai...

linux - What does "+0800" in the command "stat" mean? -

stat -c "%y" *test.sh 2015-08-25 10:35:44.711322327 +0800 2015-08-25 10:36:03.727295408 +0800 what +0800 mean? -0800 . that's timezone. one's pacifict standard time (-0800) , other china standard time (+0800). check out: http://www.timeanddate.com/time/map/

java - Angular download file from server -

i have application has java on play framework backend , angular frontend. i have end point in java show pdf when accessing endpoint. prefer use angular download file. java backend this response().setcontenttype("application/pdf"); response().setheader("content-disposition", "inline; filename='report.pdf'"); return ok(bytearrayoutputstream.tobytearray()); the angular frontend this $http({method: 'get', url: 'report/2'}). success(function(data, status, headers, config) { var hiddenelement = document.createelement('a'); var str = string.fromcharcode.apply(null, new uint8array(data)); hiddenelement.href = 'data:application/pdf;base64,' + str; hiddenelement.target = '_blank'; hiddenelement.download = 'myfile.pdf'; hiddenelement.click(); }) however, when downloaded file, content not there anymore. not sure if it's decoding issue. thanks in advance help. ...

How to use javascript(Angular.js) with laravel get php url(asset) -

i use javascript(angular.js) laravel <aside data-ng-include=" {{ asset('layout/nav') }} " id="nav-container"></aside> but error:notfoundhttpexception load no path, what can read .php file? im little confused on trying do, seems using asset() link directory. use laravel function link_to() instead, since made generate links paths. here link laravel documentation more information on link_to() , asset(): http://laravel.com/docs/4.2/helpers#urls

java - generating cert for use with python requests getting PEM lib error -

i have application i'm doing self-signing certificates using documentation here . the application loads keystore jetty config , loads , warning of untrusted certification when browsing site. then want use python connect , i've tried variations of generating cert, pem, etc. nothing gets me connect. doing following - import requests requests.get('https://servername:8443', cert=('path\ \to\\cert\\app.cert', '\\\\path\\to\\keystore\\keystore')) gives me following traceback - traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\requests\api.py", line 69, in return request('get', url, params=params, **kwargs) file "c:\python27\lib\site-packages\requests\api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) file "c:\python27\lib\site-packages\requests\sessions.py", line 465, in reque...

php - Laravel how to save data which in forloop -

Image
i have data need save database. here's example controller: public function saverequest(request $request){ $count = count($request->input('itemname')); $purchase = new prrequest; ($i=0; $i<$count; $i++){ $data[] = array( 'pr_no' => $request->input('pr_no')[$i], 'pr_date' => $request->input('pr_date')[$i], 'department' => $request->input('department')[$i], 'remarks' => $request->input('remarks')[$i], 'notes' => $request->input('notes')[$i], 'requested_by' => $request->input('requested_by')[$i], 'item_id' => $request->input('itemname')[$i], 'qty' => $request->input('qty')[$i], 'type' => $request->input('type')[$i], 'uom' ...

Calculating a new MATLAB array column based on looking up values from two arrays -

i have matlab double array looks this: year quarter id var 2000 1 1 50 2000 1 2 20 2000 1 3 67 2000 2 1 43 it goes on many years , many quarters, , number of rows in each quarter , year varies unpredictably. variables constitute estimates individual people. another double array looks this: year quarter outcome 2000 1 100 2000 2 0 it goes on many years , many quarters. there 1 outcome in each quarter. want subtract person's estimate outcome , place result in initial array. the result should this: year quarter id var result 2000 1 1 50 50 2000 1 2 20 80 2000 1 3 67 33 2000 2 1 43 43 what's best way achieve this? here 3 options, depending on desired speed / readability / assumptions. %% load data estimate = [... 2000 1 1 50; ... 2000 1 2 20; ... 2000 1 3 67; ... 2000 2 1 ...

memory - Assembly - How to see the value in a particular variable with gdb -

here assembly code section .data msg: db "hello" section .text global _start _start: nop mov rax,23 nop can access data located in 'msg' gdb the command x/5cb &msg should dump 5 bytes @ correct address, in both decimal , character notation. alternatively, should able use printf "%5.5s\n", &msg well, substituting in whatever format string need other data (a null terminated string, example, need "%s" ). this tested under cygwin following program: section .data msg: db "hello" section .text global _start _start: mov eax, 42 ret when compile , run that, expected 42 return code: pax> nasm -f elf -o prog.o prog.asm pax> ld -o prog.exe prog.o pax> ./prog.exe ; echo $? 42 starting in debugger, can see commands needed @ msg : pax> gdb prog.exe gnu gdb (gdb) 7.8 copyright (c) 2014 free software foundation, inc. <blah blah blah> reading symbols prog.exe...(no debuggi...

c++ - Poco - using removeObserver safely -

i have notification centre in activity thread: poco::notificationcentre nc; // publicly visible // (thread main loop post notifications time time) and multiple worker threads act on notification. threads waiting notification may need signalled externally exit @ time. have got following in worker threads (again pseudocode omitting details clarity) poco::event event; std::string s; mynotificationclass notifier{event, s}; // holds reference poco::nobserver<mynotificationclass, mynotification> obs(notifier, &mynoficationclass::func); nc.addobserver(obs); event.wait(); nc.removeobserver(obs); return s; the notification class is: struct mynotificationclass { mynotificationclass(poco::event &ev, std::string &s): ev(ev), s(s) {} void func(const poco::autoptr<mynotification> &p) { s = p->s; ev.set(); } poco::event &ev; std::string &s; }; what worried after removeobserver called in worker threa...

php - Text Input in HTML Form won't show up -

i working on text-based online game (that horribly incomplete), , i'm using php mainly. in html have form (text input) commands game, won't show up. html: <div class="container"> <div class="main"> <?php include_once 'game.php'; ?> </div> <form name="form1" method="post" action=""> <input type="text" value="" name="input" style="width: 600; position: absolute; bottom: 0; z-index: 2;"> </input> </form> <?php $input = $_post["input"]; ?> </div> so it's form , input screws me on since doesn't show up. have css, if helps: .main { width: 600px; height: 400px; background-color: white; border: 1px solid black; position: absolute; top:0; left: 0; right: 0; z-index: 1; } .container { width...

android - Programmatically assign color to shape -

i have layout this: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/user_color"> <shape android:shape="rectangle"> <solid android:color="#000000" /> </shape> </item> <item android:right="25dp"> <shape android:shape="rectangle"> <solid android:color="@color/user_background" /> </shape> </item> </layer-list> how i'm calling shape: <linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/shape"> how can programmatically change color of rectangle shape id user_color ? @user5262809 /...

c# - How to figure out what IIS Express instance is using a port? -

i want kill running iis instance programmatically occupying specific port, seems there no way figure out iis instance using specific port. netstat.exe shows process having pid 4, that's system process. "netsh http show urlacl" not display occupied port @ all. the iis express tray program knows somehow. when try start iis express instance while port occupied following error: "port '40000' being used process 'iis express' (process id '10632'). anyone got clue how can information? it seems pid 4 (system) because actual listening socket under service called http . i looked @ iisexpresstray.exe using provide list of running iisexpress applications. thankfully it's managed .net code (all in iisexpresstray.dll) that's decompiled. it appears have @ least 3 different ways of getting port number process: reading /port command-line arguments (unreliable know) running netsh http show servicestate view=requestq , pars...

MIME-encoded file creation in Java -

just learning purpose want create mime type file. there java api available create file? want embed pkcs7 response in file. content-type: multipart/mixed; boundary="=_1_1440399813_23993" content-transfer-encoding: 8bit mime-formatted message. if see text means e-mail software not support mime-formatted messages. --=_1_1440399813_23993 content-disposition: attachment; filename=hello.pdf content-type: application/pdf content-transfer-encoding: base64 mmdawmcbuiaowmdawmda1mzuwidawmdawig4g cnryywlszxikpdwvu2l6zsaxnc9sb290ideyidagugovsw5mbyaxmyawifikl0leifsgpdzcqjnd qzhcotkyndmxmkixmezdoui1mjm3neqzodyypgo8nkjcm0ndoei5oti0mzeyqjewrkm5qjuymzc0 rdm4nji+if0kl0rvy0nozwnrc3vtic9fnujgndq1nenfruy4rdk0rjngrdm4nuu5ntfeoerbnao+ pgpzdgfydhhyzwykntuynqoljuvprgo= --=_1_1440399813_23993 content-disposition: attachment; filename=hello.pdf.p7s content-type: application/pkcs7-mime content-transfer-encoding: base64 lxbtj3ffg7ss7fxsq/psbhybtlldz9k1 mmmmcygsi6+jmfbqj/vu50l79qtq3tgfmxh8giowq...

uigesturerecognizer - Unable to detect swipe position from bottom to top in iOS -

i have tried code gesture not detect. uiswipegesturerecognizer *mswipeuprecognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(up_downbtn_waytosalon)]; [mswipeuprecognizer setdirection:uiswipegesturerecognizerdirectionup]; [self.duration_distanceview addgesturerecognizer:mswipeuprecognizer]; first off, need pass gesture recognizer selector, otherwise can't determine state of gesture. other first check if view has userinteractionenabled yes , i'm guessing view doesn't user interaction.

c# - Chinese character cannot be read export to pdf from crystal report (parameter) -

i using crystal report viewer print , export report pdf file. realized when printing chinese character, show box instead of word self. the code how assign data parameter in crystal report. reportdocument reportdata = new reportdocument(); string reportpath = server.mappath("incidentreport.rpt"); reportdata.load(reportpath); //get data database string sqlcommand = "select ticketno, to_char(reportdate,'dd-mm-yyyy hh:mm') reportdate, status, severity,category,assignee,incidentdesc,incidentdetail,incidenttype,analysis,solution,attachment,to_char(createdate,'dd-mm-yyyy') createdate,createuserid,to_char(updatedate,'dd-mm-yyyy') updatedate, updateuserid ticket ticketno = '" + session["ticketnor"] + "' "; dataset ds = new dataset(); readdata.selectdata(ds, sqlcommand); //set parameter reportdata.setparametervalue(...

android - How to create swipeable view only to half? -

i tried searching can't seem find swipeable view can swipe half. here example image . i tried creating 2 pages (in tab) contains image 1 , image 2, animation having 2 stars when in mid-swipe. cheers. edit: found working example. try mimicking one. https://github.com/baoyongzhang/swipemenulistview you can use 2 viewpager serve purpose , customise them in way 1 viewpager change other. in way, give feel being swiped half.

javascript - How to create a Angularjs partial update (patch)? -

i new angular, have aplication manage customers data, json file stored in localstorage, how can create partial update patch(delta) method in service. also need error handling. json: [ {"id":1,"name":"gigi", "lastname":"ds", "hobby":"football", "age":"1987/06/04"}, {"id":2,"name":"john", "lastname":"ciobanu", "hobby":"basball", "age":"2001/12/05"}, {"id":3,"name":"george", "lastname":"doe", "hobby":"rugby", "age":"2003/05/09"}, {"id":4,"name":"dean", "lastname":"smith", "hobby":"tenis", "age":"2000/03/06"}, {"id":5,"name":"kelly", "lastname":"ambrose", ...

sonarqube5.1 - How to configure SCM support for MSBuild SonarQube Runner? -

i using sonarqube 5.1 msbuild sonarqube runner our quality inspection. scm support not there although have installed tfvc plugin. following log analyze process 07:18:22 07:18:22.352 info - sensor scm sensor 07:18:22 07:18:22.352 info - no scm system detected. can use 'sonar.scm.provider' property explicitly specify it. 07:18:22 07:18:22.352 info - sensor scm sensor (done) | time=0ms then set following properties in general "sonar.properites" file loacated in \sonarqube-5.1.2\conf folder (which might doing wrong) sonar.scm.enabled=true sonar.scm.provider=tfvc sonar.tfvc.username=mytfsusername sonar.tfvc.password.secured=mytfspassword i guess these properties should set in "sonar-project.properties" file , passed @ time of analysis (correct me if wrong). problem since using msbuild sonarqube runner, sonar-project.properties file not used anymore , project properties passed @ analysis time. if case how should pass them in? i searched lot not...

io - how to download just one part of a txt file in java? -

is possible download first 50 lines of .txt file in java? if possible, i'd need solution without external libraries, compatible java 5 , simple possible (involving lines of text rather streams... 1 can dream!) certainly it's possible, read first 50 lines , stop reading. you can't without streams, since that's happen underneath anyways, regular new bufferedreader(new inputstreamreader(inputstream, "utf-8"))); (select proper encoding) work fine.

cordova - How to force refresh the cached source files upon Ionic build/run? -

i have random issue ionic build or ionic run . i've noticed during compilation uses cache of source code, therefore when making new changes doesn't reflect upon re-compiling app. so question is, how can clear cache build files? i've tried doing ionic state reset still doesn't work nor doing uninstall re-install app android. thanks what did solve problem re-initialize android platform. ionic platform remove android ionic platform add android

flexbox - Material design sidenav: a div prevents correct flex - [RESOLVED] -

can codepen addition of div markup preventing nice arrangement of elements? what want image , 'should show' message visible , list fill out remaining space in sidenav. the core challenge in html. <md-sidenav md-is-locked-open="$mdmedia('gt-sm')" class="sidenav md-sidenav-left md-whiteframe-z2" layout="column"> <header> <img src="https://dl.dropboxusercontent.com/u/240178989/images/artichoke_lg2.png" /> </header> <div class="toolong"> <ul flex> <li ng-repeat="i in series">entry {{i}}</li> </ul> <h2>should show</h2> </div> </md-sidenav> worth noting angular material website has after cannot find within code clue solve this. using following seems sort of work, you'll idea... is, if understood correctly question. i've added flex in bottom h2, , added overfl...

javascript - Jquery not disabled the parent -

input tag not disabled.this code.please me. var input = $('input[value="' + $(this).val() + '"]'); input.prop('disabled', true); input.parent('li').addclass('disabled'); you should use filter() find input value instead of using attribute value selector. reduce set of matched elements match selector or pass function's test. also can use closest() traverse desired parent. script var value = $(this).val(); var input = $('input').filter(function(){ return value == $(this).val(); }).prop('disabled', true); input.closest('li').addclass('disabled');

python - Filter out href in a list instead of soup.find_all -

hi filter out of announcement on website following script gdata_even=soup.find_all("li", {"class":"list2col "}) gdata_odd=soup.find_all("li", {"class":"list2col odd "}) finally take of announcements in gdata depending on whether item has word: for l in range(len_data): if _checkdate(gdata_even[l].text): if _checkwordsv2(gdata_even[l].text): pass else: initial_list.append(gdata_even[l].text.encode("utf-8")) if _checkdate(gdata_odd[l].text): if _checkwordsv2(gdata_odd[l].text): pass else: initial_list.append(gdata_odd[l].text.encode("utf-8")) the problem facing gdata_even[l] , gdata_odd[l] has following output: <li class="list2col "><div class="indexcol"><span class="date">25 aug ...

ruby - Why is this imperative style faster than this functional style? -

say have array want find equilibrium index , why imperative style faster functional style, , logic behind algorithm (imperative's)? functional style: def eq_indices(list) list.each_index.select |i| list[0...i].inject(0, :+) == list[i+1..-1].inject(0, :+) end end imperative style: def eq_indices(list) left, right = 0, list.inject(0, :+) equilibrium_indices = [] list.each_with_index |val, i| right -= val equilibrium_indices << if right == left left += val end equilibrium_indices end because in functional style, sum of left , right sides calculated scratch each potential equilibrium, whereas in imperative style, sum calculated once, , single subtraction , addition performed each potential equilibrium.

scrollview - Replaced drawable images in the custom listAdapter in android changes after scrolling the listview. Why? -

i use custombaseadapter represent list in listview. mainactivity shown in first image below in link image contains custom listview adapter. , when click 1 of items @ position number [4] drawable images changes filling color in image second. , again when scroll listview filling drawble color disappered , remains same in previous state. how can make happen?? image link understand clearly.. singlerow.java package androidhiveexample.jsonparsing.circularimageview; import android.content.context; public class singlerow { private string title , number ; private int image; context context; public singlerow(context context){ this.context = context; } public singlerow(int image , string title , string number){ this.title = title; this.image = image; this.number = number; } public int getimage() { return image; } public void setimage(int image) { this.image = image; } public string ge...

c - Exit 1 if the total numbers input is not 8 -

i want user enter 8 numbers. if enter less 8 numbers, program exit. what if statement should use? should put in loop sum += if sum not 8 exit? this got far doesn't work out: int main() { int i, numb; int sum = 0; // loop enter 8 numb printf("enter 8 numbers"); if (i=0;i<8;i++) { scanf("%d", &numb); sum =+i; if (sum < 8) exit(1); } return (0); } you want user enter 8 numbers , since have not mentioned sum, i'll assume doesn't matter is. remove inner if condition altogether , replace outer if loop. here code: for (i = 0; < 8; i++) { scanf("%d", &numb); //do whatever want number here

javascript - Meteor template not working/blank page -

i using cloud9 , meteor package. i have been given instructions create keypad template , implement it. have followed of instructions page goes blank when call template {{> mykeypad}} if {{mykeypad}} page not go blank template not appear. this code: <body> <h1>week 2</h1> <ul class="nav navbar-nav"> <li><a class="navbar-brand">asdadsada</a></li> <li><a>test1</a></li> <li><a>test2</a></li> <li><a>test3</a></li> </ul> <br /> <br /> <br /> <button class="btn btn-default" type="submit">button <span class="glyphicon glyphicon glyphicon-ok"></span> </button> <div class="container"> <div class="row"> <div id="left-box" class="col-md-4"> adadasdasd </div> <div...

ios - Image not shown on vertical-scrollView in a background horizontal-scrollView -

i show let's 3 long pictures (longer iphone's screen height) in big background uiscrollview horizontally, , since each picture longer screen height, put 3 sub-uiscrollview vertical swiping in background one. i setup background 1 this: _scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, screenwidth, screenheight)]; _scrollview.delegate = self; _scrollview.contentsize = cgsizemake(screenwidth*_count, screenheight); _scrollview.pagingenabled = yes; _scrollview.alwaysbouncevertical = no; _scrollview.alwaysbouncehorizontal = yes; and setup each sub-uiscrollview this: if (imageheight > screenheight) { //requiring scrollview support uiimageview *longimgview = [[uiimageview alloc] init]; [longimgview setframe:cgrectmake(originx, 0, screenwidth, imageheight)]; longimgview.image = _image; uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(originx, 0, screenwidth, screenheight)]; [scrollview setcontentsize:cgsizem...

vector-matrix multiplication in r -

i want multiply 1000 random variables matrix 1000 different resultant matrices. i'm running following code : threshold <- runif(1000,min=0,max=1) #generating 1000 random variables can see 1000 multiple results of burstscore burstscore <- matrix(data=0,nrow=nrow(fm2),ncol=ncol(fpre2)) #calculating final burst score (i in 1:nrow(fm2)){ (j in 1:ncol(fpre)){ #dimentions of matrices (fpre,fm,growth,td,burstscore) 432,24 { burstscore[i,j]= ((as.numeric(threshold))*(as.numeric(growth[i,j]))) + ((1-(as.numeric(threshold)))*(as.numeric(td[i,j]))) } } } i'm getting following error - 'error in burstscore[i, j] = ((as.numeric(threshold)) * (as.numeric(growth[i, : number of items replace not multiple of replacement length' you trying put in 1 cell of burstscore matrix 1000 values (as multiplying each [i,j] 1 entire "threshold" vector). apart this, code contains unnecesary elements (brackets or as.numeric() statements). and, ...

eclipse - Connection to database - MySQL -

Image
i have problem connect database. had problem few days ago when started using mac instead of dell. connection still working on dell. i'm using eclipse, tomcat server, mysql. have displayed on console. i hope helpful: you appear using non standard port number mysql command need reflect non standard port number. i little rusty on java try this string dataserviceurl = "jdbc:mysql://localhost:8889/majjane"; possibly using ip rather localhost help, woudl make faster if nothing else. string dataserviceurl = "jdbc:mysql://127.0.0.1:8889/majjane";

Error when trying to open PlayScape Exchange catalog on Android -

i'm trying implement playscape sdk gamemaker: studio. i've followed native android integration guide and, after work, got build without errors. however, getting error message when try open playscape exchange catalog , i'm not sure means. i'm using following code: package ${yyandroidpackagename}; import ${yyandroidpackagename}.runneractivity; import com.yoyogames.runner.runnerjnilib; //some more general imports go here import com.playscape.exchange.exchangemanager; public class gmplayscape extends extensionbase { public void showexchange() { runneractivity.viewhandler.post( new runnable() { public void run() { exchangemanager.getinstance().showcatalog(); } }); } } after calling showexchange() own code, i'm getting following error: e/androidruntime(17482): fatal exception: main e/androidruntime(17482): process: com.companyname.playscape_for_android, pid: 17482 e/...

python - Combine the numbers in the brackets adjacently -

i want write function combine numbers in brackets adjacently. example, string input (4)2(2)(2)(2)2(2) i want output is (4)2(6)2(2) and example, string input (2)(2)2(2)(2)(2)24 i want output is (4)2(6)24 currently wrote function follows: def combine(i,accumulate,s): if s[i] == '(': accumulate += int(s[i+1]) in range(i+3,len(s),3): if s[i] == '(': accumulate += int(s[i+1]) else: print s[i-3] + s[i-2] + s[i-1] += 3 break else: print s[i] += 1 combine(0,0,'(4)2(2)(2)(2)2(2)') and output only: (4) i know maybe need recursive method, don't know how use correctly. can me? and treat one-digit problem, , after sum, need convert number more 9 corresponding alphabet. following function: def tostr(n,base): convertstring = "0123456789abcdefghijklmnopqrstuvwxyz" if n < base: return convertstring[...

Error submission app update: packages Windows 8.1 (desktop and Phone bundle) + Windows 8.0 -

Image
try send update app windows store windows dev center dashboard, update contains 3 packages: 2 windows 8.1 (desktop , phone) bundle , 1 windows 8.0 not support bundle. before new dashboard package windows 8.0 accepted in configuration... not , reports error: a previous submission app released windows phone 8.1 appxbundle. subsequent submissions must continue contain windows phone 8.1 appxbundle. but isn’t phone package , windows 8.0 can’t make bundle! there solution? old dashboard worked great. best regards, claudio not sure if applicable here. in case i've got same error when updating uwp version of application on store had uwp, wp81 , w8.1 apps. error signaling fact existent store uwp package build bundle new package not. so solution replace in .csproj <appxbundle>never</appxbundle> <appxbundle>always</appxbundle> . if publish visual studio directly can ui described here .

Rails g migration - not working in engine -

i have rails (4.2) engine gem i'm writing. running: rails g migration anything gives command info usage: rails new app_path [options] what missing gem/engine run rails generators? update: didn't create namespaced engine. works fine in other engines must have done different in this..

php - Symfony Session Initialization -

currently, when needed, i'm initializing session following code: if (!$request->hassession()) { $this->logger->debug("starting new session"); $session = new session(); $session->start(); $request->setsession($session); } is there simple way initialize session when needed? i thinking $request->getsession(true) in order create if not existing. or listener create session @ beginning of each request. is there alternative or practice? actually if want meddle session should see session management docs .

c# - ViewModel replacement for complex Anonymous Object -

so im working complex anonymous object var result = new { percentage = "hide", bullets = (string)null, item = new [] { new { value = 16, text = "day", prefix = (string)null, label = (string)null }, new { value = 41, text = "week", prefix = (string)null, label = (string)null }, new { value = 366, text = "month", prefix = (string)null, label = (string)null } } }; and want convert viewmodel , return json rest api. what know is how repres...