Posts

Showing posts from April, 2015

javascript - Dynamically fill div with same ID using jQuery -

i using history.js dynamically fill body of html pages in order prevent entire page refreshes. however, having trouble getting data , filling div if same id. of pages structured: <div id="content"> <div id="container"> ... here current jquery/history.js history.adapter.bind(window, 'statechange', function() { var state = history.getstate(); $.get(state.url, function(data) { $('#content').fadeto(600, 0, function() { $('#content').html($(data).find('#container').html()).delay(200).fadeto(600, 1); }); }); }); i want able data 'content' , fill 'content' div, when change variable in find() 'content', return nothing. why don't use this? : $('#content').fadeto(600, 0, function() { $(this).children('#container').html(data).delay(200).fadeto(600, 1); });

java - How to set context path to root("/") in Tomcat 7.0 when using Maven -

i hava maven project, pom.xml contains tomcat plugin. <plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <version>2.2</version> </plugin> i've downloaded tomcat 7, i've got tomcat directory (apache-tomcat-7.0.56). tried 3 goals run project: tomcat7:run, tomcat7:run-war, tomcat7:run-war-only my application running @ http://localhost:8080/projectname , if run tomcat7:run-war, projectname-0.0.1-snapshot.war appears in /target directory of project. i want run application @ http://localhost:8080/ . i know question asked before, unfortunately solutions didn't me. i tried both methods first answer of this . first method didn't work me, after renaming war nothing changed, tomcat7:run-war-only requires war name projectname-0.0.1-snapshot.war. the second method changed nothing (i tried both <context path="" docbase="projectname-0.0.1-snaps...

sql server 2008 - How to SET CONVERT date and time formats with MS SQL -

i trying run following sql statement cant quite syntax right.. update [order] set [status] = 'f', [ninvoicestatus] = 1, [ntotalitemsshipped] = [ntotalitemsordered], [total lines shipped] = [total lines], [date order finished] = convert (varchar(16), getdate(),111), convert (varchar(16), getdate(),108) [status] = 'n'; my objective insert current date , time in format 'dd/mm/yyyy hh:mi:ss' does have advice or helpful pointers? no sql expert happy try out alternative solutions or research (i have looked around net already) if pointed in right direction. try concatenating date , time: [date order finished] = convert (varchar(16), getdate(),111) +' '+ convert (varchar(16), getdate(),108)

subtyping - How to define Subtypes in Isabelle and what they mean? -

the question regarding subtyping in isabelle lengthy here . simple question how can define type b subtype of if define below: typedecl by doing make operations , relations defined on (they not printed here) accessible elements of type b. a bit more complex example define b , c subtype of such b , c disjoint, , every element of either of type b or of type c. thanks isabelle not have subtypes, although aspects of subtyping can emulated explained in thread . if want use same operation on different types, may want isabelle's type classes.

css - ASP.net MVC navbar-brand to header text color -

it's amazing there no easy find answer one: i want change textcolor of actionlinks in header. have tried code: css: .navbar-brand { color: black } .navbar-brand:visited { color: black } .navbar-default-color { color: black } cshtml: @html.actionlink("home", "index", "home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@html.actionlink("senders", "index", "senders", new { @class = "navbar-brand" })</li> <li>@html.actionlink("responders", "index", "responders", new { @class = "navbar-brand" })</li> </ul> all of actionlinks in header inherits style navbar-brand . home actionlinks gets it's text color changed. (see picture) http://i.imgur.com/l0hjmk2.png ...

c# - How to make ActionResult inaccessible via URL but is need to be called from ajax? -

grettings friends. have been researching site looong time , have not gotten satisfactory answer question. this controller: public actionresult eliminarlibro(string bookid) { bookmodel modelolibro = new bookmodel(); modelolibro.eliminarlibro(bookid); tempdata["message"] = "se ha eliminado el libro correctamente."; return redirecttoaction("gestionbiblioteca"); } and ajax in view: var mybookid = $('.parrafo-codigo').text(); $.ajax({ type: "get", url: "/home/verificareliminarlibro", data: { bookid: mybookid }, datatype: "json", success: function (data) { // $('#result').html(data); if (data.estelibroestaprestado == true) { $('#delmodal').modal('hide'); // quito modal de pregunta si se elimina $('#errmodal').modal('show'); // muestra modal de error ...

c++ - Opencv - Haar cascade - Face tracking is very slow -

i have developed project tracking face through camera using opencv library. used haar cascade haarcascade_frontalface_alt.xml detect face. my problem if image capture webcame doesn't contain faces, process detect faces slow images camera, showed continuosly user, delayed. my source code: void camera() { string face_cascade_name = "haarcascade_frontalface_alt.xml"; string eye_cascade_name = "haarcascade_eye_tree_eyeglasses.xml"; cascadeclassifier face_cascade; cascadeclassifier eyes_cascade; string window_name = "capture - face detection"; videocapture cap(0); if (!face_cascade.load(face_cascade_name)) printf("--(!)error loading\n"); if (!eyes_cascade.load(eye_cascade_name)) printf("--(!)error loading\n"); if (!cap.isopened()) { cerr << "capture device id " << 0 << "cannot opened." << endl; } else ...

beagleboneblack - Beaglebone packet sniffer using LWIP and StarterWare -

i have been working on project planning on using beaglebone black packet sniffer (and logger) local network. have worked starterware examples echo_server , http_server, , work fine. however, not being acquainted inner operations of tcp/ip don't know how modify existing starterware code base implement promiscuous mode packet sniffing. have suggestions or reasons why port of lwip may or may not work intended use? thanks,

c++ - difference between lapacke and lapack -

i wonder difference between lapack e , lapack. want eigen analysis qz decomposition, i'm not sure if should start lapack e or lapack. appreciate help. you want use lapacke frees writing helpers converting from/to row-major mode column major mode matrices before/after lapack calls.

io - C - program checks only the first word in file -

c beginner here. suggestions? have file containing text , have find words can read same forwards , backwards (palindromes) example rotator, eye , on. problem program checks first word in file. in advance. that code now: #include <stdio.h> #include <string.h> int main() { char buffer[255]; char one[255]; char two[255]; char *fp; fp = fopen("duom.txt", "r"); fgets(buffer, 255, (file*)fp); sscanf(buffer, "%s", one); strcpy(two, one); strrev(two); if(strcmp(one, two) == 0) printf("%s palindrome\n", one); else printf("%s not palindrome\n", one); return 0; } your code run once, need put main analysis inside while loop. i'll let test loop , how check next word.

ios - Trouble with OAuth in Temboo -

i trying authorize twitter user in ios , temboo. here how attempting it. in setttingsviewcontroller class have button user can tap begin twitterauthentication. have initializeoauth methods in class called twitterclient, , finalizeoauth methods in class called twitterfclient. here classes. twitterclient.m -(void)runinitializeoauthchoreo { // instantiate choreo, using instantiated temboosession object, eg: tmbtemboosession *session = [[tmbtemboosession alloc] initwithaccount:@"prnk28" appkeyname:@"floadt" andappkeyvalue:@"9b9031d182d7441da05f8214ba2c7170"]; // create choreo object using temboo session tmbtwitter_oauth_initializeoauth *initializeoauthchoreo = [[tmbtwitter_oauth_initializeoauth alloc] initwithsession:session]; // inputs object choreo tmbtwitter_oauth_initializeoauth_inputs *initializeoauthinputs = [initializeoauthchoreo newinputset]; // set credential use execution [initializeoauthinputs setcredenti...

Redirect http to https for multiple wordpress blogs running under IIS -

as title stated, i've wordpress multisite installation running several blogs under iis. need force redirect "http" "https" of them. blogs typically reachable , without 'www'. let's have following blogs: mickey.it donald.it daisy.it and only mickey , daisy run https ready, need conditional rewrite condition add web.cofig my web.config file has typical wordpress rewrite rules , not more: <rules> <rule name="wordpress rule 1" stopprocessing="true"> <match url="^index\.php$" ignorecase="false" /> <action type="none" /> </rule> <rule name="wordpress rule 2" stopprocessing="true"> <match url="^([_0-9a-za-z-]+/)?files/(.+)" ignorecase="false" /> <action type="rewrite" url="wp-includes/ms-files.php?file={r:2}" appendquerystring="false" /> ...

ruby on rails - Unknown attributes account id -

i have devise model named "account", , i'm trying create friendships between users using friendship model has initiator user id , friend user id. have view list of users current user can add, , when press add button, friendship should created: <td><%= link_to "add friend", friendships_path(:friend_id => account.id), :method => :post %></td> i'm having following error: unknown attribute: account_id def create @friendship = current_account.friendships.build(:friend_id => params[:friend_id]) if @friendship.save flash[:notice] = "added friend." redirect_to root_url else flash[:error] = "unable add friend." redirect_to root_url end end class friendship < activerecord::base belongs_to :account belongs_to :friend, :class_name => "account" end if, said, friendship schema has user_id , friend_id, error: unknown attribute: account_...

python - Why doesn't this pyside window disappear? -

i looking way cross-platform notification, here code cross-platform desktop notifier in python , modification make runable: # uitoast.py pyside import qtcore, qtgui class ui_mainwindow(object): def setupui(self, mainwindow): mainwindow.resize(547, 96) palette = qtgui.qpalette() brush = qtgui.qbrush(qtgui.qcolor(255, 255, 255)) brush.setstyle(qtcore.qt.solidpattern) palette.setbrush(qtgui.qpalette.active, qtgui.qpalette.base, brush) brush = qtgui.qbrush(qtgui.qcolor(255, 170, 0)) brush.setstyle(qtcore.qt.solidpattern) palette.setbrush(qtgui.qpalette.active, qtgui.qpalette.window, brush) mainwindow.setpalette(palette) self.centralwidget = qtgui.qwidget(mainwindow) self.display = qtgui.qtextbrowser(self.centralwidget) self.display.setgeometry(qtcore.qrect(0, 0, 551, 101)) palette = qtgui.qpalette() brush = qtgui.qbrush(qtgui.qcolor(255, 170, 0)) brush.setstyle...

r - Roxygen: Shared documentation for arguments shared by multiple functions -

i'm developing package in multiple different functions have subsets of same arguments. means have lot of duplication of argument documentation. in many cases these functions can't logically grouped together, i.e. doesn't make sense put them in same .rd file. there way avoiding duplication if documentation? i.e. having master .rd file components can selectively included in other roxygen blocks?

javascript - Open file dialog when input type button -

in html know using input type file file dialog select file. there way open file dialog using input type button? used <input type="file" class="file" name="attachement" /> but want use <input type="button" class="file" name="attachement" /> yes - can hide input type="file" still have in markup. show regular button on page , onclick of button, programmatically trigger click event of actual file input: <input id="fileinput" type="file" style="display:none;" /> <input type="button" value="choose files!" onclick="document.getelementbyid('fileinput').click();" /> fiddle: http://jsfiddle.net/cnjf50vd/

polymer - auto-binding for panelSelectedChanged -

<template is="auto-binding"> <core-drawer-panel drawerwidth="180px" rightdrawer forcenarrow selected="{{panelselected}}"> </core-drawer-panel> </template> <script> var t = document.queryselector('template'); t.panelselectedchanged=function(){ console.log('panelselectedchange', this.panelselected) } </script> is there way use ...changed feature in autobinding? can not wrap in polymer element because break other js frameworks around it. edit: answer received jeff works perfect, want point out has non intuitive behavior t.addeventlistener('template-bound', function() { document.queryselector('core-drawer-panel').addeventlistener('core-select', function(e) { console.log('selection changed:', e.detail.isselected) console.log('selection changed:'...

nlp - What is pos of `r` or `s` in Wordnet via NLTK -

i accessing wordnet via nltk. if word big, find unknown parts of speech s or r. docs "a synset identified 3-part name of form: word.pos.nn." wordnet not seem mention part of speech shortened s or r. these synsets? $wordnet.synsets('big') [synset('large.a.01'), synset('big.s.02'), synset('bad.s.02'), synset('big.s.04'), synset('big.s.05'), synset('big.s.06'), synset('boastful.s.01'), synset('big.s.08'), synset('adult.s.01'), synset('big.s.10'), synset('big.s.11'), synset('big.s.12'), synset('big.s.13'), synset('big.r.01'), synset('boastfully.r.01'), synset('big.r.03'), synset('big.r.04')] s = adjective satellite r = adverb see http://wordnet.princeton.edu/man/wndb.5wn.html

Matching 'whole text only' using expect -

i trying match string in expect programming mentioned below send "cd $tftproot/cmbuild\r" expect \\$ send "ls -lrt\r" expect -ex "10.0.1.10000-2" { send "touch $builddir\r" expect \\$ } in specified directory there file name 10.0.1.10000-24 . expect command expect -ex "10.0.1.10000-2" matching file 10.0.1.10000-24 , getting passed. i have tried expect -exact "10.0.1.10000-2" , expect "10.0.1.10000-2" , both commands getting passed. i want match exact string( 10.0.1.10000-2 ) passing. there can many ways. assume file 1 listed @ last in directory follows, /var/root # ls -lrt total 4 -rw-r--r-- 1 root root 242 nov 12 10:08 hello.c lrwxrwxrwx 1 root root 9 nov 12 10:08 dos -> /root/dos ...

c# - Trying to work out why my app crashes with run out of memory exception -

Image
i have desktop app. purpose connect 4 digital cameras , display onto form using vlc bindings. other purpose discern motion , upload server. i throttle fps 10 frames per second. never goes beyond fps. if run on pc quad core 8gb ram works ok. if run on friends pc duo core 4gb ram can run days before memory exception causes app bomb out. the timing of when crashes unpredictable. have error handlers everywhere (being paranoid :) ) error ever reported out of memory exception occur randomly. interpreted cause f exception somewhere else. i using emgu c#. i installed dotmemory - jetbrain , have taken random snapshots. nothing ever seems untowward. no memory spikes or objects not being disposed. this screenshot of this: now, 'green area' has dominated. steps should take now? thanks anyone! additional: this starts. yet, code/functionality same...

reporting services - Is CheckBox checked or not in RDL reportview -

Image
i've 2 checkboxs(actually 2 rectangles) in report page. object database, returns boolean value. if returns yes, want checked "yes" or not, other 1 must checked. i'm newbie in rdl reporting project. how can add expression this? right click rectangle , go insert | indicator when indicator window opens, select middle option in "symbols" section (has cross, exclamation , tick) press ok, right click indicator , click indicator properties go value , states. in list of states @ bottom, delete x , exclamation. set tick have start = 1 , end = 1 in value field enter =iif(fields!<<fieldname>>.value = true, 1, 0) (obviously replace <> name of field in states measurement unit field, select "numeric" here's snap of how it: what evaluate iif statement and, if field true, return 1. indicator see 1 , place green tick in rectangle. hope helps, drop comment here if struggle.

String Format Specifier in C# for with fixed length of strings in Gridview -

Image
i trying display string fixed length (say 10 digits of strings) in grid view item template while binding, not find format specifiers string itself. i can format specifiers ( numbers{0:n} , floats & decimal (d) , currency{0:c} , , date{1,8:yyyy} , percentage {0,3:p1} , temperature: {0:f} , exponential , hexadecimal ... but not string itself ) i tried links: click here didn't work me. my grid view have template field (item template) <asp:templatefield headertext="notes"> <itemtemplate> <asp:label id="label_note" runat="server" text='<%# string.format("{0}", eval("defect_note").tostring()) %>' ></asp:label> </itemtemplate> </asp:templatefield> i need display ' notes column ' in below grid max 10 digits. if exeeds should not show (can show on tooltip) if less 10 can show content. i wanted display notes columns printf(" %8s...

cross platform - Callback/Delegate to Java for handling some C# event -

i using c# assembly in java application via jna & unmanaged exports. need implement callback/delegate in order inform java event in c# .dll has occured. how can accomplished? or there reading reference suggest? what tried far: using java native access (jna) & unmanaged exports robert giesecke in order call c# methods java. - works fine far. i pass callback-method as void* pointer java c# . call method somehow. for verification added code use: defining jna interface (incl. callback) in java: import com.sun.jna.callback; import com.sun.jna.library; public interface ijna extends library { interface sig_t extends callback { boolean invoke(int signal); } string testcallback(sig_t callbackparam); } unsage c# method exported unmanaged code, receiving "any pointer" (void*) parameter should adress of method [dllexport] public unsafe static string testcallback(void* somemethod) { //use somemethod here ...

node.js - migrating authentication in nodemailer with gmail -

i enable server send out emails using noreply.mywebsitename@gmail.com used generate pass app in gmail security settings, has changed , looks google devs have mixed every kind of auth in blender. what required (as of november 2014) send email nodemailer? here old working auth code: var gmail = nodemailer.createtransport("smtp",{debug:true,service:'gmail','auth':{'user':'noreply.auto.email.robot@gmail.com','pass':'iuygfiugwiufgweiu'}}); i lost not sure if doing oauth or xoauth 2 , confused see lots of new things refresh keys authorization code cilent id / secret api key server key consent screen product name what have generated far api project project id , have api key use api keys identify project when not need access user data the api key confusing because had click on 'create server key' , allow server ip called api key instead (what ever). have also enabled apis gma...

c++ - Usage of auto for global constants -

suppose have this: namespace { const unsigned my_uint = 100u; const float my_float = 0.f; const char* my_string = "hello world"; } do expected behavior using auto these? presume improvement, i'm not sure in practice. namespace { auto my_uint = 100u; auto my_float = 0.f; auto my_string = "hello world"; } are 2 code examples semantically same? these const automatically? if not, should specify auto const ? auto 's deduction rules equivalent by-value template argument deduction. creating object value entails stripping references , top-level cv-qualifiers initializer. 2 examples not equivalent. in particular, primitive 100u of type unsigned int , that's deduced as. likewise, 0.f of type float . adding const makes sense if variable itself not modified. if want make constants in program, using constexpr might better.

Android 5.0: how to change recent apps title color? -

Image
i'm using appcompat , theme extending theme.appcompat.light.darkactionbar . when in android 5 lollipop , press recent apps button, app appears dark title instead of white title in actionbar. when i'm inside app looks fine. what can change title color in recent apps view? edit : figured out if use darker colorprimary , title becomes white. still need way force white title original color. you can't force text color, auto generated (either white/black) based on colorprimary color.

javascript - What is the correct order of loading AngularJS files? -

i encountered problem angularjs webpages don't load sometimes. when happens, code in corresponding controller not run. happens rarely. suspect due loading order of angularjs files. perhaps there other possible causes. please alert me if can think of any. below code showing loading order of html page; <script src="lib/angular/angular.min.js"></script> <script src="lib/angular/angular-route.min.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers.js"></script> <script src="js/filters.js"></script> <script src="js/directives.js"></script> <script src="vendor/dialogs.min.js" type="text/javascript"></script> <script src="lib/angular/angular-sanitize.min.js"></script...

android - implementing a list within my fragment -

so started hands dirty android development , after wrestling , failing working thought id run guys , gals. hope of has solved similar problem i have fragment layout display textview , list of items follow: historical data item1 20 item2 30 item3 40 this includes button on action bar implemented allow user add more items , number. having trouble achieving above behavior. able implement adapter ended displaying follow: historical data item1 20 historical data item2 30 historical data item3 40 any ideas how above? myfragment.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview style="?android:listseparatortextviewstyle" android:textsize="18sp...

get response from spring oauth2 token request as xml -

i implementing oauth2 rest server using spring 4 , spring oauth2. response can either xml or json specifeid client request header. getting issues oauth2 when ever try access token supports json (application/json), not supporting xml(application/xml). am getting error as: http status 406 - type status report message description resource identified request capable of generating responses characteristics not acceptable according request "accept" headers. apache tomcat/7.0.54 my security configuration follows: @configuration @enablewebsecurity(debug = true) @componentscan(basepackages = { "org.bluez.logiczweb.config.security.handler" }) public class securityconfiguration extends websecurityconfigureradapter { private final static string applicationname = "crm"; @configuration @enableresourceserver protected static class resourceserverconfiguration extends resourceserverconfigureradapter { @autowired ...

haskell - GHC could not execute htfpp -

i getting error ghc: not execute: htfpp when try load file {-# options_ghc -f -pgmf htfpp #-} in header. have installed htf (v0.12) how can solve (on linux , on windows) thank you! community-wiki answer posterity: htfpp not in path. find how alter path, 1 looks in ~/.cabal folder config file , finds cabal installs binaries default. directory needs added path, or installed binary needs moved there directory is in path. ghc can run -pgmf flag.

How to move a DIV based on a mouse click in Javascript? -

i have testbed 4 simple content divs change position of when each of them clicked. link below. http://christopherwynne.com/tattoo/ i have performed similar functions other sites in past, , feel missing fundamental. still new java, , have had issues getting work initially. any issue appreciated. your jquery click handlers not quite right. you're using: $("gallerywrap") but should $("#gallerywrap") to select element id. once you've selected them can add class attach left margin of 205 want. likewise have few other places you're not selecting elements properly. if try selecting elements these commands in console you'll see jquery can't find them. an example: command $('div') selects <div> s on page, whereas if wrote $('#div') select elements id="div" .

hierarchical data - Mysql Query to select multi-level children from table -

this mysql table layout of user table. possible get count of children under each person. to select person @ least 2 children under him. +----+------+--------+ | id | name | parent | +----+------+--------+ | 1 | | 0 | +----+------+--------+ | 2 | b | 0 | +----+------+--------+ | 3 | c | 1 | +----+------+--------+ | 4 | d | 3 | +----+------+--------+ | 5 | e | 2 | +----+------+--------+ the expected answer are 1. +----+------+----------+ | id | name | children | +----+------+----------+ | 1 | | 2(c, d) | +----+------+----------+ | 2 | b | 1(e) | +----+------+----------+ | 3 | c | 1(d) | +----+------+----------+ | 4 | d | 0 | +----+------+----------+ | 5 | e | 0 | +----+------+----------+ 2. +----+------+----------+ | id | name | children | +----+------+----------+ | 1 | | 2(c, d) | +----+------+----------+ recursive queries not supported mysql, problem quite ...

mysql - php access error using credentials that work in another script -

i'm ios developer trying update bit 'o php work mysqli_* stuff instead of deprecated mysql_* stuff. i know next nothing php/mysql, , i'm stuck. i'm using script found @ http://www.w3schools.com/php/php_mysql_select.asp , changes reflect field names etc when call following browser access error (connection failed: access denied user 'whoisit7'@'localhost' (using password: yes)). server name, password , username etc i'm using work existing script in browser not new one. can point me @ i'm getting wrong? <?php $servername = "localhost"; $username = "whoisit7_ios"; $password = "blahblahblah"; $dbname = "whoisit7_scathing"; // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } $sql = "select name, latitude, longitude location status = 1"; $result = my...

AngularJS : all directives from controller if array has changed -

an area have points. default disabled draggable. if user click on edit link point 43 position should draggable. point still have disable state , watch function not executing.. jsfiddle html <div ng-app="myapp" ng-controller="maincontroller"> <a href="#" ng-click="edit(43)">make point 43 draggable</a> <ul class="court"> <li ng-repeat="point in courtpoints" droppable data-location="{{point.location}}"> {{point.location}} <div class="draggable-point draggable-point-location" location-point-draggable ng-show="point.marker==true"></div> </li> </ul> </div> js var myapp = angular.module('myapp', []); myapp.directive('locationpointdraggable', function () { return { restrict: 'a'...

asp.net mvc - How to bind value from database to Dropdown List in MVC 4 -

this model public class insertorder { public int customerid { get; set; } public string customername { get; set; } } public list<insertorder> getcustomerid() { list<insertorder> customerlist = new list<insertorder>(); sqlconnection connection = new sqlconnection(configurationmanager.connectionstrings["myconnection"].connectionstring); sqldatareader datareader; { using (sqlcommand command = new sqlcommand("select customerid,firstname customers", connection)) { connection.open(); datareader = command.executereader(); while (datareader.read()) { insertorder id = new insertorder(); id.customerid = convert.toint32(datareader["customerid"]); id.customername = datareader["firstname"].tostring(); customerlist.add(id); } datareader.close(); ...

multithreading - Is SCP Ant task thread safe -

we have multiple servers need files out to. we're using ant based build system , save time we're trying deploy them each of boxes in separate thread: <for param="file" parallel="true" threadcount="10"> ... <sequential> <sshexec host="${host}" trust="true" username="${username}" password="${password}" command="do setup;"/> <scp todir="${username}:${password}@${host}:~/" trust="true" > <fileset dir="${releasedir}/.."> <include name="releases/**" /> </fileset> </scp> ... </sequential> </for> this snippet fails intermittently boxes works fine using single thread - leads me believe doesn't handle multithreading well. 1.has come across similar issue? 2.can recommend alternatives?

javascript - Google Translate isn't Hidden -

having opted "automatic" version of google translate widget, expected not see "select language" dropdown if browser same language site. however, see time no matter set html lang attribute or set browsers preferred language to. have noticed doesn't seem make difference whether meta "google-translate-customization" tag there or not, widget in view. i'd site translated if users browser isn't set english. any advice appreciated. code used:- in head:- <meta name="google-translate-customization" content="6bb255d109276506-b73cb06230e6b6c0-gbb2acb9bc95b4a11-12"></meta> in body:- <div id="google_translate_element"></div> <script> function googletranslateelementinit() { new google.translate.translateelement({pagelanguage: 'en', layout: google.translate.translateelement.floatposition.top_left}, 'google_translate_element'...

python - Reverse mapping on nested dictionary -

i have dictionary { 'eth1': { 'r2': bw1, 'r3': bw3 }, 'eth2': { 'r2': bw2, 'r3': bw4 } } and turn dictionary { 'r2': { 'eth1': bw1, 'eth2': bw2, }, 'r3': { 'eth1': bw3, 'eth2': bw4 } } is there neat way of doing that? you can use nested-loop go through dictionary, , construct new 1 updating key/values using setdefault . d={ 'eth1': { 'r2': 'bw1', 'r3': 'bw3' }, 'eth2': { 'r2': 'bw2', 'r3': 'bw4' } } result = {} k, v in d.iteritems(): a,b in v.iteritems(): result.setdefault(a, {}).update({k:b}) print result output: {'r2': {'eth2': 'bw2', 'eth1': ...

google maps - List nearest Longitude/Latitude from array -

i have 2 variables define static longitude , latitude. want able define multi dimensional array holds following: id, longitude , latitude. what want achieve - static longitude feed through loop of arrays , if finds within radius of 50 miles (or whatever), selects potential ones , lists them. i not sure formula or algorithm can use check radius , bring nearest values. please note: not using databases in example. so far: $mainlong = 57.7394571; $mainlat = -4.386997; $main = array( array("loc_1",57.7394571,-4.686997), array("loc_2",51.5286416,-0.1015987), array("loc_3",51.2715146,-0.3953564), array("loc_4",50.837418,-0.1061897) ); foreach ( $main $key => $value ) { if($value[1] == $mainlong){ print_r($value); } } haversine formula help. here sample algorithm. can try out. %% begin calculation r = 6371; % earth's radius in km delta_...

c++ - Why can't I end my input by this? -

Image
i want terminate input input, eof(^z in windows), , here program: #include<stdio.h> #include<conio.h> int main(void) { int c; while ((c = getchar()) != eof) { if (c == '\t') { putchar('\\'); putchar('t'); } else if (c == '\b') { putchar('\\'); putchar('b'); } else if (c == '\\') { putchar('\\'); putchar('\\'); } else if (c == '\r') { puts("\\n"); // putchar('\n'); } else{ putchar(c); } } return 0; } and here input , output: asking: why can't terminate input first ^z? otherwise stated, why have type enter make new line in order terminate input input @ ^z? see discussions in: read() stdin doesn't ignore newline ho...

c# - Create a simple button in Unity3D 2D mode -

i'm working on 2d game in unity 3d, v4.5. have added sprites hierarchy. how add button hierarchy? have designated button.png should display button. should turn sprite button? what tried far: someone noted gui.button, but 1: has done in code - assume can add buttons game ui inside unity gui (??) 2: using gui.button script, class adds border around specified texture. haven't figured out how use existing image , size (width/height) of sprite texture sent gui.button. you can useongui button , disappear rectangle have make new guistyle private guistyle teststyle = new guistyle(); public texture2d texture1; void ongui(){ if( gui.button( new rect (0, 0, 100, 100) , texture1 ,teststyle) ) { //dosomething if clicked on } } if dont want can raycasting selfand give buttons tags below void update () { if (input.getmousebuttondown (0)) { ray ray = camera.main.screenpointtoray(input.mous...

javascript - Function to update total cost not working -

i building simple shopping cart using simplecart.js. i have been able display items, add them basket , checkout. however, trying add dropdown allow users select country determine shipping cost. plunker: http://plnkr.co/edit/ab6jlxmycppwr4isuqez?p=preview i have added following select , how can connect simplecart.js? believe update() needs called: js: <select class="item_shipping" id="addshipping"> <option value="4.99">england £4.99</option> <option value="5.99">ireland £5.99</option> <option value="7.99">europe £7.99</option> </select> see http://plnkr.co/edit/cizshalarqmbrqnb6hgf?p=preview first need way shipping cost: simplecart({ shippingcustom: function(){ var ddl = document.getelementbyid("addshipping"); return ddl.options[ddl.selectedindex].value; } }); and when drop down changes, update values: document.getelemen...

Perl - append text to cell if new cell has text -

my data this: 20110627 alpha beta gamma 217722 1425 1767 0.654504367955466 0.811585416264778 -0.157081048309312 i using writeexcel module (i.e. tab2xls program) of john mcnamara : use warnings; use strict; use spreadsheet::writeexcel; use scalar::util qw(looks_like_number); use spreadsheet::parseexcel; use spreadsheet::parseexcel::saveparser; use spreadsheet::parseexcel::workbook; if (($#argv < 1) || ($#argv > 2)) { die("usage: tab2xls tabfile.txt newfile.xls\n"); }; open (tabfile, $argv[0]) or die "$argv[0]: $!"; $workbook = spreadsheet::writeexcel->new($argv[1]); $worksheet = $workbook->add_worksheet(); $row = 0; while (<tabfile>) { chomp; # split on single space @fld = split('\s', $_); $col = 0; foreach $token (@fld) { if (looks_like_number($token)) { $worksheet->write($row, $col, $token); $col++; } else { $worksheet->write($row, $col, $to...

javascript - Finding terrain info using Google Earth API -

i'm looking extract terrain information google (maps or earth). using google maps elevation service. i'm reading linestrings kml document , making several calls getelevationalongpath. save output elevations along input lat , long (converted utm) point cloud, mesh point cloud , can import rhino. however concerned going fall foul of elevationservice usage limits "google maps api work" license. if @ other tools have achieved (such "lands design" rhino or "terrain plugin" 3ds max, appear using google earth plugin/api rather google maps. can please , point me in direction of right calls google earth api - extract terrain data. for else looking @ - google earth geglobe.getgroundaltitude(double lat, double lon) looks it's answer - though general advice looks "stick maps elevation service"

python - Searching basic comments in C++ by regex -

i'm writing python program searching comments in c++ program using regex. wrote following code: import re regex = re.compile(r'(\/\/(.*?))\n|(\/\*(.|\n)*\*\/)') comments = [] text = "" while true: try: x= raw_input() text = text + "\n"+ x except eoferror: break z = regex.finditer(text) match in z: print match.group(1) this code should detect comment of type //i'm comment , /*blah blah blah blah blah*/ i'm getting following output: // program in c++ none //use cout which i'm not expecting. thought match.group(1) should capture first parenthesis of (\/\*(.|\n)*\*\/) , not. c++ program i'm testing is: // program in c++ #include <iostream> /** love c++ awesome **/ using namespace std; int main () { cout << "hello world"; //use cout return 0; } you didn't use order since inline comment can include inside multiline comment. need begin pattern mul...

jquery - Remove duplicate objects in an array of object in JavaScript -

object1 = {connectorindex: 1, nodeid: 6, connectors: object} object2 = {connectorindex: 1, nodeid: 6, connectors: object} connector: {name: "aland", key: "", description: "departure country (country goods sent)"} there 2 objects in same array. connector objects identical. how remove duplicate elements , final array 1 object? var array = [object 1, object 2]; object 2 duplicate remove array. this if looking exact matches: function remove_duplicates(objectsarray) { var usedobjects = {}; (var i=objectsarray.length - 1;i>=0;i--) { var = json.stringify(objectsarray[i]); if (usedobjects[so]) { objectsarray.splice(i, 1); } else { usedobjects[so] = true; } } return objectsarray; } var objectsarray = [{a:'foo',b:'bar'}, {a:'foo',b:'bar'}]; var clean = remove_duplicates(objectsarray);

php - Injecting services into Entities: check if an image file exists -

i'm using php , doctrine orm , here's deal: have product table image field , want event check if image exists in assets cloud storage (amazon s3). if file exists if not return file-path of placeholder image. method perform check existence of image resides in s3service class. is there way me tie event entity such every time call like: $product = $this->em->getrepository('entities\product') ->findby(['id' => $productid]); echo $product->getimagepath(); i able default image if file non existent (by calling method in s3service of course). know shouldn't inject services entities cleaner rest of code if can abstract part entity. that's why i'm looking @ event driven kind of solution. have looked @ life cycle events of doctrine entities don't know if there's event executes entity retrieved. question is: event should looking @ or should looking @ solution altogether? it's not practice injectin...

ios - Resize UICollectionView after view transition -

i've built detail view in interface builder showing informations , photos object. because lenght of informations , number of photos vary, nested in uiscrollview . photos shown in uicollectionview , need show contained photos, disabled scrolling , dynamically changing height constraint of uicollectionview function (called when finishing rendering cells): func resizephotoscollectionview() { photoscollectionviewheightconstraint.constant = photoscollectionview.collectionviewlayout.collectionviewcontentsize() } it works great until uicollectionview needs resize (typically device orientation change). trying use uiviewcontrollertransitioncoordinator in function: override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { coordinator.animatealongsidetransition(nil) { context in self.resizephotoscollectionview() } super.viewwilltransitiontosize(size, withtransitioncoordinator: co...

focus on first feld using jquery validator -

Image
i using jquery validator validate form fields. below fields: focus @ third field i.e email 2 want focus on first field i.e fax. error message displayed between text both , other static text due alignment shifts here , there. best possible way display messages. in few scenarios error message displayed not focus due user not aware of error. code: var validator = $("#enrollmentform").validate({ errorelement: 'label', errorplacement: function(error, element) { error.insertafter(element); element.focus(); }, }); can provide solution? your own code causing problem you're describing. errorplacement: function (error, element) { error.insertafter(element); element.focus(); // <- line causing whole problem }, by using element.focus within errorplacement , you're telling focus on element being evaluated right when it's been evaluated. if mutiple elements invalid @ once, focus naturally left...

javascript - Where does (no domain) > extensions::name come from? -

on sources tab in devtools, pages have (no domain) folder various extensions inside of them. source seems indicate chrome extensions, can't find information them. example, page listed many extensions including extensions::unload_event, extensions::messaging, extensions::event, extensions::last_error, etc. what they? made them? chrome doing, or front-end developers responsible including? there documentation these particular extensions? these extensions::[name] files part of extension platform's implementation, , bundled chrome. extension developers don't need know existence. you can view source @ https://chromium.googlesource.com/chromium/src/+/master/extensions/renderer/resources .

proof - Prove So (0 < m) -> (n ** m = S n) -

i'm trying make idris function of type (j : nat) -> {auto p : (j < n)} -> fin n convert nat fin n . z case work (and output fz ), i'm trying prove proof of 0 < n sufficient able make fz : fin n . can't work out how this. i'm open making different function, long can convert nat values fin n values (where exist). goal have other function can convert nat mod n value, that, example, 15 : nat mapped 3 : mod 4 . mod type has single constructor, mkmod : fin n -> mod n . after learning lt : nat -> nat -> type , took different approach. started declaration: nattofin : (j : nat) -> {auto p : j `lt` n} -> fin n nattofin {n} j {p} = ?nattofin_rhs_1 . case-splitting on n , on p in n = z case resulted in: nattofin : (j : nat) -> {auto p : j `lt` n} -> fin n nattofin {n = (s k)} j {p = p} = ?nattofin_rhs_2 , proof asking for. there, case-split on j , filled 0 case, leaving: nattofin : (j : nat) -> {auto p : j `l...