Posts

Showing posts from April, 2011

php - Share quiz results on Facebook -

i have spent hours researching seems tricky many developers out there. have small php quiz, outputting results form in following way: if (maxa) { echo ' <img src="imgs/result4.jpg"/> <div class="results2"> <p class="title">you bean</p> <p class="details">description</p> </div>'; } the question is, how add share button @ bottom of this, share result on facebook, description , picture. note there 4 available results. i have made public app, , inserted following in head: <script> window.fbasyncinit = function() { fb.init({ appid : '1382290368762081', xfbml : true, version : 'v2.3' }); }; (function(d, s, id){ var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) {return;} js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(docum

implicit conversion - Why are non-boolean values not implicitly converted in boolean expressions? -

some programming languages evaluate 5 == true to true, or allow if 5 expr by converting 5 bool. julia not. why? because == equivalence relation . in julia, true , when converted integer, becomes 1 , , 1 == true . if true == 5 , in order == preserve transitivity, imply 1 == 5

how to get value from hidden input type array using jquery -

how value hidden input type array input below , trying code <input type="hidden" name="position[]" value="10"> var arr= $('input[type="hidden"][name="position[]"]').val(); try code var arr = $('input[type="hidden"][name="position[]"]').map(function(){ return this.getattribute("value"); }).get();

javascript - How to do recurring event using fullCalendar in node.js and mysql -

i creating scheduling website based on fullcalendar plugin. we have requirement create recurring events. events repeated on weekly or daily basis. following example of event trying achieve event name: weekly review meeting day: monday time: 09:00 11:00 repeat: weekly (every monday same time 6 months) how can achieve that? have tried few options not seem work. can please logic?

sql - select Details fro where condition sub query getting error -

i having 2 tables. app_reviewreplay , app_userreview . using sub query different table condition , in sub query returning double values , getting error. error is subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. select * app_reviewreplay rid=(select rid app_userreview hallid=7095) either use join select r.* app_reviewreplay r join app_userreview u on u.rid = r.rid u.hallid=7095 or in clause select * app_reviewreplay rid in (select rid app_userreview hallid=7095)

java - Unable to POST large html content to server on Chrome -

i'm trying send html content through post request not getting delivered on server side using chrome. while request data in jsp when using mozilla. works in both browsers when html content small. i'm generating pdf html content using apache fop. var iframe = document.createelement('iframe'); iframe.setattribute('name','eyeframe'); document.body.appendchild(iframe); var myform = document.createelement('form'); document.body.appendchild(myform); myform.setattribute('action','myjsptorenderhtmlaspdf.jsp'); myform.setattribute('method','post'); myform.setattribute('target','eyeframe'); var hiddenfield = document.createelement("input"); hiddenfield.setattribute("type", "hidden"); hiddenfield.setattribute("name", "htmlcontent"); hiddenfield.setattribute("value", strhtml); myform.appendchild(hiddenfield); myform.submit(); i dividing html c

spring - Which template engine i have to use? -

i developing website spring mvc , hibernate sql database. colleagues suggested me use free marker or velocity template engine i'm using jsp template engine .i'm totally confused. so, can please tell me jsp best or not , why go jsp or?. each 1 of them have advantages use if need them, kind of questions answers depends on want achieve , how template engine you. for example, if want use generated html pages working mockups (because need show them), go thymeleaf . document shows key differences between thymeleaf , jsp.

redirect - PHP/cURL Redirection -

here problem i want post data page using curl, redirected destination page without using header function. the call must post request. i don't want retrieve data on call page. any solution ? please thank you there multiple way handle it. 1 simple solution save $data session , retrieve session data other file. another method create form values , post form using javascript.

python - Rolling argmax in pandas -

i have pandas timeseries , apply argmax function rolling window. however, due casting float rolling_apply, if apply numpy.argmax() , obtain index of slice of ndarray. there way apply rolling argmax series/dataframe? series.idxmax() or series.argmax() both return timestamp object pandas.rolling_apply(series, window=10,func=lambda x: pandas.series(x).idxmax()) return float64. edit: here example: import pandas pd import numpy np import pandas.io.data web import datetime start = datetime.datetime(2001,1,1) end = datetime.datetime.today() close = web.datareader('aapl','yahoo',start,end).close close = close / close.shift(1) - 1 close.resample('w-mon').idxmax() # timestamp object close.resample('w-mon').argmax() # timestamp object pd.rolling_apply(close.resample('w-mon'), window=52, func=lambda x: pd.series(x).argmax()) a working way be ix = pd.rolling_apply(close, window=52, func=np.argmax) ix = np.where(np.isnan(ix),0,ix

c# - WPF DataGridComboBoxColumn not showing initial binding value -

i succesfully binding collection datagrid , succesfully binding property datagridcomboboxcolumn. (there wpf tool called snoop allows me investigate if data has been bound). but reason initial data not being shown. after change selection manually. value visibly available. any tips or appreciated ! thank you, here xaml: <datagridcomboboxcolumn width="*" displaymemberpath="redoms" header="myheader" itemssource="{binding source={staticresource mymodel}, path=srcollection, mode=oneway}" selectedvaluebinding="{binding azsr,

css - How to make an image responsive in HTML email regardless of image size -

i creating email template container has max-width: 600px. want able upload images in excess of 800px wide, , images scale down maintain intended aspect ratio. if uploaded 800px wide image, scale 600px. in outlook, don't think supports max-width images therefore caused stretch. are there solutions this? yes , no. outlook tends force image actual size, regardless of css , html sizings. using images bigger want displayed on desktop version break on outlook. your best bet responsive images have images 100% width inside table has max-width set. around table, make conditional code mso contains set width table @ max-width size. example below: <!--[if gte mso 9]> <table width="640"><tr><td> <![endif]--> <table width="100%" style="max-width:640px;"><tr><td><img src="image.jpg" width="100%" /></td</tr></table> <!--[if gte mso 9]> </td><

Beginner - How to print the external values of an array in Matlab? -

## want write function receives array parameter , prints array's external values better using loops. e.g. if = [1, 2, 3, 4; 5, 6, 7, 8; 9, 10, 11, 12] then call printframe(a) display in code shows. this far can obtain array 0 in middle, not sure if way can lead me final purpose ---- printing frame of array## % text not showing clear enough want display following 1 2 3 4 5 8 9 10 11 12 function f = printframe(a) mat = []; [m,n]=size(a); i=1:n e = a(1,i); mat = [mat,e]; end j=2:(m-1) e = a(j,1); mat = [mat,e]; k = 2:(n-1) a(j,k)=0; g = a(j,k); mat = [mat,g]; end e = a(j,end); mat = [mat,e]; end i=1:n h = a(end,i); mat = [mat,h]; end l = 1:length(mat); f = fprintf('%5d',mat(l)); if rem(l,n) == 0 fprintf('\n'); end end fprintf('\n\n') end use bsxfun create mask , apply logical index . a needs transposed order want (rows first, columns). b = a.'; %' mask = bsxfun(@or, [1 zeros(1,s

visual studio - 32-bit .obj in 64-bit project -

i have 32-bit object file o.obj , want use in project uses 64-bit library l.lib . to make .lib happy, visual studio configuration needs set x64. however, linker throws error of error lnk1112: module machine type 'x86' conflicts target machine type 'x64' . i went through visual studio's linker options, nothing jumped out. there way resolve error? i under impression 32-bit code compatible 64-bit systems, modulo libraries. x86 executables (that is, object code compiled 32-bit x86 processors) can executed on x64 machines running 64-bit operating systems, through special compatibility mode supported jointly processor , operating system. feasible because x86 instruction set subset of x64 instruction set. however, many elements of abi differ between x86 , x64 code, notably calling conventions , pointer size. calling convention needs match between calling code , called code, or things screw up. thus, there no straightforward way call 64-bit code 32-b

wcf - There was no endpoint listening at net.tcp://localhost:10001 that could accept the message -

i'm having problem when moving wcf service windows 2003 server windows 2008 server. service communicates between web site , windows service on same server. service runs below configurations on both 2003 server , locally on windows 7 computers. on 2008 server, i'm getting following error message exception type : system.servicemodel.endpointnotfoundexception message: there no endpoint listening @ net.tcp://localhost:10001/dcfdirectcert/securityservice accept message. caused incorrect address or soap action. configuration web site <system.servicemodel> <diagnostics> <messagelogging logentiremessage="true" logmalformedmessages="true" logmessagesatservicelevel="true" logmessagesattransportlevel="true" /> </diagnostics> <bindings> <nettcpbinding> <binding name="directcertbindingconfig"> <security mode="no

regex for date in javascript -

this question has answer here: regex validate date format dd/mm/yyyy [duplicate] 16 answers how come when searching dd/mm/yyyy in string works: /(\d\d?)\/(\d\d?)\/(\d{4})/ but doesnt: /\d{2}\/\d{2}\/d{4}/ you have typo may not know why . second expression looking d{4} rather \ d{4} . without backslash, you're looking letter d rather number. additionally, {2} means you're looking 2 of preceding character/group, 1/1/2014 won't test positive. {1,2} match 1 to 2 consecutive items. first expression achieves functionality \d\d? . ? matches whether or not preceding character/group exists. var tests = [ { rx: /\d{2}\/\d{2}\/d{4}/, text: "10/10/dddd" }, // true { rx: /\d{2}\/\d{2}\/\d{4}/, text: "10/10/2014" }, // true { rx: /\d{2}\/\d{2}\/d{4}/, text: "1/1/2014" }, // false

java - How do you put a BufferedImage into a ByteBuffer? -

i have bufferedimage, need make bytebuffer can apply cubemap face. create byte[] bufferedimage can put bytebuffer. example create byte[] can found here: http://www.mkyong.com/java/how-to-convert-bufferedimage-to-byte-in-java/

group by - Datatable compute c# filter string -

i have problem code: _dtreturn.rows[i][_calculatedfield.outputcolumnname] = _dtsource.compute(_calculatedfield.enmfunction.tostring() + "(" + _calculatedfield.columnname + ")", _filterstring); the string generate seguent: _dtreturn.rows[i][_calculatedfield.outputcolumnname] = _dtsource.compute("sum(affidate)","lottoimportazione = 44438 , regione = 'sicilia'"); the code generate exception : from google translate: "an unhandled exception of type ' system.data.dataexception ' in system.data.dll additional information : invalid use sum () function , type of aggregation : boolean ." eccezione non gestita di tipo 'system.data.dataexception' in system.data.dll ulteriori informazioni: utilizzo non valido della funzione sum() e del tipo di aggregazione: boolean. can me?

java - Null Pointer Exception with objectinputstream -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i'm trying read list of names , phone numbers in. the program keeps throwing nullpointerexception. why doing this? int i=0; datab[] b = null; //b = null; // name of file open. string filename = "datt.dat"; try { // use reading data. byte[] buffer = new byte[1000]; fileinputstream fileis = new fileinputstream("datt.dat"); objectinputstream input = new objectinputstream(fileis); for(i=0; i<b.length; i++) b[i]=(datab)input.readobject(); input.close(); b null, b.length throws exception

how to check if a field exist in facebook graph api using python? -

as facebook graph api uses json format show data.i want books name liked friends using python , facebook graph api program stops when of friend have not read book. please give me way check if field exist or not.thanks in advance. here code : print name of friends , books liked them. id , access token given user. import requests import json base_url = raw_input("enter id : ") access_token = raw_input("paste here access token : ") base_url = '6365047697172' access_token = 'caacedeose0cbancfk1kuosp6gzcosmqzc17v1vzcmwra5fw16pks7iuoz2zailizcfnij32rzcvzb7kah0aa6dqludloyzbi6gs30vlzay2jp7zczm0tpbcnermkrpdt2pifxxdscnbzasskypikuxsppkksncemkeugbzb3upxniy4bw0dmkkqeuhqrns5xuxcdynevtyh17pzb09lgzboipw2' base_url = ' https://graph.facebook.com/ ' + base_url fields ='friends{books,name}' url = '%s?fields=%s&access_token=%s' % \ (base_url, fields, access_token,) def get_books(): """ return

cmd - Can i use XCOPY to copy only files that have changed size? -

i'm trying use xcopy backup .pst files outlook , backup files have changed since last use. normally easy using /d switch save files newer modified date outlook changes date when it's opened regardless of whether contents have changed. is possible use if statement compare file sizes , backup if file size different (not larger or smaller)? currently using: xcopy /m /f /i /y c:\*.pst \\networklocation\%username%\backup thanks this unbelievable tool copying cannot "update" target file. @ least xcopy cannot, , neither can robocopy afaik. batchfile clumsy gets job done: @echo off :: copy files targetdir if different, modified date or size or name set targetdir=backup %%f in (*.pst) call :copy_changed %%f %targetdir% goto :eof :copy_changed set saved=(none) set live="%~1" if not exist "%~2\%~1" goto :do_copy rem compare file metadata of %1 in current dir , dir %2 pushd "%~2" /f "tokens=3 usebac

Can I include a custom payload or value with amazon affiliate links? -

i'd able tag affiliate links information can map successes information inside of system. is there way can include custom identifier or payload of data affiliate link amazon allow me inspect when receive report of successful sales? the thing found tracking ids manage tracking ids page. however ids limited 100 values default (you need contact amazon more). answered me: i understand you'd view reporting within products advertising api. all reports housed on associates account view activity of links. we offer multiple tracking ids associates can track activity of individual links , accurately. you can create 100 tracking ids in account visiting account settings section of associates central. you'll find link in account information section labeled manage tracking ids: https://affiliate-program.amazon.com/gp/associates/network/your-account/manage-t ... once you've created additional tracking ids, view these ids,

r - Holes in polygons disappear after performing checkPolygonsHoles from maptools -

note: @ edzer pebesma's suggestion, question has been crossposted r-sig-geo, here , has received responses. i encountered following unexpected result using checkpolygonsholes : # attach worldmap spatialpolygonsdataframe package maptools library(sp) library(maptools) data(wrld_simpl) # polygon hole shape_with_hole <- wrld_simpl[5,] # plot (hole left white, surrounded blue color) plot(shape_with_hole, col = "blue") # perform checkpolygonsholes shape_with_hole@polygons <- lapply(shape_with_hole@polygons, checkpolygonsholes) # plot again, holes aren't recognized such plot(shape_with_hole, col = "blue") # , original spatialpolygonsdataframe object changed !? plot(wrld_simpl[5,], col = "blue") one irritating side effect here original object wrld_simpl changed. result looks me bug, or have missed something? p.s.: object shape_with_hole edited checkpolygonsholes before, continues behave strange: # check polygons marked ho

python - Converting PeriodIndex to DateTimeIndex? -

i have question regarding converting tseries.period.periodindex datetime. i have dataframe looks this: colors country time_month 2010-09 xxx xxx 2010-10 xxx xxx 2010-11 xxx xxx ... time_month index. type(df.index) returns class 'pandas.tseries.period.periodindex' when try use df var analysis ( http://statsmodels.sourceforge.net/devel/vector_ar.html#vector-autoregressions-tsa-vector-ar ), var(mdata) returns: given pandas object , index not contain dates so apparently, period not recognized datetime. now, question how convert index (time_month) datetime var analysis can work with? df.index = pandas.datetimeindex(df.index) returns cannot convert int64index->datetimeindex thank help! you can use to_timestamp method of periodindex this: in [25]: pidx = pd.period_range('2012-01-01', periods=10) in [26]: pidx out[26]: <class 'pandas.tseries.period.periodi

Cannot type into text input on jqModal dialog when modal set to true -

having upgraded jqmodal r13 r22, find dialogs contain text inputs not possible type them. removing modal:true settings fixes it, don't want users able dismiss dialog clicking on overlay. behaviour design, or bug? this not design. have released fix (+r23). please open github issue if require further assistance. related: if you're nesting modals, sure have higher z-index value on child modals. you may override $.jqm.focusfunc() provide custom behaviour events occurring outside active modal.

Plot a 3D linear surface from 2D functions in R -

Image
i have following data: x <- c(1000,2000,3000,4000,5000,6000,8000,12000) y_80 <- c(33276,33276,5913,2921,1052,411,219,146) y_60 <- c(14724,14724,3755,1958,852,372,211,140) y_40 <- c(9632,9632,2315, 1250,690,332,196,127) y_20 <- c(4672,4672,1051,562,387,213,129,81) y_5 <- c(825,825,210,118,88,44,27,17) from data create 5 spline functions: f_80 <- splinefun(x, y_80, method=c("monoh.fc")) f_60 <- splinefun(x, y_60, method=c("monoh.fc")) f_40 <- splinefun(x, y_40, method=c("monoh.fc")) f_20 <- splinefun(x, y_20, method=c("monoh.fc")) f_5 <- splinefun(x, y_5, method=c("monoh.fc")) the z axle number after f_ i.e. function f_80 z value 80 , on. what needed plot 3d surface functions, linear interpolation between lines. possible in r? have similar questions can't find answer. thanks there variety of r pseudo-3d plotting functions. base-graphics has persp , , wireframe in lattice, , c

java ee - Can't invoke EJB/CDI bean -

i don't know application websocket (tyrus 1.1) can't invoke cdi or ejb bean. i'm running on glassfish 4.1 server-sent event, websocket 1.1, etc when called jsf managed bean (cdi) websocket app, showed "error: weld-001303: no active contexts scope type org.omnifaces.cdi.viewscoped". if called ejb stateless bean websocket app, showed messages follows: warning: system exception occurred during invocation on ejb chatsessionbean, method: public com.mnik.chat.entity.chatinfo com.mnik.chat.ejb.chatsessionbean.findroomid(java.lang.string) warning: javax.ejb.ejbexception @ com.sun.ejb.containers.ejbcontainertransactionmanager.processsystemexception(ejbcontainertransactionmanager.java:750) @ com.sun.ejb.containers.ejbcontainertransactionmanager.checkexceptionnotx(ejbcontainertransactionmanager.java:640) @ com.sun.ejb.containers.ejbcontainertransactionmanager.postinvoketx(ejbcontainertransactionmanager.java:482) @ com.sun.ejb.containers.basecont

Meaning of the PMI bit in the SCSI READ CAPACITY command -

i'm looking @ sbc-3 item 5.15 (read capacity (10) command). description of pmi bit (bit 0 of byte 8 in cdb) copied below: "a pmi bit set 1 specifies device server return information on last logical block after specified in logical block address field before substantial vendor specific delay in data transfer may encountered." my questions: if both pmi bit , logical block address (bytes 2-5 in cdb) aren't zero, should (as target) still report last lba on disk? if not above, should reported in case? what should logical block address (bytes 2-5) value when pmi bit set? (i know, pmi bit became obsolete in sbc-4, still need implement functionality according current standard) this out in sbc-3 now, of revision 28 (january, 2011) can see change here: (sign required) http://www.t10.org/cgi-bin/ac.pl?t=d&f=11-010r0.pdf . so, you're talking sbc-2 compatibility. anyway, don't think you'll ever see these fields set in practice. but, s

c - How to pass N bytes of parameters to a function called by pointer -

my software drive embedded device run c code on ti dsp tms320f2812. the communication done via usb serial port emulation. at point, device side, need parse message means "call function @ given address given parameters". message contains: 4 bytes function address. 1 byte parameter(s) size (in byte). n bytes parameter(s) data. here code use: typedef void (*void_fct_void) (void); typedef void (*void_fct_int16) (int16); typedef void (*void_fct_int32) (int32); typedef void (*void_fct_2int32) (int32, int32); ... uint32 address; uint16 sizein; address = hw_usb_read_4bytes(); sizein = hw_usb_read_1byte(); switch(sizein) { case 0: ((void_fct_void) address)(); break; case 2: ((void_fct_int16) address)(hw_usb_read_2bytes()); break; case 4: ((void_fct_int32) address)(hw_usb_read_4bytes()); break; case 8: ((void_fct_2int32) address)(hw_usb_read_4bytes(), hw_us

php - Composer cannot find the package for new require within Yii2 composer.json -

ok, i'm using yii2 , trying add new requirement/library project. said library can found here: https://github.com/cyphix333/sbbcodeparser it forked project added composer.json . i tried adding requirement in projects main composer file, ie: "require": { //.......... "samclarke/sbb-code-parser": "*" }, then ran: composer update it complained couldn't find package or version of it. then removed line , tried: require samclarke/sbb-code-parser i have files in yii vendor folder located at: @app/vendor/samclarke/sbb-code-parser i'm pretty new composer , not sure i'm doing wrong or how composer supposed know files based on package name. the package samclarke/sbb-code-parser can found @ packagist. https://packagist.org/packages/samclarke/sbb-code-parser by default composer tries resolve stable set of packages. packages doesn't provide stable version (version tag), yet - dev-master version exists. co

xaml - Make clickable UI-elements for windows Phone 8.1 apps maps -

windows phone 8.1 app , c# i let user add pushpins ( apparently called mapicons ) map , when user clicks newly created pushpin other ui-elements should appear. but apparently mapicons not clickable , can not inherit them since sealed, no luck in making them clickable. i tried extend windows.ui.xaml.controls.button , have not location, because not belong windows.ui.xaml.controls.maps-namespace. can not add them windows.ui.xaml.controls.maps.mapcontrol.children or windows.ui.xaml.controls.maps.mapcontrol.mapelements, since not on map want them be. so how make clickable ui-element can give location on map? you can throw pretty want on there , bind mapcontrol.location attached property object placement long they're children of map parent. see more detail explanation here in docs.

Sub domain issue on Azure -

i need create sub domain follows on azure, how do that? mysite/jobs i able create job.mysite.azurewebsites.net. not want. thank you. azurewebsite.net not primary domain. azure has written code create sub domain dns have no rights create again sub domain in it

What is the relationship between a 2d Cartesian coordinate grid and a matrix of arrays? -

i working complex problem involves array matrix. think of matrices having row index , column index. matrix[row][column] but particular problem think more useful think of in context of cartesian coordinates. when doing though noticed there few distinct issues such matrix indices can positive integers opposed cartesian coordinates can span in direction. find myself confused how x , y indices map rows , columns indices. what relationship between 2d cartesian coordinate grid , matrix of arrays? it seems major concern of yours how represent cartesian coordinate system using java 2 dimensional array. confusing part of how deal negative coordinates since java arrays can indexed positive numbers. here class cartesiangrid contains 2d array of integers. array can initialized range of cartesian coordinates. getter , setter offset negative coordinates map range of array java expects. public class cartesianarray { private int[][] grid; private int minx, miny; p

openlayers 3 - Openlayers3 clicking outside feature deselects all features -

i continue using default toggle options of interaction.select, user can have 1 feature selected @ time. however, when user clicks outside of feature, not want remove selected feature. there way achieve this? thank in advance. i able solve problem following... var select = new ol.interaction.select({ style: vm.selectedfeaturestyle, condition: function (event) { if (event.type === 'singleclick') { return vm.map.foreachfeatureatpixel(event.pixel, function () { return true; }); } return false; } });

c# - Regex match alphanumeric in any part of query -

can me creating regex function following ? problem numbers/alphanumeric may come in part of query well. string = 1942 ng12 bagel cream; output = 1942 ng12 this should work you, may multiple answers. ([^ ]*[0-9]+[^ ]*) it work things this: string = 1942 bagel ng12 cream output = 1942 ng12

javascript - jQuery .val change doesn't change input value -

i have html input link in value. <input type = 'text' value = 'http://www.link.com' id = 'link' /> i using jquery change value on event. $('#link').val('new value'); the above code changes value of text box doesn't change value in code (value = 'http://www.link.com' stays unchanged). need value = '' change well. use attr instead. $('#link').attr('value', 'new value'); demo

java - Closing a remote akka actor connection? -

is possible, and/or necessary, close remote actor in akka? i able start akka.actor.actorsystem "server" (in scala): val actorsystem = actorsystem("testserver") val actor = actorsystem.actorof(..., name = "testactor") and connect "client" actorsystem running on seperate jvm: remote = context.actorselection("akka.tcp://testserver@localhost:1234/user/testactor") i able send messages remote , receive response messages. however, when it's time client shutdown see following log messages server actorsystem after client jvm dead: [warn] [04/01/2015 11:27:27.107] [testserver-akka.remote.default-remote-dispatcher-5] ... [akka.tcp://consolesystem@localhost:1236] has failed, address gated [5000] ms. reason is: [disassociated] are these warnings bad? there remote.closeconnection method should calling prevent warning messages? thank in advance. this warning not bad in test example. necessary warn if

python - Cutting image after a certain point -

Image
i have bit of unusual problem. use pillow python 3 , need stop part of being transparent , layering. as can see in image 1, hair clips hat @ left , right of it. image 2 1 edited myself, , correct. there no clipping on left or right. all 3 of sprites (the head, hat, , hair) transparent, , same size. the trouble make cut off @ point, not hat sprites start , end in same place. may arc shape example, , end no hair in arc. this code i'm using: from pil import image, imagetk, imagechops background = image.open("headbase.png") foreground = image.open("hair2.png") image.alpha_composite(background, foreground).save("test3.png") background2 = image.open("test3.png") foreground2 = image.open("testhat2.png") image.alpha_composite(background2, foreground2).save("testo.png") this simple problem. need here make transparency mask (make areas coloured don't want have hair) areas don't want

wordpress - woocommerce credit card payment gateway not showing up in Payment gateways page -

Image
i using paypal standart not pro or advanced. before able select credit card payment gateway , had issues woocommerce - caused 500 server error managed going , there lot of changes made related website,but nice no error right now, cant see credit card gateway. thought maybe have messed files , disabled uninstalled (in woocommerce tools section "remove post types on uninstall" selected , saved) woocommerce plugin , installed again , again nothing happened ,i still cant see credit card payment gateway. before there credit card gateway paypal image credit card images here system report wordpress environment home url: http://samplewebsite.com (not real websites name) site url: http://samplewebsite.com wc version: 2.3.7 wc database version: 2.3.7 log directory writable: ✔ /home1/lauroskr/public_html/wp-content/uploads/wc-logs/ wp version: 4.1.1 wp multisite: – wp memory limit: 96 mb wp debug mode: – language: en_us server environment server info: apache php v

Ampl finds optimal solution in 0 iteration, but the variables are wrongly set to 0 -

i'm trying solve non-linear problem: var c; var n; minimize error: ( (6770924 - (n * c * exp(-c * 1)))^2 + (3617627 - (n * c * exp(-c * 2)))^2 + (2344172 - (n * c * exp(-c * 3)))^2 ) / 3; when execute code, have success message 0 iteration: minos 5.51: optimal solution found. 0 iterations, objective 214759264300000 non lin evals: obj = 3 grad = 2. but variables 'n' , 'c' set '0'. , using answer bad value function, since nothing subtracted constant values. if take out 'n' variable function have normal answer, 'c' minimizing function. wrong model described? thanks in advance. as mentioned in this post , minos sensitive starting point. example, using 1 starting value n gives better objective value: ampl: let n := 1; ampl: solve; minos 5.51: optimal solution found. 10 iterations, objective 24439722900 nonlin evals: obj = 34, grad = 33.

entity framework - PostgreSql EF, navigation property is always null when querying -

i stumbled upon unexpected behaviour when using entity framework postgresql. when query context navigation property inside clause, null , fails. if add there include method pointing navigational propery it's working this work context.garages.include("postalcode").where(f=>f.postalcode.regionid == regionid) this not (postalcode null , fails on nullreference) context.garages.where(f=>f.postalcode.regionid == regionid) i don't think had add query when using mssql. can anybdoy explain me. if want navigation properties lazy loaded , need declare them virtual : public garage { //... public virtual postalcode postalcode {get;set;} } in link find conditions must follow entities if want enable lazy loading entities , have entity framework track changes in classes changes occur. if navigation property virtual , other option think cause behavior if turn off lazy loading on context: public class yourcontext : dbcontext { public your

android - Gradle Dependency using Make -

Image
i decided give gradle shot in latest project featuring graphics create using gimp. i use git project , refuse commit exportet .png -graphics in repository. instead want save gimps .xcf files in order able edit graphics later on. however android application need them .png files , there whole lot of them , trying automate build-process want gradle build .png -graphics .xcf files when executing gradle build . there plugin featuring imagemagick gradle not work produces images transparency-issues. example: this image created gradle: and how should (exportet gimp): there no hidden layers , not have opacity. build.gradle: buildscript { repositories { mavencentral() } dependencies { classpath 'com.eowise:gradle-imagemagick:0.4.0' } } task build(type: com.eowise.imagemagick.tasks.magick) { convert 'xcf/', { include '*.xcf' } 'png/' actions { -alpha('on') -background('none') inpu

Billing by tag in Google Compute Engine -

google compute engine allows daily export of project's itemized bill storage bucket (.csv or .json). in daily file can see x-number of seconds of n1-highmem-8 vm usage. there mechanism further identifying costs, such per tag or instance group, when project has many of same resource type deployed different functional operations? as example, qty:10 n1-highmem-8 vm's deployed region in project. in daily bill display x-seconds of n1-highmem-8. functionally: 2 vm's might run database 24x7 3 vm's might run batch analytics operation averaging 2-5 hrs each night 5 vm's might perform batch operation runs in sporadic 10 minute intervals through day final operation writes data specific gs buckets, other operations read/write different buckets. how might costs broken out across these 4 operations each day? the usage logs not provide 'per-tag' granularity @ time , can little tricky work usage logs here recommend. to further break down u

routing - find rout from a to b -

i want find rout b using public transport. suppose i'm found path b(i.e. sequence stops b), how create route(i.e. go d on bus 3, take bus 15 d b)? use depth first method, create graph connecting stops transport (considering connecting length). annotate each direct connection (i.e. edge in graph of transportation map) between 2 stops bus lines serve part of connection. traverse path , select of bus lines first edge. every time, recent bus line selection not available on next edge, need change busses. might want backtracking in order find connection least stops.

networking - Blocking a website on a router from a computer programatically -

in short, want prevent computers on network accessing netflix until condition met. user supposed solve few problems on program before being able watch netflix. user shouldn't able watch netflix on device until after solving problems. how can program enable or disable access netflix across entire lan? perhaps there's way remotely configure these settings on router? able change router's firmware or purchase new router if needed. all advice appreciated. what you're proposing same system many airports , coffee shops use restrict access web on networks, unless user completes task. functionally, there few commercial providers this: boingo aptilo and others via forbes article for want, combination of hardware , software achieve goals. network layout similar this network diagram , shows: client computers server provides dns resolution , hosts website a switch a modem / internet access point the process include dns server returning fake ip add

java - IndexOutOfBoundsException when clicking RecyclerView item -

having problem when clicking items of recyclerview, app crashes , giving output: java.lang.indexoutofboundsexception: invalid index 24, size 20 @ java.util.arraylist.throwindexoutofboundsexception(arraylist.java:255) @ java.util.arraylist.get(arraylist.java:308) @ com.google.gson.jsonarray.get(jsonarray.java:147) @ com.devpocket.kvartirka.mainactivity.itemclicked(mainactivity.java:334) @ com.devpocket.kvartirka.adapters.offersadapter$viewholder.onclick(offersadapter.java:161) @ android.view.view.performclick(view.java:5162) @ android.view.view$performclick.run(view.java:20873) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:145) @ android.app.activitythread.main(activitythread.java:5834) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:3

currying - Curry all swift function parameters, but don't call the function -

i have following swift function: func foo(bar: string)(_ baz: string) { nslog("bar \(bar), baz: \(baz)") } let f = foo("fizz")("buzz") // won't compile, foo returns void i want pass dispatch_async , can't because can't curry both parameters without invoking function. how curry both bar , baz without calling foo ? if free change function declaration, heath's answer correct. if don't want that, need use inline closure, e.g. // pre-existing foo definition func foo(bar: string)(_ baz: string) { nslog("bar \(bar), baz: \(baz)") } let f = { foo("fizz")("buzz") } f() if problem want evaluate arguments immediately, can use capture list: let f = { [a=bar(),b=baz()] in foo(a)(b) } or when written call dispatch_async : dispatch_async(queue) { [a=bar(),b=baz()] in foo(a)(b) } this works because capture list evaluated caller when closure created (as opposed being evaluated whe

multithreading - Future::spawn() kinda useless? How can I multi-thread this? -

excerpt main here: let value: value = json::from_str(&sbuf).unwrap(); let coords = value.find("coordinates").unwrap().as_array().unwrap(); let x = future::spawn(|| coords.iter().fold(0f64, |mut a,b| { += read_coord_value(&b, "x"); })); let y = future::spawn(|| coords.iter().fold(0f64, |mut a,b| { += read_coord_value(&b, "y"); })); let z = future::spawn(|| coords.iter().fold(0f64, |mut a,b| { += read_coord_value(&b, "z"); })); println!("x: {}; y: {}; z: {}", x.await().unwrap(), y.await().unwrap(), z.await().unwrap()); so, basically, i'm doing here won't work because spawn call requires passed have static lifetime--which means there no work can avoid repeating. @ all. pointless. what's good way threading here? here, multithreading, need used scoped threads, std::thread::scoped(..) . these threads not need 'static closure execute, must joined. for exampl

grails - GORM abstract domain class -

i have 2 abstract grails domain classes like abstract class { static hasmany = [ b : b ] static mapping = { tableperhierarchy false } } class achild extends { } abstract class b { static belongsto = static mapping = { tableperhierarchy false } } class bchild extends b { } i have code does a = new achild() a.b << new bchild() a.save(flush:true) this works expected now, when try do b.delete(flush:true) this fails because of referential integrity violation in join table created between a/b. looks first query gorm part of delete delete b table, not join table, , join has reference b table id, causes violation. delete b id=? , version=? the reason keep a , b in domain folder can things a.list() , moving out src/groovy last option. i think bug in gorm abstract classes. have opened issue https://github.com/grails/grails-core/issues/593

OpenAM Java EE agent plain text password -

in documentation , looks can set plain text password instead of encrypted one. com.iplanet.am.service.secret when using plain text password, set password agent profile, , leave am.encryption.pwd blank. so, i've set following in openssoagentbootstrap.properties: com.iplanet.am.service.secret = myplaintextpassword am.encryption.pwd = accessing agent application gives me: java.lang.runtimeexception: failed load configuration: invalid application password specified com.sun.identity.agents.arch.agentconfiguration.bootstrapclientconfiguration(agentconfiguration.java:790) com.sun.identity.agents.arch.agentconfiguration.initializeconfiguration(agentconfiguration.java:1140) com.sun.identity.agents.arch.agentconfiguration.<clinit>(agentconfiguration.java:1579) com.sun.identity.agents.arch.manager.<clinit>(manager.java:675) com.sun.identity.agents.filter.amagentbasefilter.initializefilter(amagentbasefilter.java:274) com.sun.identity