Posts

Showing posts from March, 2012

javascript - XML feed change url's -

i setting shopping feed within shopify . i'm using amasty app generate it. there appears problem url. because saas package, it hosted @ shopify. google info uses www.shopname.com address, xml sheet gets https://shopname.myshopify.com . this results in errors, because urls not match. i want capture url , change in every product line use shopname.com address. how can achieve that?

javascript - Raycasting hard-faces of a mesh -- Three.js -

i created box in three.js var scene = new three.scene(); var camera = new three.perspectivecamera( 100, window.innerwidth/window.innerheight, 0.1, 1000 ); camera.position.set(5, 5, 10); var geo = new three.boxgeometry(5,2,5); var mat = new three.meshbasicmaterial({color:0xff0ff0, wireframe:false, vertexcolors: three.facecolors}); var mesh = new three.mesh( geo, mat); scene.add(mesh); var renderer = new three.webglrenderer(); renderer.setsize( window.innerwidth, window.innerheight ); document.body.appendchild( renderer.domelement ); renderer.render(scene, camera); after want raycast cubes faces mouse on on.thus created function var raycaster = new three.raycaster(); var mouse = new three.vector2(); function onmousemove( event ) { mouse.x = ( event.clientx / window.innerwidth ) * 2 - 1; mouse.y = - ( event.clienty / window.innerheight ) * 2 + 1; raycaster.setfromcamera( mouse, camera ); var intersects = raycaster.intersectobject( mesh); ( var

java - Misusing ThreadPoolExecutor - OOM errors -

im reading files sqs in unbounded stream. read each file want submit second queue processing. can simultaneously process several files put these threads , want block further reads queue when threads in use. to end used this: executorservice executorservice = new threadpoolexecutor( maxthreads, // core thread pool size maxthreads, // maximum thread pool size 1, // time wait before resizing pool timeunit.minutes, new arrayblockingqueue<runnable>(maxthreads, true), new threadpoolexecutor.callerrunspolicy()); where maxthreads = 2 . files read in blocks of ten , processed such: for (message msg : resp.getmessages()) { gson g = new gson(); messagebody messagebody = g.fromjson(msg.getbody(), messagebody.class); messagerecords messagerecords = g.fromjson(messagebody.getmessage(), messagerecords.class); list<messagerecords.record> records = messagerecords.getrecords(); executorservice.submit(new runna

AKKA.NET actor system not shut down correctly in asp.net core application -

i'm running akka.net actor system inside asp.net core application (framework net46). run web-application command prompt running 'dotnet run' , when try exit using ctrl-c following output , prompt hangs there: c:\d3\>19:05:33.7024266 env=d0 sdm.web debug akka.actor.internal.actorsystemimpl disposing system 19:05:33.7084292 env=d0 sdm.web debug akka.actor.internal.actorsystemimpl system shutdown initiated [debug][12/09/16 19:05:33][thread 0023][eventstream] subscribing [akka://all-systems/] channel akka.event.debug 19:05:33.7134423 env=d0 sdm.web debug akka.actor.guardianactor stopping [debug][12/09/16 19:05:33][thread 0023][eventstream] subscribing [akka://all-systems/] channel akka.event.info [debug][12/09/16 19:05:33][thread 0023][eventstream] subscribing [akka://all-systems/] channel akka.event.warning [debug][12/09/16 19:05:33][thread 0023][eventstream] subscribing [akka:/

Valid URL to register on Google MAP -

i running application on : http:// myfakedomain.com:4502/ application accesses google map api. registered domain myfakedomain .com google map , , getting : google maps api error: unauthorizedurlforclientidmaperror when setting url google map , http:// myfakedomain.com:4502/ different http:// myfakedomain. com ? what url should used set google map api ? the error message indicates using client id. in case should authorize urls in google maps work support portal described in https://developers.google.com/maps/premium/previous-licenses/clientside/auth#register-urls if still have issues should file issue via support portal.

sonarqube - Sonar Maven plugin is failing because of a newer maven assembler plugin, how can I get the new plugin to pass properties correctly? -

had update our maven assembler version 1.1.8 1.1.6. it's change happened , sonar maven plugin throwing exception: [error] failed execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default) on project reconcoverage: java.util.arraylist cannot cast java.lang.string -> plugins: <groupid>org.codehaus.mojo</groupid> <artifactid>sonar-maven-plugin</artifactid> <version>2.7</version> <groupid>com.corpname.raptor.build</groupid> <artifactid>assembler-maven-plugin</artifactid> <version>1.1.8</version> i have been looking week, upgrading assembler version required. no other teams experiencing issue upgrade because using sonar through jenkins. i'm using maven plugin because our project has many modules, , structures coverage results match it. i have looked through sonar's code , seems happening in sonar.batch.bootstrap.userproperties. i'm guessing happening when s

javascript - validationEngine('validate') not a function -

i have simple form want know if form @ valid state or not. this project using jquery validation engine i using same version 2.6.2 according docs supports function validationengine('validate') returns true or false depending on state of form. i keep getting error typeerror: $(...).validationengine not function strangely enough form throwing validation errors required. i did check validationengine plugin loaded after jquery , before js file triggering call. form selector correct. the form: <form name="editprofileform" method="post" action="#" class="epf" id="editdiaryform" style="display:none;"> <a href="javascript:void(0)" onclick="togglecancel(this,'addplay');$('#editdiaryform')[0].reset();;" class="pull-right action-link">cancel</a> <a href="javascript:void(0)" onclick="submitdiary('#editdiaryf

neural network - Backpropagation through time in stateful RNNs -

if use stateful rnn in keras processing sequence of length n divided n parts (each time step processed individually), how backpropagation handled? affect last time step, or backpropagate through entire sequence? if not propagate through entire sequence, there way this? the propagation horizon limited second dimension of input sequence. i.e. if data of type (num_sequences, num_time_steps_per_seq, data_dim) prop done on time horizon of value num_time_steps_per_seq take @ https://github.com/fchollet/keras/issues/3669

jni - How to build Java project while using shared library? -

i have java class needs access shared library class. how can write code use shared library , build project? public void callapp(){ externalprop prop = new externalprop(); prop.set("name", "test user"); prop.set("eligibility", "master"); prop.set("id", "103452"); } externalprop available in driver-prop.jar file, asked use shared library (not added project). since externalprop not in build path, compile time error externalprop cannot resolved type can help? i have resolved by, 1) compilation - added library external jar maintained in shared location , updated classpath (build path) refer jar. jar maintained outside of project. 2) deployment - created shared library in web sphere environment , referenced library application. https://www.ibm.com/support/knowledgecenter/en/ssaw57_8.5.5/com.ibm.websphere.nd.doc/ae/ucws_rsharedlib_map.html

python - Matplotlib- How to make color fill bias towards max & min values? -

Image
the issue i have plot of correlation of 2 variables of values close either -1 or 1. i'm using seismic colormap (red & blue w/ white in middle), of plot either dark blue (close -1) or dark red (close 1), showing little detail near min & max values. the code here's code block used plotting. #set variables lonlabels = ['0','45e','90e','135e','180','135w','90w','45w','0'] latlabels = ['90s','60s','30s','eq.','30n','60n','90n'] bounds = np.array([-1.0,-0.8,-0.6,-0.4,-0.2,0,0.2,0.4,0.6,0.8,1.0]) #create basemap fig,ax = plt.subplots(figsize=(15.,10.)) m = basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,llcrnrlon=0,urcrnrlon=360.,lon_0=180.,resolution='c') m.drawcoastlines(linewidth=1,color='w') m.drawcountries(linewidth=1,color='w') m.drawparallels(np.arange(-90,90,30.),linewidth=0.3) m.drawmeridians(n

javascript - Three.js: Rotate object on mobile devices -

referring similar question here , trying object rotated on smartphones/tablets. since got mousedown method, won't apply touching on mobile devices. there solution that? try touchstart , touchend event listeners touch screens. window.addeventlistener("touchstart", handlestart, false); window.addeventlistener("touchend", handleend, false);

keystonejs - Image links not rendering as html (left as [img] on blog) -

have set keystone.js use cloudinary images. upload on editor seems work, can see file in editor , on cloudinary. (proof below) http://res.cloudinary.com/keystone-demo/image/upload/v1473696039/y5v9oewncmuopq4d3vwi.jpg used standard settings per documentation on webpage, changes keystone.js file below: 'wysiwyg override toolbar': false, 'wysiwyg menubar': true, 'wysiwyg skin': 'lightgray', 'wysiwyg cloudinary images': true, 'wysiwyg additional buttons': 'searchreplace visualchars,' + ' charmap ltr rtl pagebreak paste, forecolor backcolor,' +' emoticons media, preview print ', 'wysiwyg additional plugins': 'example, table, advlist, anchor,' + ' autolink, autosave, bbcode, charmap, contextmenu, ' + ' directionality, emoticons, fullpage, hr, media, pagebreak,' + ' paste, preview, print, searchreplace, textcolor,' + ' visualblocks, visualchars, wordcount', howev

html - Create hover effect on a div or button -

i trying create hover-over effect div font-awesome icon inside. tried making button out of because div doesnt have href (the "link" points overlay ), here no luck. how create hover-over effect on fa icon has no href ? .read-more { padding: 5px 10px; display: inline-block; -moz-border-radius: 140px; -webkit-border-radius: 140px; border-radius: 100px; -moz-box-shadow: 0 0 2px #888; -webkit-box-shadow: 0 0 2px #888; box-shadow: 0 0 2px #888; background-color: #fff; opacity:0.7; color: #888; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); } .read-more:hover { color:#fff; background-color:#000; } <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/> <a href="#" target="_blank"> <div class="well carousel"> <

stomp - How set the nativeHeaders to Spring Java SockJS client on CONNECT frame -

i have implemented java sockjs client websocket on stomp using spring famework 4.3.2 actually. javascript client create nativeheaders java client dont create. java client: standardwebsocketclient websocketclient = new standardwebsocketclient(); list<transport> transports = new arraylist<>(2); transports.add(new websockettransport(websocketclient)); sockjsclient sockjsclient = new sockjsclient(transports); websocketstompclient stompclient = new websocketstompclient(sockjsclient); stompclient.setmessageconverter(new simplemessageconverter()); stompclient.settaskscheduler(taskscheduler); stompsessionhandlerimp stompsessionhandlerimp = new stompsessionhandlerimp(); websockethttpheaders handshakeheaders = new websockethttpheaders(); handshakeheaders.add("tokengroup", "192:168:99:3::demo"); handshakeheaders.add("targetnickname", "null_borrar"); stompclient.connect(stompurlendpoint.tostring(), handshakeheaders, sto

git - Is a private repository on github or bitbucket safe for storage of passwords? -

as understand, despite email servers use tls encrypt messages transfer between different targets , destinations,the contents on mail servers no means encrypted. that's reason why sending passwords via email not recommended. on surface, it's appealing save sensitive information in git repositories sake of convenience. however, seems hit same issue mail server's dilemma. so i'm wondering if saving passwords in private git repository likewise unsafe mail server. thanks in advance! please don't that. storing passwords on thirdparty services bad idea, ones not designed secure data storage. github has pretty detailed article security: https://help.github.com/articles/github-security/ they don't encrypt repositories on disk because, point out: we not encrypt repositories on disk because not more secure: website , git back-end need decrypt repositories on demand, slowing down response times. user shell access file system have access decrypt

python - Extracting column labels of the cells meeting a given condition -

suppose data @ hand in following form: import pandas pd df = pd.dataframe({'a':[1,10,20], 'b':[4,40,50], 'c':[10,11,12]}) i can compute minimum row with: df.min(axis=1) which returns 1 10 12 . instead of values, create pandas series containing column labels of corresponding cells. that is, a c . thanks suggestions. you can use idxmin(axis=1) method: in [8]: df.min(axis=1) out[8]: 0 1 1 10 2 12 dtype: int64 in [9]: df.idxmin(axis=1) out[9]: 0 1 2 c dtype: object in [11]: df.idxmin(axis=1).values out[11]: array(['a', 'a', 'c'], dtype=object)

sql server - Calculate SQL values into new insert -

i don't have enough points post images, here link table screen shot: my query screen shot i have sql server table sick , leave time taken employees. our code did not enter forward balance 2016-08-01 (that has been fixed). need take forward balance 2016-07-01 (19.32) , add earned 2016-06-30 (6.66) , subtract taken between 2016-07-01 2016-07-31 (3, 6 , 1.5) , insert new record similar row 3 , 10 forward balance should 13.48. how write sql statement employeeid ? tried use sum didn't work out right. select value employeevacations vacation_kind = 'sl' , vacation_type = 'forward' , creationdate = '2016-07-01' , employeeid = 1775 plus: select value employeevacations vacation_kind = 'sl' , vacation_type = 'earned' , creationdate = '2016-06-30' , employeeid = 1775 minus: select sum(value) totaltaken employeevacations vacation_kind = 'sl' , vacation_type = 'taken' , creationd

python - Space complexity of list creation -

could explain me space complexity of beyond program, , why it? def is_pal_per(str): s = [i in str] nums = [0] * 129 in s: nums[ord(i)] += 1 count = 0 in nums: if != 0 , / 2 == 0: count += 1 print count if count > 1: return false else: return true actually, i'm interested in lines of code. how influence on space complexity of above program? s = [i in str] nums = [0] * 129 i'm unclear you're having trouble this. s list of individual characters in str . space consumption len(s) . nums constant size, dominated o(n) term. is code wrote, or has been handed you? programming style highly not "pythonic". as code, start collapse: count = 0 char in str: val = ord[char] + 1 if abs(val) == 1: count += 1 print count return count == 0 first, replaced single-letter variables ( s => char ; i => val ). cut out most of intermediate steps, leaving in couple read code. finally, used

c# - Regex: Match everything after first blank line -

Image
i trying create regex matches after not including first blank line in c#. example: having input of: this header info dont' : want in file want below line until end of file stuff would result in: i want below line until end of file stuff you can use single line , multiline flag in regex this: ^$.* working demo btw, if have multiple white spaces in line, use: ^\s*$(.*) and grab content capturing group

python - How can I fix my function? -

i being told.. comments fix function make "cleaner". i've tried alot.. don't know how use llambda accomplish i'm trying do. code works.. isn't being asked of me. here code suggestions on how fix it. def immutable_fibonacci(position): #define lambda instead of def here def compute_fib (previousseries, ignore): newlist = previousseries if len(newlist) < 2: # outside , keep function focused on returning new list last element being sum of previous 2 elements newlist.append(1) else: first = newlist[-1] second = newlist[-2] newlist.append(first+second) return newlist range=[none]*position return reduce(compute_fib, range, []) #above code. how this: #next_series = lambda series,_ : (use these instead of above line) #return reduce(next_series, range(position - 2), [1, 1]) anything helps.. confused on how can implement these suggestions. here attempted. de

php - Difference between the current date and the birthday date inserted in a form -

on form, user must enter date of birth. php should control if has accomplished 18 years. $birth = $_post['data_nascita']; $str_birth = strtotime ($birth ); $today = date("m/d/y"); $str_today = strtotime ($today); if($today - $str_today < 567648000) { echo'you can't drive car in italy because underage';exit(); } // 18 years * 31536000 second in 1 year = 567648000 if put on birth field date of 14 september 1998 (today 13 september 2016, 18 years don't entirely spend yet), control doesn't work; works starting 15 september 1998. why lost 2 days? i recommend using datetime class has date , time functionality , maths built it. an example: $birth = new datetime($_post['date_of_birth']); $today = new datetime('now'); $diff = $birth->diff($today); if($diff->format('%y') > 18) { echo "can drive"; } else { echo "can't drive"; }

How to convert java 8 map, filter and streams to scala? -

i new scala trying understand changing equivalent java scala better understanding. how convert java 8 map, filter , streams scala ? i have following java 8 code trying convert scala : public set<string> getvalidusages(string itemid, long sno, date timeofaccess) { set<string> itemset = sets.newhashset(); testwindows testwindows = items.get(itemid).gettestwindows(); final boolean istv = existseligibletestwindow(testwindows.gettv(), timeofaccess); if (istv) { itemset.add(tv);

sorting - algorithm to find the median value from an array with an odd number of elements -

this question has answer here: finding median of unsorted array 6 answers i know if there exists algorithm find median of array of odd length. 1 sort array , take middle ideally being interested in median 1 make gains in terms of time complexity of algorithm. if no such algorithm exists, suggestions regarding how go developing such algorithm great. thanks this solved selection algorithm , , can done in o(n) time. quickselect , or refinement introselect, popular methods. a brief summary of quickselect run quicksort, rather sorting both halves @ each step, sort half contains element you're looking for, can determined counting how many elements in each partition. c++, example, has standard library function: nth_element .

jquery - javascript not working from network drive -

i'm trying run below file. runs fine when run on local drive if place on network drive no longer works. idea why might be? the below code trying run. using pivottable here: https://github.com/nicolaskruchten/pivottable . <!doctype html> <html> <head> <title> demo</title> <!-- external libs cdnjs --> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <!-- pivottable.js libs ../dist --> <link rel="stylesheet" type="text/css" href="../dist/pivot.css"> <script type="text/javascript" src="../dist/pivot.js"></script> <style> body {font-family: verdana;} </style> <!--

javascript - Why firebase database now returns null when used to work great? -

i have firebase web app used read , write firebase database fine. of week same code: var ref = new firebase ('https://myapp.firebaseio.com/web/data'); ref.child(id + "/slot" + timeslot + "/vote").on("value",function(snapshot){ console.log(snapshot.val()); // returning null sval = (snapshot.val()); now returns null sval . can please explain 1.why , 2.what should it? thank you.

javascript - jquery doesnt work when using this approach -

my html form generate info before submiting it. <script type="text/javascript" language="javascript" src="js/jquery.min.js"></script> <script type="text/javascript" language="javascript" src="js/submit.js"></script> <form id="myform" class="form-horizontal" method="post"> <input type="text" id="lname" name="lname"required> <input type="text" id="fname" name="fname"required> <input type="text" id="mname" name="mname"required> <input type="button" id="submitformdata" onclick="submitformdata();" value="generate" /> </form> <div id="results1"> <hr> </div> //submit.js function submitformdata() { var lname = $("#lname").val()

Creating a man page in Minix 3? -

i'm unsure on how go creating new man page in minix 3. groff , troff aren't available in minix, , after researching can't find alternative. how go creating new man page in minix? minix3 has mandoc (aka mdocml ) in its tree supports both mdoc(7) , legacy man(7) . the mandoc(1) utility, default, writes formatted text standard output, , -a option causes pipe output pager "just man(1) would". mandoc -a path/to/myprog.1

angular - AngularJS2 in PHP Apache -

today first day on angularjs. following few tutorials on angularjs v.2 javascript. there prerequisite of node.js. development environment php mysql apache (xampp). my question is, can write & run angular app on apache without node.js? angular2 , ecosystem heavily depend on npm , node. while theoretically develop application in non-node environment, nightmare set , maintain. setting proper tool-chain take ages if @ possible. it'd total waste of time , painful experience. ending frustrated setting node. edit: backend can xampp based fine! there's no need use node based production environment.

Mongo db update on array object -

{ "_id" : objectid("4faaba123412d654fe83hg876"), "user_id" : 123456, "total" : 100, "items" : [ { "item_name" : "my_item_one", "price" : 20, "veriety": [{ color:"red", make:"plastic" },{color:"green", make:"metal" }] }, { "item_name" : "my_item_two", "price" : 50, "veriety":[ { color:"red", make:"plastic" } ] }, { "item_name" : "my_item_three", "price" : 30, "veriety":[ {

django - resizing horizontal filter for group admin page -

i'm trying resize horitontal filter default group admin page because small. here i've tried: admin.py: class groupadmin(admin.modeladmin): filter_horizontal = ('permissions',) class media: js = ('js/group_admin.js',) admin.site.unregister(group) admin.site.register(group, groupadmin) group_admin.js: $(function() { $("#id_permissions_from").css("height", 600); $("#id_permissions_from").css("overflow", "scroll"); $("#id_permissions_to").css("height", 600); $("#id_permissions_to").css("overflow", "scroll"); }) it's not resizing , not showing javascript error. if run javascript above in console works fine; there must wrong order of javascripts getting loaded. i'm using django 1.8. ideas? you can .js or .css also. try js: $(document).ready(function(){ $("#id_permissions_from").css("height&qu

web - Detect Edge browser using java -

i want detect edge browser(windows 10) using useragentfamily enum class(package net.sf.uadetector). there no option related edge broswer. such useragentfamily .ie , useragentfamily . safari detecting ie , safari browser. how detect edge broswer using userfamily. use library has features want. example, user-agent-utils . if want use library using now, can try build newer version, seems has some bugs relating edge

checkbox - Counting number of current checked boxes and output that number in c# -

i trying count number of current checked "checked box" in group box. have 10 check boxes. i been trying code managed count upward if checked box not other way around. adding (but not +1 each time). so approach have take count number of current (not incrementing) checked boxes? thank you int checkedboxes = 0; private void checkbox1_click(object sender, eventargs e) { checkbox check = (checkbox)sender; bool result = check.checked; if (result == true) { btndone.enabled = true; } foreach (control c in grptoppings.controls) { checkbox cb = c checkbox; if (cb != null && cb.checked) { checkedboxes += 1; int how_many = checkedboxes; } } } private void btndone_click(object sender, eventargs e) { string name = textbox_ordername.text; messagebox.show("\nhow many: " + checkedboxes, "it done", messageboxbuttons.ok); } just move assi

excel - Get image from local path in php -

i working on bulk upload project using excel sheet , using cakephp 3.2 writing application. i have excel sheet column give image uploaded. user have 3 choices go either upload images pre defined directory before bulk upload , give name of image in cell , image automatically selected path. give url of image ( http://website/path/image.jpg ) give path of image if on local machine. ex., c:\user\pictures\image.jpg if windows , , /home/user/picture/image.jpg if linux this i'm doing save images $p_image = $objworksheet->getcellbycolumnandrow(30, $row)->getvalue(); if (filter_var($p_image, filter_validate_url)) { // image url $full_image_path = $p_image; } else { // image folder $path = configure::read('media.bulkupload.pre.product'); // full path of image root directory $full_image_path = $path . ds . $p_image; } $upload_path = configure::read('media.upload') . ds . 'files' . ds; // new name of im

c# - EF6 Strange Dateproblem / Context.SaveChanges messes up date -

in model have datetime object, filled webapi json string. the model.end reads in debugger: model.end {13.09.2016 23:59:59} system.datetime or in ticks: model.end.ticks 636094079999990000 long then set entity enddate model.end: appointment.enddate = model.end; store whole thing savechanges: appointment.lastedit = datetime.now; ctx.appointments.add(appointment); ctx.savechanges(); return appointment; //breakpointset at breakpoint, appointment object reads correct date: appointment.enddate {13.09.2016 23:59:59} system.datetime when reading ctx.appointments.tolist() in debugger, reflects correct date. but.... when connect database, , read on appointments table, end date set to: 14.09.2016 00:00:00 what?? comes second from? to answer own question: model.end.ticks 636094079999990000 long is model.end {13.09.2016 23:59:59} system.datetime but also: model.end.millisecond 999 int and database cant handle milliseconds, skips n

AngularJS - huge directive -

i have website has display different set of data on map. map same - areas 'onhover' effect , tooltip. there 10 different sets of data. i created directive display map directive (only draw map) angular.module('pluvioradapp.controllers') .directive('map', function() { return { restrict: 'e', link: function(scope, element, attrs) { var svg = d3.select(element[0]) .append("div") .classed("svg-container", true) //container class make responsive .append("svg") //responsive svg needs these 2 attributes , no width , height attr .attr("preserveaspectratio", "xminymin meet") .attr("viewbox", "0 0 1000 500") //class make responsive .classed("svg-content-responsive",