Posts

Showing posts from 2012

c# - What's the difference between Process[] and Process()[] -

i doing research pattern scanner came problem. the pattern scanner saw needed handler of process way i'm doing process[] p = process.getprocessesbyname("pname"); doesn't have p.handle , went msdn there says have. why mine doesn't? what difference between 2 lines of code? process p = process.getprocessesbyname("pname")[0]; process[] p = process.getprocessesbyname("pname"); this gets first process has name of "pname": process p = process.getprocessesbyname("pname")[0]; note cause "index out of bounds" exception if there aren't any. this gets list (or array, actually) of processes have name of "pname": process[] p = process.getprocessesbyname("pname"); note won't cause exception if there aren't any; it'll return empty array. with latter, can index former, if want first match: process[] p = process.getprocessesbyname("pname"); if (p.len

r - How to reflow long to wide only part and summarise the rest? -

i need arrange table performing formatting, table like dt <- read.table(text = "year st_id n overall metric1 metric2 1999 205 386 96.3 0 0 1999 205 15 0 0 0 1999 205 0 0 0 0 1999 205 0 0 0 na 2000 205 440 100 0 0 2000 205 0 0 0 0 2000 205 0 0 na 0 2000 205 0 0 0 na", header = true) i need obtain following "output" table. year st_id 1 2 3 4 overall metric1 metric2 1999 205 386 15 0 0 96.3 0 na 2000 205 440 0 0 0 100 na na . . in columns on right, want aggregate instances of na => na else sum(values) how can achieve using r? library(tidyr) a=aggregate(.~year,xy[-(2:3)],sum,na.action=function(x)x) xy[1:3]%>%group_by(year)%>%mutate(n_=1:4)%&

Airflow: Dynamic SubDag creation -

i have use case have list of clients. client can added or removed list, , can have different start dates, , different initial parameters. i want use airflow backfill data each client based on initial start date + rerun if fails. thinking creating subdag each client. address problem? how can dynamically create subdags based on client_id? you can create dag objects dynamically: def make_client_dag(parent_dag, client): return dag( '%s.client_%s' % (parent_dag.dag_id, client.name), start_date = client.start_date ) you use method in subdagoperator main dag: for client in clients: subdagoperator( task_id='client_%s' % client.name, dag=main_dag, subdag = make_client_dag(main_dag, client) ) this create subdag specific each member of collection clients , , each run next invocation of main dag. i'm not sure if you'll backfill behavior want.

curl - Linux: run a command every 50 minutes randomly -

i need run curl request locahost @ least once in every 30 mins. command curl http://localhost:8080 . the catch here is, want select time randomly between 5min - 30 min , execute curl command. pseudo-code might this while(true) n = random number between 5-30 run curl http://localhost:8080 after 'n' minutes a detailed answer nice since don't have knowledge linux. if run above script, must run background process , make sure not killed (os, other users,...) another way use cronjob trigger automatically script more complex. cronjob setting: * * * * * bash test_curl.sh >> log_file.log shell script test_curl.sh: #!/bin/bash # declare variable execute_time_file_path="./execute_time" # load expected execute time expected_execute_time=$(cat $execute_time_file_path) echo "start @ $(date)" # calculate current time , compare expected execute time current_minute_of_time=$(date +'%m') if [[ "$expected_execute_time&qu

javascript - using backward slashes it takes entire path -

i trying pass path of file , filename alone in grid. right working forward slashes not working backward slashes. when give whole path using backward slashes takes entire path can guys tell me how fix it. providing code below working scenario test/player.txt not working scenario test\player.txt http://jsfiddle.net/besnpj54/8/ template: "<a onclick=\"window.open('#= filename#', 'popup', 'width=800,height=600,scrollbars=yes,resizable=no')\">#= filename.substring(filename.lastindexof('/')+1) #</a>" one solution replace \ / before adding grid. this: $("#save").click(function(){ grid.datasource.add({"filename":$("#fname").val().replace(/\\/g,"/"),"lastname":"last name"}); $("#fname").val(''); }); http://jsfiddle.net/besnpj54/11/ please note \ used escape special characters (as did \" ), \ have

reactjs - cannot get fix react-native-router-flux error even after uninatsalling it -

Image
i using react-native 0.47.1 . playing around different versions of react-native-router-flux . long story short, messed things , started error while running app. decided uninstall router-flus start beginning. used ways below: npm uninstall <name> removes npm uninstall <name> --save npm uninstall <name> --save-dev npm -g uninstall <name> --save and now, when try npm list react-native-router-flux i message: but still when running project same error shown below edited: this package.json: { "name": "manager", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "firebase": "^4.2.0", "react": "16.0.0-alpha.12", "react-native": "0.47.1",

"object reference not set to an instance of an object" when trying to get lat, lng from a KML-layer to Google Maps [Xamarin Android] -

Image
i working kml-file via plugin: https://github.com/sushihangover/sushihangover.android.maps.utils the kml-file using gets added succesfully via codesnippet: var kmllayer = new kmllayer(googlemap, resource.raw.campus, android.app.application.context); kmllayer.addlayertomap(); movecameratokml(kmllayer); when it's added run movecameratokml function try lat, lng of every point crash on row foreach (latlng latlng in ((kmllinestring)geo).geometryobject); errormessage: object reference not set instance of object void movecameratokml(kmllayer kmllayer) { //retrieve first container in kml layer var container = (kmlcontainer)kmllayer.containers.iterator().next(); //retrieve nested container within first container container = (kmlcontainer)container.containers.iterator().next(); //retrieve first placemark in nested container var placemark = (kmlplacemark)container.placemarks.iterator().next(); var geo = placemark.geometry; if (geo kmllinestring) { foreac

Questions about subquery in mysql -

1、firstly, mysql version 5.5.40 2、following table data: mysql> select * student; +----+-----------+ | id | name | +----+-----------+ | 1 | lily | | 2 | lucy | | 3 | nacy | | 4 | hanmeimei | +----+-----------+ 4 rows in set (0.00 sec) mysql> select * course; +------------+--------+ | student_id | course | +------------+--------+ | 1 | title | | 2 | title | | 3 | title | +------------+--------+ 3 rows in set (0.00 sec) 3、why sql return result set,what subquery return? when replace id name,i same result.how works? mysql> select * student id in(select id course); +----+-----------+ | id | name | +----+-----------+ | 1 | lily | | 2 | lucy | | 3 | nacy | | 4 | hanmeimei | +----+-----------+ 4 rows in set (0.00 sec) mysql> select * student name in(select name course); +----+-----------+ | id | name | +----+-----------+ | 1 | lily | | 2 | lucy | | 3 | nacy | | 4 | han

java - What is the use of the init() method in this code? -

i'm trying learn how use json , i'm going on code tutorial , there init() method. found online init() used entry point of applets. if why init() in android apps code , not website code? can please explain reason? common when using json in android or uncommon? public class mainactivity extends appcompatactivity { private recyclerview mrestaurantrecyclerview; private restaurantadapter madapter; private arraylist<restaurant> mrestaurantcollection; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); init(); new fetchdatatask().execute(); } private void init() { mrestaurantrecyclerview = (recyclerview) findviewbyid(r.id.restaurant_recycler); mrestaurantrecyclerview.setlayoutmanager(new linearlayoutmanager(this)); mrestaurantrecyclerview.sethasfixedsize(true); mrestaurantcollection = new arraylist<>(); madapter = new restaurantadapter(mresta

javascript - Copy Row Values to all Rows of one Column -

my project requires similar approach of example: https://codecentral.devexpress.com/e2026/ is possible without popup , reflect changed values on database? , noticed wasn't done using batch mode. possible on batch mode , sqldatasource? hope here can me this. or sample, idea , suggestion do. thank much. it seems older approach. consider using batch edit mode (i.e., without popup) instead , save data required storage. check out following examples see possible solutions: (in-memory) batch edit via list of objects (db) batch edit via entitydatasource (change sqldatasource specified crud commands)

docker - in k8s+flannel, how to access pod from outside host using nodeport -

i confused when tested following scenario: host (non k8s node) accesses service using node port. due entry: postrouting -m comment --comment "kubernetes service traffic requiring snat" -m mark --mark 0x4000/0x4000 -j masquerade the source ip address in ip packet sent changed ip of docker, 1 of service pod got packet. in case, pod not know real client a. how docker route packet replied pod host a?

java - sonar custom rule: disable 'system.out.println' -

my goal is: raise issue when java file contain system.out.println() rule code snipped: public void visitnode(tree tree) { //ohter code methodmatcher matcher = methodmatcher.create() .typedefinition(typecriteria.anytype()) .name("println") .withoutparameter(); methodinvocationtree methodinvocationtree = istreemethodinvocation(expressiontree.expression(), matcher); if(methodinvocationtree != null){ reportissue(tree, "msg"); } } private static methodinvocationtree istreemethodinvocation(expressiontree tree, methodmatcher matcher) { tree expression = expressionutils.skipparentheses(tree); if (expression.is(tree.kind.method_invocation)) { methodinvocationtree methodinvocation = (methodinvocationtree) expression; if (matcher.matches(methodinvocation)) { return methodinvocation; } } return null; } test case code: public class saasdisablesystemoutprintcheckcase

javascript - Vue js computed result not accurate -

i trying implement vote button vue js, when user click "vote" send axios request server , store data, return json back. same unvote. check if user voted, button should change unvote facebook. far vote , unvote button work correctly. found problems voted features not working. if user voted, after refresh page change "vote", should unvote. if button clicked, in database showing vote deleted. mean should problems of computed. struggle on since not know vue js. this vue components. <template> <a href="#" v-if="isliked" @click.prevent="unlike(comment)"> <span>unvote</span> </a> <a href="#" v-else @click.prevent="like(comment)"> <span>vote</span> </a> <script> export default{ props: ['comment','liked'], data: function() { return { isliked: '', } }, mounted() { axios.g

python function to calculate 5th and 95th confidence intervals of TLS regression slope. -

i know statsmodels function simple ordinary least squares (ols) can calculate confidence intervals on parameters. there python function can same total least squares (tls)?

javascript - Google Maps Routing with Waypoints from DB -

i have c# webforms application , i'm trying use google maps routing waypoints according example google maps api site. https://developers.google.com/maps/documentation/javascript/examples/directions-waypoints#try-it-yourself this example represents want except want of points sql database rather dropdown lists shown. essentially, want loop through datareader , map/route points. data stored procedure. don't know how stored procedure results on java script. thanks suggestions. clarifying little, here have currently: in c# i'm calling stored procedure gets lat/long values db. private void loadarray() { //get lat long db load google array. sqlconnection conn = new sqlconnection(); sqlcommand cmd = new sqlcommand(); string connstr = configurationmanager.connectionstrings["furnituredb"].connectionstring; conn.connectionstring = connstr; conn.open(); cmd.commandtype = commandtype.storedproce

c# - Emgu CV the context menu of ImageBox is missing in a WPF project? -

Image
i creating wpf project emgu cv camera capture. embedded emgu cv imagebox wpf window below <windowsformshost> <winformcontrols:imagebox x:name="imageboxcamera" functionalmode="minimum" dock="fill" backcolor="blue" sizemode="zoom"/> </windowsformshost> but found context menu of imagebox missing. how recover context menu of imagebox in wpf project? the context menu looks just remove attribute functionalmode="minimum" can recover context menu.

css3 - Hovering subtle random movement -

i'm trying make 3dish block hover/float balloon in still room. i'm using this... tweenmax.from($(".bloque"), 4.3, { transform: "rotatey(47deg)", repeat: -1, yoyo: true, ease: sine.easeinout }); tweenmax.from($(".bloque"), 6.1, { transform: "translatey(-2vw)", repeat: -1, yoyo: true, ease: sine.easeinout }); ... while first block alone expected, adding second block behaves weird. i'm not using transforms on same animation block want different timing overlap avoid boring predictable movement cycle. instead want these cycles overlap creating subtle chaotic motion. edit: pen added -> https://codepen.io/zjorge/pen/zjravm

osx - Python not finding pip modules MacOS -

i have installed modules using pip , whenever try import them in python told no module exists. think there wrong paths. terminal output, know how can fix this? nicks-macbook-pro:~ nickporter$ python /usr/bin/python nicks-macbook-pro:~ nickporter$ pip /usr/local/bin/pip nicks-macbook-pro:~ nickporter$ you can use pip freeze find packages installed. not know whether use virtualenv. if use it, have source it, activate it.

javascript - Why isn't JQuery showing my autocomplete fields? -

context: i'm attempting setup jquery autocomplete using data gets sent in server. when user changes field, autofill data gets sent in backend such can select supplied value if desire. backend code functional, can see array of autocomplete data if console.log(data) it on frontend. my issue that, though frontend code requesting , receiving autocomplete data, when used jquery's built in autocomplete options, never shows options on frontend. here's code: $.ajax({ type: "get", url:"/autocomplete/"+event.target.id+"/"+$(this).val(), success : function(data){ console.log(data); $(event.target.id).autocomplete({ source: data }); } }); where event.target.id id of input field i'd autocomplete. again, of works fine. when console.log(data) , shows array of items want use autocomplete, when run $(event.target.id).autocomplete({source:data}); it doesn't show autocomplete o

meteor - app not working unless there is something in server.js file -

i have texting app created while , broke. fixed copying of code on project , installing same packages. when did this, stopped working , have no idea why. narrowed down texts returning empty array since no data being published. in new app created, have exact same code, 1 not working... happened me other app copied from(it did not work, randomly started working again) , worked after day of not touching it. , yes, autopublish installed @ version 1.0.7. please reoccuring problem , need answer! client - main.js import react "react"; import reactdom "react-dom"; import {meteor} "meteor/meteor"; import {tracker} "meteor/tracker"; import { browserrouter, route, switch, redirect, withrouter} 'react-router-dom' import {texts} "./../imports/api/text"; import app "./../imports/ui/app"; import notfound "./../imports/ui/notfound"; import signup "./../imports/ui/signup"; import login "./../im

javascript - Getting Error, "Cannot set property [0] of undefined" -

trying practice writing hangman program, , @ part function loop on word guessed, , set dashes '_' array based on length of word guessed. working until added function "putdashes()" take dashes in array , add them html on screen user guess. getting error, "cannot set property [0] of undefined". please assist function wordselect(selectdashes){ // define wordbank object wordbank =["westworld", "startrek", "legion", "gameofthrones", "archer", "simpsons", "bobsburgers", "janethevirgin", "seinfeld", "rachelmaddow"]; // pick random word wordbank currentword = wordbank[(math.floor(math.random()*wordbank.length+1))]; console.log(currentword); selectedword=[]; selectedword=currentword.split(""); for(var i=0; i<currentword.length; i++) { selectdashes[i]="_"; // selectdashes.push("_"

java - How to deserialization of a class having final fields using kryo -

i have class a. public class { public final int a; public a(int a) { this.a = a; } public int geta() { return a; } } now when want use kryo ser/deser needs no-arg constructor unlike default implementation of java serialization needs no argument constructor of parent class non-serializable. how can serialize/deserialize class using kryo has final members, having final members in class can't define no-arg constructor

node.js - Http Request in TypeScript -

i trying convert following snippet in nodejs typescript: how make http request in nodejs here typescript code: import * http 'http'; export class httprequest{ url: string; private path: string; private host: string; private args: array<array<string>>; constructor(url: string, args?: string){ this.url = url; this.processurl(this.url); if(!!args){ this.processargs(args); } this.args = []; } private processurl(url: string): void { let tld: number = url.lastindexof('.') let sep: number = url.indexof('/', tld); this.host = url.slice(0, sep); this.path = url.slice(sep+1); } private processargs(args: string): void { let sep: number = args.indexof('&'); if(sep < 0){ return ; } let argpair: string = args.slice(0, sep); let apsep: number = argpair.indexof('='); let k: string = argpair.slice(0, apsep); let v: string = argpair.slice(apsep+1); this

Web Scraping using rvest in R -

i have been trying scrap information url in r using rvest package: url <-'https://eprocure.gov.in/cppp/tendersfullview/id%3dnde4mty4ma%3d%3d/zmvhyzk5nwvimwm1ntdmzgmxywyzn2jkytu1ymq5nzu%3d/mtuwmjk3mtg4nq%3d%3d' but not able correctly identity xpath after using selector plugin. the code using fetching first table follows: detail_data <- read_html(url) detail_data_raw <- html_nodes(detail_data, xpath='//*[@id="edit-t- fullview"]/table[2]/tbody/tr[2]/td/table') detail_data_fine <- html_table(detail_data_raw) when try above code, detail_data_raw results in {xml_nodeset (0)} , consequently detail_data_fine empty list() the information interested in scrapping under headers: organisation details tender details critical dates work details tender inviting authority details any or ideas in going wrong , how rectify welcome. your example url isn't working anyone, if you're looking data particular tender, then: lib

jquery file upload not working with jquery 3.x -

my script works fine jquery 1.x , 2.x, doesn't work jquery 3.x imageinput.fileupload(); var jqxhr = imageinput.fileupload('send', { files: files, formdata: $.extend({csrfmiddlewaretoken: csrftoken}, attachmentdata), url: {{ id }}_settings.url.upload_attachment, }) .success(function (result, textstatus, jqxhr) { $.each(result.files, function (index, file) { console.log('success'); }); }) .error(function (jqxhr, textstatus, errorthrown) { console.log('error occurred.'); }); the ff browser complains success , error function not found. jquery.deferred exception: imageinput.fileupload(...).success not function .... undefined this error message. thank help. jquerys success , error part of $.ajax , in $.ajax({ success : function() {}, error : function() {} }) but $.ajax starter returning deferreds, changed done , fail $.ajax({}).done().fail() this caused confusion, identical methods calle

sql server - Adding columns to view in T-SQL using while loop -

i'm cleaning few queries in sql views. in 1 view number of columns generated using following syntax sum(case when navn = '000100' vaerdi else 0 end) '000100', sum(case when navn = '000110' vaerdi else 0 end) '000110', sum(case when navn = '000115' vaerdi else 0 end) '000115', the list goes on , becomes quite extensive i'd put while loop. something like while (i in ('000100','000110','000115') sum(case when navn = vaerdi else 0 end) i, end any suggestions on how accomplish this? found solution! using pivot function, able accomplish goal with datatable ( select * dbo.table navn in ('000100', '000110') ) select * datatable pivot ( sum(vaerdi) for[navn] in (['000100],[000110]) ) p

asp.net - How do I share settings between web.config and class library during unit testing? -

i want unit tests in class library, need same config settings in main asp.net project's web.config. therefore need duplicate number of web.config settings class library. i have added settings through class library's project properties settings tab. then app.config file automatically added project: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <sectiongroup name="applicationsettings" type="system.configuration.applicationsettingsgroup, system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" > <section name="externalservices.cpr.properties.settings" type="system.configuration.clientsettingssection, system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </sectiongroup> </configsections> <applicationsettings> <ex

angular - What is @Input() used for? -

i decided learn angular 4 , follow tutorial @ https://angular.io/tutorial/toh-pt3 but, once again, question arose. @input () hero: hero; what for? do? mean? here code. hero-details.component.ts import { component, input } '@angular/core'; import { hero } "./hero"; @component({ selector: 'hero-detail', templateurl: './hero-detail.component.html' }) export class herodetailcomponent { @input() hero: hero; } here code files app.components.ts , app.components.html , hero-details.components.html explain please if can @input() hero means hero variable being passed on component it's parent.e.g <hero-detail [hero]="(object of hero)"> </hero-detail> here passing hero object hero detail component it's parent component.

r - Prevent tm from removing stopwords from double words -

i'm trying remove stopwords vector of characters. problem i'm facing there word "king kond".since 'king' 1 of stopwords, "king" in "king kong" getting removed. is there way avoid double words being removed? code is: text <- vcorpus(vectorsource(newmnt1$form)) #(newmnt1$form chr [1:4] "king kong lives" "foot" "island" "skull") #normal standardization of text. text <- tm_map(text, content_transformer(tolower)) text <- tm_map(text, removewords, custom_stopwords) text <- tm_map(text, stripwhitespace) newmnt2 <- text[[1]]$content one quick hack convert "king kong" patterns "king_kong". a <- gsub("king kong", "king_kong", "this pattern king , king kong") [1] "this pattern king , king_kong" tm::removewords(a, "king") [1] "this pattern , king_kong" best, colin

terminal - what is the use of parentheses in linux command -

i run following command in linux terminal. can tell me use of parentheses in linux terminal , following command ? $(echo "get / http/1.0";echo "host: www.google.com"; echo) | nc www.google.com 80 ( list ) placing list of commands between parentheses causes subshell environment created, , each of commands in list executed in subshell. since list executed in subshell, variable assignments not remain in effect after subshell completes.

python - How to to graphically select side lengths on a grid? -

Image
i creating map builder game i've been designing, , have run issue users being able intuitively draw maps. map has hexagonal grid, , each grid location can have forest, town, etc. terrain. however, there rivers run along borders between hexes on grid. have implemented "cursor" show side being modified, shown in left image. the method using identify cursor located shown in right image. if mouse present in hex, locates of 6 triangles inside , highlights respective side of hexagon. it possible draw rivers using method, easy accidentally wander wrong triangle, resulting in patchy river when drawing straight lines. the program written in pygame on python 3, although doesn't make of difference. tl;dr: best way graphically select side length on grid (hexagonal or otherwise)?

php - Call to undefined method Illuminate\Database\Query\Builder::put() -

i developing laravel application poultry farm management. and here using eloquent return collection of stockegg table, stores data egg stock. but total stock not present in stockegg table, calculating in loop using initial value of total stock. here controller: $stockeggs = \app\stockegg::where('farm_id', '=', $farm)->orderby('date', 'asc')->get(); $current_stock = $initial_stock; foreach($stockeggs $stockegg){ $current_stock = $current_stock + $stockegg->daily_balance; $stockegg->put('total_stock', $current_stock); } but error: (1/1) badmethodcallexception call undefined method illuminate\database\query\builder::put() i have included following line @ top of mu controller: use illuminate\support\collection; put not method eloquent. should write code this. foreach($stockeggs $stockegg){ $current_stock = $current_stock + $stockegg->daily_balance; $stockegg->total_stock = $current_st

Parse C# to javascript, too big for Json -

i have viewbag diffrent texts in, set textbox. depending on dropdown value choose. have tried passing json doing this: c# var jss = new system.web.script.serialization.javascriptserializer(); var val = jss.serialize(viewbag.forbeholddata); javascript var val = '@html.raw(val)'; var obj = $.parsejson(val); but getting error when try parse json, because val larger 1500. of know better solution this? thanks. has been answered in comment section. had nothing size, error in json syntax. persons taking time help.

mysql - How to use IF/CASE statement in stored procedure WHERE clause -

i have stored procedure this delimiter $$ drop procedure if exists `shashitest`$$ create definer=`user`@`%` procedure `shashitest`(in groupid int, in userid int, in chapterid int) begin select sum(qptdq.mark)-sum(qpe.marks) marks_detucted, count(qpe.tc_question_message_type_id) noof_errors, (select tqmt.key_value tc_question_message_type tqmt tqmt.id=qpe.tc_question_message_type_id) error_type question_paper qp inner join question_paper_group_student_map qpgsm on qpgsm.question_paper_id=qp.id inner join institute_group_student_map igsm on igsm.id=qpgsm.institute_group_student_map_id , igsm.group_id=groupid , igsm.user_id=userid inner join question_paper_template_detail qptd on qptd.question_paper_template_id=qp.question_paper_template_id inner join question_paper_template_detail_question qptdq on qptdq.question_paper_template_detail_id=qptd.id inner join question_paper_details qpd on qpd.question_paper_template_detail_question_id=qptdq.i

Reading multiple Files Asynchronously using Akka Streams, Scala -

i want read many .csv files inside folder asynchronously , return iterable of custom case class. can achieve akka streams , how? *i have tried somehow balance job according documentation it's little hard manage through... or is practice use actors instead?(a parent actor children, every child read file, , return iterable parent, , parent combine iterables?) first of need read/learn how akka stream works, source, flow , sink. can start learning operators. to make multiple actions in parallel can use operator mapasync in specify number of parallelism. /** * using mapasync operator, pass function return future, number of parallel run futures * determine argument passed operator. */ @test def readasync(): unit = { source(0 10)//-->your files .mapasync(5) { value => //-> run in parallel 5 reads implicit val ec: executioncontext = actorsystem().dispatcher future { //here read file thread.slee

algorithm - Add sequence number for dynamic hierarchy in C# -

Image
suppose have these records: code |grouplevel |group ----------------------------------- x0000 |4 | x1000 |3 |x0000 x2000 |3 |x0000 x3000 |3 |x0000 x1100 |2 |x1000 x1200 |2 |x1000 x1300 |2 |x1000 x2100 |2 |x2000 x2200 |2 |x2000 x2300 |2 |x2000 x1110 |1 |x1100 x1120 |1 |x1100 x1111 |0 |x1110 x1112 |0 |x1110 x1113 |0 |x1110 x1114 |0 |x1110 what want acheive have kind of sequence number: seq |code |grouplevel |group ------------------------------------- 1 |x0000 |4 | 2 |x1000 |3 |x0000 3 |x1100 |2 |x1000 4 |x1110 |1 |x1100 5 |x1111 |0 |x1110 6 |x1112 |0 |x1110 7 |x1113 |0 |x1110 8 |x1114 |0 |x1110

html - Combining jQuery filtering and Bootstrap rows -

i have simple bootstrap grid this <div class="container-fluid"> <div id="parent"> <div class="row row-striped"> <div class="category1 col-xs-12"> //of course more cols , contents in them </div> </div> </div> </div> and put filter on buttons ids (thanks https://codepen.io/terf/post/jquery-filter-divs ) <button class="btn btn-link" id="category1">category 1</button> but because need background on every second row, decided add new row jquery every 2 items. causes problem filter, because whenever filter, new row being kept (and empty). this javascript part: <script type="text/javascript"> function aligndivs() { var $mainelem = $('.row.row-striped'), $parent = $mainelem.parent(), // div#parent

python - Bitwise operation and usage -

consider code: x = 1 # 0001 x << 2 # shift left 2 bits: 0100 # result: 4 x | 2 # bitwise or: 0011 # result: 3 x & 1 # bitwise and: 0001 # result: 1 i can understand arithmetic operators in python (and other languages), never understood 'bitwise' operators quite well. in above example (from python book), understand left-shift not other two. also, bitwise operators used for? i'd appreciate examples. bitwise operators operators work on multi-bit values, conceptually 1 bit @ time. and 1 if both of inputs 1, otherwise it's 0. or 1 if one or both of inputs 1, otherwise it's 0. xor 1 if exactly one of inputs 1, otherwise it's 0. not 1 if input 0, otherwise it's 0. these can best shown truth tables. input possibilities on top , left, resultant bit 1 of 4 (two in case of not since has 1 input) values shown @ intersection of inputs. and | 0 1 or | 0 1 xor | 0 1 not | 0 1 ----+-----

c# - Why there is "index exceeded the number of group boundaries" in this code? -

Image
for code in visual studio point[,] point = new point[9, 10]; (int = 0; < 9; i++) { for(int j = 0; < 10; j++) { point[i, j].x = i;//mark1 point[i, j].y = j; } } at //mark1,system tell me"index exceeded number of group boundaries" why? you doing for (int j = 0; < 10; j++) so condition i < 10 maybe typo causing loop go out of range in array (you trying access eleement 0, 10 in array) replace with: for (int j = 0; j < 10; j++)

java - IntelliJ IDE disable 'is never used' inspection -

Image
i extends messagecracker class , override methods(handlers) public void onmessage(executionreport execrep, sessionid sessionid) ... public void onmessage(businessmessagereject message, sessionid sessionid) ... public void onmessage(quote quote, sessionid sessionid) each method catch messages extend message - executionreport, businessmessagereject, quote etc. all work fine intellijide on methods - method 'onmessage(quickfix.fix44.quote, quickfix.sessionid)' never used how can fix it? intellij telling public method on class unused. it's not error, it's information message. you think of gentle hint: writing public method have implied should use method intellij unable find usages of method warns in case either (a) method scope should reduced or (b) have forgotten write code intended invoke method. you can switch behaviour on/off preferences > editor > inspections > unused declaration you can disable inspection on specific method ann

Is it possible to use System.File.IO with Azure File Share? -

we can find everywhere how use azure file share rest api, have legacy .net app uses system.file.io accessing file share. how can access file share using system.file.io ? these azure file share created supporting legacy app don't see point if have rewrite file access code. how can access file share using system.file.io ? you can amount azure file share. after amounted azure file share, can access share using system.file.io through mapped drive in same windows. mount azure file share , access share in windows otherwise, can access file share using rest api or client sdk. if use .net framework, download , use azure storage .net sdk. develop azure file storage .net

php - fatal error during installation of chamilo -

i want install chamilo in 1and1 when transfer files downloaded via ftp official site after have linked subdomain works error: fatal error: require (): failed opening required /homepages/...../ chamilo / vendor / composer /../ symfony / polyfill-mbstring / bootstrap.php '(include_path ='.: / usr / lib / php5.6 ') in chamilo / vendor / composer / autoload_real.php on line 66 i tried proceed differently sending ssh server of 1and1 not recognize command sudo if can me find solution given type of error getting, looks trying install chamilo directly development sources @ https://github.com/chamilo/chamilo-lms (maybe master branch not install-ready yet). you should try use either stable package (from "releases" tab on github) or download 1.11.x development branch (which install-ready @ date - master branch well), in case need read readme.md file requires additional steps (namely using composer update kind of hinted @eriz.

.net - Execute a query multiple times -

according dapper documentation , can execute same command multiple times if pass ienumerable parameter: connection.execute(@"insert mytable(cola, colb) values (@a, @b)", new[] { new { a=1, b=1 }, new { a=2, b=2 }, new { a=3, b=3 } } ).isequalto(3); // 3 rows inserted: "1,1", "2,2" , "3,3" i similar query. same query executed multiple times , result of each execution, scalar value, combined in ienumerable result. this: ienumerable<long> ids = connection.query(@"insert mytable(cola, colb) values (@a, @b); select case(scope_identity() bigint);", new[] { new { a=1, b=1 }, new { a=2, b=2 }, new { a=3, b=3 } } ); when try this, invalidoperationexception message "an enumerable sequence of parameters (arrays, lists, etc) not allowed in context". there way accomplish this? i using dapper 1.50.2. the api not provide functionality. need execute query multiple times each par

typoscript - TYPO3 Menu creates two anchor per link -

the following typoscript creates 2 anchor tags per li tag. 5 = hmenu 5 { wrap = <ul class="menu clearfix">|</ul> special = directory special.value = {$supportfolder} 1 = tmenu 1 { noblur=1 no.atagparams = title="{field:title}" no.atagparams.insertdata = 1 no.allwrap = <li>|</li> no.stdwrap.cobject = case no.stdwrap.cobject { key.field = doktype 1 = text 1 { typolink.parameter.field = uid field = title stdwrap.htmlspecialchars = 1 } # pagetype shortcut 4 = text 4 { field = title typolink.parameter.field = shortcut } # page typo3 external url 3=coa 3 { # textblock für http-links (wert 1) 10 = text 10 { field = title typolink.parameter.data > typolink.parameter.datawrap = http://{field:url} stdwrap.html

Wordpress user search query order by most recent login -

i'm creating custom user search results page , order results a) post_count (easily done) b) when user last logged in - i.e. active users. is possible? there user meta field in db login date? this have far: $args = array( 'number' => $users_per_page, 'paged' => $current_page ); thanks. figured out answer this. found meta key last_activity . $args = array( 'order' => 'desc', 'orderby' => 'last_activity', 'number' => $users_per_page, 'paged' => $current_page );

c++ - explicitly-defaulted copy assignment operator must return MyClass & -

// task.h class task { public: task() = default; task(const task &) = delete; ~task() = default; task(task &&) = default; const task & operator= (const task &) = default; }; /main.cpp #include <iostream> #include "task.h" int main() { task t; std::cout<<"hello world"<<std::endl; return 0; } i'm coding c++ on mac os. when compile code above: g++ main.cpp , error below: error: explicitly-defaulted copy assignment operator must return 'task &' i don't understand @ all. operator= can return non-const reference here? executed same code in windows , worked without error. mac os has special c++ standard? the problem use = default . http://en.cppreference.com/w/cpp/language/copy_assignment if = default used, type of return must non-const reference. whereas if code this: const task & operator= (const task &t){} , works without error.

Spring boot admin without embedded Tomcat -

i'm trying deploy spring-boot .war application on standalone servlet container (pivotal tc server) , have issue spring-boot admin page. when run app using spring-boot:run command, have proper boot spring-boot admin ui page, when deploy war on tcserver, on root path / see spring-boot admin page without applications inside it: how enable admin page: @enableadminserver public class apprunner extends springbootservletinitializer { ... } in properties set: server.port=9000 when running tcserver see in logs: jvm 1 | [2017.08.18 12:42:04.180 ast] [warn ] [d.c.b.a.s.applicationregistrator] [pool-3-thread-1] [failed register application null @ spring-boot-admin http://localhost:9000/api/applications ): serviceurl must set when deployed servlet-container] tcserver ran on 8080 default port. can give advice how see app in spring-boot admin ui on external server? finally solved adding property: spring.boot.admin.client.service-url=http://loc

xaml - To load an image in a frame in xamarin.forms -

i want load image in specific frame, when zoom in , out, should within frame, should not come out of boundary. able achieve using scroll view, there white spaces when pan image after zooming image.i want pan through image. on latest features of xamarin.forms pinch gesture inside contentpage, here official page: https://developer.xamarin.com/guides/xamarin-forms/user-interface/gestures/pinch/ and entire project sample: https://github.com/xamarin/xamarin-forms-samples/tree/master/workingwithgestures/pinchgesture here example of can achieve: xamarin.forms pinch example

c# - Why when I sort a list full of 0's it gets mixed up? -

Image
i'm trying rate gin's popularity, read in gin list text file , each gin starts popularity of 0, when sort list comes out mixed, not in it's original alphabetical order if not sorted. no sorted - here code i'm using - using unityengine; using system.collections; using system.collections.generic; public class ginlistclass : monobehaviour { [header("the text file holding gin's, country, abv , price")] public textasset gintextfile; [header("the lists, public debugging")] public list< string > ginstring = new list< string >(); private int rating; private int linesinfilecount; void start () { rating = 0; list<ginlist> gins = new list<ginlist>(); string[] linesinfile = gintextfile.text.split('\n'); foreach (string line in linesinfile) { linesinfilecount++; ginstring.add(line); } (var = 0; < linesinfilecount; i++) { gins.a

Deserialize BigDecimal in scala with json4s return empty list -

given json: { "id": "1", "details": [{ "tax": [{ "amount": 1 }, { "amount": 2 }] }] } i'm trying reading in way: lazy val amounts: list[bigdecimal] = parse(json) \\ "amount" \ classof[jdecimal] but it's giving me empty list, while using jdouble this: lazy val amounts: list[double] = parse(json) \\ "amount" \ classof[jdouble] it's giving me correct list. how can directly read list of bigdecimals ? shortly can solve using extract method target type conversion, like: val amounts = parse(json) \ "details" \ "tax" \ "amount" implicit val formats = defaultformats val decimals = amounts.extract[list[bigdecimal]] > list(1, 2) explanation: when read amounts it's element type jint not jdecimal , val amounts = parse(json) \ "details" \ "tax&

c# - How to set height to the dynamically added user control in stackpanel? -

we having wpf user control (usercontrol.xaml) in 1 dll (child.dll). we added reference of "child.dll" in application (parentapplication) in parent application have 1 stackpanel in have add user control dynamically using user control constructor. parentapplication contains : mainwindow.xaml <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:fa="http://schemas.fontawesome.io/icons/" x:class="parentapplication.mainwindow" xmlns:mvis="clr-namespace:mvis;assembly=mvis" title="mainwindow" height="1000" width="1000" windowstartuplocation="centerscreen" windowstate="maximized"> <grid> <tabcontrol> <tabitem cursor="hand"> <tabitem.header> <stackpanel orientation="horiz

ios - Xcode 8.3.3 lost connection to iPhone 7 plus -

this frustrating, got iphone 7 plus use test device. somehow, xcode loose connection connect mac. restarting mac solve it. xcode version: 8.3.3 ios version: 10.3.3 luckily, have iphone 6s testing, works fine. ios version 10.3.3. don't want use 1 test device because it's personal phone, messages , phone calls interrupt development. thanks in advance : )

Is it good practice to use non interrupting intermediate message catch event on boundary of receive task in camunda -

Image
why did this: the reason use kind of approach because want workflow wait @ node until video gets copied, @ same time want notified % of progress made while copying sent different application @ every 2s. problem faced: at random while executing workflow intermediate message catch event on boundary not registered , error first callback video copy application when tries correlate message event on boundary. their others ways making simple loop in camunda achieve same behavior but random error in case concern if 1 knows same issue or if better approach can me. the approach non-interrupted boundary event valid, maybe bit verbose. prefer on loop construct, have thought "just" updating process variable outside indicate status? not need bpmn element allow this. see example rest api on update of process variables: https://docs.camunda.org/manual/7.7/reference/rest/process-instance/variables/put-variable/ . same of course possible java api. at random while

Regex expression in Java Selenium -

system.out.println("<chassismoduleoptionrequest partner_item='"'(.*)'"'>"); **expected output:** <chassismoduleoptionrequest partner_item="(.*)"> the above regex not working, can please me here. thanks, satish d to escape " should use \" , not '"' system.out.println("<chassismoduleoptionrequest partner_item=\"(.*)\">");

Is any other android devices having Leanback feature except AndroidTV? -

is other android devices having leanback feature except androidtv? i want restrict app on play store android tv. so, have added manifest <uses-feature android:name="android.software.leanback" android:required="true" /> from "https://developer.android.com/training/tv/start/start.html#declare leanback support" is right way restrict androidtv on play store? declare app uses leanback user interface required android tv. if developing app runs on mobile (phones, wearables, tablets, etc.) android tv, set required attribute value false. if set required attribute value true, app run on devices use leanback ui. the way interpret this, limits app tv.