Posts

Showing posts from August, 2011

android - Set background color for a specific text in a XML TextView using CDATA -

i can able set text color using cdata. <string name="sample"> <![cdata[ <font color=#ff0000>red color</font>]]> </string> but how can able set backgound color highlight text? example: redcolor can me?

sqlanywhere - Find remaining space in SQL anywhere database -

how can run command check see how space have in total in database , how free space have? call sa_disk_free_space( ); reports information space available dbspace, transaction log, transaction log mirror, and/or temporary file. result set: dbspace_name - dbspace name, transaction log file, transaction log mirror file, or temporary file free_space - number of free bytes on volume. total_space - total amount of disk space available on drive dbspace resides .

matrix - Find the largest value of each row in Matlab and divide each number in that row by the number -

i have 133120x4 matrix in matlab. i find largest value in each row, , divide every element in row particular value. do need use sort of loop? example: find amount of rows in matrix (133120), , iterate loop amount of times, go row row , use max function return largest value in row, , divide each element in row returned value max. or there quicker way of doing this? thanks edit (for clarification): lets call 133120x4 matrix a . want divide every element in row largest value in row. since max , element-division vectorized, solution be: a_normal = / max(a) resulting in 133120x4 matrix, within each row, largest value 1. is correct? edit: not correct, , still trying figure out solution. community appreciated compute maximum max , repeat result n(=4) times there 1 per each element , element wise division ! newmat=mat./repmat(max(mat,[],2),[1 size(mat,2)]);] or in r2016b or newer newmat=mat./max(mat,[],2);

Trouble tying everything together with main function using python -

i new programing , having trouble getting main function work. print statement gives me error: candidate not defined but shouldn't findbestcandidate function provide it? doing wrong?? me in right direction awesome! def filetolist(filename): import os.path if os.path.isfile(filename) == true: file = open(filename, "r") strings = file.read().splitlines() file.close() return strings if os.path.isfile(filename) == false: return [] def returnfirststring(strings): string = '' if len(strings) != 0: string = string + strings[0] return string def strandsarenotempty(strand1,strand2): if len(strand1) != 0 , len(strand2) != 0: return true return false def strandsareequallengths(strand1,strand2): if len(strand1) == len(strand2): return true return false def findlargestoverlap(target,candidate): if len(target) != len(candidate): return -1 if

ios - Weird behavior when animating UILabel change of color -

i'm animating textcolor of uibutton's label there's animation when user taps down , when touch inverts backgroundcolor , textcolor. the problem animation on tap down changes color current color -> white, here animation cut , new color set but when touch animation works fine new color -> previous color here's code override func begintracking(_ touch: uitouch, event: uievent?) -> bool { let location = touch.location(in: self) if self.layer.bounds.contains(location) { fade(tobackgroundcolor: textcolor, textcolor: bgcolor) return true } return false } override func continuetracking(_ touch: uitouch, event: uievent?) -> bool { let location = touch.location(in: self) if !self.layer.bounds.contains(location) { fade(tobackgroundcolor: bgcolor, textcolor: textcolor) return false } return true } override func endtracking(_ touch: uitouch?, event: uievent?) { fade(tobackgroundcolor: b

c++ - Run CMake executable on Heroku -

i've built nodejs website uses boostprocess run simple executable. compiled executable's project (which written in c++) using cmake on mac, , copied executable website's bin directory. then, can run compiled executable nodejs website. works on localhost. however, when push website heroku, server responds with: error: request failed status code 404. now, did research , think since compiled executable using cmake on osx, won't able run on heroku (which uses linux, far can tell). i'm not sure how fix problem - i'm not familiar heroku, , research did didn't yield , concrete answers. appreciated. thanks in advance.

disaster recovery - Kafka replication Mirror maker -

i have question regarding dr kafka. have set prod - dr kafka, need sync prod (topics, messages ) dr. approach can follow here. below questions assuming mirror maker in place. using hortonworks hdp 2.5.5 each time when create new topic in prod need create same topic in dr well? do need have mirrir maker running on dr well?

I want to create a program in C to check for @ and . if typed in by user -

checking email address if user typed in @ , . symbols. how can fix code? void emailaddress(){ char emailadd[50]; int emailaddl, i; printf("please enter email address\n"); scanf("%s", emailadd); emailaddl=strlen(emailadd); for(i=0; i<=emailaddl; i++){ if(emailadd[i]!='@'){ printf("the entered email address incorrect. please re-enter email address , must contain '@' specifier\n"); emailadd=(int*)calloc(emailadd, sizeof(char)); scanf("%s", emailadd); } if(emailadd[i]!='.'){ printf("the entered email address incorrect. please re-enter email address , must contain '.' specifier\n"); emailadd=(int*)calloc(emailadd, sizeof(char)); scanf("%s", emailadd); } else continue; } } the major problem code facing not c logical structure of f

c# - maxAllowedContentLength ignored -

i have following settings in web config: <system.web> <compilation debug="true" strict="false" explicit="true" targetframework="4.6" /> <httpruntime requestvalidationmode="2.0" targetframework="4.6" maxrequestlength="92160" executiontimeout="3600" /> </system.web> <security> <requestfiltering> <requestlimits maxallowedcontentlength="94371840" /> </requestfiltering> </security> they both equate 90 mb. using asynchronous uploader telerik upload file. i've been testing uploading 100 mb files see if error being triggered. however, file uploaded without issue. can't figure why error not being triggered. issue staring me right in face. can figure out why? in system.web <httpruntime maxrequestlength="90000" executiontimeout="3600" /> and in system.webserver <s

javascript - hiding the parameters from the url in a new tab -

this meteor client code shows parameters param when opens destination link in new tab. how can done values in param hidden url , not displayed? thanks let windowref = null; let url = 'http://www.someurl/?'; let param = {key1:val1,...} object.entries(param).foreach(([key, value]) => url += key + '=' + value + '&'); windowref = window.open(url.slice(0, -1), "mywindow"); edit windowref.history.pushstate("removing query", "title", "/"); did not remove param values url in newly opened tab. you can try redirect new url no parameter. when user hit url can save query params in local storage or sessions. can redirect no parameter. there's script guys @ wistia may you're looking for: link

php - File extension without dot (period symbol) -

my code <?php $video_thumb_large = 'some.example-file.name.png'; /** define file name here **/ /** line below giving me need **/ $video_thumb_extension_large = substr($video_thumb_large, strrpos($video_thumb_large, '.') + 1); echo $video_thumb_extension_large; /** output: png **/ ?> there other methods file extension, example this stack overflow question has answers code not available in answers. i'm wondering why code or bad , why or why not use code on production site. better in case? can use explode() on dot , use last part in array() better? what better or best file extension without dot (.) ? recommended own experience, faster basename, explode or using own func. try use default php func cachable in opcaches.. recoded replace old code , execute <?php //recoded ajmal praveen $video_thumb_large = 'some.example-file.name.png'; /** define file name here **/ $path_parts = pathinfo($video_thumb_large); //

python - Using Backward Propagation in fmin_cg -

i trying build ann in python, , i've been able far to forward pass, problem when try backward propagation. in function nncostfunction, gradient grad define as: grad = tr(c_[theta1_grad.swapaxes(1,0).reshape(1,-1), theta2_grad.swapaxes(1,0).reshape(1,-1)]) but problem because using scipy.optimize.fmin_cg calculate nn_params , cost, , fmin_cg accepts single value (the j value forward pass) , cannot accept grad... nn_params, cost = op.fmin_cg(lambda t: nncostfunction(t, input_layer_size, hidden_layer_size, num_labels, x, y, lam), initial_nn_params, gtol = 0.001, maxiter = 40, full_output=1)[0, 1] is there way fix can include backward propagation in network? know there scipy.optimize.minimize function, having difficulty understand how use , results need. know needs done? your appreciated, thanks. def nncostfunction(nn_params, input_layer_size, hidden_layer_size, num_labels, x, y, lam): ''' given nn parameters, layer sizes, number of labels, data,

javascript - How to remember current toggle state in this example after page refresh with local storage? -

i have 3 tabs: 'monday', 'tuesday' , 'favorites'. each tab contains boxes empty heart @ start ('.favorite i'). want save current toggle class after refresh. toggle: heartlink.find('i').toggleclass('fa-heart-o fa-heart'); // .selected or not i've started with: if (heartlink.find('i').hasclass('fa-heart-o')) { localstorage.setitem('displayicon', 0); } else { localstorage.setitem('displayicon', 1); } and know need similar don't know how it.. to make clear: want save current state of each specific heart. don't 1 icon affect boxes. var showicontoggle = localstorage.getitem('displayicon'); if (showicontoggle == 'true') { // code } html: <section id="speakers-programme"> <div class="container"> <div class="tabs_main"> <div class="col-md-5"><a data-target="#mo

How to find number of builds in Jenkins queue per hour for last 24 hours -

i need report metrics on our jenkins server. 1 requirement want find out how many builds in queued state per hour in freestyle jenkins job during last 24 hours. builds triggered commits in git repo. have configured jenkins job run 2 concurrent builds , hence commits go in queued state. i see hudson.instance.queue.items.length returns number of builds in queue currently. how find out how many builds scheduled, lets say, @ 4 pm today. (current time being 6 pm). i want find programmable groovy way fetch info jenkins , plug in larger groovy script fetches other data part of metrics requirements. thanks

json - Jenkins job adding new line only when run via jenkins pipeline not stand alone -

i have jenkins pipeline builds job uses powershell make json based requests. when run job through pipeline script adds various line breaks throughout json. when run job hitting 'rebuild' script runs without issue. output of request via jenkins pipeline: invoke-restmethod -uri http://api.newrelic.com/v2/applications/17303495/deployments.json -method 'post' -headers system.collections.hashtable -contenttype 'application/json' -body { "deployment": { "revision": "deployment of e0ca4b7 ", "changelog": "see release email notes", "description": "beginning deployment of e0ca4b7 ", "user": "pcort" } } output of request via 'rebuild' or manual: invoke-restmethod -uri http://api.newrelic.com/v2/applications/17303495/deployments.json -method 'post' -headers system.collections.hashtable -contenttype 'application/

reactjs - how can I select only one component of my array of component -

this code here works don't know how click 1 of component in >the array code can change color. want know how can not change color when change in 1 >component future answer import react, { component } 'react'; export default class seats extends component { constructor() { super() this.state = { status: false, }; } changecolor(event) { if (this.state.status === false) { event.currenttarget.style.backgroundcolor = '#d70202'; this.state.status = true; }else { this.state.status = false; event.currenttarget.style.backgroundcolor = '#0cb607'; } } render() { let array = []; (var = 0; < 5; i++) { array[i] = i; } const list = array.map((d, index) => <div classname="seat" onclick={this.changecolor.b

I need a python function to extract an element from array of arbitrary depth -

i need process elements in array in python function - want assign default value if element doesn't exist. element processed may of arbitrary depth in array. ie, need this: x=myfunc(myarray,"element","here") but it's this: x=myfunc(myarray,"deeper","element","here") or even x=myfunc(myarray,"even","deeper""element","here") so achieve i've written terribly inefficient function myfunc def myfunc(mydict,*args): if len(args) == 2 : try: returnvalue=mydict[args[0]][args[1]] except keyerror: returnvalue="some default value" elif len(args) == 3 : try: returnvalue=mydict[args[0]][args[1]][args[2]] except keyerror: returnvalue="some default value" elif len(args) == 4 : try: returnvalue=mydict[args[0]][args[1]][args[2]][args[3]] except keye

React-native Text input color issue in full screen editing -

Image
in react-native android app, same text box in portrait & landscape views. have used selectioncolor & underlinecolorandroid properties set font color. <textinput selectioncolor={formelements.textinputselectioncolor} underlinecolorandroid={formelements.textinputselectioncolor} placeholder={"email address"} placeholdertextcolor={formelements.textinputplaceholdercolor} keyboardtype="email-address" value={this.props.email}/> but issue in full screen edit (on landscape mode) it's hard read in white background. so want either change make full screen edit background color or text color black on full screen. i tried, couldn't find solution yet. cam please give me solution this? this full screen popup doesn't come landscape mode. comes when ever there not enough space occupy keyboard. there libs such react-native-orientation https://github.com/yamill/react-native-orientation/ allow check if user changed screen orientatio

javascript - AngularJS $http request issue in HTTP and HTTPS -

i have problem in angularjs $http request. when send request api blocked browser like: error in firefox : blocked loading mixed active content “ http://www.example.com/rest/default/v1/integration/admin/token/ ” error in chrome: mixed content: page @ ' https://www.example.com/load.shtml#/register/pos/docs/2323232221555/new ' loaded on https, requested insecure xmlhttprequest endpoint ' http://www.example.com/rest/default/v1/integration/admin/token/ '. request has been blocked; content must served on https. how can fixed problem? idea accepted. simple: hit web api endpoints using ssl. https://www.example.com/rest/default/v1/integration/admin/token/

Xpath getting numeric value in a table -

Image
i need help, im new xpath. want extract data xml below xpath. xml : <td class="pprice" style xpath="1">$4,124,000 </td>==$0 xpath: //table/tbody//tr//td[[@class="pprice"]<1000000] how price less 1,000,000 , error na. please help. you can try below :- //td[@class='pprice'][. > 4124000] or //table/tbody//tr//td[[@class="pprice"][. > 4124000] or you can use translate keyword of xpath translate(.,translate(., '0123456789,', ''), '') the output be 4,266,240678,260825,0002,185,000589,0007,789,4723,375,0007,780,0001,972,0002,560,0002,541,0001,523,5003,975,0002,845,0004,124,0004,111,0000 or translate(.,translate(., '0123456789', ''), '') it return 42662406782608250002185000589000778947233750007780000197200025600002541000152350039750002845000412400041110000 you can specify element location below: //td[@class='pprice']/tr

mysql transaction - roll back on any exception -

is possible roll automatically if error occurs on list of mysql commands? for example along lines of: begin transaction; insert mytable values1 ... insert mytable values2 ...; -- throw error commit; now, on execute want whole transaction fail, , therefore should not see values1 in mytable. unfortunately table being pupulated values1 though transaction has errors. any ideas how make roll back? (again, on error)? edit - changed ddl standard sql you can use 13.6.7.2. declare ... handler syntax in following way: delimiter $$ create procedure `sp_fail`() begin declare `_rollback` bool default 0; declare continue handler sqlexception set `_rollback` = 1; start transaction; insert `tablea` (`date`) values (now()); insert `tableb` (`date`) values (now()); insert `tablec` (`date`) values (now()); -- fail if `_rollback` rollback; else commit; end if; end$$ delimiter ; for complete example, check following sql f

Best practice: spring configuration xml and java -

what best way inject beans such can have following: greedy initialization of various objects defined beans be able trace definition of beans in ide keep initialization in xml file, there's no "main" file need define annotationconfigapplicationcontext object. the implementation i'm seeing in project has above features, isn't docs recommended, , we've seen undefined behavior. explanation of current implementation have 3-4 java classes @configuration annotation. these classes consist of many @beans. ensures @beans greedily initialized. we have spring.xml defines @configuration class bean. thus, able trace definition of beans since of calls made using configuration class object, like: config.s3client() and of course, there's no need bothering annotation objects. would appreciate thoughts.

Parsing CSV String Using supercsv -

i have been having hard time parsing csv string using supercsv. " 00751016" "auth " " 19.81" " " " " "wa construction ltd " "ghs" " 19.81" " 19.81" basically fields enclosed in "" , separated spaces no headers. appreciated.

android - Could not migrate to Room -

i decided use room in current application. find out there no type 1 column in current schema , room produce illegalstateexception on migration. java.lang.illegalstateexception: migration didn't handle item. expected: tableinfo{name='item', columns={optional_modifiers=column{a_type=column{name='a_type', type='blob', notnull=false, primarykeyposition=0}...} found: tableinfo{name='item', columns={optional_modifiers=column{a_type=column{name='a_type', type='', notnull=false, primarykeyposition=0}...} sql script of table creation: "create table item (" " id text primary key," + " a_type, " //... ") entity class: @entity(tablename = "item") data class item( @primarykey val id: string?, val a_type: string? // used several types, none of them worked ) are there way resolve issue? make modification class annotate

json - Letting user export their data from Firebase database? -

i have pretty run of mill firebase database, , i'd user able export data in json format. noticed if go realtime database console on firebase admin can export json, i'm curious if possible have sort of url user can access if authenticated in order able retrieve own user data.. any ideas? thanks i once developed application option allows user export data txt file on device storage. if think option can you, please use following code: try { file root = new file(environment.getexternalstoragedirectory(), "myfolder"); if (!root.exists()) { root.mkdirs(); } file myfile = new file(root, "myfilename.txt"); filewriter writer = new filewriter(myfile); writer.append(text); writer.flush(); writer.close(); } catch (ioexception e) { e.printstacktrace(); } you might want change name of folder created store of exported txt files myfolder particular one. might want change filename myfilename particular one.

api - limit for access tokens -

i'm creating app uses giigle drive api. google's document says there limit access tokens issued per client-user combination. said 15, 20, 50.(i don't know exact number) but in case, limit of number seems one. i installed app several android machines. the first machine can access-token , refresh-token @ 1 time. in case of second 1 , after, only access-token can acquired. i.e. no refresh-token. does know how solve problem or increase number? ============================================== sep.13 2017 thank "tanaike" kind advice. explanation not good. (because i'm not native english speaker.) anyway, let me explain again. here have 3 android phones, #a , #b , #c. , installed app of them. at first, #a sends request access token google. allow request google account ggg@gmail.com #a can access token , refresh token. next, #b tries same thing same account ggg@gmail.com. #b can access token no refresh token. and next, #c tries same thing.

xaml - background and toolbar apear sometimes xamarin forms -

i have page in xamarin.forms problem is: when it's first time device opened, first page bad loaded , don't know why this xaml <?xml version="1.0" encoding="utf-8" ?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:class="neofly_montana.views.splash2" backgroundimage="abertura.jpg" navigationpage.hasnavigationbar="false"> <contentpage.content> </contentpage.content> the background not loaded , have blank screen, , hasnavigationbar="false" doesn't work...and toolbar appears...but, in first time app oppened...i don't understand that...

vbscript - How to loop every 15 minute and get data from .txt at the same time? -

i have code below taking data .txt , loop every 15 minutes. i'm experimenting value of 9000 shorten time while testing. if successful set 900000 15 minutes. dim fso, path, file, recentdate, recentfile, objfso, objoutputfile, objtextfile, strtext, = 0 while = 0 set fso = createobject("scripting.filesystemobject") set recentfile = nothing each file in fso.getfolder("c:\users\id\documents\data-dtl\vbs\").files if (recentfile nothing) set recentfile = file elseif (file.datelastmodified > recentfile.datelastmodified) set recentfile = file end if next if recentfile nothing wscript.echo "no recent files" else 'wscript.echo "recent file " & recentfile.name & " " & recentfile.datelastmodified const forreading = 1 set objfso = createobject("scripting.filesystemobject") set objoutputfile = objfso

Maximise Handsontable Performance -

how can maximize performance of handsontable? i have been doing background research on , there seems limited information on subject. have been able find information directly on handsontable website. see link below. https://docs.handsontable.com/0.23.0/tutorial-performance-tips.html does know of additional resources on subject? or have tips / tricks have found in personal experience in using product can share?

Remote Invocation of EJB in WildFly 10 using JNDI lookup -

im trying invoke ejb remote server using jndi lookup, im using ejb3 spring-mvc in wildfly 10 , configuration guided in documentation has been done in client , remote server https://docs.jboss.org/author/display/wfly10/ejb+invocations+from+a+remote+client+using+jndi but still i'm not able connection of remote server. 1) created user under applicationrealm , gave permissions master slave setup remote ejb invocation. 2) jboss-ejb-client.properties file, here have given wildfly user_name , password of host server. endpoint.name=client-endpoint remote.connections=one, 2 remote.connection.one.host=172.16.25.26 remote.connection.one.port=8080 remote.connection.one.username=abcd remote.connection.one.password=abcd@123 remote.connection.two.host=localhost remote.connection.two.port=8080 remote.connection.two.username=guest remote.connection.two.username=guest # org.jboss.as.logging.per-deployment=true my exception is javax.naming.authenticationexception: failed connect serve

c# - ASP.NET Core Identity session expires sooner than it is configured to happen -

so in application i've configured identity as: services.configureapplicationcookie(cfg => { cfg.cookie.name = "application_ms_state"; cfg.cookie.expiration = timespan.fromdays(1); cfg.slidingexpiration = true; }); but expiration happens in 20 minutes.could shed light on this? read doc comments. https://github.com/aspnet/security/blob/a53bf093a7d86b35e019c80515c92d7626982325/src/microsoft.aspnetcore.authentication.cookies/cookieauthenticationoptions.cs#l147 expirestimespan , expiration control different things. expirestimespan 1 used sliding expiration.

swift - What does "fatal error: unexpectedly found nil while unwrapping an Optional value" mean? -

Image
my swift program crashing exc_bad_instruction , error. mean, , how fix it? fatal error: unexpectedly found nil while unwrapping optional value this post intended collect answers "unexpectedly found nil" issues, not scattered , hard find. feel free add own answer or edit existing wiki answer. this answer community wiki . if feel made better, feel free edit it ! background: what’s optional? in swift, optional generic type can contain value (of kind), or no value @ all. in many other programming languages, particular "sentinel" value used indicate lack of value . in objective-c, example, nil (the null pointer ) indicates lack of object. gets more tricky when working primitive types — should -1 used indicate absence of integer, or perhaps int_min , or other integer? if particular value chosen mean "no integer", means can no longer treated valid value. swift type-safe language, means language helps clear types of values cod

python - Differential equation using dynamicsymbols in Sympy -

in sympy, tried solve differential equation this: from sympy import * sympy.physics.vector import dynamicsymbols x = dynamicsymbols('x') diffeq = eq(x(t).diff(t), x(t)) dsolve(diffeq, x(t)) but returns typeerror traceback (most recent call last) <ipython-input-10-8a45d7148b24> in <module>() 1 x = dynamicsymbols('x') ----> 2 diffeq = eq(x(t).diff(t), x(t)) 3 dsolve(diffeq, x(t)) typeerror: 'x' object not callable as far understand, dynamicsymbols creates function of t, how use in differential equation? sympy docs bit confusing output of print(x) is in fact x(t) however doesn't mean supposed call x(t) : from sympy import * sympy.physics.vector import dynamicsymbols x = dynamicsymbols('x') diffeq = eq(diff(x, symbol('t')), x) dsolve(diffeq, x) # eq(x(t), c1*exp(t))

android espresso - adb shell am instrument process crashed -

i'm trying run espresso black box test on 3rd party apk file using test apk file. i've set testapplicationid in build.gradle, , targetpackage in androidmanifest.xml. here's commands run: adb install app-debug.apk success adb install app-debug-androidtest.apk success adb shell instrument -w com.example.android.testing.espresso.wikipediatester/android.support.test.runner.androidjunitrunner instrumentation_result: shortmsg=process crashed. instrumentation_code: 0 here's tomcat log: 09-11 22:22:17.065 8576 8576 d androidruntime: >>>>>> start com.android.internal.os.runtimeinit uid 2000 <<<<<< 09-11 22:22:17.098 8576 8576 w app_process: unexpected cpu variant x86 using defaults: x86 09-11 22:22:17.116 8576 8576 d androidruntime: calling main entry com.android.commands.am.am 09-11 22:22:17.118 1510 2317 activitymanager: force stopping org.wikipedia.alpha appid=10102 user=0: start instr 09-11 22:22:17.123 8586 8586 zygo

objective c - openURL: deprecated in iOS 10 -

apple ios 10 has deprecated openurl: openurl:option:completionhandler if have: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"https://www.google.com"]]; how become? options:<#(nonnull nsdictionary *)#> in detail [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"https://www.google.com"] options:<#(nonnull nsdictionary<nsstring *,id> *)#> completionhandler:nil]; thanks update options:@{} empty dictionary no key , value http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl/ write this. handle completionhandler uiapplication *application = [uiapplication sharedapplication]; nsurl *url = [nsurl urlwithstring:@"http://www.google.com"]; [application openurl:url options:@{} completionhandler:^(bool success) { if (success) { nslog(@"opened url"); } }]; without handling completionhandler [application openurl:url options:@{} completionhandler:nil

javascript - How to add Contact page URL in query form? -

i want add page url customer query on ecommerce magento 1.9.2 website https://shubhgems.in/ exp name : test number: 999999999 mail id test@gmail.com massage page url https://shubhgems.in/

c# - xml format date node as dd/mm/yyyy # -

hi parsing xml document code here xdocument doc = xdocument.load(path); xelement person = doc.descendants().where(x => x.name.localname == "person").firstordefault(); xnamespace ns = person.getdefaultnamespace(); dictionary<string, string> dict = person.elements() .where(x => x.name.localname != "iddocumentlist") .groupby(x => x.name.localname, y => y == null ? "" : (string)y) .todictionary(x => x.key, y => y.firstordefault()); foreach (xelement element in person.descendants(ns + "iddocument").firstordefault().elements()) { dict.add(element.name.localname, (string)element); } in dict there field key dateofbirth formatted yyyy-mm-dd . how can reformat field dd-mm-yyyy ? here value of dict after executing code - dict count = 14 system.collections.generic.dictionary<string, string> + [0] {[personobjectid, 111111111]} system.collections.generic.keyvaluepair<string, st

c# - How to write events from multiple applications(sources) to the same event log? -

Image
i have created custom event log , applications write same event log. can see below in image attached, distributedcom , svc ctrl mgr 2 sources writing same event log system . similarly, have 2 services want write same eventlog. tried doing creating 1 event log , passing different source names 2 windows services have created. find 1 service writing log while other doesn't. below class library created event log. public class eventlogger { private eventlog eventlog1 = new system.diagnostics.eventlog(); public eventlogger(string logsource) { if (!system.diagnostics.eventlog.sourceexists(logsource)) { system.diagnostics.eventlog.createeventsource(logsource, "samplelog"); } eventlog1.source = logsource; eventlog1.log = "samplelog"; } public void writelog(string message) { eventlog1.writeentry(message); } created 1st windows service public partial class service1 :

ffmpeg bitrate/quality selection -

i'm attempting copy videos site. stored in 6 different resolutions, hls stream format. when use command ffmpeg -i http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoid=5506754630001 -c copy output.ts highest quality (1280x720). however, when wget .m3u8 can see there other qualities having trouble how copy quality (i.e. 640x380). original link http://www.sportsnet.ca/hockey/nhl/analyzing-five-potential-trade-destinations-matt-duchene/ . i'm hoping can me out this. thank you.

what is the prefer folder structure for laravel + angular -

Image
what prefer folder structure laravel + angular. i want setup new project laravel backend , angular front end. can 1 suggest me, folder structure project maintainable. thanks. i handling angular 4 front end , laravel backend api. think folder should not merged (angular within laravel folder or reverse). make confused. angular works in different way laravel blade. i create 2 different folder, named frontend , backend . angular project runs on port 4200 , set environment angular hit laravel api runs on port 8000.

amazon web services - How to speed up the run time of computation heavy python programs -

i want know how speed running of programs involving lot of computations on large datasets. so, have 5 python programs, each of them perform convoluted computations on large dataset. example, portion in 1 of program follows: df = get_data_from_redshift() cols = [{'col': 'col1', 'func': pd.series.nunique}, {'col': 'col2', 'func': pd.series.nunique}, {'col': 'col3', 'func': lambda x: x.value_counts().to_dict()}, {'col': 'col4', 'func': pd.series.nunique}, {'col': 'col5', 'func': pd.series.nunique}] d = df.groupby('column_name').apply(lambda x: tuple(c['func'](x[c['col']]) c in cols)).to_dict() where get_data_from_redshift() connects redshift cluster, data database, writes dataframe (the dataframe 600,000 rows x 6 columns ). the other programs use dataframe df , perform lot of computation , each program write result in pickle file.

react-native-google-signin package is not giving refresh token -

i implementing google api in react-native app , using react-native-google-signin package google sign-in/oauth. while using code googlesignin.configure({ scopes: ["https://www.googleapis.com/auth/drive.readonly"], // api want access on behalf of user, default email , profile iosclientid: <from developer console>, // ios webclientid: <from developer console>, // client id of type web server (needed verify user id , offline access) offlineaccess: true // if want access google api on behalf of user server hosteddomain: '' // specifies hosted domain restriction forceconsentprompt: true // [android] if want show authorization prompt @ each login accountname: '' // [android] specifies account name on device should used }) .then(() => { // can call currentuserasync`enter code here`() }); although have offlineaccess: true , still, don't refresh token used after original token expires. how refresh token package? or when token

c# - Post request to API is receiving NULL -

i have asp.net core api expecting post request in shape of particular object -- see code sample below. i make sure front-end client sends data in exact shape. make sure inspecting call fiddler data being sent api. when request hits api method though, it's null . my first thought model binder cause of issue. meaning, somehow, data i'm sending not matching object api method expecting. i've been staring @ code few hours , seems ok me. assuming shape of object sent front-end matches object api expecting, else causing issue? i've been using similar code on app , working fine. my code looks this: [httppost("test")] public async task<iactionresult> dosomething([frombody]myobject data) { // logic here... } here few things i'm sure about: i'm hitting api method there no routing issues the point above confirms front-end client sending request i know front-end client sending data -- confirmed through fiddler update: this cau

javascript - How to use loader while page rendering in angular 2? -

i have loader.gif image flag variable show , hide. <div [hidden]="isloading" class="loadingdiv"></div> in html having 200 records without pagination(the requirement not need pagination). felt rendering time taking time(around 5-10 sec). have planed use loader . cutomload() { this.isloading = false; this.tyreandrimlist = this.temptyreandrimlist; // here having 200 records. this.isloading = true; } may guy's misunderstood abouve question .i have tried above code. code run quick unable see loader page rendering taking more time( i don't want set timeout seconds ). decided show loader on starting time of page rendering , hide loader while end of page rendering . don't have idea this. edit i don't want in when change navigation. have using observable in $http call. can use loader. that's not problem. main problem when filter/sort 200 records @ time same 200 records re-rendering. in time w

Android Deep Links and App Links Confused -

Image
can explain in real life example difference between app links - https://developer.android.com/training/app-links/deep-linking.html deep links - https://developer.android.com/training/app-links/index.html app indexing - https://developer.android.com/studio/write/app-link-indexing.html in android? have read many posts , documentations, still cannot exact gist. i understand app links works android 6.0 , deep links 4.2. in performance, doing similar task. if have app or developing app, app indexation , deep linking things need paying attention to. basically, google wants treat app website. wants crawl , index search results can return specific pages app in mobile searches. ability return specific pages within app? that’s deep linking. what deep linking? deep linking, in general sense, involves linking specific content within website or app, rather homepage. here we’re talking in particular getting specific elements of app show in search