Posts

Showing posts from July, 2014

css - animating using angular animate -

i use .ng-hide set height 0px .ng-hide .bar { height: 0px; } and when .ng-hide remove height set 5px; .bar { transition: height linear 2.5s; border-width: 0px; margin: 0px; height: 5px; } however don't see transition happening. (i expected results like: http://www.w3schools.com/angular/tryit.asp?filename=try_ng_animation_css ) not sure missing here: plnkr: http://plnkr.co/edit/b5lbwksml13boogubhsx?p=preview starting version 1.2 of angularjs, animations not part of core anymore. so means have include angular-animate.js file webpage , reference nganimate module inside of application module <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.js"></script> var app = angular.module('plunker', ['nganimate']);

scope - Angularjs ng-repeat and ng-options are not working in select -

i'm trying values $scope in form using select, undefined values, please me. angular js in code, call agregarmuestra() when submit form, $scope.nuevo_muestra doesn't match when using select , works input . .controller('ctrlregm',function($scope, $state, $http){ $scope.tipos = [{"tipo":"sangre"}, {"tipo":"heces"}, {"tipo":"orina"}]; $scope.nuevo_muestra = {}; $scope.agregarmuestra = function() { console.log($scope.nuevo_muestra); //print empty array console.log($scope.nuevo_muestra.tipo); //print undefined $http.post("/muestra", { tipo: $scope.nuevo_muestra.tipo, }).success(function(response){ $scope.muestras.push(response); $scope.$apply(); }); }; } html this doesn't work <div class="form-group col s12" > <select ng-options="t.tipo t in tipos track t.tipo"

kotlin - Is it possible to hide variables from lambda's closure? -

i'm trying crate type-safe groovy-style builder in kotlin it's described here . problem visibility of lambda receivers in nested lambdas. here simple example. html { head(id = "head1") body() { head(id = "head2") } } receiver of nested lambda body doesn't have 'head' method. nevertheless code compiles , prints this: <html> <head id="head1"></head> <head id="head2"></head> <body></body> </html> it expected there way compilation error on inner head? as of kotlin 1.0 not possible. there open feature request functionality.

android - Retrieve device Gmail accounts -

i trying accounts info configured in gmail application, like, username, email address, etc. i using below code - public arraylist<string> get_email_addresses() { arraylist<string> names = new arraylist<>(); account[] accounts = accountmanager.get(feedbackfragment.this.getactivity()).getaccounts(); if (accounts == null) { toast.maketext(feedbackfragment.this.getactivity(), "cannot access email accounts database", toast.length_short).show(); return null; } if (accounts.length <= 0) { toast.maketext(feedbackfragment.this.getactivity(), "no accounts found", toast.length_short).show(); return null; } (account account : accounts){ names.add(account.name); toast.maketext(feedbackfragment.this.getactivity(),account.name, toast.length_short).show(); } return names; } but no retrieves info have c

html - Why do flex items wrap instead of shrink? -

i wonder if give me simple intro how flexbox layout gets calculated, in priority order, example: <div id="container" style="display: flex; flex-direction: row; flex-wrap:wrap;"> <div style="flex: 1 0 200px; height:200px; background-color: lightgreen;"></div> <div style="flex: 1 1 400px; height:200px; background-color: lightyellow;"></div> <div style="flex: 1 0 200px; height:200px; background-color: lightblue;"></div> </div> i find interesting if make container width smaller 600px; wrap take effect first before shrinking (i set second yellow block flex: 1 1 400px; ) turn 3 rows, shrinking take effect until container reach 200px; i wonder order/rule flexbox layout decided? why not shrink 400 block? and set 3 blocks flex: 1 1 basis size; wrap still happens first. thanks the flex-shrink property comes in handy in single-line flex container

ios - Cancel NSOperationsQueue -

i trying cancel nsoperationsqueue , remove operations queue. called method "cancelalloperations()" doesnt remove operation queue, aware method adds flag operation. how go removing operations queue? or prevent operation queue executing operations have flag? private let mediadownloadoperationqueue: nsoperationqueue = { let queue = nsoperationqueue() queue.maxconcurrentoperationcount = 1 queue.qualityofservice = .background return queue }() func startdownloadprocess() { guard downloadswitchstate == true else { return } let context = databasemanager.sharedinstance.mainmanagedobjectcontext let mediastodownload = self.listofmediatodownload(context) media in mediastodownload { downloadmedia(media) } } private func downloadmedia(media: media) { //check if operation exist operation in mediadownloadoperationqueue.operations { let operation = operation as! mediadownloadoperation if operation.media.object

ajax - select query not working php -

Image
i make ajax page php script , computations on result obtained there , return values. <form id="couponform"> apply coupon: <input type="text" name="addcode" placeholder="apply coupon"> <input class="button" style="margin-left:10px;" type="submit" value="apply"> </form> <script> $('#couponform').on('submit',function(e){ e.preventdefault(); var formdata=$(this).serialize(); var totalprice=<?php if(isset($total))echo $total;else echo'"'.'"';?>; formdata=formdata+'&totalprice='+totalprice; $.ajax({ url:'/cart/couponajax.php', type:'post', datatype:'json', data:formdata, success: function (content) { //something } }); }) </script> the above page calls php script lo

With Django Rest Framework, how can I grab the sub-objects of a specific entity? -

if want to, say, grab of questions of survey 5, “restful” url “ http://domain.com/api/survey/5/question/ “. does drf provide such wouldn’t have override get_queryset() , manually grab survey id out of url , manually filter down question queryset? it seems built in drf such wouldn’t need re-invent wheel each time wanted grab sub objects of specific object, i'm not finding far... i'm using drf 3. a co-worker pointed me this: https://github.com/alanjds/drf-nested-routers , existence of hints such functionality isn't (yet) built drf. after testing around little bit, , appears easy enough use.

java - Delete SQS messages only without deleting the underlying S3 object -

i'm using amazon sqs java extended client library store sqs messages in s3. when delete messages using amazon sqs web interface, messages deleted sqs queue , not s3. however, when use aws java sdk sqs client / extended library client, message gets deleted both sqs , s3. i'm looking retain actual message in s3, rid of sqs messages. there way can achieve programmatically using aws java sdk sqs client or extended client? you create (and maintain) custom version of extended client library, not great solution in long-run. another alternative use s3 event notifications can automatically create sqs message each file uploaded s3 bucket. producer need change use s3 api upload files (rather extended client library queue message). consumer continue use sqs receive message, use normal rather extended library. s3 bucket configured send event notifications . perhaps alternative try mimic did manually through sqs console. wouldn't surprised if effect looking using exten

linux - Find and replace with sed in directory and sub directories -

i run command find , replace occurrences of 'apple' 'orange' in files in root of site: find ./ -exec sed -i 's/apple/orange/g' {} \; but doesn't go through sub directories. what wrong command? edited: here lines of output of find ./ command: ./index.php ./header.php ./fpd ./fpd/font ./fpd/font/desktop.ini ./fpd/font/courier.php ./fpd/font/symbol.php your find should avoid sending directory names sed: find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;

swift - `where` equivalent in type declaration -

i want declare associatedtype conforms protocol specific property, namely rawrepresentable self.rawvalue == string . this got far. protocol statefulview: class { associatedtype statetype: rawrepresentable, hashable } but it's not precise enough. need where clause, where put it?

localization - Measure distance by RSSI in veins4.4 Omnet++5 SUMO0.25 -

i master student working localization in vanets in moment working on trilateration method based on rssi cooperative positioning (cp). considering analogue model : simple path loss model but have doubts in how calculate distance correctly determined phy model. spent time (one day) reading papers of dr. sommer phy models included in veins. would help-me solution? need way to: 1) measure power of receiver when receive beacon (i found in decider class). in decider802.11p received power can obtained line in method decider80211p::processsignalend(airframe* msg): double recvpower_dbm = 10*log10(signal.getreceivingpower()->getvalue(start)); 2) apply formula of rssi accordingly phy model in order achieve distance estimation between transmiter , receiver. 3) asssociate measure (distance rssi) wave short message delivered in applayer of receiver (that measuring rssi). after read paper "on applicability of two-ray path loss models vehicular network simulation"

ios - Sort a relationship in cosmicmind graph's library -

i'm using graph library , need sort relationship relationship.subject field [ " idorder " ] . it's possible it? , if idorder isn't int date? yes can swift 3, in development branch. _ = graph.search(forrelationship: ["t1"]).sorted { (a, b) -> bool in return a.subject!["idorder"] as! int > b.subject!["idorder"] as! int } all best :)

git - Remove a modified file from pull request -

i have 3 modified files (no new files) in pull request @ moment. i remove 1 of files pull request, pull request contains changes 2 files , leaves third in original, untouched state. i have tried couple things (checking out original version of file, etc...) still shows changed file in pr. is there solution this? switch branch created pull request: $ git checkout pull-request-branch overwrite modified file(s) file in branch, let's consider it's master : git checkout origin/master -- src/main/java/helloworld.java commit , push remote: git commit -m "removed modified file pull request" git push origin pull-request-branch

xml - Error: Undeclared namespace prefix x: -

i soap newbie , struggling how resolve error message, {:error, "500", "undeclared namespace prefix \"x\"\n @ [row,col {unknown-source}]: [1,168]"} for below soap envelope. because of terms , conditions of host system trying access, have replaced identifying url , credential info "xxx" , removed majority of objects. <x:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:read="urn://xxx/sdk/readobject" xmlns:obj="http://xxx/object"> <x:header> <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:usernametoken> <wsse:username>xxx</wsse:username> <wsse:password t

apache - htaccess doesn't rewrite all the rules -

as i'm new .htaccess, i'm trying take easy on how use it. i'm rewriting urls though problem is, if rewrite 3 urls, top 1 1 working. rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^forums/([^/]*)/([^/]*)/$ /forums.php?page=$1&sectionid=$2 [l] rewriterule ^forums/([^/]*)/topic/([^/]*)/$ /forums.php?page=$1&topic=$2 [l] errordocument 400 /error.php errordocument 401 /error.php errordocument 403 /error.php errordocument 404 /error.php errordocument 500 /error.php so, if add new rule above first one, 1 working. using wrong way? also, how rewritecond work? try removing [l] flag or create separate rewritecond each rule, rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^forums/([^/]*)/([^/]*)/$ /forums.php?page=$1&sectionid=$2 rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^forums/([^/]*)/topic/([^/]*)/$ /foru

laravel 5 - PHP error method doesn't exist in the Child class, method_exists($child, $method) passes -

working laravel 5.1 here. have created 2 classes, 1 extending other: abstract class activitytimeline extends model which has: $this->fields = [ 'owner_id', 'contact_name', 'mailing_label', 'source_id', 'source_raw', 'initial_referer_raw', 'primary_person', 'connections', ]; foreach ($this->fields $field) { if (method_exists($this, $field)) { dd('the method exists', $this, $field); $timelineactivity[$field] = $this->{$field}(); } } and class contactactivity extends activitytimeline { which has: public function primary_person() { return $this->getprimaryperson($this->record); } the "dd('the method exists', $this, $field);" returns following: "the method exists" contactactivity {#963 ▶} "primary_person" however when if statement passes, , attempt call method checked existence

javascript - Firebase error: Uncaught TypeError: ref.once is not a function -

i trying use firebase upload file enter file in data base @ same time. (i keep track of how many uploads there can rename file unique) uploaded, , put copy in database can not number of how many files in child folder using once() , getchildren() methods. keep getting error. doing wrong? count number error coming here: var ref = firebase.database(); ref.once("value") .then(function(snapshot) { var numbersamples = snapshot.child(sampletype).numchildren(); //number of children }); full code: <script src="https://www.gstatic.com/firebasejs/3.3.2/firebase.js"></script> <script> // initialize firebase var config = { apikey: "aizasyc9jumxovvdgcbvxecvpriactg6ffbwtgg", authdomain: "instasample-d8eea.firebaseapp.com", databaseurl:

javascript - Use the same Apache Thrift server in two different languages -

it's possible use same apache thrift server javascript web , java? @ moment, have threadpoolserver javascript: tserver server = new tthreadpoolserver(new tthreadpoolserver.args(servertransport).processor(processor)); and simple server java: tserver jserver = new tsimpleserver(new args(jservertransport).processor(jprocessor)); both of them share same info. now, have problem somethimes data comes incomplete in 1 of clients , dont know if it's that. if question is, whether or not particular service connected client in arbitrary, thrift-supported language, answer big yes because that's thrift about . now, have problem somethimes data comes incomplete in 1 of clients , dont know if it's that. please add relevant information , such what client language, the thrift protocol/transport setup relevant parts of code, , last not least what error did (stacktrace included, if any) i forgot im using http server connect javasscript. http://cod

javascript - rails 3 escaped html tags unescaped in browser when served as JSON -

i have rails 3.2 app interacts 3rd party xml api data using activeresource. want ensure against xss in 3rd party xml, have enabled: activesupport.escape_html_entities_in_json = true this seems work in xml data , converts < tag in potentially dangerous script call &lt; this: &lt;script>alert('xss')&lt;/script> (not sure why esacpes lt tbh, seems design) problem when convert xml json & send browser, browser sees unescaped. string in json sent browser looks this: \u003cscript\u003ealert('xss')\u003c/script\u003e" can explain why browser converts unescaped string, , suggest workarounds? fwiw i'm using backbone, jquery, jst & ejs if string sent browser 1 in question, it's not browser converting back, it's sent unescaped. however, don't think server needs encode it, it's data, sent in intermediary data format json. is correctly encoded json. have careful when insert dom on client though.

php - group by child entity in laravel 5 with eloquent -

i have tables (simplified): products: id, model_id, color models: id, name and want know how many products have of each model , each color, in sql can way: select models.name, count(*) models inner join products on (models.id = products.model_id) group products.color, products.model_id but can't doit eloquent, code: model::with('products','products.model')->groupby('products.color')->groupby('products.model')->get(); throws error: sqlstate[42s22]: column not found: 1054 unknown column 'products.color' in 'group statement' it's eloquent not knows relationship model products, i'm missing? update: moein sends me in rigth direction, can solve doing this: model::join('products', 'models.id', '=', 'products.model_id') ->selectraw('products.*, count(*)') ->groupby('products.color')

jquery - Distinct Append in Select -

Image
how distinct value of select when append. see sample output below $(document).ready(function(){ $("#example2").on('click',"tr#paymentedit", "click", function(data){ var valuetoedit = new option(($(this).find('td:eq(2)').html()), "value"); valuetoedit.selected=true; $("#paymenttypeedit").append(valuetoedit); }); }); test each option see if 1 exists has value compares , perhaps replace value entered existing 1 (or visa versa) you want avoid using text/label of option value. if don't decide there's no point setting values "value" (use valuetoedit = new option(($(this).find('td:eq(2)').html())); instead) function foo() { var valuetoedit = $('#foo').val(); var uniq = true; var options = $("#paymenttypeedit option"); for(var i=0; uniq && < options.length; i++) { if (valuetoedit.toupp

Exporting all records from datagridview to Excel VB.NET -

i used code export records excel , works fine, exports 1 row. there anyway record data in datagridview? also, i'm not familiar crystal report in vb want use button click event.. dim xlapp microsoft.office.interop.excel.application dim xlworkbook microsoft.office.interop.excel.workbook dim xlworksheet microsoft.office.interop.excel.worksheet dim misvalue object = system.reflection.missing.value dim integer dim j integer xlapp = new microsoft.office.interop.excel.applicationclass xlworkbook = xlapp.workbooks.add(misvalue) xlworksheet = xlworkbook.sheets("sheet1") = 0 datagridview1.rowcount - 2 j = 0 datagridview1.columncount - 1 k integer = 1 datagridview1.columns.count xlworksheet.cells(1, k) = datagridview1.columns(k - 1).headertext xlworksheet.cells(i + 2, j + 1) = datagridview1(j, i).value.tostring() next next next xlworksheet.saveas("d:\vbexcel.xlsx") xlworkbook.close() xlapp.quit() releaseobject(xlap

tsql - T-SQL delete cascade (or trigger) with multiple references to child table -

the problem larger, in nutshell. have 2 tables invoice , address . the invoice table has 2 columns: billingaddressid int , fk address(addressid) shippingaddressid int , fk address(addressid) i declare both of these relationships on delete cascade , can't because causes "multiple cascade paths" error. need able delete invoice record , have delete both address records. so instead, create trigger: create trigger [dbo].[trigger_invoice_deleteaddress] on [dbo].[invoice] delete begin set nocount on delete address addressid in (select billingaddressid deleted); delete address addressid in (select invoiceaddressid deleted); end this flat out doesn't work, get: the delete statement conflicted reference constraint "fk_invoice_billingaddress". conflict occurred in database "example", table "dbo.invoice", column 'billingaddressid'. also tried suggestion: create trigger [dbo].[trigge

java - Trying to use toString to plot coordinates -

this description of assignment i'm stuck trying use tostream. don't want answer guidance problem , using point class in java. thank guys! "prompt user 4 integer values: x1, y1, x2, y2 represent (x,y) coordinates 2 points on plane p1 , p2 respectively. using point class java class library. create 2 point objects p1 , p2 input data, print data both point objects utilizing tostring method." import java.util.scanner; public class point { public static void main(string[] args) { scanner keyboard = new scanner(system.in); int x1, x2, y1, y2; system.out.println("please enter first x coordinate!"); x1 = keyboard.nextint(); system.out.println("please enter second x coordinate!"); x2 = keyboard.nextint(); system.out.println("please enter first y coordinate!"); y1 = keyboard.nextint(); system.out.println("please enter second y coordinate!"); y2 = keyboard.nextint(); point p1 = new point(); point p2 = ne

where is the error in this perl code -

Image
my $secret = int(1+rand(100)); loop: { print "please enter guess 1 100: "; chomp(my $guess = <stdin>); $found_it = 0; given( $guess ) { when ( ! /\a\d+\z/ ) { "not number!" } when ( $_ > $secret ) { "too high!" } when ( $_ < $secret ) { "too low!" } default { "just right!"; $found_it++ } } last loop if $found_it; redo loop; } this code cannot run. cannot find mistakes are! it looks me whatever using isn't recognizing newer keywords using. if aren't already, enable them with: use 5.010; # or higher # or use feature 'switch'; in addition, on newer perl versions, need say no warnings 'experimental::smartmatch'; since implicitly using smartmatch, , way works planned change in future perl version.

ffmpeg - avcodec_open2: PCM channels out of bounds -

i trying read audio rtp stream in application, getting error: [pcm_mulaw @ 03390580] pcm channels out of bounds i can read rtp stream fine ffplay: ffplay -i test.sdp -protocol_whitelist file,udp,rtp i generate rtp stream using command: ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*pi*t)" -ar 8000 -f mulaw -f rtp rtp://127.0.0.1:8554 // sdp v=0 o=- 0 0 in ip4 127.0.0.1 s=no name c=in ip4 127.0.0.1 t=0 0 a=tool:libavformat 57.25.101 m=audio 8554 rtp/avp 0 b=as:64 and here source code: #include "stdafx.h" #include <math.h> extern "c" { #include <libavutil/opt.h> #include <libavcodec/avcodec.h> #include <libavutil/channel_layout.h> #include <libavutil/common.h> #include <libavutil/imgutils.h> #include <libavutil/mathematics.h> #include <libavutil/samplefmt.h> #include <libavformat/avformat.h> } #define audio_inbuf_size 20480 #define audio_refill_thresh 4096

sails.js - How can I wrap sails-mongo db methods for profiling? -

i'm trying setup sails hook miniprofiler profile mongo usage. i'm struggling how wrap db methods in function execute profile. i'm trying via user hook: setupminiprofilermongo(req, res, next) { const adapter = sails.hooks.orm.datastores.default.adapter; const adapterprototype = object.getprototypeof(adapter); const originalmethod = adapter.adapter.find; methodprototype.find = function profiledmongocommand(connectionname, collectionname, options, cb) { sails.log.info(`${collectionname}.find`); return originalmethod.call(adapter, connectionname, collectionname, options, cb); }; } that causes following error thrown: typeerror: cannot read property 'collections' of undefined @ object.module.exports.adapter.find (/users/jgeurts/dev/platform/node_modules/sails-mongo/lib/adapter.js:349:40) @ object.profiledmongocommand [as find] (/users/jgeurts/dev/platform/config/http.js:234:37) any appreciated. tried wrap methods on mongodb package,

css - select dropdown too large (Bootstrap) -

Image
ok, have simple thing on website users can enter phone number , text them, when enter phone number need select item in dropdown list country dial codes, problem dropdown list long textbox makes quite awkward, i've done research , have messed around myself without luck, example here talking (btw use bootstrap framework answer need support bootstrap) as can see text box smaller dropdown list makes kinda weird, somehow scale down dropdown looks better along side text field. thanks reading, appreciated! edit: current code <select> dropdown looks this <select class='form-control'> <option value='213'>algeria (+213)</option> <option value='376'>andorra (+376)</option> <option value='244'>angola (+244)</option> <option value='1264'>anguilla (+1264)</option> <option value='1268'>antigua &amp; barbuda (+1268)</option> <option val

python 2.7 - Conda update is too much time on Centos -

conda taking time on centos. m running command conda --debug update conda. here log not sure why it's taking time. debug:conda.fetch:channel_urls=ordereddict([('https://repo.continuum.io/pkgs/free/linux-64/', ('defaults', 1)), ('https://repo.continuum.io/pkgs/free/noarch/', ('defaults', 1)), ('https://repo.continuum.io/pkgs/pro/linux-64/', ('defaults', 1)), ('https://repo.continuum.io/pkgs/pro/noarch/', ('defaults', 1))]) fetching package metadata ...info:stdoutlog:fetching package metadata ... debug:requests.packages.urllib3.util.retry:converted retries value: 3 -> retry(total=3, connect=none, read=none, redirect=none) info:requests.packages.urllib3.connectionpool:starting new https connection (1): repo.continuum.io debug:requests.packages.urllib3.util.retry:incremented retry (url='/pkgs/free/linux-64/repodata.json.bz2'): retry(total=2, connect=none, read=none, redirect=none) warning:requests.packages

c - usage of lda and ldb in sgemm matrix mulitiplication function -

while debugging matrix multiplication error, arrived @ atlas code. code looks complex , don't want further inside.(no time.. :) ) it's general matrix multiplication alpha*a*b + beta*c , guess result stored in c.(or or b..i'm not sure) https://sourcecodebrowser.com/atlas/3.6.0/_a_t_l___sgemm_8c_source.html could explain how lda , ldb (lead dimension of , b) used? wonder when m, n, k specifies matrix dimension information why lda , ldb needed. question : inside atl_sgemm function, atl_sgemm function being called. called recursive function?

jquery - How to keep background fixed irrespective of scrollbar? -

i writing small scrollbar on div [basically pop div] like: #scrollablediv { position:absolute; width:250px; height: 450px; padding:12px; display:none; margin-top:-1px; border-top:0px; overflow:auto; border:2px #ccc solid; border-radius: 5px; background-color: #eeeef1; color: black; opacity: 1; z-index: 100; } the issue scrollbar reaches end of div, starts scrolling body @ vertically.is there way prevent using css or jquery or anything?

mysql - post call is not working in node js -

i trying perform post call in node js, testing through post not able retrive data, node code, exports.login = function( req, res ) { console.log("params:"+req.body.email); //console.log('email:'+params.email); connection.query('select * profile email ='+req.body.email,function(error,result,rows,fields){ if(!!error){console.log(error) console.log('fail'); }else{ console.log(result); res.send(result); } // } });} my routes, router.post('/login',cors(), admin.login); i getting fail , error is { [error: er_parse_error: have error in sql syntax; check manual corresponds mysql server version right syntax use near '@gmail.com' @ line 1] my input through postman {"email":"s@gmail.com"} don't build query string directly, leaves open injection attacks , chokes on characters, experiencing here. use placeholder so: var query = "select * profile email

javascript - How to save web contents to another html file -

i'm new javascript , electron projects. have small task run webpage in have "download" button, if hit button have contents , sources code downloaded current page. here sample work : browser.js onload = function() { var webview = document.queryselector('webview'); dolayout(); document.queryselector('#back').onclick = function() { webview.goback(); }; document.queryselector('#download').onclick = function() { var urlstr = webview.geturl() alert(urlstr) // alert(webview.getwebcontents()); }; } currently able url in alert view, i'm not able webpage contents note: please give solution in javascript not in jquery finally simple code helped me download html file var htmlcontent = [""]; var bl = new blob(htmlcontent, {type: "text/html"}); var = document.createelement("a"); a.href = urlstr; a.download = "new.html"; a.hidden = true; document.body.appendchild(a); a.innerhtml = "som

android - YouTube Api for channel list -

i newer in youtube api,i need implementing youtube api in android. have find 1 youtube api getting channel list on associated username https://www.googleapis.com/youtube/v3/channels?part=snippet&forusername={username}&key={your_api_key} . have created 3 channels in youtube account above api not getting response. this response above api valid username , api key { "kind": "youtube#channellistresponse", "etag": "\"i_8xdzu766_fsaexeadxtifewc0/ewwrz0vbtypp2egbokvz5m_1mbo\"", "pageinfo": { "totalresults": 0, "resultsperpage": 5 }, "items": [] } use this: https://www.googleapis.com/youtube/v3/channels?part=statistics&id=channel_id&key=your_key you can try api request here: https://developers.google.com/youtube/v3/docs/channels/list#try-it request: http get: https://www.googleapis.com/youtube/v3/channels?part=statistics&id={channel_id}&key={your_ap

sql - MySQL, grouping words and saving them to two other tables -

have 3 tables: products (relevant columns: id, name) wordgroups (relevant columns: id, wordgroup) productwordgroups (relevant columns: wordgroupid, productid) now separate each products.name wordgroups of 1-3 words this: name = "a b c d e" => wordgroups = "a", "a b", "a b c", "b", "b c", "b c d", "c", "c d", "c d e", etc. these wordgroups must saved wordgroups.wordgroup if don't exist in table already. finally, many-to-many relation between table products , table wordgroups must saved productwordgroups if relation doesn't exist in table already. guess can done nasty sql query, far haven't been able trick mysql doing it. thanks. i have solved second part of problem you, if extract letters separate rows given name. the extracting need done in procedure. my code, letters input table , letter column: select * letters union select a.letter||

c# - Uploading file using Managed client object model in sharepoint 2013 -

i have devloped file uploading document library in sharepoint 2013 using managed client object model. here upload.aspx <%@ page language="c#" autoeventwireup="true" codebehind="webform1.aspx.cs" inherits="webapplication7.webform1" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td colspan="2" align="center"> <asp:label font-bold="true" text="upload documents sharepoint 2013" runat="server" id="lblsharepoint" /> </td> </tr> <tr> <td></td&

Plotly in Python: How to add legend when using matplotlib? -

Image
in plotly, can convert matplotlib figure plot.ly: x=[1,2,3] y=[4,5,6] plt.plot(x,y,label='test') fig=plt.gcf() however, if add legend, x=[1,2,3] y=[4,5,6] plt.plot(x,y,label='test') fig=plt.gcf() plt.legend() it return error runtimeerror: cannot window extent w/o renderer i want know problem? plot.ly support legend made matplotlib? adding showlegend=true plt.plot(x,y,label='test') trick.

html - Navigation Submenu is not coming up -

i have created navigation menu sub menu. can please me find out why sub menu coming part of main menu? navigation have options like: home, about, portfolio... portfolio have menu options: web development, motion... issue: web development should have sub menu: bootstrap, css rather coming part of main menu. <div id="navigation"><ul class="navigation"><li><a href="#">home</a></li></ul>/div> body { background: #c4c7cb; background-image: -webkit-radial-gradient(cover, #fff, #d1d1d1); background-image: -moz-radial-gradient(cover, #e8eaec, #a4a8ae); background-image: -o-radial-gradient(cover, #e8eaec, #a4a8ae); background-image: radial-gradient(cover, #e8eaec, #a4a8ae) } html { min-height: 100%; } .navigation { height: 50px; padding: 0; margin: 0; position: absolute; } .navigation li { height: auto; width: 150px; float: left; text-align: center; list-s

github - GIT cherry-pick giving error -

i trying cherry-pick 1 of commit using sha branch giving error. say on branch x , running command git cherry-pick as560aad0138.... in terminal. the error got this; error: commit as560aad0138.... merge no -m option given. fatal: cherry-pick failed the answer right there, in error message. from man git cherry-pick : [...] -m parent-number, --mainline parent-number usually cannot cherry-pick merge because not know side of merge should considered mainline. option specifies parent number (starting 1) of mainline , allows cherry-pick replay change relative specified parent. [...]

c# - How to show partial view -

i have page information, want add there list (in form of table) within partial view. user has have ability sort switching radio box. my problem: code works fine (i have tried in separate view), when try switch radio button (they submit page on change , activate 2nd method, create new model according radio button) html code partial view. in other words: want : html view1 + html mypartial get: html mypartial suppose problem here (calling mypartial ): @html.action("_showemployeeprojects", "employee") but when try use this: @html.partial("partial/_showemployeeprojects") i this: the model item passed dictionary of type 'btghrm.models.employeejobdataviewmodel', dictionary requires model item of type 'system.collections.generic.list`1[btghrm.models.employeeprojecthistorymodel]'. my controllers code: public partialviewresult _showemployeeprojects() { int empid = hrmsession.selectedemployeeid;

exception - java.lang.ArrayIndexOutOfBoundsException using highlighter -

i'm trying selected text jtextfield. found .gethighlighter() function , works. desired text keeps throwing , index out of bounds exception. can tell me why? ps: i've tried checking if h != null , h[0] != null. same result. private void jtextfield1mousedragged(java.awt.event.mouseevent evt) { highlight[] h = jtextfield1.gethighlighter().gethighlights(); jlabel2.settext("selected text: " + jtextfield1.gettext().substring(h[0].getstartoffset(), h[0].getendoffset())); } exception: exception in thread "awt-eventqueue-0" java.lang.arrayindexoutofboundsexception: 0 @ interfacesprueba1.ej3b.jtextfield1mousedragged(ej3b.java:110) @ interfacesprueba1.ej3b.access$000(ej3b.java:14) @ interfacesprueba1.ej3b$1.mousedragged(ej3b.java:42) @ java.awt.awteventmulticaster.mousedragged(awteventmulticaster.java:320) @ java.awt.component.processmousemotionevent(component.java:6583) @ javax.swing.jcomponent.processmousem

javascript - How do I generate a nameless url parameter from a form submit -

i want use form submit generate url looks like: submit.html?a&b=c according w3c spec here: https://www.w3.org/tr/html5/forms.html#attr-fe-name-isindex should able use name="isindex" in order generate nameless attributes. when trying setup this: <input type="text" name="isindex" value="a" /> <input type="text" name="b" value="c" /> it doesn't seem work in chrome (works fine in safari , firefox though) when looking @ mdn there's mentioning html element isindex being deprecated: https://developer.mozilla.org/en-us/docs/web/html/element/isindex but no info name attribute of input element. https://developer.mozilla.org/en-us/docs/web/html/element/input is name deprecated or bug in chrome? there way solve issue standard submit or have js workaround modifying href.

Tableau MarkLogic Data Modelling -

i using tableau marklogic. have following xml structure <customerinformation customerid="1"> <customerbasicinformation> <customertitle></customertitle> <customerfirstname></customerfirstname> <customermiddlename></customermiddlename> <customerlastname></customerlastname> </customerbasicinformation> <customeremplyomentdetails> <customeremployer> <employername iscurrentemployer=""></employername> <customerdesignation></customerdesignation> <employerlocation></employerlocation> <customertenure></customertenure> </customeremployer> <customeremplyomentdetails> <polcydetails> <policy policyid=""> <policyna