Posts

Showing posts from January, 2012

java - Fail to gpg-decrypt BouncyCastlePGP-encrypted message -

when try decrypt message using gnupg encrypted bouncycastle 2 gpg: [don't know]: invalid packet (ctb=xx) messages , decryption fails. i using bouncycastle 1.54 , gpg (gnupg) 2.0.30 on osx details 1) pgp key generated using gpg follows: $ gpg --gen-key gpg (gnupg) 2.0.30; copyright (c) 2015 free software foundation, inc. free software: free change , redistribute it. there no warranty, extent permitted law. please select kind of key want: (1) rsa , rsa (default) (2) dsa , elgamal (3) dsa (sign only) (4) rsa (sign only) selection? 1 rsa keys may between 1024 , 4096 bits long. keysize want? (2048) requested keysize 2048 bits please specify how long key should valid. 0 = key not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years key valid for? (0) 0 key not expire @ correct? (y/n) y gnupg needs construct user id identify key.

algorithm - Find keys of the 3 largest values in a Javascript Object with O(n) complexity? -

say have object such as: let objtocheck = { a: 2, b: 5, c: 9, d: 33, e: 4, f: 8, g: 3, h: 10 }; how go returning keys of 3 largest values in ascending order, in case be: [ 'c', 'h', 'd' ] , in linear time? evidently need loop through entire object once compare values, i'm having troubling coming solution doesn't involve nested loops believe o(n²). here solution looks far: function findbig3(obj){ const res = []; const largest = object.values(obj).sort((a,b) => {return b-a}).slice(0,3); (let key in obj){ largest.foreach( (val) => { if (obj[key] === val) res.push(key); }); } return res; } i imagine need declare 3 variables, such big1 , big2 , big3 , , loop through object type of comparison check , reassign appropriate, i'm struggling implementation. this algorithm runs in o(n). function getthreelargestkeys(obj){ var k1, k2, k3; var v1, v2, v3; v1 = v2 = v3 = -infinity;

r - How to reshape data from long to wide format? -

i'm having trouble rearranging following data frame: set.seed(45) dat1 <- data.frame( name = rep(c("firstname", "secondname"), each=4), numbers = rep(1:4, 2), value = rnorm(8) ) dat1 name numbers value 1 firstname 1 0.3407997 2 firstname 2 -0.7033403 3 firstname 3 -0.3795377 4 firstname 4 -0.7460474 5 secondname 1 -0.8981073 6 secondname 2 -0.3347941 7 secondname 3 -0.5013782 8 secondname 4 -0.1745357 i want reshape each unique "name" variable rowname, "values" observations along row , "numbers" colnames. sort of this: name 1 2 3 4 1 firstname 0.3407997 -0.7033403 -0.3795377 -0.7460474 5 secondname -0.8981073 -0.3347941 -0.5013782 -0.1745357 i've looked @ melt , cast , few other things, none seem job. using reshape function: reshape(dat1, idvar = "name", timevar = &qu

php - View content of PHPSESSID variable/cookie based on its value -

when visiting website (not owned me) example has set phpsessid variable/cookie value 7er3hjkal8u235c87u6ih0vz8y, possible view content? tried print_r($_session); in console says 'referenceerror: print_r not defined' . if not possible directly view content, there way view traffic or contents stored/piped phpsessid? thank you. you can't use print_r() in console, because console executing javascript, can't execute php functions in browser's console. you can't view contents of session, because never passed browser. when php creates session, (often times) sets cookie called phpsessid. value of cookie thing sent browser. value references on server (usually file containing serialized version of of session data). unless author of site explicitly writes session data out browser, browser never have access it.

Don't understand why I am receiving SIGKILL on python -

i'm beginner python , i'm trying make code on code challenge website when given list of integers, returns integer closest zero. if there 2 different integers same difference, e.g. 3 , -3, should return none. (however if number repeated, e.g. 3 , 3, doesn't count that) i've made code seems work on outside python interpeters, inside website gives error of "process exited prematurely sigkill signal." on external python interpreter seems return integer i'm looking for def closest(lst): ans = list(filter(lambda x: abs(0-x) == min([abs(0-i) in set(lst)]), set(lst))) return ans[0] if len(ans) < 2 else none is there in code causing inefficiency or website? i suspect coding website testing function passing large generator lst . when program converts set , loads entirety of input memory. if uses memory, process may killed oom killer. i think following solution ought work. note iterates on lst , doesn't construct other large d

Why does Perl's strict mode allow you to dereference a variable with an undefined value in this foreach context but not in an assignment context? -

this code: #!/usr/bin/perl use 5.18.0; use strict; # part 1 $undef = undef; print "1 $undef\n"; foreach $index (@$undef) { print "unreachable no crash\n"; } print "2 $undef\n"; # part 2 $undef = undef; @array = @$undef; print "unreachable crash\n"; outputs: 1 2 array(0x7faefa803ee8) can't use undefined value array reference @ /tmp/perlfile line 12. questions part 1: why dereferencing $undef in part 1 change $undef arrayref empty array? are there other contexts (other foreach) dereferencing $undef change in same way? terminology describe generic such case? questions part 2: why dereferencing $undef in part 2 fall afoul of strict ? are there other contexts (other assignment) dereferencing $undef fall afoul of strict . terminology describe generic such case? 1) for() in perl puts operand "l-value context", therefore $undef being auto-vivified existence array (reference) 0 elements (see this

javascript - clipboardData paste html format mobile web in iOS -

Image
clipboarddata in javascript, used getdata('text/html'). const clipboarddata = e.clipboarddata || window.clipboarddata; const pasteddata = clipboarddata.getdata('text/html') || clipboarddata.getdata('text'); this source activates in pc/aos platform. not working on ios. when pasting clipboarddata, want load html specification on ios show this. first picture: mobile web safari load format in ios second picture: pc web chrome load format i try mobile chrome, safari, , on.. same too.

c# - Dispose image and memory stream objects after calling HttpContext.Response.OutputStream.Write() -

how improve code below in terms of better performance? example, must explicitly dispose both memorystream , image objects after calling outputstream.write() ? any improvement on other areas, e.g. buffer , memorystream allocation? the code allow web user download png file. part of below: outputimage(image); image.dispose(); ... public void outputimage(image image){ using(memorystream temp = new memorystream()){ image.save(temp, imageformat.png) byte[] buffer = temp.getbuffer(); context.response.outputstream.write(buffer, 0, temp.length); } } asp.net, .net 4.5 response.outputstream getbuffer response.outputstream memorystream memorystream

microsoft cognitive - Does the Recommendation service allow enriching an existing model with new data? -

we able provide initial training model , ask recommendations. when asking recommendations can provide new usage events. these persisted @ model? manipulate model @ all? is there way data supposed updated or need retrain new model every time want enrich model? https://azure.microsoft.com/en-us/services/cognitive-services/recommendations/ edit: trying use "recommendations solution template" deploys solution azure , provides swagger endpoint working model ( https://gallery.cortanaintelligence.com/tutorial/recommendations-solution ) it appears cognitive services api richer this. can swagger version's models updated? after more experience discovered few things of august 21st, 2017: while not intuitive uninitiated, new data requires training new model data persisted model. this allows form of versioning model, , means when make new models can switch recommendations work how did before if don't work well. the recommended method appears to batch u

Same services for several Angular 4 projects -

i working on 3 different projects client, each 1 @ different server 3 of them share lot of functionality. i have basic folder structure: /company --project1 --project2 --project3 so tried put shared folder (with services) @ same company directory 3 projects , reference services going couple directories on app module. the files found module seems services must inside app/src folder, error emerges telling me angular/core missing. this basic way defining services: import { injectable } "@angular/core"; import { headers, http } "@angular/http"; import { appsettings } "../app.settings"; import * moment 'moment'; @injectable() export class routesservice { } so presume, breaking when trying find injectable @angular/core what guys recommend accomplishing this?

ionic3 - ionic 3 angular slide height just enough to hold contents -

my page looks http://moblize.it and trying change slide height enough contents. cannot fix else screw on smaller devices the current code looks like <ion-slides direction="vertical" speed="1000" slidesperview="1"> <ion-slide class="site-slide" style="background-color:#2298d3"> <ion-card style="height:300px;float:center"> <img src="http://www.segalpetroniru.com/images/consulting-services-hero-image-secondary.jpg" /> </ion-card> </ion-slide> <ion-slide padding class="site-slide" > <ion-row> <ion-col text-left> <ion-row><ion-col col-1 style="background-color: #4054b2"></ion-col><ion-col padding style="color:#616161"><h2 style="color:#616161">revolution!</h2> in field of mobile app development!</ion-col> </ion-row>

Cant seem to create "good" json file with python -

so in have loop. everytime code loop gets executed, happens: json_data.append({object_name : [string1, string2]}) so im creating alot of arrays, followed 2 values inside each array. after this: json_file = json.dumps(json_data) open('test.json', 'w') f: json.dump(json_file, f, ensure_ascii=false) the problem output im getting following: "[{\"cat\": [\"female\", \"fish\"]}, {\"pig\": [\"male\", \"carrots\"]}, {\"dog\": [\"male\", \"dogfood"]}]" now think wrong because: starts double quotes, wich indicates string , not json. after in each object there's escape sequence instead of quotes. how can solve of this? stop dumping twice. you're generating json, , encoding resultant string json.

postgresql - NoSuchMethodError when use slick SourceCodeGenerator -

i want auto generate slick table in build.sbt this page said. there comes error: [error] (run-main-4) java.lang.classnotfoundexception: scala.slick.codegen.sourcecodegenerator [trace] stack trace suppressed: run last *:slickgenerate full output. as this answer said, add librarydependencies += "org.scala-lang" % "scala-reflect" % scalaversion.value but didn't work. my build.sbt can seen here edit: i modified build.sbt here: (runner in compile).value.run("scala.slick.codegen.sourcecodegenerator", (dependencyclasspath in compile).value.files, array(slickdriver, jdbcdriver, url, outputdir, targetpackagename, username, password), streams.value.log) to: (runner in compile).value.run("slick.codegen.sourcecodegenerator", (dependencyclasspath in compile).value.files, array(slickdriver, jdbcdriver, url, outputdir, targetpackagename, username, password), streams.value.log) and there java.lang.nosuchmethoderror : [error] (ru

python - Add button next page - wizard - Odoo v8 -

i'm trying create wizard has several pages. i know how pass 'target' new or current, pass action form or tree view, need, before that, create several steps on different "views" of wizard, form 'next' , 'back' buttons. is there example code can that? i've searched on default addons, no success. the best way have popup target=new , have statusbar on top right clickable/not readonly (so user can go back). , depending on state of record, show appropriate fields you can of course create popup, , when user clicks next destroy popup , create 1 doesn't seem idea me.

PHP - Parsing nested JSON array values -

i have hit wall , not sure causing this. parsing json file , creating variables. ones not nested in arrays work great. these 2 below not though , not sure why. $hail var value shows both hail , $wind var , puzzled why. here snippet of code create variable value. $hail = isset($currfeature['properties']['parameters']['hailsize'][0]); $wind = isset($currfeature['properties']['parameters']['windgust'][0]); here how outputted , displayed in html displays shows $hail both var. <div class="alerts-description"> hazards<br /><? if (isset($hail)) {echo $hail . '" hail';} ?><br /> <? if (isset($wind)) {echo $wind . '" mph winds';} ?></div> example of array both hailsize , windgust nested under parameters , both [0] [response] => avoid [parameters] => array (

android - Save more than one string using OutputStreamWriter -

in app user taps screen gain score. , score can buy upgrades. want able save 3 integer values :counter,add,singleclick. know how save first integer value counter, when copy , paste same method , replace counter integer add integer doesn't work. can guys show me how save other integer values. please , thank you public void writecounttofile() { try { outputstreamwriter outputstreamwriter = new outputstreamwriter(openfileoutput("countvalue.txt", context.mode_private)); outputstreamwriter.write(string.valueof(counter)); outputstreamwriter.close(); } catch (ioexception e) { log.v("myactivity", e.tostring()); } } private int readcountfromfile() { string result = ""; int countervalue = 0; try { inputstream inputstream = openfileinput("countvalue.txt"); if (inputstream != null) { inputstreamreader inputstreamreader = new inputstreamreader(inputstream);

html - How I can pass user input between php files? -

now have simple email login form <form action="one.php"> <input type="email" name="email"/> </form> one.php email filter gmail users , header them custom path <?php $email = $_post['email']; if (stripos($email, '@gmail.com') !== false) { header('location: ../gmail/index.html'); } else { header('location: /unknownusers'); } ?> now done first page question how can email name page' example in /gmailusers <html> <head> </head> <body> <div> <font>welcome back,</font> <?php include 'one.php'; echo $email; ?> </div> </body></html> $email not work in because one.php doesn't have saved info how can make this welcome 'user.email@gmail.com' in index.html file can body me php code. the easiest way not use location redirection, include file want show. one.php <?php

Building QGIS with Visual Studio 2015 on windows x64? -

i tried follow guide @ github , hence encounter problem after problem (now have problems with: msbuild.exe value of vctargetspath: , earlier couldn't find c++ paths etc.) assume have done mistake , missed running installation. i'm curious if there have build qgis on windows(10) visual studio(2015) , can give advise change in .bat file, can set path bison , flex in cmake, , shall use ninja.exe file downloaded according guide.

tcl - How to expect strings with leading '-' char in Expect script -

i have tried code expecting "-bash-4.3$" expect "-bash-4.3$" but not work you need write expect -- -string otherwise expect think -string option. # expect -c 'expect -bash' bad flag "-bash": must -glob, [...], -timeout, -nobrace, or -- while executing "expect -bash" # expect -c 'expect -- -bash'

Webkit to find elements with Swift -

i need test ui in mac os (not ios) using swift. have opened browser using webkit module's nsworkspace.shared().open . there way find elements on browser (example: find elements id, click button etc) using webkit. note: can't use uikit

prepare a set of arguments that can pass to a function in java -

this question has answer here: can pass array arguments method variable arguments in java? 4 answers i want call function private void passstrings(string... arg){} , have array store set of strings don't know size. how can use array value , call function passstring(). just pass as array: string[] array = { "some", "arguments", "i", "prepared", "earlier" }; passstrings(array); a varargs parameter arg still array parameter - it's compiler allows specify elements individually, if want. doesn't force though - if you've got array, pass it.

c# - Filtering is not working primeNg DataTable while using template -

draft confirmed cancelled amended {{voucher[col.field] | date:'dd-mmm-yyyy'}} {{note[col.field]}}

How to get the data in KAA server that sent from client side with REST api? -

want ask 1 question of rest api. how data in kaa server sent client side rest api? for example, in datacollectiondemo, hardware client sends temperature kaa server. then, in other client, want temperature kaa server rest api. how it? thanks , best regards, richard

html - How to implement dropdown menu as per below requirements in angular2 -

by default want set value in dropdown this: {{getteamname(employee.team)}} , bind value {{team.$value}} . <div class="form-group"> <label for="team">designation</label> <select [(ngmodel)]="selectedvalue" [ngmodeloptions]={standalone:true}"> <option *ngfor="let team of teams">{{team.$value}}</option> </select> </div> function: getteamname(key) { let result = this.teams.filter(item => item.$key == key); if (result.length > 0) { return result[0].$value; } return ''; } you directly consider binding emplyee.team pre-populate team object in ngmodel & populating team value inside dropdown use [ngvalue]="team" on option level. not sure team.$value , assumed want display team.name . <div class="form-group"> <label for="team">designation</label> <select [(ngmo

c - How to save wtime differences in a File from multiple thread in OpenMP? -

i trying use openmp database internal project improve performance. need running time(am using omp_get_wtime() ) saved in file there no way can print console program. please suggest if better way exists. tried write single file threads(see below code), crashing when number of threads more one. please help. in advance. file *fp = null; fp = fopen("/home/fopen.txt","a"); ... omp_set_num_threads(2); fprintf(fp,"num of threads: %d\n",omp_get_num_threads()); #pragma omp parallel default(shared) private(tid) { tid = omp_get_thread_num(); #pragma omp critical fprintf(fp,"threadid of thread %d\n",tid); : : } if (fp != null) fclose(fp); needed set array recording times, had each thread write element of array (indexed thread number). after parallel region had remaining active thread write array file. @high performance mark.

How to play a audio file which is AES encrypted using Exo Player 2 in android??? -

i have audio file aes encrypted. want play audio in app , no other app should able play audio file. have seen method aescipherdatasource in exo player, not not sure how works. can more information on or sample code helpful. or if there other way in can play audio file other user or app can play audio files.

javascript - How to compare front-end user login inputs with oDatamodel json object in sapui5? or any other scenario to follow? -

// these user inputs , hold values in these variables, need comapare these values odata model json object values. // have created ztable columns username , password, data through odata service, need validate front end credentials odata backend. related solution helpful! thanks! var user = sap.ui.getcore().byid("username").getvalue(); var pass = sap.ui.getcore().byid("password").getvalue(); var sserviceurl1 = "proxy/http/xxxxxxxxxxxxxxxxxxxxx/sap/opu/odata/sap/zsample_project2_srv"; var omodel1 = new sap.ui.model.odata.odatamodel(sserviceurl1,true,"xxxxxxxx", "xxxxxxxx"); var ojsonmodel1 = new sap.ui.model.json.jsonmodel(); omodel1.read("/xxxxxxxxxxxx?",null,null,true,function(odata1,response){ ojsonmodel1.setdata(odata1); }); sap.ui.getcore().set

pandas - How to pass a list variable which contains column names of particular table to django model values() in Python? -

consider list below : listofcol = ['col1','col2','col3'] django model example: model.tablename.objects.values(listofcol).filter() i fetch list of columns variable listofcol , tried mentioned in django model example , getting error message 'list' object has no attribute 'split' . in brief, table contains 50+ columns. selected columns stored in listofcol variable(columns changes periodically) need fetch through django model. there way fetch so..? thanks in advance..! from documentation assume need unpack list, this: model.tablename.objects.values(*listofcol).filter() just assumption, please tell if works :)

archlinux - I have installed KDE plasma but Konsole is missing. How to return to CLI? -

i installed arch linux in virtual box , installed kde plasma on using following command- pacman -s plasma when rebooted after enabling sddm, desktop environment did not have konsole, dolphin, etc. is there way return cli without resetting vm? you can switch tty via ctrl+alt+f<1-7> . normally plasma environment runs either on ctrl+alt+f1 or ctrl+alt+f7 try 2-6!

how to get first row and column value from data table which contain value from excel sheet using c# to create dynamic table in sql server -

i had exported data excel file data table.what want take header of excel file , make dynamic table in sql database every time update new excel here code import data excel data table. protected datatable dataexcel() { datatable dt = new system.data.datatable(); try { string filenname=@"c:\users\sani singh\documents\excel03.xls"; string sworkbook = "[sheet1$]"; string excelconnectionstring=@"provider=microsoft.jet.oledb.4.0;data source="+filenname+";extended properties='excel 8.0;hdr=yes;imex=1'"; oledbconnection oledbconn = new oledbconnection(excelconnectionstring); oledbconn.open(); oledbcommand oledbcmd = new oledbcommand(("select * " + sworkbook), oledbconn); dataset ds = new dataset(); oledbdataadapter sda = new oledbdataadapter(oledbcmd); sda.fill(ds); dt = ds.tables

reactjs - Unknown property on TransitionGroup - React Animation -

i getting error "warning.js:36 warning: unknown props onexited , appear , enter , exit on tag. remove these props element. details, see ... in div (created tripfilteredlist) in div (created transitiongroup) in transitiongroup (created tripfilteredlist) in div (created tripfilteredlist) in tripfilteredlist (created tripsortedlist) in div (created tripsortedlist) in tripsortedlist (created tripfinder) in div (created tripfinder) in tripfinder" i using import transitiongroup 'react-transition-group/transitiongroup'; <transitiongroup component="div" childfactory={child => child} > <div classname={`cards ${display === 'other' ? 'search-results__other-content' : ''}`}> {display === 'row' && tripfilteredlist.map((data, index) => <triprow key={index} {...data} />) } </

rdp - Remote desktop access - any software that can wider larger client side display? -

i have dell windows 10 laptop in office. want remotely access laptop home office. @ home have windows 10 desktop 2 large monitors. is there remote desktop software allows remote laptop display virtualised across both of desktop pc monitors? laptop has 1960 x 1080 display. 2 monitors @ home have 3920 x 1080 display. possible change remote laptop use 3920 x 1080 display? try logiciel: https://www.teamviewer.com best remote. see you

passwords - Asp.net Identity DataProtectorTokenProvider Tokenlife span not working -

asp.net identity dataprotectortokenprovider tokenlife span not working, expiring automatically after 1 hour if specify tokenlifespan 2hours var provider = startup.dataprotectionprovider; _usermanager.usertokenprovider = new dataprotectortokenprovider<identityuser>(provider.create("accountactivation")) { tokenlifespan = timespan.fromhours(2) }; var emailconfirmtoken = await _usermanager.generateemailconfirmationtokenasync(userid); var passwordresettoken = await _usermanager.generatepasswordresettokenasync(userid); string callbackurl = string.format(appsettings.applicationurl, "reset-password") + "?userid=" + userid + "&email=" + email + "&emailtoken=" + emailconfirmtoken + "&resettoken=" + passwordresettoken; i us

list of type parameter in trait scala -

trait mytrait[t]{ def mylist[t] =listbuffer.empty def add(ele:t)= mylist::ele def get:t=mylist } i want create list , add elements inside list , return list i getting compile error. update any alternative use list instead of list buffer you're shadowing trait level t in mylist . remove type parameter method: def mylist = listbuffer.empty[t]

java - How to set the font from Styles.xml in android -

what have : i have custom class inheriting appcompattextview . i have defined custom attribute textformat in attires.xml , passing font need set xml stylefile <style name="headerfiltername"> <item name="android:src">@drawable/back_button</item> <item name="android:text">@string/str_filter_edit</item> <item name="android:gravity">center</item> <item name="android:textsize">@dimen/header_filter_name_text_size</item> <item name="android:layout_weight">1</item> </style> xml <customviews.customtfttextview android:id="@+id/txtscreennameid" android:layout_width="wrap_content" android:layout_height="wrap_content" app:textformat="fonts/sf_san_fransisco.ttf" style="@style/headerfiltername"/> attr.xml <?xml version=&

forms - Django: ManyToManyField.limit_choices_to seems not working properly -

i have following models: models.py : def limit_name_choices(): return {"pk__gt": name.objects.last().pk} class name(models.model): name = models.charfield(max_length=100) primary = models.booleanfield() class robject(models.model): project = models.foreignkey(to=project, null=true) author = models.foreignkey( to=user, null=true, related_name="robjects_in_which_user_is_author") create_by = models.foreignkey( to=user, related_name="robjects_created_by_user", null=true) create_date = models.datetimefield(null=true) modify_by = models.foreignkey(to=user, null=true) name = models.manytomanyfield( "name", related_name="robject_name", help_text='the name of robject', limit_choices_to= get_last_name_pk() ) views.py : def robject_create_view(request, *args, **kwargs): if request.method == "post": form = robjectfor

sbt package and assembly include jars i don't want to -

i using sbt package generate jar, deploy after in cluster. issue sbt package command includes dependencies didn't specify in build file, , these causes many troubles when running jar. well, answer question, here code: assemblyexcludedjars in assembly := { val cp = (fullclasspath in assembly).value cp filter { f => f.data.getname.contains("spark-core") || f.data.getname == "spark-core_2.11-2.0.1.jar" } } src: how exclude jar in final sbt assembly plugin my problem turns out dependency: com.fasterxml.jackson.case.jsonfactory it solved addiding next dependencies: librarydependencies += "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.8" librarydependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.8" librarydependencies += "com.owlike" % "genson" % "1.4"

yocto - bitbake error package not found in base feeds -

i want include https://pypi.python.org/pypi/ndeflib in image. created recipe this. following contents of python-ndeflib_0.2.0.bb description = "nfc data exchange format decoder , encoder." section = "devel/python" license = "closed" src_uri = "https://pypi.python.org/packages/0c/0f/b9d94cee7847697469c49a25b4d23236de534451990b83008e6bf4fab15b/ndeflib-0.2.0.tar.gz" do_install_append() { rm -f ${d}${libdir}/python*/site-packages/site.py* } do_compile_prepend() { ${staging_bindir_native}/python setup.py install ${distutils_build_args} || \ true } src_uri[md5sum] = "b7ae0c34f49289c44c292e24843cfeb1" i able bitbake python-ndeflib but whenever try build final os image bitbake fsl-image-machine-test process fails @ following error error: python-ndeflib not found in base feeds thus making mistake? did try write recipe similar 1 in previous question? should have solved issue. writing similar recipe, give

Microsoft Project Online approve task using CSOM or REST API -

working on project online. i want develop custom task approval form project manager. pls guide how list of pending task approval list pm can approve / reject task. basically want update field / custom field / custom list after task approved pm. want develop custom view/app task approval ootb view.

javascript - How to post info form wp sql into js -

am new developing , trying learn self doing different things.right trying wordpress pluging can create database , insert , delete info it.after catch info sql clicking btn name="chooseid" , js code sql row info save on , code. done inserting , deleting section facing problem getting info the selected name="chooseid" js. advice please how solve issue , code run. best regard's <?php /* * plugin name: reloader1 * description: reloader of pages * version: 1.0 * author: test * */ // attach bootstrap function xobamax_resources() { wp_enqueue_style('bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'); wp_enqueue_style('style', get_stylesheet_uri()); wp_enqueue_script( 'bootstrap-js', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js', array('jquery'), '3.3.4', true ); } add_action(&#

Receive JSON Array response from Java servlet in UTF-8 charset -

i doing ajax call java servlet. servlet responds json array charset set utf-8. however, once response in ajax call, ??? characters in strings. went through lot of testing , research , not find possible solution. ajax call: $.ajax({ type: 'post', data: {curtablename: curtablename,curtableid: curtableid}, datatype: 'json', url: '../showproducts', success: function(productinfo){ var noofproducts = productinfo.length; for(var = 0; < noofproducts; i++) { product.push(productinfo[i].product.substr(0,25) + "..."); webshop.push(productinfo[i].webshop); price.push(productinfo[i].price); availability.push(productinfo[i].availability);

spring boot - Failing while testing autowired field using Junit -

am new junit, solution below issue welcomed. have main class like, @service public class mainclass extends abstractclass { @autowired classa a; @autowired objectmapper mapper; public void methoda(){ .... anotherclass obj= (anotherclass)mapper.readerfor(anotherclass.class).readvalue(some_code); ....... } test class is, @runwith(powermockrunner.class) @preparefortest({mainclass.class}) public class mainclasstest { @mock classa a; @mock objectmapper mapper; @injectmocks mainclass process = new mainclass(); //i have somthing autowired mapper class of main in test class @test public void testprocessrequest() throws exception{ process.methoda() } am getting null mapper object in main class while testing, yes aware haven't dne kind of initialization. there better way writing junit mapper. note : tried @mock objectmapper throws exception @ "readerfor". in advance. you not have use mockito/powermock. use spring boot test. this: import org.junit.t

jquery - JSPDF - repeat the content so it appears multiple times on the page -

i creating small letter generator project. i'm using jspdf , want repeat content in 'lettercontent' div on exported pdf document multiple times down page. is there anyway this? thanks help! <html> <head> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="jspdf.min.js"></script> <script> $(function () { $('#generateletter').click(function () { var doc = new jspdf(); doc.addhtml($('#lettercontent')[0], 15, 15, { 'background': '#fff' }, function() { doc.save('party-letter.pdf'); }); }); }); </script> </head> <body> <div id="lettercontent"> <p> dear neighbour, <br /> <br />

c# - Azure mvc web app deploy with 2 dbcontexts and class library -

hi guys trying deploy mvc application azure. far, ive done half of work. so, main web application aplicationdbcontext identity2.0 tables user , roles , on. now, have dal class library model , quizcontext rest of application. use 1 instance of database storing these 2 contexts , u can see server explorer on left done on localhost, when try publish on azure mvc web project deployed. sure ive connected sql management studio azure database , shows identity tables. after searching few days online find solution gave cuz basic stuff. can u me make happen :d goal deploy web application class library(s) , 2 dbcontexts using 1 database on azure. thank u much. link pictures u better understanding of problem http://testic1.azurewebsites.net/ there no error msg. @ publish console project published - 1 , thats it. this dbcontext class library namespace quiz.dal { public class quizcontext : dbcontext { public quizcontext() : base("name=defaultconnection&q

java - .getNameCount() different results when creating Path using String and URI -

i reading book related ocp exam. studying path , uri , noticed strange. here code: uri u1 = new uri("file://c:/brother/drvlangchg/langlist.ini"); path f = paths.get("c:/brother/drvlangchg/langlist.ini"); path p1 = paths.get(u1); for(int = 0; < p1.getnamecount(); i++) { system.out.print(p1.getname(i) + " "); } system.out.println(p1.getroot()); system.out.println(); for(int = 0; < f.getnamecount(); i++) { system.out.print(f.getname(i)+" "); } system.out.println(p1.getroot()); and output: drvlangchg langlist.ini \c\brother\ brother drvlangchg langlist.ini \c\brother\ what noticed internally java sets type "file" when using uri while type null string parameter (i on windows 10). i little puzzled , learn more strange (in opinion) behavior , should watch if using path. edit :got it, comments.

javascript - --AMI JS-- Creating segmentation LUT -

i have question regarding use of segmentation luts in ami js (not xtk there no ami js tag yet!). particularly want load segmentation / labelmap layer , display right colors, 1 each label. my labelmap layer consists of n integer labels define different structures (e.g 0 14000), voxel values of labelmap. each 1 of labels has different color associated (they generated freesurfer , can seen on: https://surfer.nmr.mgh.harvard.edu/fswiki/fstutorial/anatomicalroi/freesurfercolorlut ). what lut that, each different label, paints correspondant color. have had trouble finding right way , have not had success far. have done colors , store them array (colors normalized between 0 , 1 , first component being position inside texture 0 1, step of 1/total labels, results in small step there 1200 labels!). i've seen then, helperslut class takes colors , maps them discretely texture, colors appear messed , can't seem opacities right either... i have seen stackmodels have functionalit

java - While inject mock error throws from logger -

here's example code. class a class going write test case. class { private static log logger = logfactory.getlog(a.class); @autowired abdul abdul; public object getdetails(){ return abdul.getdetails(); } } class abdul { public object getdetails(){ return new object(); } } class atest{ @injectmocks a; @mock private abdul abdul; @before public void initmocks(){ mockitoannotations.initmocks(this); } } i getting following error when @injectmocks called :- log4j:error setfile(null,true) call failed error throws when attempted mock logger using powermock got following error: org.mockito.exceptions.misusing.nullinsteadofmockexception: argument passed when() null! example of correct stubbing: dothrow(new runtimeexception()).when(mock).somemethod(); also, if use @mock annotation don't miss initmocks() please me resolve it. in advance.

r - Bookdown: Citations at end of sections in single HTML output file -

i looking citations use @ end of sections (i.e. 2.1.). accomplish this, output format can set as: output: bookdown::gitbook: split_by: section this works fine, want render file single html file use of sharing colleagues. way can work through code: output: bookdown::gitbook: split_by: none which puts citations @ end of file. there way citations @ end of sections, yet render single html file?

Print special character in assembly bootloader -

i want print characters such ▀, ▄ , ■ in assembly bootloader. when this: println: lodsb or al, al jz complete mov ah, 0x0e int 0x10 jmp println complete: call printnwl printnwl: mov al, 0 stosb mov ah, 0x0e mov al, 0x0d int 0x10 mov al, 0x0a int 0x10 ret msg db 'message specia character ■', 0x0 mov si, msg call println the special characters replaces weird other characters. thank your help thank michael petch , ped7g commenting question. tried out both of advices, , both did work. here's method used: write special characters inside assembly file in plain text (not michael petch suggested) save file dos encoding (i use sublime text text editor) build nasm , characters display in bios

python - subselection of columns in dask (from pandas) by computed boolean indexer -

i'm new dask (imported dd) , try convert pandas (imported pd) code. the goal of following lines, slice data columns, which's values fullfill calculated requirement in dask. there given table in csv. former code reads inputdata=pd.read_csv("inputfile.csv"); pseudoa=inputdata.quantile([.035,.965]) pseudob=pseudoa.diff().loc[.965] inputdata=inputdata.loc[:,inputdata.columns[pseudob.values>0]] inputdata.describe() and working fine. simple idea conversion substitute first line to inputdata=dd.read_csv("inputfile.csv"); but resulted in strange error message indexerror: many indices array . switching ready computed data in inputdata , pseudob error remains. maybe question assigned idea of calculated boolean slicing dask-columns. i found (maybe suboptimal) way (not solution) that. changing line 4 following inputdata=inputdata.loc[:,inputdata.columns[(pseudob.values>0).compute()[0]]] seems work. yes, dask.dataframe's .loc

java - JUnit testing recursive method -

i made 1 class recursive method checks if 2 arrays same, want test junit. question be: what method should use test no value, negative value , limited value? thanks in advance. best regards ps: have done far: @test public void testofthetests(){ system.out.println("test"); int[]a={1,2,3,4,5,6,7}; int[]b={7,6,5,4,3,2,1}; boolean result = main.equalshelper2(a,b,0,6); boolean expresult=true; // assertequals(expresult,result); assert.assertnotnull(result); } what have read "no value, negative value , limited value" means, test different forms arrays can take, no value or negative doesn't apply case need think of test cases apply method. here test cases might want add: one array null both arrays null the arrays have different length the elements in same order in both the arrays have same elements in different order if array indexes passed method invalid ... ... here 2 examples: @test public voi

sbt - Playframework 2.6.2 runProd -

im using playframework 2.6.2 , m trying run in production mode. tried command runprod after sbt have error: (starting server. type ctrl+d exit logs, server remain in background) la ligne entrée est trop longue. la syntaxe de la commande n'est pas correcte. i tried put project directly in c: error maintains. any idea ? thank you.

php - MySQL REPLACE is not working if we store query into a variable -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers my query this: <?php $sql = "update macs_temp set home_page_heading='$home_page_heading', home_page_sub_heading='$home_page_sub_heading', home_page_description='$home_page_description', about_us_heading='$about_us_heading', about_us_description='$about_us_description', business_description='$business_description', we_do_description='$we_do_description', video_description='$video_description', photography_description='$photography_description', music_description='$music_description', web_and_app_description=replace($web_and_app_description, '\'', '') id=1"; if ($conn->query($sql) === true) { // echo "record updated successfully"; header(&