Posts

Showing posts from March, 2014

jquery - changing bg color on min and max -

i want change color of button-down , button-up when spinner have min or max value red <input type="hidden" name="id" value="<?= $this->product->getid() ?>" /> <input name="quantity" value="1" readonly/> <script type="text/javascript"> $(document).ready(function () { $('input[name="quantity"]').spinner({ min: 1, max: <?= $this->product->getquantity() ?>, }).keydown(function (e) { e.preventdefault(); }); }); </script> you can apply change method jquery ui spinner provides: $('input[name="quantity"]').spinner({ min: 1, max: <?= $this->product->getquantity() ?>, spin:function(event, ui){ $(this).closest('.ui-spinner').find('a.ui-spinner-button').css('background', function(){

sql - Alias case statement -

i have stored procedure return negative number in id. (on purpose). in additional, have view shows table (simple select), don't want '-' appear in id column, mean, if number negative - want add letter 'a' id without '-'. how can this? select replace (id, '-', 'a') myid or if wanting append 'a' select replace (id, '-', '') + 'a' myid

How do I use the windows service and WCF to update some record in database? -

i wrote wcf service , host wcf in windows service using tcp .and using command installutil windowsservicesendmail.exe register on windows 7 . my problem service not start when right click on service1 (on window services on windows 7) , click start. read article , went forward step step result did not receive. this runprogram() method in wcf project in solution [operationcontract] void runprogram(); public void runprogram() { //code check database } this code in windows service project in solution protected override void onstart(string[] args) { if (myservicehost != null) { myservicehost.close(); } myservicehost = new servicehost(typeof(service1)); myservicehost.open(); } protected override void onstop() { if (myservicehost != null) { myservicehost.close(); myservicehost = null; } } and add reference wcf projec t windows service project and using command installutil windowsservicesendmail.exe regist

c# - Cannot convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'Umbraco.....' - Umbraco v6 -

i've looked @ couple of similar errors regarding ipublishedcontent (yes know different object i'm using) in umbraco, , they've said it's been fixed since 4.11.7 - however, i'm using v6 that's not case. case 1 case 2 my code worked until threw in coalesce: worked: dynamicpublishedcontent countryfolder = umbraco.media(currentpage.getproperty("contestmediafolder").value.tostring()); no longer works: dynamicpublishedcontent countryfolder = !string.isnullorempty(contestfolder) ? umbraco.media(currentpage.getproperty("contestmediafolder").value.tostring()) : umbraco.media(contestfolder); cannot convert type 'umbraco.core.dynamics.dynamicnull' 'umbraco.web.models.dynamicpublishedcontent' i have (2) controllers calling same code, 1 controller hit on page load, other api controller. reason i'm passing in variable, conte

What is the best solution to appen a line at the beginning of a String variable in Java? -

i have following situation. into java application have string variable named *fattura** contains structured data extracted xml...so fattura variable contains text this: <fatturaelettronicabody> <datigenerali> <datigeneralidocumento> <tipodocumento>td01</tipodocumento> <divisa>eur</divisa> <data>2015-03-16</data> <numero>004600002117</numero> <importototaledocumento>9.57</importototaledocumento> </datigeneral

Search and add a ldap entry using JSP/JNDI -

i'm trying add ldap entry jsp/jndi. code rough, i'm learning, if have advice please tell me. search section works fine. addentry section doesn't. tells me : " exception occurred: [ldap: error code 50 - entry cn=m,o=rubrica,dc=example,dc=com cannot added due insufficient access rights] " this code: <%@page import="javax.naming.namingenumeration"%> <%@page contenttype="text/html" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en""http://www.w3.org/tr/html4/loose.dtd"> <%@page import="java.util.*" %> <%@page import="javax.naming.ldap.*" %> <%@page import="javax.naming.directory.*"%> <%@page import="javax.naming.directory.initialdircontext"%> <%@page import="javax.naming.directory.dircontext"%> <%@page import="javax.naming.context" %> <%@page import="

ios - Fetching facebook friends of user -

i trying fetch facebook friend list of user returning count of friends.bellow code .is there wrong in code? -(void)loginviewfetcheduserinfo:(fbloginview *)loginview user:(id<fbgraphuser>)user { [fbrequestconnection startwithgraphpath:@"/me/friends" parameters:nil httpmethod:@"get" completionhandler:^( fbrequestconnection *connection, id result, nserror *error ) { nslog(@"me/friends result=%@",result); nslog(@"me/friends error = %@", error.description); nsarray *friendlist = [result objectforkey:@"data"];

c# - Access to the path is denied - different from user -

i have web page in asp.net & c#. page show table our orders. suppliers need check data , save them. my problem : when suppliers click on "save", pdf downloaded. have more 100 suppliers use website, works 98% of our suppliers. 3 suppliers have error message when click on "save" : access path "c:\externedata\pdf\f000001.pdf" denied. this code used access pdf : // save document... string filename = server.mappath("~/pdf/" + url_supplierid + ".pdf"); document.save(filename); string path = filename; string name = url_supplierid + ".pdf"; filestream fs = new filestream(path, filemode.open, fileaccess.read); // create byte array of file stream length byte[] _downfile = new byte[fs.length]; //read block of bytes stream byte array fs.read(_downfile, 0, system.convert.toint32(fs.length)); //close file stream fs.close(); session["pdfcontrol"] = _downfile; session["pdfcontrolname"] = url_suppl

Application.html.erb in rails 4 -

i new rails 4.0.2 . working on application rails version 4 , ruby 2. in views application.html.erb file not working. not replicating on view files. this code in application.html.erb file: <!doctype html> <html> <head> <title>myapp</title> <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html> i have controller named xyz_controller.rb has following code: class xyzcontroller << applicationcontroller end the application_controller.erb file has following code: class applicationcontroller < applicationcontroller def login end end the login.erb file contains normal html code. thanks in advance. your application controll

apache pig - In Pig latin, am not able to load data as multiple tuples, please advice -

i not able load data multiple tuples, not sure mistake doing, please advise. data.txt vineet 1 pass govt hisham 2 pass prvt raj 3 fail prvt i want load them 2 touples. a = load 'data.txt' using pigstorage('\t') (t1:tuple(name:bytearray, no:int), t2:tuple(result:chararray, school:chararray)); or a = load 'data.txt' using pigstorage('\t') (t1:(name:bytearray, no:int), t2:(result:chararray, school:chararray)); dump a; below data displayed in form of new line, dont know why not able read actual data data.txt. (,) (,) (,) as input data not stored tuple wont able read directly in tuple. one feasible approach read data , form tuple required fields. pig script : a = load 'a.csv' using pigstorage('\t') (name:chararray,no:int,result:chararray,school:chararray); b = foreach generate (name,no) t1:tuple(name:chararray, no:int), (result,school) t2:tuple(result:chararray, school:chararray); dump b; inp

namespaces - How to merge two wsdl in a wsdl file? -

i created proxy in wso2 esb, , used 2 different endpoints in it. want publish common wsdl. have 2 wsdl adresses 2 different web services. 1- http://localhost:12080/srv-csb-mock/csbservice?wsdl <?xml version="1.0" ?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://csb.sgrs.ayesas.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="csbservice" targetnamespace="http://csb.sgrs.ayesas.com/"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:tns="http://csb.sgrs.ayesas.com/" elementformdefault="unqualified" targetnamespace="http://csb.sgrs.ayesas.com/" version="1.0"> <xs:element name="carpma" type="tns:carpma"></xs:element>

c++ - Qt5 custom widget - Curved slider -

i'm starting next electronics project create own version of google's nest thermostat. whole circular dial temperature selection , i've been having think how create myself. gui programming not area of expertise (cli way!). so far i'm think along 1 of 2 lines, both involving custom widgets: create widget inherits pushbutton class. subclass contain lots of buttons, 1 each step in temperature scale, arranged in 3/4 circle. create widget inherits slider class, defining object curved around 3/4 of circle. each step temperature. now... have no idea if these practical solutions problem or if there easier way of doing this. i've had @ style sheets , don't think going it. i've had root around google similar , not found yet; said, analogwidgets 3electrons @ least creates dials, these output rather input.

parse.com - Change Parse Application when App is running -

i have android application works locals instalations , want use diferents parse applications. each instalation administrator contract parse directly. when app start keys parse. i wonder how change parse app linkeded in android app once running i have tried call parse.initialize (context, apllicationid, clientkey) twice doesn't work. have tried app register in diferent parse app every time start app link different parse app it´s linked first application public void oncreate(final bundle icicle){ super.oncreate(icicle); final context context = this; setcontentview(r.layout.ssa); getactionbar().hide(); // getting global variables fmglobalsbean = utilities.getglobals(this); if(!"".equals(fmglobalsbean.geturl_server())){ parse.initialize(contexto, "p4iwktrc0wtdkkmh6r60hjyzwx1tixchy8vcdvpb", "khkcx4g3dqvprawhyiyfnhawqj1h2vyhwd3winlq"); parseinstallation.getcurrentinstallation().saveinbackground();

html - li and a element styling issue with Chrome after clicking a link -

i have simple menu works fine in firefox, when using chrome links move around when click on them , breaks styling. read somewhere display: block; on a element fix this, didn't. you can see demo here: https://jsfiddle.net/dewg1l8y/1/ use chrome , click links see mean. also idea how remove text wrapping in chrome? stays on 1 line in firefox. html: <ul> <li> <a href="#">link 1</a> </li> <li> <a href="#">second link</a> </li> <li> <a href="#">3</a> </li> </ul> css: li { display: inline-block; list-style: none; } { display: block; color: #000; padding: 0 10% 0 10%; text-decoration: none; } just change padding 10% 10px or more tag

Code coverage in TFS2013 for multiple solutions -

i use tfs2013 , have build template definition. have few solutions built in build definition. if leave 1 solution in definition, after build completed, can see code coverage results. if include more 1 solution, after build completed 'no code coverage' in log file. mean there restriction see code coverage 1 build included in .xaml build template?

.net - How to deserialize comments from JIRA webhook correctly -

i deserializing webhook url jira having trouble deserializing comments part of issue in controller in mvc application. currently in deserializing correctly except comments part of json payload. this view of comments looks in json payload: 'comments':[ {'id':'71980','displayname':'ciaran','active':true},'created':'2015-06-10t09:30:07.983+0100','updated':'2015-06-10t09:30:07.983+0100'}, {'id':'72026','displayname':'ciaran ','active':true},'created':'2015-06-10t14:50:34.253+0100','updated':'2015-06-10t14:50:34.253+0100'}] using json2csharp , copying classes needed , comments looked this: then classes this: public class rootobject public property expand string public property id string public property self string public property key string public property fields fields end class public class f

c# - DataTrigger on each item's textbox in ItemsControl -

i have itemscontrol displays list of labels & textboxes used data input , button executes command when pressed (using input values): <datatemplate x:key="stringparametertemplate"> <stackpanel name="stackpanel_parameter" orientation="horizontal"> <label name="parameterlabel" content="{binding parameterlabel}" horizontalcontentalignment="right" width="200" /> <textbox name="parametertextblock" text="{binding parametervalue, updatesourcetrigger=propertychanged}" width="300"/> </stackpanel> </datatemplate> . . . <!-- display parameters --> <itemscontrol name="listview_parameters" itemssource="{binding parametercollection, notifyonsourceupdated=true, updates

How to add a translated validation message to a form without entity with Symfony 2.3 -

i'm using symfony 2.3 . have simple contact form , add custom translated validation messages, (but don't have entity) : class author { /** * @assert\notblank(message = "author.name.not_blank") */ public $name; } i have done : namespace me\mybundle\form\type; use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use symfony\component\optionsresolver\optionsresolverinterface; use symfony\component\validator\constraints\notblank; class contacttype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('name', 'text', array('constraints' => new notblank(array('message' => "contact.name.not_blank")),)) ; where in me/mybundle/resources/translations, have added in "validators.fr.yml" : contact.name.not_blank: "please enter name." the message "contact.

jenkins - Unable to trigger build using 'Poll SCM' and Git notifyCommit option -

Image
we use jenkins (1.614) , have git version control tool. git plugin version 2.3.5. trying trigger build only after every check-in since continuously polling expensive. tried following method described in various links it’s not working: enabled ‘poll scm’ , assigned dummy value. tried without assigning value. added following line in post-receive hook: curl http://jenkins_url:9099/jenkins/git/notifycommit?url=ssh://gitolite@git_server/testrepo now if commit changes, following message during push: $ git push origin release-test counting objects: 20, done. delta compression using 4 threads. compressing objects: 100% (2/2), done. writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done. total 3 (delta 1), reused 0 (delta 0) remote: commit id: 3a9cddadasd remote: returning result 0 remote: % total % received % xferd average speed time time time current remote: dload upload total spent left spee

javascript - Show/Hide markers with category. Not working with MarkerCluster -

i'm trying make select show , hide markers category. working fine, not working if there markercluster on map. eg. when choose category bar markers on map category restaurant disapear, markercluster still on map. here intin function: function initialize() { directionsdisplay = new google.maps.directionsrenderer(); var chicago = new google.maps.latlng(52.6145, 21.3418); var mapoptions = { zoom: 6, center: chicago }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); directionsdisplay.setmap(map); // geolocation if (navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { var pos = new google.maps.latlng(position.coords.latitude, position.coords.longitude); document.getelementbyid('field').value = +position.coords .latitude + "," + position.coords.longitude; marker = new google.maps.marker({ position: pos, an

mysql - how to access string sent from wearable tizen app to android app -

a bit of background: using samsung gear 2, samsung s4 ,eclipse , tizen ide wearable. i have app on both devices communicates using accessory sdk. on same app, have codes read heartrate. pass heartrate wear app using sasocket.senddata on code below. access string on android app using onrecieve method on shown below. now, want save heartrate in mysql. how can access string , save mysql? try { sasocket.setdatareceivelistener(onreceive); sasocket.senddata(channelid,heartrate.tostring()); } catch(err) { console.log("exception [" + err.name + "] msg[" + err.message + "]"); } @override public void onreceive(int channelid, byte[] data) { log.d(tag, "onreceive"); time time = new time(); time.set(system.currenttimemillis()); string timestr = " " + string.valueof(time.minute) + ":" + string.valueof(time.second); string strtoup

jquery - Web service call with ajax in asp.net -

i trying use web service using jquery ajax. webservice method called , parameter passed well, wonder why ajax not execute success function here's ajax call <script type="text/javascript"> function btn_add() { var = $("#tb_a").val(); var b = $("#tb_b").val(); var c = $("#tb_c").val(); var para = "a=" + + "&b=" + b + "&c=" + c; $.ajax({ type: "post", url: "mywebservice.asmx/add", data: para, datatype: "text", success: function (res) { alert("success"); console.log(res); } }); } </script> edit here webservice code [system.web.script.services.scriptservice] public class mywebservice : system.web.services.webservice { [webmethod, scriptmethod] public int add( in

asp.net - how to stop viewstate going stale? -

i have asp.net web forms app uses html5 "offline web apps" technology store pages in browser cache extended period of time. in case it's possible user press button on form , postback when it's days or weeks since form fetched server (i.e. long time interval between , post requests). sometimes, postback fails classic "validation of viewstate mac failed". question in 2 parts: what causes viewstate go stale? i.e. how can replicate problem on demand? is there can make sure never happens? bearing in mind there advice saying should never disable viewstate mac. you may able solve adding machine key web.config file. you can use online tool generate machine key, eg. http://www.developerfusion.com/tools/generatemachinekey/ . in web.config goes under configuration > system.web. it won't help, though, if make changes web form or form listitem values, etc. you may best not using asp.net form , instead submitting via ajax or using html f

Python to CSV or Excel Export multible data -

hey guys try write data csv file / excel. the problem excel file don't work , csv shows me "element div @ xx.xxx.xx" etc. wan't line line product , price filled in right match. excel prefered. around 1000 product scrapped. standard code test if code work: from lxml import html import requests urls = ['http://whiskey.de/shop/aktuell/'] url in urls: number in range(1, 15): page_url = url + str(number) if number > 1 else url page = requests.get(page_url) tree = html.fromstring(page.text) prices = tree.cssselect('div#content div.price') names = tree.cssselect('div#content div.title a') print 'whiskey preis: ', [price.text price in prices] print 'whiskey names: ', [name.text name in names] csv tested: from lxml import html import requests import csv urls = ['http://whiskey.de/shop/schottland/'] url in urls: number in range(1, 10):

MarkLogic Samplestack installation issue (Execution failed for task ':dbTeardown') -

i'm trying install samplestack application ml8.02 on os x 10.10.3. following instructions, goes until gulp once --browser=chrome step. generates execution failed task ':dbteardown' error, leading "the samplestack environment may not configured." message. according installation manual, step needs called "local samplestack repository root directory". different "marklogic-samplestack directory" in previous steps? if so, should look? not knowing do, used marklogic-samplestack-master (root downloaded zip) , got following console error message. advice how solve this? [16:55:06] warning: gulp version mismatch: [16:55:06] global gulp 3.9.0 [16:55:06] local gulp 3.8.11 [16:55:07] using gulpfile ~/downloads/marklogic-samplestack-master/gulpfile.js [16:55:07] starting 'once'... [16:55:08] starting 'clean'... [16:55:08] starting 'middle-tier-start'... reconfiguring database, starting app server ./gradlew dbinit --no-d

objective c - Create shake animation for UIImageView that is possible to start and stop -

i need shake uiimageview when event occurs, use following code shake animation: cabasicanimation *shake = [cabasicanimation animationwithkeypath:@"position"]; [shake setduration:0.1]; [shake setrepeatcount:infinity]; [shake setautoreverses:yes]; [shake setfromvalue:[nsvalue valuewithcgpoint: cgpointmake(_clockimg.center.x - 5,_clockimg.center.y)]]; [shake settovalue:[nsvalue valuewithcgpoint: cgpointmake(_clockimg.center.x + 5, _clockimg.center.y)]]; [_clockimg.layer addanimation:shake forkey:@"position"]; the problem can't stop animation when want to, tried [_clockimg stopanimating]; , changing [shake setrepeatcount:0]; animation keeps going. there way stop cabasicanimation want to? have tried: [image.layer removeallanimations]

sql - group by access seperate column -

i'm new sql , have following (seemingly simple) database query. i have table containing timetracking information set of employees: date employeeid timein timeout 01/01/20 1355 12:00 4:00 01/01/20 1355 4:30 6:00 01/01/15 1234 9:00 12:00 02/01/15 5555 5:00 6:00 02/01/15 1111 1:00 4:00 foreach date, want count number of unique employees worked, ending table like: date totalemployeesworked 01/01/15 2 02/01/15 2 there several id's ignore well. far came with: i have tried following query in ms access 2003: select [timetrackinglog-sql].date, count(distinct callername) [timetrackinglog-sql] group [timetrackinglog-sql].date and complained 'missing operator', highlighting use of callername. the news query legal (and straight forward!) ansi sql, work on sensible database. bad news ms access you're using not support syntax. it can worked around subquery, though: select t.date,

php - How can I cross-reference a database table by itself? -

i've been trying find way (armed basic knowledge of php , wildly optimistic sense of determination) search wordpress database meta-values based on other meta-values. i need item name 1 table (wp_posts) using post's id, use obtain post_id of items same name in table (wp_postmeta) , same table values particular custom field every post_id obtained. since i'm new attempted breaking down parts , here's i've got. <!-- part works , gets post title expected --> <?php $result1 =$wpdb->get_results("select post_title $wpdb->posts , $wpdb->postmeta $wpdb->posts.id = $post->id", object); print_r($result1[0]->post_title); ?> <!-- then, expected return post_id of entries title same 1 obtained , meta_key = custom_field_one. doesn't --> <?php $result2 =$wpdb->get_results("select post_id $wpdb->posts , $wpdb->postmeta $wpdb->postmeta.meta_value = $result1 , $wpdb

postgresql - Cakephp 3 and Postgre add.cpt doesnt work id_parent -

i'm trying create easy page on cakephp 3 using postgresql. not understand problem: create table "menus". when add new instance (add.cpt) parent field empty cant add parent. it's generated command "cake bake menus". thx :( view <div class="actions columns large-2 medium-3"> <h3><?= __('actions') ?></h3> <ul class="side-nav"> <li><?= $this->html->link(__('list menus'), ['action' => 'index']) ?></li> </ul> </div> <div class="menus form large-10 medium-9 columns"> <?= $this->form->create($menu); ?> <fieldset> <legend><?= __('add menu') ?></legend> <?php echo $this->form->input('name'); echo $this->form->input('parent_id'); ?> </fieldset> <?= $this-&g

java - Jsoup Login aspx Digikey -

i have problem connect digikey.it jsoup. need login account , use cookies, when execute post, not login. code: string urllogin="https://www.digikey.it/classic/registereduser/login.aspx?returnurl=%2fclassic%2fregistereduser%2fmydigikey.aspx%3fsite%3dit%26lang%3dit&site=it&lang=it"; connection.response response = jsoup.connect(urllogin) .method(connection.method.get) .execute(); document loginpage = response.parse(); response = jsoup.connect(urllogin) .data("ctl00$ctl00$maincontentplaceholder$maincontentplaceholder$txtusername", "username") .data("ctl00$ctl00$maincontentplaceholder$maincontentplaceholder$txtpassword", "password") .data("ctl00$ctl00$maincontentplaceholder$maincontentplaceholder$btnlogin", "accesso") .cookies(response.cookies()) .method(me

tfs2012 - What is the best branching strategy in TFS to share code between multiple team projects? -

this theoretical question branching, not code architecture or layers. i have team project "superlibs" 25 .net projects (which class libraries). team project's structure such: main (current stable version under development) dev (branched main - unstable code under development) releases\release 1.0 releases\release 2.0 releases\etc... and have team project "superlogic", contains logic application , depends on 5 projects superlibs. team project's structure such: main (current stable version under development) dev (branched main - unstable code under development) shared\superlibs\release 1.0 (branched release 1.0 of superlibs) shared\superlibs\release 2.0 (branched release 2.0 of superlibs) releases\release 1.0 releases\release 2.0 releases\etc... and have third team project "superapp" depends both on "superlibs" , on "superlogic". team project's structure such: main (current stable version under d

class type conversion fails C++ -

i'm trying make compile, won't, , couldn't find relevant on web. #include<iostream> using namespace std; class a; class b { int x; public: b(int i=107) {x=i;} operator a(); }; b::operator a() {return x;} class { int x; public: a(int i=6) {x=i;} int get_x() {return x;} }; int main() { a; b b=a; cout<<a.get_x(); return 0; } i errors: return type 'class a' incomplete conversion 'a' non-scalar type 'b' requested not works: b b; a=b; i don't know wrong, , don't know find more info on subject. thank you you didn't post full text of errors, means left out important line numbers. case, line numbers valuable piece of information in error. class a; class b { ... }; b::operator a() {return x;} i'm guessing line compiler telling error occurs on. at line of code, compiler not yet have complete declaration of a has no idea how convert int x class a .

sql - Executing a stored procedure using the 'IN' clause -

i've got following (very simplified) stored procedure: create procedure [dbo].[sp_search] @matchgender varchar(6) begin select * [tblusers] [usergender] in (@matchgender) end go i want able match either male, female or both, i'm using "in' clause. when test stored procedure, run following: exec [sp_search] 'f' works fine. now, how run both genders? when try: exec [sp_search] ('f', 'm') it doesn't work. what's proper syntax? please note, of these matches have couple dozen options, assume user can select 6 or 7 out of possible 20. not of variables simple m/f). i won't pretend ideal answer overall design perspective, here's 1 approach interpret you're trying: create procedure [dbo].[sp_search] @matchgender nvarchar(max) begin declare @statement nvarchar(max) set @statement = "select * [tblusers] usergender in (" + @matchgender +")" exec @statement end

android - Thread vs Handler for polling -

i need polling thread perform network operations every 5 mins. came following 2 solution. better , why? looking have minimum cpu , battery usage. pollthread = new thread(){ public void run(){ while(toggle) { // stuff sleep(five_minutes); } } }; pollthread.start(); or runnable dostuffrunnable = new runnable() { @override public void run() { // stuff handler.postdelayed(this, five_minutes); } } the answer depends on whether using handler handle other tasks well. if not, there won't difference; there still thread wakes every 5 minutes want. if handler handles other tasks, using handler more efficient having separate thread each task, requires 1 thread, , may have optimizations respect processor usage.

Getting my php file to work with my html file -

so want contact form work on site wrote php make work. here code: (form_process.php) <?php $name = $_post('name'); $company = $_post('company'); $email = $_post('email'); $message = $_post('message'); $to ="arp2222@yahoo.com"; $subject="new message kincentive"; mail($to, $subject, $message, "from: ".$name); echo "your message has been sent"; ?> i want know how can make php work html file. put php file in root folder index.html file , believe need set form tag. believe need use action or method attribute? setup as for example. i using mamp pro local host since site not live yet , want test contact form , recieve test email. any please new php in sendemail.html should write code given <form name="frmemail" id="frmemail" action="sendemail.php" method="post"> <input type="text" name="fname" id="fname&qu

Is it possible to deactivate MongoHealthIndicator in the Springboot spring actuator health endpoint? -

in springboot project work on there transitive maven dependency on spring-data-mongodb. therefore mongohealthindicator seems activated automatically although project not use mongodb. possible deactivate healthindicator without deactivating actuator health endpoint? workaround found excluding dependency. wondering if possible specific deactivation of mongohealthindicator. from: http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html # health indicators (previously health.*) ... management.health.mongo.enabled=true ... you should able set false disable health indicator. org.springframework.boot.actuate.autoconfigure.healthindicatorautoconfiguration.java @configuration @conditionalonbean(mongotemplate.class) @conditionalonproperty(prefix = "management.health.mongo", name = "enabled", matchifmissing = true) public static class mongohealthindicatorconfiguration {

javascript - background image isn't showed with the creation of the directive -

this directive (function() { 'use strict'; angular .module('app') .directive('backgroundimage', background); function background () { return function (scope, element, attrs) { scope.$watch(attrs.backgroundimage, function(value) { element.css({ 'background-image': 'url(https://example.com/' + value + '.jpg)', 'background-repeat': 'no-repeat', 'background-position': 'center center', 'background-attachment': 'fixed', '-webkit-background-size': 'cover', '-moz-background-size': 'cover', '-o-background-size': 'cover', 'background-size': 'cover' }); }); }; } }()); which call view following code <div background-image="id"></div> my issue de

ruby on rails - How can I use image_tag in a javascript response? -

i'm trying realize following: $(".share-icon").html("<%= image_tag(@card.photo.url(:small)) %>"); this not working how can use image_tag in js response? thanks try escaping html generated image_tag using escape_javascript $(".share-icon").html("<%= escape_javascript image_tag(@card.photo.url(:small)) %>");

user interface - "Add" Button for Data Frame Editing GUI in R -

i'm trying create gui in r user can add, edit, or search entries within data frame. adding new entry created "add" button opens new window. code follows: add <- gbutton("add entry", handler = function(h,...){ input <- gwindow("input new entry") vals <- ggroup(horizontal = f, use.scrollwindow = t, container = input) cols <- 1:length(colnames(data)) text <- vector() (n in cols) { adds <- gedit(initial.msg = colnames(data)[n], container = vals) text[n] <- adds[] } save <- gbutton("add entry",horizontal = f, handler = function(h,...){ tab[dim[1]+1,] <- text dim[1] = dim[1] + 1 dispose(input) },

javascript - How to promisify Node's child_process.exec and child_process.execFile functions with Bluebird? -

i'm using bluebird promise library under node.js, it's great! have question: if take @ documentation of node's child_process.exec , child_process.execfile can see both of these functions returning childprocess object. so what's recommended way promisify such functions? note following works (i promise object): var promise = require('bluebird'); var execasync = promise.promisify(require('child_process').exec); var execfileasync = promise.promisify(require('child_process').execfile); but how can 1 access original return value of original node.js functions? (in these cases need able access returned childprocess objects.) any suggestion appreciated! edit: here example code using return value of child_process.exec function: var exec = require('child_process').exec; var child = exec('node ./commands/server.js'); child.stdout.on('data', function(data) { console.log('stdout: ' + data); }); child.