Posts

Showing posts from May, 2015

Rename an Azure Function -

Image
how rename azure function ? i want replace default 'httptriggercsharp1' name own. @ moment unfortunately name included in function url , there no option change it: https://functions-xxx.azurewebsites.net/api/httptriggercsharp1 the ui not directly support renaming function, can work around using following manual steps: stop function app. this, go under function app settings / go app service settings, , click on stop button. go kudu console: function app settings / go kudu (article that ) in kudu console, go d:\home\site\wwwroot , rename function folder new name now go d:\home\data\functions\secrets , rename [oldname].json [newname].json then go d:\home\data\functions\sampledata , rename [oldname].dat [newname].dat start function app, in same place stopped above in functions ui, click refresh button in top left corner, , renamed function should appear note: doing can lose historical logging. github issue renaming azure function

android - Job Service is destroying after some -

i have implemented jobservice in application don't know reasons stopping suddenly, , changing job time dynamically based on req. here code i calling startservice(context context) when interval changes public class gcmlocationservice extends jobservice { @override public boolean onstartjob(jobparameters job) { sendlocationtoserver(); return false; } @override public boolean onstopjob(jobparameters job) { return false; } public static void startservice(context context) { // create new dispatcher using google play driver. integer locationinterval = integer.parseint(sessionmanager.getinstance(context).getpreflocationinterval()); int min = 10; int max = 10; if (locationinterval > 2) { max = locationinterval * 60; min = (locationinterval - 1) * 60; } clog.e("gcmintentservice taskservice", "111 locationinterval------->...

Format string with possible non-existing arguments in Python -

i've searched this, i'm not sure how word i'm asking, it's difficult find whether has posted solution. i'd format variables descriptive string. example: 'my name {name}. eat {food}.'.format(name='ben', food='pizza') gives (obviously): 'my name ben. eat pizza.' but i'd omit entire second sentence in case food none or '' (empty). so: 'my name {name}. eat {food}.'.format(name='ben', food='') gives: 'my name ben.' is there can wrap around second sentence make conditional on there being non-blank value of food ? can in inelegant way joining strings , suchlike, looking more pythonic solution. perhaps need subclass formatter , i'm not sure start that. (as aside, know winamp used able in format strings depending on whether tags present or not in mp3 file.) its question, way work around food = "pizza" food = "i eat {food}".format(food = food) ...

javascript - I can't use multiple jquery versions -

this question has answer here: can use multiple versions of jquery on same page? 7 answers i want use 2 different jquery version on 1 page codes: <!----- mobile menu starts -----> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="style/mobile_menu.css"> <script type="text/javascript"> var jquery_1_11_0 = $.noconflict(true); </script> <!----- mobile menu ended -----> <!------ post slide starts ------> <link rel="stylesheet" type="text/css" href="./style/post_slide_style.css"> <script src="js/jquery.v1.5.1.min.js"></script> <script type="text/javascript"> var jquer...

postgresql - Why can't I extend docker postgres image to create extra database and user -

i'm using docker postgres 9.4.5 images , extendeding using init.sh copied /docker-entrypoint-initdb.d in docker container. trying create database , non admin user access both $postgres_db 2nd database creating. tried following $postgres_user user myadmin , $postgres_db database mydb1 passed through docker-compose environment: #!/bin/bash set -e psql -v on_error_stop=1 --username "$postgres_user" <<-eosql create user userx password '$postgres_password'; create database diagnostics; grant privileges on database userx $postgres_db; grant privileges on database userx mydb2; eosql this gave me error: postgres_1 | create database postgres_1 | postgres_1 | create role postgres_1 | postgres_1 | postgres_1 | /docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-user-db.sh postgres_1 | fatal: database "myadmin" not exist postgres_1 | psql: fatal: database "myadmin" not exist docker_postgr...

javascript - How do i cancel a timeout if a button is pressed? -

i have layout buttons, , want after 1 of them pushed cancel timeout, code have press 1 of buttons , redirects me activity timer dons't stop , after 3 seconds redirects me again, how cancel timer if 1 of buttons pressed? timer: int timeout = 3000; seconds timer timer = new timer(); timer.schedule(new timertask() { @override public void run() { finish(); intent homepage = new intent(act1.this, act2.class); startactivity(homepage); } }, timeout); check documentation , find timer.cancel() . keep reference timer , call whenever want make stop. void cancel() terminates timer, discarding scheduled tasks. example: mbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { mtimer.cancel(); } });

Can I enter password once for multiple mysql command line invocations, where the queries are not known upfront? -

you can avoid re-entering mysql command line password putting queries file. in case, later queries not determined until after first queries have finished. this happens in non-interactive script running mysql console not option. is there notion of session mysql command line interactions? or can set listen commands on local unix socket (the output required returned)? or that? user @smcjones mentions using .my.cnf file or mysql_config_editor. suggestions, give +1 vote him. another solution put credentials in file of choosing , specify file when invoke mysql tools: mysql --defaults-extra-file=my_special.cnf ...other arguments... and finally, completeness, can use environment variables options, host , password. strangely, not user. see http://dev.mysql.com/doc/refman/5.7/en/environment-variables.html export mysql_host="mydbserver" export mysql_pwd="xyzzy" mysql ...other arguments... i don't recommend using environment variable password, s...

excel - Run Python script via VBA and give name and path of active workbook? -

edit: same question rewrote it, more legible. i tried post: how call python script on excel vba? and post: run , execute python script vba and post: how can call python program vba? but none of answers works me , have no idea i'm doing wrong. problem 1: want run pythonscript vba excel. excel file doesn't have home place (can on desktop). code (want to) use: dim ret_val ret_val = shell("c:\python27\python.exe \\10.31.13.22\shareddocs\3 - technical\13 - reports & templates\13 - description\descriptiontodatabase.py") the pythonfile has same path on server. cannot see wat wrong here? black python screen. in python file call workbook , correct sheet: book = xlrd.open_workbook("//10.31.13.22/shareddocs/3 - technical/1 - projects/0 - internal/rpa 138 - engineering software/testchipdescription/upload database/testchipdescription-template-10-11.xltm") sheet = book.sheet_by_name("database") at moment excel workbook path hardcoded ...

JsonMappingException on a Hadoop program with Eclipse -

seeing jsonmappingexception on simple hadoop program when running in eclipse(kepler) cloudera quickstart vm exception in thread "main" java.lang.noclassdeffounderror: org/codehaus/jackson/map/jsonmappingexception @ org.apache.hadoop.mapreduce.job$1.run(job.java:595) @ java.security.accesscontroller.doprivileged(native method) @ javax.security.auth.subject.doas(subject.java:415) @ org.apache.hadoop.security.usergroupinformation.doas(usergroupinformation.java:1693) @ org.apache.hadoop.mapreduce.job.connect(job.java:593) @ org.apache.hadoop.mapreduce.job.submit(job.java:581) @ org.apache.hadoop.mapreduce.job.waitforcompletion(job.java:612) @ maxtemperature.main(maxtemperature.java:28) caused by: java.lang.classnotfoundexception: org.codehaus.jackson.map.jsonmappingexception @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivilege...

JAVA - subList returns empty lists inside FOR loop -

i'm facing following issue. have list total (size: s) , need split in n contiguous blocks. here code: int start_index, end_index; for(int = 0; < n; i++){ start_index = (s/n)*i; end_index = start_index + (s/n) - 1; list<string> subblock = total.sublist(start_index, end_index-1); system.out.println("block "+i+": "+start_index+" "+end_index); system.out.println("block "+i+": "+subblock .tostring()); } indexes correct: first system.out.println works fine. subblock empty. sublist call outside loop works fine: example, total.sublist(0,2) returns first , second element expected. is there i'm missing here? i think made mistake in calculation of start , end index. try following code. for(int = 0; < n; i++){ start_index = (s/n)*i; end_index = start_index + (s/n); list<string> subblock= (total.su...

regex - removing words with numbers and letters from command line input in python 3: error -

i'm having trouble getting regex remove words contain digits , letters. keep getting "typeerror: expected string or buffer" can provide appreciated. $ testing abc sorted_word = re.sub("\s+\d\s+", "", word_sort).strip() file "/usr/lib64/python2.6/re.py", line 151, in sub return _compile(pattern, 0).sub(repl, string, count) typeerror: expected string or buffer #! /usr/bin/env python import os import sys import re in_list = sys.argv def word_sort(in_list): word_sort = " 1a " word_sort = sorted(in_list[1:], key=len) in word_sort: punctuation = '.',',',';','!',' / ','"','?' #strips punctuation words if in punctuation: #removes punctuation word_sort = word_sort.replace(i," ") word_sort= sorted(word_sort, key=lambda l: (l.lower(), l)) sorted_word = " 1a " sorted_word = re.sub("\s+\d\s+...

regex - Python: How do I continue searching a list for different elements efficiently? -

i have many lists of strings i've scraped , parsed , find strings in these lists using regular expressions. each string different, appear sequentially in lists. i.e. first string i'd appear before second string, second appear before third string, , on. however, can't use index because number of elements in between vary between lists. ex. scraped these strings , stored in following lists: personal_info = ["name: john doe", "wife: jane doe", "children: jenny doe", "children: johnny doe", "location: us", "accounts: boa", "accounts: chase", "house: own", "car: own", "other: none"] personal_info2 = ["name: james lee", "location: can", "accounts: citibank", "house: rent", "car: own", "other: none"] and grab elements starting name, location, , house, may or may not have multiple elements in between. location af...

Drupal 8 - Clone nodes to node translation -

i have website in english. i need put nodes of contentypes language client responsible entering , modifying data. i know how go through nodes, know how create translation of node not know how duplicate fields of node in translation. how it? with code create translation node $node = \drupal\node\entity\node::load($value_rowtotranslate->nid->value); $translation = $node->addtranslation('es'); $translation->title = "titulo traducido"; $translation->field_1 = "dasdas" $translation->field_2 = "xxxxxxxxx" ... $translation->field_n = "xxxxxxxxx" $translation->save();

ruby on rails - Design where all associations tie to a team / community -

i'm interested in hearing how people design , set i'm inexperienced scenario. take example rails application allow people create teams. each team can have many projects, comments, members , other resources. how structure avoid deep linking f.ex: nested_comment.root_comment.project.team i see becoming problematic quite quickly, causing both performance issues , in general not comfortable work with. routes become complicated if team id present always, f.ex: example.com/:team_name resources :teams resources :projects resources :comments end end i know can shallow nesting, issue see here can use slug still require deep linking. furthermore shallow won't avoid going more 1 level deep, document recommends not doing. resources should never nested more 1 level deep. what potentially f.ex still needs 2 levels deep. resources :teams resources :projects, shallow: true resources :comments end resources :comments, only: [:show, :edit, :update, :...

javascript - printing data under / hidden with html hover code option -

how can print numbers on webpage require hover on them view ones found on better business website. example: http://www.bbb.org/raleigh-durham/accredited-business-directory/roofers i go website have hover on phone icon view phone number. how can make these phone numbers visible @ once can print them on 1 document? thanks not stackoverflow question, here solution copy&paste line url after page loaded: javascript:jquery('.phone-link div:first-child').hide();jquery('.phone-link div:last-child').show() (include javascript: @ beginning). note - need replace current url ( www.bbb... ) 1 in code-block above.

.htaccess - Redirect already Rewriten URL with parameter -

in order edit actual url structure. need redirect "old" links keep incoming links active. everything working fine, doesn't work when "old" links have parameters. here first part of .htaccess (which working) : options +followsymlinks -multiviews rewriteengine on # rewrite "old" url "/models" "/models-pictures" rewriterule ^/?models/?$ /models-pictures [r=301,ne,l] # new redirection rewritecond %{request_uri} /models-pictures/?$ [nc] rewriterule . models.php [l] and second part not redirecting # rewrite "old" url "/models/[name]-pictures" "/[name]-pictures" rewriterule ^/?models/([a-z\-a-z]+)-pictures/?$ /%1-pictures [r=301,ne,l] <- not working # new redirection rewritecond %{request_uri} /([a-z\-a-z]+)-pictures/?$ [nc] rewriterule . orderby.php?model=%1 [l,qsa] # new redirection rewritecond %{request_uri} /([a-z\-a-z]+)-pictures/([a-z\-a-z]+)/?$ [nc] rewriterule . p.php?model=%1...

How do I add an input form when clicking an HTML link using javascript? -

this question has answer here: using quotation marks in javascript innerhtml 4 answers i want have div containing link. when clicked, link should replaced <input type="text"> , doesn't work. any other html code works, reason can not replace link input: function working() { document.getelementbyid("working").innerhtml = "<h1>test</h1>"; }; function notworking() { document.getelementbyid("notworking").innerhtml = "<input type="text">"; }; <div id="working"> <a onclick="working();" href="#">this works!</a> </div> <div id="notworking"> <a onclick="notworking();" href="#">this doesn't!</a> </div> <p> notice entire code doesn't work unl...

javascript - angular ui grid single click with editableCellTemplate -

i'm having trouble getting angular ui grid enter editing mode in cell on single click when im using celltemplate/editablecelltemplate. here plunker demonstrates code have , problem i'm having. if click on cell under hte name column, notice single click, cell under type column double click, needs single click. steps reproduce: click on cell under id column click cell under name column (notice edit on single click!) click cell under id column again or in white space of grid/or off grid click on cell under type column (should single click edit mode, requires double click) working plunker here `var app = angular.module('app', ['ngtouch', 'ui.grid', 'ui.grid.edit',` 'ui.grid.resizecolumns', 'ui.grid.movecolumns', 'ui.grid.autoresize', "ui.grid.pagination", "ui.grid.edit", "ui.grid.cellnav", "ui.grid.selection", "ui.grid.pinning"]); //draggablerows? app.controll...

karma jasmine - How to wait for DOM elements to finish rendering in Angular 2 Unit Tests -

i have following test. focuses html element, sets it's value , triggers blur event handler. blur event triggers validation check which, if invalid should disable save button. currently during test run failing, if set break point , walk through it, set disabled attribute on save button , work. based on guess whenstable promise not waiting elements finish re-rendering completely. threw settimeout wait whole second before checking button state, still isn't working me. is there function on componentfixture class wait elements re-render before triggering callback or resolving promise or whatever? fixture.whenstable().then(() => { inputhomephone.nativeelement.focus(); setinputvalue(inputhomephone, "123"); inputhomephone.nativeelement.blur(); fixture.detectchanges(); return fixture.whenstable(); }) .then(() => { settimeout(() => { ...

css - JavaScript : mouseout event in Popup Bubble causing children to hide -

i have problem event propagation. when mouseover child element in description div, description div mouseovered child gets display:none; . after event occurs selected child remain invisible until page refresh. here "working" demo: jsfiddle i believe main cause of somewhere between lines 8-15 of js code on jsfiddle the mouseout triggers in case of not finding description div under mouse cursor. i have found not elegant workaround adding :before description div in css. can find workaround commented in jsfiddle css section. unfortunately prevents of doing in popup bubble (like href clicking). want keep simple , functional, without workarounds. use mouseleave , target instead of e.target. e.target equal hovering. https://jsfiddle.net/gfvq9yvp/6/ e.target.children[a].addeventlistener("mouseleave",function(e){ this.style.display="none"; }, false);

php - How to access object properties with names like integers? -

how access php associative array element output is: [highlighting] => stdclass object ( [448364] => stdclass object ( [data] => array ( [0] => tax amount liability ....... i want access string value in key [0]. want like: print myvar->highlighting->448364->data->0 but 2 numerals/integers there seems problem. edit: i give bit of history here myvar. using json_decode() like: $myvar = json_decode(url) php has share of dark alleys really don't want find inside. object properties names numbers 1 of them... what never told you fact #1: cannot access properties names not legal variable names easily $a = array('123' => '123', '123foo' => '123foo'); $o = (object)$a; echo $o->123foo; // error fact #2: can access such properties curly brace syntax $a = array('123' => ...

angular - File Name and Extension not respected when sent from .NET Web API to Angular2 App -

the use case : input field receives .rdl file on actions performed. file gets sent .net web api service gets processed , once processing complete, returns processed file user. client implemented using angular2. view template <h3 align="center" class="title" onclick="window.location.reload()"> converter utility </h3> <div align="center"> <input type="file" accept=".rdl" (change)="changelistener($event)"/> <br> <br> <input id="replace" name="replace" type="checkbox"> replace file?<br> <label></label> <br> <br> <input type="button" value="process" (click)="doprocess()" /> <br> <br> </div> component import { component } '@angular/core'; import { mainservice } './services/main.service'; @component({ select...

string - how to count repeated characters in text file using python -

i beginner in python , trying make small program in python count repeated character in text file here code import string def count_char(text,char): count = 0 c in text: if c == char: count +=1 return count filename = raw_input("enter file name:") open(filename) f: text=f.read() print(count_char(text,"r")) but prints output as >> 0 please tell me wrong code ? move return outside of loop. it's going through 1 iteration.

c# - Serializing multiple DateTime properties in the same class using different formats for each one -

i have class 2 datetime properties. need serialize each of properties different format. how can it? tried: jsonconvert.serializeobject(obj, formatting.none, new isodatetimeconverter {datetimeformat = "mm.dd.yyyy"}); this solution doesn't work me because applies date format properties. there way serialize each datetime property different format? maybe there attribute? newtonsoft.json has structure that's bit difficult understand, can use following custom converter want: [testmethod] public void conversion() { var obj = new dualdate() { dateone = new datetime(2013, 07, 25), datetwo = new datetime(2013, 07, 25) }; assert.areequal("{\"dateone\":\"07.25.2013\",\"datetwo\":\"2013-07-25t00:00:00\"}", jsonconvert.serializeobject(obj, formatting.none, new dualdatejsonconverter())); } class dualdate { public datetime dateone { get; set; } public datetime...

c# - Sending image over socket and saving it on the server -

Image
i'm facing problems project , hope able identify problem i'm not capable see myself. i'm trying send picture c# client (windows) c server running on linux system. i'm transmitting image binary data via tcp socket , works fine, problem when i'm writing received buffer on linux system fwrite, seems information present in buffer, not written or written corrupted value file. e.g. i'm trying send picture here: and 1 on server: the client: public static void sendpicture(image image) { byte[] imagebytes; using (memorystream s = new memorystream()) { image.save(s, imageformat.jpeg); imagebytes = s.toarray(); s.close(); } if (imagebytes.length <= 5242880) { try { networkstream stream = client.getstream(); file.writeallbytes("before.jpg", imagebytes); //send image size ...

What exactly does the --release build switch do in cordova? -

what --release build switch in cordova? ask because after creating simple cordova app, have found debug builds run fine on testing phone while release build apks fail install, claiming corrupt. i have tried zip aligning , signing apk. in every instance same code runs debug mode app fails "release mode app". what process cordova differently cause this? thank you.

html - How to resize form text field inputs with Bootstrap? -

Image
so have form looks this: except on 1 line. that, i'm trying resize text fields make them smaller. basically, i'm adding col-md-1 div encapsulates input tag follows: <div classname="form-group margin-right-5 col-md-1"> <input classname="form-control" type='text' placeholder='company' /> </div> but when that, this: why happening? because col-md-1 longer current text field? there other way can make input fields shorter fit on 1 line? i'm new bootstrap, appreciated, thanks!! [edit] reference, code structured as: <td> <div classname="row padding top"> <div classname="row"> <form action="" classname="form-inline form margin-bottom-5"> <div classname="form-group margin-right-5 col-md...

include exclude filters from a elasticsearch query -

i new elasticsearch , want know if there way to include or exclude filters when preforming query. way write 1 query , not multiple queries. yes can filter tag within query . like: "query": { "bool": { "filter": [ { "term": { "color": "red" }}, { "term": { "brand": "gucci" }} ] } } but might want have @ post filtering well. there differences in performance, when filtering within , out of query . so handy. use filter context , when comes structured data.

python - Why "CopyFrom" is used during the creation of the constant Tensor? -

during creation process of constant tensor there following line : tensor_value.tensor.copyfrom( tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) copyfrom creates copy of newly created tensor proto. looks waste of resource coping since make_tensor_proto , according doc, creates new object. more sufficient, next: tensor_value.tensor = tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape) this should not create new object, plus valid usage of oneof protobuf fields. you cannot assign proto field of proto explained in doc: https://developers.google.com/protocol-buffers/docs/reference/python-generated you cannot assign value embedded message field. instead, assigning value field within child message implies setting message field in parent. if remove copyfrom, following error: attributeerror: assignment not allowed field "tensor" in protocol message object.

activemq - HornetQ support in JBoss7 eap -

in jboss7 eap, activemq default messaging system. older hornetq still supported. if want war use hornetq instead of activemq, possible? jboss eap 7 use apache artemis message broker. hornetq not supported eap 7. experience, tested hornetq clients, version 2.3 or later. far know, red hat support use of artemis in eap 7 hornetq client runtime eap 6. however, not think product combination supported in next eap version(release 8 or later). what propose migrate existing hornetq configuration on jboss eap 6 artemismq on jboss eap 7. info, jboss eap 7 shipped migration tools, built move configuration eap 6 eap 7. more info, please have on official migration documentation .

c# - Create type by runtime type info using Activator<T>.CreateInstance() -

intro to create instances on fly via reflection, use: activator.createinstance the downside this returns object , while need concrete type , since know runtime type can't cast. to accomplish this, can use activator.createinstance<t> which returns t , since don't know t @ compile time, no use either. @ first glance anyway. currently i'm using dynamic this, in special kind of way: //i pass runtimetype itopsecret // runtimetype implements itopsecret dynamic concretetypeinstance = activator.createinstance(runtimetype); // have empty runtimetype. // can use passed runtimetype fill newly created object concretetypeinstance = runtimetype // call applycurrentvalues. // can't pass runtimetype, because it's itopsecret , // ef doesn't figure out actual runtime type. context.applycurrentvalues(concretetypeinstance) before line sanity checks performed. example know runtime type itopsecret @ point, otherwise statement can't hit. so pr...

android - Trouble with Crop Intent -

i having trouble crop intent . can take photos, when code gets crop function , tries make transaction onactivityresult function error: 11-17 19:38:13.383 1335-2873/? e/javabinder: !!! failed binder transaction !!! (parcel size = 635380) 11-17 19:38:13.384 1335-2873/? w/activitymanager: exception in new application when starting activity com.tedosoft.carmaintaintance/com.tedosoft.carmaintenance.addeditpart android.os.transactiontoolargeexception: data parcel size 635380 bytes @ android.os.binderproxy.transactnative(native method) @ android.os.binderproxy.transact(binder.java:503) @ android.app.applicationthreadproxy.schedulelaunchactivity(applicationthreadnative.java:826) @ com.android.server.am.activit...

javascript - Node async and exception handling -

i'm using async waterfall. when 1 of functions calls callback(err), custom async callback called. inside of there throw error, hoping caught in try block around async, that's not happening. try { async.waterfall([function1, function2], myasynccallback); } catch(err) { console.log("this code never executed."); } var function1 = function() { ... //some error occurs: callback(new error(errmsg), errmsg); ... } var function2 = function() { ... } function myasynccallback(err, result) { console.log("this code gets executed."); if (err) { console.log("this code gets executed too."); throw new error("i want error caught @ top around catch around async.waterfall()"); } } https://runkit.com/imjosh/async-try-catch/2.0.0 var async = require('async'); try { async.waterfall([function1, function2], myasynccallback); } catch(err) { errorhandler(err); } function funct...

python - List Comprehension returns empty list -

i'm trying query mongodb database , throw 2 sets of results ('_id' , 'team') 2 separate lists. import pymongo client = pymongo.mongoclient('localhost:27017') db = client['db_name'] query = {'team': {'$exists': 1}} projection = {'_id': 1, 'team': 1} data = db['collection_name'].find(query, projection) # line 9 id_list = [value dict in data key, value in dict.iteritems() if key == '_id'] teams_list = [value dict in data key, value in dict.iteritems() if key == 'team'] print id_list print teams_list client.close() for code above, 'id_list' expected 'teams_list' empty. when put 'teams_list' before 'id_list' expected 'teams_list' output , 'id_list' empty. , when repeat data call (line 9) in between 2 list comprehensions expected output both lists. any idea why happening? you need define data as: data = list(db['collectio...

Excel VBA: Comparing two excel sheets and conditionally formatting based off extra data from sheet 2 -

Image
i'm sort of creating dashboard view have formatting determined other sheets on file. dashboard have checkbox indicates sheet read from. i'm still working on first sheet. basically dashboard has names placed in different parts of sheet , second sheet have corresponding names in spreadsheet fashion. i'm trying write compares range of names list of names on sheet two, if names match, want read number next name on sheet 2 , calculate format name on sheet 1. here sample code dim processes range dim applications range dim appcount range dim k integer set process = worksheets("dashboard").range("a4:f17") set applications = worksheets("application").cells(2, 1) set appcount = worksheets("application").cells(2, 2) k = 0 = 1 process.rows.count j = 1 process.columns.count if process.cells(i, j) = applications.offset(k, 0) if appcount.offset(k, 0) >= 40 process.cells(i, j).interior.colorin...

rails populate field in model depending on another field -

i need order days name, have table field called day_name, select can sunday, monday, etc. so thinking add field table (day_order) when enters sunday on day_name populates day_order 1, when enters monday in day_name, don't know how populate day_order depending on day_name. there option, should when picks "sunday" in day_name, store 1 instead, , change again when read table. don't know how neither. so need help, trying order array storing days in order , try make custom order, think easy (and faster) other way model. can sort easily. pd: i'm looking @ before_save filter in model i solved it, finally added integer day_order field timetables table. , made presence mandatory validates :day_order, presence: true then limited in model number can added field with def day_order_enum [1, 2, 3, 4, 5, 6] end and next step doing before_validation method before_validation :set_day_order def set_day_order if s...

tomcat - How to map the IP address of docker container to another container dynamically -

i have few docker containers running in host. have scenario need map ip address of 1 container configuration file available in container. know can ip address of container using docker inspect [container] command. assumes ip address assigned dynamically every time restart container. every time need change ip address in container. possible have static ip container or can use ip address of host instead of ip address of container. new docker world. also have case need map ip address container running in host. example, have redis container running in hosta , tomcat container running in hostb. in order communicate redis tomcat, need map ip address , port of redis in tomcat container. how can achieved in docker ? you can run linked containers in documentation - linking containers : docker run -itd --name=container4 --link container5:c5 image docker run -itd --name=container5 --link container4:c4 image and ping second container by alias (c5) : docker attach container4 ...

arrays - (Java) A search similar to Binary but using /3 instead of /2 -

i have created program compares different search methods search random int value 0-999 sorted array 0-999. have created binary search works , after doing decided try create search which, instead of splitting values half, splits them 1/3 , 2/3 depending. if have {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} , looking 10 go above {6,7,8,9,10,11,12,13,14,15} {10,11,12,13,14,15} {10,11} simple {10} , return index of value. i have: int looptotal3 = 0; for(int y = 0; y < 1000; y++){ system.out.println("reference1"); int first = 0; int last = array0through999.length - 1; int third = (array0through999[0] + array0through999[999]) / 3; int findthis3 = rand.nextint(1000); int loop3 = 0; while(first <= last){ system.out.println("reference2"); loop3++; if (array0through999[third] < findthis3){ system.out.println("reference3"); fi...

html - Why does first slideshow image click skip transition and go straight to image? -

in slideshow shown below, there 2 images available. once clicking on button second image after first opening page, there sudden jump image no 5 second transition expected. when doing this, notice #slideshowimage-2 shown in url (doing offline) after clicking button image. here's code below: css: .slideshowcontainer { width:800px; height:400px; margin-left:auto; margin-right:auto; margin-top:0px; text-align:center; overflow:hidden; position:relative; top:30px; border-style:solid; border-width:10px; border-color:white; border-radius:15px; } .imagecontainer { width:1800px; height:400px; clear: both; position:relative; -webkit-transition:left 3s; -moz-transition:left 3s; -o-transition:left 3s; -ms-transition:left 3s; transition:left 3s; animation:scroller 16s infinite; } @keyframes scroller { 0% {transform:translatex(0);} 31.25% {transform:translatex(0);} 50% {transform:translatex(-800px);} 81.25% {transform:translatex(-800px);} 100% {transform:translat...

python - Cannot change directory to a script using bash - cron -

this question has answer here: python: change scripts working directory script's own directory 4 answers i have script runs multiple instances of python scrapy crawlers, crawlers int /root/crawler/batchscript.py and in /root/crawler/ have scrapy crawler. crawlers working fine. batchscript.py looks this, (posting relevent code) from scrapy.settings import settings scrapy.utils.project import get_project_settings amazon_crawler.spiders.amazon_scraper import myspider process = crawlerprocess(get_project_settings()) when run batchscrip.py inside /root/crawler/ directory scraper runs fine. but when run outside of directory using python /root/crawler/batchscript.py not run intended, (settings not imported correctly), get_project_settings() empty. i have tried creating bash script too create bash script called batchinit.sh #!/bin/bash alias batchs...

php - Google Distance Matrix API error Invalid Request -

i have following code create request in php response google distance matrix api: //get info google $map_url = 'https://maps.googleapis.com/maps/api/distancematrix/json'; $midnight = strtotime('tomorrow midnight'); $params = array( 'units' => 'metric', 'origins' => str_replace(' ', '+', str_replace('.', '', $arr['address'])), 'destinations' => str_replace(' ', '+', str_replace('.', '', $rink_arr['address'])), 'traffic_model' => 'best_guess', 'departure_time' => $midnight + $rink_arr['avg_time'], 'key' => 'api_key' ); //get data $url = $map_url.'?'.http_build_query($params); $json = file_get_contents($url); echo '<pre>'; echo $url.'<br><br>'; print_r($json); echo '</pre>'; exit(); when run code following r...

angular - How to deploy an Angular2 + Webpack app on Azure? -

Image
i'm trying find information online how deploy angular2 webpack app azure, couldn't find helpful enough. checked start package suggested here how deploy angular 2 apps? couldn't find there. so, have angular2 app running webpack locally. it's working locally. how deploy azure web apps? i appreciate :) thanks! well, able working. after researching found out there few options go by, creating own local prod build , uploading , using cd/ci. went latter. took quite time, it's set don't have worry anymore... i based myself in tutorial http://tattoocoder.com/angular2-azure-codeship-angularcli/ shane boyer since link-only answers discouraged i'm going write here. here's how did it: create branch release on github (i use 1 publish) create free account on codeship , import github repo on configure project select i want create custom commands , use code: nvm install 4.1 npm install angular-cli npm install then 1...

github - Merging two git repos if one was initialized under the other -

directory b subdirectory of a. the stupid thing done initializing git repo both under , under b. both repos contain unique commits. is there way merge them 1 repo not losing history? in principle, commits have time stamps , whole project had logical sequential development commit commit git should able that.

javascript - JS Closure - Multiple date picker initializations / invocations that relies on callback -

how invoke , initialize multiple datepickers (bootstrap date picker) on following script using closure not have duplicate functions each date picker id? http://www.daterangepicker.com/ picker using cb_helper <---- tried use closure unsuccessfully "remember" id passed in... what doing wrong? js $(function() { var start = moment().subtract(29, 'days'); var end = moment(); var idval = ""; function cb(start, end) { $(idval + ' span').html(start.format('mmmm d, yyyy') + ' - ' + end.format('mmmm d, yyyy')); } function cb_helper(id, start, end) { (function(){ idval = id; cb(start, end); })(); } function init(id){ $(id).daterangepicker({ startdate: start, enddate: end, ranges: { 'today': [moment(), moment()], 'yesterday': [moment().subtract(1, 'days'), moment...