Posts

Showing posts from April, 2010

for loop - Writing data from one dataframe to a new column of another in R -

Image
this question has answer here: how join (merge) data frames (inner, outer, left, right)? 12 answers i have 2 data frames in r. data , frame monthly sales per department in store, looks this: while averages , frame average sales on months per department, looks this: what i'd add column data containing average sales (column 3 of averages ) each department. whereas have avg column zeroes, i'd contain overall average sales whatever department listed in row. code have now: for(j in 1:nrow(avgs)){ for(i in 1:nrow(data)){ if(identical(data[i,4], averages[j,1])){ gd[i,10] <- avgs[j,3] } } } after running loop, avg column in data still zeroes, makes me think if(identical(data[i,4], averages[j,1])) evaluating false ... why be? how can troubleshoot issue / there better way this? are looking merge function? merge(x = data, y =

java - Searching Phone number in Android Code -

i trying implement functionality in android app user keys in numbers, want incrementally search numbers in phone book (the generic phone book search) , display result. for this, using uri.withappendedpath(contactscontract.commondatakinds.phone.content_filter_uri, uri.encode(anumber)); this seems work of cases , handling search ' ' etc. there 2 issues not able resolve : it not ignore country code. so e.g. if have number : +9199776xx123 when search string +9199, result comes up. while if search string 9977, not come up. it not search between. when search string 776, result not come up. so behavior of content_filter_uri of phone not clear me. p.s. : have tried phonelookup reason, not throw result. belief might not capable searching partial numbers. phone.content_filter_uri built speed, it's not perfect, you've noticed. can use plain phone.content_uri process kind of request want. e.g.: string partialphone = "9977"; strin

c# - Code not executing before thread sleep? -

i this: clear(); coinrefundcomplete.visible = true; state = 0; system.threading.thread.sleep(4000); clear(); greeting.visible = true; rate.visible = true; refundticket.visible = true; currenttime.visible = true; i expect coinrefundcomplete text (it label) appear 4 seconds, cleared method defined clear(), , other stuff happens. instead after clear form first clear(), form blank 4 seconds, finishes properly. although putting gui thread sleep never desirable allowing gui thread refresh control state before going sleep show changes want. call control.update or control.refresh after making visible , before going sleep gui thread able show changes before goes sleep. clear(); coinrefundcomplete.visible = true; label1.update(); state = 0; system.threading.thread.sleep(4000); clear(); you should carefull while using thread.sleep , in case gui thread , gui irresponsive time sleep. knowing reason why want block thread bring other better suggestion. edit you can u

amazon web services - Composer autoload.php AWS 500 error -

hey trying deploy website aws , getting error (500 (internal server error)) when reaches require line in php, supposed include composer's vendor file, autoload.php. weird thing is, works fine on local instance (and group member's local instances) . ideas? aws setting sort of permissions? tried including other php files outside of vendor folder , seem work fine. i test echoing before , after each line figure out how far compiles. gets "above require" thanks! update: after suggestion below, getting error read now, below. warning: require(/var/app/current/vendor/composer/../facebook/graph-sdk/src/facebook/polyfills.php): failed open stream: no such file or directory in /var/app/current/vendor/composer/autoload_real.php on line 66 fatal error: require(): failed opening required /var/app/current/vendor/composer/../facebook/graph-sdk/src/facebook/polyfills.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/app/curren

node.js - Where to pass username and password passport local strategy -

i using express js in application. need authentication have selected passport want use it's local strategy have placed code in app.js file code is: //application dependencies var express = require('express'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var expressvalidator = require("express-validator"); var mysql = require('mysql'); var multer = require('multer'); var passport = require('passport'); var localstrategy = require('passport-local').strategy; //express js routes var routes = require('./routes/index'); var users = require('./routes/users/users'); var app = express(); //passport configuration passport.use(new localstrategy( function(username, password, done) { user.findone({ username: username }, function(err, user) { if (err) { return don

build.gradle - If else in Gradle scripts -

i have strange behavior in gradle , cannot find way out of it. in gradle.properties file, using checking condition: //gradle.properties if ( "${system.property['database_dir']}".compareto('swdb') == 0 ) { project_database_path=../database/swdb/include } else { project_database_path=../database/include/ } i created new task called printproperties , looks this. //build.gradle task printproperties { println "${system.properties['database_dir']}".compareto('swdb') == 0 println project_database_path } i following output when run printproperties task. $gradle printproperties -ddatabase_dir=swdb true ../database/include/ :printproperties up-to-date build successful total time: 1.07 secs it strange task prints true gradle.properties file not evaluate same condition correctly. me this? your code shall take place in init.gradle script. you can find documen

nginx https redirections Too Many Redirections error -

i have config: server { listen 80; server_name example.com; rewrite ^/(.*) https://example.com/$1 permanent; } server { listen 443 ssl; root /var/www/laravel/public; index index.php index.html index.htm; server_name for1ever.com; ssl on; ssl_certificate /home/carta/for1ever.com.chained.crt; ssl_certificate_key /home/carta/for1ever.com.key; im trying redirect -> https://example.com (non-www) recieve this: err_too_many_redirects

xcode - Play Music or Video during phone call like instagram in iOS -

i working on app in ios. have requirement play music on phone , record video app. have accomplished avaudiosession . this code used in appdelegate's didfinishlaunching options : avaudiosession *session1 = [avaudiosession sharedinstance]; [session1 setcategory:avaudiosessioncategoryplayandrecord withoptions:avaudiosessioncategoryoptionmixwithothers|avaudiosessioncategoryoptiondefaulttospeaker|avaudiosessioncategoryoptionallowbluetooth error:nil]; [session1 setactive:yes error:nil]; [[uiapplication sharedapplication] beginreceivingremotecontrolevents]; but stuck trying play video or music during phone calls in instagram app works in iphone. issue when got call , on app , video playing before call, when return app, video player stuck.

python - import error OpenCV on Jupyter Notebook (but it works in Ipython on Terminal..) -

i'm having interesting error import cv2 in ipython on terminal cannnot import library on jupyter notebook. checked kernel i'm using same kernel (anaconda python2.7) would has idea how fix this? error: importerrortraceback (most recent call last) <ipython-input-2-52da0154cfe4> in <module>() ----> 1 import cv2 2 import numpy np importerror: no module named cv2 $import os $os.sys.path ['', '/users/kn/anaconda2/envs/python2/lib/python27.zip', '/users/kn/anaconda2/envs/python2/lib/python2.7', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-darwin', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-mac', '/users/kn/anaconda2/envs/python2/lib/python2.7/plat-mac/lib-scriptpackages', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-tk', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-old', '/users/kn/anaconda2/envs/python2/lib/python2.7/lib-d

append new data at the end of json in php -

i trying append new data @ end of predefined json. want append new data element of existing json. mean data appended new element of json. $jsondata = array(); if (!empty($json_mainquot)) { $jsondata['mainquot'] = $json_mainquot; } if (!empty($json_quotation_hotel)) { $jsondata['quotation_hotel'] = $json_quotation_hotel; } $temparray[] = json_decode($state_current_arr[0]['user_date']); array_push($temparray, $jsondata); $jsondata_merged = json_encode($temparray); it [{ "id": "77", "agent_id": "30524", "raised_by": "c", "from_date": "2016-11-09", "to_date": "2016-11-10", "num_of_days": "1", "num_of_country": "1", "leadconsultant": { "user_id": "3045", "lead_id": "77" }, "leaddestination": [{

html - Footer not inheriting class from css but accepting another? -

i have basic footer setup in bootstrap framework custom test. html: <footer class="footer navbar-custom-footer navbar-fixed-bottom"> <div class="container"> <div class="row"> <div class="column"> rights reserved. </div> </div> </div> </footer> and css: .navbar-custom-footer { background-color:#7bafd4; color:#b7c0e0; border-radius:0; font-size: 1em; } .navbar-custom-footer .navbar-nav > li > { color:#121e4b; } .navbar-custom-footer .navbar-nav > .active > a, .navbar-nav > .active > a:hover, .navbar-nav > .active > a:focus { color: #121e4b; background-color:transparent; } .navbar-custom-footer .navbar-brand { color:#eeeeee; } this exact copy of header custom tags , apply css when using original following: .navbar-custom { background-color:#7bafd4; col

r - Filtering a data frame by values in a column -

this question has answer here: filtering data.frame 5 answers i working dataset learnbayes . want see actual data: install.packages('learnbayes') i trying filter out rows based on value in columns. example, if column value "water", want row. if column value "milk", don't want it. ultimately, trying filter out individuals who's drink column "water". the subset command not necessary. use data frame indexing studentdata[studentdata$drink == 'water',] read warning ?subset this convenience function intended use interactively. programming better use standard subsetting functions ‘[’, , in particular non-standard evaluation of argument ‘subset’ can have unanticipated consequences.

node.js - Single aggregation query for multiple groups -

my collection json [ { "_id" : 0, "finalamount":40, "payment":[ { "_id":0, "cash":20 }, { "_id":1, "card":20 } ] }, { "_id" : 1, "finalamount":80, "payment":[ { "_id":0, "cash":60 }, { "_id":1, "card":20 } ] }, { "_id" : 2, "finalamount":80, "payment":[ { "_id":0, "cash":80 } ] } ] i want have amount , cash , card group wise using aggregation framework. can help? please consider _id objectid demo purpose have given 0 , 1. using node js , mongodb , want expected output in 1 query follows:

objective c - iOS custom animation to replace a subview -

i have app viewcontroller contains headerview, headerview container should hold other views. views inside headerview views want replace @ runtime animation. want oldview (which old content of headerview) slide out left , newview slide in right. i've included code below , log. slide in animation of newview works, oldview slides (0,0) coordinates, instead of (-headerview.bounds.size.width, 0) coordinates. kind of animation impossible, or isn't uiview animatewithduration made kind of animations? lot already. the code: //put frame @ right side of out bounds (to slide in) [newview setframe:cgrectmake(newview.frame.origin.x + newview.frame.size.width, newview.frame.origin.y, newview.frame.size.width, newview.frame.size.height)]; nslog(@"oldview bounds before transition: %f - %f - %f - %f", oldview.frame.origin.x, oldview.frame.origin.y, oldview.frame.size.width, oldview.frame.size.height); [uiview animatewithduration:1.0 animations:^{ //put in correct position

javascript - Unable to update to Angular2 RC6 -

hi cant update angular rc6 its depedndencies "dependencies": { "@angular/common": "~2.1.1", "@angular/compiler": "~2.1.1", "@angular/core": "~2.1.1", "@angular/forms": "~2.1.1", "@angular/http": "~2.1.1", "@angular/platform-browser": "~2.1.1", "@angular/platform-browser-dynamic": "~2.1.1", "@angular/platform-server": "~2.1.1", "@angular/router": "~3.1.1", "@angular/upgrade": "~2.1.1", "angular-in-memory-web-api": "~0.1.13", "@msafi/angular2-text-mask": "^0.7.0", "angular2-clipboard": "0.2.12", "angular2-cookie": "^1.2.3", "angular2-google-maps": "git+https://git@github.com/rafalsobota/angular2-google-maps.git", "angular2-text-mask": "^0.20.2", "angu

ms access - SQL - Save record with listbox and textbox change -

i have list box - user clicks 1 of results in list box that's populated table. when click 1 of items in list box text boxes populate results in table on textbox have on change code of: docmd.runsql "update tbl_complaintscoded set [ticketnumber] = '" & text3 & "' id = " & list1.column(0) text3 shows ticket number text5 shows department its department user trying change before getting error of: data type mismatch in criteria expression thanks help just fun, rewrote put in little more elegant basic error handling , little more streamlined. option compare database 'added option explicit verify variables option explicit private sub button_click() 'error handling on error goto button_click_err_handler dim rs dao.recordset 'is ticketnumber column text data type? me.list1.column(0) should return variant value, assuming 'your ticketnumber column of number type name implies, think use: 'set r

r - ggplot2 caching or plotting in the background -

i'm working on r shiny app plots (with ggplot2 ) information different chromosomes, , there option show chromosomes together. have bad performance problem, 'all' view, looked caching solutions, didn't find helpful. thought put 2 tabs in app, first single chromosomes, , second together, run in background, , load while user still in first tab, when read tabsets found out this- notice outputs not visible not re-evaluated until become visible. so question is, there way bypass this? or there way cache plot when want plot thing left draw it, , skip construct, build, , render stages. (there chance don't understand plotting process, , it's not possible) one last thing, aware of (the faster) ggvis , ggobi , these not option.

unity3d - Unity 2D - HP bar -

Image
the value of hp bar drops when runner collides obstacle. of course, value of hp drop nomally, image of hp bar not change. why error? public class csrunner : monobehaviour { public vector2 jumpvelocity; public float _hp = 100f; public float _curhp; bool isjump; public image _hpvalue; bool collision_box; // use initialization void start() { _hpvalue = gameobject.find("hpbar").getcomponent<image>(); _curhp = _hp; } // update called once per frame void update() { _hpvalue.fillamount = _curhp / _hp; if (input.getkeydown(keycode.space) && isjump) { isjump = false; transform.getcomponent<rigidbody2d>().addforce(jumpvelocity/2, forcemode2d.impulse); } if ((input.getkeydown(keycode.space) || input.getmousebuttondown(0)) && collision_box) { isjump = true; transform.getcomponent<rigid

algorithm - Calculate the number of nodes on either side of an edge in a tree -

a tree here means acyclic undirected graph n nodes , n-1 edges. each edge in tree, calculate number of nodes on either side of it. if on removing edge, 2 trees having a , b number of nodes, want find values a , b edges in tree (ideally in o(n) time). intuitively feel multisource bfs starting "leaf" nodes yield answer, i'm not able translate code. for credit, provide algorithm works in general graph. run depth-first search (or breadth-first search if more) node. node called root node, , edges traversed in direction root node. for each node, calculate number of nodes in rooted subtree. when node visited first time, set number 1. when subtree of child visited, add size of subtree parent. after this, know number of nodes on 1 side of each edge. number on other side total minus number found. (the credit version of question involves finding bridges in graph on top of non-trivial part, , deserves asked separate question if interested.)

python - Size of pdf generated with reportLab -

i have problem generation of pdf. when generate pdf , after few minute when restart same script generate same pdf don't have same size between first pdf , second... this code : c = reportlab.pdfgen.canvas.canvas("test.pdf") c.showpage() c.save() the first pdf have : 1519 byte and second have 1531 byte whenever restart same script , whenever have differents value. why? how can resolve it?

javascript - Using CountUp in Vue -

i'll start saying i'm new vue. completed 1 project following tutorial , first 1 i've done on own far. i building simple page show score between 2 teams. score being pulled api , polling every 5 seconds , setting score variable each team score retrieved each time api. i'd animate count new score, , little lost how this. i found countup.js looks good, problem updating vue variable , not element , have no clue how this. it looks there implementation vue having never used npm don't know doing. here app.js file contains vue code: var vm = new vue({ el: '#livecounter', data: { teama: 0, teamb: 0 }, methods: { loaddata: function() { this.$http.get('https://dummyapi.com/getscore)').then(function (response) { this.teama = response.body.teama.summary.score; this.teamb = response.body.teamb.summary.score; console.log('polled');

python - python3 create/open file case sensitive Mac -

tried interneting , checking python3 documentation, can't seem fix following - i'm missing flag or something! i want create , edit files in local directory . using python case-sensitive file names: have following behaviour: ~$ python3 python 3.5.2 (v3.5.2:4def2a2901a5, jun 26 2016, 10:47:25) [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> f = open("file.txt", "w") >>> f.write("hello\n") 6 >>> f.close() >>> del f >>> f = open("file.txt", "w") >>> f.write("bye\n") 4 >>> f.close() >>> del f >>> quit() ~$ ls applications downloads movies public cloud file.txt music intel desktop jagex documents library documents library pictures ~$ cat file.txt b

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

android - How to store json array elements into one table in sqlite db -

Image
i want store data 1 table through 1 pojo class.so understanding can relate 2 seprate tables.but per requirement have save in 1 table. don't want save in 2 seprate tables.how achieve ? (i need logic here.. i'm not expecting code leve) edit part as can see, there no common parameter relate data in future seperate table { "createdate": 1339957800000, "modifydate": 1341197519000, "createdby": "aaa", "modifiedby": "ddd", "status": "a", "description": "ffff", "parentid": null, "sourceid": null, "source_field1": null, "source_field2": null, "source_field3": null, "source_field4": null, "source_field5": null, "parentkey": null, "parentvalue": null, "genericm

VBA Excel - deleting rows at specific intervals -

i new forum, bear me. i have csv-file need apply vba-modules in order information need. in short, have 3 macros following: create new row every 20th row take number cell above (column a) , fill blank space in new row number. sum numbers in column h 20 rows before new row total score. done subsequently long new rows appear (every 20th row). is possible these 3 macros in single macro? make easier hand down others may need use these macros. current code: ' step 1 sub insert20_v2() dim rng range set rng = range("h2") while rng.value <> "" rng.offset(20).resize(1).entirerow.insert set rng = rng.offset(21) wend end sub ' step 2 sub fillblanks() columns("a:a").select selection.specialcells(xlcelltypeblanks).select selection.formular1c1 = "=r[-1]c" end sub ' step 3 sub autosum() const sourcerange = "h" dim numrange range, formulacell range dim sumaddr

ios - how to upgrade existing framework which installed using carthage -

i have installed charts framework using carthage. need update framework swift 3 version. carthage/build/ios/charts.framework/charts compiled older version of swift language (2.0) previous files (3.0) architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) how upgrade framework? there new release swift 3. need update cartfile point version: github "danielgindi/charts" == 3.0.0 then re-run carthage update .

excel - get the each row data to another sheet in with specific cell for all the rows with header -

Image
i need help. question: have around 100(sometime 200 records) of records in 1 sheet. in sheet have report template how data looks after calculation. need solution of vba macros copy data each row in report sheet1. i have 2 calculation currently, if country code 111 should return else if coutry code 91 should update india need total amount product quantity , price. in report sheet need data header row each record , should loop until data ends.so have attached file here reference. once again thank help. thanks, joshi

android - GridView issue with large data while scrolling -

i having problem "gridview".if use 6 items not creating problem while scrolling increase no. of items behavior unpredictable. please check following video link better understanding problem: gridview issues video link i attaching codes here: activity_achievements.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="60dp" android:layout_alignparenttop="true" android:background="@color/green_color"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content"

java - Added a Document to New Root Element -

i have below document want add document under in tag. current document <order> </order> expecting document <newdoc> <order> </order> </newdoc> i have tried below code (without luck): ordernewdoc.appendchild(orderolddoc); any appreciated. a simple way of doing through dom follows /** * created rgovind on 11/10/2016. */ import java.io.bytearrayinputstream; import java.io.inputstream; import java.io.outputstreamwriter; import java.io.writer; import java.nio.charset.standardcharsets; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import javax.xml.transform.transformer; import javax.xml.transform.transformerfactory; import javax.xml.transform.dom.domsource; import javax.xml.transform.stream.streamresult; import org.w3c.dom.document; import org.w3c.dom.element; import org.w3c.dom.node; public class xmlrootadd { public static void main(string[] args) throws exception

active directory - Group Policy Object after change of organizational structur -

i have prepare structure-change in our company active directory(on windows server 2012 r2). new structure on idm. our old structure looks this: division 1 -subdivision 1.1 -subdivision 1.2 division 2 -subdivision 2.1 -subdivision 2.2 . . . berlin dresden each ou has users in linked gpo. ou sets environment variables, binds network drives , share correct printer. in ou berlin , dresden ceo of location secretary. new structure(that comes idm) looks this: dresden -division 1 --subdivision 1.1 --subdivision 1.2 . . . berlin -divison 2 --subdivision 2.1 --subdivision 2.2 . . . now question: how can prevent gpo, should affect ceo , secretary of location, inherits ous under it? , sorry english

search in a web using python 3.5 -

i want make code can input text in web; i.e. in web page http://www.dictionary.com/ word. code found following (i'm using python 3.5): import urllib.request import urllib.parse value= {'q', 'something'} value= urllib.parse.urlencode(value) value= value.encode('utf-8') f= urllib.request.request('http://www.dictionary.com/', value) g= urllib.request.urlopen(f) print(g.geturl()) however, print(g.geturl()) prints http://www.dictionary.com/ , same link had @ beginning. want search 'something' in search bar. geturl() returns url of page, need use read() function. print(g.read())

Specflow bypasses subsequent scenarios after a failure -

all scenarios supposed but, until now, had 1. now have second scenario, following problem arises. if scenario 1 fails assertion, subsequent scenarios skipped. see below skipped scenarios. setup: configfiletransformation (thread #0) scenario: shows telephone numbers on header in showcontactinformation (target: browserbrowserstack_win8_chrome_52) -> succeeded on thread #0 scenario: shows telephone numbers on contact sidebar box in showcontactinformation (target: browserbrowserstack_win8_chrome_52) -> failed on thread #0 [error] 2 assertions failed. restore: configfiletransformation (thread #0) scenario: shows telephone numbers on header in showcontactinformation (target: browserbrowserstack_win8_firefox_42) -> skipped on thread #-1 scenario: shows telephone numbers on contact sidebar box in showcontactinformation (target: browserbrowserstack_win8_firefox_42) -> skipped on thread #-1 result: 1 failed total: 4 succeeded: 1 i

PHP / Python Beanstalk sockets event Job -

i'm using phalcon php server side , send job beanstalk doc said. to execute jobs inside beanstalk have python script. script search if there existing jobs , execute them. moment execute script linux command line. then, want execute python script automatically when job created , execute task. thought sockets. it's possible catch beanstalk socket event when receives job , execute python script ? finally wrote python script tornado beanstalkt. here code. import tornado import beanstalkt def show(msg, value, cb): print(msg % value) cb() def stop(): client.close(ioloop.stop) def connect(s): print('connection established') reserve() def reserve(): client.reserve(callback=lambda s: show( "reserved job %s", s, lambda: delete(s["id"]))) def delete(job_id): client.delete(job_id, callback=lambda s: show( "deleted job id %d", job_id, reserve)) ioloop = tornado.ioloop.ioloop.instance() client = b

scala - Evaluate expression in intellij -

i want know if there way in intellij know type of val shortcut or button? for instance: val t = 3 if select t , shortcut, can know t ant integer? thanks you can select val or var , press ctrl + alt + e add code type of val. on exemple, get: val t: int = 3

c# - How to merge the search box in first row and first column to complete row i gridview? -

below code used adding search filter grid view. happens present code search box in first row , first column, want show search box complete row instead of showing in first column. how can this? jquery code search box- <script type="text/javascript"> $(function () { $('.search_textbox').each(function (i) { $(this).quicksearch("[id*=gridview1] tr:not(:has(th))", { 'testquery': function (query, txt, row) { return $(row).children(":eq(" + + ")").text().tolowercase().indexof(query[0].tolowercase()) != -1; } }); }); }); </script>

html - javascript toggle needs to stay -

hi guys need javascript, have toggle function text, waht can see on www.jasperscheper.nl want make text stay when double click on over mij , home. this code: var bannertext1 = document.getelementbyid('bannertext1'); var bannertext2 = document.getelementbyid('bannertext2'); var displayedbannertext = 1; function togglebannertext() { if(displayedbannertext == 1) { // switch bannertext 2 bannertext1.classname += ' hidebannertext'; displayedbannertext = 2; bannertext2.classname = 'welkom'; } else { bannertext2.classname += ' hidebannertext'; displayedbannertext = 1; bannertext1.classname = 'welkom'; } } <li class="knop" > <button class="button" href="#"onclick="togglebannertext()"> <h3>home</h3></button> </li> <li class="knop"> <button class="button" onclick=&qu

ibm midrange - How do i call an AS400 program from command prompt of windows? -

Image
i trying call program using command prompt using command "quote rcmd call pgm(lib/mypgm)" getting error : how perform action ? syntactically, command correct. error occurred while server trying call program. text message cee9901 is: message . . . . : application error. &1 unmonitored &2 @ statement &5, instruction &3. cause . . . . . : application ended abnormally because exception occurred , not handled. name of program unhandled exception sent &6 &8 &12. program stopped @ high-level language statement number(s) &11 @ time message sent. if more 1 statement number shown, program optimized ile program. optimization not allow single statement number determined. if *n shown value, means real value not available. recovery . . . : see low level

Sonarqube coverage with opencover and Nunit -

we using sonarqube 4.5.7 (sonarqube scanner msbuild 2.1) nunit , opencover. test execution successful , metrics correctly reported in dashboard. coverage section in sonar dashboard blank , coverage xml shows "module skippeddueto="missingpdb"" application module below configuration have used in jenkins "c:\program files (x86)\msbuild\14.0\bin\msbuild.exe" sample\app.sln /t:rebuild /p:configuration=debug "c:\program files (x86)\opencover\opencover.console.exe" -register:user -targetdir:"…\sample\app.tests\app.correction\bin\debug" -target:"c:\program files (x86)\nunit 2.6.4\bin\nunit-console.exe" -targetargs:" …\sample\app.tests\app.correction\bin\debug \app.dll /nologo /noshadow" -output:coverage.report.xml finally found solution problem. in case indeed problem quotes, wrapping complete targetargs, shown below fixed problem "-targetargs: …\sample\app.tests\app.correction\bin\debug \app.dll /nol

c# - Why label's value is changed? -

i know if viewstate disabled textbox, not losing data because implements ipostbackdatahandler interface. <asp:textbox id="textbox1" runat="server" enableviewstate="false"/> but question why happens label too? why label not losing it's data if viewstate disabled since label doesn't implements ipostbackdatahandler interface? <asp:label id="label1" runat="server" enableviewstate="false" viewstatemode="disabled"/> textbox definition: public class textbox : webcontrol, ipostbackdatahandler, label definition: public class label : webcontrol, itextcontrol my code: <form id="form1" runat="server"> <div> <asp:label id="label1" runat="server" enableviewstate="false" viewstatemode="disabled" text="before click"></asp:label> <asp:textbox id="textbox1" runat="server&qu

python find root/parent based on list of tuples -

suppose have list of tuples in store keys (strings): l=[ (a,b), (b,c), (c,d), (d,e), (e,f), (w,x), (w,t), (t,q), (q,r), (q,u), ] how can find relations (especially head) between tuples in list, eg: a<-b<-c<-d<-e<-f w<(-x,t-<q-<(r,u)) so know f grand grand grand grand child of a ? regards js. we'll have dictionary mapping names to node s, , build nodes trees. from collections import defaultdict class node: def __init__(self): children = [] def add_child(self, child): self.children.append(child) def ancestor_of(self, descendant): if self == descendant: return [self] child in children: c=child.ancestor_of(descendant) if c: return [self, *c] return none node_dict = defaultdict(node) fst, snd in l: #assuming , b strings d[fst].add_child(d[snd]) #query trees using ancestor_of

sql - TSQL - running total -

Image
i have script i'm trying work out running balance on set of transactions: so key fields here opening balance. balance of when report run. value same each "accountid" in query. the total value value of transaction has taken place. (no column name) row number resets after each new account finds in result set - row_number()over(partition accountid order postingdate) what doing in balance field want following. when row number = 1, use opening balance , add total value. can see doing fine. however, struggling achieve each subsequent row, how calculate balance on line below it. so in example above first row shows balance of 125.80. want 2nd row 226.98. balance + total value rows not have row number of 1. select balance = openingbalance + sum(totalvalue) on (partition accountid order postingdate rows between unbounded preceding , current row) t; the rows between limits sum ro

android - Service killed before starting loop -

i new in android development. service killed before starting loop.. started service activity mainactivity package com.example.ch_m_usman.sharedtasklist.services; import android.app.intentservice; import android.content.intent; import android.util.log; public class reminderservice extends intentservice { public reminderservice() { super("reminder service"); } @override protected void onhandleintent(intent intent) { log.e("check","") //loop not start. (int i=0;i<5;i++){ log.e("inside for",""); } } } //how use loop in intent service use below code: public class taskconfirm extends intentservice { private final ibinder mbinder = new localbinder(); public taskconfirm() { super("taskconfirm"); setintentredelivery(

java - Issue with visibility of columns in primefaces datatable after sorting -

Image
i have issue visibility of columns after applying sorting on of columns. i attaching screen-shots of gui: before hiding colmnns : after hiding first 2 columns : after applying sort on first column after hiding : as can see in images sorting datatable first column producing inconsistent results.below code of datatable: <composite:implementation> <p:datatable id="tbl" var="item" value="#{cc.attrs.searchandconsultsecuritiesentriesresultspanel.results}" selectionmode="single" selection="#{cc.attrs.searchandconsultsecuritiesentriesresultspanel.selecteditem}" rowkey="#{item.referenceinstruction}" paginatortemplate="{currentpagereport} {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}" currentpagereporttemplate="{startrecord}-{endrecord

c# - Windows 64bit address space -

i developing 64 bit application couple of dll's. coming win 32, default base address of loaded dll's 0x10.000.000 , moved, when conflicts arose. john robbins wintellect recommended set dll's unique addresses, memory space use same on different runs. he suggested in book on debugging .net 2.0 applications base addresses should guided first letter of dll's name. a-c 0x60.000.000 d-f 0x61.000.000 g-i 0x62.000.000 j-l 0x63.000.000 m-o 0x64.000.000 p-r 0x65.000.000 s-u 0x66.000.000 v-x 0x67.000.000 y-z 0x68.000.000 i thinking has changed 64 bit. (at least addresses). has found better solution? (so address 1 run on pc, can mapped mine? - or minidump made somewhere can loaded me.) since move 64 bit, guess you're targeting windows vista or higher, since xp 64 bit never popular (and extended support ended). with windows vista, address space randomization (aslr) introduced, increases security, because guessing memory locations became ha

python - How do i count the number of similar values in a column in dataframe? -

# name type 1 type 2 total hp attack defense 1 bulbasaur grass poison 318 45 49 65 2 ivysaur grass poison 405 60 62 80 3 venusaur grass poison 525 80 82 100 4 charmander fire nan 309 39 52 60 5 charmeleon fire nan 405 58 64 80 i have dataframe above. need calculate number of 'grass' type pokemons 'type 1'. how do that? iiuc need value_counts : df = df['type 1'].value_counts() print (df) grass 3 fire 2 name: type 1, dtype: int64 or groupby aggregating size : df = df.groupby(['type 1']).size() print (df) type 1 fire 2 grass 3 dtype: int64

sql server - Combining IIF statements in ssrs -

i'm trying combine following iif statements in ssrs , cannot seem code correct run. can help? =iif(isnothing(fields!description.value) , fields!callflag.value = "1" , "new record dial", fields!description.value, iif(isnothing(fields!description.value) , fields!callflag.value = "0" , "do not call", fields!description.value, iif(isnothing(fields!description.value) , isnothing(fields!callflag.value), "load reject", fields!description.value) the iif statement reads iif(boolean, true-value, false-value). in case mean: if callflag=1 "new record" else if callflag=2 then....... that lead to: =iif(isnothing(fields!description.value) , fields!callflag.value = "1" , "new record dial", iif(isnothing(fields!description.value) , fields!callflag.value = "0" , "do not call", iif(isnothing(fields!description.value) , isnothing(fields!callflag.value), "lo

cassandra - Codec not found for requested operation -

i using cassandra-driver-core-3.0.0-1 . in table having column frozen<list<udt type>> . now while perform select operation, (row.getlist("udttype",nov.class),) i getting below exception . codec not found requested operation: [frozen<keyspace.udt_type> <-> com.abc.nov] please let me know, if missing something. i using datastax.driver i know there bug in 3.0.0 version had use workaround in order register codecs udt. did implement codec udt @ all? try upgrade 3.1.0 if implemented codec. if not implement 1 following the guide .

select - Access 2010 return first 3 occurances of results -

i creating select query compares 2 tables fine. appear on second table many times on , want return first 3 per contract. below have far. select gcrmaster.contract_number, [20161107_emma].ccat, [20161107_emma].vertrag gcrmaster, 20161107_emma ((([20161107_emma].vertrag) in (select top 3 [20161107_emma].vertrag [20161107_emma] dupe gcrmaster.contract_number = dupe.vertrag order gcrmaster.contract_number desc, [20161107_emma].ccat))) order gcrmaster.contract_number, [20161107_emma].ccat;

Kotlin and generics, implementing abstract generic class with generic array -

i have following abstract class abstract class vec2t<t : number>(open var x: t, open var y: t) implemented data class vec2(override var x: float, override var y: float) : vec2t<float>(x, y) so far, works fine now, i'd similar matrices, @ moment abstract class abstract class mat2t<t : number>(open var value: array<out vec2t<t>>) that should implemented by class mat2(override var value: array<vec2>) : mat2t<float>(value) but compiler complains on array<vec2> : error:(8, 32) kotlin: type of 'value' doesn't match type of overridden var-property 'public open var value: array> defined in main.mat.mat2t' i told: i can't change type of var property when override (but not changing it, overriding subtype.. same thing?) mat2.value = object : vec2t<float>() { ... } not valid, must not case subclass of mat2t<float> how may overcome these problems? is there way have abs

Mongodb check if connection is ok via Laravel/PHP -

i'm using laravel 5.2 , mongodb 3.2. i want test if connection ok before app starts (i can't use db facade), in monolog configuration. if connection not ok, use logging in file. by recommendation, i'm testing mongoclient, mongo , mongodb\client, , using whatever enabled. i'm trying test mongo connect following: $mongoclient = new \mongodb\client('mongodb://localhost:27017'); $mongoclient->selectcollection('mydb', 'mycollection'); that's return: client { +manager: manager {#21} +uri: "mongodb://localhost:27017" +typemap: [ array => "mongodb\model\bsonarray", document => "mongodb\model\bsondocument", root => "mongodb\model\bsondocument" ] } finnaly, questions: exists way use db facade before app starts? how , right way test mongodb connection php? if has suggestion, thankful. according php document, the driver c

qt - Resize QDialog when RadioButton is Checked PyQt -

not many experience @ pyqt.. i have designed ui qt designer 2 radiobuttons. depending on radiobutton selected widgets visible , other not. i'm not trying resize automatically layout of dialog depending on how many widgets visible in ui. the question similar this one . here extract of code might helpful understand problem (i know piece of code, entire dialog pretty long): class mydialog(qdialog, form_class): .......... # connect radiobutton function reloads ui self.radiosingle.toggled.connect(self.refreshwidgets) ..... # dictionary widgets , values self.widgettype = { self.cmbmodelname: ['all'], self.cmbgridlayer: ['all'], self.cmbriverlayer: ['all'], self.linenewlayeredit: ['all'], self.linelayernumber: ['single'] } # function refresh ui correct widgets depending on radiobutton selected def refreshwidgets(self, idx): '