Posts

Showing posts from February, 2013

apollostack - Apollo GraphQL: Schema for Query to Return Objects of Different Types? -

i have 3 different postgres tables, each containing different types of associates. database fields different each type-- that's why in 3 separate tables. i have 1 component can potentially access type of associate. seems examples i've encountered far, component typically associated 1 graphql query, e.g.: const withdata = graphql(getoneassociate_query, { options({ navid }) { return { variables: { _id: navid} }; } , props({ data: { loading, getoneassociate } }) { return { loading, getoneassociate }; }, }); export default compose( withdata, withapollo )(associateslist); and appears given graphql query, can return single type of record, e.g. in schema: getoneassociate(associatetype: string): [associateaccountingtype] question: possible design graphql schema such single query, can return objects of different types? resolver receive associatetype parameter tell postgres table reference. schema like, r...

Android gradle issue with sdk versions -

i had error being returned after doing build emulator though none shown when doing rebuild. after online research discovered reason might compilesdkversion , buildtoolsversion not matching or compilesdkversion not being supported targetsdkversion. unfortunately changing compilesdkversion 18 doesn't rather returns huge number of errors. have idea how resolve this? compilesdkversion 24 buildtoolsversion "25.0.0" ... minsdkversion 18 targetsdkversion 24 ... compile 'com.android.support:appcompat-v7:24.2.1' if using buildtoolsversion '25.0.0', habe use compilesdkversion 25 if using compilesdkversion 24, have use buildtoolsversion 24.0.3

c# - Is UseIISPlatformHandler() deprecated correctly to UseIIS()? -

in this place , there's information on changes core follows. public void configure(iapplicationbuilder app, iloggerfactory loggerfactory) { ... // remove call app.useiisplatformhandler(); handled useiis in main. // remove call app.useforwardedheaders(); handled useiis in main. ... } however, when checking out contents of method, there's no such call useiis() . nearest 1 useiisintegration() it's commented if substitutes useforwardedheaders() . public static void main(string[] args) { var host = new webhostbuilder() .usedefaultconfiguration(args) .useserver("microsoft.aspnetcore.server.kestrel") // replaces call useiisplatformhandlerurl() .useiisintegration() .usestartup<startup>() .build(); host.run(); } what misunderstanding? the issue rather old , things have changed since then. on right track, though. the useiisplatformhandler call indeed moved startup program start , has been renamed useiisinte...

portable executable - Which PE header fields are used by windows loader? -

Image
i'm trying understand pe header files produced executable compressor. i've been told header fields windows uses in case intact. other, on other hand, contain complete garbage pe header perspective. i'm trying understand ones relevant ones. let's got image_dos_header : and image_file_header : when open executable on debugger, stops @ address: cpu disasm address hex dump command comments 0040005c 53 push ebx so, how debugger knows 0x0040005c location needs start debugging at? what'd formula calculate "entry point" address? i guess main question here is, pe header files relevant windows perspective loader , ones used other purposes these type of packers? from image_dos_header e_magic (for check) , e_lfanew (offset image_nt_headersxx (32 or 64) ) used. need image_nt_headers fields. entry point calc easy pimage_dos_header imagebase; if (imagebase->e_magic == ima...

ms access - Entering a zero-length string into a form -

i have form 2 fields (a , b). b designed show after have entered data a. want able enter a. access not allow me - b not show if press enter on keyboard field (a zero-length string). can fix this? have used code below: private sub a_afterupdate() if = "" b.visible = true else b.visible = true end if end sub i guess have in mind: private sub a_afterupdate() b.visible = not isnull(a.value) end sub and cannot "type" null value. leave textbox empty.

android - Xamarin TimePicker propertychanged event fired on load -

i developing xamarin app android using xamarin forms create layout. have come across issue time picker firing on load of view cell. what doing creating list view , setting item template custom view cell template. in view cell template creating timepicker , binding propertychanged event it. setting timepicker.time property information retrieved database. seems happen @ point propertychanged event fired each item displayed in list view. leads multiple database calls not needed. is there way stop propertychanged event being called until property has been changed? my code below. public class mycell : viewcell { private readonly timepicker _mytimepicker; public mycell() { _mytimepicker = new timepicker() { horizontaloptions = layoutoptions.endandexpand }; _mytimepicker.setbinding(timepicker.timeproperty, "starttime"); _mytimepicker.propertychanged += mytimepicker_propertychanged; var viewlayout = new stacklayout(...

c# - Use same local database in independent projects -

i have solution several projects: a class library contains database context, lets call datumclasslibrary. a class library contains model entities, lets call modelsclasslibray a class library contains repositories model entities of modelsclasslibray, lets call repositoriesclasslibrary. besides have other projects, 1 mvc5 application , other webapi application. how can use same local db file both mvc5 application , webapi application, using entity framework code first? ef doesn't care how/where use it... pass correct connection string in context's constructor every time use it

java - Convert string with utf-8 to unicode -

i have string contains utf-8 encoded emojis. string escaped. need convert utf-8 emojis , print them properly. example: input: \\xe2\\x80\\x9c@vinefights: not care lamo!!! \\xf0\\x9f\\x98\\x82 https:\\/\\/t.co\\/twmyfehx9g\\xe2\\x80\\x9d\\xf0\\x9f\\x98\\x82\\xf0 \\x9f\\x98\\xad\\xf0\\x9f\\x98\\xad expected output: not care lamo!!! 😂 url”😂😭😭 this 1 sinle string (without breaks). have broken down fit in 1 view in question. idea extract emojis using regex (\\\\x[a-fa-f0-9]{2})+ , replace them converting bytes manually emojis. failed in several cases 1 in example. feels unnecessary hacky/ugly solution. what's right way handle it? (more interested know how done in real world. examples appreciated)

apache spark - Features for sentiment analysis of twitter data related to music -

need guidance related sentiment analysis on tweets related music on spark. i trying perform sentiment analysis on twitter data tweets related music. after lot of searching around net, have understood how fetch tweets using 'tweepy' python api , realized can use 'naive bayes classifier' classify tweets. confused regarding how define features classification, supposed define @ least 500 features. here questions. not want use available api 'textblob' find sentiment of tweet. 1) can give examples of features can use classifying music related tweets ? [ can use tweets happy smiley positive training set ? if words in tweets features classifier ?] 2) how generate training set classifier? 3) if want filter tweets music related tweets, can use bloom filter achieve ? 4) size of data can through tweepy api ? please correct me if there wrong understanding. since sentiment analysis supervised task, should have training (and test) set. on training set...

linux - How to get only ip addresses from the echo stat command -

when executing below command echo stat | nc localhost 2181 i getting zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 gmt clients: /10.999.87.01:56046[1](queued=0,recved=95261,sent=95261) /10.888.98.02:47356[1](queued=0,recved=45856,sent=45856) /10.777.09.03:53636[1](queued=0,recved=96378,sent=96380) latency min/avg/max: 0/0/316 received: 3034250 sent: 3035252 connections: 3 outstanding: 0 zxid: 0x21000351cf mode: follower node count: 2740 can me separate ip addresses below using commands 10.999.87.01 10.888.98.02 10.777.09.03 so question have commands this. if yes please help. :) ... nc .... | awk -f: '/^[\/]/{sub(/^[\/]/,"",$1);print $1}' output 10.999.87.01 10.888.98.02 10.777.09.03

python - Find Value From JSON -

first off, i'm sorry title, didn't know how specific issue there. ok, i'm doing league of legends api. data displayed json , can found here , want loop through it. have data script displays stats each player on match. in stats there id champion being played. want use id , compare each key json file above , if finds matching key - id can name of champion. problem don't know how can iterate through each 1 of them, because can see on file there this (posted image because couldn't indent right. how can access id of each one? because, again, can see, each 1 has different names (jax, sona, tristana, etc...) want key , name of each one. tried using loop couldn't list first 1 i'm pretty lost time. :) code: champ_r = requests.get("https://global.api.pvp.net/api/lol/static-data/lan/v1.2/champion?" "api_key=").json() x in champ_r['data'][0]: pprint(x['id']) if run keyerror: 0 , if remo...

node.js - Accessing JavaScript variables from client and server -

i have assigned variable value of text field var x=document.getelementsbyclassname("base--textarea input--textarea")[0]["value"];), this in ejs document. however, want extract "key words" text using node module keyword extractor. so, how access variable x server.js file, use keyword extractor method on , return extracted keyword(s) client?

java - How to put two numbers separated by a space into two different arrays -

i have 2 number inputs 1010 212 i want put these 2 different arrays ([1 0 1 0] , [2 1 2]) this code import java.io.*; import java.util.*; public class solution { public static void main(string[] args) { int array[] = new int[8]; int array2[] = new int[8]; int = 0; scanner getnumber = new scanner(system.in); { array[i] = getnumber.nextint(); i++; } while(getnumber.hasnextint()); system.out.println(arrays.tostring(array)); } } but output [1010, 212, 0, 0, 0, 0, 0, 0] (i put 8 generic array length because java compiler forced initialize each array) you need store numbers first initialize arrays based on length of number. can length turning string. once left number , empty array, can split integer array of digits number of ways. int[] array, array2; scanner in = new scanner(system.in); int a, b; = in.nextint(); b = in.nextint(); array = new int[integer.tostring(a...

arrays - How to query multiple keys with Firebase GeoFire using Swift? -

i've got geofire query bringing user id's or keys . i'm getting keys in sequence, i'm getting several sequences. how can last updated sequence? @ibaction func friendsnearmeactn(sender: anyobject) { let geofireref = self.ref.child("userlocations") let geofire = geofire(firebaseref: geofireref) let circlequery = geofire.queryatlocation(self.location, withradius: 20.6) circlequery.observeeventtype(.keyentered, withblock: { (key: string!, location: cllocation!) in self.localusers.append(key) self.getlocalusers() }) } func getlocalusers() { print(self.localusers) } this i'm getting func getlocalusers() .... ["wgueyzdjh4nw2vnehoygmjf6pyb3"] ["wgueyzdjh4nw2vnehoygmjf6pyb3", "cg4pqj36ttnuuwnqtc16tifmi0a2"] ["wgueyzdjh4nw2vnehoygmjf6pyb3", "cg4pqj36ttnuuwnqtc16tifmi0a2", "n5pgqgehw2f7pggvmb3aq8v1upk2"] how can last...

python - Find the best next key in a dictionary which value fits in a constrain -

i have dictionary names:weights of cows. cows = {'herman': 7, 'moo moo': 3, 'betsy': 9, 'lola': 2, 'milkshake': 2, 'florence': 2, 'henrietta': 9, 'maggie': 3, 'millie': 5, 'oreo': 6} i have create list of lists dictionary using greedy algorithm. each sub-list has constrain: weight limit 10. means, have select biggest cow weight first , find next cow fits in sub-list. example, right answer problem dictionary be: [ ['betsy'], ['henrietta'], ['herman', 'moo moo'], ['oreo', 'maggie'], ['millie', 'florence', 'milkshake'], ['lola']] i'm trying create function find next best fit subtrip. example, if first element of sublist 'herman' (weight of 7 tons), need find next key fits best value gets closer 10, in case 'moo moo' (weight of 3 tons). so, here function wrote find next fit: def findnextfit(adict, v...

android - Linphone compilation error when compiling with x264 in v3.2 -

i have compiled linphone source code without x264 encoder.but when add x264 encoder(i.e. ./prepare.py -denable_x264=yes -denable_non_free_codecs=yes).it gives me error in make step.i think problem in configuration file of x264.i m using ndk-r12b , pre requisites installed. shall grateful. make[3]: entering directory /home/usman/downloads/linphone-android/work/android-armv7/cmake' [ 19%] creating directories 'ep_x264' [ 19%] no download step 'ep_x264' [ 20%] no patch step 'ep_x264' [ 20%] no update step 'ep_x264' [ 20%] performing configure step 'ep_x264' no working c compiler found. make[3]: *** [/home/usman/downloads/linphone-android/work/android-armv7/stamp/ep_x264/ep_x264-configure] error 1 make[3]: leaving directory /home/usman/downloads/linphone-android/work/android-armv7/cmake' make[2]: * [cmakefiles/ep_x264.dir/all] error 2 make[2]: leaving directory /home/usman/downloads/linphone-andro...

javascript - Laravel form validation for returning dropdown values -

when validation fails, want dropdowns have selected values in it.my drop down list populated javascript. validation not validate dropdown box values. drop down list in view <div class="form-group"> <label align="right" for="itemid" class="control-label col-xs-2">item :</label> <select class="col-md-5 input-sm" name="itemid" id="itemid" > <option> </option> </select> </div> my java script loading values $(document).ready(function(){ $('#year').on('click',function(e){ var year= e.target.value; $.getjson('/xxxxx/xxx?year=' + year, function(data){ $('#itemid').empty(); $.each(data,function(index, courses){ $('#itemid').append('<option value="'+courses[0].id+'">'+courses[0].code+'</option>...

python - How to get BeautifulSoap to parse encoded characters such as "\u003C"? -

i have html string of characters encoded: \u003c\/style\u003e\u003cdiv\u003e\u003cdiv style=\"position:relative;background: ...... i want able parse beautifulsoap. there easy way convert these encoded characters fromat beautifulsoap support , feed result string it? there no need that. beautifulsoup can handle correctly. ran html string, works. html string test

sql server - Table Difference component failed with 'System.OutOfMemoryException' -

Image
i have package loads data sql server source. after extracting records determine differences between source , target using 'table difference component'. it's daily running package. of days run fine days package fails , gives following error message: source: dft_stg_apr_activity_aud_members table difference [215] description: system.outofmemoryexception: exception of type 'system.outofmemoryexception' thrown. @ microsoft.sqlserver.dts.pipeline.pipelinebuffer.get_item(int32 columnindex) @ cozyroc.sqlserver.ssis.tabledifference.inputinformation.addrow(pipelinebuffer buffer) @ cozyroc.sqlserver.ssis.tabledifference.processinput(int32 inputid, pipelinebuffer buffer) @ microsoft.sqlserver.dts.pipeline.managedcomponenthost.hostprocessinput(idtsmanagedcomponentwrapper100 wrapper, int32 inputid, idtsbuffer100 pdtsbuffer, intptr bufferwirepacket) end error error: 2016-08-22 00:21:32.78 code: 0xc0047022 source: dft_s...

php - How to merge same name as one and store their value? -

during making team honor list facing problem.i using following codes show team names , number of seasons. codes: <?php $terms = wp_get_post_terms( $post->id, array('competition') ); $term_slugs = wp_list_pluck( $terms, 'slug' ); $args = array( 'post_type' => 'football_league', 'tax_query' => array( array( 'taxonomy' => 'competition', 'field' => 'slug', 'terms' => $term_slugs ) ), ); $fixture_query = null; $fixture_query = new wp_query($args); ?> <?php while ( $fixture_query->have_posts() ) : $fixture_query->the_post(); $champion_team = get_post_meta( get_the_id(), 'football_league_team_name', true ); echo $champion_team; $terms_session = get_the_terms( $post->id , 'session' ); ?> <?php foreach ...

c++ - Embedded extended python multiprocessing imports -

i have c/c++ application embedding python3 interpreter , extending "emb" module outlined here https://docs.python.org/3/extending/embedding.html . here rough example of c++ py_setpythonhome(ppath); py_setpath(path); pyimport_appendinittab("emb", &pyinit_emb); py_setprogramname(program); /* optional recommended */ py_initialize(); pysys_setargvex(argc, argv_copy, 0); pyobject *obj = py_buildvalue("s", "mypython.py"); file *file = _py_fopen_obj(obj, "r+"); if(file != null) { pyrun_simplefile(file, "mypython.py"); } py_finalize(); the python script (mypython.py) c++ app loads , works great: import emb print("number of arguments", emb.numargs()) i modified python script (mypython.py) test multiprocessing working , works great after setting executable. from multiprocessing import process, set_executable set_executable('c:\path\to\python3\python.exe') def worker(num): print('worker...

How to adjust size of grid in html using JQuery? -

i wish create simple grid in html. following code seems job done: $(document).ready(function() { var rows = 75; var columns = 25; var htmlstr = ""; htmlstr += "<table>" for (var c = 0; c < columns ; c++) { htmlstr += "<tr> " for (var r = 0; r < rows ; r++) { htmlstr += "<td bgcolor = '#ff0000'> " htmlstr += "<div class='square' id='p" + r + "-" + c + "'> </div>" htmlstr += "</td>" } htmlstr += "</tr>" } htmlstr += "</table>" $("#container").html(htmlstr) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!doctype html> <html lang ="en"> <head> <meta charset="utf-8"> <meta name ="viewport" content ...

django - Maximum Recursion Depth? How to prevent? -

i'm trying recurse list. but if have 1 task under task runs error maximum recursion depth? why? task_recurse.html {% if items %} <ul> {% task in items %} <li> {{ task.name }} {% items=task.subtask.all template_name="task_recurse.html" %} {% include template_name %} {% endwith %} </li> {% endfor %} </ul> {% endif %} task.html {% include "task_recurse.html" items=items %} task model class task(models.model): name = models.charfield(max_length=100) notes = models.textfield() created = models.datetimefield() created_by = models.foreignkey(user) subtask = models.manytomanyfield('self') it gives me error on view? problem? def tasks(request): items = task.objects.all() return render(request, 'tasks.html', {'items': items}) so 2 questions really: 1) why return maximum recursion depth when have 2 tasks 1 task subtas...

mysql - EntityFrameWork EDM Type not supported -

Image
im working mysql entity framework, vs 2013, mysql connector 6.9. when create complex types stored procedure return edm type not supported. how can fix it...

mysql - How to fetch two records from subquery -

i want fetch 2 records subquery gives error below u tried below works : select id, (select color tblcolor pid=id) color form maintable not works select id, (select color,price tblcolor pid=id) form maintable please me solution it from question, seems you're looking for: select t1.id, t2.color, t2.price maintable t1 inner join tblcolor t2 on t1.id = t2.pid

javascript - Why calling array.prototype.forEach.call() with an array set to THIS object not working -

here have number array. tried test if array.prototype.foreach can used on array in different way traditional way. in traditional way pass argument second parameter foreach . here used array.prototype.foreach.call() , used array argument call method. indication window object. why ? number=[1,2,3,4,5]; array.prototype.foreach.call(number,function(elem){ console.log(this); }); because assuming foreach has not been overwritten, , array still has normal prototype, this: array.prototype.foreach.call(number,function(elem){ }); is no different from: number.foreach(function(elem){ }); in foreach callback function, unless pass thisarg , function called normal callback. from mdn : if thisarg parameter provided foreach() , passed callback when invoked, use this value. otherwise, value undefined passed use this value. this value observable callback determined according the usual rules determining seen function . to set thisarg while using .call ...

multiplying each element of a list with each element of another list in lisp -

i want write function accepts 2 lists argument , return multiplication of them in list. this: (3 4) (3 5 6) => (9 15 18 12 20 24) this code i've came receive error telling me have few arguments map. (defun multip (lst lst2) ;this function flatten result (defun flatten (tree) (let ((result '())) (labels ((scan (item) (if (listp item) (map nil #'scan item) (push item result)))) (scan tree)) (nreverse result))) (flatten (map (lambda (i) (map (lambda (j) (* j)) lst )) lst2)) ) (write (multip '(3 4 6) '(3 2) )) i can not understand doing wrong. appreciate comment. you should use mapcar instead of map : (mapcar (lambda (i) (mapcar (lambda (j) (* j)) lst )) lst2)) these 2 different functions: mapcar maps function on 1 or more lists, , requires @ least 2 arguments, while map equivalent kind of sequences (e.g. vectors), , requires additio...

php - Facebook Messenger bot text formatting -

i have following message fb messenger bot replies users: $message_to_reply = "to travel info, reply in format\norigin*destination*travedate\nexample: city 1*city 2*$selected_date"; i trying add line breaks using \n looks not working. have tried chr(10) , '\n' , '<br>' and <center></center> , none of them working me. faced same issue , work around?

node.js - Don't want to receive an email on "from" email id if "to" email id is not reachable -

i sending email multiple email ids. using nodemailer since code in node.js. now working fine till email ids have sent email reachable. but if email id not reachable, receiving email on "from" email id subject. "delivery status notification (failure)". i don't want receive failure email on email id. possible receive on different email id or not receive on email id? the code follows: transporter.sendmail({ from: email id, : email id, subject : subject, text :text, replyto : reply email id } i have tried add reply email id still failure emails coming email id.

Go: Bessel functions -

i noticed there functions first-order, second-order, , n-order bessel functions (y0, y1, yn) defined in standard go library ( y0 ). can't seem determine practical application of these mathematical functions make them important include in standard library. can me out? seems bessels (which haven't heard of before) relate describing [graduated?] shapes of quadratic curves, i'm unsure why of special significance general development. i believe it's there because function of same name (except capitalisation) , behaviour in standard posix library . that's case many other functions in page link to, ldexp or lgamma or nextafter . speaking of uses of bessel functions, come in handy time time in mathematical simulations. tightly connected laplacian problems spherical symmetry, relates physical models of ideal circular drum, quantum mechanical model of hydrogen, or sidebands of fm radio signal (all heavily simplified in list). value of bessel function denomin...

java - how to change the values in the array list -

i doing assignment in school, have make restaurant table management system. have written following code having problem edit items. supposed edit items in array list. have make sure when re-run program changes still there. editmenu() in manager class , array list in meal class but have make sure when re-run program changes still there. use file or database. vanish when rerun program since in memory before.

What does this specific .cmd file do? -

i need cmd file following content: @echo off /f "tokens=1,4 delims= " %%a in ('dir e:\ /t:c^|findstr /i /l "v"') echo %%a %%b echo on pause i can't figure out does. can me? i know output, don't know why gives me output. here output. didn't want post @ first because windows german, sorry: datenträger in laufwerk e: ist volume volumeseriennummer: 1ab8-6911 verzeichnis von e:\ 22.09.2015 09:09 0 282ba90118a5f80716 06.10.2015 09:07 0 32f0961d6cc71b3c51bdc6 06.10.2015 09:07 0 4f1ab9edc5ed58c95f344fd2bc84a6ec 02.02.2016 10:56 <dir> ada200fdfcff43bdf47cf363ddf8 22.09.2015 09:08 <dir> besitzer 06.10.2015 09:07 0 bf5f62260169474da0ec9df993590745 06.10.2015 09:07 0 de9afd1afa67ed193d0adb16010b54 10.10.2016 20:29 <dir> importafter 01.12.2006 22:37 904.704 msdia80.dll 03.10.2016 15:27 ...

android - Calling methods on activity events -

i writing simple android library. have couple of methods executed when activity events happen - after activity got loaded or when activity gets paused. one way think of create class extends activity, , write methods there, , have "target" activities extend class. methods called but if end user extending other activity already, method won't work. there better alternative? if need provide support api 14 or higher, might able make use of application level activity lifecycle callbacks - see application.activitylifecyclecallbacks interface details. to make use of need register instance of interface application instance, using registeractivitylifecyclecallbacks method. 1 way have developer using library initialise library passing application instance it. in sdk maintain, , seems work nicely.

html - Achieving a certain grid using flexbox -

this question has answer here: managing justify-content: space-between on last row [duplicate] 1 answer i'm using flexbox create grid website. grid used articles archive, , should display 3 articles per row margin between each article. the problem is: need article boxes start @ beginning of row , end @ end of row. obvious thing use justify-content: space-between; , did. this, in addition flex-wrap: wrap created grid needed. until has odd number of articles. justify-content property left blank space @ middle of row, can see in following example: http://codepen.io/naxon/pen/nbnxvj it important me, no matter width of container is, items start @ beginning , end the end. how can achieve this? flexbox doesn't support inter-item padding can fake calc() , margin . codepen .container { width: 800px; height: 800px; background-color: b...

creating object in c++ using input file -

Image
i familiar java , c++ not strong spot.. i trying write algorithm cpu scheduler of code syntax error free stuck 1 problem. my program uses 2 classes process , processqueue my main looks this int main(){ fstream f; processqueue pq; f.open("input.txt"); if (!f) { cout << "file not found"; }else{ int noofprocess; f >> noofprocess; process *p; p = new process[noofprocess]; (int = 0;i<noofprocess;i++){ int arivaltime; int cputime; int proritynumber; f >> arrivaltime; f >> cputime; f >> proritynumber; p[i] = new process(arrivaltime,cputime,proritynumber); } return 0; } but p[i] causing trouble.. not able use parametric constructor,setters. it gives following error change p[i] = new process(arrivaltime,cputime,proritynumber); to p[i] = process(arrivaltime,cputime,proritynumber); as p[pi] ...

encryption - how to .net core RSA pem to xml? -

recently got project need run on .net core 1.1. realize rsacryptoserviceprovider not exsit on .net core rsa class. after search in stackoverflow few result below => how use rsa in .net core how read pem rsa private key .net c# export private/public rsa key rsacryptoserviceprovider pem string this above post cues me below link https://gist.github.com/brentmaxwell/46081df6fcbc0ca33fe1 and research bouncycastle pcl 1.8.1.1 too.i still can't solve it any 1 can below pem format convert xml format in .net core. -----begin private key----- miicdgibadanbgkqhkig9w0baqefaascamawggjcageaaogbaizaroud0esme7+v fefiw5acyrjjwt1mka5itwfhhsfbz8eriwftaysr95alwidhkeobui0lnkwnlqdp v0/x5xntjk03o/u+52424ppinzbog2ndswyeuawte2zipdgb9cowj/7tigjytlhx fxaax7l6fxkmp6oxk7sjk5ln5zalagmbaaecgybsatc5xxuc8xaab4kflfay7xse jmjsrpd6w3o4flrsjhece73xyx/tloqmesc0/x6tf2pczwuzcpkmufkkztgygm4q ku0qimu9rsbmnfrro0r0wev2sq2sshrzn9qtxbdv/6ze6jn1gzdcseasb0llttqm j2jh9zpm7trzk8qaoqjbalr+ekqxzxdme/td7l15lf...

c# - MVC Dynamic Controller -

i have mainview calling action return partial view such html.renderaction("getupperpanel","general"); within generalcontroller have function return different view depending on condition. each view in different controller. public actionresult getupperpanel() { return view("../accounttypes/accounttypesupper",new accounttypescontroller().getgriddata()); } this working currently, partial views trying display in view returned don't seem work. in account type view have following. @html.partial("uppergridpartial"); this errors saying view cannot found, looks mvc looking in generalcontroller views rather accounttypes located. i presuming because getupperpanel in general thinks controller, though returning view accounttypes controller. how should doing this?

Login to Realm Server on Android -

i'm pretty new android , jump straight it. question realm try login realm object server , throw out unknown error, following realm task in demo app , it's working fine moving own app, stuck @ login step. set debug @ authenticateresponse result in syncuser , after failed login. below code. public void login(string username, string password) { synccredentials mycredentials = synccredentials.usernamepassword(username, password, false); syncuser.loginasync(mycredentials, realmip, this); } i implemented onsuccess , onerror function. app on ios , mac works fine without trouble first time in android , don't know made mistake. have searched around seems there no answers. sorry if asked stupid question or answered question.

unix - How to escape single quote characters in bash command substitution -

i want generate sqoop command appended variable custom_params . have defined variable in file : hi.cfg the variable have single quotes 'orc'. cat hi.cfg custom_params="--query select * blah..blah \$conditions --split-by blah --create-hcatalog-table --hcatalog-external-table --hcatalog-storage-stanza stored 'orc' --compress --compression-codec 'snappy' --fields-terminated-by '|' -m 5 --target-dir /any/dir" when source file on command prompt , echo gives me whats written on there looks correct. source hi.cfg echo "$custom_params" --query select * blah..blah $conditions --split-by blah --create-hcatalog-table --hcatalog-external-table --hcatalog-storage-stanza stored 'orc' --compress --compression-codec 'snappy' --fields-terminated-by '|' -m 5 --target-dir /any/dir but when call shell script below : cat hi.sh echo "generating sqoop command" source $home/hi.cfg echo "${custom_p...

c++ - Cost of an algorithm -

the problem next: we want know size of vector, can't use size() have function inbounds(vector& arr,int index) returns true if index valid position of vector. so, approach iterate positions. starting @ 1 , duplicating (2,4,8,16,32...) until inbounds returns false, step , repeat search in subrange. let's example, put n = 21: 1 = true 2 = true 4 = true 8 = true 16 = true 32 = false step 16, , search in 16-32 range: (16+1) = true (16+2) = true (16+4) = true (16+8) = false step 20 (16+4) , start over: (20+1) = true (20+2) = false start on in 21: (21+1) = false ok, size 21. this implementation in code: #include <iostream> #include <vector> using namespace std; int inbounds(const vector<int>& arr,int i) { return < arr.size(); } int size(const vector<int>& arr) { int init = 0; while (inbounds(arr,init)) { int start = 2; while (inbounds(arr,init+start)) { ...

hibernate - Retrieve an object which has a POJO as a primary key with Spring JPA -

i have following classes: departmentmember , account, mapped onetoone relationship. this departmentmember class: @entity(name="departmentmember") @table(name="departmentmember") @embeddable public class departmentmember { @id @generatedvalue(strategy = generationtype.identity) private int id; @column(name="name", nullable=false) private string nume; @column(name="lastname", nullable=false) private string prenume; @onetoone(mappedby="departmentmember",cascade=cascadetype.all,fetch=fetchtype.lazy, optional=false) @jsonignore private account account; public departmentmember() {} public departmentmember(string nume, string prenume, string cnp, string email) { super(); this.nume = nume; this.prenume = prenume; } //getters , setters } and account class : @entity(name="users") @table(name="users") public class account { @id private...

appstore approval - Can I submit same app with different name on iOS App Store? -

i have developed 1 ios app have 10-13 clients whom selling app. so, app 1 , change name on apps , publish same account. allowed apple? source code same , name different on apps. app built sale copies client allowed? it possible, apple won't happy it, proposed way license apps clients instead of placing them on public app store. source: https://forums.developer.apple.com/thread/7825

python - How to interrupt a while loop, run a function and go back to the loop -

i'm beginning python , raspberry pi , trying make physical computing them. i began that: https://www.raspberrypi.org/learning/physical-computing-with-python/ , went well. than tried play around traffic lights (with success!): https://www.raspberrypi.org/learning/physical-computing-with-python/trafficlights/ here code: from gpiozero import button, trafficlights time import sleep lights = trafficlights(25, 8, 7) while true: lights.green.on() print("green") sleep(12) lights.green.off() lights.amber.on() print("amber") sleep(4) lights.red.on() lights.amber.off() print("red") sleep(12) lights.amber.on() print("red & amber") sleep(4) lights.red.off() lights.amber.off() than tried add button pedestrian crossing. here have problems. here code: from gpiozero import button, trafficlights time import sleep button = button(21) lights = trafficlights(25, 8, 7) def p...

ruby - Alternatives to convert a array to a hash using same keys and values -

i want convert: [:one, :two, :three] to: {one: :one, two: :two, three: three} so far i'm using this: hash[[:basic, :silver, :gold, :platinum].map { |e| [e, e] }] but know if it's possible other way? this use in rails enum definition in model, save values strings in db. i admit hangup: given choice, prefer constructing hashes scratch rather creating array , converting hash. [:one, :two, :three].each_with_object({}) { |e,h| h[e]=e } #=> {:one=>:one, :two=>:two, :three=>:three}

php - How to use exec() to display more than one value? -

i'm using php function exec() execute shell script. shell script return 3 echo : [.. script ..] echo $mp3 echo "$title" echo $img how can recover them separately use them ? for now, when print output, $img printed. thanks in advance ~quentin first of all, script doesn't return 3 values. instead, echo 3 variables. think 2 first not initialized.

javascript - Variable dependent rule in jQuery validation -

i have problem asynchronously validating login in html form using jquery validation plugin. want send request asking login validity on blur, , validate when recieving response. this code: var loginavailability = false; $().ready(function() { var gotresponse = false; $("#form").validate({ onkeyup:false, rules: { login: { required: true, loginavailable: gotresponse } }, messages: { login: { required: "please enter login.", loginavailable: "this login in use." } } }); $("#login").blur(function() { if($('#login').val()) { var value = $('#login').val(); $.ajax({ type: "get", url: "my server adress"+value, data: "", success:function(...

android - How do I add a fragment to a view when its context is Application? -

i need add fragment view dynamically it's inside fragment (see answer https://stackoverflow.com/a/6847770/811405 ). the whole structure this: fragment | |---viewholder | |---(dynamically added fragment) in viewholder, have access view. i've first thought call getcontext() , cast activity, use it's fragment manager add it. however, getcontext returns application object, not activity (it's called on app launch before app physically on screen, maybe activity hasn't been created yet). how can add fragment dynamically on viewholder? (of course, without using terrible anti-patterns) my real problem inflating layout incorrect context (yup, guessed right, application instance) instead of activity. i've fixed code make inflate activity, , getcontext returns activity. fragment manager , add fragment normally.

javascript - How to insert a variable inside a json url? -

i trying use defined var inside json url: var articlename = "test"; $.getjson( "https://www.googleapis.com/customsearch/v1?key=api_my&cx=cx_my&q='+articlename+'&searchtype=image&filetype=jpg&imgsize=xlarge&alt=json`", i tried: q='+articlename+' it's wrong just use " before , after + , &q='"+articlename+"'& another solution using data option 1: article name $.getjson("https://www.googleapis.com/customsearch/v1?key=api_my&cx=cx_my&searchtype=image&filetype=jpg&imgsize=xlarge&alt=json",{ "q":articlename }, option 2: param $.getjson("https://www.googleapis.com/customsearch/v1",{ "q" : articlename, "alt" : "json", "imgsize" : "xlarge", "filetype" : "jpg", "searchtype" : "image", ...

html - Browser mailto links open Outlook for Mac messages with body parameter contents below signature. How to fix? -

say have mac , using outlook 2016. you visit website has email address link: <a href="mailto:?body=hello world!">click me</a> when click link, outlook mac opens new mail message. body text "hello world!" appears in message. if have default signature defined, however, "hello world!" appended below the default signature when message opens. is there trick tell outlook mac put contents of body parameter? thanks

java - Spring doesn't instantiate bean at start -

i'm stuck following problem. application doesn't create services @ startup , end nullpointerexception when try use them in maven tests after inject them @autowired . i don't understand comes from. have done research still don't understand why doesn't work. here class autowired administrationactionservice null: public class administrationactiontests extends entitytests { @autowired administrationactionservice administrationactionservice; @test public void equalstests() { administrationactionservice.getexample(); [...] the class : package com.bloombooking.services; @org.springframework.stereotype.service public class administrationactionservice extends serviceentity{ @autowired private administrationactiondao administrationactiondao; [...] and applicationcontext.xml . i've placed in src/applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="ht...

mysql - Autoreconnect class for database in php -

i developing class database access , query. if database accessible working correctly, problem comes when somehow database restarted. below code library , users code. able reconnect database, unable select database. have tried 2,5 retry attempts select_from_db function. throwing error unable select database test mysql server has gone away . using windows machine , in sleep time executing below command restarting mysql. net stop wampmysqld net start wampmysqld please let me know suggestion , answers, can improve on it. <?php class database { private $host; private $user; private $pswd; private $name; private $db_handle; private $error_msg; function __construct($db_host, $db_user, $db_pswd, $db_name=null){ $this->host = $db_host; $this->user = $db_user; $this->pswd = $db_pswd; $this->name = $db_name; $this->db_handle = null; $t...

html - How to use bootstrap to fill white spaces -

Image
i want design div has input box , other elements. want use bootstrap give dynamic size input box change width changing window width , in mobile devices show in 2 line. like this: this example code without class: <form> <div> <input type="submit" value="search"> <select> <option>value1</option> <option>value2</option> <option>value3</option> </select> text </div> <div> <input type="text" placeholder="search text input"> </div> i implemented first image in post , below in code. try running it, dont forget expand snippet <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <scrip...