Posts

Showing posts from January, 2014

Implement LDAP in ASP.net (C#) MVC4 -

i got working on asp.net application (non mvc) have change on mvc not know how adapt old code. reference, using stock website application (needed quick , dirty) , sewing in zurb's foundation framework. c# based. here old way worked: login.aspx <form id="login" method="post" runat="server"> <fieldset> <legend>please login</legend> <asp:label id="errorlabel" runat="server" forecolor=#ff3300></asp:label><br> <div class="row"> <div class="large-12 columns"> <label>domain:</label> <asp:textbox id="txtdomain" runat="server" placeholder="human check: please type workgroup"></asp:textbox> </div> </div> <div class="row&qu

python - ZeroRpc: TypeError ord() expected string of length 1 -

i trying run example website, server: import zerorpc class hellorpc(object): def hello(self, name): return "hello, %s" % name s = zerorpc.server(hellorpc()) s.bind("tcp://0.0.0.0:4242") s.run() and client: import zerorpc c = zerorpc.client() c.connect("tcp://127.0.0.1:4242") print c.hello("rpc") however it's not working should, getting error message: typeerror: ord() expected string of length 1, memoryview found i running on windows anaconda (python 2.7.11) have zerorpc installed via pip , , zeromq installed via installer website. how can fix ?

Access VBA connection to test existence of SQL Server -

i have access application needs connect 1 of several possible sql servers (i.e., connect linked tables) , have list of possible sql server instance names. when application launches, needs go see of possible servers available. considering sluggishness of solutions using sqlbrowseconnect or netserverenum, i'm wondering if there clean , fast way 'ping' sql server based on name. we use pass-through query, verifyconnection, opens small table. the test alters connection , checks if can read table: public function issqlserver( _ byval testnewconnection boolean, _ optional byval hostname string, _ optional byval database string, _ optional byval username string, _ optional byval password string, _ optional byref errnumber long) _ boolean const cstrquery string = "verifyconnection" dim dbs dao.database dim qdp dao.querydef dim rst dao.recordset dim booconnected

r - Splitting a string using variable offset -

i want substrings of size n , and offset o string. for example, given "abcdef" , substrings of size = 3, offset = 1. want obtain set "abc","bcd", "cde", "def" . in mathematica, can done partition or stringpartition . is there similar function in r? you can write wrapper (thanks @thelatemail): subs = function(x, size, offset){ nc = nchar(x) first = seq(1, nc-size+1l, by=offset) last = first + size -1l substring(x, first, last) } subs("abcde",3, 1) [1] "abc" "bcd" "cde"

java - Finding a single path from any node on a graph to a specific node -

some more background on question. line 1 a, goes b. line 2 goes c. line 1 b, goes a. line 2 b goes c. line 1 c, goes b. line 2 c goes a. suppose lost @ 1 of stations a, b, or c. independent of are, if take line 2, , line 1, end @ station b. having path takes same place called meeting path. interested in finding meeting path consists of fixed set of instructions like, 'take line 1, line 2,' etc. possible might visit station multiple times. possible such path might not exist. i thinking of using depth first search on graph find each node. because can repeat nodes not sure when should stop search , there no path. is there better way finding paths in cyclical directed graph dfs? once have given path test current implementation. public static int calculate(int[][] n, list<integer> list){ boolean flag = false; int list_counter = 0; mapeven.clear(); mapodd.clear(); for(int = 0; i<n.length;i++){ int item = list.get(0); mapo

keyboard shortcuts - How to move the cursor to the end of the tag in Sublime Text 2? -

when type start of tag, sublime text auto-complete end of tag , position cursor inside tag. <code>|</code> i use | represent cursor. when finished contents inside tag, want move cursor end of tag this: <code>blabla</code>| to this, have press right button move cursor character character, not efficient. there shortcut move cursor end of tag directly? you create macro. may valuable if tags cover multiple lines. save following move_to_end_tag.sublime-macro in packages/user . [ { "args": { "to": "tag" }, "command": "expand_selection" }, { "args": { "by": "characters", "forward": true }, "command": "move" } ] you can create keybinding action. { "keys": ["ctrl+shift+alt+right"], "com

asp.net - Windows Azure SDK not found by Visual Studio 2012 -

following windows azure tutorial deploying asp.net mvc app. http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/ also note: following version of question images. http://imgur.com/z99gtue . think images make question clearer. however, not have more 10 reputation points, unable add more 2 links or display images. how visual studio 2012 find windows azure sdk installed? similar question asked on stackoverflow (titled unable-to-create-windows-azure-project-in-visual-studio-2012), suggested solution total reinstallation of visual studio. there faster , less invasive solution? or on other hand, why vs 2012 , windows azure screw installation (this not first time i've been prompted reinstall everything)? i following windows azure tutorial deploying asp.net mvc app. in "set development environment" section, tutorial prompts user install windows azure sdk. installed windows azure sdk. continuing tutorial, in step 7a of tutorial, instru

operator overloading - Fortran: Accessing values from the return type of a function -

i have created derived type v, , included add function can use operator +. however when z = u + v the operation not performed. think because z%kn not being accessed. however when call vsum(z, u, v) everything works expected below declaration of derived type , overloading function vadd. module vtest type :: v character (len=8) :: kn real, allocatable :: vc(:) contains procedure :: vadd generic :: operator (+) => vadd end type vtest contains function vadd (b, c) result (a) type (v) :: class (v), intent (in) :: b, c !!$ in vsum, use made of a% kn call vsum (a, b, c) end function vadd subroutine vsum (ta, tb, tc) type (v), intent (inout) :: ta type (v), intent (in) :: tb, tc logical :: la, lb, lc la = .false.; lb = .false.; lc = .false. select case (ta%kn) case ("real32") if (allocated (ta%vc)) la = .true. if (allocated (tb%vc)) lb = .true. if (allocated (tc%vc)) lc = .true.

linux - Cpanel send delivered mail back to the mail queue to be delivered to the specific email address again -

open other options.. for specific user(home/user/mail/domain.com/username) need resend mail have been delivered. (also mail cur, tmp, new) also target mail specific past date now. exim mail queue empty. no, not possible forward mails delivered mailbox.

javascript - Adding Action Listener Sets the Last Value Alone -

i trying add action listener several divs created dynamically. have use loop add action listener them. this code: for (var = 0; < mapdata.length; i++) { var marker = new google.maps.marker({ position: new google.maps.latlng(mapdata[i].lat, mapdata[i].long), icon: circlemaker, map: map }); var temp = mapdata[i].id; var temp_marker = marker; document.getelementbyid('sensor_'+temp).addeventlistener('mouseover', function() { //temp_marker.seticon(circlemakerhi); console.log("sensor: "+temp); }, false); } } this loops prints last value of loop. if sensor_2 div hovered, should print sensor: 2 prints sensor: 7 7 mapdata.length.

html - Created horizontal list of image links that expand onhover. Lines appearing next to images onhover, why? -

live page , css source , page source if hover on twitter icon, should see dark blue line appears right of icon disappears when move mouse off. happens icons except "donate" icon. suspect because icon blocks view of line, though guess mine. can tell me why mysterious line popping up? don't know how got there because using editor live page updates , assumed glitch. thank you! this should work you a { text-decoration: none; } by default text-decoration underline anchor tags.

php - Code setting item price to 0 -

alright, these 2 functions refuse work reason , cannot figure out why. work fine if used outside of active database (i'ved tested , testing right now) reason second they're getting information database, 0 out price that's supposed updated; eg price should go say, 20 dollars 4, goes 0 , next time updates goes next number in line. private function updateprice($iid, $price, $purchased) { if($price >= 0) { $price = abs($price); } else { $price = $this->getitemstats($iid); $price = abs($price['base']); } $sql = "update store set item_price = :price, available = available-:purchased iid = :iid"; $que = $this->db->prepare($sql); $que->bindparam('price', $price); $que->bindparam('iid', $iid); $que->bindparam('purchased', $purchased); try{$que->execute(); if($que) { return true; } else { echo "fuck"; exit;

swift - UISearchResultsUpdating and MPMediaItem -

i'm having problems when searching mpmediaitems. code below present view , filter results. not clear results when search cancelled (subsequent searches add criteria filtered data), change results while removing text (backspacing), or scroll beyond cells presented on screen. how correct mentioned missing behavior? i've tried various things, including setting filteredtabledata , pred nil, i'm missing major here. appreciated. in advance... class songsviewcontroller: uiviewcontroller, uisearchresultsupdating { @iboutlet var songstableview: uitableview! var tabledata = mpmediaquery.songsquery() var song : mpmediaitem? var tabledatatofilter = mpmediaquery.songsquery() var filteredtabledata : mpmediaitemcollection? var resultsearchcontroller : uisearchcontroller! var pred : mpmediapropertypredicate? override func viewdidload() { super.viewdidload() let nib = uinib(nibname: "songcell", bundle: nil) songstableview.registernib(nib, forcellreusei

overloading - How can I overload find function in Matlab -

can overload find function in matlab? as know: ind = find(x) locates allnonzero elements of array x, , returns linear indices ofthose elements in vector ind. but when x array of object, how can use find function findout elements based on these properties ? as lucius domitius ahenobarbus noted in link gave, there strict rules of when can overload functions in matlab. take following class: classdef myclass methods function find(self) fprintf('find(myclass) has been called.\n'); end end end and execute x = [myclass myclass myclass] find(x) this gives following output: x = 1x3 myclass no properties. methods find(myclass) has been called. what in overloaded find function you. write function prints out indices of elements match call "these properties", whatever is.

c# - how to order a list by Property Value using Linq -

i need order items defined in list called preferences. list<string> preferences = new list<string> { "first","second","third" }; ienumerable<mylist> ordereddata = mylist.orderby(item => preferences.indexof(item)); ordereddata output should be first second third... //remaining property values comes here please give suggestion. look index if available in preference list else use int.maxvalue keep @ end. list<string> preferences = new list<string> { "first","second","third" }; ienumerable<mylist> ordereddata = mylist.orderby(item => { var index = preferences.indexof(item); // use property if item object. return index>=0 ? index: int.maxvalue; }); check example

javascript - Prevent duplicate comma from being typed into Input Text Box -

i'm using textbox collect numbers only, separated comma. no other characters, not spaces, allowed. 0-9 , comma. the following function serves purpose, i'd prevent duplicate comma being entered. correct e.g. 22,444,2,444 incorrect e.g. 22,,444,2,444 or 22,,444,,2,,444 here code i'm using limiting field numbers, , allowing comma: $(document).ready(function(){ $("#customprices").keypress(function (e) { if (e.which != 8 && e.which != 0 && string.fromcharcode(e.which) != ',' && (e.which < 48 || e.which > 57)) { //display error message if($( "#errmsg" ).is(':hidden')) { $( "#errmsg" ).fadein(); } return false; } }); }); i've found may able work @ following link: javascript - prevent duplicate characters in textbox the example there needs prevent hyphen, charcode 45. comma charcode 44.... but i'm not sure of how implement current code... any loved, thank you! in

ios - How to add cell which is long pressed to indexpathforSelectedRow? -

i want add cell longpressed indexpathforselectedrow.. when longpress cell, hope added automatically in indexpathforselectedrow... how can it? this code long press function: func longpress(longpressgesturerecognizer: uilongpressgesturerecognizer) { if longpressgesturerecognizer.state == uigesturerecognizerstate.ended { let touchpoint = longpressgesturerecognizer.locationinview(self.view) if let indexpath = tableview.indexpathforrowatpoint(touchpoint) { let celltodeselect:uitableviewcell = tableview.cellforrowatindexpath(indexpath)! //then how? } } } simply use: if let indexpath = tableview.indexpathforrowatpoint(touchpoint) { tableview.selectrowatindexpath(indexpath, animated: false, scrollposition: .none) }

solr - Run SolrCloud on different machine -

i trying configure solrcloud on more 1 server/machine 1 server fail replica can serve request. i can run solrcloud on single machine 2 node on different port address. refering link but how can run on different machine. configuration need achieve this? any appreciated. you provide solr address zookeeper ensemble you'll using distribute workload. it's highly recommended run zookeeper instead of using 1 bundled solr. in last example in link you've provided, can see -z parameter provides connection list of zookeeper instances available. solr uses zookeeper keep cluster state , available servers synced across instances.

scala - spray-json can't find JsonReader for type List[T] -

i'm creating custom json readers case classes can't find implicit jsonreader type class list[t] used in other case class. when checked defaultjsonprotocol, has implicit format collections already; implicit def listformat[t :jsonformat] = new rootjsonformat[list[t]] { def write(list: list[t]) = jsarray(list.map(_.tojson).tovector) def read(value: jsvalue): list[t] = value match { case jsarray(elements) => elements.map(_.convertto[t])(collection.breakout) case x => deserializationerror("expected list jsarray, got " + x) } } here simplified code; case class test(i: int, d: double) case class listoftest(t: list[test]) trait testresultformat extends defaultjsonprotocol { import customformat._ implicit object testjsonformat extends rootjsonreader[test] { override def read(json: jsvalue): test = { val jsobject = json.asjsobject val jsfields = jsobject.fields val = jsfields.get("i").map(

Needs a helping hand setting up a kik bot with python -

need setting bot. i'm newbie in not familiar alot python perl , php. a. created bot thru kik b. ran pip install kik on server c. created test code requests.post( 'https://api.kik.com/v1/config', auth=('', ''), headers={ 'content-type': 'application/json' }, data=json.dumps({ "webhook": "https://example.com/incoming", "features": { "manuallysendreadreceipts": false, "receivereadreceipts": false, "receivedeliveryreceipts": false, "receiveistyping": false } }) ) i filled in username, api key , created web hook test script in perl prints hello world. work above code? how run on server. have continually running , if how. on server ru

git - postgre version per rails branch -

is possible use specific snapshot of database, per each branch (git) have? reason is, table definition change because of need per each branch i'm working on. the web framework i'm using rails 4 way. postgresql 9.5.2. yes possible have database per branch. can find more information here rails database per branch or git rails database branch hook

How to get visible text as a string on a textView in iOS? -

Image
i have uitextview . on textview have text. when resize ( decreasing height of textview ) textview 2 line text visible. so how can visible text string. means how can split visible text main text string. below images reference. i need consectetaur cillium adipisicing pecu, sed eiusmod tempor incididunt ut labore et text string main string. how can ? yes got :) :) in objective c - (void)viewdidload { [super viewdidload]; [self getvisibletext]; // additional setup after loading view, typically nib. } - (void)scrollviewdidscroll:(uiscrollview *)scrollview { [self getvisibletext]; } - (void)getvisibletext { nsrange range = [self visiblerangeoftextview:self.textview]; nsstring *visibletext = [self.textview.text substringwithrange:range]; nslog(@"visibletext == %@",visibletext); } - (nsrange)visiblerangeoftextview:(uitextview *)textview { cgrect bounds = textview.bounds; uitextposition *start = [textview charact

html - Using two animations on one element, CSS -

i have 2 animations: on element load , hover: div { animation: slide-up 2s; -webkit-animation: slide-up 2s; -moz-animation: slide-up 2s; } div:hover{ animation: rotate 2s; -webkit-animation: rotate 2s; -moz-animation: rotate 2s; } the slide-up animation runs once element loaded, , rotate runs when element hovered. however, element slides on mouse leave , don't know how prevent this. i'd turn off slide-up animation on hover. the rotate animation uses transform property, , slide-up changes margins . reason: the slide-up animation executes once again when move mouse out of element because of following reasons: on load, element has 1 animation (which slide-up ). browser executes this. on hover, animation property again specifies 1 animation (which rotate ). makes browser remove slide-up animation element. removing animation makes browser forget execution state or execution count of it. on hover out, default div selector becom

How do I make a directive with a property in Angular 2? -

i don't understand how make component property. can see what's matter? i keep getting error: "can't bind 'val' since isn't known native property" // app.html there should list of fruit here line after each 1 <ul> <template ngfor let-fruit [ngforof]="fruits"> <li>{{fruit}}</li> <part [val]="5"></part> </template> </ul> and part.component.ts import { component } '@angular/core'; @component({ selector: 'part', templateurl: 'app/part.html' }) export class partcomponent { // meaningless now. want thing // take parameter val: number; } plunk if may allowed suggest, plunk provided angular team demonstrates common features of technology (like these in plunk form , more basic) way more useful me the documentation . if know of such thing, i'd grateful referral. you need declare child directives in main component.

Android: Server disconnects app after device sleeps. But Java socket never detects disconnection when device wakes up -

in android app have written service connects server. calling java socket .getoutputstream().write , .getinputstream().read write requests , read responses , server. plain , simple that. everything works fine until device sleeps. when device sleeps, server disconnects app connection. when device wakes up, app service starts running. never detects disconnected connection. .getinputstream().read keeps waiting responses forever , .getoutputstream().write writes requests socket successfuly. weird. thus java, socket normal though disconnected server. , there no way detect same. ideally, .getinputstream().read should return -1 after device wakes , service starts running. doesn't happen. neither .getoutputstream().write throws ioexception . , user has way stop application forcefully through app settings, not @ acceptable app perspective. what tried? i have gone through relevant question this , this , this answers there suggests write or read socket check if still

Android TelephonyManager doesn't work with android studio simulator? -

i using simple code retreive phone device data, reason time open app on emulator, pops message saying "unfortunately *app name* has closed" , shuts down app. this code using: telephonymanager tm=(telephonymanager)getsystemservice(context.telephony_service); string imeinumber=tm.getdeviceid(); i wrote code test telephonymanager methods nothing works except for: "getphonetype();" any ideas what's problem? maybe because runing on android studio emulator? the problem says: getdeviceid: neither user 10058 nor current process has android.permission.read_phone_state though added permission in manifest: <uses-permission android:name="android.permission.read_phone_state" /> (above application part) thank help are running android m ? if , because it's not enough declare permissions in manifest . permissions , have explicitly ask user in run-time : check link run time permission . code snippet. define globally

javascript - How can I make a linear swept face using three.js? -

how can make linear swept face? i wrote following code. // profile var pts = [ new three.vector2(0, 0), new three.vector2(10, 0), new three.vector2(10, 10), new three.vector2(20, 10), new three.vector2(20, 20), ]; var profile = new three.shape(pts); // path var path = new three.linecurve3(new three.vector3(0, 0, 0), new three.vector3(30, 0, 30)); var geometry = new three.extrudegeometry(profile , { steps: 1, bevelenabled: false, extrudepath: path }); var material = new three.meshlambertmaterial({ color: 0xff8000, wireframe: false }); var mesh = new three.mesh(geometry, material); scene.add(mesh); and got result http://i.imgur.com/7ydpmk7.jpg but not needing. hope http://i.imgur.com/shuj6jn.jpg what wrong? there three.extrudegeometry this. there several examples on the three.js examples page : http://threejs.org/examples/#webgl_geometry_extrude_shapes

python - How to implement interface for submatrix like m[1:3, 0:2] += 1? -

i asked question still can't figure out how implement this. i have matrix class: class matrix(list): def __getitem__(self, item): try: return list.__getitem__(self, item) except typeerror: rows, cols = item return [row[cols] row in self[rows]] it allows things this: m = matrix([[i+j j in [0,1,2,3]] in [0,4,8,12]]) print(m[0:2, 0:2]) print: [[0, 1], [4, 5]] i want able add/multiply submatrix elements given value, like: m[0:2, 0:2] += 1 print(m[0:2, 0:2]) should print: [[1, 2], [5, 6]] i'm trying implement methods: __add__ , __setitem__ def __setitem__(self, key, value): print(key, value) def __add__(self, item): print(item) in range(self): j in range(self[0]): self[i][j] += item at least want see print something. doesn't happen. i'm trying such example: m[1:2, 2:3] = m[1:2, 2:3] + 1 and error like: typeerror: can concatenate list (not "int") list

How to search an element in array using node.js in mongodb? -

Image
in mongodb there document below, { "_id": objectid("57443657ee5b5ccc30c4e6f8"), "name": "kevin", "email": "kevinwarn@gmail.com", "password": "$2a$13$iz0phuy6vlbf6qc9ruredrg39fw5pekkih.vcligslpzmkyveyzey", "mobile": "9980896745", "__v": numberint(0), "ocassiontypes": [ { "occasiontype": "anniversary", "date": "2016-05-30t18:30:00.000z" }, { "occasiontype": "donation", "date": "2016-07-24t18:30:00.000z" }, { "occasiontype": "house warming", "date": "2016-09-21t18:30:00.000z" } ] } so have written query in nodejs search occasiontype element in ocassiontypes array below, router.post('/find-registry', function(req, res){ var uemail = r

javascript - Add images to a table one by one -

can please advise how can load images array (called preloadarray) table cells 1 one. table 13 x 4 cells. function meant increment image id , call add them short settimeout() delay process & make animated. appreciated. thanks. function showcard(){ //when button clicked document.writeln("<table>"); (m = 0; m < 4; m++) { document.writeln("<tr>"); (n = 0; n < 13; n++) { preloadimages[n] = new image(); preloadimages[n].src = n + '.gif'; document.writeln("<td id=\"\"><img height=\"80\" id=\"" + preloadimages[(m * 13) + n] + "\" \"></td>"); } document.writeln("</tr>"); } document.writeln("</table>"); } you don't need preload images in array if directly specifying src.. here code you <!doctype html> <html> <head> <title></titl

android - grid data change dynamically inside Fragment inside Sliding tab on click -

Image
i have sliding tab layout have 3 tabs , navigation drawer. each tab fragment. want use 1 fragment cardview in grid manner. problem when click navigation drawer item tab fragment grid data not changing. here link of code structure. https://github.com/rrrongon/navigationdrawerwithtab use event bus achieve this. when click on menu item fire event , listen event respective fragment , on listen respective work

rest - Spring Boot does not create the Restful WS when we give @RequestBody or @RequestHeader as a method parameter -

in our project have interface , implementing class in interface provide method signature annotated @requestmapping annotation. class implementing interface annotated @restcontroller , @requestmapping annotations , overriding methods in interface. issue: in of methods, when give @requestbody or @requestheader parameter, spring boot not creating /v1/myapi/load url given in @requestmapping in interface. if give empty parameters creating url. further digging in, figured out if remove @requestmapping annotations interface methods , provide in methods in controller class working irrespective of giving in method parameter. i want know why @requestmapping provided in interface not considered when use @requestbody or @requestheader method parameter. @controller @requestmapping("/v1/myapi/") public class mycontrollerclass implements myinterface{ @override public responseobject method1(@requestbody string request, @requestheader(name= httpheaders.authorization) string toke

vhdl - Compile Date and Time in FPGA -

Image
can uses in vhdl similar c-sourcecode-macros __date__ , __time__ make compile time available in fpga kind of version time stamp? as >>>new-comer<<< vhdl want modify following existing code, puts hard coded date fpga register. have remember adjusting values before compiling. easier if done automatically. can include hours/minutes/seconds? library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity datum2 port ( day :out std_logic_vector(4 downto 0); month :out std_logic_vector(3 downto 0); year :out std_logic_vector(4 downto 0) ); end datum2 ; architecture rtl of datum2 begin -- "08.08.0013" day <= conv_std_logic_vector(8, 5); month <= conv_std_logic_vector(8, 4); year <= conv_std_logic_vector(13, 5); end architecture rtl; current date , time not directly available in vhdl, solution suggested below. edited 2013-08-10 : added description

ruby - Rails gem administrate custom values in fields -

i using administrate gem , other day collided problem.how can in dashboard? resource.owner.first_name or how can put in field custom value using resourse variable? in moment tried code , working search broken approach: %td= resource.owner.email

couple of singletons in one swift 2 application -

i wrote 2 classes in app need perform data classes . 1 user details , 1 products. both of classes same code different names , variables. products class works ok user class don't make sharedinstance me. json data ok , can print it. here code: import uikit import alamofire import swiftyjson class userdetailsdataclass { let defaults = nsuserdefaults.standarduserdefaults() var user: [swiftyjson.json] = [] init() { let baseurlstring = "http://example.com/ios/login.php?" let parameters = [string:string]() let urlsignup = baseurlstring + "id=" + defaults.stringforkey("userid")! + "&macnumber=" + defaults.stringforkey("currentuuid")! //encode url solve spaces issues let urlwithpercentescapes = urlsignup.stringbyaddingpercentencodingwithallowedcharacters( nscharacterset.urlqueryallowedcharacterset())! print(urlwithpercentescapes) alamofire.request(.get, ur

c# - wpf animation -- mouse down event doesn't work -

there blue rectangle moving left side of window right different distance every time. either clicking rectangle or animation completed, rectangle start moving again left side. if rectangle clicked, color of turn green duration of 0.3s. but mousedown event seemed not start coloranimation , moving distance/duration of rectangle not correct neither. private int i; private storyboard hittargetstoryboard; private list<double> dislist; private void window_loaded(object sender, routedeventargs e) { dislist = new list<double>{.......}; // init list of values. /* create rectangle */ rectangle rect = new rectangle(); this.registername("rect", rect); rect.height = this.actualheight; rect.width = 50; canvas.settop(rect, 0); canvas.setleft(rect, 0); /* fill rect solid brush */ solidcolorbrush targetrectbrush = new solidcolorbrush(colors.blue); this.registername("targetrectbrush", targetrectbrush); rect.fi

java - How to pass REST API data into a specific database in mongodb while now everything goes to test by default? -

i using spring boot implement rest api connected mongodb. however, data updates passed default database called test. have done these: i have opened mongodb server , client, , changed connected database on client side using cmd $mongo mydatabase postman used test spring boot, things go there, updates go test instead of mydatabase i cannot find bean file, in suppose configuration changes should made? thank much! as can understand need specify different database name. can done using common application properties. refer http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html add spring.data.mongodb.database=test # database name in application.properties file

java - How to load the value of attributes from property files into INSTANCES OF classes -

i have software should read properties file @ each start , construct classes those: name = john surname = smith the class person have then public class person{ private final string name; private final string surname; } is there magic method or class don't know let me like: loadedpersonproperties.createclass(person) ? english not first language , cannot understand if looking wrong words or have such constructor myself. thank you. edit:added instances of, .java file generation not necessary

equivalent of Excel Goal Seek function in Python or MYSQL -

how implement excel goal seek function python or mysql? this scenario : in agency work buy items , sell online store, online store apply 3 different fees , calculated on final price. agency wants earn fixed amount of money on final price, need calculate final price fees , amount want earn. i know amount money want earn , initial price, , fees in % , don't know @ price need sell items earn specific amount of money. with excel use goal seek function calculate final price fees , fixed amount agency want earn, python or mysql. ex : a1 = 270.0$ # price buy item c2 = 3.50$ # shipping price c3 = 0.10 # fee of store in percentage (10%) c4 = 0.03 # fee credit card (0.3%) c5 = 0.35$ # fixed fee store 0.35$ d1 = 5$ # amount want earn when sell item x = ? # final price need sell item earn d1 thanks help in python following. note formumla may need adjusting a1 = 270.00 # price buy item in $ c2 = 3.50 # shipping price in $ c3 = 0.10 # fee of store in percentage

express - Auth0 LoopbackJS API access token using 3rd party login -

i have loopbackjs api hosted on domain (e.g. http://backend.com ), third party authentication setup via auth0. have front-end hosted spa on domain (e.g. http://frontend.com ) loopback-component-passport seems work fine when front-end on same domain api, , sets userid , access_token cookies accordingly. however, front-end in production on different domain api, example api auth link like: "http://backend.com/auth/auth0?returnto=" + encodeuricomponent("http://frontend.com") the backend has used same auth pattern in loopback-passport-example , providers.json file specifies connection details auth0 (although have tried other social providers such facebook). "auth0-login": { "provider": "auth0", "module": "passport-auth0", "clientid": "auth0_client_id", "clientsecret": "auth0_client_secret", "callbackurl": "/auth/auth0/callback"

embedded - u-boot mmc read_block limitiations -

i trying copy file mmc/sd card in global variable (struct) of u-boot spl, in ocram. far trying use mmc->block_dev.block_read(0, file_sector, 4, &my_struct); since copying dram (ddr3/ddr4) works (if replace &my_struct address in ram, call succeed , can correctly read file ram), file located @ beginning of sector file_sector . however, code, get: error: v7_dcache_inval_range - start address not aligned - 0x100082f4 error: v7_dcache_inval_range - start address not aligned - 0x10008af4 are there requirements/limitations should aware off on location of destination of block_read ? so, part of answer says right there in error message. 'mystruct' is, not cache aligned flushing isn't valid. should use alloc_cache_align_buffer macro , @lps mentioned, copying character buffer.