Posts

Showing posts from February, 2012

Match a word that starts and end with "##" (Special character) in C# regex -

match word starts , end ## (special character) in c# regex for example: want match "##id##" "##uuid##" could please me? try this: string s = "lorem ipsum ##text## second [lorem ipsum]. how #are you. it's ok. done. #else now."; foreach (match match in regex.matches(s, @"\##[^[\]]*\##")) { messagebox.show(match.value);//here value. }

python - tf.nn.depthwise_conv2d is too slow. is it normal? -

i trying out recent arxiv work called " factorized cnn ", which argues spatially separated convolution (depth-wise convolution), channel-wise linear projection(1x1conv), can speed convolution operation. this figure conv layer architecture i found out can implement architecture tf.nn.depthwise_conv2d , 1x1 convolution, or tf.nn.separable_conv2d. below implementation: #conv filter depthwise convolution depthwise_filter = tf.get_variable("depth_conv_w", [3,3,64,1], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/9/32))) #conv filter linear channel projection pointwise_filter = tf.get_variable("point_conv_w", [1,1,64,64], initializer=tf.random_normal_initializer(stddev=np.sqrt(2.0/1/64))) conv_b = tf.get_variable("conv_b", [64], initializer=tf.constant_initializer(0)) #depthwise convolution, multiplier 1 conv_tensor = tf.nn.relu(tf.nn.depthwise_conv2d(tensor, depthwise_filter, [1,1,1,1], padding='same')) #

ios - Issue in finding time difference -

in app, want know difference between: the total hours worked in week(54.30 hours) and the total hours worked on specific day(10.45 hours) for example, want know value of (54.30 hours - 10.45 hours) in hours. since total hours of week greater 24 hrs, couldn't convert nsdate. use 2 functions,this you the below function return total seconds hour string - (nsnumber *)secondsfortimestring:(nsstring *)string { nsarray *components = [string componentsseparatedbystring:@"."]; nsinteger hours = [[components objectatindex:0] integervalue]; nsinteger minutes = [[components objectatindex:1] integervalue]; //nsinteger seconds = [[components objectatindex:2] integervalue]; return [nsnumber numberwithinteger:(hours * 60 * 60) + (minutes * 60)]; } and below function return formatted time seconds - (nsstring *)timeformatted:(int)totalseconds { //int seconds = totalseconds % 60; int minutes = (totalseconds / 60) % 60;

java - ble beacon transmitter app close once it run -

i trying create app transmit beacons android 5.0 devices error {09-07 10:23:45.184 3057-3057/com.example.mohamed_pc.test2 e/androidruntime: fatal exception: main process: com.example.mohamed_pc.test2, pid: 3057 java.lang.runtimeexception: unable start activity componentinfo{com.example.mohamed_pc.test2/com.example.mohamed_pc.test2.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'android.bluetooth.le.bluetoothleadvertiser android.bluetooth.bluetoothadapter.getbluetoothleadvertiser()' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activ

android - Share user's information with other apps with same signature -

my play store account has on 100 apps published , of them have common user generation process includes otp verification. interesting note apps have same user object same properties particular otp verified number, gets stored in respective sharedpreferences string. for better user experience trim down user generation process if there 1 app installed in device , has done otp verification. want share user object, saved string in each app's sharedpreferences . so here's want when install com.domain.app.cx app: 1) com.domain.app.cx -> (do have verified user?) -> com.domain.app.cy 2.1) com.domain.app.cy -> (yes have, here "user json") -> com.domain.app.cx or 2.2) com.domain.app.cy -> (no don't have user) -> com.domain.app.cx 3) move check if com.domain.app.cz installed , on step 1 options have: 1) have read contentprovider , understood need put in uri of contentprovider package name specific. 2) use package name createpa

resources - Android: asking to add additional or optional raw files after application downloaded market -

i try add external resources apk. firstly, have ask possible for example, 1 downloaded app google market, when app launches, his/her default language , ask "do want download additional mp3 files?". if he/she presses "ok", app download additional resources , starts. i have because i'm using mp3 files in application. these files expand application size more. besides, application supports lot of different language, can not add mp3 files initially. not useful. additionally, know , use localization (values/ values-fr/ values-es/ values-) strings. string files don't expand application size more, not important, mp3 files(raw file) crucial. are there knows how can realize that? thanx u need server contain data "mp3 files" , if user accept ur request think u must donwload json or ever else. u need request permissions on m android.

c# - Realm async usage in Tasks -

i'm trying better understand how use realm in async scenario. far i'm aware realm instance can access objects on thread created. async transaction need new instance of realm using getinstance("somerealmfile"); . there function called task writeasync(action<realm> action) can execute write transaction on worker (background) thread. here's example scenario. app needs make web request. runs async task function go off web , fetch data. request returns , app wants take data parse in realm object , persist database using realm.manage<t>(t obj) . note entire scenario assumes have created realm database on ui main thread begin with. let's assume want stay on background thread @ point, in context of async task function started web request. so we're in situation have results of web request (data) via var results = await webfetch(); , possibly using taskcompletionsource instead , can realm write transactions on worker thread. assume call asyn

php - How to add string to file at server side using AJAX -

i trying save values taken webix textarea file @ server, no luck now. eaqsily php: $filename = getcwd() . "/test.txt"; echo $filename; $line_i_am_looking_for = 5; $lines = file( $filename , file_ignore_new_lines ); $lines[$line_i_am_looking_for] = '6my modified line'; file_put_contents( $filename , implode( "\n", $lines ) ); ?> but don't know how ajax. need - take value textarea, insert (for e.g.) 6th string of data/data.php file. this code: <!doctype html> <html> <head> <title>loading db</title> <link rel="stylesheet" href="codebase/webix.css" type="text/css"> <script src="codebase/webix.js" type="text/javascript"></script> </head> <body> <?php $filename = getcwd() . "/test.txt"; echo $filename; $line_i_am_looking_for = 5; $lines = file( $filename , file_ignore_new_lines )

ipython - Changing Jupyter Notebook start location [Win 7 Enterprise] -

i trying change default jupyter notebook start directory on windows 7 enterprise machine. other answers have suggested changing "start in" field found through right-click>properties>shortcut on jupyter program in start menu, doesn't have effect. when change field desired directory , try running program still opens in default directory, when recheck "start in" field same whatever had changed looks isn't being changed windows, rather it's being disregarded entirely. reference default directory @ p:\ not local directory , hosted on company servers, , trying change jupyter startup directory c:. i'm sure path correct - i've tried few different ones , working autocomplete. should mention locked down corporate machine , have run jupyter administrator or else exits immediately. have elevated rights , have checked user permissions on jupyter. using jupyter comes default current python 3.5 distribution of anaconda - have tried reinstalling whol

angular - how to add angular2-bootstrap-confirm to angular2? -

Image
i new angular-2, trying add angular2-bootstrap-confirm showing cannot errors in console. had followed following docs click here there way this. can 1 me on issue. this trying get.is there way effect. app.component.ts import { component } '@angular/core'; import {confirmoptions, position} 'angular2-bootstrap-confirm'; import {positioning} 'angular2-bootstrap-confirm/position/position'; @component({ selector: 'my-app', template: `<button class="btn btn-default" mwlconfirm [title]="title" [message]="message" placement="left" (confirm)="confirmclicked = true" (cancel)="cancelclicked = true" [(isopen)]="isopen"> click me! </button> `, providers: [ confirmoptions, {provide: position, useclass: positioning} ] }) export class appcomponent { public title: string = 'popover title'; publ

The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing while starting Apache server -

i not able start apache server. have tried solution many times still it's showing same error. solution tried: install windows updates: go start - control panel - windows update check updates install available updates. after updates installed, restart computer. after restart repeat steps above again until no more updates available. download visual c++ redistributable: for windows 64-bit visual c++ redistributable visual studio 2015 (64-bit) windows 32-bit visual c++ redistributable visual studio 2015 (32-bit) run vc_redist.x64.exe (64-bit) or vc_redist.x86.exe (32-bit) , select uninstall run .exe again , select install i have tried these steps it's showing same problem api-ms-win-crt-runtime-l1-1-0.dll file missing. please give me solution.

ios - Using segmented control to switch tableView -

i'm trying change table view cell when segmented control changed here have internal func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { var returnvalue = 0 switch(segmentedc.selectedsegmentindex) { case 0: returnvalue = rest.count break case 1: returnvalue = fullmenu.count break default: break } return returnvalue } i have numberofrowsinsection , cellforrowatindexpath func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell = tableview.dequeuereusablecellwithidentifier("food") as! resttableviewcell var cell2 = tableview.dequeuereusablecellwithidentifier("fullm") as! fullmenutableviewcell switch(segmentedc.selectedsegmentindex) { case 0: let res: rest! res = rest[indexpath.row] var img: uiimage? if let urls = foo.imagestring{

jekyll - GitHub Pages build failure due to "nil was passed to a date-related filter that expects valid dates in atom.xml" -

on jekyll page error once commit github: the page build failed following error: the value 'nil' passed date-related filter expects valid dates in atom.xml or 1 of layouts. any idea how fix it? went through posts , checked front matter can't find wrong...

r - One of the factor's levels is an empty string; how to replace it with non-missing value? -

data frame aebysoc contains 2 columns - factor soc character levels , integer count count: > str(aebysoc) 'data.frame': 19 obs. of 2 variables: $ soc : factor w/ 19 levels "","blood , lymphatic system disorders",..: 1 2 3 4 5 6 7 8 9 10 ... $ count: int 25 50 7 3 1 49 49 2 1 9 ... one of levels of soc empty character string: > l = levels(aebysoc$soc) > l[1] [1] "" i want replace value of level non-empty string, say, "not specified". not work: > library(plyr) > revalue(aebysoc$soc, c(""="not specified")) error: attempt use zero-length variable name neither this: > aebysoc$soc[aebysoc$soc==""] = "not specified" warning message: in `[<-.factor`(`*tmp*`, aebysoc$soc == "", value = c(na, 2l, 3l, : invalid factor level, na generated what's right way implement this? appreciate input/comment. levels(aebysoc$soc)[1] <- "not spe

python - Loop "Forgets" to Remove Some Items -

this question has answer here: strange result when removing item list [duplicate] 4 answers in code trying create function anti_vowel remove vowels (aeiouaeiou) string. think should work ok, when run it, sample text "hey words!" returned "hy lk words!". "forgets" remove last 'o'. how can be? text = "hey words!" def anti_vowel(text): textlist = list(text) char in textlist: if char.lower() in 'aeiou': textlist.remove(char) return "".join(textlist) print anti_vowel(text) you're modifying list you're iterating over, bound result in unintuitive behavior. instead, make copy of list don't remove elements you're iterating through. for char in textlist[:]: #shallow copy of list # etc to clarify behavior you're seeing, check out. put

android - New Firebase cloud messaging server key keeps changing every week -

the server key cloud messaging under project settings -> cloud messaging -> server key keeps changing frequently, once week. this extremely frustrating. our notification server calls fail error code of 401, means it's authorization problem. but once update server key on backend, key see on firebase console, different each time after 401 authorization error, works fine. i have googled best on this, there no documentation, or support available error. meant change much? if so, how can update server_key automatically on end..? there rest api this? i asked directly firebase support issue similar 1 have , told me: if changes server api key in google api console, server api key changed in firebase console. firebase not change server api key without notifying you . make sure no 1 has changed server api key in google api console , server api key same in both consoles. a change in api key occurred once in time have been using firebase. maybe contact fireb

javascript - d3: drawing multiple rectangles using areas -

i need draw draw many filled rectangles inside graph , achieve using svg paths. (i'm not using rect tag because perfomance suffer on time.) my current approach uses d3.svg.area generate path each area, rectangles not being drawn properly. as far understand rendered path attribute, seems path missing moveto per rectangle. the following simplified code of problem. var data = [ {x0:0,x1:50,y0:0,y1:10}, {x10:0,x1:60,y0:20,y1:30}, ]; var width = 500; var barheight = 20; var areafunc = d3.svg.area() //.interpolate('step') .x0(function(d){return d.x0;}) .x1(function(d){return d.x1;}) .y0(function(d){return d.y0;}) .y1(function(d){return d.y1;}); var chart = d3.select('#chart') .attr('width', width) .attr('height', barheight * data.length); chart.append('path') //.data(data) .attr('d', areafunc(data))

objective c - CTLineGetGlyphRuns strange behaviour with NSAttributedString -

i have string, let's "hello" need append in front , @ end "," string looks this: ",hello," want text white , "," in different color. this: [attributedstring addattribute:(__bridge nsstring *)kctforegroundcolorattributename value:[uicolor whitecolor] range:nsmakerange(range.location+1, range.length-1)]; [attributedstring addattribute:(__bridge nsstring *)kctforegroundcolorattributename value:[uicolor yellowcolor] range:nsmakerange(range.location, 1)]; [attributedstring addattribute:(__bridge nsstring *)kctforegroundcolorattributename value:[uicolor yellowcolor] range:nsmakerange(range.length-1, 1)]; later stuff ctframesetterred , cgcontextref ctlineref line = cfarraygetvalueatindex((cfarrayref)lines, index); cfarrayref glyphruns = ctlinegetglyphruns(line); cfindex glyphcount = cfarraygetcount(glyphruns); and in ",hello," example glyphcount returns 3 however! when change code to: [attributedstring addattribute:(__br

jquery - Filtering out null values of object list in JavaScript -

i filtering out null values array using object.keys , map this: // ultimate goal length of list !== null var length = object.keys(mylist).map(x => mylist[x]).filter(x => x !== null).length; i need find alternative way of doing because in ie11 having issues it. interfering functionality of 3rd party control somehow. any ideas? the arrow functions not supported in ie. , equivalent of code is: var mylist = {'1': '1', '2': '2', '3': '3', '4': null}; var length = object.keys(mylist).map(function (x) { return mylist[x] }).filter(function (x) { return x !== null; }).length; console.log(length); because output of object.keys(mylist) array , need filter elements vaues (not null) may reduce to: var mylist = {'1': '11', '2': '22', '3': '33', '4': null}; var length = object.keys(mylist).filter(function (x) { return mylist[

asp.net - Is it possible to use OAuth2 to secure "non-rest" applications -

we have application written in asp.net mvc consists of web (non rest, using razor) , api projects (and other projects, besides point now). authentication in web done using basic forms authentication , authentication in api done using oauth2. having 2 ways of authentication in same application has proven difficult maintain, decided discard forms authentication , use oauth2 both web , api projects. in web project, have store oauth2 tokens in cookies instead of sending them headers. possible use oauth2 secure "non-rest" applications ? if so, there security concerns in doing so? there excellent articles on topics interested. these articles explain details looking for. tokens , cookies . the ultimate guide mobile api security the common oauth2 vulnerability using oauth 2.0 soap api using oauth2 soap asp.net webforms oauth2 multi-tenant resource , wpf client these sites starting point. oauth 2.0 criticized lot security vulnerabilities pointing out comm

node.js - update git version in docker container -

i implementing node.js application in docker, needs make use of git worktree feature. however, if : run apt-get update && apt-get install -y git=2.10.0 it can't find other version after 2.1.0 i building image : from node:4.4.2 how can latest git version supports worktree feature installed on docker container as of time of post, no package repos debian include version beyond 2.9. if need newer version, you'll need download , install source documented on git-scm , or find repo.

Using Google Adsense ads on Angular 2 application -

i there way use google adsense ads on angular 2 app? i've seeing google adsense ads in angular 2 components? answer isn't working me. see blank space instead of ad. i'm trying place responsive ad. did answer in above question said, template code: <div class="text-center"> <ins class="adsbygoogle" style="display:inline-block;height:150px" data-ad-client="my ca-pub" data-ad-slot="my ad slot"></ins> </div> any ideas? the answer in link worked me. better managed improve code can use dynamic slot info. banner.component.ts import { component, afterviewinit, input } "@angular/core" @component({ moduleid: module.id, selector: "google-adsense", template: ` <div> <ins class="adsbygoogle" style="display:block;" data-ad-client="write_your_pub_" [attr.data-ad-slot]="data"

apache - Django Twitter callback goes to IP-adress, not domain -

i got problem twitter redirect going ip-adress of site, not actual domain, after authorization. has been working expected before. i using django project, , ip-adress in allowed_hosts list. twitter application correctly figured domain, not ip-adress, "chooses" use ip, seems. have misconfigured server-side maybe? im bit of django newbie. thanks suggestions.

javascript - Document.importNode VS Node.cloneNode (real example) -

document.importnode in specification node.clonenode in specification this 2 methods work equally. please give me real example in can see difference between methods. alohci right: there's not of difference, since web compatibility forced browsers implicitly adoptnode() before inserting node document . before insert cloned node new document, there's difference: owner document of node returned clonenode(original) same of original node, , new document if call newdocument.importnode(original) . can see difference if use ownerdocument or related properties (such baseuri). but if call importnode on same document original node belongs to, there's no difference whatsoever.

push notification - Android bundle from pending intent always recieved as null -

i tried suggested in stackoverflow - nothing helps. notification works fine, it's loses it's bundle somehow. here pendingintent: notificationmanager notificationmanager = (notificationmanager)getsystemservice(context.notification_service); intent intent = new intent(this, loginactivity.class); // intent intent = new intent().setclass(this, loginactivity.class); intent.putextra(constants.key_bundle_message_from_notification,true); intent.addflags(intent.flag_activity_new_task); intent.addflags(intent.flag_activity_single_top); //intent.setaction("dummy"); pendingintent contentintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notificationcompat.builder nobuilder = new notificationcompat.builder(this) .setsmallicon(r.mipmap.ic_launcher) .setcontenttitle(title) .setcon

java - Can't deply war on Tomcat -

i've spring messaging app i've developed inside of eclipse using local instance of tomcat 8. works fine inside eclipse, when create war , deploy inside webapps directory of tomcat doesn't work. these steps i've done till now. i'm using gradle build system, on windows machine. ran gradlew build . generated war file inside root/build/lib went bin directory of local tomcat , ran start.bat set tomcat running, copied war webapps directory of tomcat. 404 . this catalina.log 07-sep-2016 10:32:21.857 info [main] org.apache.catalina.startup.versionloggerlistener.log server version: apache tomcat/8.0.36 07-sep-2016 10:32:21.858 info [main] org.apache.catalina.startup.versionloggerlistener.log server built: jun 9 2016 13:55:50 utc 07-sep-2016 10:32:21.859 info [main] org.apache.catalina.startup.versionloggerlistener.log server number: 8.0.36.0 07-sep-2016 10:32:21.859 info [main] org.apache.catalina.startup.versionloggerlistener.log os name

c# - MS Access Database Not Maintaining with New Values -

this question has answer here: changes access database not persist when running app in visual studio 1 answer i working ms access db , visual studio 2010. have stored db in bin\debug\ folder. when insert data table or update existing data, work fine 2-4 minutes. have newer values in database. when close project , restart it, old/previous values before insertion/updation. can reason , how can overcome problem? best way store db file in folder , change connection string read/write data folder. need relative connection string

javascript - How to communicate between two siblings components without changing state of parent? -

i new reactjs , faced following problem - have parent component, , 2 child components - list , map . both of these has children items. want when hover component in map - change style of appropriate component in list , vice versa. can handle hover events, if save id of hovered element in parent state, rerender full parent component on each hover. how can avoid this? i'm not using redux or this. no, won't. it rerender elements have changed. , don't worry - o(n) extremely fast. pointed out in comments, if component extremely large - implement intermediate 1 well. here how react implements diff algorithm. rerender in case of: different node types key attribute changed

php - Show excerpt on front page using the_content(); and ACF -

i need show excerpt on home page. have standard post , custom post type 'webinar'. cpt 'webinar' has custom field, using acf 'webinar_description' equivalent of 'description' in normal posts. i able display both, adding filter 'webinar_description' this: add_filter('the_content','add_my_custom_field'); function add_my_custom_field($data) { $data .= get_field('webinar_description'); return $data; } now have both post types displaying, displays entire 'description' or 'webinar_description' field. need trim @ 40 words , add '... read more' 'read more' being link article. i have tried this, works on normal 'post' type field 'description' doesn't work on 'webinar' custom post type -> custom field 'webinar-description' <?php $content = get_the_content(); echo mb_strimwidth($content, 0, 400, '<a href="' . get_permalink(

java - RX Observable - measure execution time (even when nested) -

i'm using appended class measure execution time of observables. works fine, long don't measure nested observables... working fine observable<t> obs1 = ...; observable<t> obs2 = ...; obs1 .compose(rxmeasure.applymeasurement(t.class, "tag1")) .subscribe(); obs2 .compose(rxmeasure.applymeasurement(t.class, "tag2")) .subscribe(); not working observable<t> obs3 = ...; observable<t> obs = obs1 .flatmap(resul1 -> obs2) .flatmap(result2 -> obs3) .subscribe(); this leads result, observables subscribed @ start , means, measurement not correct anymore. here i'm trying execute 3 observables sequentially... what want i want measure function that is not breaking chain is measuring execution time of observable (something time between start/end of observable instead of subscribe/terminate) any ideas? rxmeasure class public class rxmeasure { private static boolean menabled = tru

css - Border image on ul tag html -

Image
i have downloaded image of empty frame i wanted use frame enclose list of business hours <div class="col-lg-5 col-lg-offset-2 col-sm-6"> <div class="content4"> <ul class="grid cs-style" > <li> <figure> <figcaption> <div class="time-table"> <h3><span class="icon icons-ornament-left"></span> <span class="light">opening</span> time <span class="icon icons-ornament-right"></span></h3> <div class="inner-bg js--timetable"> <dl class="week-day" data-day="1"> <dt>monday</dt> <dd>9:00-18:00</dd> </dl> <dl class="week-day light-bg" data-day="2"> <dt>tuesday</dt> <dd>9:00-18:00</dd>

javascript - Python-Selenium-Chrome: how to get access to the whole document property -

i need whole html code of page uses javascript. use selenium module chrome , see different 'find' methods, didn't find sort of ".document" property (like ie.document in vba). there possibility whole result code (after js execution) in string format example?

oracle - Check table names of other users -

i'm in data migration , i've been request check table names, don't have dba permissions , user_table view not useful because tables other user. idea make a query (i'm using oracle sql developer): create global temporary table table_exist (name varchar(50), exist varchar(15)) on commit delete rows / declare v_exist number; begin select (1) v_exist schema.table rownum =1; insert table_exist (name, exist) values ('table','exist'); exception when others insert table_exist (name, exist) values ('table','not_exist'); end; / select * table_exist; / drop table table_exist; the issue when table don't exist sql ignore exception block here error get: informe de error - ora-06550: línea 5, columna 55: pl/sql: ora-00942: la tabla o vista no existe ora-06550: línea 5, columna 3: pl/sql: sql statement ignored 06550. 00000 - "line %s, column %s:\n%s" *cause: pl/sql compilation error. *action: no se ha seleccionado ninguna f

arrays - Import an externally hosted txt file (on github) as PHP code -

i have txt file on github i'd bring php code. the txt file array of arrays, written in proper php syntax. example: <?php $data = []; $data[101] = [ "key1" => "value1", "key2" => "value2" ]; $data[102] = [ "key1" => "value1", "key2" => "value2" ]; ?> i've tried few different methods, including file_get_contents(), file(), , fopen/fread/fclose. each time results in array being broken down more arrays. seems though pulling github code, result difficult manage. so, question is: possible import externally hosted text file php code without breaking down arrays or converting strings? maybe there better method solving problem, believe can accomplished. appreciated!

c++ - Remove comments from file and keep integers -

i trying remove comments .txt file. text file looks this: (* sunspot data collected robin mcquinn *) (* http://sidc.oma.be/html/sunspot.html *) (* month: 1749 01 *) 58 (* month: 1749 02 *) 63 (* month: 1749 03 *) 70 (* month: 1749 04 *) 56 the comments between (* , *).i need keep 58,63,70, , 56 file. my code removing of chars not properly. code looks this: #include <iostream> #include <vector> #include <iterator> #include <algorithm> #include <fstream> #include <string> #include <cctype> #include <numeric> #include <iomanip> using namespace std; int main() { int digit = 1; string filename; //cout getting user path //the compiler parses string literals differently use double backslash or forward slash cout << "enter path of data file, sure include extension." << endl; cout << "you can use either of following:" << endl; cout << "

c# - Error calling WCF webservice through channelfactory - not permissioned -

i using channelfactory call wcf service (as target service location change depending on environment , need url configurable). error: the http request unauthorized client authentication scheme 'anonymous'. authentication header received server 'negotiate,ntlm'. my calling code var mybinding = new basichttpbinding(); var myendpoint = new endpointaddress(webserviceaddress); var mychannelfactory = new channelfactory<iobjectservice>(mybinding, myendpoint); var serviceclient = mychannelfactory.createchannel(); my wcf service web.config system.servicemodel section <system.servicemodel> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> </behaviors> <bindings>

android - Fail-safe strategy/best practice for AAR dependency -

i relatively new android programming. have read books , posts online trying figure out fail-safe strategy handle aar dependency issue, none of them gave me satisfactory answers. we trying develop aar , plan distribute 3rd-party android developers. our aar depends on number of external libs, , 3rd-party developers' projects might use of libs well. not sure how handle of issues arise such transitive dependency scenario. for example, our aar depends on lib of version 1.0. , 3rd-party developer's project depends on lib of version 0.9. when starts use our aar, seems has upgrade 1.0 in order our aar function properly. if 3rd-party dev doesn't have "luxury" upgrade @ will? similar issue exists in other way around, is, 3rd-party developer uses higher version of lib our aar. does such fail-safe strategy exist enable our 3rd-party developers blindly drop our aar projects , works? if not, what's best practice build/distribute our aar, minimal disruption caused

django - Accessing model instances associated with a forms.ModelMultipleChoiceField from the templates -

i'd create form allow visitor pick 1 or several instances of model looks this: class package(models.model): name = models.charfield(max_length=255) image = models.imagefield(upload_to="foo") i have created form looks this: class packageselectionform(forms.form): packages = forms.modelmultiplechoicefield(queryset=package.objects.all(), widget=forms.checkboxselectmultiple()) now, i'd display image associated each package instance in html form in respective label tags (or near), can't manage find way access instances form fields. do see how can? thanks

swift - Use UIView.animateWithDuration inside protocol -

how can use uiview.animatewithduration inside swift protocol? when try use get: ambiguous reference member 'animatewithduration(_:delay:options:animations:completion:)' how can reference uiview ( animatewithduration static method understand)? since can not provide implementation inside protocol declaration itself, should reference uiview class inside default implementation. hope 1 of 3 template cases need: import uikit protocol someprotocol { static func animatewithduration(duration: nstimeinterval, delay: nstimeinterval, options: uiviewanimationoptions, animations: () -> void, completion: ((bool) -> void)?) func animatewithduration(duration: nstimeinterval, delay: nstimeinterval, options: uiviewanimationoptions, animations: () -> void, completion: ((bool) -> void)?) func somecustomfuncforanimate() } extension someprotocol { static func animatewithduration(duration: nstimeinterval, delay: nstimeinterval, options: uiviewan

date - ISO week number in CMD -

how can determine ( iso 8601 ) week number in windows batch file? unfortunately wmic path win32_localtime /format:list has weekinmonth ... i have found very complex solutions . there no easier way? you can use ritchie lawrences's date functions. maintained on gitub. https://ritchielawrence.github.io/batchfunctionlibrary/ here code. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :datetoweek %yy% %mm% %dd% yn cw dw :: :: by: ritchie lawrence, updated 2002-11-20. version 1.1 :: :: func: returns iso 8601 week date calendar date. :: nt4/2000/xp/2003. :: :: args: %1 year component converted, 2 or 4 digits (by val) :: %2 month component converted, leading 0 ok (by val) :: %3 day of month converted, leading 0 ok (by val) :: %4 var receive year, 4 digits (by ref) :: %5 var receive calendar week, 2 digits, 01 53 (by ref) :: %6 var receive day of week, 1 digit, 1 7 (by ref) ::::::::::::

Sub Resource Integrity value for //maps.google.com/maps/api/js -

where find sub resource integrity value script //maps.google.com/maps/api/js? for example: <script src="//maps.google.com/maps/api/js" integrity="sha256-????" crossorigin="anonymous"></script> to generate integrity hash code, can use website : https://www.srihash.org/ you paste url , generate hash online. however, don't think it's possible google maps api. following message : error: resource not eligible integrity checks. see http://enable-cors.org/server.html

sql server - SQLBulkCopy with CLR UDT gives "Could not find method 'Read' for type 'MyNamespace.MyType' in assembly 'MyType'" -

i have written sql server clr user-defined type (udt) in sql server 2012. have been able access though sql test scripts, , have used local variable, defined in table, , tested through visual studio , sql server management studio. we have service uses sqlbulkcopy in generalized fashion pick files placed in directory, insert contents appropriate table. when add udt column in 1 of tables, receive error writetoserver( datatable ) invocation. the udt column being passed system.string, in hope udt's parse() method called within sql server convert internal type. have tried declaring udt class within client program, , passing data udt type directly. in either case receive error message (edited take out proprietary names) could not find method 'read' type 'mynamespace.mytype' in assembly 'mytype' i have reviewed many similar questions can find error message, , refer format of create statement. also, refer clr functions, not clr types, different. min

Cesium: Theming the InfoBox -

i have seen few examples on google groups demonstrate how modify css of infobox. in particular example, javascript used append css link head of document: https://groups.google.com/forum/#!topic/cesium-dev/f0iodd42pei var csslink = framedocument.createelement("link"); csslink.href = buildmoduleurl('path/to/your/css/file.css'); csslink.rel = "stylesheet"; csslink.type = "text/css"; viewer.infobox.frame.contentdocument.head.appendchild(csslink); this, however, has not resulted in changes style of markup. at best, have been able wrap contents of infobox iterating through entities in .then function call subsequent loading geojson dataset. when wrapping contents, can set style values readily apparent in resulting markup. var datasource = cesium.geojsondatasource.load('../data/mgeojson.json').then(function(data) { viewer.datasources.add(data); var entities = data.entities.values; (var = 0; < entities.length; i++) var e