Posts

Showing posts from April, 2010

java - Spring 4 with Annotation Tomcat Deployment 404 Error -

Image
i using spring 4, servlet 3 api , tomcat 8 project. have problem deployment. trying deploy war package in vps. using intellij idea. i coppied war /opt/tomcat/webapps path. can see war tomcat's apps page. when try browse url 404 not found error. i using spring annotation , empty web.xml , using spring security. wepappinitializer.java public class wepappinitializer implements webapplicationinitializer { @override public void onstartup(final servletcontext servletcontext) throws servletexception { annotationconfigwebapplicationcontext ctx = new annotationconfigwebapplicationcontext(); ctx.register(webconfig.class); ctx.setservletcontext(servletcontext); servletregistration.dynamic dynamic = servletcontext.addservlet("dispatcher", new dispatcherservlet(ctx)); dynamic.addmapping("/acentecilik"); dynamic.setloadonstartup(1); } } webconfig.java @configuration @enablewebmvc @enabletransactionmanagement @componentscan("c

asp.net web api2 - Can you call an executable from a Owin self hosted Web API restfull service -

i trying set self hosted owin webservice spins executable process. the same code use calls executbal simple test console application not call self hosted service instance. don't see exception don't see logs of kind. not sure possibly wrong. starting think not allowed. [route("startapplication/{application}/{parameters}/{workingdirectory}")] public ienumerable<string> startapplication(string application, string parameters, string workingdirectory) { logger.loginfo("startapplication restfully called"); runresults runresults = new runresults { ... }; application = new uri(application).localpath; try { if (file.exists(application)) { using (process proc = new process()) { logger.loginfo(string.format("attempting start application: {0}", application)); proc.startinfo.filename = application;

javascript - How to bind Array from angular $scope to the input -

i have array in $scope, say $scope.my_array = ["val_1", "val_2", "val_3"] to bind array input element, used ng-model: <input type="text" ng-model="my_array"> now want display array values comma separated in input box, nothing displays. possible? in ng-repeat, iterating values, array available view. edited: thanks, normal way working array binding. in case first using empty array: $scope.my_array = [] then, on ng-click function, grabbing data-* attribute clicked element , pushing array: var item = $(".some-class").data("field-type"); $scope.my_array.push(item) iterating on working fine, not working while setting input. look @ topic two-way filtering explained in details: how two-way filtering in angular.js? in brief should use ngmodels' $parsers , $formatters collection able make .join(", ") before setting input , make .split(/, */) before setting value model.

Regex match two words and not match other -

how can write regex match follow conditions: ( (iphone|ipod) or ( android , mobile , (not gt-p) ) ) would me? edit: with in comments i've follow code: iphone|ipod|(android(?!.*?gt-p)(?:\s*mobile))? it same regex more on group android alone not match... correct? this might you're after: iphone|ipod|android(?!.*?gt-p)(?:\s*mobile)? https://regex101.com/r/xt8rd4/1 it allow android , android mobile not followed gt-p . if should allow android mobile , it's easy fix.

sql server - EF 6 Raw SQL Queries null value -

i try fetch data db , bind internal class object field null should have data. here internal class internal class query1 { public decimal? workedhours {get;set;} public decimal? woff { get; set; } public decimal? abilact { get; set; } public decimal? abilori { get; set; } public decimal? rratio { get; set; } public decimal? frec { get; set; } } here query var ttk = new sqlparameter("@ttk", element.tkinit); var year = new sqlparameter("@year",start.substring(1,3)); var ed = new sqlparameter("@end",end); var st = new sqlparameter("@start",start); string sqlquery = @"select sum(inq.thhrwkdw) workedhours, sum(inq.thcrdc) woff, sum(inq.thdobidb) abilact, sum(inq.thdowkdb) abilori, ((sum(inq.thdobidb)-sum(inq.thdowkdb))/(sum(inq.thdowkdb)+1) * 100) + 100 rratio, sum(inq.thdocodc) frec dbo.inqtimewahs inq inner join dbo.timekeep tk on tk

Getting value from an input in html using python -

so, i'm making program in python executed when user gives values in input in html. runs ok. from bs4 import beautifulsoup # parsing r = open("c:/python27/pruebas/pruebahtml.html") soup = beautifulsoup(r,"html.parser") r4sem = soup.find("input",attrs={'id':'r4sem'})["value"] r5sem = soup.find("input",attrs={'id':'r5sem'})["value"] r.close() txt = open('c:/python27/pruebas/pruebaconfigfechas.txt','w') encabezado = """due-date-function "dd_general" type piecewiseconstant multiplier 1 calculation-policy time-relative duedate-policy foduedatetobucketendtime attribute "fechatope" \n""" fechar4 = "\ndate -4 weeks score " fechar5 = "\ndate -5 weeks score " txt.write(encabezado+fechar4+r4sem+fechar5+r5sem) txt.close() but when checking new text file, r4sem , r5sem empty. question is, can't read v

more than one entity of type 'Model' have the same primary key value -

i try insert "person" database after initialization problem: an exception of type 'system.invalidoperationexception' occurred in entityframework.dll not handled in user code additional information: saving or accepting changes failed because more 1 entity of type 'myproject.entities.models.person' have same primary key value. ensure explicitly set primary key values unique. ensure database-generated primary keys configured correctly in database , in entity framework model. use entity designer database first/model first configuration. use 'hasdatabasegeneratedoption" fluent api or 'databasegeneratedattribute' code first configuration. in line : private void syncobjectsstateprecommit() { foreach (var dbentityentry in changetracker.entries()) { dbentityentry.state = statehelper.convertstate(((iobjectstate)dbentityentry.entity).objectstate); } } how can deal please problem thanks

delphi - Can't Find Directory Library\PrivateFrameworks XE8 64 Bit iPhoneOS9 -

i have been developing mobile app using delphi xe8 , testing under platform: ios device - 32 bit - iphoneos 8.4. now happy app trying deploy app store. understand, in order this, have submit 64 bit build. therefore, trying build app using: ios device - 64 bit - iphoneos 9.0 when compile or build project in 64 bit error message: [dcc error] e2597 ld: warning: directory not found option '-fc:\users\leonard\documents\embarcadero\studio\sdks\iphoneos9.0.sdk\system\library\privateframeworks' ld: file not found: /usr/lib/libiconv.dylib i have tried deleting , re-adding sdk , selecting 'update local file cache' iphoneos 9.0. the closest thing find on google link: xe4 deployment error did not help. there other suggestions dealt xcode not apply situation either. it appreciated if can offer suggestion why getting error , how can fix it? well didn't discover why privateframeworks directory missing. decided move app delphi 10 se

how to print elements of a stack in python 3 -

i have print elements in stack using classes , all: class stack: def __init__(self): self.stack = [] def push(self,element): self.stack.append(element) def pop(self): return self.stack.pop() def st(n): s = stack() in range(n,0,-1): s.push(i) #this updated version want print outside of loop , #it gives me error : __main__.stack instance @ 0x7fe40d261710> print s if __name__ == '__main__': st(4) for reason instead of printing [4,3,2,1] print none stask class using built-ins using lists stack https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-stacks the list methods make easy use list stack, last element added first element retrieved (“last-in, first-out”). add item top of stack, use append(). retrieve item top of stack, use pop() without explicit index if have provide custom interface adding elements in stack can add single method this: class stack(list):

java html font size -

i trying generate html file start template. have problem font size cannot configure code provide. buildhtml.append("<p style=" + "font-size:" + fontsize * 0.1 + " align=" + "center" + ">f</p>"); it moves letter f center, no difference @ fontsize. i think need semicolons between each property. code gave, buildhtml.append("<p style=\"" + "font-size:" + fontsize * 0.1 + "; align=" + "center\"" + ">f</p>"); . edit: need surround style element quotes.

python - How to access class module from object instance? -

i want access module-level variables of module defines class instance derived from. have instance work from. tried self.__class__.__module__[<some var>] unlike __class__ attribute returns class object, __module__ returns string name, not module object itself. how can module object in situation? the __module__ attribute can used key in sys.modules dictionary : import sys class_module = sys.modules[instance.__class__.__module__]

In C, does an array 'access' without storing in a variable actually read from memory? -

i'm trying measure time takes memory accesses, , we're run loop , access elements char array. here code: int i; clock_gettime(clock_monotonic, &start); for(i = 0; < size; i+=stride) { array[i]; } clock_gettime(clock_monotonic, &stop); my question is: statement 'array[i]' without storing value in variable, e.g. char x = array[i], still make array access memory? it depends on mean "memory access". the language specification not have concept of "memory access". closest has offer concept of lvalue conversion described 6.3.2.1 of c11. process of converting lvalue non-lvalue language-level idea of reading data storage intermediate ethereal "holding area" further processing. language specification says lvalue conversion applied always, "except when operand of sizeof operator, unary & operator, ++ operator, -- operator, or left operand of . operator or assignment operator". not exclude example, mean

github - git: how to remove all commits with a pattern? -

we use git source control. each time there commit developers, script modify build file , checks in file. script commits build file message follows pattern. commit history following: script checkin build file 003 fix bug script checkin build file 002 resolve story what want remove commits script. now, obviously, different removing particular commit. i have freedom start brand new repository copying existing repository, still want preserve "developer's commit history" as possible, while getting rid of "script's commit history". is possible? note - "script's commits" changed single file (that is, build file), , did not change other file. and, no "developer's commit" ever changed particular file. so far have been doing run "bfg tool" delete particular build file git repo. commits script ever changed build file, hoping removing build file, associated commits squashed away git. but, found is: build file

java - Solrj NoClassDefFoundError -

i'm using solr perform search on database. added following dependency in pom.xml didn't work. <dependency> <groupid>org.apache.solr</groupid> <artifactid>solr-solrj</artifactid> <version>5.3.1</version> </dependency> i got runtime error java.lang.noclassdeffounderror: org/apache/solr/common/params/solrparams i got solved putting entire library under web-inf/lib folder. confused me why maven dependency didn't work. i'm using tomcat 8.0. all jars (libraries) referenced in application should available in application's library path @ run time. in pom have defined libraries or packages using. default repository pom ~/.m2/respository keep references jars. now need provide them @ rum time well. when mvn clean install application, default packages application source code not libraries. these called thin jar's , because contain application code , light weight. to access them @ runtime,

recursion - Finding the max number with Divide and Conquer in Java -

i'm trying find maximum number in array using divide , conquer method(recursion). when compile code, i'm getting arrayindexoutofbounds exception. i'm not sure i'm going wrong. here code snippet: public class ... { int[] = {2,4,5,1,6,7,9,3}; int max; public void solution() { max = findmax(0, a.length-1); //print max } private int findmax(int a, int b){ if(b-a == 1){ return a[a]>a[b] ? a[a] : a[b]; } else if(a==b){ return a[a]; } return findmax(findmax(a, (a+b)/2), findmax((a+b)/2 +1, b)); } } the problem in last line: return findmax(findmax(a, (a+b)/2), findmax((a+b)/2 +1, b)); this use results of findmax() methods arguments findmax() call, means used indexes array. give wrong result or cause arrayindexoutofboundsexception . what want return maximum of 2 findmax() calls: return math.max(findmax(a, (a+b)/2), findmax((a+b)/2 + 1, b));

ios - UITableView can't scroll while refreshing -

using parse downloading images, text etc. , using them in table view cells. however, while refreshing (when indicator animating in navigation bar) cannot scroll or move on app. if app has become unresponsive until table view done refreshing. any appreciated. here simple example on how dispatch different thread, download image , main thread when download done. func downloadimageandupdateui(){ imageview?.image = nil if let imageurl = avalidurl{ //get image on thread let qos = int(qos_class_background.rawvalue) dispatch_async(dispatch_get_global_queue(qos, 0), { let imagedata = nsdata(contentsofurl: imageurl) //get main thread dispatch_async(dispatch_get_main_queue(), { if imageurl == self.requestedimageurl { //making sure if image still needed (or if user havent moved on else) if imagedata != nil{ self.imageview.image = uiimage(data: imagedata!

javascript - How to show webapp's header bar on top of the external websites? -

let's suppose webapp has list of external urls. user clicks 1 of urls , goes website. how show first webapp's header on top of other websites? http://www.stumbleupon.com/ these guys use iframe purpose, if try add page pinterest, example, stumbleupon's header , blank body because x-frame-options of pinterest set sameorigin . to knowledge there no way put own app's header above site's content without using iframe, , without extension there no way bypass same origin rule. if create chrome extension, should able request cross-origin permissions, , code should allowed embed unembeddable iframes. from chrome docs : by adding hosts or host match patterns (or both) permissions section of manifest file, extension can request access remote servers outside of origin. { "name": "my extension", ... "permissions": [ "http://www.google.com/" ], ... } so should able add pattern * re

The local source file for AngularJS is not found -

i practicing basic angularjs examples. main issue have been facing angular.min.js file saved on desktop not found. tried using file location 1 example @ plunker, works fine. this location use in code: <script src="c:\users\abdul hadi\desktop\angular\lib\angular\angular.min.js"></script> and output this: {{author.name}} {{author.title + ',' + author.company}} but when use this, works fine: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> you need use file uri scheme ( file:/// ) load local files. <script src="file:///c:\users\abdul hadi\desktop\angular\lib\angular\angular.min.js"></script> i use slashes instead of backslashes , relative path, works anyway.

html - Adding JQuery/Javascript into my web page -

i know question has been answered many times before. im stuck on trying implement jquery webpage , im not sure im going wrong. ive tried 2 ways people offer i.e: adding html: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> and downloading jquery-1.11.3.min source file (where saved). adding html: <script type="text/javascript" src="wpkey/106website/jquery-1.11.3.min.js"></script> neither work unfortunately :( here jfiddle https://jsfiddle.net/pxejv9p3/ appreciated rather flagging repeating question. in advance :d you have add <script src="myscript.js"></script> wrong place. please move syntax after <script type="text/javascript" src="wpkey/106website/jquery-1.11.3.min.js"></script> or <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> please ch

R ggvis linked_brush is not reactive -

Image
i have following code in server.r data_agg_plot1<- reactive({ brush1 <- linked_brush(keys = data_agg()$id, "navy" ) data_agg <- data_agg() plot1<-data_agg%>% ggvis(x = ~dates_all) %>% group_by(factor(dates_all.1)) %>% layer_points(y = ~ value, fill =~dates_all.1, shape =~dates_all.1) %>% layer_paths(y = ~ value, stroke = ~dates_all.1 , strokeopacity := 0.5) %>% scale_ordinal("fill", range = c("green", "red", "blue"))%>% scale_ordinal("shape", range = c("triangle-up","triangle-down","circle")) %>% scale_ordinal("stroke",range=c("green","red","blue")) %>% brush1$input() %>% hide_legend(c('stroke','fill'))%>% add_legend(c('shape','fill'), title = "symbol", orient = "left"

database - SQL Subtract Values From Table 1 When The Row Exists In Table 2 -

i have 2 tables, tbltasks , tbloffsets. tbltasks has of these tasks being funded , tbloffsets has references lines in tbltasks being funded outside money. both have same columns except tbloffsets has column called "source" keep track of money coming form. columns appropriation, performergroup, performer, contract, id, idext, labor, material, travel, fiscalyear the primary key collection of columns table: appropriation, performergroup, performer, contract, fiscalyear, id, , idext. each row has unique combination of these columns. now want subquery (or maybe need make new table?) takes tbltasks , subtracts values tbloffsets lines exist in tbloffsets. i've tried write code doesn't work should give idea of i'm talking about: select tb.appropriation, tb.performergroupid, tb.performerid, tb.contract, tb.id, tb.idext, (tb.labor - o.labor) labor, (tb.material - o.material) material, (tb.travel - o.travel) travel tbltaskbooks tb, tbloffsets o

python - Pandas Item to features matrix in to item-item matrix -

Image
i have binary matrix have following structure df = pd.dataframe({"col1": [0,1,0,1,1], "col2": [1,0,1,0,0],"col3": [1,1,1,0,1],"col4": [1,0,0,1,0]},index=['a', 'b', 'c', 'd', 'e']) this current df and applying similarity measure(jaccard distance) each row , want have type of item-item matrix end(the intersections values should comes jaccard function\not actual values used here). final outcome should this. b c d e 0 3 2 1 1 b 0 1 2 3 c 0 1 4 d 0 2 e 0 i have jaccard similarity function defined jaccard() want know how apply df can have type of representation matrix end. thank you!

php - create new array merge -

i have array: array( [0] => array ( [d1] => array ( ................ ) [d2] => array ( ................ ) ) [1] => array ( [d1] => array ( ................ ) [d2] => array ( ................ ) ) ) how create new array merge it, d1 , d2, remove index 0 , 1. for php > 5.5.0 can use array_column as $result['d1'] = call_user_func_array('array_merge',array_column($your_array,'d1')); $result['d2'] = call_user_func_array('array_merge',array_column($your_array,'d2')); print_r($result); demo

java - How does number read/spelled as alphabet? ex: 213 as BAC. (jsp) -

i have numbers , 213. want encryption alphabet, 213 bac. when ran codes didn't show anything. here codes . calculate.java // java servlet file string str = integer.tostring(numbers); //it because numbers in int type, convert string type first before spelled char[] alp; alp = new char[str.length()]; (int = 0; < str.length(); i++) { if (str.charat(i)=='1'){ alp[i]='a'; }else if(str.charat(i)=='2'){ alp[i]='b'; } else if(str.charat(i)=='3'){ alp[i]='c'; } else if(str.charat(i)=='4'){ alp[i]='d'; } else i

html - JavaScript REGEX replacement with the content inside from an external text file -

here code in below comment pattern replaced new content. , it's working fine. inside html: <div id="content"> <!-- ### start content ### --> <p>some text.</p> <!-- ### end content ### --> </div> javascript code: var str = document.getelementbyid("content").innerhtml; var txt = str.replace(/<!-- ### start content ### -->([\s\s]*?)<!-- ### end content ### -->/g, '<div id="example">some replaced example stuff !!</div>'); document.getelementbyid("content").innerhtml = txt; but, question is.. want replace large block of html code instead of <div id="example">some replaced example stuff !!</div> . so, this.. plan save large block of html code inside text file , text file called , content inside file displayed when pattern matches. is possible replace content external text file ? note: text file placed in root directory

c++ - Where to use the makeCurrent() in QGLWidget? -

the qt's documentation said: your widget's opengl rendering context made current when paintgl(), resizegl(), or initializegl() called. if need call standard opengl api functions other places (e.g. in widget's constructor or in own paint functions), must call makecurrent() first. for following case: paintgl() { drawsomething(); } ... drawsomething() { glclearcolor()... //many other gl calls... } do have makecurrent inside drawsomething() function. and if make qpainter call in stead of standard opengl api functions. have use makecurrent? do have makecurrent inside drawsomething() function. if function called paintgl , no, qt call paintgl context current. as docs say, you'll need whenever need gl context current in other function. // called other code, context may not current void myglwidget::setbackgroundcolor(const qcolor &color) { makecurrent(); glclearcolor(color.redf(), color.greenf(), color.blue

svg - What do the X and Y in topLeftRadiusX and topLeftRadiusY on a border do? -

in graphics programs there corner radius values cornerradiusx , cornerradiusy. have seen topleftradiusx , topleftradiusy plus 6 more properties; 2 properties per corner . for example there fxg / svg code, <s:rect id="lowlight" left="1" right="1" top="1" bottom="1" topleftradiusx="4" toprightradiusx="4"> </s:rect> i've never seen topleftradiusx , topleftradiusy used again i've never seen them used @ all. what , how affect graphic? they allow have rounded corners elliptical rather circular. <svg width="100" height="100"> <rect width="200" height="200" rx="80" /> </svg> <svg width="100" height="100"> <rect width="200" height="200" rx="50" ry="80"/> </svg>

php - calculate goat age from its date birth and echo in a field on form -

i have form dynamic select option. want calculate age of goat in months date of birth after selecting db , echo selected goat age on following form field follows dynamic selection option. here selection script: <?php $conn = mysqli_connect("localhost", "root", "xxx", "xxxx"); if(mysqli_connect_errno($conn)) { echo "unable connect database server"; } $sql = "select * goats sex='male'"; $query = mysqli_query($conn, $sql); echo '<select name="hegoat">'; echo '<option value="">choose goat</option>'; while($hegoats = mysqli_fetch_assoc($query)){ echo "<option>{$hegoats['goatid']}</option>"; } echo '</select>'; ?> data base table goats 'dob' column date of birth while form field age is: <input type="text" name="age" id="age"/> and php code <?php if(isset($_post[

Inside CollapsingToolbarLayout ImageView Click event is not trigger Android -

image view inside collapsingtoolbarlayout , click event not triggering. how to solve issue. just make sure don't have view above layout. in case had toolbar , eating clicks. <android.support.design.widget.collapsingtoolbarlayout > <include... /> <android.support.v7.widget.toolbar... /> <android.support.design.widget.tablayout... /> </android.support.design.widget.collapsingtoolbarlayout> i had create new class extending toolbar let clicks go through it( how click views behind toolbar? ) public class nonclickabletoolbar extends toolbar { @override public boolean ontouchevent(motionevent ev) { return false; } }

numpy - Tensorflow: TypeError with numpy_input_fn -

i coding convolutional neural network classify images in tensorflow there problem: when try feed numpy array of flattened images (3 channels rgb values 0 255) tf.estimator.inputs.numpy_input_fn following error: typeerror: failed convert object of type <class 'dict'> tensor. contents: {'x': <tf.tensor 'random_shuffle_queue_dequeuemany:1' shape=(8, 196608) dtype=uint8>}. consider casting elements supported type. my numpy_imput_fn looks this: train_input_fn = tf.estimator.inputs.numpy_input_fn( x={'x': train_x}, y=train_y, batch_size=8, num_epochs=none, shuffle=true) in documentation function said x should dict of numpy array: x: dict of numpy array object. nevermind, having same problem fixed it. in model function had: input_layer = tf.reshape(features, [-1, 256, 256, 1]) which raised type error. fix have access 'x' key in features dictionary: input_layer = tf.reshape(featu

xaml - Binding issue linked to DispatcherTimer -

Image
i'm building universal windows application allow users track time spent on specific task. on mainpage i'm binding observablecollection, containing time registrations. when task running want update time spent every second. i'm using dispatchertimer (whichs runs fine) update time spent active timers. have implemented inotifypropertychanged , i'm firing propertychanged event in setter of property binded xaml. the problem i'm expecting ui update every second updates once - each run - , @ irregular timestamps. think i'm doing wrong binding. your appreciated! mainpage_loaded private async void mainpage_loaded(object sender, routedeventargs e) { timerrepository repository = new timerrepository(); this.timers = await repository.gettimersasync(); _timer = new dispatchertimer(); _timer.interval = timespan.fromseconds(1); _timer.tick += _timer_tick; _timer.start(); } dispatcher timer, 1 second

vb.net - How to get the text of the button which is clicked -

pretty new programming. i've managed come change colour of button once it's pressed. i'm trying text of button clicked on using string chosenroom , once come save, value of string nothing must doing wrong. private sub changecolor(sender object, e eventargs) dim senderbutton button = sender if yellowbutton isnot nothing yellowbutton.backcolor = me.backcolor end if if senderbutton isnot yellowbutton senderbutton.backcolor = color.yellow chosenroom = senderbutton.text end if yellowbutton = sender end if end if this using save string cmd1.parameters.add(new oledbparameter("room number", ctype(chosenroom, string))) maybe in code help. put buttons on form and... private sub button1_click(sender object, e eventargs) handles button1.click, button2.click, button3.click each ctr control in controls

javascript - How to render Reducer by applying filter? -

Image
my reducer is: const initialstate = { 1: { id: '1', user: 'user1', text: 'user1 comment', parentid: 0, }, 2: { id: '2', user: 'user2', text: 'user2 comment', parentid: 0, }, 3: { id: '3', user: 'user1', text: 'user1 subcomment', parentid: 2, }, 4: { id: '4', user: 'user2', text: 'user2 subcomment', parentid: 3, }, 5: { id: '5', user: 'user1', text: 'user1 subcomment', parentid: 2, }, } i have mappedstatetoprops , able show data using object.keys , mapping it: const rendata = object.keys(this.props.comments).map((key, idx) => { let comment = this.props.comments[key] return( <view key={idx}> <text> { comment.id } - { comment.user } - { comment.text} - { comment.parentid } </tex

java - Should getters from domain classes not be prefixed with "get" in DDD, and why? -

the dddsample project , hosted in github repository , seems reference how design ddd project. i noticed getters in domain classes not prefixed get (ex: cargo#delivery ) while prefixed in classes outside of domain package (ex: handlingeventregistrationattempt#gettrackingid ). richard c. martin, in book clean code, sates: accessors, mutators, , predicates should named value , prefixed get, set, , according javabean standard. so, should avoid follow advice in context? if so, why more important consistency? why getters domain classes should not prefixed “get” in ddd? the easy place start mutators ; note previous sentence in clean code mutators should have verbs or verb phrase names postpayment , deletepage , or save . this idea consistent principle domain model should not anemic, , language of domain should ubiquitous : should seeing same language in code our domain experts use when explaining business. that's why aren't going see set ofte

java - How to trigger first update with rabbitMQ using rxJava 2.0? -

is there elegant way subscribe updates after trigger first update of data using rabbitmq? or.. there way know when new consumer added , trigger sending data? for example: service getting updates service b (using rabbitmq, service b pushes ips need send data to). service getting requests service c , sends each request ips service b. my problem when service up, there might 1-5 minutes until service b pushes update. meanwhile, service c can send 100 requests, , i'll have no ips send these requests ... if queue have known new consumer added - trigger sending ips.. i hope explains problem. any appreciated.

spring - How to connect importMappings and yaml in Swagger -

i have spring restfull application , want generate api it. use gradle configuration there https://github.com/casturan/swagger-gradle-example/blob/master/build.gradle generate code. there problem uses models defined in definitions: while want use models shared module. found need use importmapping when try apply command in build.gradle getting error: importmappings = [ 'board_container': 'board_container=com.workingbit.share.domain.impl.boardcontainer' ] > not set unknown property 'importmappings' task ':myproject:generateapi' of type org.gradle.api.defaulttask. so question how use importmapping , how connect model in yaml ?

amazon web services - Open S3 buckets vulnerabiltiy? -

i know bucket, want know open buckets vulnerability. what open buckets? how confirm vulnerability? thank in advance!! there have been number of high profile leaks involving publically accessible s3 buckets. if i'm understanding question correctly, you're asking are, , how know if buckets vulnerable. s3 buckets considered publically accessible, based on permissions of access controls. there 2 ways can make bucket public. first 1 using access control lists (acls) . if bucket set public read, it's contents can downloaded able determine correct urls. second method use of bucket policy . bucket can made public using bucket policy such this example s3 documentation : { "version":"2012-10-17", "statement":[ { "sid":"addperm", "effect":"allow", "principal": "*", "action":["s3:getobject"], "resource":["

update local list of branches in git -

i m trying update local list of branches. can see 3 while remote 11. tried this solution prune command , despite config file updated when press git branch -a same result before (the remote branches red letters , in first place 'remotes/origin/head->origin/master'. try explicitly specify want fetch remote branches: git fetch origin '+refs/heads/*:refs/heads/*' to make permanent setting do: git config remote.origin.fetch '+refs/heads/*:refs/heads/*' local copy of branch created when check out. if have remotes/origin/branchx have local branchx want git checkout branchx

why did I get a decimal point by using loadstring in Lua -

i have scenario need pass dynamic operators loadstring . found , don't understand. please see following output: > = '3' > b = '7' > operator = '+' > loadstring("return a" .. operator .. "b")() 10.0 -- why decimal point. > loadstring("return 3" .. operator .. 7)() 10 -- 1 not? can explain what's going on inside loadstring since thought should same result? the manual says arithmetic operators applied strings: if both operands numbers or strings can converted numbers (see §3.4.3), converted floats perhaps want loadstring("return " .. .. operator .. b)() instead of loadstring("return a" .. operator .. "b")()

PHP - Linking to a txt file to display information -

currently trying php. i have txt file contains 3 entries of information, 3 titles information each section underneath. there way of pulling these details html page wording separated? cheers so works me, add more spacing between 3 sections, table. ' . $name . ' '; } fclose($handle); ?> you can using fopen , fgets . extract 1 line @ time (two lines supposed separated new line character), explode it. you can explode number of sections. in case there 3 sections, each separated | . code this: <?php error_reporting(0); $document_root = $_server['document_root']; $filename = $document_root."foldername/file.txt"; $fp = fopen($filename, 'r'); $m = 0; echo "<table> <tr> <th>id</th> <th>name</th> <th>email</th> </tr>"; while (true) { $m++; $line = fgets($fp); if (feo

php - How can I connect to a database on an external ip? -

i connect database external ip of pc on server, example: <? $db_host = "xxx.xxx.xxx.xxx" //external ip $db_user = "user"; $db_password = "password"; $db_database = "database"; $conn = "mysql:host=$db_host;dbname=$db_database;charset=utf8mb4"; try {$db = new pdo($conn , "$db_user", "$db_password");}catch(pdoexception $e) {echo 'error: '.$e->getmessage();}?> so, can that? , if so, how can it? help;) p.s: sorry bad english it easy connect remote mysql server using php, have is: create mysql user in remote server. give full privilege user: firewall of server must set-up enable incomming connections on port 3306 you must have user in mysql allowed connect % (any host) (see manual details) connect server using php code (sample given below) $link = mysql_connect('your_my_sql_servername or ip address', 'new_user_which_u_created', 'password'); if (!$l

django-filer: FilerFile model not being saved; NoneType error raised instead. Why? -

hi i'm trying test mock django-filer save() trigger post_save signal. models.py import filer.fields.file import filerfilefield class deliveryinvoice(timestampedmodel): invoice_excel = filerfilefield(null=true, blank=true) tests.py from filer.models.filemodels import file filerfile django.core.files import file def test_if_delivery_invoice_number_updated_on_file_save_through_admin(self): patch("orders.utils.apply_invoice_number_to_orders") signal_mock_handler: post_save.connect(signal_mock_handler, sender=deliveryinvoice) filename = 'test_invoice_excel' filepath = 'orders/fixtures/delivery_invoices.xlsx' open(filepath, 'rb') f: file_obj = file(f, name=filename) error -> invoice_excel = filerfile.objects.create(owner=self.user, file=file_obj, original_filename=filename) instance = deliveryinvoice(invoice_excel=invoice_excel) instance.save() self.a

javascript - Adding animate.css on hover -

so p tag starts hidden , on hover shows visible. can me use animate.css use slide in effect on p tag when hover? #div:hover{ position: absolute; height: 100%; width: 100%; background-color: rgba(0,0,0,0.4); justify-content: center; } h2{ margin-top: 150px; color: #fff; display: block; } p{ visibility: visible; color: #fff; padding: 20px; display: block; } <div id="div"> <div class="div"> <h2>header</h2> <p></p> </div> </div> you can use animation-name of slideinup (predefined in animate.css ) on <p> tag like: #div:hover p { animation-name: slideinup; // predefined in animate.css } you don't need use javascript also. have @ snippet below: #div { display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; } #div:hover { background-color: rgba(0,0,0,0.4);

firefox - tinymce upload NS_ERROR_FAILURE -

i'm trying add image uploads in tinymce editor blog. i've tried few things , solution found i've got furthest here . with soultion, on firefox (haven't tried other browsers need firefox work) i'm getting ns_error_failure in console when select file upload. this code have. html ejs (shouldn't affect functionality) <form class="form-group" method="post" action="<%= adminpage == 'new post' ? '/admin/newpost' : '' %>"> <input type="hidden" name="_csrf" value="<%= csrftoken %>"> <input class="form-control" name="title" placeholder="title" required> <br> <textarea name="content" id="editor" rows="20"></textarea> <button type="submit" class="btn btn-danger">submit post</button> tinymce initialisation <script src="

Django form and redirect -

my code follwing : in views.py: class projectdetailview(generic.detailview): model = project template_name = 'project_details.html' class projectcreate(createview): model = project fields = ['project_name'] template_name = 'project_form.html' def create_invite(request): if request.method == "post": invite_form = inviteform(data=request.post) if invite_form.is_valid(): email1 = invite_form.cleaned_data['email1'] email2 = invite_form.cleaned_data['email2'] email3 = invite_form.cleaned_data['email3'] email4 = invite_form.cleaned_data['email4'] email5 = invite_form.cleaned_data['email5'] in invite_form.cleaned_data: invite = invitation.create(i) invite.send_invitation(request) print("the mail went") return reverse('website:projec

python - Django - Docker - The Application Default Credentials are not available -

i use google cloud sdk django project in docker container. let's assume use from google.cloud import vision google.cloud.vision import types when install google-cloud using requirements.txt file error shown below. on local machine without container works properly. have idea how can solve this? django_1 | oauth2client.client.applicationdefaultcredentialserror: application default credentials not available. available if running in google compute engine. otherwise, environment variable google_application_credentials must defined pointing file defining credentials. see https://developers.google.com/accounts/docs/application-default-credentials more information. update work on macbook , found on this website this: docker run --rm -it -v ~/.config/gcloud:/.config/gcloud google/cloud-sdk at moment errors shown below. ideas how can solve this? django_1 | traceback (most recent call last): django_1 | file "/usr/local/lib/python3.6/site-packages/

asp.net - IIS auto redirect http to https for select applications in a website -

Image
i have setup website in iis , website has 2 applications (as shown in snapshot below). i have enable https on applications. have installed ssl certificate , setup applications use https instead of http. want implement autoredirect http https, test application (personalcornertest). using urlrewrite using below links reference, https://www.sslshopper.com/iis7-redirect-http-to-https.html (method 1) , https://blogs.msdn.microsoft.com/kaushal/2013/05/22/http-to-https-redirects-on-iis-7-x-and-higher/ (method 1) i used below setting in configuration file of test application, <rule name="http https redirect" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" redirecttype="found" url="https://{http_host}/{r:1}" /> however, issue is

java - cannot get right result from getdefaultsharedpreferences -

Image
when use defaultsharedpreferences save multiple data, found data covered. feel confused happened. expected values preferences userid 2 authorizedheader bhlryxzpbjpsewthdmlu and retrieved values userid 2 authorizedheader 2 private static final string pref_authorized_query = null; private static final string pref_userid_query = null; public static string getstoreduseridquery(context context){ return preferencemanager.getdefaultsharedpreferences(context) .getstring(pref_userid_query, null); } public static string getstoredauthorizedquery(context context){ return preferencemanager.getdefaultsharedpreferences(context) .getstring(pref_authorized_query, null); } public static void setstoredquery(context context, string userid, string authorizedheader){ preferencemanager.getdefaultsharedpreferences(context) .edit() .putstring(pref_authorized_query, authorizedheader) .putstring(pref_userid_query, userid)

directory - cannot locate Apache MaxRequestWorkers -

the title says all. i reading article apache , found directive, cannot locate. i using windows 10 home edition , apache/2.4.27 (win64) php/7.2.0beta3. any tips? this directive not available windows. mpm module available windows apache mpm winnt . maxrequestworkers directive not available module. if want tune configuration use threadsperchild , maxconnectionsperchild directives.

c# - IOException: The process cannot access the file 'file path' because it is being used by another process -

i have code , when executes, throws ioexception , saying the process cannot access file 'filename' because being used process what mean, , can it? what cause? the error message pretty clear: you're trying access file, , it's not accessible because process (or same process) doing (and didn't allow sharing). debugging it may pretty easy solve (or pretty hard understand), depending on specific scenario. let's see some. your process 1 access file you're sure other process own process. if know open file in part of program, first of have check close file handle after each use. here example of code bug: var stream = new filestream(path, fileaccess.read); var reader = new streamreader(stream); // read data file, when i'm done don't need more file.delete(path); // ioexception: file in use fortunately filestream implements idisposable , it's easy wrap code inside using statement: using (var stream = file.open("