Posts

Showing posts from August, 2014

c# - How can I multiply values from 2 dropdown lists in asp.net and display the results in a text box? -

i have lot of dropdown lists building insurance app. each list has number of options given multiplier value. question how can multiply these values separate dropdown lists give myself final multiplier value in textbox? want use whatever value picked each dropdown list. the lists formatted follows <asp:dropdownlist id="points" runat="server"> <asp:listitem value="1.00">0</asp:listitem> <asp:listitem value="1.05">1</asp:listitem> <asp:listitem value="1.10">2</asp:listitem> <asp:listitem value="1.18">3</asp:listitem> <asp:listitem value="1.25">4</asp:listitem> <asp:listitem value="1.32">5</asp:listitem> <asp:listitem value="1.40">6</asp:listitem> <asp:listitem value="1.47">7</asp:listitem> <asp:listitem value="1.55">8</

xml - Looking for an XSLT to convert domino document rich text fields -

i want convert domino rich text field html exporting dxl , using xslt convert rich text html string. has done before? hate start scratch xslt skills sadly lacking. have @ pd4ml. believe free converter includes xslt stylesheet. http://pd4ml.com/command-line-dxl-to-pdf-converter.htm

php - Laravel 5.2 job jammed in database? -

Image
i using laravel queues jobs insert large excel in database , jobs getting jammed , not executing. i chunk file contents(250 rows per job) , inserts of them until stops. insert code (job inserts 250 or less rows) public function handle() { $uuid = uuid::generate(4); $defaultssize = 0; $customsize = 0; $defaultsidfields = []; $customfields = []; if (sizeof($this->matrixdefaultfields) > 0) { $defaultssize = sizeof($this->matrixdefaultfields[0][0]); //size of 1 of vecs in default values $defaultsidfields = $this->matrixdefaultfields[0][0]; // default fields id } if (sizeof($this->matrixcustomfields) > 0) { $customsize = sizeof($this->matrixcustomfields[0][0]); //sizeof 1 of vecs in custom values $customfields = $this->matrixcustomfields[0][0]; // custom fields id } ($i = 0; $i < sizeof($this->matrixcontacts); $i++) { $contact = contact::create(['uuid' => $uui

fine uploader - FineUploader CSV Header Validation -

i have looked through fineuploader documentation , wanted ask community in case missed it. need allow users upload csv file check headers in csv make sure match required. way within fineuploader settings? for instance, making sure csv user uploads has column headers of first name, last name, address, phone. if doesn't match column headers return error message. thanks! this type of custom validation exactly why custom validation callbacks added fine uploader while back. in case, since need access file or blob , can contribute an onsubmit callback returns promise . in callback, can determine if file csv. if is, can read file client-side using filereader , parsing file determine if conforms requirements. if does, fulfill returned promise. otherwise, reject it. note can access underlying file or blob , given file id, via getfile api method .

methods - iOS cancel (void)-execution and dismiss ViewController -

i want cancel long running calculation method , dismiss viewcontroller when app send background. details: after button action in mainviewcontroller new resultviewcontroller shown , long running calculation method started in viewdidload method. calculation method running on main thread totally fine. for case app going background want prevent app killed due not finished calculation method. set applicatindidenterbackground notification used in resultviewcontroller don't know how cancel running calculation method , dismiss resultviewcontroller. thanks. and long running calculation method started in viewdidload method. calculation method running on main thread totally fine. honesty, doubt can labelled 'fine'. proper solution move these calculations background thread , execute them asynchronously. if block main thread long (like in case) won't know app going put background - notification won't processed app's main queue since consume of r

python - Difference between Len and Print Len() -

i've started doing data analysis in python , since didn't learn python scratch feel i've missed few nuances. one thing noticed in 1 of reports had imported data set csv, put in dictionary, manipulated , trying print remaining entries. i used: len(a) len(b) len(c) when did 1 of numbers returning , spent significant amount of time debugging code. in end found similar code online , tried copy syntax. change worked was: print len(a) print len(b) print len(c) i'm trying understand difference between 2 commands. initial thought len printed out count, guess different? does len have 'memory' 1 count? why need add print? len(list) not print anything, returns. if using repl (read - evaluate - print - loop) print returned value , loop. therefore print more 1 must call print. here method documentation

javascript - Code screws up when viewport changes -

i have following function makes 'up-btn' appear @ bottom of page when user scrolls 250px bottom ( , not on mobile) html ( in head tags ) <script> if ($(window).width() > 768) { $(window).scroll(function () { if ($(window).scrolltop() + $(window).height() > ($(document).height() - 250)) { $("#up-btn").fadein(500); } else { $("#up-btn").fadeout(500); } }); }; </script> html (body) <a id="up-btn" href="javascript:void(0);" onclick="scrolltop();"><i class="fa fa-chevron-up fa-lg"></i></a> it works properly. however, when scale window mobile ceen size. or if window opens @ mobile size, etc. code doesn't work , button remains invisible. wondering if there's changes code make more foolproof? just remove if -statement: <script> $(window).on('scroll', function() { if ($(window).scrolltop() + $(window

java - In Object Oriented theory, should a derived class inherit a parent object's Interface? -

i'm self taught hobbyist programmer , knowledge derived seeing compiler , doesn't like. suppose have (in c# notation, java may have other abilities) the class need override looks this: public interface icandosomethingelse { void doit(); } class parent : icandosomethingelse { public void eattacos() { } void icandosomethingelse.doit(string thingtodo) { // implementation } } so this: class child : parent, icandosomethingelse { new public void eattacos() { } void icandosomethingelse.doit(string thingtodo) // new keyword illegal here? { // implementation } } question i observe new keyword illegal in interface. because explicit interface? is there way force children implement interface, or mean need set implicit/explicit cast? i observe new keyword illegal in interface. because explicit interface? the error because you're implementing interface explicitly in classes. explicit implementaton

objective c - IOS Create button to hit a URL without opening in Safari -

i have found code open link upon pressing button, don't want open link, send command web controller without exiting app. [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"192.168.0.100/outlet?5=on"]] is there way modify don't leave app, still send command controller? eventually want send on command, wait 20 seconds, send off command.

machine learning - why Test precision is higher than training precision -

i using tensorflow implement object recognition. followed tutorial use own dataset. https://www.tensorflow.org/versions/r0.8/tutorials/mnist/pros/index.html#deep-mnist-for-experts i used 212 positive samples , 120 negative samples train. test set contains 100 positive , 20 negative samples. training precision 32.15%, test precision 83.19% i wondering makes test precision higher training precision, data set not large enough? data doesn't show statistical meaning? or general thing, because saw people said training precision doesn't make sense. why that? there 2 problems here. first, precision not measure of performance when classes unbalanced. second, , more important have bad ratio of negative positive in test set. test set should come same process training one, in case negatives ~40% of training set ~17% of test set. not suprisingly - classifier answers "true" every single input, 83% precision on test set (as positives 83% of whole data). thus

version control - .git folder that has only link to repository, but no files embedded -

short version of question be: what put .git folder developer able pull newest version server, not have older 1 files embedded .git? reason why need that: i have application's core and other solutions use core. i want use separate git repository core , separate repository every solution uses core. for examples sake, let call core application simple , new project super what have far structure: simple super.config super.web a few comments: simple ----here core files super.config ----here configuration files super.web ----here web project uses core everything works fine , have core files in separate repository , super repository looks this: super.config super.web what want add simple folder super repository .git folder in there wich has core repository url , not files. super project developer able pull latest core version repository. therefore structure want this: simple ----.git super.config super.web and when developer gets structure, he/she pul

css - displaying images horizontally -

the photos on website on top of each other , other photos displaying vertically. have idea how solve this? css: #photo1{ float: left; width: 10px; margin-left: 210px; text-align: justify; } .img-with-text { text-align: justify; width: 200px; } .img-with-text:hover { text-decoration: underline; } i think looking following: try add display: inline-block css on image. example of does: http://jsfiddle.net/hobobne/d5sym/ (credit goes kalle h. väravas example)

networking - golang: how to release a net.Conn from a bfio.Reader -

in go have net.conn wrap bufio.reader. want read , parse number of lines reader, , obtain control on net.conn, obtaining temporary data reader might still have buffered. there easy way it? you can buffered data *bufio.reader using following code: p, _ := br.peek(br.buffered()) where p []byte containing buffered data , br *bufio.reader . many applications use *bufio.reader io.reader after calling readline , related methods. there's no need buffered data in these applications. reader continue reading buffered data needed.

ios - Xcode doesn't recognize GoogleService-Info.plist file after adding Firebase via pods -

Image
i'm trying add firebase , keep getting log message thats says: could not locate configuration file: 'googleservice-info.plist'. i added file in xcode way of file > add new file project . suggestions? it happen me. erase (7). xcode firebase framework connects firebase through googleservice-info.plist when build code error display if .plist file not called exactly: googleservice-info.plist . @ moment .plist file have character in name firebase framework not recognise it. frame work searching 'googleservice-info.plist' not 'googleservice-info.plist (07)' this happens when download several times googleservice-info.plist console. if want avoid this. file out "downloads" carpet. otherwise, computer going add number @ end of name file if have 1 inside carpet. creates copy. hope can help!

wit.ai stories training results unpredictable? -

i trying develop weather bot , have been experiencing problems. i trained systems stories , in understanding tab. behavior of wit seems unpredictable me - combines stories (which supposed guess), seems converse randomly. the intent values not consistent either, using same story. used debugger show intent value. example, "what's weather", trained intent value should forecast_all, becomes "what", , other entities other stories shows such "off_topic" entity created off topic conversations. bot behave differently training story. any insight? doing wrong? did miss? thank help! i feel pain:) you have "force" wit.ai correct stories based on user input , if need user follow story till end - have keep "forcing" them down dialogue chain. what mean this: if user says what's weather can introduce 1 more custom entity name wth , in understanding tab make keywords based , add strict keywords list related weather w

c# - populating sub object using linq -

i have relationship orders --> contentrequest --> institution table. how can populate contentrequest.institution while doing database search? this statement below populate orders , contentrequest model. works fine. list<orders> orderlist = db.orders.include("contentrequest").tolist(); i have orders.contentrequest.institution model populated. you can (using overload of include extension method): var orderlist = db.orders.include(o=>o.contentrequest.institution).tolist(); or can still use include method show in question way: var orderlist = db.orders.include("contentrequest.institution").tolist(); but prefer first solution because typed , in case change name of property or have typing error writing property names, first solution compile error.

sql - AND query a m-to-n table -

i have simple m-to-n table in database , need perform , search. table looks follows: column | column b 1 x 1 y 1 z 2 x 2 c 3 3 b 3 c 3 y 3 z 4 d 4 e 4 f 5 f 5 x 5 y i want able 'give me column has x , y in column b (returning 1 , 5 here), can't figure out how form query. i tried select column_a table column_b = x , columb_b = y seems return if column somehow both. fundamentally possible, or should have different table layout? here's 1 way: select table1 b in ('x', 'y') group having count(distinct(b)) = 2 sql fiddle if guaranteed (a,b) unique, can rid of distinct well.

c - Attach totalview debugger to a variable -

so trying debug code. reason doesn't pass through section need to. governing variable calls piece of code pointer "*sret". tried lot no luck. c program. there way can attach watch point on variable? wouldn't recognize variable...it recognizes file though. @ban, if using totalview debugger great question. yes, provide watchpoints. however, set on memory locations, opposed variables. distinction important because if imagine function calls recursively , local variable x in function. can run program function, dive on x , set watchpoint on it. watchpoint trigger if specific instance of x (which points memory location in stack) written to. won't stop if, example, function calls again (which creates new, distinct, x @ different location in stack) , second x written to. some other capabilities might find useful: you can set value of variable directly in debugger. can use verify if variable has "right" value program behave expect it. you can

Test-Kitchen sync files to remote servers -

i've been using test-kitchen locally vagrant run serverspec tests , haven't had major problems. i'm setting ci process test-kitchen, , using kitchen-google gem provision servers , run serverspec test suite. i have test-kitchen creating servers in gce project correctly, tests failing because necessary files aren't being synced remote server. ideally i'd sync multiple folders home directory of remote machine. along lines of: "./scripts", "/home/test/" "./scripts2, "/home/test/" my .kitchen.gce.yml file below, how can dictate files i'd synced remote machines? --- driver: name: gce project: test-project email: email@test-project.iam.gserviceaccount.com machine_type: f1-micro service_account_name: email@test-project.iam.gserviceaccount.com tags: - test-kitchen service_account_scopes: - https://www.googleapis.com/auth/compute # full control access google compute engine methods. zone: us-central1-a

mongodb - mongo-connector error on ubuntu 14.14 -

the mongoconnector has worked previously, not. here part of long trace of error: ... return f(*args, **kwargs) file "/home/ubuntu/anaconda/lib/python2.7/site-packages/mongo_connector/doc_managers/elastic2_doc_manager.py", line 203, in bulk_upsert ok, resp in responses: file "/home/ubuntu/anaconda/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 160, in streaming_bulk result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs): file "/home/ubuntu/anaconda/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 132, in _process_bulk_chunk raise bulkindexerror('%i document(s) failed index.' % len(errors), errors) bulkindexerror: (u'86 document(s) failed index.', [{u'index': {u'status': 400, u'_type': u'wikis', u'_id': u'574f3f9253a18f8397ecc13a', u'error': {u'caused_by': {u'reaso

calculate median from data.table columns in R -

i trying calculate median value across number of columns, data bit funky. looks following example. library(data.table) dt <- data.table("id" = c(1,2,3,4),"none" = c(0,5,5,3), "ten" = c(3,2,5,4),"twenty" = c(0,2,3,1)) id none ten twenty 1: 1 0 3 0 2: 2 5 2 2 3: 3 5 5 3 4: 4 3 4 1 in table column represents number of occurrences of value. wanting calculate median occurrence. for example id = 1 median(c(10, 10, 10)) is calculation wanting create. for id = 2 median(c(0, 0, 0, 0, 0, 10, 10, 20, 20)) i have tried using rep() , lapply() limited success , after clear guidance on how might achieved. understand likes of rep() having hard code value repeated (e.g. rep(0,2) or rep(10,2) ) , expect. struggling create list or vector repetitions each column. here's data.table way (assuming unique id ): dt[, median(rep(c(0, 10, 20), c(none, ten, twenty)

scripting - How to move an entire row from one sheet to another based on the date in a certain column AND a selection in another column -

Image
so blowing mind right , no 1 can seem me out it. have moved entire row "archive" sheet, not criteria mentioned in title , have been messing 2 or 3 weeks. want able archive entire row 30 days old , has value of "complete". i've been trying incorporate onopen script suggestions appreciated if there way. here onedit script working off of , i've used before (minus criteria want set in place). have edited onopen before , didn't have errors wouldn't work. the checklist sheet i'd pulling row from, "archive" sheet destination moving of row , column 15 i'd find value "complete". can give access test sheet if necessary. function onedit(event) { // assumes source data in sheet named needed // target sheet of move named acquired // test column yes/no col 4 or d var ss = spreadsheetapp.getactivespreadsheet(); var s = event.source.getactivesheet(); var r = event.source.getactiverange(); if(s.getname() == "c

javascript - React-Redux container throws "mapStateToProps() in Connect(ModalRoot) must return a plain object. Instead received undefined." -

i building redux based model/dialog trigger based on dan abramov's solution question: dan abramov's solution the error getting "mapstatetoprops() in connect(modalroot) must return plain object. instead received undefined." here code modal container , code calls it: // code calls modal container import react 'react'; import { provider } 'react-redux'; import { connector horizonconnector } 'horizon-react'; import getmuitheme 'material-ui/styles/getmuitheme'; import muithemeprovider 'material-ui/styles/muithemeprovider'; import routes '../routes'; import store '../store'; import horizon '../db'; import modalroot './modal'; export default () => ( <muithemeprovider muitheme={getmuitheme()}> <horizonconnector horizon={horizon} store={store}> <div classname="app"> {routes} <modalroot /> </div> </horizonconne

java - How can I set videos to "private yet shared" using the v3 YouTube API? -

i work school has institutional youtube account (google apps education). video privacy options public , unlisted , , private . the important bit: private videos can shared either: - institution (i.e., students school account), or - list of specific email addresses. we have tool uses v3 youtube api (java) automatically upload videos youtube. i can use api set privacy: videostatus videostatus = new videostatus(); videostatus.setprivacystatus("private"); but how set sharing (e.g., "shared school.edu") using youtube api? assume it's possible because can done (manually) using youtube's online video manager . it seems more people being left in dark this, questions date years ago. e.g.: youtube api: private video access links yt dev reaction: https://groups.google.com/forum/#!topic/youtube-api-gdata/lkfdtwxjwp8/discussion ( may 2012 ) there not, unfortunately, , don't believe specific functionality added. moreover the b

html form action attribute always send the form data to the server side? -

according w3schools , definition , usage of form action is described follows: the action attribute specifies send form-data when form submitted. my question is, form data send service side using action attribute ? the point of form package bunch of data inputs (and selects etc) http request. http requests sent server. the action attribute tells browser url use that. you can interfere (in sorts of ways, including preventing submission entirely) normal form behaviour using javascript. html 5 introduces the formaction attribute overriding form's action when specific submit button used.

php - Removing id from foreach if user_type is not 5 -

i have page categories in foreach loop, wish remove 1 if user not have user_type of 5, eg the below simple laravel foreach @foreach ($category $cat) {{$cat->id}} {{$cat->title}} on.. @endforeach the category id wish remove 1 unless user_type 5 $user->userprofile->user_type 5 i think have come not sure if the.. best way of doing it. @foreach ($category $cat) @if($user->userprofile->user_type !=5) @if($cat->id != 1) {{$cat->id}} {{$cat->title}} @endif @else {{$cat->id}} {{$cat->title}} @endif @endforeach propably in controller have controller public function whatever() { $category = categorie::all(); if(auth::user()->userprofile->user_type !=5) { $category->forget('put right key here'); // dd $category collection right key } return view('hodor')->with('category',$category); // simple loop in ie

prolog - Is it possible to view all implications of a given predicate being true or false? -

i trying build machine can answer user-given questions have problem don't know how resolve, boils down following: imagine following program: friendlycat(x) :- cat(x), friendly(x). cat("felix"). we want know if felix friendly cat, use friendlycat("felix"). problem we, programmer, don't know if felix friendly cat or not. there way automatically see implications if friendly(x) true of false given x? for example, can output looks this? felix (friendly("felix") = true) false (friendly("felix") = false) i recommend check out constraint handling rules  (chr) . this may best bet reason such constraints , implications. for example: :- use_module( library(chr) ). :- chr_constraint cat/1, friendly/1, friendlycat/1. cat(x), friendly(x) ==> friendlycat(x). sample queries: ?- cat(felix), friendly(felix). cat(felix), friendly(felix), friendlycat(felix). ?- cat(x), friendly(x). cat(x), friendly(x), friendlycat(

javascript - How do I customize the behavior of the base Google Map's place markers? -

Image
i've been working google maps api, , while can add , customize own markers , info windows, base map has these default markers display these info windows when clicked (picture below). is there way remove behavior or implement own (to make them more consistent behavior of markers application adds) when clicking on these locations? for example, it'd nice able add own marker upon clicking these markers. like: defaultmarker.addlistener("click", function () { mymarker = new google.maps.marker({ ... }); }); except... don't know of way grab these default markers. apologies if has been answered before, or if i've missed basic entirely, couldn't find documentation these "default markers", lack of better terminology. the current release version 3.24 of maps javascript api has property clickableicons in map options object: https://developers.google.com/maps/documentation/javascript/reference#mapoptions you can use property tu

fuzzy query in elasticsearch -

i followed tutorial . tried 3 data , worked when add 200 data tutorial "text , id" when did research doesn't work for exemple have { "index": { "_id": 237 }} { "text": "emco"} when research as: get /weef/dicomot/_search {"query": { "fuzzy": { "text": "emco" }}} i got this: { "took": 36,"timed_out": false, "_shards": { "total": 5 "successful": 5, "failed": 0}, "hits": { "total": 0, "max_score": null, "hits": [] }} any suggestion? you using standard analyzer "lowercase" token filter. so "emco" indexed "emco". there 2 solutions solve problem: use lowercase keyword search , search result: get /weef/dicomot/_search {"query": { "fuzzy": { "text": "emco" }}} update index analy

angularjs - Issues achieving search filter results via shared scope between controllers -

in nutshell, trying text entered in search field associated 1 controller in 1 view display search results in different view associated different controller. https://jsfiddle.net/fk8j8s7z/2/ the results of whatever name enter in input field in "first view" needs displayed in "second view" (below it's input field) same way display if entered in same name in input field of "second view" (this primary goal) . please note shared 2 way data-binding between 2 input fields not necessary. used experiment/hack/dirty-way try achieve want because don't know of other better way! if of can primary goal work without 2 way data-binding between 2 input fields preferred , extremely grateful! thank in advance! html/view <div ng-app="app"> <div ng-controller="first"> <h3>first</h3> begin typing here: tom, dick, or harry </br> <br/><input type="text" ng-model=

Parsing MediaWiki text in Java reliably (according to stated criteria) -

i'm trying find api can avoid building (in java) can convert mediawiki syntax html myself. seems sufficiently general problem else should have solved it, far i've been digging around on internet no luck. my first pick mylyn wikitext, seems work somewhat, i'm using maven, , maven repository version still 0.94, , seems support subset of full mediawiki syntax -- in particular, missing ability replace {{quote|sample quote text}} blockquotes. i tried bliki v3.0.19, , seems missing blockquotes. based on quick survey, many of other available options either no longer maintained, still in alpha (e.g. sweble), or projects single contributor, may less bug-free. so, know of java library parsing mediawiki , generating html meets following criteria? (my intent specific , concrete i'm looking for, it's more binary choice matter of opinion.) still maintained -- more specific, it's been updated within last 2 years actually supports mediawiki {{quote}} syntax in a

c# - Get XML attribute and value from elements -

i being provided following xml, no ability change structure: <reportspec> <report reportname="reportname1" filtermode="container" destination="emailtouser:loggedinuser" format="pdf" alertsource="all" criticalstatus="true"> <filter students="all" /> </report> <report reportname="reportname1" filtermode="container" destination="emailtousergroup:useradmins" format="pdf" alertsource="all" criticalstatus="false"> <filter testscore="1234" /> </report> <report reportname="reportname1" filtermode="container" destination="dir:\\net.path.com\reports" format="pdf" alertsource="failing"> <filter grade="all" /> </report> <report reportname="reportname1" filtermode="container" destination=&

javascript - Top navbar items cutting off picture below -

i'm using materializecss style website creating. in order me navbar items towards bottom of navbar, applied top margin items ( #normal-nav ). unintended side effect, picture below navbar gets clipped reason. if remove margin applied li , well. not sure i'm doing wrong. here issue replicated in jsfiddle . in order see issue i'm having, you'll need make window rather large--i have setup items appear on desktop-sized displays. instead of top-margin try : #normal-nav { top: 64px; position: relative; }

Using python, how do I convert dates that are stored as m(m)/dd/yyyy in a csv file to yyyy-mm-dd for use in sqlite? -

i working csv file contains date field, dates formatted 1/8/1986 when need them read sqlite3 database in format 1986-8-1 or 1986-08-01. have seen lot of people talking issue, haven't understood answers being given. here how think work though: specific field, csv reader outputs converter method reparses date in format can used sqlite. don't think sqlite can used make conversion code, otherwise use instead. not sure how converter method work loadcsv method though. if don't want install additional packages can following: >>> datetime import date >>> d = '1/8/1986' >>> date(*reversed([int(x) x in d.split('/')])).strftime('%y-%m-%d') '1986-08-01'

javascript - How to get grease monkey to run on Youtube link changes? -

it's first time using grease monkey, , i'm novice @ javascript, have simple code delete suggested videos on right-hand side of youtube, find can distract me work: var elem = document.getelementbyid('watch-related'); elem.parentnode.removechild(elem); i've tried using addeventlistener() ; while loop settimeout() ; , i've tried setinterval() . none worked. all, including plain code, work if refresh page or arrive @ link external source, if arrive @ video youtube page doesn't. i think has way youtube loads pages, haven't been able find workarounds. ideas? edit: found this , has info on topic, doesn't work. option 1: install ublock origin or adblock plus , , add custom filter: youtube.com###watch-related . option 2 (in case have use greasemonkey): // ==userscript== // @name youtube suggested video hider // @include https://www.youtube.com/watch?* // @grant gm_addstyle // ==/userscript== gm_addstyle('

ios - How to resume playing audio after the camera goes away? -

i'm working on app plays audio in background while using other apps using avaudioplayer. when camera opened music silenced none of methods in appdelegate app lifecycle called can't save playlist position or playback time song. in addition when camera dismissed have app resume playing background music again haven't found callback method allow observe change. do know how observe camera did become active , camera dismissed while app running in background mode? here's how solved it. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(handleaudiosessioninterruption:) name:avaudiosessioninterruptionnotification object:[avaudiosession sharedinstance]]; handle interuption. -(void)handleaudiosessioninterruption:(nsnotification*)notification { //nslog(@"%@",notification); nsnumb

python - Define a function head inside a conf file -

i using dictionary/get construct switch case in python. looks similar one: def switch_function(pluginid, param): switcher = { 'someid': somefunction(param), } return switch_function.get(pluginid, none) however, want to extend dictionary key value pair, defined in conf file. want function head value. function head should head of function, should executed in switch case, specific pluginid. config file this: [asection] pluginid='anotherid' functionhead: anotherfunction2 extending dictionary should easy, possible map function head value inside conf file? the following example give exec clause. dict should extend this: switcher[config["asection"]["anotherid"])] = func then need define func this: #conf #[asection] #pluginid='anotherid' #functionhead: anotherfunction2 #python #config instance of config parser def func (param): exec ("%s(param)" % config["asection"]["functionhead"])

android - AsyncTask with above API 11 makes app crashed -

i using asynctask , gson parse feed , works properly. in 1 fragment getting forced close of app on device above api 11. okay in devices below api 11. code: public class latestsubmissions extends sherlocklistfragment { sharedpreferences prefs; latestsubmissionsadapter adapter = null; arraylist<hashmap<string, string>> submissions = new arraylist<hashmap<string, string>>(); private getsubmissionslisttask submissiontask = null; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { connectiondetector cd = new connectiondetector(getsherlockactivity()); if (cd.isconnectingtointernet()) { prefs = getsherlockactivity().getsharedpreferences( commonutils.preference_name, 0); submissiontask = new getsubmissionslisttask(); submissiontask.execute(commonutils.user_submission_url + pr

windows - How to get WinRM WSDL file? -

i'm interested in adding open source project or creating own interface windows remote management service python. however, difficult create such service when there no web service description file "wsdl" explain me functions , objects available in soap web service provided windows. can 1 obtain wsdl file windows rm 1 can begin consuming service? link question on msdn forum. https://social.msdn.microsoft.com/forums/vstudio/en-us/772aa67f-fe95-488a-ab9a-6bde3a42658e/how-to-get-winrm-wsdl-file?forum=windowsserversolutionssdk it's available in open specifications document ms-wsmv describes wsman in large detail. can download full document msdn site: https://msdn.microsoft.com/en-us/library/cc251526.aspx it detailed in appendix (full wsdl): https://msdn.microsoft.com/en-us/library/dd366131.aspx all can provide links full wsdl far exceeds character limit allowed in post.

android - Cannot call this method while RecyclerView is computing a layout or scrolling -

i tried looking @ answer answers similar question: https://stackoverflow.com/a/31069171/6313011 i getting error: "cannot call method while recyclerview computing layout or scrolling" in adapter class have private boolean monbind init false. then have @override public void onbindviewholder(recyclerviewholder holder, int position) { monbind = true; holder.bindrow(mylist.get(position), position); monbind = false; } and in recyclerviewholder method have: myedittext.setonfocuschangelistener(new view.onfocuschangelistener() { @override public void onfocuschange(view view, boolean focus) { if (!monbind && !focus) { notifydatasetchanged(); //causes error! } } }); i thought using monbind approach fix error apparently not. how fix?

objective c - Pick image and crop image became low quality iOS -

i can pick image gallery , crop image becomes low quality. cgrect value= avmakerectwithaspectratioinsiderect(imageview.image.size, imageview.frame); uigraphicsbeginimagecontext(imageview.image.size); [imageview.image drawinrect:cgrectmake(0,0, value.size.width, value.size.height)]; uiimage *img= uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); please 1 me figure out issue. you need create context uigraphicsbeginimagecontextwithoptions, , pass in scale of 0. call uigraphicsbeginimagecontext not allow retina images.

Enthought Canopy package manager upgrade/install error -

i have installed v1.7.2.3327 , have been unable package manager update or install packages. shows 11 updates available, none update correctly. have tried install statsmodels have encountered errors well. running in windows 10 build 10240. example, when attempting install statsmodels 0.6.1-16 repeatedly install error - try again. history shows following: warming up... traceback (most recent call last): file "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action_worker.py", line 54, in run file "build\bdist.win-amd64\egg\canopy_dashboard\packman\package_action.py", line 193, in execute file "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 352, in <lambda> file "build\bdist.win-amd64\egg\canopy_dashboard\packman\packman.py", line 889, in _install file "build\bdist.win-amd64\egg\canopy_platform\cpython_packages_manager.py", line 85, in install_package file "build\bdist.win

CSS - Border bottom length fixed to 60% -

this question has answer here: border length smaller div width? 10 answers i need on border-bottom length. want set border-bottom length 60%. can using inner div like: #mydiv { background: #fed; _border-bottom: 5px solid red; } #mydiv div { margin: 5px 0px; width: 60%; height: 5px; background-color: red; } <div id="mydiv"> div <div></div> </div> but don't want use div, want achieve using border-bottom, search in google , stack no luck. thanks in advance. you can use pseudo element this: #mydiv { background: #fed; position: relative; } #mydiv::after { content: ""; width: 60%; height: 5px; background: red; position: absolute; bottom: -5px; left: 0; } <div id="mydiv"> div </div>

mysql - How to force rsyslog ommysql use utf8? -

i'm using ommysql in rsyslog transfering data mysql $modload ommysql local6.* :ommysql:localhost,syslog,rsyslog,1 but cyrilic data goes "·Ð¾Ð²Ð°Ð½Ð¸Ðµ иÑ�точнÐ" in database. i think it's because ommysql doesn't set utf8 encoding , starts inserting @ once it's connected: http://s017.radikal.ru/i441/1606/e0/050cf30c495f.png is way «set names utf8;» before inserting? that should have said ование , correct? when trying use utf8/utf8mb4, if see mojibake , check following. discussion applies double encoding , not visible. the bytes stored need utf8-encoded. the connection when inserting , selecting text needs specify utf8 or utf8mb4. the column needs declared character set utf8 (or utf8mb4). html should start <meta charset=utf-8> .

python - Printing certain strings different colour with termcolor.colored? -

Image
i print strings in different colours in python. need modify code: board_p1 = [] board_pc = [] board_size=6 x in range(board_size): board_p1.append(["[w]"] * board_size) board_pc.append(["[w]"] * board_size) def print_board(board): if board == board_p1: print colored("\n computers board: ",attrs=['underline']) row in board: print " ".join(colored(element,"cyan") if element != "[x]" else colored(element,"red") if element != "[h]" else colored(element,"magenta") element in row) if board == board_pc: print colored("\n players board: ",attrs=['underline']) row in board_pc: print " ".join(colored(element,"cyan") if element != "[s]" else colored(element,"green") if element != "[x]" else colored(element,"red") if element != "

oracle - How to validate the database after migration -

we have oracle 11g database running on amazon ec2 , trying migrate amazon rds. both source , target oracle db. best way validate tables , data in both source , target after migrating database. how make sure migrated without data loss. thanks in advance. create database link old_db old database , compare data select * tab1 minus select * tab2@old_db union select * tab1@old_db minus select * tab2@old_db the result of select must empty select desired tablenames by select table_name user_tables and build select statement above execute dynamically table table, like declare l_found number; l_sql varchar2(500); begin l_rec in (select table_name user_tables) loop begin -- assume database link old_db exists l_sql := 'select 1 dual exists (select * ' || l_rec.table_name || ' minus select * ' || l_rec.table_name || '@old_db union ' || 'select * ' || l_rec.table_name ||

Does Wowza rtsp server support basic authentication? -

currently i'm creating demo app streaming video android devices wowza server. when try connect authenticate rtsp client, wowza server seems ignore it. here rtsp request , rtsp response server. options rtsp://my_rtsp_server_address:1935/ rtsp/1.0 cseq: 1 authorization: basic ywrtaw46mtiz47== rtsp/1.0 200 ok cseq: 1 server: wowza streaming engine 4.4.1 build17882 cache-control: no-cache public: describe, setup, teardown, play, pause, options, announce, record, get_parameter supported: play.basic, con.persistent actually username , password admin:1234, after encoded base64 became ywrtaw46mtizna==, when tried replace wrong value , wowza server did not take care , still return success code. my question wowza server support basic authentication or digest authentication. read on https://www.ietf.org/rfc/rfc2326.txt rtsp authorization, not exist anymore. thank supporting! please refer following link: wowza rtsp stream authentication

html - How can I code cellspacing=0 so it is valid HTML5? -

this question has answer here: in html5, respect tables, replaces cellpadding, cellspacing, valign, , align? 5 answers i have html looking this: <table class="table" style="clear: both;" width="100%" cellspacing="0"> my ide telling me width , cellspacing not valid html5. is there way can code valid? well, use border-collapse: collapse; css rule (which has same effect: no space between table cells). note may not work in older browsers ie 5 or 6, if need support them out of luck. <table class="table" style="clear: both; border-collapse: collapse; width: 100%;">

javascript - If i have a script inside a div, how do i get the id of that particular div? <br> -

if have script inside div, how id of particular div? (so can below, varying div id's): <div id="chart_div1" class ="googlepie"> <script type="text/javascript"> drawchart('chart_div1'); </script> </div> [edit]: have 2 html views when 1 view's button clicked second view shown. some javascript reconstructs html this, , wanted charts shown on second view, have click event handling this. strangely, have managed load particular chart in particular div (of multiple repeated), above, putting script calls drawchart() in div itself. reason couldn't relocate script more comfortable position have suggested. also, no matter suggested methods fetch parents div 'id' tried, kept getting 'undefined container' error. for example didnt work me: <div class ="googlepie" id="chart_div1" style ="position:absolute; top: -8%; left:63%;"> <script type="text/jav

CodeIgniter Unable to connect ftp hostname -

i been searching possible cause of problem "unable connect ftp server using supplied hostname." codeigniter ftp library, got hard time on it. been trough solutions. web server , ftp server(nas) connected each other. function index(){ $this->load->library('ftp'); $config['hostname'] = 'artinite.comps.net'; $config['username'] = 'artinite\dev'; $config['password'] = 'password'; $config['port'] = 21; $config['passive'] = true; $config['debug'] = true; $this->ftp->connect($config); $this->ftp->close(); } i thankful help.

html - My jquery product slider has a big grey butt -

Image
sorry title because don't know how describe question in 1 sentence. i made picture describe better(this picture took while sliding.) i'm using caroufredsel slider plugin , great, styling has been pain in butt me.whati want make sure slider doesn't have weird boarder/grey box more , slides ends on far edge slider starts in above picture. here html: div class="list_carousel"> <ul id="foo2"> <li>c</li> <li>a</li> <li>r</li> <li>o</li> <li>u</li> <li>f</li> <li>r</li> <li>e</li> <li>d</li> <li>s</li> <li>e</li> <li>l</li> <li> </li> </ul>

asp.net mvc - LabelFor is showing property name instead of Display attribute -

my model is: public class mymessage { [required, display(name= "recipient id")] public string recipient; [required, display(name ="message")] public string text; } my view is: @model mymessage @html.labelfor(m=>m.recipient) @html.textboxfor(m=>m.recipient) <br/> @html.labelfor(m => m.text) @html.textboxfor(m => m.text) the rendered output showing property name instead of display attribute. have done wrong? change fields in model properties public class mymessage { [required, display(name= "recipient id")] public string recipient { get; set; } [required, display(name ="message")] public string text { get; set; } } the modelmetadata.displayname not set fields. , need anyway because defaultmodelbinder not set value of fields, when submit form, values of recipient , text have been null despite text entered in textboxes , modelstate have been invalid because of [require