Posts

Showing posts from February, 2011

vb.net - Error when inserting data into a MS Access table -

how can insert data ms access table? when try, getting error. code: if textbox1.text = nothing , textbox2.text = nothing msgbox("no username , password inserted") textbox1.focus() else if not con.state = connectionstate.open 'open connection if not yet open end if cmd.connection = con 'add data table cmd.commandtext = "insert logintable(username, password, typeofuser) values ('" & me.textbox1.text & "', '" & me.textbox2.text & "', '" & me.combobox1.text & "')" cmd.executenonquery() 'refresh data in list 'close connection con.close() end if first, don't open connection: con.open() next, password reserved word in ms access . need wrap password in square brackets: [password] you concatenating strings instead of using paramaters: cmd.parameters.add("@username", oledbtype.varchar

node.js - AngularJS and NodeJS http-server: rewrite URL -

i'm using nodejs http-server code angularjs app. i'm having problem. when try access directly url in browser angular not intercept url show me content. if type url manually like: http://127.0.0.1:8080/ #! /clients works, not when type directly: http://127.0.0.1:8080/clients i want http://127.0.0.1:8080/ #! default in http-server. i'm using in angularjs html5 mode , hash prefix: $locationprovider.html5mode(true); $locationprovider.hashprefix('!'); is there way rewrite url http-server default /#!/ before address? note : below example of more complex express.js url rewriting situation, may not wish "catch all" routes, instead discern between routes views , routes server-side api. solutions find showed generic catch-all approach, did not fit practical application app whom requires access server-side routes. if want "catch all", see other yellow note @ bottom of answer links on how set up. if turn off html5 mode, defa

html - Need assistance with PHP and my HTML5 form -

i used anchor tag submit button think why i'm having trouble trying figure out. i'm not sure if it's "href" messing up. assistance server side validation, not having lot of experience in php, able validate using javascript. <form id="myform" method="post" name="contact_form" action="process.php"> <input id="cname" type="text" name="name" minlength="2" placeholder="full name" class="form-control" required> <input id="cemail" type="email" name="email" placeholder="email address" class="form-control" required> <textarea id="ccomment" rows="5" name="message" placeholder="message..." class="form-control" required></textarea> <div id="send-btn"> <a href="process.php" onclick=&qu

Variable sheet names in a sumifs formula excel -

have following working formula =sumifs('1'!$u$2:$u$32,'1'!$z$2:$z$32,{1007,1008},'1'!$ab$2:$ab$32,"*"&march!b5&"") and i'm trying replace 3 hard coded references sheet 1 variable located in c3. attempt follows using indirect (i've used before on single conditional statements not on multiple conditionals) : =sumifs(indirect("'"&$c3&"'!$u$2:$u$32),indirect("'"&$c3&"'!$z$2:$z$32),{1007,1008},indirect("'"&$c3&"'!$ab$2:$ab$32),"*"&march!b5&"") this comes errors. appreciate in pointing me in right direction. you haven't closed strings in indirect functions: =sumifs(indirect("'"&$c3&"'!$u$2:$u$32"),indirect("'"&$c3&"'!$z$2:$z$32"),{1007,1008},indirect("'"&$c3&"'!$ab$2:$ab$32"),&qu

android - After I change my targetSDKversion to 23, app Screen appear white screen -

i'm developing android app , our boss want upgrade app work on android 6.0. upgrade build sdk target sdk 6.0 , changed android:targetsdkversion 23 in manifest file. , app appear white screen , nothing happened. why happening? if re-change android:targetsdkversion 22 it's working. permission request need android os 6 huh? that's why need change android:targetsdkversion 23. please guide me. addition, i've develop app eclipse. boss don't want use android studio. please guide me eclipse solving. much. even if use target sdk below 23 works on 6.0.in android if use min sdk 19 , if run on device below api level 19 won't higher versions support lower api levels through knowledge, , sure question.

Call Specific Javascript/Jquery Function On multiple Images without using id or class attribute -

i trying create responsive modal images (images enlarge/popup when clicked). i need able call onclick event on each image within div. however, images not have id or class attributes associated. because images uploaded via text editor through content management system. is there way implement w3 schools modal images solution without use of ids , classes? (note: need work multiple images within div) https://www.w3schools.com/howto/howto_css_modal_images.asp <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <style> #myimg { border-radius: 5px; cursor: pointer; transition: 0.3s; } #myimg:hover {opacity: 0.7;} /* modal (background) */ .modal { display: none; /* hidden default */ position: fixed; /* stay in place */ z-index: 1; /* sit on top */ padding-top: 100px; /* location of box */ left: 0; top:

php - How to echo success message on same page and only upload image type file -

this code running well.i want trying solve upload image type png jpeg. , if error or success message shown on same page. , 1 thing mail going in spam box . please regarding . <form enctype="multipart/form-data" method="post" action=""> <label>your profile pic<input type="file" name="my_file" /></label> <label><input type="submit" name="button" value="submit" /></label> </form> <?php if($_post && isset($_files['my_file'])) { $from_email = 'sanjay@.com'; //from mail, mandatory hosts $recipient_email = 'sanjay@.com'; //recipient email (most cases personal email) //capture post data html form , sanitize them, //$sender_name = filter_var($_post["sender_name"], filter_sanitize_string); //sender name // $reply_to_email = filter_var($_post["sender_email"], filter_sanitiz

javascript - Vuejs Sorting after rendering -

i've got elements tied @click <th @click="sort('dateadded')" class="created_at">date added what i'd call on page load / or when component renders in vuejs, in way i'd able have presorted table when opens up. apparently, if call after rendering still doesn't sort. here's loop display items. <tr is="song-item" v-for="item in displayeditems" :orderby="dateadded" :song="item" ref="rows"></tr> and in computed i've following: computed: { displayeditems() { return limitby( filterby( this.mutateditems, this.q, 'dateadded', 'title', 'album.name', 'artist.name', 'id', ), this.numofitems, ); }, //displayeditems2(){return orderby (limitby (filterby( this.mutateditems, this.q, 'title', 'album.name', 'artist.name', 'datead

java - Maven stand alone jars with shared code dependencies -

i'm ramping on maven perhaps rookie questions. i've found various pieces puzzle yet find clear doc on how achieve following. i have common java code want share between 2 java applications. i've set using maven modules follows: root dir pom.xml shared_code pom.xml src ... app1 pom.xml src ... app2 pom.xml src ... the pom.xml file in dir simple , consists of <packaging>pom</packaging> <modules> <module>shared_code</module> <module>app1</module> <module>app2</module> </modules> the pom.xml in shared_code subfolder uses maven-compiler-plugin , <packaging>jar</packaging> create jar file. the pom.xml s in app subfolders use maven-compiler-plugin maven-jar-plugin maven-dependency-plugin and mark shared_code module dependency. this works okay, i'm failing achieve goals. firstly, re

Approximation Algorithm for Vertex Cover -

if p not equal np can shown there no approximation algorithm comes within k of optimal vertex cover, k fixed constant? if question understood in terms of additive error, such algorithm not exist. aiming @ contradiction, suppose a such algorithm; means there nonnegative integer k such graph g , a(g) <= tau(g) + k holds, a(g) cardinality of vertex cover of g generated a , tau(g) denotes cardinality of minimum vertex cover. let k chosen minimal respect existence of mentioned algorithm. in particular, have k => 1 , since otherwise vertex cover problem solved in polynomial time, impossible unless p=np holds. let g arbitraty graph; create graph g' taking k+1 isomorphic copies of g ; then tau(g') = (k + 1) tau(g) holds. furthermore obtain following. a(g') <= tau(g) + k = (k + 1) tau(g) + k let g* isomorphic copy of g in g' smallest vertex cover generated a ; let a(g*) denote size of vertex cover. aiming @ contradict

php - Connect to table of a database -

how connect 2 tables of database, 1 column in common each other? table1-> id table-2 -> id 213 213 123 123 mysql: select table1.*, table2.* table1 left join table2 on table2.id = table.id

Can I install impala on hadoop-2.7.2 and apache-hive-1.2.1? -

on internet there many documents installing impala on chd, hadoop apache hadoop instead of chd, have tried impala-2.5.0+cdh5.7.2 on apache hadoop (hadoop-2.7.2) faild @ last. if want install impala, impala version suitable me? or need re-install new chd system.

c# - Parse Json Data in wcf Rest? -

i want create wcf rest service accept json data , parse value. my json data coming client side this: {"user":{"username":"123","pass":"123"}} i create simple wcf operationcontract : [operationcontract] [webinvoke(method = "post", uritemplate = "login", bodystyle = webmessagebodystyle.wrapped, responseformat = webmessageformat.json, requestformat = webmessageformat.json )] string login(user user); what can in login method parsing json data?? if send data client this: {"username":"123","pass":"123"} you have class class user{ public string username {get;set;} public string pass {get;set;} } if client insist on request : {"user":{"username":"123","pass":"123"}}, you should have class: class user{ public string username

Android fragment FragmentTransaction hide/show title -

my problem following, have fragments , titles viewpageradapter. when use fragmenttransaction.hide fragment went empty (blank), title stays. how can hide title fragment, can swipe shown fragments. heres code: private void setupviewpager(customviewpager viewpager) { madapter = new viewpageradapter(getsupportfragmentmanager()); fraglog = new frglog(); fraginfo = new frginfo(); fragtext = new frgtext(); fragfirm = new frgfirm(); fraghist = new frghist(); madapter.addfragment( fraglog, getstring(r.string.frag_title_log)); madapter.addfragment( fraginfo, getstring(r.string.frag_title_info)); madapter.addfragment( fragtext, getstring(r.string.frag_title_text)); madapter.addfragment( fragfirm, getstring(r.string.frag_title_firm)); madapter.addfragment( fraghist, getstring(r.string.frag_title_hist)); viewpager.setadapter(madapter); viewpager.setcurrentitem(1); viewpager.setpagingenabled(true); } class viewpageradapter

java - How to set a value on a class using another class that is called/set in main class -

i have 3 classes, say: sharetype, sharetypestrue , main. public class sharetype { public string sharetypename = ""; public string noofshare = ""; public string parvalue = ""; public void setsharetypename(string sharetypename) { this.sharetypename = sharetypename; } public void setnoofshare(string noofshare) { this.noofshare = noofshare; } public void setparvalue(string parvalue) { this.parvalue = parvalue; } } public class sharetypestrue { public list<sharetype> sharetype; public void setsharetype(list<sharetype> sharetype) { this.sharetype = sharetype; } } public class main { sharetypestrue sharetypetrue = new sharetypestrue(); sharetypetrue.add(sharetypename); } now problem need set sharetypename value under class sharetypestrue.

Custom order for php array based on indexes -

i have php array looks like $my_arr['cats'] = array('shadow', 'tiger', 'luna'); $my_arr['dogs'] = array('buddy', 'lucy', 'bella'); $my_arr['dolphins'] = array('sunny', 'comet', 'pumpkin'); $my_arr['lizzards'] = array('apollo', 'eddie', 'bruce'); //and many more lines i need sort based on keys using sorting array like $order = array('lizzards', 'cats'); i want first item should lizzards array, second item - cats , items not specified in $order array. how can done using usort / uasort / uksort functions? you can achieve below code <?php function sortbykey(&$arr,$key_order) { if(count(array_intersect(array_keys($arr),$key_order))!=count($key_order)) { return false; } $ordered_keys=array_merge($key_order,array_diff(array_keys($arr),$key_order)); $sorted_arr=[]; foreach($ordered_keys $

view - How to open pdf as a presentation by default using adobe? -

i trying open pdf presentation. have used initial view properties that. when click on full screen mode shows me pdf presentation. want view pdf default in full screen mode. whenever click on desired pdf should open in full screen mode. i forget specific version happened security measure, adobe products require user confirms want allow pdf go full-screen mode. alternatively, can disable "enhanced security" in preferences dialog bypass precaution.

javascript - jQuery taking the first PHP result -

i'm trying select data comes data base jquery, problem first result has click handler bound it. here php part: <?php $sql = "select * cars rented = '0'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $carname = $row['name']; echo '<div id="car" car-name="'.$carname.'">'.$carname.'</div>'; } }else{ echo 'ολα τα αυτοκινιτακια ειναι νοικιασμενα'; } ?> and jquery part: $('#car').on('click', function(){ var carname = $(this).attr('car-name'); alert(carname); }); let's i'm dynamically creating 2 div elements (because there 2 records in db). jquery recognizes first one. how can make recognize div elements? you need access event on class name instead id &

php - How To Change Footer Power By And Add Store Name -

i new opencart,i trying change store name in footer. please answer me fast. go catalog/view/theme/default/template/common/footer.tpl <div class="container-fluid bottom-footer"> <div class="container"> <div class="row"> <div class="col-sm-12 text-center"> <p>copyright 2016. cartridgewala.com. rights reserved.</p> </div> <div class="col-sm-12 text-center"> <p><img src="<?php echo 'image/weaccept.png'; ?>" title=" " alt=" " class="img-responsive" style=" display:inline-block" /></p> </div> </div> </div>

Xamarin.ios Settings.bundle Root.plist missing -

i using xamarin studio comunity. found error in application settings.bundle root.plist missing. how fix error? is folder named "settings.bundle" , file "root.plist" . , root.plist marked "content" , "always copy" . casesensitive problems. if names correct, try delete root.plist , adding again doing right click on settings.bundle , add>new file>property list. don't forget re-set properties "content" , "always copy"

Disable runtime error dialog in Android -

when run app vitamio library in android n, generates popup every time (libffmpeg.so file error dialog). when minimize app or onstop called in activity. working fine in previous android versions. i need disable dialog. video playing fine. enter image description here

ReSharper - Can I turn off suggestions for “Invert if” and similar? -

so last weeks forced use resharper @ work. great tool, lots of great refactoring options. has say. on every single line... the system work on quite big , old, , have make minor changes on old code (which written before guidelines existed), , told not refactor whole thing. resharper colours whole thing, because naming wrong, if-statements can simplified , more. distracts me form work. so can turn off suggestions "invert if-statement" or similar things? alternatively, can make sum-up suggestions tool-bar error list or callstack? (and keep working screen clean colouring , suggestions) 'invert if-statement' , likes called context actions. can turned on , off under: resharper -> options -> code editing -> context actions similar suggestions can configured under: resharper -> options -> code inspection -> inspection serverity. though severity can changed using alt + enter menu.

docker - PostgreSQL Horizontal scaling for "database per customer" cloud service -

i'm looking best way serve thousands of postgresql databases application tier. each database used specific customer. goals are: 1. serve databases on minimal hardware (reduce cost) 2. support horizontal scaling (so can add more servers more customers join). 3. move databases between servers load balance setup. 4. able bill based on resource consumption. my thoughts were: 1. run each customer database in dedicated postgresql server running inside docker 2. run single cluster serving multiple databases , use database scaling options. i'll appreciate if people can share other alternatives or experience 1 of above. or in other words, best way achieve above.

html - Why 'ng-attr-' can't be used with attribute 'multiple'? -

i'm trying make <select> behave single or multiple selection depending on condition. far have tried: <select ng-model="data.model" ng-attr-multiple="{{mycondition ? '' : undefined}}"> (here's plnkr have been testing https://plnkr.co/edit/ackbmzsjc2mvsjadbgmy?p=preview ) won't work. leaving ng-attr-multiple alone won't work. missing here? https://docs.angularjs.org/error/$compile/selmulti binding multiple attribute of select element not supported since switching between multiple , single mode changes ngmodel object type instance array of instances breaks model semantics. if need use different types of select elements in template based on variable, please use ngif or ngswitch directives select 1 of them used @ runtime.

python - need string or buffer, file found -

i should keep offset file , read offset line , emit, update offset = offset + 1 class simspout(storm.spout): # not here such basic spout def initialize(self, conf, context): ## open file read permit self.f = open('data.txt', 'r') ## read first line self._conf = conf self._context = context self._offset = 0 storm.loginfo("spout instance starting...") # process next tuple def nexttuple(self): # check if reach @ eof close open(self.f) f: f.readlines()[self._offset] #emit random sentence storm.loginfo("emiting %s" % line) storm.emit([line]) self._offset = self._offset + 1 but got error with open(self.f) f: typeerror: coercing unicode: need string or buffer, file found you opening file in line self.f = open('data.txt', 'r') and trying open file handle instead of same file in line with open(self.f) f: instead, in nexttuple , use self.f inste

c# - change checkbox by another checkbox inside the event -

in winforms application, have situation. 1 checkbox should disabled when checkbox checked. know isn't ideal design, quite lot depends on , wonder how make code below work, smallest change large code base. private void cbcalibrate_checkedchanged(object sender, eventargs e) { checkstate calibrationbussy; calibrationbussy = cbdenoise.checkstate; cbdenoise.checked = false; cbdenoise.show(); // cbdenoise checkbox doesnt change cbdenoise.checkstate = calibrationbussy; cbdenoise.show(); } update should use checked instead of checkstate still problem remains. (as checked enabled vs disabled), checkedstate has 3th option not determined (user didnt touch control). bool calibrationbussy; calibrationbussy = cbdenoise.checked; cbdenoise.checked =false; cbdenoise.show(); cbdenoise.checked = calibrationbussy; cbdenoise.show(); public void cbcalibrate_checkedchanged(object sender, even

ios - How do I screenshot a uiview without adding it to the subview? -

Image
i have multiple subviews on parent view, , need convert uiview uiimage of subviews. added tag views needed take screenshot of , added own view, when try screenshot black screen. however, when use regular parent view photo subviews. let viewpic = uiview() subview in self.view.subviews { if(subview.tag == 6) { viewpic.addsubview(subview) } if(subview.tag == 8) { viewpic.addsubview(subview) } } let picimage = viewpic.getsnapshotimage() //this black screen getsnapshotimage extension uiview { public func getsnapshotimage() -> uiimage { uigraphicsbeginimagecontextwithoptions(self.bounds.size, self.isopaque, 0) self.drawhierarchy(in: self.bounds, afterscreenupdates: false) let snapshotitem: uiimage = uigraphicsgetimagefromcurrentimagecontext()! uigraphicsendimagecontext() return snapshotitem

node.js - pdf generator error with rodot-regular.ttf, could i store this pdf -

i trying create pdf generator ionic 3 used this , imported using npm install pdfmake import { component } '@angular/core'; import { navcontroller } 'ionic-angular'; import * pdfmake 'pdfmake/build/pdfmake'; @component({ selector: 'page-home', templateurl: 'home.html' }) export class homepage { constructor(public navctrl: navcontroller) { } pdf(){ console.log("pdf", pdfmake) var dd = { content: 'this sample pdf printed pdfmake' }; pdfmake.createpdf(dd); } } after executing error error: file 'roboto-regular.ttf' not found in virtual file system dont know how fix 1 me fix this, , save device storage using cordova file pdfmake uses fonts data. converts tff file in js , converts fonts. so missing file <script src='build/vfs_fonts.js'> you can either add index html (bad bad bad) or can import in ts file , see if pdfmake picks up. import 'pdfmake

uiviewanimation - drop shadow to remain at bottom of rotating uiview swift 3 -

how keep shadow @ bottom of rotating/ animating ui view my code drop shadow follows extension uiview { func dropshadow(cornerradius : cgfloat, heightoffset : int) { self.layer.maskstobounds = false self.layer.shadowcolor = uicolor.black.cgcolor self.layer.shadowopacity = 1 self.layer.shadowoffset = cgsize(width: 0, height: heightoffset) self.layer.shadowradius = 5 //remove bezier enable corner radius // self.layer.shadowpath = uibezierpath(rect: self.bounds).cgpath self.layer.cornerradius = cornerradius self.layer.shouldrasterize = true } } then in view controller call method in uiview animation to hide uiview.animate(withduration: 0.5, animations: { views in self.menuview.subviews { views.alpha = 0 } self.view.layoutifneeded() self.morebutton.transform = tr self.morebutton.dropshadow(cornerradius: self.morebutton.laye

android - Nested JsonArray parsing for Pinned ListView -

Image
i'm using library make pinned section listview. api response below. need parse nested jsonarray problem i'm getting last object inside second loop jsonarray "products" such i'm getting same 2 list row item first section header instead of 2 different list row item . how parse nested jsonarray , add model class? { "all_cart_products": [ { "seller_id": "3", "seller_name": "avik roy", "email": "nits.avik@gmail.com", "seller_image": "http://104.131.83.218/makeoffer/upload/userimage/1491225073_ajeet_1000016806.jpg", "products": [ { "id": "7", "product_user_id": "3", "name": "rtutyikuyliou", "desc": "ytuykloiu sadfvdsbhdf fvdn dfjntgfkmhygdd dfsdhbgdf asfsedgdrjn sfvdsbhdf sfaswg adaswfg adxav

ios - Swift: Printing without alert box -

i use following codes printing in app: init() { self.printinfo.outputtype = uiprintinfooutputtype.photo self.printinfo.orientation = uiprintinfoorientation.landscape self.printcontroller.printinfo = self.printinfo self.printer = uiprinter(url: url(string: printip)!) // printip string give internal ip of printer debugprint(printip) } func print(image: uiimage) -> bool { self.printcontroller.printingitem = image printcontroller.print(to: printer, completionhandler: {(controller, success, error) -> void in if success { debugprint("printing completed.") } else { debugprint("printing failed.") } }) return true } it can print successfully. however, when function triggered, there alert box indicating contacting printer, , printing. there method avoid pop of alert box? want printing done @ without showing on screen interfere user experience (i want play movie when printer wo

java - How to parse a JSON string to an list using Jackson -

i have string following value: { "keya": { "id": "123", "name": "testa", "mobile": "1111" }, "keyb": { "id": "456", "name": "testb", "mobile": "2222" } } how convert json list , class formats and want parse list please advise how achieve using jackson objectmapper? you try testing: public static void main(string[] args) { string jsonstring = "{\n" + " \"keya\": {\n" + " \"id\": \"123\",\n" + " \"name\": \"testa\",\n" + " \"mobile\": \"1111\"\n" + " },\n" + " \"keyb\": {\n" + " \"id\": \"456\",\

javascript - Height of div element returns zero -

does know why height 0 here? $(document).ready(function () { alert($("#hello").height()); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img id="hello" class="browseimg" src="https://udemy-images.udemy.com/course/750x422/64132_926c_10.jpg" /> it because after dom loaded successfully, getting height of image before image loading network. probably have in load event of image. $('#hello').load(function() { alert($("#hello").height()); });

c++ - Difference in definition of member and non member function prototype -

am correct, what typedef void(classname::*functionname)(); definition of class member function prototype and typedef void(*functionname)(); definition of non class or static function prototype and should used differently: for class function pass: registerfunction(&classname::function); use: (classpointer->*(classpointer->functionpointer))() for static function pass: registerfunction(&function); use: functionpointer(); or misunderstand something?

Storing HTML Documents in Elasticsearch -

scenario i have html documents, let's say: emails. want store these on elastic search , search plaintext of html emails. problem elasticsearch index html tags , attributes, too. don't want that. want search span if plain text, not html element. example <span>span</span> hit, not <span>some other content</span> . question would recommend, store html stripped field , html field in document? or should store html document on s3 , rather leave stripped html version in elastic search? make sense i don't know happens if elastic search indexing html document, imagine index divs , spans , attributes. these things totally don't search for. so: suggestion on solving problem here great! what doing now? right before store document in es, check if index exists document type. if not, create collection given mapping. mapping looks this { "analysis": { "analyzer": { "htmlstripanalyzer":

html - Chrome browser extension alignment of image links side by side (horizontally) -

i trying display images link side side. code works fine when executed on browser. images displayed vertically when loaded extension. can't figure out. appreciated. <html> <body> <!-- <div class="imgcontainer"> <a href="popup.html"> <img border="0" src="images/a.png" height="30" width="30"> </a> </div> <div class="imgcontainer"> <a href="popup2.html"> <img border="0" src="images/b.png" height="30" width="30"> </a> </div>--> <!--<div id="imgcontainer"> <form action="/popup.html"> <input type="image" src="images/a.png" alt="submit" width="30" height="30"> </form> <form action="/popup2.html"> <input type="image" src="

python - Removing duplicates in pandas data frame if one column differs, but is in a given list -

i have dataframe duplicate entries coming 2 sources, values should unique, 1 column not formatted same, hence should remove duplicate different names in 1 column, if names within list. technically, remove row in pandas dataframe if there exist row same a , b values, if row’s z value 'bar' , other’s 'z' 'foo' . an example might clearer: i have given dataframe df b z 'a' 'a' 'foo' 'a' 'a' 'bar' 'b' 'a' 'bar' 'c' 'c' 'foo' 'd' 'd' 'blb' and get b z 'a' 'a' 'foo' 'b' 'a' 'bar' 'c' 'c' 'foo' 'd' 'd' 'blb' note that: the rows other values 'foo' , 'bar' in z column should not touched. it’s not important if 'foo' , 'bar' stay same because ch

javascript - Filtering an Array based on another Boolean array -

say have 2 arrays: const data = [1, 2, 3, 4] const predicatearray = [true, false, false, true] i want return value be: [1, 4] so far, have come with: pipe( zipwith((fst, scnd) => scnd ? fst : null)), reject(isnil) )(data, predicatearray) is there cleaner / inbuilt method of doing this? solution in ramda preferred. if want ramda solution reason, variant of answer richsilv simple enough: r.addindex(r.filter)((item, idx) => predicatearray[idx], data) ramda not include index parameter list function callbacks, reasons, addindex inserts them.

themes - WordPress blank page error -

i installed woocommerce , many plugins. running well. started facing issue @ homepage. removed , restored using backup files taken duplicator plugin. i can’t see except blank page. can’t access admin panel. plugins fine tested disabling all. themes creating issue. when disable theme folder renaming it, admin panel works. when try install new theme doesn’t happen. can’t change theme. don’t know issue.

javascript - Express.js Routing wrong route -

i have 3 express.js routes app.get('/packages/:name', (req, res) => {...}); app.get('/packages/search/', (req, res) => {...}); app.get('/packages/search/:name', (req, res) => {...}); the first , thrid routes working fine. second route never triggert. when browse "localhost/packages/search/" trigger first route res.params.name = "search/" i can "if" check if "search/" don't think thats solution. am doing wrong? routes in express.js executed in order. for detail node.js express route naming , ordering: how precedence determined?

javascript - PhantomJS Web Scraping Cisco Switch Web Interface -

i got phantomjs using phantomjs first developer job. i've been tasked web scrape network switch information (hostname, productid, ipaddress, mac address, etc) old cisco catalyst 2960 x switch connected pc via lan cable. i got http authenticatiion working fine phantomjs headless browser , can open first switch page leads startup page seen in image below. cisco switch startup report this startup page appears first time login/access switch after witch user must click continue button has form button input property shown below. (written in ajax way) <form method="get"> <input type="button" name="button1" value="continue" onclick="setcookiesandloadciscodevicemanager()"></form> usually on chrome browser click on , move on. subsequently brings main page of interest, cisco device manager page containing switch information.(not allowed post picture available on phantomjs group discussion page) my question i

PHP count number of rows in SELECT with WHERE clause in mysql -

i have table 2 columns 'community' , 'status' in following format: community status zoo 1 zoo 1 zoo 0 zoo 1 now want count how many rows status=1 there zoo; above example want output "no of rows 3" for now, can query rows status 1 zoo column , echo result output 111. the code snippet below: if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "select * location (community = 'zoo') , (status = '1');"; $result = $mysqli->query($query); while($row = $result->fetch_array()) { $rows[] = $row; } foreach($rows $row) { echo $row['status']; } $result->close(); can please show me or implement mysql_num_rows here? just use mysqli_num_rows(); function $q="select * location community='zoo' , status='1'"; $res=mysqli_query($con,$q); echo mysqli_num_

c# - How to add/insert in EF from arguments passed by jquery ajax -

how insert values jquery ajax ef table? [httppost] public actionresult savescheduleappointment(string custname, string scheddate, string _starttime, string _endtime) { list<schedappointment> schedapt = new list<schedappointment>(); using(var db = new dcdbentities()) { schedapt.add(new schedappointment() { appointmentdate = scheddate, customerfullname = "", appointmentdescription = "", customerpatientid = 0, endtime ="", starttime = "" }); db.scheduleappointments.add(schedapt); db.savechanges(); } return view(); } im getting error error 1 best overloaded method match 'system.data.entity.dbset.add(dentalclinicsystem.models.scheduleappointment)' has invalid arguments c:\users\francisco.l.saul\documents\visual studio 2013\proje

php - how do i change this code mysql to pdo -

this question has answer here: php - using pdo in clause array 3 answers orignal php code $sql = "select * products id in("; foreach($_session['cart'] $id => $value){ $sql .=$id. ","; } $sql=substr($sql,0,-1) . ") order id asc"; $query = mysql_query($sql); $totalprice=0; $totalqunty=0; if(!empty($query)){ while($row = mysql_fetch_array($query)){ $quantity=$_session['cart'][$row['id']]['quantity']; $subtotal= $_session['cart'][$row['id']] ['quantity']*$row['productprice']; $totalprice += $subtotal; $_session['qnty']=$totalqunty+=$quantity; i tried this $sql = $

xslt 2.0 - Separating data into groups -

i think i'm missing simple here. have source xml file <inventory division="b" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <stackgroup name="warehouse"> <stack> <mainstack name="primary"> <mainstackgroup name="group_primary"> <mainstacklayer sequence="1"> <stacklayerref id="layer_1"/> </mainstacklayer> </mainstackgroup> </mainstack> <mainstack name="secondary"> <mainstackgroup name="group_secondary"> <mainstacklayer sequence="2"> <stacklayerref id="layer_2"/> </mainstacklayer> </mainstackgroup> </mainstack>