Posts

Showing posts from August, 2012

java - Proximity of polylines in time -

given 2 paths in 2d, each described polyline (sequence of points each 2 consecutive points connected straight line), find parts of paths closer given distance d; i.e. areas of proximity within bound d. is there java/scala api provides functionality? if not, ideas efficient algorithm job? assuming points of polylines close 1 (compared size of lines), can try play extremal points . determine these points of lines , build simplified versions of them. determine extremal points of 2 lines closer given distance. explore points of real polylines lie near found close extremal points - determine exact pieces of polylines close.

amazon web services - Upload file to S3 from Android using upload policy -

i have api returns s3 upload policy use in web forms ( link s3 documentation) now have develop native android app same upload functionality using policy api gives me. how can using android aws sdk ? i can't seem find resources this. way see have webview , create form upload experience. (i total android newbie) for authenticating aws using android sdk, best bet checkout amazon cognito identity, lets vend temporary limited privilege credentials app. (because hard coding credentials in android application unsafe). can use identity access management (iam) roles restrict credentials can do. some initial resources checkout getting started s3 android using cognito auth ( http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/s3transfermanager.html ) concept on iam roles cognito identity ( http://docs.aws.amazon.com/cognito/devguide/identity/concepts/iam-roles/ ) understanding acl vs iam vs bucket policies in s3 ( http://blogs.aws.amazon.com/security/pos...

swift - Self as argument type of generic callback -

i'm trying implement generic broadcasting function each type supports specific protocol. example: protocol proto { typealias itemtype typealias callback = (self, itemtype) func register(tag: string, cb: callback) func unregister(tag: string) } class foo : proto { typealias itemtype = int func register(tag: string, cb: (foo, int)) { } func unregister(tag: string) { } } func bc <t: proto> (p: t, value: t.itemtype, os: [string: t.callback]) { (k, v) in os { v(p, value) // error: cannot invoke v argument list of... } } question how implement bc function right? i think swift buggy @ place. maybe can use protocol proto { typealias itemtype func register(tag: string, cb: (self, self.itemtype)->()) func unregister(tag: string, cb: (self, self.itemtype)->()) } class foo : proto { func register(tag: string, cb: (foo, int)->()) { } func unregister(tag: string, cb: (foo, in...

javascript - Login in asp.net using rest api and angularjs -

i have created login page in asp.net using angularjs , rest api, don't know how created? how perform login operation in asp.net using angularjs , rest api auto-generate token. design form below <div class="form-box" id="login-box"> <div class="header">sign in</div> <form> <div class="body bg-gray"> <div class="form-group"> <input type="text" name="userid" ng-model="login.user_user" class="form-control" placeholder="user id"/> </div> <div class="form-group"> <input type="password" name="password" ng-model="login.user_pass" class="form-control" placeholder="password"/> </div> <div clas...

c++ - Fastest way to copy some rows from one matrix to another in OpenCV -

i have [32678 x 10] matrix ( w2c ) , want copy 24700 rows of matrix( out ). have index of rows copied in vector( index ). doing in matlab do: out = w2c(index_im,:); it takes approximately 0.002622 seconds. in opencv: mat out(index.cols, w2c.cols, w2c.type()); (int = 0; < index.cols; ++i) { w2c.row(index.at<int>(i) - 1).copyto(out.row(i)); } it takes approximately 0.015121 seconds. as can see matlab 6 times faster. how can make opencv code efficient? i using cmake-2.9, g++-4.8, opencv-2.4.9, ubuntu 14.04 update : i ran code in release mode, here result ( still slower matlab ) release debug matlab 0.008183 0.010070 0.001604 0.009630 0.010050 0.001679 0.009120 0.009890 0.001566 0.007534 0.009567 0.001635 0.007886 0.009886 0.001840 based on our discussion in chat not compiling optimization enabled. if this, see notable performance increase. also, make sure linking against release build of opencv. i...

Android Incorrect value when converting String to StringEntity -

i sending string server using httppost. string jsonobject thath have converted string far working properly... must sent content-type "application / json". to send it, convert string stringentity , add httppost.setentity (my_string) ... problem server tells me not recognize data (is ready receive jsonobject converted string) in code, use log know value of string before converting stringentity, , result: string: {"gender":"male","user":"pedro","email":"ejemplo@ejemplo.com","language":"english"} however, when convert string stringentity, result of log, instead of being same, follows: string: org.apache.http.entity.stringentity@16a4bc74 why? i not know i'm doing wrong ... i searched , found many examples, think i'm doing correctly ... not understand error. why string, when converted stringentity not maintained values? i have tried many examples, such http://hmkcode.com/an...

linux kernel - On-screen display driver -

i need write linux kernel module display message box on other windows on screen. , need drawing image in kernel, access picture user-space application not required. don't understand how this. framework should use - framebuffers or v4l? suppose direct programming of display controller not idea, because there other driver in kernel this. so, questions are: how interact between in-kernel drivers, , how specify picture should on top? i grateful help. what want can not done in way, since kernel not handle guis , not handle window systems. provides access video output devices in 1 form or another, actual drawing , compositing of screen done in user space. now, kernel module have power overwrite frame buffer, but, noticed, there multiple interfaces different purposes. additionally, using 3d rendering 2d desktops quite common. hijacking 3d command stream purposes disproportionately difficult. even if managed that, there no guarantee user space window system wouldn't ...

javascript - Status Code 304 -

i new javascript , server-side programming. trying send request load image blog: http://jsafaiyeh.github.io/img/suw_background.png function imgload(url) { return new promise(function(resolve, reject) { var request = new xmlhttprequest({mozsystem: true}); request.open('get', url); request.responsetype='blob'; request.onload = function() { if (request.status >= 200 && request.status < 400) { resolve(request.response); } else { reject(error('image did\'t load successfully; error code '+ request.statustext)); } }; request.onerror= function() { reject(error('there network error')); }; request.send(); }); } var body = document.queryselector('body'); var myimage = new image(); imgload('http://jsafaiyeh.github.io/img/suw_background.png').then(function response() { var imageurl = window.url.createobjecturl(response); myimage.src = imageurl; body.appendchild(myimage); },...

php - Eloquent order by one-to-one-related column -

good morning everyone! i'm using laravel 5.0 , eloquent build displaying page results of replies on database. replies in reservations table, "belongs" users table since every reservation linked person. class reservation extends model { public function user() { return $this->belongsto('app\user'); } } i display results, reservations, ordered last name column of user. like: $reservations = reservation::orderby( /*users.last_name*/ )->get(); but dont'know how. thank in advance time. you'll need join tables order foreign column. $reservations = reservation::join('users', 'users.id', '=', 'users.reservation_id') ->orderby('users.last_name', 'asc')->get();

node.js - What is the purpose of `socket.broadcast.to(param)` in socketio -

while i'm learning node.js, confronted example write chat system. somewhere in code there's following line: socket.broadcast .to(message.room) .emit('message', themessage); i don't understand to function doing. also, didn't find clue @ client side code. happens if code has not to(message.room) part? socket.broadcast.to broadcasts sockets in given room, except socket on called. for more details : http://socket.io/docs/server-api/#socket#to(room:string):socket

javascript - Texture repeats and overlaps in three.js -

i creating texture svg files, mapping on planes , returning bitmap mesh callback. problem first texture works fine when apply second texture plane has both first , second texture , continues. edit : surprising console.log(mesh.material.map.image.src) showing correct image each icon(no overlap). other each three.js group has 2 children 1 overlay image , other blue background. var scene = new three.scene(); var camerawidth = window.innerwidth; var cameraheight = window.innerheight; var camera = new three.orthographiccamera(camerawidth / -2, camerawidth / 2, cameraheight / 2, cameraheight / -2, 0, 10000); var webglrenderer = new three.webglrenderer(); webglrenderer.setclearcolor(new three.color(0x555555, 1.0)); webglrenderer.setsize(window.innerwidth, window.innerheight); camera.position.x = 0; camera.position.y = 0; camera.position.z = 100; camera.lookat(new three.vector3(0, 0, 0)); var ambientlight = new three.ambientlight(0xffffff); scene.add(ambientligh...

actionscript 3 - stop(); undefined method in as3.0 -

i want move next frame after clicking specific button. tried putting stop(); method says error , result alternating 2 frames . here's code. //the error says call possibly undefined method stop. //i'm using adobe flash cc. stop(); public function main ():void { enter_button.buttonmode = true; enter_button.addeventlistener(mouseevent.mouse_down, checkform); player.text = ""; } public function checkform (event:mouseevent):void { if (player.text != ""){ gotoandstop(1); sendform(); } else{ player.text = "please enter name"; } } try movieclip(root).gotoandstop(1); - assuming you're trying change frames on main timeline , not object. also, it's not clear you're using code, (on timeline, in class, or in main .as) stop(); should placed in actions panel of every frame of timeline / movieclip.

ruby on rails - devise sign in page always show up even though its not root. -

it says log in continue. ve removed excess layout.html.erb render tag part of body. yet keeps routing users/sign_in page help! did removed controllers/models too? can example have in model: before_action :authenticate_member! this cause redirect login page if you're not proper logged in.

javascript - why DOM is null when evaluated in a callback function of an ajax call using jQuery.get()? -

i run function contents of html inside div #contents success. when use deferred.always callback function dom elements null ( included window! ). explain why , solution? thanks. function loadhomec(){ $.get("../ajax/homec.html", function(data) { $(contents).html(data); }).always(function() { console.log(window.document.getelementbyid('myid').value); }); } the data returned homec.html following : <p> welcome </p> <ul> <li> <a href="#" onclick="loadnewtype()">create new object type</a></li> <li> <a href="#" onclick="loadtreefortypes()">create new object</a></li> <li> <a href="#">create new rulesset</a></li> </ul> this fiddle shows works fine unless have exception in success handler. candidate, since still haven't provided how content defined. given ...

evernote - Is there a way to create or update notes for the new rich Notes App in iOS 9? -

i want create app generate content notes. evernote has api that. possible create new rich text ios 9 notes app? haven't found it. unfortunately there no simple way now, there isn't api notes app. it's possible apple release 1 later, that's not going happen, don't release api's. hope helps.

php - Session start on Laravel -

please help, exception on: session_start(); open(/home/en/incentivestogirls/app/storage/sessions/sess_uj043d3ka2vgv3iumu6vf1cbr1, o_rdwr) failed: read-only file system (30) storage directory needs writable web server. make app/storage folder writeable example command chmod 777 -r app/storage which not works, because allow every user rwx access folder. better solution use 755 . if permission change not help, there can serious problem hdd (failing, run out of memory,...). try contact administrator or provider.

visual studio 2015 - Unable to publish to Microsoft Azure API Apps (Preview) -

Image
i have visual studio 2013 , 2015 rc installed on pc. azure 2.6 can see new microsoft azure api apps (preview) when publishing. visual studio 2013 on 2015 don't see option visual studio 2015 rc enterprise yet looks have installed correctly is there else need publish option api apps? if have access azure management portal, download publish profile api wish publish. once downloaded, import publish profile, automatically save profile next publish too.

connection - Connect IOT module to the internet server -

i have developed iot module can connect wi-fi , send data internet, module can send data (string) specific ip address on specific port. the internet server should store information data base , display information user via http (web page). when set port 9081 (any random number) , local computer ip address ip address module should send data to, can see data on local computer terminal. my question how can send data internet? have in mind can purchase domain name, host , develop web site (http) default listen port 80. service provider give me basic services such http, https , ftp make possible upload website , don’t have access other protocols , ports. should purchase virtual private server or should use specific cloud services or module can send data server on port 80 without getting conflict web pages , web contents? please give me suggestion. i did similar iot module. there 2 options considered. before describe, there no need buy domain name. can comfortably use i...

fstream - Imitating fortran print and write syntaxes in C++ -

i trying implement class in c++ imitate syntax of print , write statements fortran. in order achieve this, implemented class fooprint , overloaded fooprint::operator, (comma operator). since class should print standard output or file, defined 2 macros: print (for stdout) , write (to operate on files). i compilation errors when trying use write(data) a; (see below error log). how can working write statement above properties? this code ( live demo ): #include <iostream> #include <fstream> class fooprint { private: std::ostream *os; public: fooprint(std::ostream &out = std::cout) : os(&out) {} ~fooprint() { *os << std::endl;} template<class t> fooprint &operator, (const t output) { *os << output << ' '; return *this; } }; #define print fooprint(), // last comma calls `fooprint::operator,` #define write(out) fooprint(out), int main() { ...

Python Convert set to list, keep getting TypeError: 'list' object is not callable -

i trying write program adds items list based on random number. part of program potentially rolling additional items, duplicate items should rerolled. issue when try using methods able find (compare list set of list test dups, save set list), keep getting typeerror: 'list' object not callable. confusing thing when test simple lists set up, works fine. this code from random import randint # dice roller function def roll_dice(dice, sides, bonus): count = 0 roll = 0 count in range(dice): roll += randint(1, sides) roll += bonus return roll list = ['1', '2', '3', '4', '5'] print_list = '' x in range(0, len(list)-1): print_list += ' ' + list[x] print print_list[1:] # minor special armor ability roller def armor_special_ability(): reroll = 1 ability = [] abil_list = '' while reroll > 0: result = int(raw_input('roll:'))#roll_dice(1,100,0) ...

matlab - Link to external m file from Simulink -

i have simulink model relies on piece of code relies on several libraries. embedded matlab function not useful because of that. there way have simulation run , take input m file not in simulation? have done searching have not found useful. answers or locations answers appreciated.

r - Sum of all pairwise row products as a two way matrix -

i'm looking @ high throughput gene data , doing type of correlation analysis based on bayesian statistics. 1 of things need find every pairwise combination of products in dataset , find sum of each resultant row. so example, high throughput dataset matrix dataset (dataset <- structure(list(`condition 1` = c(1l, 3l, 2l, 2l), `condition 2` = c(2l, 1l, 7l, 2l), `condition 3` = c(4l, 1l, 2l, 5l)), .names = c("condition 1", "condition 2", "condition 3"), class = "data.frame", row.names = c("gene a", "gene b", "gene c", "gene d"))) condition 1 condition 2 condition 3 gene 1 2 4 gene b 3 1 1 gene c 2 7 2 gene d 2 2 5 first want multiply every possible pair of rows following matrix called comb : condition 1 condition 2 condition 3 gene gene ...

assembly - NASM assembled bootloader memory issue -

i writing bootloader nasm. @ moment designed output welcome string, record keystrokes while displaying them, printing stored keystrokes upon finding enter key, , halting. bits 16 org 0x7c00 start: jmp main bgetkey: pusha mov ax, 0 mov ah, 10h int 16h mov [.buf], ax popa mov ax, [.buf] ret .buf dw 0 prints: mov ah, 0x0e mov al, [si] cmp al, 0 jz print_end mov bh, 0x00 mov bl, 0x07 int 0x10 inc si jmp prints print_end: ret main: mov ax, 0x0000 ; set register mov ds, ax ; ...

wordpress - Remove frameborder in avada theme in youtube shortcode? -

i have using following shortcode. [youtube id="" width="" height="" autoplay="" api_params="" class=""] when add shortcode frameborder comes in iframe. i need remove frameborder can me shortcode comes in fusion core plugin. fusion-core/shortcodes.php findout add_shortcode('youtube', 'shortcode_youtube'); remove frameborder div under above shortcode.

Typescript/Javascript forEach call -

Image
i having trouble understanding bit of code: stringsarray.foreach(s => { (var name in validators) { console.log('"' + s + '" ' + (validators[name].isacceptable(s) ? ' matches ' : ' doesnt match ') + name); } }); in particular, s => { ... part mysterious. looks s being assigned next string in array on each loop. => part meaning? it's related lambdas think not following. newbie? thanks! yeah it's lambda (for example, similar ecmascript6 , ruby, other languages.) array.prototype.foreach takes 3 arguments, element, index, array , s parameter name being used element . it'd writing in regular ecmascript5: stringsarray.foreach(function(s) { (var name in validators) { console.log('"' + s + '" ' + (validators[name].isacceptable(s) ? ' matches ' : ' doesnt match ') + name); } }); ...

ios - How to count the number of times every user has done something? -

the title worded pretty poorly can explain want do. have app , in app have 'play' button. can count number of times every user has pressed 'play' , send website app? example, imagine owned candy crush , on website wanted counter read '345745646 levels completed', how this? currently, app offline , not connect server nor cloud etc. haven't created website yet. to start, can @ using parse backend app if not have lot of experience server side stuff. you create database table called action , every time user hits play button, create new play record in action table. show counter, query database , count of play actions in actions table. hope sets on right path.

javascript - How can I clear all checkboxes from ng-repeat? -

i have method value objects selected, , ".length" indicate @ user how many objects selected. have cancel button , clear checkboxes , reset ".length" $scope.selection = []; $scope.toggleselection = function toggleselection(image) { var idx = $scope.selection.indexof(image); // selected if (idx > -1) { $scope.selection.splice(idx, 1); } // newly selected else { $scope.selection.push(image); } $scope.totalitems = $scope.selection.length; $scope.itemobject = { 'attachments': $scope.selection }; this ng-repeat: <ul ng-repeat="image in images | filter:query attachmensresults"> <li> <div class="cbxdelete"> <input class="checkbx" id="ckbox" type="checkbox" value="{{image.id}}" ng-checked="selection.indexof(image.id) ...

performance - Android: Is this method always available and present? -

i want make out root access folders. order correct , available , present? file ffile = new file(environment.getrootdirectory().getparent()); // return "/" // "/" out root access folders you call getrootdirectory() system directory. if want true root of folders, it's "/". new file("/");

java - Does a class without fields have a special name? -

what class without fields called? i'm beginner in programming java , i'm trying understand , learn classes, have following class "daluser" doesn't have fields, methods, validatesession in folder called dal: import com.app.be.beuser; public class daluser{ public beuser validatesession(string user, string password) { ... } i have class beuser has fields user , password , located in folder or package called be. particular type of class or common class despite not having fields? what class without fields called? there no universally applicable name this: classes no fields have no explicit state, strictly speaking, every java object has state associated mutex. hence calling them "stateless classes" bit of stretch. classes no fields may be "helper classes", absence of fields neither necessary or sufficient precondition. an instance has no state immutable, call classes no fields "immutable class...

c# - How to use FileSystemWatcher to refresh text being returned from converter -

bare me new c#. have built converter class pass in file path , returns actual text of file. public class getnotesfilefrompathconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { var txtfilepath = (string)value; fileinfo txtfile = new fileinfo(txtfilepath); if (txtfile.exists == false) { return string.format(@"file not found"); } try { return file.readalltext(txtfilepath); } catch (exception ex){ return string.format("error: " + ex.tostring()); } } public object convertback(object value, type targettype, object parameter, cultureinfo culture) { return null; } the converter applied in xaml: <textbox x:name="filepath_txt" > <textbox.text> <![cdata[ \\i...

php exec in the background with WAMP on Windows -

with following code can call php script , pass variables it $cmd = 'php -f c:/wamp/www/np/myphpscript.php '.$var1; exec($cmd); this way called script works, , need process in background , dont want wait script finish, there way of doing using wamp on windows ? been doing reading , add & @ end of command, or > nul , noticed of them linux , there such command wamp on windows ? if there please share it edit : due way exec() command waits program finish executing, it's difficult vanilla exec() . came across these solutions , , 1 should work: $rshell = new com("wscript.shell"); $rexec = $rshell->run("php -f c:/wamp/www/np/myphpscript.php ".$var1, 0, false); the wscript.shell->run command takes 3 arguments: command (you can optionally add output redirection), window mode (0 = hidden), , wait should wait finish. because 3rd argument false, php should return immediately. original solution : this post suggests, should...

symbols - What are all of clojure's special forms? -

as part of improving cider's debugger, need implement special handling possible special-forms. in order words, need know symbols satisfy special-symbol? . doc page on special forms , while helpful, doesn't offer of them. for instance, after experimentation, i've learned that most of forms listed there have * counterpart ( let* , loop* , instance). there clojure.core/import* special-symbol (which wouldn't have found if not sheer luck). is there complete list of special symbols? alternatively, there way list interned symbols? if so, filter on special-symbol? . looking @ definition of special-symbol? provides big clue: (defn special-symbol? "returns true if s names special form" {:added "1.0" :static true} [s] (contains? (. clojure.lang.compiler specials) s)) thus: user=> (pprint (keys (. clojure.lang.compiler specials))) (& monitor-exit case* try reify* loop* letfn* if clojure.core/import...

I can't figure out what's wrong with my c++ program -

the question is: abc hardware company has hired write program it's account receivable dept. master file in ascending order customer number 20 character customer name , balance due. transaction file contains records of each transaction customer number. read in records 1 @ time 2 files , use transaction file update info master file. process transaction records before going on next master record. if transaction record contains "o" in column 1, calculate orderamount , add balance due. if record contains "p" in column 1, subtract payment balance due. keep running total of ar balance of abc company (the sum of balances each customer). after processing master record , transactions, program should prepare invoice each customer lists customer name, number, previous balance, transactions, , final balance due. the output should like: customer name customer number previous balance $xxx.xx (all transactions per customer:) transaction# item ord...

html - Make underline CSS transition change direction -

i using style found on this website create underline slide in effect. please see jsfiddle example. can see, underline comes in left right. how go making line on top of text, transitions in right left? adapt current code snippet, or have use different method entirely? .cmn-t-underline { position: relative; color: #ff3296; } .cmn-t-underline:after { display: block; position: absolute; left: 0; bottom: -10px; width: 0; height: 10px; background-color: #2e9afe; content: ""; -webkit-transition: 0.3s; -moz-transition: 0.3s; -o-transition: 0.3s; transition: 0.3s; height:2px; } .cmn-t-underline:hover { color: #98004a; } .cmn-t-underline:hover:after { width: 100%; height:2px; } <h1 class="cmn-t-underline">test</h1> http://jsfiddle.net/juhl2256/1/ change left right. .cmn-t-underline:after { display: block; position: absolute; right: 0; bottom: -10px; width: 0; ...

Google Map With Multiple Markers -

i creating search module website have own database along coordinates(lat,long). plotted coordinates search result on google map, problem want show marker more prominent or bigger nearest user among other points. how can done, website in php. thanks! first you'll have latlng database, once customer got create (invisible) markers, having done that, google has google.maps.geometry.spherical.computedistancebetween returns distance between 2 latlng, frist latlng geolocation, second latlng of database, save distance in array , recover lowest value. look @ example fiddle

javascript - Filtering an array of objects using underscor functions JS -

i have array of objects looks like: object{ name: array[3] [0]: firstname: john lastname : smtih classid : 123 [1]: firstname: jane lastname : doe id : 321 [2]: firstname: john lastname : smtih classid : 456 } i need filter out array based on uniqueness, no person same firstname , last name , if there 2 of same people, filter same people classid have chosen. for example, if there 2 john smith in list, , if current classid 123 end result should like object{ name: array[2] 0: firstname: john lastname : smtih classid : 123 1: firstname: jane lastname : doe id : 321 } so basically, need check array of objects make sure 2 people dont have same first name , last name , if need filter people classid. how can filter underscore functions? thanks try: var obj = { name: [ { firstname: "john", lastname : "smtih", classid : 123 }, { firstname: ...

glassfish - What's a good workflow for coding a frontend for a Java EE application? -

the setup java ee on glassfish server running local on 1 machine , frontend development setup running local on machine, plus git collaboration. i'm doing frontend work (mostly css, js , little html) exclusively. so, need browser-rendered html. right colleague publishes application on local glassfish, grabs rendered html firefox , pastes seperate frontend folder in our git repository. this seems bad workflow. i guess solve setting development server, don't have one, yet. is there way rendered html without me running java tools (eclipse, java ee, glassfish) on machine? it depends on want avoid not having things on machine. if local machine low on resources, may not best scenario (depending on how light/heavyweight application is), if main goal not clutter machine unnecessary things, may want try vagrant. i've created vagrantfile payara (a build of glassfish fixes bugs , includes hazelcast) means clone repo, type vagrant up vagrant ssh , you're...

java - What does the ++counter mean? -

this question has answer here: ++somevariable vs. somevariable++ in javascript 5 answers i don't consider myself bad @ programming, there's been troubling me since past few days. int counter = 3; ++counter; is following code above same counter++; . it similar, not same. in expression doesn't matter, if had more complicated, system.out.println(counter++) , make big difference. for example: int counter = 3; system.out.println(counter++) this print 3, increment counter 4. however, if do int counter = 3; system.out.println(++counter) it print 4 because increments prior giving value parameter print function. it's question of when increment performed, prefix performs before other operations, postfix performs after. have different precedences.

c# - XDT Transforms - Transforming the transform -

i creating nuget package part of result of installing package modify web.release.config. i have no problem inserting elements file web.release.config.install.xdt, need keep xdt:transform , xdt:locator attributes on elements inserting because these transforms need run when application built deployment. so instance when installing nuget package see: <add key="serilog:using" value="serilog.sinks.seq" xdt:transform="insertifmissing" xdt:locator="match(key)" /> show in web.release.config including xdt:transform , xdt:locator attributes. is possible this? i don't believe trying supported either msbuild or slowcheetah. nuget package owners dont know enough customers implementation set values environment specific configs. additionally transform tools not written nuget in mind built serve different need. sorry bad news. you may able use init.ps1 powershell script done (nuget run script first time package installed in s...

php - How does Ratchet (socketo.me) broadcast to users subricbed to a certain topic? -

i have been following directions on website socketo.me ratchet , has been fine far. interested in broadcasting topics users subscribed it, , not everyone. this code given below, , here on website confusing me. <?php use ratchet\connectioninterface conn; /** * when user publishes topic clients have subscribed * topic receive message/event publisher */ class basicpubsub implements ratchet\wamp\wampserverinterface { public function onpublish(conn $conn, $topic, $event, array $exclude, array $eligible) { $topic->broadcast($event); } public function oncall(conn $conn, $id, $topic, array $params) { $conn->callerror($id, $topic, 'rpc not supported on demo'); } // no need anything, since wampserver adds , removes subscribers topics automatically public function onsubscribe(conn $conn, $topic) {} public function onunsubscribe(conn $conn, $topic) {} public function onopen(conn $conn) {} public function onclose(c...

entity framework 6 - ASP.NET Identity Custom with Group-based Roles -

perhaps i've misunderstood concept of roles in asp.net identity , database model, i'm struggling wrap head around how implement following scenario: asp.net identity, seems user has permissions globally based on role, opposed permissions on more granular level. i'm trying implement db schema in ef6 code-first user can member of several groups. instead of having global role however, want user have 1 role in 1 group, , different role in another. for example, user can create group, , therefore group admin, teacher in group , therefore able contribute content. same user student in different group, , have different permissions in group result. users can perform multiple roles in given group, , permissions should based on role(s) within group. from can see isn't intended structure asp.net identity, can't see how limit scope of specific role group. also, ideally i'd able assign user group, , assign group of users group, example have group of users , assign grou...

javascript - Creating a sunburst diagram with dynamically chosen data source using D3 -

i trying create interactive sunburst diagram using d3, user can select data source dropdown menu. once data source selected, existing sunburst erased , redraw using new data. based off d3 example called "sequences sunburst" http://bl.ocks.org/kerryrodden/7090426 having done bit of research, looks need follow add/append/transition/exit pattern. here link semi-functioning example on jsfiddle: http://jsfiddle.net/danginmd/dhpsxm64/14/ when select first data source, sunburst diagram created. when select second data source, second sunburst added. each 1 appears connected unique data source. how erase first sunburst before drawing second sunburst? here code listener event dropdown box: // event listener (re)draws breadcrumb trail , chart d3.select('#optionslist') .on('change', function() { var newdata = eval(d3.select(this).property('value')); createvisualization(newdata); }); here code draws sunburst diagram: function createv...

java - Illegal combination of modifiers: public and private -

i having issue following code... /** * class holds of information pertaining * person's name. */ public class name { private string first, middle, last, maiden, initials, prefix, suffix; private char middleinitial, firstinitial, lastinitial; private /** * constructor name given first, middle, , last names. */ public name(string first, string middle, string last) { this.first = first; this.middle = middle; this.last = last; this.middleinitial = middle.charat(0); this.firstinitial = first.charat(0); this.lastinitial = last.charat(0); this.initials = string.valueof(firstinitial + middleinitial + lastinitial); this.maiden = null; this.prefix = null; this.suffix = null; } there more error coming in primary constructor. giving me error have entered in title. can see, both class , constructor both public. shouldn't cause issues seems doing so. ...

python - Using Django 1.8 with Shibboleth -

i'm working on project university need integrate shibboleth system university uses. i'm using django 1.8, , i'm looking way integrate basic authentication within application. i've seen few packages supposedly haven't had luck finding compatible 1.8. questions asked before on haven't been entirely relevant need. any recommending package, or somewhere start on creating own backend shibboleth welcome! i begin installing shibboleth service provider (sp) on server , integrating apache httpd mod_shibd module. https://wiki.shibboleth.net/confluence/display/shib2/installation

tsql - SQL query to get list of active customers. Active are those that are in the table at least once each week -

i have table contains usage data our customers - customerid, dateofusage. day, same customerid may occur multiple times. i want figure out list of active customers. active have used product @ least once each week. when use : select distinct [customerid], datepart(week, [date]) customerusage group [subscriptionid] i list of customerids , week used in. try extend doing this: select distinct [customerid], count(datepart(week, [date])) customerusage group [subscriptionid] but numbers count messed up. hoping number of weeks customer active in , if number greater number of weeks far, have list. idea doing wrong? you need add distinct before datepart ensure count distinct days customer present in records. query posted counts every row customer present. select distinct [customerid] , count(distinct datepart(week, [date])) customerusage group [subscriptionid]

c# - MySqlClient ReplicationManager exception -

i set test project connect mysql database (in visual studio 2013 express, using c#). [this first time working sql.] i got working; can connect local database. however, when copied connection code project, error "the type initializer 'mysql.data.mysqlclient.replication.replicationmanager' threw exception." my searches problem have turned solution of enabling "sql server debugging", option doesn't seem exist in express versions of visual studio. how can fix error in visual studio express? (the project copied code made in vs2012, if matters.) my code (works in test project, not in other project): mysqlconnection cn = new mysqlconnection(); cn.connectionstring = "server=127.0.0.1; userid=newuser1; password=mysql; " + "database=pr2_db"; cn.open(); edit: code works if start program without debugging.

java - Difference between Strings -

is there method compare 2 string values .compareto returns number of letters aren't same? example: "somestring".anothercompareto("somestrng") -> 1 "somestring".anothercompareto("smestrng") -> 2 "somestring".anothercompareto("somestrong") -> 1 i can't find anything. tried convert chararrays , write method myself failed. if not possible, maybe there's method compares 2 strings same length returns number of "mistakes"? apache commons has method diff strings stringutils.difference(string str1, string str2) that can use create method returns number of differences easily. edit : infact exists: stringutils.getlevenshteindistance(string str1, string str2)