Posts

Showing posts from August, 2013

javascript - THREE.js translation/position weirdness -

i'm trying generate random planes in random position in screen , of random size. problem have don't understand set.position values. representing? tried search every answer couldn't find. here's code planes: var planes = []; (i = 0; < 20; i++) { var geometry = new three.planegeometry(sizewidth*((randomso(1,20)*0.00001)), sizeheight*((randomso(1,10)*0.0001))); var material = new three.meshbasicmaterial( {color: 0x00ff00}); var plane = new three.mesh(geometry, material); plane.drawmode = three.trianglesdrawmode; plane.position.set(-10+i, 0, 0); scene.add(plane); planes[i] = plane; } the x-co-ordinate in above example isn't how i'd want testing. work according screensize, each plane locate in random % of width , height. width of screen 1280 , when set the x co-ordinate let's -20 it's out of screen. should set z co-ordinate of camera differently? don't understand position co-ordinates in :-(

sql server - Entity Framework not calculating count() after grouping -

the code better explain i'm trying do. var data = db.absences//.asexpandable() .where(a => a.employee.employeecode == "emp1" || a.employee.employeecode == "emp2" || a.employee.employeecode == "emp3" || a.employee.employeecode == "emp4" ) .where(a=> a.employee.department.departmentcode == "hr" ||a.employee.department.departmentcode == "fin" ||a.employee.department.departmentcode == "it" ) .where(a=> a.absenceid > 0) .groupby(a => new { a.employee.department.departmentname, a.employee.department.departmentcode, a.employee.ispermanent }) .select(g => new resultmodel { department = g.key.departmentname, permanent = g.key.ispermanent, totalemployeesindepartment = g.select(e

Deleting file after progeam execution in batch -

i having simple question, having simple batch script: for /l %%x in (1, 1, 3) start /wait c:\some.exe -verbose c:\somelog.txt del c:\somelog.txt after each execution file creates log, , want remove log before next loop execution, execution works fine when add del command having problems, looks log being deleted early. is there possible way delay del command ?? when running multiple command nest them readability. for /l %%x in (1, 1, 3) ( start /wait c:\some.exe -verbose c:\somelog.txt del c:\somelog.txt ) you way well for /l %%x in (1, 1, 3) (start /wait c:\some.exe -verbose c:\somelog.txt &del c:\somelog.txt) but not mean executable respecting wait option. many programs not. use exe directly without using start @ all.

java - Get first 200 chats with td api -

i using tdapi first 200 chats can not get, first 100 chats. here codes tried 200 chats unsuccessful. even read documentation @ here returns list of chats in right order, chats sorted (order, chatid) in decreasing order. example, list of chats beginning, offsetorder should equal 2^63 - 1. tdapi.getchats getchats = new tdapi.getchats(long.max_value, 0, 200); tg.getclientinstance().send(getchats, new client.resulthandler() { @override public void onresult(tdapi.tlobject object) { tdapi.chats chat = (tdapi.chats) object; final tdapi.chat[] chats2 = chat.chats; log.e("test", "2 " + chats2.length + ""); log.e("test", "2 " + chats2[0].title + ""); }); even tried this: tdapi.getchats getchats1 = new tdapi.getchats(long.max_value, 0, 100); tg.getclientinstance().send(getchats1, new client.resulthandler() { @override public void onresult(tdapi.tlobject object) { tdapi.chats chat =

c# - Security token for MicrosoftAppId: '' is unauthorized to post to connector -

i have written bot using bot application template in vs 2015 , published azure account. registered here https://dev.botframework.com/ . i'm using facebook messenger channel. have setup webhooks, entered credentials correctly , verified them. when try test bot error... "security token microsoftappid: '' unauthorized post connector!" obviously message seems pretty clear, i've checked security token correct. there else might causing this? maybe forget put microsoftappid web.config file?

c# - How can I get IHostingEnvironment from DbContext in ASP.NET Core -

just testing, don't want dependency injection startup.cs file. how can ihostingenvironment ef core dbcontext. i take new asp.net core project empty template. have created dbcontext below. want user environment.contentrootpath instead of directory.getcurrentdirectory(). don't want injection startup.cs. public class mydbcontext: dbcontext { public iconfigurationroot configuration { get; set; } protected override void onconfiguring(dbcontextoptionsbuilder optionsbuilder) { var builder = new configurationbuilder() .setbasepath(path.combine(directory.getcurrentdirectory(), "..\\..\\..")) .addjsonfile("appsettings.json", optional: true, reloadonchange: true); configuration = builder.build(); optionsbuilder.usesqlserver(configuration.getconnectionstring("sqlcn"));// @"server=(localdb)\mssqllocaldb;database=mydatabase;trusted_connection=true;"); } public dbset<te

python - What does `@pwnlib.memleak.MemLeak.NoNewlines` mean? -

i stumbled upon following piece of code here : @pwnlib.memleak.memleak.nonewlines def fmtleak(addr): ... return res printf_leaked = fmtleak.q(printf_got) ... can please explain @pwnlib.memleak.memleak.nonewlines (on beginning line) , fmtleak.q mean in context? sort of python syntax used, , they? welcome pwntools -- pwnlib . i'm going explain you're talking about. i'm assuming know call stack is, , exploitation techniques such information leakage , uncontrolled format string known format string bug ; need learn don't know among them understand i'm going say. dynelf the writer of the article mentioned trying use dynelf , 1 of features provided pwntools resolves remote functions using leaks. dynelf requires python function or pwnlib.memleak.memleak object leaks data @ given address as possible. class pwnlib.dynelf.dynelf(leak, pointer=none, elf=none) dynelf knows how resolve symbols in remote processes via infole

python - How to create a layer over a surface with mayavi? -

i made program python displays animation of propagation of fire spreading in forest in 2d (the forest array): no tree = 0.0 a tree = 1.0 a tree in fire = 2.0 and made surface plot mayavi, python , gdal using post ( https://gis.stackexchange.com/questions/223129/dem-plot-with-matplotlib-is-too-slow ). now want know how put propagation made array (in 2d) on surface of mountain if kind of layer able move , grow on surface fire growing in forest. i not asking algorithm can make simulation of forest fire. i asking way create kind of layer on surface plot made. for instance, in next photo can see red layer (the spreading fire) on surface: https://i.stack.imgur.com/rc5dt.png

javascript - TextBox and Button JS Onclick -

i have textbox. wanted use js onclick append input in textbox "btngo" button below it's not working: document.getelementbyid('btngo').onclick = function() { var search = document.getelementbyid('dlrnum').value; window.location.url = "http://consumerlending/app/indirect/dealercomments.aspx?dlrnum=" + search; } <input id="dlrnum" type="text" name="dlrnum" autocompletetype="disabled" class="ui-autocomplete-input" autocomplete="off"> <input id="btngo" type="submit" value="go" name="go" runat="server"> what missing? you had several problems there: 1. <input> elements part of form , when click on submit button - form submit, unless prevent it. 2. need use window.location.href (and not .url ). here fix code: document.getelementbyid('btngo').onclick = function(e) { e.prevent

ubuntu 14.04 - Virtuoso Upgrade -

i have virtuoso version 06.01.3127 installed on ubuntu 14.04.05 lts version (ubuntu-server). i upgrade virtuoso @ least version 7.2.4.2+, includes geospatial features need. i have looked info provided in following link virtuoso: upgrading release 6.x release 7.x have not been able follow these steps. to start with, second step " check size of .trx file, typically found alongside .db , .ini files ". can find odbc.ini , virtuoso.ini files, inside /virtuoso-opensource-6.1 folder. am looking in wrong place? does have guidance in matter? thanks in advance openlink software (producer of virtuoso , employer of me) not force location of any file -- cannot tell on host. virtuoso.db default database storage file; local file might *.db . file must present in mounted filesystem, , should identified (with full filepath) within active *.ini file (default being virtuoso.ini ). you might have multiple virtuoso.ini and/or virtuoso.db files in different

c# - How to add custom error message with “required” htmlattribute to mvc 5 razor view text input editor -

i naive asp.net mvc. i have partial view(asp.net mvc) in have required fields want show custom error message if of required field in not provided. below complete cshtml code partial view. @model cmsadminpanel.viewmodel.productview <h4>material , labour cost each size</h4> <hr /> @html.validationsummary(false, "", new { @class = "text-danger" }) @for (int = 0; < model.serviceview.listpriceview.count; i++) { @html.hiddenfor(x => x.serviceview.listpriceview[i].productsizetype) <div class="form-group"> @html.labelfor(x => x.serviceview.listpriceview[i].productsizetypename, "size - " + model.serviceview.listpriceview[i].productsizetypename, htmlattributes: new { @class = "control-label col-md-4" }) </div> <div class="form-group"> @html.labelfor(x => x.serviceview.listpriceview[i].labourcost, htmlattributes: new { @class = "control-label co

python subprocess module, works with communicate() not with process.stdin.write() -

im creating mp3 player python in ubuntu omxplayer installed. im using tkinter frame have play/pause button. when python script ran displays play button, once play button hit mp3 begin, , button text changes pause. user can click pause button, mp3 pauses , button text changes. cycle continues etc. using keybindings omxplayer, using subprocess module write command line. the code have is: https://codedump.io/share/8sw4ufnig4zq/1/mp3-player the important function musicplay : def musicplay(): global player, playing if musicplaybutton["text"] == "play": #if not paused musicplaybutton["text"] = "pause" if playing == false: #if player isn't loaded songstring = library + "/" + librarylist[libraryindex] player = subprocess.popen(["omxplayer","-o","local",songstring],stdin=subprocess.pipe) playing = true elif playing == true: #if pl

sendkeys - VBScript Send Key " -

Image
i have vbscript unsubscribe steam workshop-objects code: set wshshell = wscript.createobject("wscript.shell") wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.sendkeys "^{2}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").children().trigger('click'); settimeout(function(){location.reload();},500);" wshshell.sendkeys "{enter}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").children().trigger('click'); settimeout(function(){location.reload();},500);" wshshell.sendkeys "{enter}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").

Store data from struct in lists of variable size in C -

Image
i want use mpi in project. in order send data processor, first have store particle data in list. these lists can have variable size. want save data of struct: typedef struct { double x[dim]; double v[dim]; double a[dim]; double m; } particle; into list 'plist'. additionally want save size of list in plistsize : typedef struct{ double **plist; int plistsize; } particlelist; i still newbie in c task somehow difficult me. so far did following: #include <stdlib.h> #include <stdio.h> #define dim 2 typedef struct{ double **plist; int plistsize; } particlelist; typedef struct { double x[dim]; double v[dim]; double a[dim]; double m; } particle; void sendpar(int *n, int npr, particle *p){ // allocate memory particlelist particlelist *pl = malloc(sizeof(pl)*npr); // allocate memory plists

sharepoint - How to prevent browser image caching in HTML -

looking on html issue running images caching on browsers. scenario: i using html code build out custom page on sharepoint online. html code embedded content editor web part. have image link points file called "article-photo.jpg" , updated marketing department using same file name. right now, when overwrite file stored in site assets library in sharepoint, different image using same file name, close out of internet explorer , head sharepoint site, old image still appears. until hit refresh button when new image appears on screen. in google chrome, image not update @ when hit f5 refresh. have use shift+f5 perform full refresh , image updates. i not using meta tags in header of html code. img src using absolute path image located in site assets library. html file contains css brand page, looking see if can throw header of file prevent image caching on browsers. thanks this, dave expanding on previous comments, add image time stamp, so: <div id="b

python - Predict number of rows using Machine Learnnig -

i have bank data of around 4 years of different branches. trying predict number of rows in daily , hourly level. have issue_datetime (year, month, day, hour) important features. applied different regression techniques (linear, decision trees, random forest, xgb) using graph lab not better accuracy. thinking set threshold based on past data taking mean of counts in daily, monthly level after removing outliers , set threshold. best approach? since have 1d time series data, should relatively easy graph data , interesting patterns. once establish there non-stationary aspects data, class of models wanting check out first auto-regressive models, possibly seasonal additions. arima models pretty standard time-series data. http://www.seanabu.com/2016/03/22/time-series-seasonal-arima-model-in-python/

SGX and TPM interface -

i looking through documentation of sgx , not find description of how access contents of tpm. according claims should although possible!? has experience in this? intel sgx replaces tpm. not aware of functionality of tpm cannot performed intel sgx.

algorithm - Worst case complexity for this python code -

what worst case time complexity of following: def fun(n): count=0 i=n while i>0: j in range(0,i): count+=1 i/=2 return count worst case time complexity if n big integer. o(log(n)*n) ( guessing ). here's how came conclusion. while i>0: ... i/=2 this run log(n) times because it's getting halved every time runs. for j in range(0,i): this run n times first, n/2 times 2nd time, , on. so, total running time line n + n/2 + n/4 .... 1 = (2n-1) count+=1 this cheap operation o(1). thus making total running time of function o(log(n)) * o(2n-1) , if n integer. simplifying becomes o(log(n)*(n)) .

arrays - Rails | Elegant way of looping through and saving json post data -

i posting ajax request on click action , json data looks this; {"data"=>{"0"=>{"seasons"=>{ "0"=>{"from"=>"2017-01-04", "to"=>"2017-01-07", "weekday"=>"1", "per_day"=>"100", "weekly"=>"230", "weekend"=>"200", "available"=>"false", "check_in"=>"08:00", "check_out"=>"08:00", "sevendays"=>"false", "checkin_day"=>""}, "1"=>{"from"=>"2017-01-17", "to"=>"2017-01-20", "weekday"=>"1", "per_day"=>"250", "weekly"=>"323", "weekend"=>"300", "available"=>"false", "check_in"=>"08:30", "check_out&

python - numpy array traversal Error: IndexError: index 1 is out of bounds for axis 0 with size 1 -

numpy shape (5,1) following elements: [[1] [2] [3] [4] [5]] how go traversing through , printing each element? follows: 1 2 3 4 5 attempt for row in range(n): col in range(d): print(input_array[row][col]) error error: indexerror: index 1 out of bounds axis 0 size 1 your n, d values must wrong. either do n, d = input_array.shape and continue code, or directly for row in input_array: token in row: print(token)

apache spark - Configuration PySpark for Intellij -

c:\users\mbaye\anaconda3\python.exe c:/users/mbaye/junior/com/axa/projet/testmb.py traceback (most recent call last): file "c:/users/mbaye/junior/com/axa/projet/testmb.py", line 2, in <module> pyspark import sparkcontext, sparkconf importerror: no module named 'pyspark' process finished exit code 1 i got "error"

matlab - How do I obtain the count of corner points in a matrix as well as store their positions in an array? -

Image
i told coordinates of matrix must not represented using centre points, represented using corner points. can’t figure out how go this. nonetheless, have information relates matrix notations both centre , corner points shown below. [nr, nc] = size(img); and: nr = ny+1; % total no. of centre rows nc = nx+1; % total no. of center columns also, ny = nr – 1; % total no. of line rows nx = nc – 1; % total no. of line columns t = ny * nx; % t = total no. of internal nodes nodecount = nx(iy – 1) + jx; the count order row-by-row i.e. beginning nodes: (1,1) (1,nx) , (2,1) (2, nx) , etc. note in given image (6x6 matrix), nodecount has 25 array elements. now, need obtain nodecount such contains array of counted internal nodes 1 t in count order specified. obtain x , y coordinates each index in nodecount. please, need help/suggestions/advice on how resolve this. many thanks. since discussion in comments got little long, decided answer: 1) create coords

scala - Compile-time Check on Sum of Nat's? -

i attempted write typeclass, sumeq5 , such hlist type parameter's first 2 fields add 5 : trait sumeq5[a] object sumeq5 { def apply[l <: hlist](implicit ev: sumeq5[l]): sumeq5[l] = ev implicit def sumeq5ev[l <: hlist, <: nat, b <: nat]( implicit hcons: ishcons.aux[l, a, b :: hnil], ev: sum.aux[a, b, _5] ): sumeq5[l] = new sumeq5[l] {} } but doesn't appear work: import shapeless._ import shapeless.nat._ import net.sumeq5 scala> sumeq5[_0 :: _5 :: hnil] <console>:19: error: not find implicit value parameter ev: net.sumeq5[shapeless.::[shapeless.nat._0,shapeless.:: [shapeless.nat._5,shapeless.hnil]]] sumeq5[_0 :: _5 :: hnil] please give me hint why _0 :: _5 :: hnil not have evidence 2 nat 's equal 5. edit updated question per denis rosca's in shapeless's gitter . dale wijnand , marcus henry pointing in right direction if want generalize hlist s of arbitrary length, if want accomm

json - Java - Retrive next 50 results -

rob = response.getjsonobject(); array = rob.getjsonarray("data"); fr = new arraylist(); int count = array.length(); (int = 0; < array.length(); i++) { friend = array.getjsonobject(i); fr.add(friend.get("name")); } here fr array list. i want select first 50 result output names. then next 50 result output , next 50, on until response ends. is there way can ? itrate or loop ? for(int = 0; i<fr.size(); i++){ system.out.print(fr[i]+",") if(i%5==0) system.out.println(); } tried above code result in untable time select 1 time . are looking this? for (int = 0; < fr.size(); i++) { system.out.print(fr[i]+","); if ((i + 1) % 50 == 0) { // have use + 1 because otherwise modulo logic won't work system.out.print("\n"); } }

How to create channel programmatically on socketcluster? -

i'm considering using socketcluster build realtime app. docs clear not find way create channel on demand programmatically . my need is: user, call rest api create channel , running on server. for example, calling client side: post https://<myserver>/api/channels json body { "channel": "mychannel} create mychannel channel on server , client side code able subscribe directly (after having received server response): var mychannel = socket.subscribe('mychannel'); mychannel.publish('mychannel', 'i here !'); mychannel.watch(function (data) { console.log('received data mychannel:', data); }); i suppose newly created channel use authorization middleware middlewares defined @ server level (wsserver.addmiddleware(wsserver.middleware_subscribe, ...) thanks lot help, pierre with socketcluster, channels created , destroyed automatically don't need manage lifecycle. channel created on end if there @ l

android - App crashes when I set FirebaseAdapterUI -

chatactivity crashes when received message in firebase adapter ui. when set simple_list_item_1 layout, works fine, when set 2 or more attributes, app crashed on receiving message. import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.listview; import android.widget.textview; import com.firebase.ui.database.firebaselistadapter; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; public class profileacrivity extends appcompatactivity { button log_out; firebaseauth firebaseauth; databasereference databasereference; button send; edittext messgae; listview messagelist; firebaselistadapter<chat>firebaselistadapter; @override protected void oncreate(bundle savedinstancestate) {

java - How to customize text and buttons for the About entry under the Help Menu in a Eclipse 3.8.1 RCP application -

i trying customize help->about menu entry on eclipse 3.8.1. tried 2 3.x friendly methods since eclipse 4.0 works differently. ---> tried extends aboutaction (org.eclipse.ui.internal.dialogs.aboutdialog) can add 1 line dialogarea text , add scrollable dialog gui when license button clicked.but methods protected in api see says user can use not override (same dialog class) ---> tried extending default abstracthandler , in execute method creating dialog object want add things need 1 one. issue can not work on dialog object in execute method because remains null reference until end of execute method not able add things without nullpointerexception bugging me. ---> tried adding <property> plugin.xml itself. seems 4.x feature. description field under menu did not work write text in dialog text area @suppresswarnings("restriction") public class aboutactionstablehandler extends abstracthandler { public object execute(executionevent event) throw

php - Doctrine array field with default value -

is there way set default value array field? data: type: array nullable: true options: default: {key1: value1, key2: value2} comment: 'some array data' it doctrine:migration:diff command set value in migration.

jquery ui datepicker - Margin-left css not working -

i using jquery date picker,i added date picker jsp page,and want move left,but doesn't work.. in jsp page have <div id="datepicker" class="datepicker"> <script> $("#datepicker").datepicker(); </script> </div> and in css file have .datepicker{ margin-top:20px; margin-left:600px; position: fixed; } but element on top left corner..does have solution this?i used margin-top , margin-left when wanted position element,and worked..thanks in advance! i'm having trouble getting datepicker function run on codepen, css formatting part working fine: https://codepen.io/anon/pen/owdxkl <style> .datepicker{ margin-top:20px; margin-left:600px; position: fixed; }; </style> <div id="datepicker" class="datepicker">this div 600 px left; 20 px top</div> <script> $( "#datepicker"

ios - Show No Internet Connection Message Like Instagram -

Image
i wondering how can show 'no internet connection' how instagram it, as example : that see-through custom message animating show under navigationcontroller . love project , thank you help so here's pic of storyboard :- "no internet connection" label, , red view underneath test see through property of label. if designing ui in code, can make label similar mine , place top of navigation bar using it's frame property. the button here i'm using show label pop on scene (since it's demo answer). in case, if internet not available, proceed show pop up. so if making ui in code, make sure make label in viewdidload method. have made iboutlet , viewdidload looks this:- override func viewdidload() { super.viewdidload() let transform = cgaffinetransform(translationx: 0, y: -label.frame.height) label.alpha = 0 label.transform = transform } on view loading, i'm moving label behind navigation

php - Getting a drop down list from a database in CodeIgniter -

i new codeigniter , have been trying populate drop down list on view page data database no success. tried using recomendations question drop down still empty ( display data database dropdown codeigniter ) here view: <label>city</label> <select class="form-control> <option value="">all</option> <?php foreach($groups $city) { echo '<option value="'.$city['cityidd'].'">'.$city['city'].'</option>'; } ?> </select> <br/> here controller: <?php class main_controller extends ci_controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->database(); } public function index() { $this->load->helper('form'); $this->load->view('supplier_add'); } } here m

eager loading - rails eager_load from multiple association with different condition -

complex_participators = participators.eager_load(:activities).where("archieved = ? , pattern = ?", true, 'match') complex_participators = participators.eager_load(:free_times).where(activity_id: id).order("participators.id asc, free_times.start asc") complex_participators.each {|p| ...} i want complex_participators array, each p have activities objects , free_times objects loaded how can this?

JavaFX TableView Nested Property Binding -

i have list of objects containing lists of complex data type , need bind these properties tableview. entities looking this: public class customer { stringproperty property1; stringproperty property2; .... list<contract> contracts; } public class contract { stringproperty property1; stringproperty property2; .... } my observablearraylist contains list of customer contains list of contract. getting customer properties easy: samplecolumn1.setcellvaluefactory(celldata -> celldata.getvalue().sampleproperty1()); samplecolumn2.setcellvaluefactory(celldata -> celldata.getvalue().sampleproperty2()); ... but can't properties of contract list.. following workaround: propertyvaluefactory<customer, list<contract>> contractfactory = new propertyvaluefactory<>("contracts"); contractidcolumn.setcellvaluefactory(contractfactory); contractidcolumn.setcellfactory(celldata -> new tablecell<customer>, list<contr

How to run flask on apache using mod_wsgi-express on same ip as a subdomain -

i want run flask on apache.i have installed mod_wsgi-express , flask application running on port 8000(localhost:8000) want run application subdomain dont want open new port , want run application on same ip using '/'(ex- localhost/application).i have drupal running on port 80. want drupal run on url(localhost) , flask app on url(localhost/flaskapp) .how can this? use main apache run mod_wsgi well, instead of mod_wsgi-express. use mod_wsgi-express development. presuming not have mod_wsgi installed system package, can run: sudo mod_wsgi-express install-module and copy mod_wsgi module apache configuration. command output 2 lines need include in main apache configuration have load mod_wsgi , set correct location python installation or virtual environment. you should configure main apache installation manually have host flask application using mod_wsgi. see flask documentation on mod_wsgi details, because still want run php application, read: http://blog.dscp

Custom data structure syntax in Prolog -

in prolog, [h|t] list begins h , remaining elements in list t (internally represented '.'(h, '.'(…)) ). is possible define new syntax in similar fashion? example, possible define [t~h] list ends h , remaining elements in list t , , use freely [h|t] in heads , bodies of predicates? possible define e.g. <h|t> different structure lists? one can interpret question literally. list-like data structure, accessing tail can expressed without auxiliary predicate. well, these minus-lists used in first prolog system — 1 called prolog 0 , written in algol-w. example the original report, p.32 transliterated iso prolog: t(x-a-l, x-a-u-x). ?- t(nil-m-e-t-a-l, pluriel). pluriel = nil-m-e-t-a-u-x. so take left-associative operator. but, suspect, that's not wanted. want extension lists. there have been several attempts this, 1 more recent prolog iii/prolog iv . however, quite similar constraints, have face how define equality on these operat

javascript - How to prevent a navbar from overlapping other elements -

i'm working on building website, , have issue navbar hiding first bit of page can't see information. how fix this? link website here: codepen.io/sookyungahn/pen/wzqkbp?editors=1100 in case, add padding-top in home div id same size height on nav bar. <div class="container-fluid well" id="home" style="display:block; padding-top:50px;">

python - __getitem__ and __setitem__ not being called -

i have following class definition: class codes(): def __new__(self, inp): self.data = np.zeros((50,50)) self.capacity = 50 self.size = 6 self.data[:self.size,:self.size] = inp self.x = 0 self.y = 0 return self def __setitem__(self,coords,value): x = coords[0] y = coords[1] if max(x,y) >= self.capacity: self.capacity *= 2 newdata = np.zeroes((self.capacity,)) newdata[:self.size,:self.size] = self.data self.data = newdata self.data.__setitem__(coords,value) if max(x,y) >= self.size: print("expanding") self.size = max(x,y) print ("debug") def __getitem__(self,coords): x = coords[0] y = coords[1] return self.data[x,y] the , set methods don't seem being called. i'm initialising with: inp = np.array([[20151125,18749137,1728984,30943339,

python: extract and download an image from the body of the email -

i trying read content of email. if email contains image in body part need extract , save in local here code getting body content def get_body(id): res, mail_data = connection.fetch(id, '(rfc822)') raw_email=mail_data[0][1] email_message_instance = email.message_from_string(raw_email) whole_body = '' part in email_message_instance.walk(): if part.get_content_type() == "text/plain": # ignore attachments/html body = part.get_payload(decode=true) whole_body += body + ' ' else: continue return whole_body found solution. def get_body(id): """get body of email""" res, mail_data = connection.fetch(id, '(rfc822)') raw_email=mail_data[0][1] email_message_instance = email.message_from_string(raw_email) whole_body = '' part in email_message_instance.walk(): if part.get_co

java.lang.NoSuchMethodError: java.io.File.toPath() -

Image
there problem when used stream-upload plugin upload file .questions follows: java.lang.nosuchmethoderror: java.io.file.topath()ljava/nio/file/path; environment: jdk 1.7 + tomcat 6.0 + myexclipse topath method requires java 7. make sure using same version of java across machine.

c++ - Generate characters with given distribution -

i've got 2 questions generating numbers/single characters given distributions. how can implement laplace distribution in c++? know it's available in boost library, let's can't use it. also, don't see in standard library of c+11. if have generate text of characters normal distribution, casting generated double number int , char type trick? std::default_random_engine generator; std::normal_distribution<double> distribution(112.0,5.0); int number = (int)distribution(generator); // a-z characters if(number >= 97 && number <= 122) return (char)number; else generate once again; hope help. 1) laplace distribution has explicit density (see here ), function $\mathbf{r}$ $[0,1]$, parameters, can therefore implement in c++ member function of class member variables instance include distribution's parameters. : class laplacerandomvariable { double _b; double _mu; public: laplacerandomvariable(double b, double

How can I handle relational data in machine learning classification? -

i trying classify incidents true positive , false positives using machine learning. i have dataset of incidents every column describes attribute of incident. , there's list of alerts associated each incident. list of alerts can contain 0-10 alerts every alert row having details of alert. i.e there 1 many relationship between incident , alerts. i have experience in classifying simple datasets have set of columns every row not sure how handle relational data this. i using scikit-learn this. as far understand data looks this: incident table: id | i_attr0 | alerts 0 | foo | [alert0, alert1] ... alert table: id | a_attr0 alert0 | bar alert1 | baz ... if case denormalize table like: incident-alert table: id | i_attr0 | alert0 | alert0_a_attr0 | alert1 | alert1_a_attr0 | etc.. 0 | foo | true | bar | true | baz | and work there.

java - configuration faliure after replaceing chrome driver -

i m working on automation using selenium webdriver. chrome driver got crashed when run test. remove chromedriver.exe , download latest 1 , replace on target folder , driver folder. rebuild project , ran again.project building without errors. chrome not open. throws error follws : failed configuration: @beforemethod openbrowser([ljava.lang.object;@15bbf42f) java.lang.nosuchmethoderror: org.slf4j.impl.staticloggerbinder.getsingleton()lorg/slf4j/impl/staticloggerbinder; couldn't figure out error. appreciate support. find before class code : @beforemethod public void openbrowser(object[] testargs) throws exception { try { loginstruction("log instruction: open browser"); string datetime; file downloaddir; date date; dateformat dateformat; string dateexe = getdate(); writetooutput("==================="); writetooutput(dateexe); switch

java - android.util.Pair<F, S> example in Android -

i want return tuple of double data types. unable create pair . have read documentation unable make it. doing private pair mynums(double f, double s) { pair<f f, s s> p = pair.create(f, s); return p; } but saying unknown class f f , s type. in case double . pair<double, double> p = pair.create(f, s);