Posts

Showing posts from June, 2011

stored procedures - Sql Server: Compare multiple dates, remove duplicates and add new column all in one -

what best solution following problem? so have stored procedure inserts temporary table information so: id | name | date | age | bin |status| description | warn1 ----------------------------------------------------------------------- 01 | abcd |2016-01-01 15:00:00| 17 | 0 | 40 | done | 0 01 | abcd |2016-01-01 11:00:00| 17 | 0 | 30 | waiting | 0 01 | abcd |2016-01-01 10:00:00| 17 | 0 | 10 | started | 0 02 | zxcv |2016-01-02 11:30:00| 18 | 0 | 35 | error | 0 02 | zxcv |2016-01-02 11:00:00| 18 | 0 | 30 | waiting | 0 02 | zxcv |2016-01-02 10:00:00| 18 | 0 | 10 | started | 0 03 | yttr |2016-01-02 12:30:00| 16 | 0 | 30 | waiting | 0 03 | yttr |2016-01-02 10:00:00| 16 | 0 | 10 | no desc | 0 04 | huuo |2016-01-02 11:30:00| 17 | 0 | 40 | done | 0 04 | huuo |2016-01-02 09:00:00| 17 | 0 | 30 | waiting

jquery - Two animation to fadeIn at the same time? -

i'm trying 2 animations fadein onto screen @ same time. impossible because 1 animation waiting until 'typed.js effect' finish before counting animation-delay. so in order have 2 animationsfadein @ same time have set different animation-delay. the jsfiddle shows problem: https://jsfiddle.net/harrydry/p4ev1nj2/13/ merely setting animation delay 2 different types come on in sync not solution. whole animation far more complex , won't work. have used css animations plugin shown here: <span class="line1 animated fadein">jim jarmusch</span> if jquery fadein() option, can use common class selector , animation simultaneous: html <div style="display:none" class="test"> test 1 </div> <div style="display:none" class="test"> test 2 </div> <div style="display:none" class="test"> test 3 </div> <div style="display:none" c

html - SVG changes color when rotated in Safari 10 -

Image
i've run weird problem shows in safari 10. have playing cards, svg images, rotated using transform:rotate(xdeg) . the card i'm using has red block pattern. when it's not rotated, or rotated @ right angles, i.e. 90, 180, 270, looks normal. but, other angle , background pattern turns blue! got report 1 of users , have never seen weird. other browsers work normally, safari 9 normally. i'm guessing weird bug in safari 10, ideas how work around it? i've created minimal repro at: https://jsfiddle.net/2zv4garu/1/ weird bug indeed. performing transformation in wrapping g element svg transform not resolve issue. however, performing 3d rotation instead of of 2d one, i.e. inlinecard.style.transform = 'rotate3d(0,0,1,' + e.currenttarget.value + 'deg)'; resolve issue, can see here. https://jsfiddle.net/qe00s1mg/

Information about rabbitmq delayed-exchange -

we using rabbitmq-server_3.5.7 , corresponding delayed-message-exchange plugin until using direct-exchanges , controlling delays on message-producers on client applications (and keeping track of number of messages in queue). we have started using delay-exchanges successfully, wondering how check number of messages delayed (this is, awaiting routed queue). does rabbit provide way of knowing this? there other method access information? thanks! sorry, should've searched better before posting. basically, looking through closed issues in repo: https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/issues/3 it's stated functionality available in release 3.7.0 (at time of writing it's still 3.6.6)

sidewaffle - TemplateBuilder _preprocess - generate new guid as value -

i using sidewaffle templatebuilder create multi project solution. in 1 of projects have guid change during _preprocess generating new guid in place. like: add key="base(new guid(&quot;{34bc9328-fc0d-4960-83b2-612b13de1514}&quot;))" value="base(new guid(&quot;mynewguidhere&quot;))"/> how can done? of course, after posting question, new angles , testing. found answer. easier 1 think. there mechanisms doing built in template generation. more info on them check here template parameters. but in short can use $guid1$ $guid10$ getting 10 unique guid's. in _preprocess file: <add key="base(new guid(&quot;{34bc9328-fc0d-4960-83b2-612b13de1514}&quot;))" value="base(new guid(&quot;$guid1$&quot;))"/> it simple :)

javascript: what is this: (function(args){})(moreArgs){}); -

this question has answer here: what (function() { } )() construct in javascript? 18 answers am still , again , forever trying come grips javascript. @ other scripts inspiration , learning. know is: (function(args){})(moreargs){}); it's skeleton of jquery. can explain me how works? thanks! here more of skeleton: ( function( global, factory ) { } )( typeof window !== "undefined" ? window : this, function( window, noglobal ) { return jquery; } ); tldr; (func)(params); executes function inplace out having assign function separate variable. lets break code down it's smaller elements. firstly whole code self executing function. consider have anonymous function. var add = function (a,b) { return + b; }; we can call function like add(1,2); however can wrap our function in () , call in same way. (add)(1,2); both res

sql server - SQL - generate a list of cheapest options -

the schema little bit strange. have 2 tables: create table [dbo].[events]( [id] [int] not null, [name] [varchar](50) not null, [venueid] [int] null ) create table [dbo].[venues]( [id] [int] not null, [name] [nvarchar](50) not null, [averageprice] [int] not null ) and data this: insert venues (id, name, averageprice) values (1, 'arena1', 100), (1, 'arena2', 200), (1, 'arena3', 50), (2, 'club1', 50), (2, 'club2', 150) insert events (id, name, venueid) values (1, 'consertatarena1', 1), (2, 'consertatarena2', 1), (3, 'consertatarena3', 1), (2, 'conference', null) i need produce: 'consertatarena3', 'conference' . cheapest venue option events same venueid plus events null venueid. tables quite massive, few million rows. efficient select it? the database sql server 2012 standard. it looks have problem in way store data. in example &#

java - Sending data by serial port -

i'm trying send data serial port in device have , connected device serial pc. in pc i'm trying receive data through terminal application. device using j2me, code i'm using connect com port given below. public boolean connect() { if (bconnected) { return true; } else { try { stringbuffer strcom = new stringbuffer(80); strcom.append("comm:" + strcomport + ";blocking=on;autocts=off;autorts=off;stopbits="); //autocts=on;autorts=on; strcom.append(stopbits); strcom.append(";bitsperchar="); strcom.append(bitsperchar); //strcom.append(";parity="); //strcom.append(parity); strcom.append(";baudrate="); strcom.append(baudrate); commconn = (commconnection) connector.open(strcom.tostring()); writestatustofile( "commconnec

Scala - Get files based on name pattern -

i filter files based on patterns : - team_*.txt (e.g.: team_orlando.txt); - name.*.city.txt (e.g.: name.robert.california.txt); or name (the pattern * . * - has spaces because broken text). all filters come database table , dynamic. i'm trying avoid use commands cp or mv . possible filter files using patterns above ? here i've tried got regex error: def getfiles(dir:file, filter:string) = { (dir.isdirectory, dir.exists) match { case (true, true) => dir.listfiles.filter(f => f.getname.matches(filter)) case _ => array[file]() } }

security - How to extract fingerprints from biometric device? -

i wanted know can scanned image of finger prints? once user scan image biometric machine, able image of it? device dermalog , asking testing. fingerprint readers not work (paper) scanners, never store (or scan) image of finger. comes out bunch of bytes of data, compared stored values clever algorithms allow deviation (because scanned bytes never same, finger off, , it's analogue @ level anyway). so short answer no, can't image, that's never stored, or acquired, device.

php - Modify request before bundle -

i have symfony website many pages /page1 /page2 /page3/something/ etc... in pages, have many time word "pretty" i page /dummy/page1 returns same /page1 replace occurence of word "pretty" word "beautiful". same thing other pages : /dummy/url should same /url replacing "pretty" "beautiful" i have found easy way : in app.php , added @ beginning : if (strpos($_server['request_uri'], '/dummy') !== false) { $_server['request_uri'] = str_replace('/dummy','',$_server['request_uri']); ob_start(replacehtml($final_html)) } and simply public function replacehtml($html) { return str_replace('pretty','beautiful',$html); } and work perfectly. now need make bundle able share it. the problem bundles seems instanciated late, meaning after request has been processed changing $_server['request_uri'] doesn't @ point, , /dummy/url request

integration testing - SAPUI5 OPA5 How to trigger a select event -

below typical action test if sap.m.select contains item name xyz , select it. success: function(oselect) { var oitems = oselect.getitems(); $.each(oitems, function(i,v) { if(oitems[i].gettext() === "testitemnameiliketoselect") { otestopa5testitem = oitems[i]; } }); if(otestopa5testitem !== null) { oselect.setselectedkey(otestopa5testitem.getkey()); otestopa5testitem.$().trigger("tap"); } }, when start test run correctly select proper item list , sets visibly in browser, not trigger attached event behind (e.g. change="onlistitemchanged"). application works fine, don't find way create working test it. thanks in advance opa5 has 'action' interface , 2 default implementations e.g. 'entertext' , 'press'. recommended usage define action block on waitfor() options this: when.waitfor({ id: "mybutton", actions: new press() });

php - CakePHP, How to populate a select box from a sql database -

in controller have field $employee = tableregistry::get('employees'); $allnames = $employee->find()->extract('employee_name'); $this->set('name', $allnames); works fine, retrieves data want in template i have code belongs form im trying submit , save database. <?= $this->form->select('employee', $name, ['escape' => false])?> which works fine except when submit comes saying wasnt able save database. i suspect because if change input id type in saves fine. doing wrong? you should $query = $articles->find('list'); http://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html chapter :finding key/value pairs¶

ios - UICollectionViewCell embedded in UITableViewCell changes scroll position when re-appears -

Image
i have tableview cells having horizontal collection view. have multiple cells same style. let's tableview cells @ indices 0 & 5 have same style (i using same uitableviewcell subclass in dequeuereusablecellwithidentifier). user scrolls tableviewcell @ index 5. scrolls horizontal collection view leftwards(let's red-1 , yellow-2 cells hidden, cyan-3 leftmost). user scrolls tableviewcell @ index 0. although it's different uitableviewcell instance, collection view offset set same cell @ index 5. in short, when i'm re-using tableview cells, content offset of scroll view inside uitableviewcell being set previous re-used cell. is there someway can disable behaviour, each cell maintains it's own offset regardless of scroll activity on cell. you can set cell confirm uiscrollviewdelegate , implement scrollviewdidenddecelerating method save scroll offset , use offset restore original offset when dequeue cell in cellforrowatindexpath of uitableview.

javascript - JS NaN after array[index] -

i started programming js again , having trouble. can't afford lose more time, thought maybe more eyes can find problem. it's gonna simple calculator web browsers. same code other buttons(0-9) sum = 0; var actual = new array(0); var counter = 0; function button1pressed(){ if(counter==0){ actual.push(1); counter=1; sum=actual[0]; }else{ actual.push(1); //insert new number counter=counter*10; for(i = actual.length; > 0; i--){ sum = sum + actual[i] * counter; } } document.getelementbyid("display").innerhtml = sum; sum = 0; } what did wrong? start loop actual.length-1 , because every array starts 0, last element actual.length-1 not actual.length .

In PowerPoint 2007 how do I write a code to invoke an existing macro by pressing a set of keys? -

i wrote macro in powerpoint 2007 having trouble assigning macro keyboard shortcut, how do it? you need add-in one: http://officeone.mvps.org/ppsctmgr/ppsctmgr_macros.html but if add-in isn't suitable , you're developing on pc version of powerpoint try using windows apis add timers , key trapping. these apis started: public declare function getasynckeystate lib "user32" (byval vkey long) integer public declare function getkeystate lib "user32" (byval nvirtkey long) integer public declare function settimer lib "user32" _ (byval hwnd long, _ byval nidevent long, _ byval uelapse long, _ byval lptimerfunc long) long public declare function killtimer lib "user32" _ (byval hwnd long, _ byval nidevent long) long

c++11 - Makefile and putting objects and executable to subdirectory -

i have been trying read around this, can't figure out how fix it. i have following makefile , put objects in libs/ subfolder , executable build/ folder...but no matter have tried, can't figure out how tell make such ruling. cxx = g++ flags = -mwindows sources = $(wildcard *.cpp) objects = $(sources:.cpp=.o) target = engine all: $(sources) $(target) $(target): $(objects) $(cxx) $(objects) -o $@ .cpp.o: $(cxx) -std=c++11 -c $< -o $@

Using Android API23 Call and Call.Details Class to get Disconnect Cause for Calls -

all trying reason why call disconnected. have searched unable find solution api level under 23. in api 23 have; https://developer.android.com/reference/android/telecom/call.html https://developer.android.com/reference/android/telecom/call.details.html call.details.getdisconnectcause() returns disconnect cause object unable understand how can use use call class or details class or broadcasts use these objects(if any). so there broadcast have handle returns call states in extras? or there way use class?

javascript - I want to return false in clicked time is greater than 200 ms -

i developing youtube player. if user long presses on video, option panel appears. want stop it. possible write query if click time greater 200ms, return false? using code not working. $('video').on('click', function () { if(longpress) { // if detect hold, stop onclick function return false; }; }); $('video').on('mousedown', function () { longpress = false; //longpress false presstimer = window.settimeout(function(){ // code here longpress = true; //if run hold function, longpress true },300) }); $('video').on('mouseup', function () { cleartimeout(presstimer); //clear time on mouseup }); as @maxx said, declare variables first var longpress = false; var presstimer; $('video').on('click', function() { console.log(longpress) if (longpress) { // if detect hold, stop onclick function return false; }; }); $('video').on('mousedown',

Android Custom drawable paint stroke different width -

Image
i have issue when drawing path on drawable , setting drawable background or src of view/imageview. seems happening path on side arrow bit thicker straight lines... testing view has fixed dimensions. has ideas on how can fix it? here drawable code. public class arrowdrawable extends drawable { public static final string tag = arrowdrawable.class.getsimplename(); private paint outlinepaint; private paint fillpaint; int padding = 40; int arrowposition = 50; int arrowheight = 60; int strokewidth = 10; path path = new path(); public enum direction { right, left; } direction direction = direction.right; public arrowdrawable() { init(); } private void init() { outlinepaint = new paint(); outlinepaint.setstyle(paint.style.stroke); // set stoke outlinepaint.setstrokejoin(paint.join.bevel); // set join round want outlinepaint.setstrokecap(paint.cap.round);

How to simply install apk in device in Android Studio -

my question when click on run button runs gradle command check change files , build class , dex create apk. if know there no change in files still gradle runs check. as have many libraries attached app module reduce run time. if knows install apk in device android studio without running gradle. note : want install on device connected system not emulator,etc. note : want install android studio not using other software. one more solution using terminal install apk on devices. once have built apk using file>build apk , shows path in new apk present. just go path on terminal below generated apk path on system - $cd /android_app_code/updatedcodeforcheckout/projects/ims/source/apps/android/flowtalk/app/build/outputs/apk and type - $ adb install -r app-debug.apk this command installs build on connected device. , every time when there no change in code, run install command on terminal. it's super fast see.

To parse XML using XPATH -

i have below xml. want retrieve item id , batters when topping id = '5002' . kindly help. <?xml version="1.0" encoding="utf-8"?> <items> <item id="0001" type="donut"> <name>cake</name> <ppu>0.55</ppu> <batters> <batter id="1001">regular</batter> <batter id="1002">chocolate</batter> <batter id="1003">blueberry</batter> <batter id="1003">devil's food</batter> </batters> <topping id="5001">none</topping> <topping id="5002">glazed</topping> <topping id="5005">sugar</topping> <topping id="5007">powdered sugar</topping> &l

angular - auth0: token data appeared in the url and event authenticated did not raise -

i trying login using auth0 angular2 app. code derived auth0 sample . working behavior bit weird. token data appended url: http://localhost:4200/#access_token=0zoq3u6ma2tahqnh&id_token=eyj0e...jqd&token_type=bearer event authenticated did not raise: @injectable() export class auth0service { // configure auth0 lock = new auth0lock('i21eajbbpfph...', 'xxx.au.auth0.com', {}); constructor() { // add callback lock `authenticated` event this.lock.on("authenticated", (authresult) => { // use token in authresult getprofile() , save localstorage this.lock.getprofile(authresult.idtoken, function(error, profile) { if (error) { // handle error return; } localstorage.setitem('id_token', authresult.idtoken); localstorage.setitem('profile', json.stringify(profile)); }); }); } ... any idea pls? locationstrategy , hashlocationstrat

indexing - Index maximum of duplicate maximum values in R -

i know which.max able tell me index of first occurrence of maximum value, want obtain maximum index value of indexes duplicate maximum values in given range. below data working with. #given data set dataset1 <- data.frame(index=1:6, value=c(.456,.92,.88,.92,.88,0.85)) dataset1 # index value 1 1 0.456 2 2 0.920 3 3 0.880 4 4 0.920 5 5 0.880 6 6 0.850 #-------------------------- #create filtered combinations n=nrow(dataset1) comb<-data.frame(t(combn(seq(1:(n)), 2))) library("plyr") library("dplyr") fcomb<-comb %>% filter(x2-x1>1) %>% select(x1,x2) fcomb.mat<-as.matrix(fcomb) #filtered combination set matrix colnames(fcomb.mat)[1:2] <- c("ind1","ind2") #-------------------------- #finding maximum value original dataset in range between "ind1" & "ind2" fun <- function(x,y) max(dataset1$value[(.x <- x:y)[-c(1, length(.x))]]) max.val = as.matrix(mapply(fun,

php - Amazon s3 batch upload -

i have been trying batch upload using s3 client execute() method. keeps throwing exception: message: argument 1 passed aws\awsclient::execute() must implement interface aws\commandinterface, array given, called in.... even after following example code doc. check example maybe doing wrong: $bucket = 'mybucket'; $commands = []; $s3 = new aws\s3\s3client([ 'version' => 'latest', 'region' => 'us-west-1', ]); $commands[] = $s3->getcommand('putobject', [ 'bucket' => $bucket, 'key' => 'key1.gif', 'body' => 'path_to_file_1', ]); $commands[] = $s3->getcommand('putobject', [ 'bucket' => $bucket, 'key' => 'key2.gif', 'body' => 'path_to_file_2', ]); $s3->execute($commands); thanks in advance! just solved myself. instead of calling $s3->execute() , pas

sql - How to select all possible values of columns from all tables? -

select pom.table_name, pom.column_name all_tab_columns pom pom.column_name like'%status%' i want see possible values in columns on list(in 1 row if possible). how can modify select it? i want soemthing this table_name | column_name |values -----------| ----------- | ------- car | color | red,green you can use below query requirement. fetched distinct column values table. can used table having limited number of distinct values have used listagg function. select pom.table_name, pom.column_name, xmltype(dbms_xmlgen.getxml('select listagg(column_name,'','') within group (order column_name) val (select distinct '|| pom.column_name ||' column_name '||pom.owner||'.'||pom.table_name||')') ).extract('/rowset/row/val/text()').getstringval() val all_tab_columns pom pom.column_name like'%statu

c# - Linq Expression Get Predicated Items From Last With a Function -

are there linq expression exists gives predicated list end of source list . i.e: "abc1zxc".tochararray().somemagiclinq(p=>char.isletter(p)); should give " zxc " you use approach: var lastletters = "abc1zxc".reverse().takewhile(char.isletter).reverse(); string lastlettersstring = new string(lastletters.toarray()); not efficient way working , readable. if need single (optimized) method use this: public static ienumerable<tsource> getlastpart<tsource>(this ienumerable<tsource> source, func<tsource, bool> predicate) { var buffer = source ilist<tsource> ?? source.tolist(); var reverselist = new list<tsource>(); (int = buffer.count - 1; >= 0; i--) { if (!predicate(buffer[i])) break; reverselist.add(buffer[i]); } (int = reverselist.count - 1; >= 0; i--) { yield return reverselist[i]; } } then it's more concise: string lastletters

About Android Emulator Error -

output: hax enabled hax ram_size 0x60000000 hax working , emulator runs in fast virt mode. emulator: listening console connections on port: 5554 emulator: serial number of emulator (for adb): emulator-5554 emulator: warning: ./android/metrics/metrics_reporter_toolbar.cpp:189: can't upload usage metrics: error i opened android emulator appear error. why? application can run unaffected. that's not system problem, google usage statistics; you can : open android studio->preferences, go appearance & behavior->system settings->usage statistics, , uncheck "send usage statistics google". matrics_reporter disabled during emulator starting. restart emulator, problem gone;

"Already tz-aware" error when reading h5 file using pandas, python 3 (but not 2) -

i have h5 store named weather.h5 . default python environment 3.5.2. when try read store typeerror: tz-aware, use tz_convert convert . i've tried both pd.read_hdf('weather.h5','weather_history') , pd.io.pytables.hdfstore('weather.h5')['weather_history] , error no matter what. i can open h5 in python 2.7 environment. bug in python 3 / pandas? i have same issue. i'm using anaconda python: 3.4.5 , 2.7.3. both using pandas 0.18.1. here reproducible example: generate.py (to executed python2): import pandas pd pandas import hdfstore index = pd.datetimeindex(['2017-06-20 06:00:06.984630-05:00', '2017-06-20 06:03:01.042616-05:00'], dtype='datetime64[ns, cst6cdt]', freq=none) p1 = [0, 1] p2 = [0, 2] # saving of these dataframes cause issues df1 = pd.dataframe({"p1":p1, "p2":p2}, index=index) df2 = pd.dataframe({"p1":p1, "p2":p2, "i":index}) store = hdfstore(&q

bash - Running logstash forwarder as a daemon service -

i found article explain how make start stop service ; http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html and wrote : #!/bin/bash # # chkconfig: 3 80 20 # description: boop-logstash-forwarder # # function functions library . /etc/init.d/functions # start service logstash_forwarder="/logiciels/logstash-forwarder/logstash-forwarder" lf_conf="/appli/projects/boop-logstash-forwarder/logstash-forwarder.conf" service_name="boop-logstash-forwarder" start() { initlog -c "echo -n starting $service_name: " $logstash_forwarder -config=$lf_conf & ### create lock file ### touch /var/lock/subsys/$service_name success $"$service_name startup" echo } # restart service stop() { initlog -c "echo -n stopping $service_name: " killproc $service_name ### now, delete lock file ### rm -f /var/lock/subsys/$service_name

deep learning - how to prepare gray image data for caffe input -

i have read lots of references prepare image data caffe input have not been able solve problem yet!! i have put .jpg image files in 2 seperate folders: folder train: containing 100,000 image files of size 227*227 folder val: containing 9,000 image files of size 227*227 i put them in folder in /home/user/dl then made 2 text files listing names of images in train , val folders as: . . p127.jpg 2 p943.jpg 2 p8765.jpg 1 . . and put these 2 files in /home/user/caffe-master/data/dl . i made dl_create.sh located in /home/user/caffe-master/examples/dl bellow: set -e example=examples/dl data=data/dl tools=build/tools train_data_root=/home/user/dl/train/ val_data_root=/home/user/dl/val/ resize=true if $resize; resize_height=227 resize_width=227 else resize_height=0 resize_width=0 fi if [ ! -d "$train_data_root" ]; echo "error: train_data_root not path directory: $train_data_root" echo "set train_data_root variable in create_dl.

regex - Regexp to start matching after a specific character -

this question has answer here: regex match text after given character excluding character itself 1 answer in somexstring it's easy find after , including 'x'. what need find after, excluding 'x'. ... match string in it. try using lookbehind assertion. (?<=x)\w+ if regex engine doesn't support lookbehind assertions, can work around using capturing groups. x(\w+) in above regex, string accessed referencing \1 . note: uses \w capture word characters. if literally mean want capture everything use dot, . , metacharacter instead... (?<=x).+$

c++ - How to safely offset bits without undefined behaviour? -

i'm writting function convert bitset int/uint value considering bitset have fewer bits target type. here function wrote: template <typename t,size_t count> static t convertbitsettonumber( const std::bitset<count>& bitset ) { t result; #define targetsize (sizeof( t )*char_bit) if ( targetsize > count ) { // if bitset 0xf00, converting 0x0f00 lose sign information (0xf00 negative, while 0x0f00 positive) // because sign bit on left. // then, need add 0 (4bits) on right , convert 0xf000, later, divide 16 (2^4) preserve sign , value size_t missingbits = targetsize - count; std::bitset<targetsize> extended; extended.reset(); // set 0 ( size_t = 0; != count; ++i ) { if ( < count ) extended[i+missingbits] = bitset[i]; } result = static_cast<t>( extended.to_ullong() ); result = result >> missingbits;

C# Selenium No new Window Handles When Opening A New Tab In Chrome and Firefox -

selenium chrome , firefox, coding in c#, not handle switching on new tab opening during automation test. don't think focuses on new tab open because when run program completely, receive error: "out of range" exception , "index out of range. must non-negative , less size of collection." i've tried using: driver.switchto().window(driver.windowhandles.last()); and driver.switchto().window(driver.windowhandles[1]); driver.switchto().window(driver.windowhandles[0]).close(); // close first tab system.threading.thread.sleep(5000); //wait 5 seconds in case driver.switchto().window(driver.windowhandles[1]); //makes sure i'm on correct tab but there no luck. if don't close first tab, receive error: "nosuchelementexception:unable locate element:{method...}" assume correct because focus still on first tab. appreciated. thank you. once you've closed tab[0] , old tab[1] becomes new tab[0] , should switching tab[0] . seleniu

html - Using font awesome icons inside tooltip -

i want use font-awesome icon in tooltip. <i class="fa fa-info-circle text-success" title="<i class='fa fa-hourglass'></i>: level-1. <i class="fa fa-hourglass-half"> : level-2. <i class='fa fa-hourglass'></i> : level-3."></i> the code incorrect gives idea of want do. appreciated. in advance. it might you .tooltip { position: relative; display: inline-block; border-bottom: 1px dotted black; } .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: black; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; /* position tooltip */ position: absolute; z-index: 1; } .tooltip:hover .tooltiptext { visibility: visible; } <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/> <di

go - Goroutines blocked by for loop? -

i have following code implements worker queue: package main import ( "fmt" "net/http" "io" "time" ) var ( linkqueue chan link scraperqueue chan chan link ) func cycledirectory(page int) { linkqueue <- link{name: "asd"} } type link struct { name string } func (s scraper) start() { fmt.println("started") go func() { { s.scraperqueue <- s.link select { case link := <-s.link: fmt.println(fmt.sprintf("%v", s.id) + ": received " + link.name) case <-s.quitchan: fmt.println("closed") return } } }() } func (s scraper) stop() { go func() { s.quitchan <- true }() } type scraper struct { id int link chan link scraperqueue chan chan link quitchan chan bool } func initscraper(id int, sc

SQL Server - add a column to the result of a stored procedure -

i have stored procedure in sql server executes this exec @return_value = sp @value1 = 'a', @value2 = 'b' and result is: value3 | value 4 | value 5 i need add columns value1 , value2 result (yes, same use execute stored procedure). there no chance change stored procedure, because project. possible do? i work oracle, don't know if maybe it's simple, or maybe can't done. thanks answers! store proc results temp table. https://stackoverflow.com/a/1228165/6167855 then like select @value1, @value2, t.* #temptable t

docker - Keeping environment variables on window split -

Image
i use virtualenv , docker in current development set. both tools work setting environment variables in shell. i able keep environment variables once split current window. i believe common case in many developers workflow , know if there default solution within tmux or if custom configuration when splitting pane needed. assuming you're using docker-machine , add eval statement shell rc file, ~/.bashrc . assumes machine name of default . eval "$(docker-machine env default)" from documentation can see set correct env variables: https://docs.docker.com/machine/get-started/#/create-a-machine as noted in output of docker-machine create command, need tell docker talk new machine. can docker-machine env command. $ docker-machine env default export docker_tls_verify="1" export docker_host="tcp://172.16.62.130:2376" export docker_cert_path="/users/<yourusername>/.docker/machine/machines/default" export doc

mysql returning more than one row -

i have mysql query needs return supplier id supplier table searching supplier name keeps returning multiple values. create definer=`root`@`%` procedure `sp_insert_sup_order`( supname varchar(50), dat date, total decimal(10,2) ) begin insert supplier_order ( supplier_id, supdate, total, sup_name ) values ( (select supplier_id supplier supplier_id.supname = supname ), dat, total, supname ); thats query. appreciated (select supplier_id supplier supplier_id.supname = supname ) this should this: (select supplier_id supplier supplier.supname = supname ), and why store supplier name , id in order ? should not done, image have change name of supplier, have update orders. supplier id should stored in order table!

c++ - Will two overlapping mutexes lead to deadlock? -

consider following member functions. lead deadlock? void foo::insert(item_ptr item) { lock_guard<mutex> lock(mu_); items_.insert(item); } void foo::insert(vector<item_ptr> items) { lock_guard<mutex> lock(mu_); // lead // deadlock? for(auto item:items) insert(item); } if mu_ std::mutex , have problem. std::mutex not support recursive locks , cannot locked twice same thread. see: http://en.cppreference.com/w/cpp/thread/mutex if mu_ std::recursive_mutex , have no problem. thread can lock recursive mutex if has locked. see http://en.cppreference.com/w/cpp/thread/recursive_mutex

make without makefile after cmake -

i try use c++ language bindings ev3dev lego brick: https://github.com/ddemidov/ev3dev-lang-cpp the instruction follows: mkdir build cd build cmake .. -dev3dev_platform=ev3 make i running windows , have cmake , mingw available. after running cmake creates files in build directory. however: there no makefile picked of make. wondering how iam supposed compile these bindings on windows, cmake generates msvc solution default. check .sln file in build directory. the instructions linked assuming unix-ish platform, default create makefiles. if want makefiles on windows, add -g "unix makefiles" cmake line. if want use msvc compiler but work on command line , option -g "nmake makefiles" , , calling nmake after that. make sure delete build directory before trying build new generator target. cmake can touchy that. check cmake --help list of available options. (especially generator targets platform-specific.)

postgresql - Using BETWEEN operator with timestamp values in Postgres -

recently i've been informed stackoverflow user using between operator values of data type timestamp without time zone should not used. below quote. between means >= , <= , shall not used ranges contain timestamps. when asked explanation of thesis or link postgres documentation states i've got answer saying why such simple thing need site documentation. sure can find many anyway if google (at least detailed posts on various forums demonstrating case) well googled. , found nothing advise against using operator timestamp values. in fact this answer on uses them , this mailing group post . i informed these years doing wrong. case? as far know postgres max precision timestamp 1 microsecond - correct me if i'm wrong. aren't below statements equivalent ? sample_date between x , y::timestamp - interval '1 microsecond' and sample_date >= x , sample_date < y edit : sample consideration of difference. i'm aware of fact

Node.js connect to MongoDB throw an error :MongoError: failed to connect to server [127.0.0.1:27017] on first connect -

Image
i trying use node.js connect mongodb on windows system. however, throw me error: c:\users\mazic\dropbox\information system\cs602 server site web development\mongodb_practice\node_modules\mongodb\lib\mongo_client.js:225 throw err ^ mongoerror: failed connect server [127.0.0.1:27017] on first connect @ null.<anonymous> (c:\users\mazic\dropbox\information system\cs602 server site web development\mongodb_practice\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:313:35) @ emitone (events.js:77:13) @ emit (events.js:169:7) @ null.<anonymous> (c:\users\mazic\dropbox\information system\cs602 server site web development\mongodb_practice\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:260:12) @ g (events.js:260:16) @ emittwo (events.js:87:13) @ emit (events.js:172:7) @ socket.<anonymous> (c:\users\mazic\dropbox\information system\cs602 server site web development\mongodb_pract

pip - Automatic installation of dependencies when publishing Python 3 project on pypi -

i want publish project using pypi. ideally installation be: sudo pip3 install projectname the problem is, get: could not find downloads satisfy requirement itsdangerous (from projectname) insecure , unverifiable files ignored (use --allow-unverified itsdangerous allow). if firstly install external requirements (itsdangerous , wspy in case), installation completes. here requirements.txt: requests>=2.10.0 six>=1.10.0 itsdangerous==0.24 ws4py==0.3.4 and here install_requires setup.py: install_requires=[ "requests", "six", "ws4py", "itsdangerous" ] one thing think may cause issue requirements.txt not included in manifest.in, not sure how include it. i using https://testpypi.python.org/pypi/ . basically, have same issue described in question . not understand accepted answer. to install update ~/.config/pip/pip.conf and/or /etc/pip.conf . append test repository --find-links opt

javascript - What is the best way to identify those rows with data have changed in the Ag-Grid? -

i'm using ag-grid angular1; and own custom cell renderer. "version": "5.4.0" i want have array have rows in cells been changed, used in service update of data. i've tryed cellvaluechanged event, doesn't work custom editor; i've been searching in row models, didn't find on 3 models way of changed data; e.g. event listener but: "addeventlistener(eventtype: string, listener: function): add event listener. rowselected event supported." what best way that?

C programming - do while loop help (code almost done) -

i have created code writes out sum of numbers. every time loops sum of last run saved , added in sum of new run. how make have new loop? sorry bad english, , thx in advance int main() { int number = 0; int sum = 0; printf("welcome to\"sum evens\"!"); { printf("\ninput number: "); scanf(" %d", &number); if (number == 0) { printf("goodbye, have nice day!\n"); break; } printf("\nsum:"); if (number % 2 != 0) { number -= 1; } (int = 0; <= number; += 2) { printf(" %d ", i); if (i != number) { printf("+"); } sum += i; } printf("= %d\n", sum); } while (number != 0); system("pause"); return 0; } watch these

java - Creating a Hashtable - Equals method -

i'm studying course in data structures & algorithms, , have got assignment our teacher create hashtable chaining collision resolution technique. for each entry in hash table our teacher wants have equals method: @override public boolean equals(object obj) { entry keytocompare = new entry(obj, null); return key.equals(keytocompare.key); } what difference when writing compared if compare keys regular .equals? here complete class: public class entry<t> { private object key; private object value; public entry(t key, t value){ this.key = key; this.value = value; } public boolean equals(object obj){ //what think should work return key.equals(obj); } }

asp.net - C# Repeater displaying single listing 12 times -

i have repeater i'm using display sidebar nav type system on page. loads data db display of links. should showing single listing in case, shows same listing total of 13 times. my code: private void load_locations() //loads list of locations. { var query = q in currentcontext.loc join w in currentcontext.int on q.key equals w.l_key select new { location = q.location }; rpt_locations.datasource = query; rpt_locations.databind(); } ^to pull data database, works use same snippet other things. <div class="side_menu" style="margin-left: auto; margin-right: auto; text-align: center"> <asp:repeater id="rpt_locations" runat="server" onitemcommand="rpt_locations_itemcommand"> <headertemplate> <table> </headertemplate>

html5 - Pause video playing within <embed> Jquery -

i can find answer independent video tag , not 1 embed in html5 embed tag. this problem: using ajax file i'm getting array of different type of files sources (mp4, pdf,xls,doc,etc) in order populate webpage. after retrieving json array, use following line of code populate: $("#modal-body").append('<div class="embed-responsive" style="padding-bottom:80%"><embed src="'+ $path +'" width="800px" height="500px" style="text-align:center;" /></div>'); now, everytime click on file expanded modal window. in case of video, when modal window appears,it automatically starts play. wish when user closes modal window video pause or stop. however, when triggering jquery .click() event closing modal window, nothing happens. $("#modalbtn").click(function(){ $("#modal-window").toggleclass("invisible");// hide modal window $("video").e

list - R: Applying function to DataFrame -

i have following code: library(ecdat) data(fair) fair[1:5,] x1 = function(x){ mu = mean(x) l1 = list(s1=table(x),std=sd(x)) return(list(l1,mu)) } mylist <- as.list(fair$occupation, fair$education) x1(mylist) what wanted x1 outputs result items selected in mylist. however, in mean.default(x) : argument not numeric or logical: returning na . you need use lapply if passing list function output<-lapply(mylist,fun=x1) this process function x1 each element in mylist , return list of results output.

postgresql - Doublets detection and scoring using ElasticSearch -

i'm trying study feasibility of content doublets detection microservice backed elasticsearch we have plsql procedure calculating levenshtein distance of user input (title + message) against previous entries in plsql, procedure return each entry percentage of ressemblance is possible give elasticsearch title + message + user_id, loops against entries calculate score each 1 or need write plugin such purpose ?

python - Django Template Tags Creating Spaces -

i working on django site live @ this site . getting unwanted spaces in output caused unwanted whitespace in html. for instance, "01-1737 , civilian review authority , inappropriate language, sustained," has spaces before of commas. i have found other posts similar problems, no solution has worked me. tried {% spaceless %} tag, didn't work. thing did work me putting of template tags in loop on single line, i'd find more readable solution this. here code django template: {% extends 'police_archive/base.html' %} {% block content %} <h2> {{officer.first_name}} {{officer.last_name}}, badge #{{officer.badge}} </h2> <p><strong>department:</strong> {{officer.department}}</p> <h2>complaints</h2> <ul> {% details in details_list %} <li> {% if details.incident.case_number %} <a href='/police_archive/complaint/{{detail