Posts

Showing posts from May, 2013

python - How to find all comments with Beautiful Soup -

this question asked 4 years ago, answer out of date bs4. i want delete comments in html file using beautiful soup. since bs4 makes each comment special type of navigable string , thought code work: for comments in soup.find_all('comment'): comments.decompose() so didn't work.... how find comments using bs4? you can pass function find_all() check whether string comment. for example have below html: <body> <!-- branding , main navigation --> <div class="branding">the science &amp; safety behind favorite products</div> <div class="l-branding"> <p>just brand</p> </div> <!-- test comment here --> <div class="block_content"> <a href="https://www.google.com">google</a> </div> </body> code: from bs4 import beautifulsoup bs bs4 import comment .... soup=bs(html,'html.parser')

.net - Writing huge amount of physical file names into text files c# -

i have developed small tool used display data discrepancy in c#, explained point wise below, fetch data database , write list of file names in text file based on date criteria -output 1 take dir of path 1 , write text file- output2 take dir of path2, path3 , path4 , write text files separately each path- output 3/4/5 compare option: compare output1 , 2 , write down difference in text file, difference compared output3 , again difference written in file, , on... my issue : last path has more 2.5 million records of files, whenever try writing in text file hangs application , never provides output, did try filtering date criteria single day records around 30 thousands hangs i have searched many sites did not solution can understand or able implement it. below attempted code. if (!txtpath3.text.equals(string.empty) && system.io.directory.getfiles(txtpath3.text).length > 0) { var directory = txtpath3.text; var from_dt = this.dtpickerstart.value; var end

recursion - Getting help recursive C programming -

given array of length n , , requirement write program calculate number of sub-sequences of length m of given array. below code it. please, have look. int reccountsubseq(int seqlength, int length, int s[]) { int answer; if (seqlength == 0) { /* base case: found subseq of correct length */ return 1; } if (seqlength >= length) { /* base case: possible seqlength == length*/ return (seqlength==length); } /* recursive case: 2 branches */ answer = reccountsubseq(seqlength-1, length-1, s); /* s[length-1] in subseq*/ printf("answer=%d\n", answer); answer += reccountsubseq(seqlength, length-1, s); /* s[length-1] not in subseq */ printf("increased answer %d\n", answer); return answer; } void countsubseq(int seqlength, int length, int s[]) { printf("#subseq = %d\n", reccountsubseq(seqlength, length, s)); } int main() { int length; scanf("%d", &le

java - Use svn programmatically from eclipse plugin -

i need svn status , invoke svn commit eclipse plugin (and create tag). one way solve problem use runtime call svn through command line (and parse result). maybe possible use subclipse or 1 of libraries job more directly, not clear me how done. i want avoid adding additional java libraries not part of eclipse or subclipse.

java - My breaks won't fire after if statement -

import java.util.scanner; public class emptest { public static scanner input = new scanner(system.in); public static void main(string[] args) { // there second class constructors , other stuff of nature employee e1 = new employee(); employee e2 = new employee(); employee e3 = new employee(); string no = "no"; string yes = "yes"; while (true) { system.out.println("please enter in employee name"); e1.name = input.nextline(); system.out.println("please enter in salary of employee"); e1.salary = input.nextdouble(); while (true) { system.out.println("would add second employee?"); string userinput = input.next(); if (userinput.equalsignorecase(yes)) { system.out.println("please enter in employee name"); e2.name =

logging - Java custom logger issues -

i have custom logger class: import java.io.outputstream; import java.io.printstream; public class logger extends printstream{ public logger(outputstream outputstream) { super(outputstream); logheader(); } private void logheader(){ (int i=0; i<20; i++) print("#"); print("program execution start: "); print(calendarclock.getinittimestamp()); (int i=0; i<20; i++) print("#"); println(); } public void logfooter(){ (int i=0; i<=20; i++) print("#"); print("program execution stop: "); print(calendarclock.getcurrenttimestamp()); (int i=0; i<=20; i++) print("#"); println("\n"); } @override public void print(string arg0) { super.print(arg0); if (this.out != system.out) system.out.print(arg0); } @override public void println(string arg0) { supe

python - Preserve empty lines with NLTK's Punkt Tokenizer -

i'm using nltk's punkt sentence tokenizer split file list of sentences, , preserve empty lines within file: from nltk import data tokenizer = data.load('tokenizers/punkt/english.pickle') s = "that loud beep.\n\n don't know\n if working. mark?\n\n mark there?\n\n\n" sentences = tokenizer.tokenize(s) print sentences i print: ['that loud beep.\n\n', "i don't know\n if working.", 'mark?\n\n', 'mark there?\n\n\n'] but content that's printed shows trailing empty lines have been removed first , third sentences: ['that loud beep.', "i don't know\n if working.", 'mark?', 'mark there?\n\n\n'] other tokenizers in nltk have blanklines='keep' parameter, don't see such option in case of punkt tokenizer. it's possible i'm missing simple. there way retrain these trailing empty lines using punkt sentence tokenizer? i'd grateful insights others can offer

wpf - Reuse element defined further up in App.xaml -

i declare several converters in app.xaml follows repeating myself avoid: <c:converterchain x:key="isnotnull"> <c:isnullconverter /> <c:invertboolconverter /> </c:converterchain> <c:converterchain x:key="hidewhennull"> <c:isnullconverter /> <c:invertboolconverter /> <c:booltofromvisibilityconverter falseequivalent="hidden" /> </c:converterchain> <c:converterchain x:key="collapsewhennull"> <c:isnullconverter /> <c:invertboolconverter /> <c:booltofromvisibilityconverter falseequivalent="collapsed" /> </c:converterchain> as can see isnotnull reused in 2 following converter chains, possible declare somehow? i'm thinking of like: <c:converterchain x:key="hidewhennull"> <reference name="isnotnull" /> <c:booltofromvisibilityconverter falseequivalent="hidden" /> </c:converterc

google maps - Get latitude and longitude of marker (onclick) of already exist place (already marked) place -

Image
i m using google map api lat long on click event.i'm able lat long on click when tries click place exist or having marked on place doesn't allow me click on place or on text or icon near text. attaching image . this code lat long google.maps.event.addlistener(map, "click", function (e) { removemarkers(null); var latlng = e.latlng; var lat1 = e.latlng.lat(); var lng1 = e.latlng.lng(); updatelatlongboxes(lat1, lng1); // place marker on clicked position var marker = new google.maps.marker({ position: latlng }); marker.setmap(map); //store current marker in array markers.push(marker); }); google maps triggers own click handler poi objects , there no official way register custom event. probably the preferable approach here hide poi features via styles shown below function initmap() { var latlng = new google.maps.latlng(40.713638, -74.005529); var myoptions = { zoom: 1

javascript - How to add minutes to a specific date? -

i've date: 2015-10-27 10:50:00 and in minutes variabile i've valorization: 30 add minutes date convert date in format want this: var dbdate = moment(moment(appointment['end_datetime']).format('yyyy-mm-dd hh:mm:ss')); dbdate.add({minutes: min}); but return same date above. nb: appointment ['end_datetime'] contain date above. doing wrong? dont format first var dbdate = moment(appointment['end_datetime']); dbdate.add({minutes: min}); // format dbdate before using it/displaying this assumes have value want add in minutes stored in variable min . in code above minutes property name, not value.

javascript - bootstrap modal in rails doesn't work properly (not even without turbolinks) -

i have rails app using bootstrap modal ajax. have 2 problems: even putting //= require jquery.turbolinks (right after req jquery) , //= require turbolinks after //= require bootstarp-sprockets in application.js, js.erb files (new,update,delete) won't executed when click on submit buttons of modals. without turbolinks works fine (creating, updating, deleting), except 1 thing. if create new task displayed after clicking on modal's submit button ajax, if click right away on edit/delete (delete happens modal well) button of freshly created object, modal doesn't pop up. after page reload, works fine again. it's weird since if edit not new object modal can click again on edit/delete , update/destroy same object. new modal works fine well, if create new object can click on new button again , modal shows up. there issue creating new 1 edit object combination. have sby encountered same problems? so current application.js without turbolinks following @ moment: //=

java - Wrong Quiz result -

this output of program i able till this result doing program below import java.util.scanner; public class alittlequiz { public static void main(string[] args) { // declaring varibles string quizstart; int quizans1, quizans2, quizans3; scanner input = new scanner(system.in); system.out.println("are ready quiz? (y / n)"); quizstart = input.next(); system.out.println("okay, here comes!"); // quiz answer 1 system.out.println("\nwhat capital of alaska? \n1) melbourne\n2) anchorage\n3) juneau"); quizans1 = input.nextint(); if (quizans1 == 3) { system.out.println("that's right"); } else { system.out.println("your answer wrong, sorry!"); } // quiz answer 2 system.out.println("q2) can store value ''cat'' in variable of type int? \n1) yes \n2) no");

r - Issue: ggplot2 replicates last plot of a list in grid -

i have 16 plots. want plot of these in grid manner ggplot2. but, whenever plot, grid plots same, i.e , last plot saved in list gets plotted @ 16 places of grid. replicate same issue, here providing simple example 2 files. although data entirely different, plots drawn similar. library(ggplot2) library(grid) library(gridextra) library(scales) set.seed(1006) date1<- as.posixct(seq(from=1443709107,by=3600,to=1446214707),origin="1970-01-01") power <- rnorm(length(date1),100,5)#with normal distribution write.csv(data.frame(date1,power),"file1.csv",row.names = false,quote = false) # dataset uniform distribution write.csv(data.frame(date1,power=runif(length(date1))),"file2.csv",row.names = false,quote = false) path=getwd() files=list.files(path,pattern="*.csv") plist<-list()# saving intermediate ggplots for(i in 1:length(files)) { dframe<-read.csv(paste(path,"/",files[i],sep = ""),head=t

javascript - Why are some object methods declared differently than others -

so have this code 1 of examples class. the method created point.new method. point.prototype.tostring = function() { return "(" + this.x + "," + this.y + ")"; }; point.new = function(x,y) { var newobj = object.create(this.prototype); this.call(newobj, x,y); return newobj; }; what don't understand why don't need declare method point.prototype.new = function(){} (in fact wont compile when that) point.prototype.tostring(){} method necessary. in both cases adding new method point object, how come 1 method being called on point , other being called on point.prototype (i believe points object?) i'm not sure rule falls under, remember looking @ "adding property prototype rule" here . but in case point not prototype since has no instances right? the prototype used define methods can called on object created new point . e.g. can do: var x = new point(15, 20); var str = x.tostring(); but wo

how to send html file in the body of the mail using R? -

i have html file result of rmarkdown code. need send email html file directly in body of email, , not in attachement. trying solution post: "send html email using r" post seems works html text , not html file. here i've tried do: library(sendmailr) from<-"<sender@enterprise.lan>" to<-c("<reciever@enterprise.com>") message ="./test.html" subject = "test html" msg <- mime_part(message) msg[["headers"]][["content-type"]] <- "file/html" sendmail(from, to, subject, msg = msg,control=list(smtpserver="localhost"),headers=list("content-type"="file/html; charset=utf-8; format=flowed")) this trial send me email "test.html" file attached, , not in body directly. i'm doing wrong, i'm struggling task days, can me, please? try mailr package send emails in html format follows: send.mail(from = "sender@gmail.com",

c# - Drop down menu with checkboxes -

Image
i have problem drop down menu in wpf because want code menu this: but i'm struggling , managed this: so i'm wondering if me make more in first example. style (xaml): <style x:key="{x:type contextmenu}" targettype="{x:type contextmenu}"> <setter property="overridesdefaultstyle" value="true"/> <setter property="snapstodevicepixels" value="true"/> <setter property="fontsize" value="16"/> <setter property="fontfamily" value="segoe ui light"/> <setter property="template"> <setter.value> <controltemplate targettype="{x:type contextmenu}"> <border background="#ff2e2f33" opacity="1" width="190"> <stackpanel cliptobounds="true" orientation=&qu

stata - Generating variable observations for one id to be observation for new variable of another id -

Image
i have data set allows linking friends (i.e. observing peer groups) , thereby 1 can observe characteristics of individual's friends. have 8 digit identifier, id, each id's friend id's (up 10 friends), , many characteristic variables. i want take individual , create variables foreign born status of each friend. i have indicator each person 1 if foreign born. below small example, 1 friend. notice, mf1 means male friend 1 , mf1id id number male friend 1. respondents list 5 male friends , 5 female friends. so, need stata @ mf1id , match down id column, on f_born matched id, , input value of f_born there original id under mf1f_born . edit: did poor job of explaining data structure. have cross section 1 observation per unique id. row 1 first 8 digit id number variables following on row. repeating id numbers between friend id's listed each person (mf1id example) , id column. hope bit more clear. kevin crow wrote vlookup makes sort of thing pretty ea

ios - Assigning charAtIndex to stringWithCharacters gives invalid cast warning and bad access error -

i'm trying grab firstname , lastname firstname+lastname. int loop=0; nsmutablestring *firstname = [[nsmutablestring alloc]init]; nsmutablestring *fullname = [[nsmutablestring alloc]initwithstring:@"anahita+havewala"]; (loop = 0; ([fullname characteratindex:loop]!='+'); loop++) { [firstname appendstring:[nsstring stringwithcharacters:(const unichar *)[fullname characteratindex:loop] length:1]]; } nslog(@"%@",firstname); i tried typecasting unichar const unichar* because characteratindex returns unichar stringwithcharacters accepts const unichar. this causes cast smaller integer type warning , app crashes (bad access) when line encountered. why string operations complicated in objective c? try out: nsmutablestring *firstname = [[nsmutablestring alloc] init]; nsmutablestring *fullname = [[nsmutablestring alloc] initwithstring:@"anahita+havewala"]; (nsuinteger loop = 0; ([fullname characteratindex:loop]!='+'

angularjs - IonicPopUp using http.post result data -

how can pass data http.post results ionicpopup? inside http.post success section create alertpopup function passing result parameter . it opens popup there no data show. i show data $scope.result . here code use sample http://ionicframework.com/docs/api/service/ $ionicpopup/ : `$scope.showalert = function(result) { var alertpopup = $ionicpopup.alert({ title: 'detais', template: 'details : 1. {{result}} 2. {{state}} {{result.vehicle_brand}} 2. {{scope}}' }); alertpopup.then(function(res) { console.log('thank not eating delicious ice cream cone'); }); };` this maybe issue of object's property access when received result object. try following code $http.post success callback function. try print out structure of result snippet: $http.post(url).then(function(result){ console.log(json.stringify(result, null, 2)); }); i think structure maybe this: { "data": //your result should available here!

java - Force BufferedWriter to write from BlockingQueue when another tasks finished -

i'm writing simple html parser jsoup. i've got 50 000 links check, thought it's great chance learn abut threads , concurnecy. i've got 8 tasks registered executorservice: 6 of them parse links data stored in arraylists , add blockingqueues. 2 of tasks filewriters based on bufferedwriter. problem when 6 tasks finish prase links, file writers stop write data blockingqueue, lose part of data. i'm pretty newbie in java, if give me hand.... code: main file: public static void main(string[] args) { blockingqueue<arraylist<string>> units = new arrayblockingqueue<arraylist<string>>(50, true); blockingqueue<arraylist<string>> subjects = new arrayblockingqueue<arraylist<string>>(50, true); file subjectfile = new file("lekarze.csv"); file unitfile = new file("miejsca.csv"); executorservice executor = executors.newfixedthreadpool(9); executor.submit(new thread(new filesaver(subje

java - Whether memcachedb is embedded? -

i read memcachedb using berkley db storing backend - ref . read berkley db embedded db - ref . not able find whether memcachedb embedded . reference or suggestions? memcachedb not embedded. first reference, paragraph 1: it conforms memcache protocol(not completed, see below), memcached client can have connectivity it. since has streaming protocol interface (over tcp/ip), not have embedded in application berkeley db. should compatible memcached's protocol: https://github.com/memcached/memcached/blob/master/doc/protocol.txt berkeley db has c api (or java, or python, etc.) , must embedded , managed application program.

asp.net mvc - how to validate Viewmodel in multiLang in mvc -

i have viewmodel , use asp.net mvc , ef code first . public class addnewsvm { public string title { get; set; } public string titleen { get; set; } public string body { get; set; } public string bodyen { get; set; } public string author { get; set; } public bool isactive { get; set; } public guid imageid { get; set; } } but user can add ennews(englisg) or fanews(persian) or both of them . don't add required them . how can validatie . example want if use enter en news title user should enter en field . use if statement in action ? it depends on needs. if need both (client / server) validations, recommend use: https://github.com/jeremyskinner/fluentvalidation if want validate viewmodel on server side (class level validation), can write own custom validation rules using ivalidatable. http://weblogs.asp.net/scottgu/class-level-model-validation-with-ef-code-first-and-asp-net-mvc-3

python - SMTP library: Dynamic email content -

i have sendmail() method uses smtp send out emails. def sendmail(toaddrs, msg): # set credentials username = auto_email_username password = auto_email_password print "message received in send mail message: " + msg # sending mail using google smtp server server = smtplib.smtp('smtp.gmail.com:587') server.starttls() server.login(username,password) try: server.sendmail(username, toaddrs, msg.as_string()) except: server.sendmail(username, toaddrs, msg) server.quit() it accepts list of emails (toaddrs) , sends message receives (msg) emails. call method inside django view. now what's happening here is, whenever message sent dynamic content, concatenated string, empty emails. idea why happening? the print statement prints proper concatenated string method receives emails empty.

java - How to handle line breaks when copy/pasting from HTML to MS Excel -

Image
my java program creates html file main part consists of table. 1 of table columns contains text values happen have line breaks ( <br/> in html table). the output html needs copy/pasted ms excel file later on user. went smoothly until needed transform line breaks excel ones. whenever there's occurence, first line of said column put fitting excel column, second line creates new line starting @ column 1. this questions has been asked several times no answer has been given when there no asp involved. needless say, <br style="mso-data-placement:same-cell;"> not work. thanks answer, i'm desperate fixed. so personal experience excel , html battled 1 well. excel likes break put in formatted excel. my best answer create "excel" formatted version of html people want copy , paste it. (you link/button switch formatting simple html excel html) by excel html, mean format use char(13) / char(10) instead of < br \>. i on ma

using let blocks in orientdb select statements -

hopefully quick 1 - i'm struggling make let statement work. i have database of people vertexes. vertexes have ident fields , name fields. query returns 1 row - person named bob. select person ident = 1 i want return rows same name person. there 2 bobs in data (as proof, following query returns 2 rows): select person name = 'bob' i think of following queries should return same 2 rows, return 0 rows . involve different ways of using let statement. can see i'm doing wrong? select name person let $tmp = (select person ident = 1) name = $tmp.name select name person let $tmp = (select name person ident = 1) name = $tmp select name person let $tmp = 'bob' name = $tmp $tmp list of records, asking compare string list, , isn't working. following; select name person let $tmp = (select person ident = 1) name = first($tmp).name that wont return person records though (only rows of names). limiting $tmp query improve performan

How to set a minimum and maximum limit for a date picker in android? -

i'm working on app in i'm using custom date , time picker. i've created dialog box , inside i'm showing date , time picker respectively want set minimum , maximum limit date picker. such 1 should not able select previous date today , not more month ahead. code alertdialog.builder builder = new alertdialog.builder(getactivity()); final datepicker picker = new datepicker(getactivity()); try { field f[] = picker.getclass().getdeclaredfields(); (field field : f) { if (field.getname().equals("myearpicker") || field.getname().equals("myearspinner")) { field.setaccessible(true); object yearpicker = new object(); yearpicker = field.get(picker); ((view) yearpicker).setvisibility(view.gone); } } } catch (exception ex) {

c# - At what delta time will two objects collide? -

Image
my apologies if has been posted before. can't seem find on topic, via stackoverflow, nor of other google searches. i have 2 objects, both containing position (x , y), linear velocity (x , y). these objects moving through 2d plane. need detect when these objects collide, if collide @ all. big problem situation radius of objects, effect when touch. i've tried various solutions problem on period of month, i'm not hacking it. i've managed do, calculate 2 straight line formulas object, , end b , c both (y=mx + c). i'm trying compare these 2 formulas each other, x=x , y=y, end complex equation, , no idea how translate c#. this function needs fire in <50ms well, complicate matters. advice go long way. you can formulate problem system of 2 vector equations p1 = u1 + v1 t p2 = u2 + v2 t where p1 position of first object given initial position u1 , velocity v1 , , scalar time t . want solve moment objects touch, described by r1 + r2 = |p1 - p2|

javascript - How to load different templates in angular route on the basis of some conditions -

i new angularjs , trying load template on basis of id in angular route. here route : angular.module('myapp', []) .state('template', { url:'/template/{id}', templateurl: 'views/pages/template_main.html', controller: 'templatecontroller', resolve: { loadmydirectives:function($oclazyload){ return $oclazyload.load( { name:'myapp', files:[ 'scripts/directives/template1/template1.js', ] }) } } }) how can achieve this? if id==1 load this: 'scripts/directives/template1/template1.js' if id==2 load this: 'scripts/directives/template1/template2.js ' how can make conditions in route. suggestions?

Unknown total count in jquery-datatables -

in application used jquery-datatable serverside pagination. per document in response json need return recordstotal , recordsfiltered . but in db cannot total number of records. pagination not working in application. there way work without passing values in response ?

xcode - Firing a function whenever static variable value changed -

i'm developing iphone apps using swift communicate device via bluetooth. question want fire function on class(change display value) whenever variable received new data corebluetooth. can helps! wei implement delegate perform it write protocol protocol valuechangeddelegate { func valuechanged(nvalue:int) } and implement protocol in view controller want new value class yourcustomclass: valuechangeddelegate { func valuechanged(nvalue:int) { print("value changed") } } then implement delegate , set delegate self , call method when value changes, classes implement protocol receive new value you can refer delegate in swift-language

Is there a way to write "http://" in a shortcut way in HTML -

so i'm on website caracter limitator , love pass multiple links. html on ! there way write example http://google.com shortcut ./google.com ? thanks à lot adding // in front of link work fine, , helps inclue both http , https links, like <a href="//example.com">i link</a>

asp.net mvc - How to check facebook profile url exists on facebook or not in aspnet mvc 4 c# -

i have used code return 200 status code in case of invalid facebook url i have validate 4 social media url twitter , facebook , linkedin , xing httpwebrequest req = (httpwebrequest)webrequest.create(url); req.allowautoredirect = false; httpwebresponse res = (httpwebresponse)req.getresponse(); if (res.statuscode == httpstatuscode.ok || res.statuscode == httpstatuscode.found) return true; else return false;

haproxy cofiguration getting error -

service haproxy start * starting haproxy haproxy [alert] 299/163851 (6382) : starting proxy 50.112.164.38:80: cannot bind socket [alert] 299/163851 (6382) : starting proxy 50.112.164.38:443: cannot bind socket the issue there no listen port in configuration. use "listen" or "bind" , restart it. should work. if still having trouble show code on here , it safi

c++ - gcc/ld: what is to -Wl,-rpath in dynamic linking what -l is to -L in static linking? -

with /my/dir/path/foo.a , /my/dir/path/bar.a: to statically link using gcc/g++, 1 uses -l specify directory containing static libraries , -l specify name of library. in case 1 write gcc -l/my/dir/path -lfoo -lbar ... . with /my/dir/path/foo.so , /my/dir/path/bar.so: to dynamically link using gcc/g++, 1 uses -wl,-rpath,/my/dir/path . how names of libraries specified? command gcc -l/my/dir/path -wl,-rpath,/my/dir/path -lfoo -lbar ... correct? or should gcc -l/my/dir/path -wl,-rpath,/my/dir/path -wl,-lfoo -wl,-lbar ... ? in other words, library names need passed on linker through -wl,-l ? the -l argument works both static , shared libraries expects filename of specified library in specific format. namely, -lfoo tells linker file named libfoo.a or libfoo.so . if want links against library filename don't have 'lib' prefix (i. e. foo.so ), can use semicolon , specify filename: -l:foo.so . so, dynamically link against /my/dir/path/foo.so , /my/dir/path/

What is the difference between the two nested loops in javascript? -

function a() { var n1 = 0, n2 = 0; (; n1 < 100; n1++) { (; n2 < 100; n2++) { console.log(2); } console.log(1); } } a(); function b() { (var n1 = 0; n1 < 100; n1++) { (var n2 = 0; n2 < 100; n2++) { console.log(2); } console.log(1); } } b(); as can see.two simple nested loops,and looks have same output.but puzzles me function a() not output expected result,it loops outside , inside 100 times respectively.what's difference? in b() function n2 variable created (see @jfriend00 comment) reset during every a loop iteration. set 0 , therefore b loop goes whole length (100 times). in a variable n1 created once before inner loop, after first a iteration (and 100 b ), n2 has value of 100. in second a interation n2 checked if it's less 100. it's not, inner loop ends before started.

angularjs - Which routing file does my express/angular app use? Which takes precedence? -

i built simple single page express app angular , i'm wondering routes file application use , why? my repo here in repo, have node routes.js file in app/routes.js. inside file, have line of code: app.get('*', function(req, res) { res.sendfile('./public/index.html'); // load our public/index.html file }); so assume above line of code takes route , response sends public/index.html file html file loads bunch of angular scripts: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <base href="/"> <title>starter node , angular</title> <!-- css --> <link rel="stylesheet" href="libs/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> <!-- custom styles --> <!-- js --> <script src="libs/angular/angular.min.js"&g

Handling Active Directory events in Java/C# -

i want create c# or java application in handle specific a.d events such 4725 (a user account disabled) or other event. when specific event occurs read of event's details such eventid, targetaccountname, etc. can guide me apis , tutorials/ explanations regarding best way implement described above ? here can find lot of infos event handling in c# https://msdn.microsoft.com/en-us/library/bb671204(v=vs.90).aspx

xslt - Convert XML to string - XSL -

i have xml - <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <fis:acctassnsvcrqst> <abcd/> <efgh/> </fis:acctassnsvcrqst> </soapenv:body> </soapenv:envelope> i want output below <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gc="http://oracle.com/apiservice.xsd"> <soapenv:header/> <soapenv:body> <gc:apiservice datetimetagformat="xsd:strict"> <gc:input> <gc:soapenvelope> <![cdata[<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <fis:acctassnsvcrqst> <abcd/> <

xamarin.ios - Updating a ListView with Xamarin.Forms -

i having issue list views on in couple of xamarin forms applications. 1 form within tabbed page setup, other normal content page (different apps) i have class this public class someclass { public string stringone {get;set;} public string stringtwo {get;set;} public int intone {get;set;} } in content page, set observablecollection , add data in. tell list someclass itemsource. produces listview correctly on of devices. the problem when change 1 of properties, nothing on listview changes (so if have 3 objects in observable , remove one, list still says 3 - or if change property in second object, second item on listview doesn't change either). i have tried solve problem using standard list , implement inotifychanged within class. again though, listview doesn't alter when list changes. i know data has altered if make change object, come out , go in, data has changed in ui. am doing wrong or bug need putting bugzilla? it not change if don't

c# - Can I merge these two lists in 1 go -

what trying do, // members sharepoint list (can null) // members database (can null) // merge database members sharepoint list members database members should have property vip = true // merge mean if not in list add them list, if in list change there property vip = true // default vip property false what have developed far, list<member> members = new list<member>(); foreach (splistitem mitem in getlist(url).items) { member m = new member(); m.id = mitem.id; m.name = mitem.title; m.company = utilities.objecttostringorempty(mitem[companycol]); m.email = utilities.objecttostringorempty(mitem[emailcol]); m.comment = utilities.objecttostringorempty(mitem[commentcol]); m.membership = utilities.objecttostringorempty(mitem[mscol]); members.add(m); } var cd = new membermanager().getmoremembers(url + "/"); var activemembers = cd

java - Int to byte array - byte shifting -

i'm trying convert int (max. 65535) 2 bytes array. in c used uint16, java doesn't know unsigned values. to convert bytes array tried use this: byte[] data = { (byte) ((num >> 8) & 0xff), (byte) (num & 0xff) }; but get: [63, -49] instead of: [63, 207], if use 16335 value. there way in java? i need unsigned byte in byte array send using outputstream you can use java's nio's bytebuffer purpose: byte[] bytes = bytebuffer.allocate(4).putint(1695609641).array(); (byte b : bytes) { system.out.println(byte.tounsignedint(b)); } hope work ;)

c# - Roslyn: get the symbol for a type defined in a third-party library -

using roslyn/microsoft.codeanalysis, how can isymbol for third-party type, ie, type defined in referenced assembly not part of solution? in particular case, i'm looking json.net's jobject, same question valid bcl stuff stringbuilder etc. the idea i've come far implement csharpsyntaxwalker looks method invocations, property accesses , constructor calls, checks whether made on type i'm interested in , if yes, gets symbol respective syntaxnode. i'm going implement now, seems awfully cumbersome. think there must better way, google-fu has not yielded relevant results. maybe background: i'm trying replace usage of jobject usage of class. if can access compilation can call compilation.gettypebymetadataname() , pass in qualified metadata name symbol. be careful of nested classes , generics, metadata names different they're normal qualified names. more see: c# : having "+" in class name? once have symbol can find usages via symbolfin

sql - Adding multiple evaluation expression in For Loop SSIS -

is possible add multiple evaluation expression in loop container. background: have file, in file value of field y/n, if value n have keep reading file until value y exit loop. to this, used loop inside loop loading data record set destination , assigning values variable called "@value" in loop keeping condition init : @start = 0 eval : @value = "n" assi : @start = @start + 1 now have add 1 more condition in loop such that, has iterate 5 times exit. used @value == "n" || @start > 10 in evaluation expression. not working. or part not considering, how can achieve it.

Javascript nested arrays with strings -

i have array contains array strings: var text; var languageset = ["language4", "language5"]; var languages = [ ["language1", "language2", "language3"], languageset, "language6" ]; (function selector() { (i = 0; < languages.length; i++) { (j = 0; j < languages[i].length; j++) { text += "<option value='" + languages[i][j] + "'>" + languages[i][j] + "</options>"; } } document.getelementbyid("languageoptions").innerhtml = text; })(); html: <select id="languageoptions"> </select> but everytime run this, output "language 6" ends being such: l n g u g e 6 how output entire string? don't know why code doesn't work strings , arrays inside arrays. you should type check see if item array , loop array. used array.isarray here type check. cod

javascript - Ember.js: let component observe value changes of store items -

i starting use ember , came across following problem. want observe whether or not there has been change of value of item within store. far understand, @each directive for. unfortunately, not trigger respective method in component. my code structured follows. current route returns subset of store , has action changes 1 of items. export default ember.route.extend({ model: function() { this.store.push('node', {id: 1, x: 40, y:40}); this.store.push('node', {id: 3, x: 50, y:50}); return this.store.findall("node"); }, actions: { move: function(x, y) { this.store.findrecord('node', 1).then( function(v) { v.set("x", x); v.set("y", y); }); } } }); i pass model via template directive component. {{no

c# - Why does the sum of objects in !DumpHeap -stat not match !EEHeap -gc? -

i'm looking @ full application dump in windbg, , trying understand memory being consumed. i've parsed output of !dumpheap -stat , summed total memory in report, getting ~7 gb. comparison, if run !eeheap -gc , reports total of ~11 gb. why there such big difference between 2 reports? how can find out additional 4 gb going? the value of !eeheap sum of segment sizes allocated .net. this value larger sum of output of !dumpheap . in cases differs because there few objects in segments, e.g. pinned objects, used native pinvoke or com interop stuff. can prevent .net releasing segments. can check pinned objects !gchandles . cross check value of !eeheap against <unknown> value reported !address -summary . assuming have no native code calls vitualalloc() directly , don't use msxml, value of !eeheap should close that.

retrieve Google user details with OAuth -

i implementing google login api first time. works fine able retrieve email addresses only. have tried other ways no success. how can other user details username? include('/../src/google/autoload.php'); /* * ********************************************** attention: fill in these values! make sure redirect uri page, e.g: http://localhost:8080/user-example.php * ********************************************** */ $client_id = 'bla-bla-bla'; $client_secret = 'bla-bla-bla'; $redirect_uri = 'bla-bla-bla/google_login'; /* * ********************************************** make api request on behalf of user. in case need have valid oauth 2.0 token user, need send them through login flow. need information our api console project. * ********************************************** */