Posts

Showing posts from September, 2014

Android using variable for first time -

Android using variable for first time - i need set values associated persistently stored data, if exist, on initialization. if not need initialize them. there disadvantage using sharedpreference initialize variable on first run. is, : @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); sharedpreferences sp = getsharedpreferences("mydataname", context.mode_private); string name = sp.getstring("name", ""); boolean isfirstrunning = sp.getboolean("firsttime", true); if (isfirstrunning) { toast.maketext(this, "yea", toast.length_long).show(); sharedpreferences.editor editor = sp.edit(); editor.putboolean("firsttime", false); editor.commit(); } } if there no disadvantage processing level, there standard practice far situation concerned? also, there alternative way handle pe

android - Using A Custom Attribute That Is In A Style With A View -

android - Using A Custom Attribute That Is In A Style With A View - lets have custom attribute in few styles so: <style name="theme1" parent="android:theme.holo"> <item name="textviewbackground">#000022</item> <item name="android:background">#000000</item> </style> <style name="theme2" parent="android:theme.holo"> <item name="textviewbackground">#aa2200</item> <item name="android:background">#000000</item> </style> can reference in standard view textview? like: <textview android:id="@+id/txtnumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@currenttheme.textviewbackground" android:text="number" /> you need define textview style, this: <style name="theme1"

java - Error posting data with android -

java - Error posting data with android - i having error can't seem figure out why. trying post info php file , falling grab error. toast getting in grab "data not sent", getting "data prepared" toast right before it. take , help me identify problem is? the android method: public void inserttodb(string data){ seek { httpclient client=new defaulthttpclient(); httppost getmethod=new httppost("http://shawnc.webuda.com/upload.php"); arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("rpm",data)); getmethod.setentity(new urlencodedformentity(namevaluepairs, http.utf_8)); string toasttext = "data prepared"; toast.maketext(getapplicationcontext(), toasttext, toast.length_short).show(); seek { client.execute(getmethod);

cypher - Iterate through Neo4j relationships and return the minimum value of relationships properties -

cypher - Iterate through Neo4j relationships and return the minimum value of relationships properties - i want iterate through relationships between "begining node" , "end node". indeed, there cypher request : match (ar1:article)-[:part_of]->()-[:series]->(s1), (ar2:article)-[:part_of]->()-[:series]->(s2), (ar1)-[:creator]->(au1:author), (ar2)-[:creator]->(au1:author), p1 = (au1)-[contributor*]->(au2:author) cut down (edge in relationships(p1)|weight + 1/edge.fdegree) strength_au1_au2_p1,ar1 ar1,s1 s1,ar2 ar2,s2 s2,au1 au1,au2 au2 s1.name='www' , s2.name='pods' , ar2.year >2010.0 , ar1.year >2010.0 , strength_au1_au2_p1<5.0 homecoming ar1,s1,ar2,s2,au1,au2,ar1.year calc_fuzzy_ar1_year_recent,ar2.year calc_fuzzy_ar2_year_recent,strength_au1_au2_p1 calc_fuzzy_length_p1_short** now want iterate through contributor* relationships (in p1) , each of 'fdegree' , homecoming minimum value(fdegree)

css - Force mobile layout in bootstrap -

css - Force mobile layout in bootstrap - is there way forcefulness mobile layout using css in bootstrap responsive? i think 1 way set @screen-sm big number. i'd rather not mess less files, can using css? i ended creating custom bootstrap build using website. here's version: http://getbootstrap.com/customize/?id=52279502e4625826d93b if has improve way of doing this, please share. css twitter-bootstrap mobile

Python Score Counter For Controlled Test -

Python Score Counter For Controlled Test - i have controlled assessment in 7 hours requires me build programme can maintain score of competition. in competition there 4 teams , 5 games. need programme give 1 point teams in event of tie, 2 points home win , 3 points away win. need display error message or when wrong team number has been entered. can help? needs in python. i've been coding few weeks , have no thought i'm doing. trying figure out how print out statement when wrong team number entered without counting within loop my code far: schoolnumber = [1,2,3,4] homescores =[0,0,0,0] awayscores=[0,0,0,0] counter in range(0, 5): whohost = int(input("who hosted game? ")) whowins = int(input("who winner? ")) if whohost == whowins: homescores[whowins-1] += 2 else: awayscores[whowins-1] += 3 print(homescores) print(awayscores) for counter in range(0, 5): while true: try: whohost

javascript - How to pass data to Mongodb using Node.js, websocket and total.js -

javascript - How to pass data to Mongodb using Node.js, websocket and total.js - i trying pass info mongodb using websocket , total.js. in homepage.html can user input , connect server via websocket after clicking save button. in default.js server side code. @ point app hat got user input , connected server correctly, how can save info mongodb now? this homepage.html <br /> <div> <input type="text" name="message" placeholder="service" maxlength="200" style="width:500px" /> <button name="send" >save</div> </div> <br /> <script type="text/javascript"> var socket = null; $(document).ready(function() { connect(); $('button').bind('click', function() { if (this.name === 'send') { console.log(send()); return; } }); }); function connect() {

jsp - Microsoft Access 2007 connectivity in java 8 -

jsp - Microsoft Access 2007 connectivity in java 8 - this question has reply here: manipulating access database java without odbc 1 reply i want connect database msaccess 2007 using java, hear jdbc bridge removed java 8. please guide me problem in next code. import java.sql.*; public class userlogin { public static void main(string[] args) { seek { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); // c:\\databasefilename.accdb" - location of database string url = "jdbc:odbc:driver={microsoft access driver (*.mdb, *.accdb)};dbq=" + "c:\\users\\shakir\\documents\\netbeansprojects\\userlogin\\me.accdb"; // specify url, username, pasword - create sure these valid connection conn = drivermanager.getconnection(url); system.out.println(

c# - Order of operations in a foreach loop -

c# - Order of operations in a foreach loop - i changed way crafting table works , i've run problem. way works displays item in crafting list. if can't create item, item texture in table translucent. my problem when checking if item can crafted, setting bool variable cancraft true or false , not setting correctly. public void checkforavailablecrafts(player player) { foreach (itemrecipe recipe in craftinglist) { if (recipe.checkforitemsneeded(player) != null) { output = recipe.output; updatetable(output); } else if (recipe.checkforitemsneeded(player) == null) { output = new item(); output.itemname = "empty"; updatetable(output); } the checkforitemsneeded method works correctly because worked fine before rewrote part of code. if have amount of items recipe cancraft item true. problem lie

javascript - Rails4: "scrollTop" doesn't work every other click -

javascript - Rails4: "scrollTop" doesn't work every other click - scrolltop doesn't work every other click (every sec click). i utilize will_paginate @ bottom of page. when click on link, page refreshed , display position @ bottom of page. click on link page, page refreshed , display position @ top of page expect. for example, when click link page 2, page 2 displayed display position remains @ bottom. when click link page 5, page 5 displayed , display position @ top expect. when click link page 6, page 6 displayed display position remains @ bottom. when click link page 8, page 8 displayed , display position @ top expect. ... i have tried followings, had same result. \assets\javascripts\calendars.js.coffee $('html, body').animate({ scrolltop: 0 }, 'slow') $('body').animate({ scrolltop: 0 }, 'slow') $('html, body').scrolltop() $(document).scrolltop() $(window).scrolltop() $(window).scrolltop(0) \v

gradlew - Gradle Tooling API - How to use Gradle wrapper? -

gradlew - Gradle Tooling API - How to use Gradle wrapper? - i've started using gradle tooling api , found question: there way utilize gradle wrapper gradle installation tooling api? need ignore gradle installation in scheme , utilize gradle wrapper target project under tooling api. thanks in advance! you don't need set this. default behavior: tooling api seek read gradle/wrapper/gradle-wrapper.properties in project find appropriate distribution used according test in https://github.com/gradle/gradle/blob/7dd276a91d9e22248306584afe04171fd86db529/subprojects/tooling-api/src/test/groovy/org/gradle/tooling/internal/consumer/distributionfactorytest.groovy#l44 gradle gradlew gradle-tooling-api

php - Multifeeds in simplepie, how to distinguish categories -

php - Multifeeds in simplepie, how to distinguish categories - i have multifeeds project created simplepie. runs fine want can't accomplish , haven't found tutorial regarding how it. project consists on news aggregator various categories arrays of links each one. have setup 2 test pages explain better: 1st:http://goo.gl/0e3kqu 2nd:http://goo.gl/yo1mtv on first illustration each category separated , has different border-bottom color (3 simplepie instances): <?php require_once('../inc/autoloader.php'); $feednews= new simplepie(); $feednews->set_feed_url(array('feed1', 'feed2','feed3',)); $feednews->init(); $feednews->handle_content_type(); $feedentertain= new simplepie(); $feedentertain->set_feed_url(array('feed4','feed5','feed6',)); $feedentertain->init(); $feedentertain->handle_content_type(); $feedtech= new simplepie(); $feedtech->set_feed_url(array('feed7','feed8'

c++ - Google Mock to test the real behaviors of a class -

c++ - Google Mock to test the real behaviors of a class - i new google test , google mock still little bit confused. tried implement simple calculator integer addition, multiplication , partition , create mock follows real behaviours. how can prepare or did wrong? also can explain me how can sure mocking original class instead of straight calling original class? give thanks ahead. here cbasicmath.hpp: #ifndef basic_math_hpp__ #define basic_math_hpp__ class cbasicmath { public: cbasicmath(){} virtual ~cbasicmath() {} virtual int addition(int x, int y); virtual int multiply(int x, int y); virtual int divide(int x, int y); }; #endif //basic_math_hpp__ here cbasicmath.cpp: #include "cbasicmath.hpp" int cbasicmath::addition(int x, int y) { homecoming (x + y); } int cbasicmath::multiply(int x, int y) { homecoming (x * y); } int cbasicmath::divide(int x, int y) { homecoming (x / y); } here mock_basic_test.cpp: #include

Asterisk wtih OriginateResponse -

Asterisk wtih OriginateResponse - someone have used asterisk originateresponse? how retrieve homecoming value of originate using php script example? thank's help. vononka. connect ami interface use actionid when originate. check in response actionid. asterisk

mysql - java.sql.SQLException: No database selected -

mysql - java.sql.SQLException: No database selected - as above have problem "select database" i using xampp, there created database in mysql , named "employees" this java code: public static void main(string[] args) { connection conn = null; statement stmt = null; try{ //step 2: register jdbc driver class.forname("com.mysql.jdbc.driver"); //step 3: open connection system.out.println("connecting database..."); conn = drivermanager.getconnection("jdbc:mysql://localhost?user=root&password="); //step 4: execute query system.out.println("creating statement..."); stmt = conn.createstatement(); string sql; sql = "select id, first, last, age employees"; resultset rs = stmt.executequery(sql); as seen in 'sql' seek reach database, using from employees i new programming databases. need find path of database? how , can find it? change connection string create conn

javascript - Vertical graphing in Dygraph? -

javascript - Vertical graphing in Dygraph? - i'd utilize dygraphs web project, need graph lines in "vertical" fashion- meaning- x axis (horizontally, along bottom), need graphed top bottom (with x axis along left edge). i've looked @ several graphing libraries , none seem back upwards it. discovered dygraphs i'm hoping might have feature. while vertical charts not supported out of box, possible accomplish effect using css transformations. basically, rotate <div> contains chart 90 degrees , undo transformation labels. one dygraphs user able work. see this demo. javascript dygraphs

is there is a command in bash that checks if a program can or cannot run -

is there is a command in bash that checks if a program can or cannot run - i origin larn how create bash scripts. i want know if there way test if programme can run or not. example, want test if ncl runs. if write ncl on terminal class="lang-none prettyprint-override"> xxx$ ncl dyld: library not loaded: /usr/local/lib/libgomp.1.dylib referenced from: /usr/local/ncl-6.2.1/bin/ncl reason: image not found trace/bpt trap: 5 that means ncl installed, programme cannot run due lack of library. i want know if there command in bash gives me 1 or 0 depending if ncl (or other program) runs or doesn't run. you should able check homecoming value of command in bash this... somecommand argument1 argument2 retval=$? [ $retval -eq 0 ] && echo success [ $retval -ne 0 ] && echo failure bash

php - Redirect with form variable doesn't work properly -

php - Redirect with form variable doesn't work properly - i have on file (search.php) uses variable received follows: session_start(); if (isset($_post['search'])){ $_session['search'] = $_post['search']; } the form: <form id="searchbox" action="/search.php" method="post"> <input id="search" name="search" type="text" placeholder="search products"> <input id="submit" type="submit" value="search" ></form> so submits itself i have next redirects in place: rewritecond %{the_request} \s/+search\.php? [nc] rewriterule ^ /search/? [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^search/?$ /search.php? [l,qsa] rewritecond %{the_request} \s/+search\.php\?pagenum_rs_search=([^\s&]+)&totalrows_rs_search=([^\s&]+) [nc] rewriterule ^ /search/%2/%1? [r=301,

mysql - Single Cloud SQL or multiple databases? -

mysql - Single Cloud SQL or multiple databases? - not sure how inquire question, understand google cloud sql supports thought of instances, located throughout global infrastructure...so can have single database spread across multiple instances on world. i have a few geographic regions our app serves...the info doesn't need aggregated whole , stored individually on separate databases in regions accordingly. does create sense serve regions off 1 database/multiple instances? or should segregate each part it's own database , host info old fashion way? if “scaling” mean memory size, can start smaller instance (less ram) , move more powerful instance (more ram) later. but if mean more operations per second, there max size , max number of operations 1 cloud sql instance can support. cannot infinitely scale 1 instance. internally info 1 instance indeed stored on multiples machines, more related reliability , durability, , not scale throughput beyond limit.

html5 - HTML select with angular bind -

html5 - HTML select with angular bind - i doing mockup page using angular js , html only. wonder if there faster can dynamic bind selected value in html angular object such if have sth like: item.dropdownvalue = 0; <select> <option value=0>pre-launch</option> <option value=1>active</option> <option value=2>complete</option> </select> that can bind dropwown turn be: <select> <option value=0 selected>pre-launch</option> <option value=1>active</option> <option value=2>complete</option> </select> just html dropdown helper in mvc5 simplified: if you're wanting impact selected state, can own html , bind scope value selected alternative via ng-model. see simplified plunker @ http://plnkr.co/edit/yiwbheqokdfgjkmv9qvy?p=preview original answer: this ca

sql - Recursive query with sum in Postgres -

sql - Recursive query with sum in Postgres - i must store lot of projects in db. each project can have kid projects. construction looks tree: project / | \ projectchild1 projectchild2 [...] projectchild[n] / | projectchildofchild1 projectchildofchild2 the level of tree unknow. i'm thinking create table this: table projects : project_id id_unique primary_key project_name text project_value numeric project_parent id_unique in case, column project_parent store id of parent project, if exists. for application need retrieve total value of project, need sum values of every project kid , root project. i know need utilize recursivity, don't know how in postgres. this simplified version of @a_horse's correct answer (after give-and-take op in comments). works any (reasonably finite) number of levels in re

javascript - Restrict number of input in a form when selected in a select dropdown -

javascript - Restrict number of input in a form when selected in a select dropdown - i wondering how restrict number of input using maybe javascript/html (form validation) when selected select input. scenario: have first dropdown box can take country code mobile number; 1 time selected, ofcourse 1 must input mobile number (length of mobile number depending on country code have chosen, e.g. +63[philippines] , users mobile number must 11 characters long). next line of codes: <div class="input-append"> <select name="mobile" tabindex="15" style="height: 30px; width: 80px;" required> <option <?php if (isset($source) && $source=="philippines") ?>>+63 (philippines)</option> <option <?php if (isset($source) && $source=="america") ?>>+1 (america)</option> <option <?php if (isset($source) && $source=="uk") ?>

c# - Consuming an ASMX and mocking the methods -

c# - Consuming an ASMX and mocking the methods - i have consume number of asmx webservices in poject method calls making hard unit test rest of code. when i've consumed wcf service in past generates interface client allows me mock service calls in unit tests. is same thing possible asmx webservices? my solution add web reference in visual studio right-clicking on service references > add together service reference > advanced > add together web reference . open reference.cs file generated right-click on class name of service , take refactor > extract > extract interface . give interface representing service methods. create new partial class service , create inherit new interface, making sure namespace , name of class match of service in reference.cs now you've got interface, you'll able mock service in unit tests. i hope helps other people , if theres easier method please allow me know. c# wcf unit-testing mocking asmx

import - Google Sheets: How do I IMPORTRANGE only if a corresponding cell in the same row is populated? -

import - Google Sheets: How do I IMPORTRANGE only if a corresponding cell in the same row is populated? - i have 2 google spreadsheets. 3 columns on sec spreadsheet beingness imported through importrange() formula. looks this: spreadsheet 1 ╔════════╦════════╦════════╦════════╗ ║ title1 ║ title2 ║ title3 ║ title4 ║ ╠════════╬════════╬════════╬════════╣ ║ input1 ║ input4 ║ input7 ║ ║ ║ input2 ║ input5 ║ input8 ║ ║ ║ input3 ║ input6 ║ input9 ║ ║ ╚════════╩════════╩════════╩════════╝ spreadsheet 2 ╔════════╦════════╦════════╗ ║ title1 ║ title2 ║ title3 ║ ╠════════╬════════╬════════╣ ║ input1 ║ input4 ║ input7 ║ ║ input2 ║ input5 ║ input8 ║ ║ input3 ║ input6 ║ input9 ║ ╚════════╩════════╩════════╝ the thing is, want info imported if corresponding cell in title4 column populated. this: if spreadsheet 1 looks this ╔════════╦════════╦════════╦═════════╗ ║ title1 ║ title2 ║ title3 ║ title4 ║ ╠════════╬════════╬════════╬═════════╣ ║ input1 ║ inp

eclipse - Reinstalling android app without uninstaling -

eclipse - Reinstalling android app without uninstaling - i have developed first app using eclipse , uploaded amazon app store. later, realized bugs, fixed them , re-uploaded. but, when want reinstall app on same/newer version, says: "the application installing replace application. previous info saved" other normal apks. "and says application not installed." have signed both versions using same key. when seek run app(let new project name androidapp_v2) bugs fixed ,then in eclipse show :"the application installing replace application".that means replace old project(let androidapp_v1) new project(androidapp_v2).if click ok ,it wil automaticall install new app . this because both applications have same bundle name. if bundle name of 2 applications different, won't message. in fact, if bundle name in manifest file (in tag) matches bundle name of installed application, replace it. android eclipse apk uninstall reinstall

maven-javadoc-plugin: How can I exclude resource folders which violate Java package naming conventions? -

maven-javadoc-plugin: How can I exclude resource folders which violate Java package naming conventions? - i trying generate aggregated set of javadocs collection of related projects, like so. in nutshell, pom project declares bunch of dependencies , uses maven-javadoc-plugin 's <includedependencysources>true</includedependencysources> option. some of dependencies have script-templates folder in resources, gets lumped "-sources" jar maven-source-plugin . unfortunately, seems javadoc tool dislikes folders violate java bundle naming conventions. build fails with: [error] failed execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar (attach-javadocs) on project imagej-javadoc: mavenreportexception: error while creating archive: [error] exit code: 1 - javadoc: error - illegal bundle name: "script-templates.java" i tried adding <excludepackagenames>script-templates</excludepackagenames> maven-javadoc-plugin

reviews - can we find the polarity of a word using NLTK? -

reviews - can we find the polarity of a word using NLTK? - i doing sentiment analysis on mobile product reviews, need find polarity of each extracted sentiment word positive or negative. so, need know if possible nltk? or if improve tools available finding polarity of word? please allow me know? you can have @ textblob you can various things like: noun phrase extraction part-of-speech tagging sentiment analysis classification (naive bayes, decision tree) find polarity of sentences etc download link nltk reviews

How to combine image and text into one blob in google drive -

How to combine image and text into one blob in google drive - i'm trying create own barcode labels google apps script. i'm able retrieve image blob of barcode, want able add together row of text it. possible combine or edit image blob? if how 1 go doing that. here current code getting barcode. function createlabel() { var url = "http://www.barcodesinc.com/generator/image.php?code=20-001-001&style=196&type=c128b&width=200&height=100&xres=1&font=3" var image = urlfetchapp.fetch(url).getblob(); driveapp.createfile(image); } i know barcode comes number of info below it, need create number larger , easier read. i've tried creating document , inserting text , image, it's printing need print. google not offer image manipulation methods in apps script (yet). maybe when google draw supports apps script there can utilize programmatically insert image drawing , add together text it, have create own ad-hoc solut

python - Cannot write some Paragraph into Excel cell - XLWT -

python - Cannot write some Paragraph into Excel cell - XLWT - i scraping rooms information http://www.wotif.com/hotel/view?hotel=w20307&page=1&adults=2&region=1&setcurrency=true&usercurrencycode=usd with beautifulsoap library , saving results excel xlwt-future-0.8.0 . everything scraped except, when code reaches scraping "premier total harbour b&b" hotel's description , writes excel, cell empty. here snippet scrapes description if rooms.select("p.deal-description"): #room description print("deal desc " + rooms.select("p.deal-description")[0].text.strip()) worksheet.write(file_row_number, 4,rooms.select("p.deal-description")[0].text.strip()) all room's description before "premier total harbour b&b" scraped , entered excel successfully. what can problem? illegible characters in description? python excel python-3.x xlwt

javascript - explain strange jquery selector -

javascript - explain strange jquery selector - i exercising @ http://jqexercise.droppages.com/#page_0016_ , after completing exercise "change h2 h3" checked out reply pressing "give up?" , saw this: var target = $('#target'); target.html(target.html().replace(/h2/g,'h3')); does has clue how .replace(/h2/g,'h3') "selector" works? i did not find .replace() , maybe deprecated. when found .replacewith() did not find references selector looks reg ex escape character. if can explain or point read grade full. actually if right /h2/ regex expression. between // taken , replaced string after comma. g flag apply matching globally. you can read on mdn javascript jquery

matlab - plotyy function showing two x-axes but only want one -

matlab - plotyy function showing two x-axes but only want one - i using plotyy function produce chart in image below. i have 2 issues chart. first issue beingness having 2 x-axes want 0 on left hand side of chart level 0 on right hand side. there anyway can create happen? lastly want set labels on x-axis can labels have numbers on top of them. want labels visible cannot seem do? below code. x_labels = data_cell(2:end, 1); risk_tot = cell2mat(data_cell(2:end, 2)); risk_cont = cell2mat(data_cell(2:end, 3)); [pp,h1,h2]=plotyy((1:length(risk_tot)),risk_tot,(1:length(risk_tot)),risk_cont,'bar','stem'); set(gca,'xtickl',x_labels); set(h1,'facecolor',my_blue2(40,:),'edgecolor',my_blue2(40,:)) set(h2,'color',my_orange(1,:),'linewidth',0.5,'markeredgecolor',my_orange(1,:)) set(pp(1),'box','off') set(pp(2),'box','off') update i have managed resolve sec issue x-axi

spring integration - int-http:inbound-gateway same request Channel and different Response channel issue -

spring integration - int-http:inbound-gateway same request Channel and different Response channel issue - i have 2 int-http:inbound-gateway path mentioned below.and points same request channel have different reply-channel. http://localhost:8080/xyz/abcservice/query -- expected phone call http:inbound-gateway id ="xyz" http://localhost:8080/abcservice/query - expected phone call http:inbound-gateway id ="default" but happing in not consistence when give request http://localhost:8080/xyz/abcservice/query it calling "default" gateway other time calling "xyz" i.e not consistence. or not sure may phone call correctly instead gives response different reply-channel ? i using dispatcherservlet.below spring-integration.xml <int-http:inbound-gateway id="default" path="/*service/query" request-channel="requestchannel" reply-channel="responsechannel&

c# - Unit Testing Queries that passes Expression<Func> to Repository -

c# - Unit Testing Queries that passes Expression<Func<T,bool>> to Repository - i'm having issue testing querying side of architecture i'm calling repository expects expression<func<t, bool>> parameter filtering. trying understand article, mark saying utilize stubs queries instead. lets have query handler: public class getuserbyemailqueryhandler : iqueryhandler<getuserbyemailquery, user> { private readonly igenericrepository<user> userrepository; public getuserbyemailqueryhandler(igenericrepository<user> userrepository) { this.userrepository = userrepository; } public user handle(getuserbyemailquery query) { homecoming this.userrepository.find(u => u.email == query.email && u.islockedout == false); } } now test going this: [fact] public void correctly_returns_result() { // arrange var id = guid.newguid(); var email = "test@

javascript - Sound won't play if invoked on ajax success function -

javascript - Sound won't play if invoked on ajax success function - i have sound clip embedded in mobile web page so: <audio id="sound"> <source src="/assets/sound/mysound.mp3" type="audio/mpeg"> </audio> i phone call so: $('#sound').get(0).play(); this works fine on chrome in both laptop , iphone. however, if phone call within success function of ajax so $.ajax({ .... success: function() { $('#sound').get(0).play(); } on chrome browser of laptop, works fine. on chrome or safari in ios, no sound played. anyone else run this? ios places restrictions on when/how can play sound in web apps. example, can't auto-play sounds, have initiated user-event (tapping button, etc). check out more info: http://www.ibm.com/developerworks/library/wa-ioshtml5/#n100e8 javascript ios audio

solr - Hadoop-2.5.1 + Nutch-2.2.1: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected -

solr - Hadoop-2.5.1 + Nutch-2.2.1: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected - command: ./crawl /urls /mydir xxxxx 2 when run command in hadoop-2.5.1 , nutch-2.2.1, wrong info following. 14/10/07 19:58:10 info mapreduce.job: running job: job_1411692996443_0016 14/10/07 19:58:17 info mapreduce.job: job job_1411692996443_0016 running in uber mode : false 14/10/07 19:58:17 info mapreduce.job: map 0% cut down 0% 14/10/07 19:58:21 info mapreduce.job: task id : attempt_1411692996443_0016_m_000000_0, status : failed error: found interface org.apache.hadoop.mapreduce.taskattemptcontext, class expected 14/10/07 19:58:26 info mapreduce.job: task id : attempt_1411692996443_0016_m_000000_1, status : failed error: found interface org.apache.hadoop.mapreduce.taskattemptcontext, class expected 14/10/07 19:58:31 info mapreduce.job: task id : attempt_1411692996443_0016_m_000000_2, status : failed error: found interface org.apache.hadoop.mapreduce

Prevent Overpass API from returning nodes and show ways only -

Prevent Overpass API from returning nodes and show ways only - i'm trying roads around point. i'm using next query: ( way (around:300,50.7913547,-1.0944082) ["highway"~"^(primary|secondary|tertiary|residential)$"] ["crossing"!~"."] ["name"]; >; ); out; i added crossing exclusion because kept including "markers" crossings, , i'm interested in roads. however seems ignoring crossing , still plotting markers on map, rather showing road outlines. this can seen here. these "nodes" don't want have tags: crossing=zebra highway=crossing which should fail regex query, doesn't. how homecoming road plot lines, , none of these nodes/markers? sorry if terminology wrong, i'm new this the filter criterion tried utilize apply way rather nodes. usually, way wouldn't have crossing tag, filter didn't have much of effect on final result. using >

android - set a renderscript global from another script -

android - set a renderscript global from another script - is there possibility set field in android renderscript out of renderscript b? know can phone call kernel of script, using rsforeach() , how set globals or bind allocations? example: i have (of course of study there multiple) slave script slave.rs : class="lang-c prettyprint-override"> // 2 illustration allocations rs_allocation gimg1; rs_allocation gimg2; /** merge 2 images element wise - illustration */ float2 __attribute__((kernel)) root(uint32_t x, uint32_t y) { float2 merged = 0; merged.x = rsgetelementat_float(gimg1, x, y); merged.y = rsgetelementat_float(gimg2, x, y); homecoming merged; } which phone call master.rs script: class="lang-c prettyprint-override"> // globals (which set java) rs_allocation gi0; rs_allocation gi1; rs_allocation gmerged; rs_script mslave; /** * function called java , should delegate of work * kernel function of slave - scri

jquery - How to use datepicker Dynamically -

jquery - How to use datepicker Dynamically - i have input boxes, how can utilize datepicker dynamically <input type="text" id="datepicker" name="date[0]"> <input type="text" id="datepicker" name="date[1]"> <input type="text" id="datepicker" name="date[2]"> <input type="text" id="datepicker" name="date[3]"> i tried code wont work first input changes $('name^="date"').datepicker({ dateformat: 'yy-mm-dd', changemonth: true, changeyear: true }) i want code dynamically not $('#datepicker1').datepicker({}) $('#datepicker2').datepicker({}).... is possible? reply. for case should utilize class instead of id: <input type="text" class="datepicker" name="date[0]"> <input type="text" class="datepicker" name=&qu

c# - Factory pattern with Managed Ext Framwork (MEF) -

c# - Factory pattern with Managed Ext Framwork (MEF) - i trying implement mill pattern mef. here solution core project iclass objectfactory static class(this problem is) project a [export(typeof(iclass))] [exportmetadata("type", "typea")] public classa : iclass {} projectb [export(typeof(iclass))] [exportmetadata("type", "typeb")] public classb : iclass {} i facing problem when trying create object dynamically and here mill class: public static class objectfactory { private static readonly compositioncontainer _container; [importmany] public static ienumerable<lazy<iclass, imetadata>> objecttypes; static objectfactory() { aggregatecatalog catalog = new aggregatecatalog(); catalog.catalogs.add(new directorycatalog(environment.currentdirectory)); _container = new compositioncontainer(catalog); seek { objecttypes = _container.get

sql - Maintaining the order by in union of two ordered by queries -

sql - Maintaining the order by in union of two ordered by queries - i trying run below query looks doing wrong. (just modified sample query clear understanding) select name,total,rate business b rate > 100 order total desc union select name,total,rate business b rate <= 100 order rate asc now want union of these 2 queries , in resultant output in first row output should come first query , output sec query in same sorted order single actual query giving. let me know if still unclear. seek explain in more deep level. it's simple: utilize union all instead of union . select * ( select name,total,rate business b rate > 100 order total desc) x union select * ( select name,total,rate business b rate <= 100 order rate asc) y union preserves order coded. union removes duplicates , not guarantee order. databases sort output (to create duplicate detection easier). sql oracle11g oracle-sqldeveloper

python - Error E-Mails in Tornado -

python - Error E-Mails in Tornado - i running project in tornado, prefer not check log files regularly uncaught errors , have "email someone" or "store in db" (preferred mongodb). tornado doesn't seems have (at to the lowest degree in documentation) method this. there way this? you create many custom exceptions handlers: the first stores serialized exception mongo (using motor) the second, email serialized exception, via logging.handlers.smtphandler. have to: https://docs.python.org/2/library/logging.handlers.html how do, in tornado apps: create applicationexception class stores content of traceback string save applicationexception instances generated on runtime code on exception cassandra or mongo, using save method of applicationexception class send via email, specific applicationexception subclass objects using smtp handler i utilize this, when implementing tornado based client / server solution, can send applicationexception obje

javascript - Forcing an http request to timeout from frontend -

javascript - Forcing an http request to timeout from frontend - i making single page application using angular, @ times backend services not response or downwards , browser takes long time timeout request. how can forcefully timeout http request frontend in lesser time, help me show message user backend not responding. $http config has timeout property can set when making request $http . if want done @ global level $http can @ post how set global http timeout in angularjs javascript angularjs http frontend

iterator - Rust String indexing. Compare str[i] char -

iterator - Rust String indexing. Compare str[i] char - i wan't read strings "input.txt" , leave those, have no # (comment) symbol in start of line. wrote code: use std::io::bufferedreader; utilize std::io::file; fn main() { allow path = path::new("input.txt"); allow mut file = bufferedreader::new(file::open(&path)); allow lines: vec<string> = file.lines().map(|x| x.unwrap()).collect(); allow mut iter = lines.iter().filter(|&x| x.as_slice().chars().next() != "#".chars().next()); println!("{}", iter.next().unwrap()); } but line |&x| x.as_slice().chars().next() != "#".chars().next() smells bad me, because can |x| x[0] == "#" , can't check e.g. sec char in string. so how can refactor code? rust strings stored sequence of bytes representing characters in utf-8 encoding. utf-8 variable-width encoding, byte indexing can leave within character, unsafe. getting cod

validation - 4 Digit Pin Regex -

validation - 4 Digit Pin Regex - using jquery bootstrapvalidator , trying add together additional validation 4 digit pin financial app. so have gotten far making sure user's input has 4 digits , numeric. /^\d{4}$/ now trying next additional regex validations , stuck. help appreciated. make sure 4 digits aren't same (ie. 1111 or 9999) not sequential (ie. 1234, 6789) not birth year. simplify, excluding number starts 19 or 20 (ie. 1986, 2004). thanks in advance help. your first , 3rd constraints easy translate regex: class="lang-none prettyprint-override"> ^(?!(.)\1{3})(?!19|20)\d{4}$ here, used 2 negative lookaheads, 1 each constraint. however, non-sequential constraint, while possible, unreasonably convoluted regex handle. here, decide if it's worth pain: class="lang-none prettyprint-override"> ^(?!(.)\1{3})(?!19|20)(?!0123|1234|2345|3456|4567|5678|6789|7890|0987|9876|8765|7654|6543|5432|4321|3210)\d{4

javascript - How to allow numbers only in jqGrid cell editing? -

javascript - How to allow numbers only in jqGrid cell editing? - when grid editable take numbers when typing how it? jsp grid load code: <s:url id="mobbillid" action="newmul_mob_gridact" /> <sjg:grid caption="employee mobilebill details" gridmodel="mobbill_gridmodel" height="200" href="%{mobbillid}" id="gridtab" celledit="true" cellurl="%{mobbillid}" rownumbers="true" viewrecords="true" pager="true" pagerposition="center" navigator="true" navigatorsearch="true" navigatorsearchoptions="{multiplesearch:true}" navigatordelete="false" navigatoredit="false"

c++ - What are the advantages of using QGraphicsWebView over QWebView? -

c++ - What are the advantages of using QGraphicsWebView over QWebView? - apologies if question grounded in misconception. i'm new both webkit , qt. i'm trying sense circumstances justify using qgraphicswebview instead of simple qwebview object. understand 1 more complicated implement other. added fliexibility utilize of qgraphicsview class add? , why qt-creator's default html5 application template utilize qgraphicswebview instead of qwebview? for example, if wanted implement mouse gesture-driven scrolling , zooming, or implement custom scrolling implementation, need qgraphicswebview, or simple qwebview suffice? from qt docs: the qgraphicswebview class allows web content added graphicsview so qgraphicswebview can used qgraphicsitem in qgraphicsscene . c++ qt qt-creator qwebview qwebkit

objective c - Xcode storyboards and xibs for iPhone and iPad -

objective c - Xcode storyboards and xibs for iPhone and iPad - i have iphone app thats uses xib's graphical interface. we planning create ipad app using same code, different graphical interface. i storyboards because of nice flow , overview , thinking of using ipad, i'm considering not because: is bad practice have 1 ipad not iphone? the seque , push/present can confusing? having more developers in storyboard can give merge nightmares? thanks in advance is bad practice have 1 ipad not iphone? if go on utilize xibs, same both if universal app. confusing others may work on code. , might end lot of if else code. the seque , push/present can confusing? once used it, useful way of navigating between controllers. if have specific questions point out. having more developers in storyboard can give merge nightmares? its xml document, versioning scheme out there can handle merges pretty easily. file if 2 or more developers hav

javascript - codemirror : how to indent the whole line when pressing tab? -

javascript - codemirror : how to indent the whole line when pressing tab? - i creating new simple mode codemirror. i when user presses "tab", whole line gets indented (as opposed part of line after cursor, "splitting" line in two). what simplest way ? note : corresponding code not have defined in mode. other approach (e.g. add together on or configuration) work well. this should work. jsfiddle extrakeys: { "tab": function(cm){ // cursor position var pos = cm.getcursor(); // set cursor position begining of line. cm.setcursor({ line: pos.line, ch: 0 }); // insert tab cm.replaceselection("\t", "end"); // set cursor position original. cm.setcursor({ line: pos.line, ch: pos.ch + 1 }); } } javascript codemirror codemirror-modes

How to view the Friends in google plus using java-google api? -

How to view the Friends in google plus using java-google api? - i developing application view google plus friendlist of particular user. far have completed auth process. my java code bundle hello; import java.io.ioexception; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.springframework.social.oauth2.granttype; import org.springframework.social.oauth2.oauth2parameters; import com.google.api.client.http.httptransport; import com.google.api.client.http.javanet.nethttptransport; import com.google.api.client.json.jsonfactory; import com.google.api.client.json.jackson.jacksonfactory; import com.googlecode.googleplus.googleplusfactory; /** * servlet implementation class signin */ @webservlet("/signin") public class signin extends httpservlet { private static final long

java - Append byte array as unicode character(s) to a string and display it and write that string back to a file -

java - Append byte array as unicode character(s) to a string and display it and write that string back to a file - i have byte array e2 80 94 means long dash "\u2014". want append bytes string see long dash when display it. how do that? after displaying it, howdo write string file long dash stored e2 80 94 ? my bytes vary in length: 1 - 8 bytes. want write them literally string (and string file). have no means know if bytes 1 character or multiple. reading them binary file(.mobi). "0x01 0x08: "literals": byte interpreted count 1 8, , many literals copied unmodified compressed stream decompressed stream." -wikibooks, palmdoc compression you can build string with http://docs.oracle.com/javase/7/docs/api/java/lang/string.html#string%28byte[],%20java.nio.charset.charset%29 and operate it. create sure identify encoding of binary array in order constructor work java string unicode bytearray

javascript - jquery: slide-in and slide-out of a box whenn scrolling -

javascript - jquery: slide-in and slide-out of a box whenn scrolling - with code #slidebox sliding in right, after page scrolled downwards 50px. have add, when box should slide out after 150px scrolling? lines "<150" conditions did't work me... give thanks you! <script type="text/javascript"> $(function() { $(window).scroll(function(){ if ($(window).scrolltop() > 50) $('#slidebox').animate({'right':'0px'},300); else $('#slidebox').stop(true).animate({'right':'-430px'},100); }); }); </script> update: working result: $(function() { $(window).scroll(function(){ if($(window).scrolltop() > 50) { $('#slidebox').animate({'right': '0px'}, 300); } else $('#slidebox').stop(true).animate({'right':'-430px'},100); if($(window).scrolltop() > 500) { $('

rubygems - Initialize gem Artii on a File (Ruby) -

rubygems - Initialize gem Artii on a File (Ruby) - i know can initialize artii on cmd with: artii "word" and word appears, cant find how straight .rb file. artii::base#asciify returns formatted string: require 'artii' = artii::base.new a.asciify('word') #=> " _ \n | |\n __ _____ _ __ __| |\n \\ \\ /\\ / / _ \\| '__/ _` |\n \\ v v / (_) | | | (_| |\n \\_/\\_/ \\___/|_| \\__,_|\n \n " you have print in order see formatting: puts a.asciify('word') output: class="lang-none prettyprint-override"> _ | | __ _____ _ __ __| | \ \ /\ / / _ \| '__/ _` | \ v v / (_) | | | (_| | \_/\_/ \___/|_| \__,_| ruby rubygems

Ruby syntax error for non existent lines -

Ruby syntax error for non existent lines - i'm getting 41: syntax error, unexpected keyword_ensure, expecting keyword_end . have error line 43. the catch? code stops @ line 40, , i'm not seeing spaces or tabs in sublime text... gives? <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title"> <h1>listing reports</h1> </div> </div> <div class="panel-body"> <table> <thead> <tr> <th>summoner name</th> <th>user</th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <% @reports.each |report| %> <tr>