Posts

Showing posts from February, 2012

laravel - Jquery UI draggable and resizeabl issue in dynamic creation -

i making 10 draggable , resizeable boxes first box draggable , resizable. how can make boxes draggable , resizeable? code: <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <style> #resizable { width: 150px; height: 150px; padding: 0.5em; } #resizable h3 { text-align: center; margin: 0; } </style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script> <script> $( function() { $( "#resizable" ).draggable().resizable(); }); </script> @for($i=0;$i<10;$i++) <div id="resizable" class="ui-widget-content"> <h3 class="ui-widget-header">user {{ $i }}</h3> </div> @endfor use class i...

full text search - Handling the dot in ElasticSearch -

i have string property called summary has analyzer set trigrams , search_analyzer set words . "filter": { "words_splitter": { "type": "word_delimiter", "preserve_original": "true" }, "english_words_filter": { "type": "stop", "stop_words": "_english_" }, "trigrams_filter": { "type": "ngram", "min_gram": "2", "max_gram": "20" } }, "analyzer": { "words": { "filter": [ "lowercase", "words_splitter", "english_words_filter" ], "type": "custom", "tokenizer": "whitespace" }, "trigrams": { "filter": [ "lowerc...

Why does git flag files as changed when only the line endings are changed and normalization is on? -

case1: windows core.autocrlf=true when change line endings of text file lf these marked changes. normalized when committed there shouldn't changes. case2: linux core.autocrlf=input when change line endings of text file crlf these marked changes. normalized when committed there shouldn't changes. so why git flag files changed when line endings changed , normalization on? from git documentation regarding autocrlf : git can handle auto-converting crlf line endings lf when add file index, , vice versa when checks out code onto filesystem. this option does, in nutshell. not pervade every single operation of git, git add , git checkout (and similar, i.e., git reset , others change working directory). you might want text attribute in .gitattributes ; maybe that's closer need.

c# - Casting COM types in C++ -

i have following com types: project , containeritem , node . project has collection property append function accepts containeritem s. in c#, using type libraries can send node object append function , library works expected: var prj = new project(); var node = new node(); prj.collection.append(node); in c++ tried direct pointer cast expecting c# doing, ends in error: projectptr prj; prj.createinstance(__uuidof(project)); nodeptr node; node.createinstance(__uuidof(node)); prj->collection->append((containeritem**)&node.getinterfaceptr()); is there specific way these type of com pointer casts in c++? missing? com casting done queryinterface() method. object queried support of interface (based on guid), , if interface supported, internal reference counter incremented (see addref() ) , pointer interface returned. msdn has more detail on inner workings . c++ not directly support code generation "com cast" c# does, implementation simple eno...

c# - Topshelf service not starting Access is denied -

i built topshelf sample application, (version 4.0.1) 1 timedevents write console. install , run ok admin. when installing networkservice (trying run fewer privileges better security practices) got error: [success] name stuff, [success] description sample topshelf host, [success] servicename stuff topshelf v4.0.0.0, .net framework v4.0.30319.42000 topshelf.hosts.starthost error: 0 : service failed start., system.invalidoperationexception: cannot start service stuff on computer '.'. ---> system.componentmodel.win32exception: access denied --- end of inner exception stack trace --- @ system.serviceprocess.servicecontroller.start(string[] args) @ system.serviceprocess.servicecontroller.start() @ topshelf.runtime.windows.windowshostenvironment.startservice(string servicename, timespan starttimeout) @ topshelf.hosts.starthost.run() in case, there no input or output file, access permissions other files should not problem. ...

performance - Java: get data fast: store in memory vs read from file -

iam writing data table generator tool , have performance problems - need care ram usage , time of generating. key in program. 1) need store final data in single file (one file = 1 table, load later when files generated), like: 111|aaaa|bbba 112|aaab|bbbb 113|aaac|bbbc 114|aaad|bbbd... i have many columns , milion of rows. values correct. 2) now, need generate single value next table using values 1 of genereted table. program can save single column temporary file (to read in future), like: aaaa aaab aaac aaad... now, main problem need randomly 'read' new value milion times, same row counter is. how ? tools use ? have 2 options: store 2nd column 'available values' temporary file in array / arraylist , use eg. .get(int index) method , return value read specific line file , return value thanks help how ? to read file randomly, need know offset of each record. store binary file 4 byte or 8 byte offset start of each line. you can ...

ruby on rails - Fake Class for Development Environment -

i have service runs on production machine access through service class in app. because of licensing costs, i'd fake service test , development environments. how can load different class definition depending on environment in rails app? use rails.env in implementation def my_method if rails.env.production? model.production_method else model.development_method end end

angularjs routing - How to route to Angular 2 component from Angular 1 app? -

so have angular 1 app. , have angular 2 component; let's heroes dashboard, dashboard.component.ts https://angular.io/docs/ts/latest/tutorial . in angular 2 router specified list of: { path: 'issue', component: fleetscomponent } in current angular 1 app router paths specified url (ok, "path"), template (ok, specify path html), , controller. should set in controller parameter?

Import tiff + tfw + prj files in R -

i want import in r map have downloaded from http://www.naturalearthdata.com/downloads/10m-raster-data/10m-natural-earth-1/ when download 3 files following extension .tif .tfw .prj how should read them? can read .tif file with imported_raster=raster('ne1_hr_lc_sr_w.tif') but colours , projection different original tif. thanks i looking information on topic when came across one. it's quite normal colours appear different original tif. there color distribution or colour scheme applied on original tif isn't exported or output tif. it's user should set colour scheme or color distribution. (just in arcmap example). i guess exported tif has no projection @ when load in r? need use information .tfw file give each pixel (row, column) coordinate. read in .tfw file assume .tfw (ascii file) this: 10.000000 0.000000000000000 0.000000000000000 -10.000000000000 137184.00000000000 180631.000000000 last 2 rows x/y coordinates of center of upperleft pi...

javascript - Dynamic form Angular issue -

i have written code online dynamic form jsfiddle code the total , grand total not auto updating. had more simple example before , working single model item, made array , won't work. real program building going have many more fields , trying create pre-example show work. can see dumb thing forgetting? <div ng-controller="myctrl"> <form name="myform"> <div ng-repeat="item in items track $index"> <input type="text" ng-model="item.a"> <input type="text" ng-model="item.b"> <input type="text" ng-model="item.c"> <label>total: </label><label ng-bind="total(item)"></label> </div> </form> <div> <label>grand total: </label><label ng-bind="grandtotal()"></label> </div> </div> var myapp = angula...

ios - Modal presentation view in objective C is displaying NULL when I display NSLog(@"formView : %@",self.navigationController.viewControllers); -

when want see views in navigation controller when open second view in formsheet style first view, displays me (null). for example: i open second view modally in popover mode: formviewcontroller *destviewcontroller = [[uistoryboard storyboardwithname:@"main" bundle:nil] instantiateviewcontrollerwithidentifier:@"formview"]; destviewcontroller.delegate = self; destviewcontroller.typeform = @"accesscontrolform"; [self presentviewcontroller:destviewcontroller animated:yes completion:nil]; i put code in second view: nslog(@"formview : %@",self.navigationcontroller.viewcontrollers); it displays (null). tried find way display second view in "push controller", works, problem cannot display push mode in formsheet appearance (can't i?)...

nlp - Using Stanford CoreNLP Python Parser for specific output -

i'm using scp parse cfg tree english sentences. from corenlp import * corenlp = stanfordcorenlp() corenlp.parse("every cat loves dog") my expected output tree this: (s (np (det every) (nn cat)) (vp (vt loves) (np (det a) (nn dog)))) but got is: (root (s (np (dt every) (nn cat)) (vp (vbz loves) (np (dt a) (nn dog))))) how change pos tag expected , remove root node? thanks you can use nltk.tree module nltk . from nltk.tree import * def traverse(t): try: # replace labels if t.label() == "dt": t.set_label("det") elif t.label() == "vbz": t.set_label("vt") except attributeerror: return child in t: traverse(child) output_tree= "(root (s (np (dt every) (nn cat)) (vp (vbz loves) (np (dt a) (nn dog)))))" tree = parentedtree.fromstring(output_tree) # remove root element if tree.label() == "root": tree = tr...

c# - How to Load DirectSound into a 64bit Application -

i getting badimageformatexception when trying load directsound 64-bit application. after doing research, due fact directsound dll 32-bit while application 64-bit. cannot change 64-bit application 32-bit. options load directsound library? have looked using com ipc object, not sure how worked. there 64bit dll available? microsoft doesn't support managed directx anymore. xna won't run 64-bit. i've used slimdx once in past directx, , worked me. that's 1 option consider. here's link slimdx directsound documentation: https://slimdx.org/docs/html/n_slimdx_directsound.htm

javascript - collision detection not registering with ball -

Image
hi i'm trying make simple pong game , i'm running trouble collision detection. ball not registering paddle. function moveball() { var rightradius = ballx + radius; var leftradius = ballx -radius; if (ballx + radius > canvas.width || ballx - radius < 0) { balloffx = -balloffx; } /* following code handling collision of ball plate */ if((rightradius <= (player1.x + paddlewidth))&&(leftradius >= player1.x) &&(player1.y == bally + 10)){ balloffy = -balloffy; } ballx += balloffx; bally += balloffy; } i made if statement sense collisions in javascript, here is: if circle x < rect x + circle width && circle x + rect width > rect x && circle y < rect y + circle height && rect height + circle y > rect y { this works putting ball inside of 'imaginary box' , when of edges of 'imaginary box' touch of edges of rectangle, colli...

Visual Studio 2015 Apache Cordova Project Files not included to project and hidden -

Image
i updated vs community edition update 3 , cordova project files not included project , hidden. i removed , reinstalled "tools apache cordova update 10". uninstalled vs community , reinstalled again. but not resolved problem. problem? activitylog.xml we had same issue , in our case typescript . installed typescript vs 2015. can download typescript vs 2015 here . try , let me know. luck

php - How to update the tax amount in invoice using XML-RPC? -

i using odoo 8.0. accessing odoo models using xml-rpc api in php. have updated percentage of tax in invoice line items. updated successfully, problem tax amount not updated in subtotal. here code is: <?php include("../ripcord-master/ripcord.php"); $url = "http://localhost:8069"; $db="migration_three"; $username = "admin"; $password = "admin"; $models = ripcord::client("$url/xmlrpc/2/object"); $common = ripcord::client("$url/xmlrpc/2/common"); $uid = $common->authenticate($db, $username, $password, array()); $invoice_id = 28; $validate = $models->execute_kw($db, $uid, $password, 'account.invoice','button_reset_taxes',array($invoice_id)); print_r($validate); ?> it returns 1. tax amount not updated in subtotal view. in advance we don't need mention key invoice_id. change update code into $validate = $models->execute_kw(...

php - Azure media services sdk returns error on encoding to Adaptive Bitrate MP4 Set -

im new on azure media services , trying through php. able upload file on remote using multiple bitrate shows not supported. generate url access shows mpe_feature_usage_forbidden, have enabled public access azure dashboard still dont know why shows that. tried adaptive bitrate shown in code not allowing me encode , shows error. in multiple bitrate, im guessing case of encoder error. function encodetoadaptivebitratemp4set($restproxy, $asset) { // 2.1 retrieve latest 'media encoder standard' processor version $mediaprocessor = $restproxy->getlatestmediaprocessor('media encoder standard'); print "using media processor: {$mediaprocessor->getname()} version {$mediaprocessor->getversion()}\r\n"; // 2.2 create job; automatically schedules , runs $outputassetname = "encoded " . $asset->getname(); $outputassetcreationoption = asset::options_none; $taskbody = '<?xml version="1.0" encoding="utf-8"?><taskbody...

c# - Json.Net Serialize String from URI -

currently i'm using web request body of webpage strictly json. var request = webrequest.create("urihere"); string text; var response = (httpwebresponse)request.getresponse(); using (var sr = new streamreader(response.getresponsestream())) { text = sr.readtoend(); } now i've got string of json in variable i'm trying figure out how parse data. i'm attempting use json.net below: user primaryuser = new models.user(); primaryuser.fullname = "test"; jsonserializer serializer = new jsonserializer(); serializer.converters.add(new javascriptdatetimeconverter()); serializer.nullvaluehandling = nullvaluehandling.ignore; using (streamwriter sw = new streamwriter("filenamehere")) using (jsonwriter writer = new jsontextwriter(sw)) { serializer.serialize(writer, primary...

Yield in Python performances comparison -

i'm reading yield expression , generators in python, approach it's encouraged during huge calculations. to check that, i've created simple .py script, in order measure time between 1 approach, using yield expression , in memory range built-in class. here script: import time def pow(): in range(100000000): yield i*i start_time = time.time() in pow(): res = print('seconds yield: {0}'.format(time.time() - start_time)) start_time = time.time() in range(100000000): res = i*i print('seconds in-memory: {0}'.format(time.time() - start_time)) it's little bit strange behavior, because, i've run script via terminal , results are: seconds yield: 17.303140878677368 seconds in-memory: 17.322022914886475 i expecting lower value on "yield" approach, in case higher "in memory approach". i've checked on system monitor if there differences in therm of used ram or cpu, same in case... ...can able e...

java - Iterate in reverse in thymeleaf -

i'm trying iterate list in reverse in thymeleaf, th:each iteration seems go forward. array sorted least greatest, , create dom objects in greatest least. here have: <li th:each="option : ${upgradeoptions}"> <div class="billing__product-option"> <div class="billing__product-duration" th:text="${...}">3 months</div> <div class="billing__payment-subtotal" th:text="${...}">$25</div> <div class="billing__payment-monthly-charge" th:text="${...} + tax')">$25</div> <div class="billing__payment-discount""></div> <input class="billing__button" type="button" value="select" /> </div> </li> any ideas?

python - Removing encoded text from strings read from txt file -

here's problem: i copied , pasted entire list txt file https://www.cboe.org/mdx/mdi/mdiproducts.aspx sample of text lines: bfly - cboe s&p 500 iron butterfly index bpvix - cboe/cme fx british pound volatility index bpvix1 - cboe/cme fx british pound volatility first term structure index bpvix2 - cboe/cme fx british pound volatility second term structure index these lines of course appear normal in text file, , saved file utf-8 encoding. my goal use python strip out symbols long list, .e.g. bfly, vpvix etc, , write them new file i using following code read file , split it: x=open('sometextfile.txt','r') y=x.read().split() the issue i'm seeing there unfamiliar characters popping , affecting ability filter list. example: print(y[0]) bfly i'm guessing these characters have encoding , have tried few different things codec module without success. using .decode('utf-8') throws error when trying use against above variables x o...

opencv - Calculate new coordinates of keypoints after transformation -

Image
how new coordinates of points a , b in exemple after transformation m (40 degrees counter-clockwise rotation) ? import cv2 cap = cv2.videocapture("http://i.imgur.com/7g91d2im.jpg") a, b = (100, 100), (200, 200) if cap.isopened(): ret, im = cap.read() rows, cols = im.shape[:2] im_keypoints = im.copy() point in [a, b]: cv2.circle(im_keypoints, point, 6, (0, 0, 255), -1) cv2.imwrite("im_keypoints.jpg", im_keypoints) m = cv2.getrotationmatrix2d((cols / 2, rows / 2), 40, 1) im_rotated = cv2.warpaffine(im, m, (cols, rows)) cv2.imwrite("im_rotated.jpg", im_rotated) m 2 3 rotation matrix, need apply m points. im_rotated_keypoints = im_rotated.copy() point in [a, b]: # convert homogenous coordinates in np array format first can pre-multiply m rotated_point = m.dot(np.array(point + (1,))) cv.circle(im_rotated_keypoints, (int(rotated_point[0]), int(rotated_point[1])), 6, (0, 0, 255), -1) ...

qt - prevent QApplication::exec from blocking main thread -

i have visual c++ program creates multiple gui on main thread. want show qwidget alongside other gui. currently, if call qapplication.exec(), blocks main thread until close window. there way prevent exec function blocking main thread or use qwidget without calling exec? the method not blocking main thread, on contrary: allows event loop execute, ensuring ui remains responsive. while widget shown, other gui responsive, qt's event loop interoperates native message queue. if want happen when dialog widget gets closed, connect relevant code e.g. dialog's accepted() signal.

Chrome Extension - Use Another HTML Source -

i'm creating extension , here want do. i have site "www.aaa.com" , extension developed can read , navigate dom element javascript. however, when click extension icon, i'd , read html source "www.bbb.com". the current page "www.aaa.com", want source of "www.bbb.com" in current page. how can this??

ios - Sending an NSTimer target message to a different class; extracting its userInfo parameter -

i using nstimer send message on interval. here code : { // .... var params : [string] = [] params.append(conversion) params.append(message) let timer = nstimer(firedate: date, interval: 60, target: self, selector: selector("importtextmessage.sendmessage:"), userinfo: params, repeats: true) nsrunloop.mainrunloop().addtimer(timer, formode: nsrunloopcommonmodes) // ... } func sendmessage(params: [string]){ ...} i have tried changing swift 2.2 syntax: let timer = nstimer(firedate: date, interval: 60, target: self, selector: #selector(importtextmessage.sendmessage(_:)), userinfo: params, repeats: true) but not change anything. from every other question posted "unrecognized selector sent instance", response "include colon in selector knows grab arguments userinfo", have included that, , can't figure out wrong. what note: the parameters function , parameters passed in through nstimer userinfo match up. both arr...

Testing transactionality of IBM Integration Bus -

in order improve flows, test few scenarios in flow/app or integration node stopped while message still being processed (to test how transactional flows are, depending on different settings). iib9 fast processing simple requests, don't have time shut down flow enough. tried use debugger, doesn't seem work; cannot stop flow or app while debugging, , shutting down integration node doesn't seem work either. is there (in-build) way make broker work have time shut down? or should think of complicated compute node keep occupied few seconds? any suggestions (also latter if best option) welcome. really complicated compute node take lot of cpu. prefer making flow wait something. eg. flow http request node or soap request node making call external service. make external service take time 120 seconds.

java - Requested Bean function generating error -

i've developed spring application overrides setterinjection on constructor injection. getter function generating error. book.java package com.abc.xyz; public class book { private string name; public string getname() { return name; } public void setname(string name) { this.name = name; } public book(string name) { this.name=name; } } spring.xml: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/ 2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd "> <bean id="bookbean" class="com.abc.xyz.book"> <property name="name" value="abcd"> </property> <constructor-arg value="efgh...

c++ - Quicksort correct implemetation but with some extra comparisons -

i'm trying pull maximum out of quicksort implementation. functionally correct , has canonical form, i've counted superfluous comparisons. use first element pivot: #include <vector> using namespace std; using uint = unsigned int; uint partitionsub(vector<uint>& inp, uint l, uint r, uint& numofcmp); void quicksort(vector<uint>& inp, uint l, uint r, uint& numofcmp) { if (r - l < 2) return; uint newpivotidx = partitionsub(inp, l, r, numofcmp); quicksort(inp, l, newpivotidx, numofcmp); quicksort(inp, newpivotidx + 1, r, numofcmp); } uint partitionsub(vector<uint>& inp, uint l, uint r, uint& numofcmp) { auto swap = [&inp](uint a, uint b) { uint buf = inp[a]; inp[a] = inp[b]; inp[b] = buf; }; //numofcmp += r - l; // can use this, ++numofcmp before // comparison more clear uint = l + 1; uint j = l + 1; uint p = in...

xcode - How to present a custom modal in swift -

Image
i don't know how can in xcode , maybe interface builder or programmaticaly ? i want display modal : i can pods want create own modal i make kind of modals in storyboard. give view of view controller black background color, alpha lower 1. make sure modalpresentationstyle set on current context.

javascript - angularJS - Unable to load API Json response data into my HTML file -

Image
here code using: angular.module('ngapp', []) .factory('authinterceptor', authinterceptor) .constant('api', 'http://myserver.com/app/api') .controller('task', taskdata) function taskdata($scope, $http, api) { $http.get( api + '/tasks' ). success(function(data) { $scope.maintask = data; console.log(data); }); } here html file: <html> <head> <title>pcc ecar app</title> <link href="../app.css" rel="stylesheet" /> </head> <body ng-app="ngapp" ng-controller="task" class=""> <div class="view1"> {{maintask.amount} </div> <!-- third party scripts --> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script> <!-- main app script --> <script src="../app/app.js"></script> </body...

javascript - Later.js recur every hour not working as intended? -

i'm using later.js recurring events. i'm trying test recur() function , doesn't seem working properly, , don't know why. here's example: var schedule_hourly = later.schedule(later.parse.recur().every(x).hour()), start_hourly = moment(start_day + " " + start_time, 'yyyy/mm/dd hh:mm'); var occurrences_hourly = schedule_hourly.next(y, start_hourly); (var = 0; < occurrences_hourly.length; i++) { var execution_dates_hourly = []; execution_dates_hourly = moment(occurrences_hourly[i]).format('yyyy/mm/dd hh:mm'); console.log(execution_dates_hourly); } where: x , y values can change; start_day in format yyyy/mm/dd; start_time in format hh:mm. with initial date of 2016/07/20 10:00, x=2 , y=5 following on console: 2016/07/20 10:00 2016/07/20 12:00 2016/07/20 14:00 2016/07/20 16:00 2016/07/20 18:00 so it's working correctly. repeating event every 2 hours, starting @ 10:00 hours repeats 5 times. however...

ios - Change the Tint Color of UITableView Multiple Selection Check Circles -

Image
when enable allowsmultipleselectionduringediting on uitableview , enter edit mode on it, each row display light grey circle on left hand side. upon tapping row, circle replaced tick icon, of tint colour set table view. i'm wondering, there way override tint colours of both of these icons , control them manually? i've discovered if set cell.tintcolor , can override tint colour of icon when it's checked (but not hollow circle graphic), i'd rather able change tint colour of icon. i'm getting sinking feeling way manually hack internal subviews, i'm hoping may have found way i've missed. setting tintcolor property of cell should enough. e.g. cell.tintcolor = .green

ios - Data being sent to new ViewController is being sent as nil -

when try pass details of event class controller error saying "fatal error: unexpectedly found nil while unwrapping optional value". this view controller sends info: var eventdetailscontroller: eventdetailscontroller! func showdetailview(event: events){ let mainstoryboarrd: uistoryboard = uistoryboard(name:"main", bundle:nil) let detailsviewcontroller: uiviewcontroller = mainstoryboarrd.instantiateviewcontrollerwithidentifier("eventdetailsid") print(event) // prints event fine showing event variable not nil eventdetailscontroller?.event = event //this sends info nil self.presentviewcontroller(detailsviewcontroller, animated: true, completion: nil) } this class send data to: var event: events! { didset { eventpricelabel.text = event!.date //does nothing cause nil } } override func viewdidload() { super.viewdidload() let string = event?.name print(string)// prints null } my events...

python 3.x - Images disappear when resizing window in Kivy -

i've been following tutorial in kivy , encounter problem. when i'm changing size of window images doesn't display. code is: from kivy.core.window import window kivy.uix.widget import widget kivy.uix.image import image kivy.app import app class sprite(image): def __init__(self, **kwargs): super().__init__(**kwargs) self.size = self.texture_size class game(widget): def __init__(self): super().__init__() self.background = sprite(source="sprites/cartoonforest.png") self.size = self.background.size self.add_widget(self.background) class gameapp(app): def build(self): game = game() window.size = game.size return game if __name__ == '__main__': gameapp().run() i played around bit, imported different images of different extensions , sizes, changed in code , such, when left out line window.size = game.size in build method in gameapp displayed image. when resized ...

how to run R from HTML/Java and host on Jboss/tomcat server -

i have developed google plot graphs , others graphs in r. output here plots interaction mouse hover , update plots every 5 minutes (not jpeg). want run r script dynamically , render on html. have hosted these on shiny-server using <iframe> embed in html. now how can host these on different server (html , r on same server). by redirecting iframe content shiny server : html & js : <iframe name="myframe" ... /> js: window.frames["iframetest"].location = "http://myshinyserver:..." so 2 servers running ... if using js chart libraries ggvis, dygraphs ... , if have go app server, should javascript reproduce graphs ....

java - Struts2 File Download Permission Denied -

i have struts2 webapp running on tomcat 7 server. i'm trying allow user download file server. when running eclipse tomcat server , accessing localhost, have no issues downloading files. however when deploy onto server, when clicking on download link, following exception: java.io.filenotfoundexception: /var/tmp/myfile.pdf (permission denied) java.io.fileinputstream.open(native method) java.io.fileinputstream.<init>(fileinputstream.java:146) com.my.path.to.action.updateaction.execute(updateaction.java:201) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:606) com.opensymphony.xwork2.defaultactioninvocation.invokeaction(defaultactioninvocation.java:446) com.opensymphony.xwork2.defaultactioninvocation.invokeactiononly(d...

amazon web services - CloudHaskell running on AWS -

i have created 3 ec2 ubuntu instances on aws , trying run code: module main remotabledecl [ [d| distribute :: ([nodeid], int) -> process () distribute (slaves, x) = let x' = mymath x nextnode = slaves !! (x' `mod` (length slaves)) $ show x ++ " - 1 = " ++ show x' unless (x' == 0) $ void $ spawn nextnode $ $(mkclosure 'distribute) (slaves, mymath x) |]] remotetable = __remotetabledecl initremotetable master :: backend -> [nodeid] -> process () master backend slaves = liftio . putstrln $ "slaves: " ++ show slaves distribute (slaves, 15) terminateallslaves backend main :: io () main = prog <- getprogname args <- getargs case args of ["master", host, port] -> backend <- initializebackend host port remotetable startmaster backend (master backend) ["slave", host, port] -> backend <- initializebackend host port remotetable ...

python - How do I use Flask Migrate to create a SIMILAR TO constraint? -

i build constraint on status, using flask migrate. status not yet exist. my model includes line: status = db.column(db.string(120), unique=false) i add following constraint on status in addition create status: alter table inventory add constraint "statuscheck" check ("status" similar 'ordered|received|ready|faulty|void'); you can write sql in migration scripts. see http://alembic.zzzcomputing.com/en/latest/ops.html#alembic.operations.operations.execute . side note: flask-migrate wrapper alembic, make flask friendly. question alembic.

java - How to color cells of jtable depending on cell's value -

i want color specific cells of jtable. here render class. put sysout on if blocks. strings printed color of cells didn't change except 1 of them. public class myrenderer extends defaulttablecellrenderer { static double rpmmin, rpmmax, speedmin, speedmax, temperaturemin, temperaturemax, voltagemin, voltagemax; public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { component c = super.gettablecellrenderercomponent(table, value, isselected, hasfocus, row, column); if (!table.isrowselected(row)) { if (column == 2 && double.parsedouble(value.tostring()) > rpmmin && double.parsedouble(value.tostring()) < rpmmax) { c.setbackground(color.pink); } if(column == 3 && double.parsedouble(value.tostring()) > speedmin && double.parsedouble(value.tostring()) < speedmax){ ...

django - How to create dynamic methods with python? -

for project need dynamically create custom (class) methods. i found out not easy in python: class userfilter(django_filters.filterset): ''' filter used in api ''' # legacy below, has added dynamically #is_field_type1 = methodfilter(action='filter_field_type1') #def filter_field_type1(self, queryset, value): # return queryset.filter(related_field__field_type1=value) class meta: model = get_user_model() fields = [] but giving me errors (and headaches...). possible? i try make code between #legacy dynamic one option found create class dynamically def create_filter_dict(): new_dict = {} field in list_of_fields: def func(queryset, value): _filter = {'stableuser__'+field:value} return queryset.filter(**_filter) new_dict.update({'filter_'+field: func}) new_dict.update({'is_'+field: methodfilter(action='filt...

c# - Unrecognized attribute 'targetFramework' when upgrading frameworks -

Image
i'm getting following error after changing website framework 4.0 4.5.2: unrecognized attribute 'targetframework'. note attribute names case-sensitive. make sure have selected correct app pool in iis or register new framework. check this: unrecognized attribute 'targetframework'. note attribute names case-sensitive

java - fatal exception asynctask #2 AndroidRuntime -

fatal exception: asynctask #2 in application. can please tell me why , tell me need do. pretty confused right , need little help. here code bundle b = getintent().getextras(); pdialog = new progressdialog(dataactivity.this); id = b.getstring("id"); exists = b.getboolean("exists"); final string myurl = "http://xxxxxxxxxx/api.php?id="+id; try { new myasynctaskgetnews().execute(myurl,"false"); }catch (exception e){log.d("d2",e.tostring());} ib = (imagebutton)findviewbyid(r.id.imagebutton); ib.setonclicklistener(new view.onclicklistener(){ @override public void onclick(view v) { try { new myasynctaskgetnews().execute(myurl,"true"); }catch (exception e){log.d("d1",e.tostring());} } }); and logcat 07-25 19:47:25.393 8717-9017/com.xxxxxxxx.xxxx e/androidruntime: fatal exception: as...

c++ - Random list of numbers -

#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <math.h> int main() { int i; int diceroll; for(i=0; < 20; i++) { printf("%d \n", rand()); } return 0; } this code wrote in c (codeblocks) random numbers, problem same sequence: 41,18467,6334,26500 etc... i'm still learning please try explain you're talking 8 year old d: you same sequence each time because seed random number generator isn't set. need call srand(time(null)) this: int main() { srand(time(null)); ....

java - Epub and android. How to get part of html and fit it in webview -

i developing reader , encountered problem. want open epub files webview. don't know how such number of text fitting in webview 1 page. think need devide html files epub. how ? me please. try use epub.js . it'js library epub pagination toc , bookmarks.

javascript - Set tabindex in vertical order of columns -

i assigning tabindex input type text, , not disabled/hidden. following tried, , works. however, order of indexes horizontally assigned in table. need order of tabindex in column wise rather horizontal. suggestions how achieve ? want order follow q follow enter key follow tabindex (in scenario enter key changed behave tab) . col1 col2 col3 1 3 7 2 4 8 5 9 6 10 (":input:not([disabled]):not(:hidden)").not($(":submit")).not($(":reset")).each(function (i) { $(this).attr('tabindex', + 1); }) based on this solution arrow keys modified code work enter key , tab key specified column-wise mode. i don't think best idea specify tabindex attributes such case. have recaltulate them on every change in number of columns or rows. change flow of focusable elements on page (table first surrounding). /*! * based on formnavigation https://github.com/omichelsen/formnavigation */ ...

mysql - PHP: How to grab an array checkbox value and then insert each individual result into a database query? -

i have form has checkbox list generated dynamically: name="cursoid[]" each value correspond cursoid ( $curso['cursoid'] ), value taken mysql select query shows me list of items ids. the user may select n number of items, , need take each 1 of (ie. $cursoid = $_post['cursoid']; ) in order save them insert query. in form, generate each item while loop: <?php $conectar = mysqli_connect(host, user, pass, database); $query = " select cursoid, nombrecurso, cursofechainicio, modalidadcurso, estadocurso cursos estadocurso='abierto'"; $buscarcurso = mysqli_query($conectar,$query); echo '<div class="checkbox">'; while ($curso=mysqli_fetch_assoc($buscarcurso)) { echo '<input type="checkbox" name="cursoid[]" value="'.$curso['cursoid'].'">'.$curso['nombrecurso']; } echo '</div>'; ?> my database consultation in order insert ...

asp.net - C# Populating CheckBoxList from database (strange column/header text name) -

Image
i working on small project asp.net web forms, backend language c#, , want populate checkboxlist database, , did it, values strange, need names of database columns or something, because right looks this: on windows forms know do, (display member = "name") , problem solved, on web dont know how columns name, because looks strange.. thanks guys, cheers. if checkboxlist not instructed otherwise, calls object.tostring() populate text property of listitems . if tostring() not overridden, default implementation this.gettype().tostring() seeing. gettype() returns such bizarre value because entity framework dynamically subclassing class @ run-time. my preferred way of doing override tostring() return name property, good practice in general override tostring() classes. another option assign datatextfield property of checkboxlist "name".

How to import a class from a python file in django? -

i'm using django , putting python code in views.py run them on webpages. there excerpt of code requires class python file work sort of package python file given use in order execute piece of code. how able reference class python file in django views.py file? have tried putting python file in site packages folder in anaconda3 folder , have tried using [name of python file] import [class name] in views.py file not seem recognize file exists in site packages folder. tried putting python file in django personal folder , using personal import [name of file] doesn't work either you can put mypythonfile.py in same directory of views.py file. , from mypythonfile import mystuff in views.py

mapbox - How do I query features above a certain height in OpenStreetMap? -

i'd query objects taller 20m within bounding box on osm? is possible can place them on map or generate map tile them drawn on it. you can query overpass api objects have height tag in first place , filter results in language can process json or xml (overpass cannot compare tag values > ).

azure - Using ADAL in .net 3.5 -

i have azuread registered web api working correctly. able acquire access token means of acquiretokenasync. no problems there. however, no need downgrade rest client library .net 3.5. not being able use adal in .net 3.5. acquiretokenasync returns task, not supported in 3.5. have read in tutorials there non async verstion of method (acquiretoken) here . can't access method. also, when try install specific version of adal(2.19.208020213) nuget error saying there no version supported .net 3.5 what doing wrong? update i trying find out version of adal targets .net 3.5 can install in project. update 2 if adal not supported in .net 3.5, options obtain authorization token azure ad in .net 3.5? the library supports 4.5 because async support added in .net release. may need dig old versions of library older .net sdk work. lose significant big fixes , features.

sql server - Executing stored procedure not working but individual statements working in stored procedure -

i have following stored procedure trying execute. set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[usp_create] ( @originatingtransactionid varchar(50), @associatedoriginatingtransactionid varchar(50), @lineofbusiness varchar(50), @riskstate varchar(50), @occupationcode varchar(50), @sourcesystem varchar(50), @documentcategory varchar(50), @documenttype varchar(50), @transactionflow varchar(50), @bundlename varchar(50), @documentid varchar(50), @documentname varchar(50), @policyorclaimnumber varchar(50), @effectiveorcreationdate datetime, @signaturedetect bit ) begin set nocount on; declare @finaldate datetime, @ruleid varchar(50), @rulename varchar(50), @currentactionid int, @bundletransactionid int if (@signaturedetect = 'true') begin if (@originatingtransactionid = @associatedoriginatingtransactionid) begin i...