Posts

Showing posts from January, 2013

How to check if date is between interval in java? -

this question has answer here: creating java date object year,month,day 6 answers i have 6 int variables: currentmonth , currentday , monthfrom , dayfrom , monthuntil , dayuntil . need check if todays month , day falls within range of , until variables. for example if currentmonth = 1 , currentday = 2 , monthfrom = 11 , dayfrom = 24 , monthuntil = 3 , dayuntil = 3 date in interval , method should return true. i'm not sure how though. there other option check every possible outcome using ifs? just quick range check calendar: note: make sure import java.util.gregoriancalendar; public static boolean isdateinrange(int month, int day, int monthfrom, int dayfrom, int monthuntil, int dayuntil) { int yearroll = 0; int currentroll = 0; if (monthuntil < monthfrom)

kubernetes - Prometheus - Not able to probe tcp end -

i have setup prometheus , blackbox check liveliness of services , working fine http targets not working tcp one. if try probe service using curl http://blackbox:9115/probe?target=mongodb:27017&module=tcp it gives me output as probe_http_status_code 200 probe_http_content_length 84 probe_http_redirects 0 probe_http_ssl 0 probe_duration_seconds 0.310101 probe_success 1 but not able same result using prometheus job. prometheus ui shows status down error "server returned http status 400 bad request" job configuration - job_name: 'mongo-service' scheme: http metrics_path: /probe params: module: [tcp] static_configs: - targets: ['mongo-svc:27017'] relabel_configs: - source_labels: [__address__] target_label: __param_target replacement: ${1} - source_labels: [__param_target] regex: (.*) target_label: instance replacement: ${1}

angular - passing data between injectables in angular2 -

the question self explanatory, have seen since @injectables not components, cannot use traditional @input , @output job done. in advance ! you can inject 1 injectable second injectable via constructor: import { securehttp } './securehttp.service'; @injectable() export class identityservice { constructor(private http: securehttp) { } }

openstack - Instal devStack on Ubuntu14.04 faild -

i run ./stack.sh install openstack failed [error] ./stack.sh:198 if wish run script anyway run force=yes so use cmd force=yes ./stack.sh install openstack on ubuntu failed as: [error] /opt/stack/devstack/functions-common:602 git call failed: [git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements --branch master] i search error got nothing google, can me resolve problem? many thanks!

typescript - How to add class on scroll in ionic2 -

i want add animation in ionic2 app on scrolling, can't add classes on scroll animation didn't happen on scrolling, animations fired @ 1 time. please me solve problem. basically there ionscroll event emitter available on ion-content can subscribe , whatever need. can find more in docs . here example: template.html <ion-content #content></ion-content> component.js import { component, viewchild } '@angular/core' @component({...}) export class component { @viewchild('content') content = null ngafterviewinit() { this.content.ionscroll.subscribe(event => { // need here console.log(event) }) } }

openerp - stop deleting records in one2many relationship in odoo -

i have created relational columns different class when delete relational records delete records base class well. anyone have solution stop deleting records base class while deleting relational field. i have checked ondelete='set null' on field declaration. e.g have create field many2one 'purchase.order', when delete record delete 'purchase.order' well. i want stop deleting purchase order while delete record. in order stop field one2many deleting record witch default behavior of field when creating view give option: <field name="one2many_field_name" options="{'not_delete': true}" />

workflow - How to remove default example dags in airflow -

i new user of airbnb open source workflow/datapipeline software airflow, on github url https://github.com/apache/incubator-airflow . there dozen of default example dags after web ui started. make me feel stupid tried many ways remove these dags , failed so. load_examples = false set in airflow.cfg. folder lib/python2.7/site-packages/airflow/example_dags removed. states of example dags changed gray after removed folder of dag pythons scripts. items still occupy web ui screen. , new dag folder specified in airflow.cfg dags_folder = /mnt/dag/1. checked dag folder, nothing there. weird me why difficult remove these examples. when startup airflow, make sure set: load_examples = false inside airflow.cfg. if have started airflow not set false, can set false , run airflow resetdb in cli (!which destroy current dag information!). alternatively can go airflow_db , manually delete entries dag table.

PHP - Using PDO with IN clause array -

i'm using pdo execute statement in clause uses array it's values: $in_array = array(1, 2, 3); $in_values = implode(',', $in_array); $my_result = $wbdb->prepare("select * my_table my_value in (".$in_values.")"); $my_result->execute(); $my_results = $my_result->fetchall(); above code works fine, question why doesn't: $in_array = array(1, 2, 3); $in_values = implode(',', $in_array); $my_result = $wbdb->prepare("select * my_table my_value in (:in_values)"); $my_result->execute(array(':in_values' => $in_values)); $my_results = $my_result->fetchall(); this code return item who's my_value equals first item in $in_array (1), not remaining items in array (2, , 3). pdo not such things. need create string question marks dynamically , insert query. $in = str_repeat('?,', count($in_array) - 1) . '?'; $sql = "select * my_table my_value in ($in)&

c# - Can I know how the language interoperability works in .NET with the help of example? -

i reading .net framework , read ".net provides language interoperability", , read answer question what language interoperability (basic concept) in .net framework? , don't have idea how use feature practically. can simple code , procedure helpful understand concept of "language interoperability" practically? create simple project using c#, make simple class , compile it. generate .dll. create project using vb , import/include 1 compiled used c#. vb won´t take care of c# code, can manage class created. how? because .net compiled in common language. not matter if have used c# or vb generate code. interoperability framework feature. rare need make use of small projects undestand don't find real way carry out. simple c# in .net can reuse if decide code in vb in future or parts of project. in practice programmers decide code in 1 language. reusability there. feel free ask need. https://stackoverflow.com/a/43417187/7733724

javascript - Anybody give me an idea about scrolling, How to applay Scrooling Animations when user starts scrolling a content -

i need add animations element when in viewport. $(document).scroll(function(){ alert('how animate transitions left right, top bottom elements in structure '); }); .main-container{ width:900px; height:100%; overflow:auto; background:#00496d; color:#fff; } #section1,#section2,#section3,#section4,#section5,#section6{ width:100%; height:300px; border:1px solid #fff; margin:5px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="main-container"> <div id="section1"></div> <div id="section2"></div> <div id="section3"></div> <div id="section4"></div> <div id="section5"></div> <div id="section6"></div> </div> try skrollr.js animation on scroll. although not updated quite long time, might give shot based on require

smtp - Python utf-8 error -

when tried send email using python,i met error,here code: from_addr = '*@163.com' password = '*' to_addr = '*@qq.com' smtp_server = 'smtp.163.com' import smtplib server = smtplib.smtp(smtp_server, 25) server.set_debuglevel(1) server.login(from_addr, password) server.sendmail(from_addr, [to_addr], msg.as_string()) server.quit() then output it: traceback (most recent call last): file "c:\users\desktop\smtp.py", line 17, in <module> smtp = smtplib.smtp() file "c:\users\appdata\local\programs\python\python36-32\lib\smtplib.py", line 260, fqdn = socket.getfqdn() file "c:\users\appdata\local\programs\python\python36-32\lib\socket.py", line 673, in hostname, aliases, ipaddrs = gethostbyaddr(name) unicodedecodeerror: 'utf-8' codec can't decode byte 0xb2 in position 0: invalid start byte you can try name.decode() solve problem non-ascii characters.

python - looping into different positions of a list -

i loop list of pandas dataframe variables, possibility of choosing different index positions raw_data = {'v1': [10,np.nan,50,30],'v2': [10,-10,50,-20],'v3':[120,-130,509,-230],'v4': [5,78,34,66]} df = pd.dataframe(raw_data, columns = ['v1','v2','v3','v4']) columns = ['v1','v2','v3','v4'] #pseudo code: i+1 represents following element in list, after "i" element in columns: print(df[i]) print(df[i+1]) in real life more complex operations pairs of variables, applying function v1 , v3, v2 , v4, v3 , v5, etc. for instance: create new var called 'new_varv1, difference between v1 , v3. loop same v2 , v4, storing result in new_varv2, etc for in columns: df['new_var'+i]=df[i]-df[i+2] if understanding question correctly, this: ctr = 1 in columns: print(df[i]) print(df[columns[ctr]]) ctr+=1

html - Which css rule, makes elements to be positioned vertically, despite inline-block rule? -

which css rule, makes elements positioned vertically, despite inline-block rule? i want elements inline horizontally, instead inline me vertically. finally, not able past css, because stackoverflow blocks question code amount me. if try on fiddle - align horizontally, https://jsfiddle.net/j3e76u0l/1/ if try on computer opera, chrome , firefox browsers - make column of buttons instead of row; , if load remote server , have subscription, - buttons make column instead of row . html <button class="inbk" type="submit" name="redirlogin">login</button> <button class="inbk" type="submit" name="redirregister">register</button> <button class="inbk" type="submit" name="redirremind">remind</button> <button class="inbk" type="submit" name="redircontact">contact</button> css .inbk { display: inline-block; vertica

csv - Not showing Year values in mySQL -

i trying import data csv file below command line data kept in e drive , file name data.csv: load data local infile 'e:\data.csv' table prize_won fields terminated ',' lines terminated '\n'; the data file has headers year,subject,winner,country , category respectively. when try import above command, year aren't showing in tables , visible rest of entries seems fine. can please suggest possible solution? my data.csv file contents like 1970 physics hannes alfven sweden scientist 1970 physics louis neel france scientist 1970 chemistry luis federico france scientist 1970 physiology ulf von euler sweden scientist open csv in text editor can see if formatting (the enclosers, delimiters) consistent. should able see double quotes on fields. double quotes enclosed '"' line that's missing in statement default parsing csv in mysql.

angularjs - display errors when the username doesn't fit pattern -

i'm using symfony , want display errors when username doesn't fit pattern, how can that? {{ form_widget(form.username, {'attr':{'pattern': '[a-za-z]*'} }) }} try add assert property in entity class. check out asserts : http://symfony.com/doc/current/validation.html and 1 regex : http://symfony.com/doc/current/reference/constraints/regex.html

c# - WinForms DataGridView throwing IndexOutOfRangeException -

first timer here on stack overflow (although i've been lurking ages). i'm developing little application contains 2 datagridviews . second datagridview filled via binding on list of custom class objects (the user presses button , list added new element , re-binded datagridview ). the problem i'm facing when have rows in datagridview (even if it's 1 row in fact...), if happen click 1 of rows select them, visual studio pops showing me debugger, because system.indexoutofrangeexception happened. it seems when user clicks on row, datagridview throws exception because says i'm trying access -1 index of array. the strange fact exception thrown even if don't have event listening row selection ! actually, there no event @ listening on datagridview . debugger isn't helping because it's throwing exception @ form constructor level (it's breaking @ application.run(new frmmain()); it's not telling me useful). can me please? if need code

regex - Repeat group to match multiple occurrences -

// example here: https://regex101.com/r/7kjjcr/3 i try match strings of type ([0-9]):(([0-9]+)-([0-9]+))+ whereas second group should repeatable, string 25:12-54,213-512,1231-2344 gets matched , group in (25, 12, 54, 213, 512, 1231, 2344) , string 25:12-34 should processed same way. i appreciate ideas!

drools - How to remove Rules which are having errors -

i having list of rules created dynamically. after created check whether there errors. cannot find way remove rules having errors dynamically. public void validaterule(list<string> rules, collection<abstractfact> facts) { kieservices kieservices = kieservices.factory.get(); kiefilesystem kiefilesystem = kieservices.newkiefilesystem(); int ruleindex = 0; (string rule : rules) { stringbuilder rulename = new stringbuilder("src/main/resources/rule"); rulename.append(ruleindex).append(".drl"); kiefilesystem.write(rulename.tostring(), rule); ruleindex ++; } kiebuilder kiebuilder = kieservices.newkiebuilder(kiefilesystem).buildall(); if (kiebuilder.getresults().hasmessages(message.level.error)) { //remove rules failing } kiecontainer container = kieservices.newkiecontainer(kieservices.getrepository().getdefaultreleaseid

sleep - PHP: run php code every 10 seconds -

i want run php code every 10 seconds, code have problem because functions random delay ( 2 seconds until 5 seconds ) i want exact run code on 10 seconds , passes function if time out or if more 5 seconds code : for($i=0;$i<=5;$i++){ echo date('y-m-d h:i:s').'<br />'; get_file_content('....'); //load file server ( make 2 seconds until 5 seconds ) sleep(10); // sleep 10 seconds } result 1 : 2017-04-14 15:25:35 2017-04-14 15:25:46 2017-04-14 15:25:57 2017-04-14 15:26:08 2017-04-14 15:26:19 2017-04-14 15:26:30 another result : 2017-04-14 15:32:22 2017-04-14 15:32:34 2017-04-14 15:32:44 2017-04-14 15:33:01 2017-04-14 15:33:17 2017-04-14 15:33:29 i want result ( load file make long time ) exact result : 2017-04-14 15:25:00 2017-04-14 15:25:10 2017-04-14 15:25:20 2017-04-14 15:25:30 2017-04-14 15:25:40 2017-04-14 15:25:50 how in lines of : for($i=0;$i<=5;$i++){ $previoustime = date(); echo date('y-m-d

java - No HTTP request is send from retrofit /Android/ -

i'm trying send data api android project using retrofit. seems work without errors no http request leaves application. can confirm wireshark screening , api console log. here example pseudo code of parts of application: // sample code findviewbyid(r.id.submit_btn).setonclicklistener(this); @override public void onclick(view v) { int = v.getid(); if (i == r.id.submit_btn){ intent intent = new intent(currentactivity.this, homeactivity.class); // myobj class storing several values , defined in separate class myobj obj = new myobj(** attributes here **); retrofit retrofit = new retrofit.builder() .baseurl("http://api.address") .client(new okhttpclient()) .addconverterfactory(gsonconverterfactory.create()) .build(); myapi api = retrofit.create(myapi.class); call<void> upload = api.newobj(obj); startactivity(intent); finish(

javascript - intergrate function readline from node.js module into read_line function to get user input -

//normal nodejs module readline const readline = require('readline'); //i want integrate readline module function read_line can user input use read_line ,but mind wrong. //i know reason js function not blocked function,but not familiar nodejs,how can block subsequent code run? function read_line() { var input; const rl = readline.createinterface({ input: process.stdin, output: process.stdout }); rl.on('line', function (input) { this.input = input; rl.close(); }); return input; } //it run right now,return undefined var s = read_line(); //i want console user input console.log(s); i want integrate readline module function read_line can user input use read_line ,i need help! readline asynchronous function rl.on('line', function (input) { this.input = input; rl.close(); }); the function wait ' line ' event triggered when call function read_lin

apache kafka - Validate request body in Nginx -

i using nginx producer receives requests , sends them kafka. for purpose found ngx_kafka_module nginx. is possible validate request body in nginx? because ngx_kafka_module puts in request body kafka. want remove fields don't exist in scheme.

elixir - How to keep a user subscribed to every chat it is following -

Image
thats messenger's facebook ui if implementing phoenix (elixir framework) would create 1 phoenix-channel 1 chat? which implies client (mobile, web etc...) have open 1 channel every chat suscribed at which implies if there 2000 chats suscribed at, have open 2000 channels (client load). would create 1 phoenix-channel 1 user? which implies client (mobile, web etc...) have open 1 channel , which implies every incoming message you'll have query al users in room (server load). in messaging apps, there 2 primary concerns. managing list of resources (users, rooms, etc) user subscribed too. typically displayed list in client. need render list , update thinks presence, new message alerts, , perhaps showing if use has open chat window. solution part similar regardless if users/rooms point-to-point or multi-user (rooms). the second concern displaying messages in individual chat windows open/visible. solution may vary depending on whether point-to-point or mult

hiveql - Hive multiple count (with and without DISTINCT) generate bad output -

i tried hive query select id,count(distinct case when unix_timestamp(m_date) between unix_timestamp(cast(date_sub(cast('2017-02-01' date),60) date)) , unix_timestamp(cast('2017-02-01' date)) m_date else 0 end) ,count(case when unix_timestamp(m_date) between unix_timestamp(cast(date_sub(cast('2017-02-01' date),60) date)) , unix_timestamp(cast('2017-02-01' date)) m_date else 0 end) db.table2 group id limit 10; and gives me smthg like: 111007001007633 1 1 111007001029793 1 1 111007001000521 1 11 111007001000794 1 1 111007001000273 3 13 111007001001032 1 1 111007001025874 1 4 111007001001792 1 7 111007001029181 1 1 111007001000141 16 96 but when add other count: select id,count(distinct case when unix_timestamp(m_date) between unix_timestamp(cast(date_sub(cast('2017-02-01' date),60) date)) , unix_timestamp(cast('2017-02-01' date)) m_date else 0 end)

c++ - Why does initialization of local static objects use hidden guard flags? -

local static objects in c++ initialized once, first time needed (which relevant if initialization has side effect): void once() { static bool b = [] { std::cout << "hello" << std::endl; return true; } (); } once print "hello" first time called, not if called again. i've put few variations of pattern compiler explorer , noticed of big-name implementations (gcc, clang, icc, vs) same thing: hidden variable guard variable once()::b created, , checked see whether primary variable needs initialized "this time"; if does, gets initialized , guard set, , next time won't jump out initialization code. e.g. (minimized replacing lambda call extern bool init_b(); ): once(): movzx eax, byte ptr guard variable once()::b[rip] test al, al je .l16 ret .l16: push rbx mov edi, offset flat:guard variable once()::b call __cxa_guard_acquire test

javascript - Using CoffeeScript to select default value for select box -

i'm trying set default value of select box. here current failed attempt. $("#event_location_country").on "load", () -> $(this).val("us") html <%= f.select :location_country, countries, {}, class: "form-control", required: true %> <%= f.label :location_country, class: "form-note" %> here html console: <option value="us">united states</option> obviously other countries of world want default on page load. also. there in easier way html? have tried this? <option value="us" selected>united states</option>

rspec - cucumber Scenario Outlines: how to skip step for one scenario -

i have strange situation have 2 examples. , have 1 step fill mandatory fields of user form need execute 1 example ("scope_self"). other should not run. is there way achieve this examples: | action | | "scope_self" | | "scope_new" | it easier option create separate scenario mandatory step. cleaner implementation. anyways, there way work in same scenario outline. split examples table two. give first table @mandatory tag has one example ("scope_self") . scenario outline: given ............ when ............. ............. @mandatory examples: | action | | "scope_self" | examples: | action | | "scope_new" | setup variable flag , set false. create tagged before hook @mandatory tag. in set flag variable true. in step definition code mandatory option check

html - Make fixed contents of column not span entire page width -

i've created plunkr show issue. i have following layout have menu on left , page contents on right. i'd fix menu so, if page contents result in vertical scrolling, menu not move. <div class="container-fluid"> <div class="row"> <div class="col-sm-2"> <div class="main-nav"> <!--menu here--> </div> </div> <div class="col-sm-10"> <!--page contents here--> </div> </div> </div> with following css: .main-nav { position: fixed; left: 0; right: 0; z-index: 1; } the menu has links i'd take width of col-sm-2 in, when position: fixed applied, takes entire page width. by setting .main-nav right:0; left:0; you're making span entire width. if remove these lines (you can set top:0; left:0; if want safe menu position) should work way want. .main-nav { position: fixed; z-index: 1;

wakanda import { RouterModule } from '@angular/router' -

i work tuto wakanda on https://wakanda.github.io/doc/#/tutorial?section=main-routing . when open app.module.ts, method import don't working, have message: cannot find module '@angular/platform-browser', @angular/core, @angular/forms, @angular/http, @angular/router. i have see in help/troubleshooting. ok.

google app engine - Serving GAE Django project static files another bucket, not defoult bucket -

i developing django project on gae(google app engine). python2.7 django1.8 i want upload image file django app google storage bucket.so create buccket on google , added these configurations settings.py default_file_storage = 'storages.backends.gs.gsbotostorage' gs_access_key_id = 'yourid' gs_secret_access_key = 'yourkey' gs_bucket_name = 'yourbucket' staticfiles_storage = 'storages.backends.gs.gsbotostorage' when run python manage.py collectstatic django collect static files , send gs bucket , when project running on local machine, django can find static files. when deploy project gae project works django can't find static files. there conflict. gae can serve static files in private bucket so, django(on gae) search static files in private bucket, not mybucket. i think, must modify app.yaml file in project. documentation tutorials not enough django on gae. i'd appreciate if help

c# - Signed apk is changing post parameters name -

Image
i have app , c# web api app calls using retrofit2. i'm facing problem while making post call api, parameter names in call changing "a" , "b" instead of there actual names. apiinterface: @post("users/add") call<string> createuser(@body usersignupmodel user); setting retrofit: gson gson = new gsonbuilder() .setlenient() .create(); retrofit = new retrofit.builder() .baseurl(configuration.api_url) .addconverterfactory(gsonconverterfactory.create(gson)) .client(get_httpclient()) .build(); usersignupmodel: public class usersignupmodel { public string username; public long phonenumber; } making request: usersignupmodel.username = username.gettext().tostring(); usersignupmodel.phonenumber = long.parselong(number.gettext().tostring()); client.createuser(usersignupmodel, callback); i have setup fiddler interc

security - SQL Server : throw exception if a row with column value is accessed -

in sql server 2014 , 2016, there way throw exception if row particular column value accessed? i accessed instead of returned because row participate in aggregation , not included in end result, when doing count of rows. for example, have row columns values: container: 'a' column1: 1 column2: 2 column3: 3 i want select column1 tbl throw exception, because access row container = "a" . select column1 tbl container <> 'a' should not throw exception. this different row level security in row level security silently filter out rows whereas want sql server throw exception.

c# - TreeViewItem not updating with bound ItemsSource, ObservableCollection, and INotifyPropertyChanged -

i know question has been asked lot after trying of different answers still can't work me. object i'm trying bind updating correctly in code behind thing isn't working children of treeviewitem updating when itemssource changed. it seems have set correctly maybe there how tying things making not work. using c# .net 4.5 wpf project in vs 2015 in windows 7. binding static classes' static property has method treeviewitem's itemssource , setting displaymemberpath. xaml: <!-- menu tree --> <treeview grid.column="0" x:name="menutree" background="transparent" borderthickness="0"> <!-- profiles tvi --> <treeviewitem header="{x:static loc:resources.profiles}" isexpanded="true"> <!-- color profile tvi --> <treeviewitem x:name="col

.net - Running multiple Task -

i'm trying execute multiple tasks @ same time private static void main(string[] args) { while (true) { console.foregroundcolor = consolecolor.white; console.write("enter number of cart: "); var numofcarts = convert.toint32(console.readline()); console.write("enter number of items: "); var numofitems = convert.toint32(console.readline()); runtasks(numofcarts, numofitems).wait(); } } public static async task runtasks(int numofcarts, int numofitems) { (var = 0; < numofcarts; i++) await task.run(() => { var color = (consolecolor) new random().next(0, 15); (var q = 0; q < numofitems; q++) { console.foregroundcolor = color; console.writeline("cart {0} : {1}", i, q); } }); } is correct implementation?

r - Creating a histogram from a vector of values -

Image
this vector of values > blufile2$vf2[blufile2$site == '2'] [1] 2.918530 2.925320 2.926210 2.918510 2.912310 2.908160 2.906990 2.906940 2.907420 2.909130 2.909860 2.911250 [13] 2.913300 2.911280 2.908770 2.907380 2.906760 2.905330 2.904420 2.904360 2.904270 2.905800 2.907190 2.909450 [25] 2.911710 2.910800 2.908600 2.906340 2.904930 2.904310 2.906800 2.902590 2.901020 2.900790 2.901090 2.903160 [37] 2.904630 2.905280 2.905690 2.905210 2.904590 2.904180 2.903830 2.904180 2.904630 2.904790 2.905080 2.906510 [49] 2.906590 2.908440 2.908000 2.909910 2.912100 2.912280 2.908980 2.907530 2.906780 2.906790 2.906070 2.906360 [61] 2.905570 2.905720 2.905030 2.904710 2.904710 2.904950 2.904390 2.904430 2.904170 2.903650 2.902390 2.901870 [73] 2.900900 2.900420 2.900860 2.902570 2.904360 2.908180 2.903970 2.901810 2.901150 2.900990 2.901170 2.901690 [85] 2.902480 2.902580 2.903010 2.903860 2.903950 2.904230 2.904690 2.905340 2.904810 2.905210 2.905620 2.905960 [9

dockerfile - Modifying a docker image -

i have started working on docker. have downloaded docker image , want change in way can copy folder contents local image or may edit file in image. i thought if can extract image somehow, changes , create 1 image. not sure if work that. tried looking options couldn't find promising solution it. the current dockerfile image this: from abc/def maintainer humpty dumpty <@hd> run sudo apt-get install -y vim add . /home/humpty-dumpty workdir /home/humpty-dumpty run cd lib && make cmd ["bash"] note:- looking easy , clean way change existing image , not create new image changes. first of all, not recommend messing other image. better if can create own. moving forward, can use copy command add folder host machine docker image. copy <src> <dest> the caveat <src> path must inside context of build; cannot copy ../something /something , because first step of docker build send context directory (and subdirectories) docke

java - Iterative Topological search (DFS) -

how can iterative dfs topological sort accomplished on directed acyclic graph? here vertex class vertex { list<vertex> adj = new arraylist<>(); char val; vertex(char val) {this.val = val;} } a recursive solution straightforward using set mark visited nodes , stack order vertices: list<vertex> sortrecursive(list<vertex> vertices) { deque<vertex> stack = new arraydeque<>(); set<vertex> visited = new hashset<>(); (vertex vertex : vertices) { if (visited.contains(vertex)) continue; sortrecursivehelper(stack, visited, vertex); } list<vertex> output = new arraylist<>(); while (!stack.isempty()) output.add(stack.removefirst()); return output; } void sortrecursivehelper(deque<vertex> stack, set<vertex> visited, vertex vertex) { visited.add(vertex); (vertex vv : vertex.adj) { if (visited.contains(vv)) continue; sortrecursivehelper(stack, visited, vv); } stack.addfirs

oracle - SQL PLUS-Displaying Tables -

i need write query display brand id, brand name, brand type, , average price of products brand has largest average product price i can avg price of brands entering: sql> select lgproduct.brand_id, brand_name, brand_type, round(avg(prod_price),2) boff.lgproduct, boff.lgbrand lgproduct.brand_id = lgbrand.brand_id group lgproduct.brand_id, brand_name, brand_type order lgproduct.brand_id; but if enter round(max(avg(prod_price)),2) error, suggestions? you can use window function rank mark ranks according average , filter top ranked rows: select * ( select lgproduct.brand_id, brand_name, brand_type, round(avg(prod_price), 2), rank() on ( order round(avg(prod_price), 2) desc ) rnk boff.lgproduct, boff.lgbrand lgproduct.brand_id = lgbrand.brand_id group lgproduct.brand_id, brand_name, brand_type ) t rnk = 1 order brand_id; if must use having try: select lgproduct

android - Long and lat values are accurate and correct, but blue circle is way off -

i developing location-based android "game" , task @ hand map , running accurate blue circle device's current location. using google api client, google maps api , fused location provider. should mention in china, in case factor. , app runs , without vpn on, keep on. at first thought long/lat values wrong begin with, hence wrong location on map print them in logcat , google them, found out quite accurate. example screenshot: blue circle shown, black circles location tried from. upon manually searching values online, correct locations black circles i tried on phone, same correct location , same wrong location(!). have tried gps settings, mobile data, wifi, bluetooth, etc. nothing seems improve situation. permissions asked , granted. however, asked try app bulgaria, , said works accurately on there. confused. ideas causing problem , how fix it? don't think it's problem code in case, there is. here mapactivity/ oncreate: @override protected void oncreat

Google Analytics - Interpreting sessions on a filtered view -

might wrong forum - please redirect if know correct path - thanks. in google analytics sessions attributed first page visited , not meant used on pageview level. that makes sense me on our full website view. however, have using view filters show traffic section /explore. know how should interpreting sessions reported on view? person wanted take total sessions view , divide total sessions whole site view acquisition traffic section. besides being inefficient way go - wrong? if anything, think tell percentage of total traffic section receives - not acquisition or 'first touch' traffic, right? because filtered view means traffic there treated first touch session , not compared larger site data. think i've answered own question already. if has wisdom add i'd appreciate it.

JavaScript predefined variable "name" -

Image
i learning javascript , discovered variable named name , predefined, sitting in global context. i created new, clear html file (have not written html in it). tested in chrome, opera , firefox, same... i wonder why that, beyond curiosity, there case when variable assigned value "string" , itself, have not touched it. why there? doing? window.name 1 of predefined property of global object window . since stephan bijzitter wants answer more details, here is. section 7.3.1 of current living html standards states window.name property of global object window returns name of window , can set, change name. the name attribute of window object must, on getting, return current name of browsing context; and, on setting, set name of browsing context new value. the name gets reset when browsing context navigated origin.

php - strange output with bootstrap table in while loop -

Image
i try make while loop boostrap table gives me strange output here image as see after second loop output outside of selected div. also first row of table placed right.the rest of rows shown seen in image here code <?php $x= 1; while ( $x <= $_session['noc']){ require ('conntodb.php'); $stmt= $conn->prepare('select catname food_category st_id= :st_id , catcount= :catcount' ); $stmt->bindparam(':st_id',$_session['st_id']); $stmt->bindparam(':catcount', $x); $stmt->execute(); $catres= $stmt->fetchall(pdo::fetch_assoc); foreach($catres $row) { echo "<h3>" . $row['catname'] . "</h3>"; } echo "<div class='table-responsive'>" ."<table class='table table-condensed'>" ."<thead><tr><th>Πίατο</th><th>Τιμή<

scala - spark-submit --packages is not working on my cluster what could be the reason? -

i trying run spark sample postgress database read in spark application.i gave spark command line arguments spark-submit --packages org.postgresql:postgresql:9.3-1101.jdbc41.jar , still getting class not found exception. can please in solving issue ? it more helpful if can give code snippet , explain steps of how building jar , running on cluster. also, mode of execution (client /cluster)? because possible reasons classnotfoundexception can specific how making spark-submit call. following code worked me. can give try. created below scala object file inside scala maven project in eclipse: code : import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.spark.sql._ import org.apache.spark.sql.sqlcontext import org.apache.spark.sparkconf object sparkpgsqlconnect { case class projects(id:int, name:string, address:string) def main(args:array[string]) { val conf = new sparkconf().setmaster(“local[*]”).setappname("postgresqlc

javascript - Wait until <script> finishes loading before executing next step -

i trying code execute in correct order. first need add google maps code dom using: $('body').append('<script defer src="https://maps.googleapis.com/maps/api/js?key=y2e3g8n-jat0gpxpuhr9mq8zj8uysbv4&callback=createmap"></script>'); then need reset center of map when new selection made list: map.setcenter({lat: latitude, lng: longitude}); right setcenter() doesn't work first time run it, presumably because callback function createmap() has added dom, script has not finished. there way can wait until script finishes executing before running setcenter()? the callback createmap "wait until script finishes executing before running setcenter()". that's callback used for. without showing actual code (and not in comment) of trying , how, can't you. now understand if code super secret can't show us. in case re-read part of starts " without showing actual code"

image - Cannot Upload to Imgur PHP -

this code works, has not been working , don't know why... never touch it, suspect ever since reinstalled google chrome has had sort of effect. here error, file_get_contents( http://api.imgur.com/3/image ): failed open stream: http request failed! http/1.0 403 forbidden in c:\xampp\htdocs\project\administrator\index.php on line 92 if (isset($_post['change1'])) { $image = base64_encode(file_get_contents($_files['image1']['tmp_name'])); $options = array('http'=>array( 'method'=>"post", 'header'=>"authorization: bearer 5ac2b1b64fdfea5e062d5c477a49c68b69993213\n". "content-type: application/x-www-form-urlencoded", 'content'=>$image )); $imgururl = "http://api.imgur.com/3/image"; $context = stream_context_create($options); $response = file_get_contents($imgururl, false, $context); $response = json_decode($response); db::que

data modeling - Google Datastore deletes and multiple parents -

i have data model in entity a contains references 2 other entities, b , c . if either b or c deleted, want a deleted. when creating a , it's possible name either b or c parent. possible name both b , c parents if either b or c deleted, a deleted? in more concrete terms, search results, result might have both category , region , web page birds in north america. result stored reference category , region. later, want delete category birds , want result deleted. likewise, delete region north america , want result deleted. i hate go on @ such length such trivial scenario. doesn't seem covered in of datastore documentation. missing? flawed data model? single-parent limitation: a child can have 1 parent in datastore. in other words, a can child of b or c , not both. of course, parent can have multiple children, though. alternative: you can use keyproperty repeated=true argument , store many entity keys on it. in python, this: class a(n

In sonarqube 5.6.6. I am unable to register secret key -

i following instructions here: https://docs.sonarqube.org/display/sonar/settings+encryption i in step 2. have created secret file custom path. set sonar.secretkeypath property appropriately , rebooted server. when navigate config->general->security->encryption tab still says "secret key required able encrypt properties" i see no mention in log (running @ debug level) mentioning if trying use secretkeypath or if succeeded. i can't seem past point. suggestions? my problem turned out because windows server not seem allow services access windows directory. trying "hide" secret file here. though user had permissions, else blocking it. moving non-system controlled directory fixed problem

javascript - Unable to print an array of numbers in ascending order when the list is generated -

my code generates matrix of numbers when ok symbol selected. but, want add sorting functionality relist matrix in ascending order when "by result" button selected. suggestions on how can ? html code <div class="rightdiv"> <div id = "pastcalcblock"> <h3> past calculations </h3> <input type = "text" size = "1" id = "text1"/> <input type = "text" size = "1" id = "text2"/> <input type = "text" size = "1" id = "text3"/> <input type = "text" size = "1" id = "text4"/><br> <input type = "button" value = "ok" id = "operation" onclick = "display()"/> <div id = "resulttab"> sort<br> <input type = "button" value =