Posts

Showing posts from September, 2010

Detect Click into Iframe using JavaScript -

i understand not possible tell user doing inside iframe if cross domain. track if user clicked @ in iframe . imagine scenario there invisible div on top of iframe , the div pass click event iframe . is possible? if is, how go it? iframes ads, have no control on tags used. is possible? no. can detect mouse going iframe, , potentially (though not reliably) when comes out (ie. trying work out difference between pointer passing on ad on way somewhere else versus lingering on ad). i imagine scenario there invisible div on top of iframe , the div pass click event iframe. nope, there no way fake click event. by catching mousedown you'd prevent original click getting iframe. if determine when mouse button pressed try invisible div out of way click go through... there no event fires before mousedown. you try guess, example looking see if pointer has come rest, guessing click might come. it's totally unreliable, , if fail you've lost click-t

What's wrong with my R function for computing conditional means? -

i've begun teaching myself r, , decided try create function calculates mean of variable in data frame conditional on variable in same data frame equalling value. here code: conditional.mean <- function( df, tv, cvar, cval ) { col1 <- df$tv col2 <- df$svar subdf <- data.frame( col1, col2 ) tv.cond <- subdf[ which(col2==cval), 1 ] x <- mean( tv.cond ) return( x ) } df data frame, tv target variable conditional mean computed, cvar variable used in condition, , cval value checked cvar . when run code above, function outputs na , gives following warning: " in mean.default(tv.cond) : argument not numeric or logical: returning na ." don't understand why saying this, since tv.cond should vector of values of target variable cvar = cval . thanks help!

r - How to get the time of sampling in rjags? -

i have implemented lda model rjags. , got final samples with: jags <- jags.model('../lda_jags.bug', data = data, n.chains = 1, n.adapt = 100) update(jags, 2000) samples <- jags.samples(jags, c('theta', 'phi', 'z'), 1000) now can use samples$theta or samples$phi result of theta , phi . how can know how long did take sample? thanks! as @eipi10 states can use system.time() around update() call time process within r. or, can use runjags package prints (total) time taken in updating model, including previous calls extend.jags: library('runjags') results <- run.jags('../lda_jags.bug', monitor = c('theta', 'phi', 'z'), data = data, n.chains = 1, adapt = 100, burnin = 2000, sample = 1000) results # or: jags <- jags.model('../lda_jags.bug', data = data, n.chains = 1,

javascript - How to get iframe's readyState -

this html <div ng-if="isloaddone" class="col-xs-12"> <div class="text-center"><span class="fa fa-spinner fa-pulse fa-5x fa-fw margin-bottom"></span></div> </div> <iframe id="appid" ng-if="isloaddone" class="app-iframe" ng-src="{{trustedapplurl}}"></iframe> and in javascript: $elem = angular.element('#appid'); in debug console $elem show context:document ....... readystate: "complete" i don't know how readystate using $elem $elem.context.document.readystate didn't work. idea how readystate using $elem thanks you use readystatechange , onload determine it, like: //check ie if (navigator.useragent.indexof("msie") > -1 && !window.opera){ youriframe.onreadystatechange = function(){ if (youriframe.readystate == "complete"){ alert("iframe loa

html - Why doesn't bootstrap nav-bar open on small screens? -

this nav-bar works fine when screen larger 640px , when menu-button displayed on small screens, clicking not show menu items. here site . <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bhc-navbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">bunker hill</a> </div> <div class="collapse navbar-collapse"

vba - split a value from a range of column and color the duplicate value using vb macro -

i have bolow requirement of had achieved few still need help if status in g column = ready retest or passed then if there values in column c, take/split duplicate id in column c separated comma(,) search duplicate id in column , mark green color [![example data][1]][1] ex. in row 1 defect id cms-921 there 2 duplicate id 44 , 163693. need values in column a. if status of defects (44 , 163693) not closed need mark entire row in green color example of current code: sub findduplicatecolorit() last row dim report worksheet dim integer, j integer dim lastrow integer set report = excel.worksheets("sheet2") lastrow = report.usedrange.rows.count application.screenupdating = false = 2 lastrow j = 2 lastrow if report.cells(i, 4).value <> ""_ , report.cells(i, 7).value = "ready retest"_ , report.cells(i, 1).value = "jira" 'this omit blank cells @ end '(in

asp.net mvc - pass query table to another function in mvc c# -

i got problem here , hope can assist me solve problem. problem is: im using c# , mvc. want pass db table function. dont know how solve this.. hope out there can me public actionresult index() { var viewmodel = db.test.tolist() exportexcel(viewmodel); //pass current table excel export return view(viewmodel); } //export excel public actionresult exportexcel(xxxx viewmodel) { var grid = new gridview(); grid.datasource = p in viewmodel select new { name = p.name, no = p.staffno }; grid.databind(); response.clearcontent(); response.buffer = true; response.addheader("content-disposition", "attachment; filename=myexcelfile.xls"); response.contenttype = "application/ms-excel"; response.charset = ""; stri

asp.net core - Visual Studio Code: Failed to launch external program dotnet -

visual studio code 1.0.0 mac os x 10.11.4 dnx installed , can run .net core application terminal. getting following error when try run .net core project. output window: failed launch external program dotnet . spawn dotnet enoent any suggestions? i experienced problem today - seems caused running zsh shell , launching vs code terminal. when launch bash or using spotlight works. apparently vs code has hacky dependencies on bash - there discussion issue here: https://github.com/microsoft/vscode/issues/8434

java - NullPointerException at mapFragment.getMapAsync -

after going through questions relating title, couldn't find solution problem. having nullpointerexception @ mapfragment.getmapasync . below mapactivity code. package com.example.jerofad.mylocation; import android.app.fragmentmanager; import android.support.v4.app.fragmentactivity; import android.os.bundle; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; public class mapsactivity extends fragmentactivity implements onmapreadycallback { private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_maps); // obtain supportmapfragment , notified when map ready used. supportmap

arrays - Visual C# converting custom IEnumerable to string[] -

i writing plugin code in c# , there custom ienumerable in fact array of strings. no string operations can done on array elements because not of type <string> . need them strings , have operate on them strings. so have added these 2 lines of code turn array string: var arrayrawsourcetext = editorcontroller.activedocument.activesegmentpair.source.allsubitems.toarray(); string[] arraysourcetext = new string[arrayrawsourcetext.length]; (int = 0; < arrayrawsourcetext.length; i++) { arraysourcetext[i] = arrayrawsourcetext[i].tostring(); } only 2 lines, yet wonder if there simpler way of converting array <string> . lambda expression or other way make simpler. if allsubitems implement ienumerable guess code snippet should work : var arraysourcetext = editorcontroller.activedocument .activesegmentpair .source .allsubitems

storage - Best way to store and push contact info on Cordova apps -

i writing cordova-based app, serves organisation's internal phonebook app. contains data of individuals, such phone number , e-mail the employee database on microsoft sql server. planned database partially duplicated on client side, making app usable while offline. so, here questions , concerns: in format should store data? json seems not when it's time searching. how store data? if it's json, fliereader/writer seems okay, if it's not json it's going harder. what best way duplicate database? have admit have no idea here. html5 storage in cordova has been known come couple of quirks. need first identify device platform supporting can pick best choice html5 storage option . one alternative i've seen people use pouchdb . makes database syncs easier manage. know you're using ms sql server, still might want take look. see if microsoft has similar.

android - How to find distance between two locations (By latitude and longitude) in kilometers -

i developing android app track current location latitude , longitude , store in external database.here having list of latitudes , longitudes.i populated them using custom adapter . but,here need distance 1 base latitude , base longitude remaining items latitude , longitude.here base latitude , longitude selected user self.here below list explains have selection lat long distance ------------------------------------------------- checkbox1 123.4546 456.48751 text checkbox2 123.4546 456.48751 text checkbox3 123.4546 456.48751 text checkbox4 123.4546 456.48751 text if user selects check-box 1 have find distance check-box 1 lat long check-box 2,check-box 3,check-box-4 lat long in kilometers , display in respected position . code adapter had written not showing results. public class locations_adapter extends baseadapter { public string distance_string; context context; list<l

jquery - Fade out current and fade in anchor on JavaScript -

i've got simple problem don't know how deal because i'm learning javascript what want link navigation anchor fade in/out content. that, must current page id , anchor href javascript. this got far: (please note in script simple calling method don't know yet) $(btn).click(function(e){ $(*/current page/*).fadeout('slow', function(){ $(*/destiny page/*).fadein('slow'); }); }); #page2, #page3 { display:none; } <div id="page1"> page 1 content <br> <a href="page2" id="btn">show page 2 , hide page</a> <br> <a href="page3" id="btn">show page 3 , hide page</a> </div> <div id="page2"> page 2 content <br> <a href="page1" id="btn">show page 1 , hide page</a> <br> <a href="page3" id="btn">show pag

javascript - new Date() with ISO 8061 date creates date according to timezone -

if create date object new date('2015-03-25') , i'm getting object tue mar 24 2015 16:00:00 gmt-0800 (akdt). expected ? is expected? unfortunately ecma tc39 decided date forms of iso 8601 strings should treated utc , not local (per iso 8601). you might care read matt johnson's blog on issue . the only reliable way parse date strings manually. library can help, not necessary.

jQuery Validation with Bootstrap Tabs -

i have form multiple bootstrap tabs , inside them multiple input , select fields, required , not. i using jquery validation plugin validate form. below highlight , unhighlight errors using bootstrap css working fine: highlight: function(element) { $(element).closest('.input-group').addclass('has-error'); }, unhighlight: function(element) { $(element).closest('.input-group').removeclass('has-error'); }, what need if tab has not validated field, want tab highlight. i used below code, funny thing code works , highlights tab red colour, , doesn't work. if($(".tab-content").find("div.tab-pane:has(div.has-error)").length != 0){ $(".tab-content").find("div.tab-pane:has(div.has-error)").each(function(index, tab){ var id = $(tab).attr("id"); $('a[href="#' + id + '"]').tab('show').addclass('bg-danger');

Url rewrite in CodeIgniter -

my url websitename/package?some-text some-text alias , using fetch values db want see url websitename/some-text using codeigniter framework , package controller please me.. please try using htaccess file below redirect 301 /package?some-text http://websitename.com/some-text you can use this site generating htaccess rules. edit please change content of htaccess to rewriteengine on rewritecond %{request_uri} ^/package?some-text [nc] rewriterule ^.*$ /some-text#%1 [l] edit - 2 you can try in tyhe codeigniter routes.php file, like $route['some-text'] = "package_some-text"; $route['default_controller'] = "web"; $route['404_override'] = 'web/not_found';

generics - Instantiate array of associated type in Swift -

i'm going through "guided tour" playground comes swift 2.2. in chapter on generics, extraordinarily cumbersome function declaration dumped on you: func anycommonelements <t: sequencetype, u: sequencetype t.generator.element: equatable, t.generator.element == u.generator.element> (lhs: t, _ rhs: u) -> bool { lhsitem in lhs { rhsitem in rhs { if lhsitem == rhsitem { return true } } } return false } anycommonelements([1, 2, 3], [3]) the function returns whether or not 2 sequences have elements in common, simple enough. the exercise chapter modify function return array of common elements between 2 sequences. function needs have return type like (lhs: t, _ rhs: u) -> [t.generator.element] which seems simple enough, make array , put common elements in it, return it. nothing in book far has taught me how make new array of type [t.generator.element] , don't know how proceed. naturally a

plsql - Getting an error while trying to update the column of a table by calling a function to set it s value :PLS-00231 -

here's update statement that's throwing error: pls-00231: function 'f_get_mustgo_lookahead' may not used in sql update gt_network gt set u_look_ahead = f_get_mustgo_lookahead(gt.u_smart_cd, gt.u_must_go_multi), u_must_go = f_get_mustgo_lookahead(gt.u_smart_cd, gt.u_look_ahead_multi); f_get_mustgo_lookahead private function , parameters have been passed function column values table. function f_get_mustgo_lookahead --f_get_mustgo_lookahead function takes input parameters smart_code , multiplier , returns value u_must_go , u_look_ahead (in_smart_code in varchar2, in_multiplier in float) return number l_type_mustgo_lookahead number; begin select (closedt.eff - opendt.eff) l_type_mustgo_lookahead (select eff (select eff scpomgr.caldata cal=in_smart_code , opt=1 order eff )where rownum=1) opendt, (select eff from(select eff scpomgr.caldata cal=in_smart_code , opt=2 order eff )where rownum=1) close

django - where to place .htaccess on elastic beanstalk python -

i'm trying remove www url, , using .htaccess file rewrite rule. don't know put file in elastic beanstalk folder structure, or have created. i've tried placing .htaccess in 1. /var/www/html 2. django application folder 3. same folder wsgi 4. django templates folder 5. in root of project folder. none of these have made difference. interested either place .htaccess file, or way remove www might django specific. apache's allowoverride set none default. have .ebextensions touches change default allowoverride on documentroot folder. you can verify connecting instance through ssh , check httpd config.

Jquery.height() return 0 for an img tag -

<script type="text/javascript" src="jquery-1.4.full.js"></script> <body> </body> <script type="text/javascript"> var jdialog = $('<div id="avatar_button_clipdiv" style="width: 668px; height: 425px">\ <img width="668" height="900" src="http://localhost/1_tmp.jpg" style="">\ </div>').appendto('body'); console.log(jdialog.find('img')); console.log(jdialog.find('img').width(),jdialog.find('img').height()); </script> this code works fine after put alone in file,the height() returns right value instead of 0,but when put full html file,it returns 0 instead of real value,it weired , not have idea on possiblely make act differently. i've edited css file before run code,can not remember lines of css had edited.the selectors correct , i've checked return object,nothing wrong either in seperat

WSO2 MB vs Apache Kafka -

i've been working both apache kafka plus wso2 message broker in order publish , consume messages using topics . apart changing jndi properties in wso2 mb, configurations in integrating wso2 cep looks same in both. i'm sure has it's own pros' & cons'. i've gone through doc of kafka , wso2 mb documentation. there major differences when comparing 1 against other? appreciated. architecture wso2 mb : built extending apache qpid code base. uses apache zookeeper , apache cassandra. apache kafka : solution built scratch. web management console wso2 mb : native management console apache kafka : no native management console. there open source options: https://github.com/yahoo/kafka-manager , https://github.com/claudemamo/kafka-web-console community apache kafka : used giant companies checkout below https://cwiki.apache.org/confluence/display/kafka/powered+by wso2 mb : doesn't have proven use-cases in market. protoco

Making a min:sec counter using javascript -

i trying make small question/answer quiz game using react, , want show timer counts down every second. each game last 10, 15, or 30 minutes @ most, want show timer updates every second in bottom of screen (in big font, of course!), 15:00 , 14:59 , 14:58 , , on until hits 00:00 . so, given start time such 2016-04-25t08:00:00z , , end time after adding 15 min of 2016-04-25t08:15:00z , want start countdown. my issue not understanding how use setintervals keep calling method find remaining time. timeleft = math.round(timeleft/1000) * 1000; const timer = new date(timeleft); return timer.getutcminutes() + ':' + timer.getutcseconds(); edit: you've edited question. need time padding, , method below faster using, answer question setinterval : first, define function run timer , decrement each time it's called: var timeleft; // time left var elem; // dom element timer text goes var interval = null; // interval pointer stored in variable function tick() {

html - CSS solution for pattern outside of text -

i trying style setup section of website pattern running each side of pieces of text. see screenshot took psd file here --> http://screencast.com/t/84rclrdszt red arrows pointing areas in question finding difficult solve. any idea how go this? here starting with: <div class="box"> <h2>some text here</h2> </div> and css: .box { width:400px; height:200px; text-align:center; background:yellow; } h2:after,h2:before{ content:""; border:5px double purple; } here fiddle --> http://jsfiddle.net/herrloop/g63lb/1/ as can see, stripes vertical, instead of horizontal can see in initial screenshot. this isn't quite perfect , requires set fixed width on before/after elements (best can think of use javascript if responsive required), here goes: h2{ display:inline-block; vertical-align:middle; } h2:after, h2:before{ content:""; margin:0px 20px; border:1px solid #000; b

ruby - Issue with Rspec Timer test -

i stuck in second gear, please review code , give me input. thank you. class timer def initialize(seconds = 0,time_string = "00:00:00") @seconds = seconds @time_string = time_string end def seconds=(new_sec) @seconds = new_sec end def seconds @seconds end def time_string=(new_time) hh = seconds/3600 mm = seconds%3600/60 ss = seconds%60 new_time = "#{hh}:#{mm}:#{ss}" @time_string = new_time end def time_string @time_string end end rspec: require 'timer' describe "timer" before(:each) @timer = timer.new end "should initialize 0 seconds" @timer.seconds.should == 0 end describe 'time_string' "should display 0 seconds 00:00:00" @timer.seconds = 0 @timer.time_string.should == "00:00:00" end "should display 12 seconds 00:00:12" @t

javascript - Filter by key in (key, val) pair using ng-model -

i ahave following data: [ { "rub": { "item1": 979, "item2": 32, "item3": 845 }, "shop": "shop1", }, { "rub": { "item232": 84, "item213": 348 }, "shop": "shop2" } ] i try filter in table key using ng-model . isn't filtering @ all. <table class="table ng-cloak" ng-repeat="rub in rubs | filter:isactive" ng-if='isactive'> <input type="text" class="form-control" placeholder="Товар" ng-model="rub.rub[key]"> <thead> <tr> <th>#</th> <th>Товар</th> <th>Число</th> </tr> </thead> <tbody> <tr ng-repeat='(key, val) in rub.rub'> <td>{{ $index }}</td> <td>{{ key }}</td&

c# - Changing the response object from OWIN Middleware -

my owin middleware this. (framework asp.net web api). public class mymiddleware : owinmiddleware { public mymiddleware(owinmiddleware next) : base(next) { } public override async task invoke(owinrequest request, owinresponse response) { var header = request.getheader("x-whatever-header"); await next.invoke(request, response); response.setheader("x-myresponse-header", "some value"); response.statuscode = 403; } } questions: is recommended practice derive owinmiddleware ? see in katana source, of middleware classes derive owinmiddleware , not. i can see request headers okay. setting response header or status code after next.invoke in middleware has no effect on response returned client. if set response header or status before next.invoke call, response headers , status set returned client. right way of setting these? yes, deriving owinmiddleware recommended. reason middleware class

Does android mediaplayer supports HLS audio streams? -

we have developed application plays mp4 audio streams. want replace mp4 streams hls streams(.m3u8) ios has out of box support playing hls streams. have tried playing streams android 5.1 , 6.0 devices , appears have hls support native android media player. but on of 4.4 version devices saw mediaplayer became unresponsive while doing operations seek() etc. can confirm whether native android mediaplayer has full support hls streams (.m3u8) ? i have same problem in case need play video. though newer versions of android os tend perform better, android fragmentation still problem , depending on android version, hls may: not supported @ (android 2.3, gingerbread) cause devices crash (android 3.0, honeycomb) lack seeking ability, feature distorted images, , restart videos when in fullscreen (android 4.0, ice cream sandwich) lack seeking ability, , throw error , crash when in fullscreen (android 4.1, jelly bean) i've found possible solutions:

python - Kinesis-contributed latency using Lambda -

we're building (mostly) server less architecture centered around kinesis stream being consumed lambda, , running latency behavior don't understand , might block us. we experiencing high latency @ extremely low volumes, set test case measure it: our lambda few things, logs, , posts message same kinesis stream trigger next invocation. test logs 100-200ms of billed time, invocations come 2-4s apart according cloud watch. my reading suggests lambda should polling 200ms after function completeness, seems slow. found old posts eoy 2014 discussed similar behavior, appeared fixed in march 2015. expected? if not, there gotchas can result in slow invocation despite fast run times? some notes: seeking <1s overall latency, optimally < 500ms contributed kinesis. using python library our lambda, did not have context.succeed() or context.done() methods, if might relevant. have experienced configuring greater memory, lower timeout, , different batch sizes no effect.

html - Local font not applied in web page in .net, How to import font -

Image
i have included font this, in html dont know vb.net . in normal css if include given below work in .net not so.. @font-face { font-family: 'oswald'; font-style: normal; font-weight: 300; src: url('../fonts/oswald light.woff2'), url('../fonts/oswald-light.woff2') format('woff2'); unicode-range: u+0100-024f, u+1e00-1eff, u+20a0-20ab, u+20ad-20cf, u+2c60-2c7f, u+a720-a7ff; } /* latin */ @font-face { font-family: 'oswald'; font-style: normal; font-weight: 300; src: url('../fonts/oswald light.woff2'), url('../fonts/oswald-light.woff2') format('woff2'); unicode-range: u+0000-00ff, u+0131, u+0152-0153, u+02c6, u+02da, u+02dc, u+2000-206f, u+2074, u+20ac, u+2212, u+2215, u+e0ff, u+effd, u+f000; } /* latin-ext */ @font-face { font-family: 'oswald'; font-style: normal; font-weight: 400; src: url('../fonts/oswald regular.woff2'), url('../fonts/oswald-regular.woff2') format(

python - IMAP and Gevent: ConcurrentObjectUseError -

i'm trying create asynchronous download of messages e-mail gevent , imap . use python 2.7.8 , gevent 1.1.1 . self.connection = imaplib.imap4_ssl(self.hostname, self.port, **ssl_files) ... rv, data = self.connection.search(none, "all") numbers = [number number in data[0].split()] threads = [gevent.spawn(self._get_message, message) message in numbers] gevent.joinall(threads) function _get_message have code: def _get_message(self, message_number): logging.info("message {0} called!".format(message_number)) rv, data = self.connection.fetch(message_number, '(rfc822)') if not self.is_ok(rv): return message = email.message_from_string(data[0][1]) but every time have error: traceback (most recent call last): file "c:\python27\lib\site-packages\gevent\greenlet.py", line 534, in run result = self._run(*self.args, **self.kwargs) file "c:/users/eugene/pycharmprojects/extract email criteria/imap_email.py"

javascript - Datatable freezed header -

datatable fixed header when scrolling , down link $(document).ready(function() { $('#student_datatable').datatable( { fixedheader: true, scrollx: true, bsort : false } ); } ); fixedheader: true doesn't work. can me ? the link fiddle in question has nothing datatables. uses css implement fixed header functionality regular html table. in case css useless. for datatables use fixedheader plugin first of need reference adding html(in case not included): <script src="https://cdn.datatables.net/fixedheader/3.1.1/js/datatables.fixedheader.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.1/css/fixedheader.datatables.min.css"> then $('#student_datatable').datatable({ fixedheader: true }); will work expected ( working fiddle )

jetty 8 - Where is the best way to log response in Restlet -

i use restlet jetty8. jetty log incoming calls. want log response data also, url , body. best place put log code? i thought createoutboundroot place didn't figured out how use , couldn’t find examples in web. i have never tried start custom filter , override after handle, appears way restlet logging internally see class logfilter.

Adding links to every record with Spring REST + MongoDB -

i'm trying add links every record in databse, trying implement hateoas concept. however, have been experiencing trouble this. tried following guide https://spring.io/guides/gs/rest-hateoas/ . no success. how , should write code adding links? because doesn't seem work when try write in controller method because withselfrel() undefined. basically i'm trying add link every account made in database. //create account @requestmapping(value="/accounts", method = requestmethod.post) public responseentity<?> accountinsert(@requestbody account account) { account = new account(account.getfirstname(), account.getlastname(), account.getemail(), account.getpassword(), account.getbirthdate(), account.getactivities(), account.getfriends()); accountrepository.save(account); //account.add(linkto(methodon(accountcontroller.class, accountinsert(account)).withselfrel())); /// here try httpheaders httpheaders = new httpheaders(); httpheaders.se

jquery mobile - Jquerymobile buttons are shown only first apperance of the page -

i have problem jquery mobile code. using code above append dynamic html code application. $("#tab3").click(function() { $('#habericerik').html(" <img src='img/izto_header.png' height=auto width=100% class='img2' > "); $('#habericerik').append(" <div class='zoomtab'><a href='#' data-role='button' class='plus'>+</a><a href='#' data-role='button' class='minus'>-</a></div>"); }); when page loads first, works perfectly. when move main page , click tab3 page again buttons shown links,not button styles. can me solve problem? in code you're not refreshing button's styles. so, must add after append() $(document).on("click", "#tab3", function (e) { e.preventdefault(); $('#habericerik').html("<img src='http://www.ndaccess.com/sample/images/imag

c++ - map keys of abstract classes that are logically similar -

suppose user uses library kbase vbase classes. user adds pairs of keys , values of classes available him (he implemented them using library) - v , k . in library, when added, want keys logically similar (have same string) "merged" single key. he're code sample i've tried : //---------------------------library.h------------------------// #include <map> #include <vector> #include <iostream> using namespace std; map<kbase*,vector<vbase*>> mapa; void printmap(); void addtomap(kbase* k1, vbase* v2); class kbase { public: virtual ~kbase(){} }; class vbase { public: virtual ~vbase(){} }; //---------------------------library.cpp------------------------// void printmap() { // expect 3 keys implemented. (auto : mapa) cout << i.first << endl; } void addtomap(kbase* k1, vbase* v2) { // create k1. if doesnt exist - vector created. // otherwise, object obtained. mapa[k1]; mapa[k

javascript - Passing Server Side Javacript Array to Client -

i have select menu displaying list of options i need use server side javascript call external 3rd party db, , return , array. , have client side javascript calling array , populating options in select menu. i not how can pass array server side client side. client side javscript , server side javascript, not how pass array server client side. input appreciated. code below. server side javascript var arrayoptions = new array(); arrayoptions= //call db here for(var = 0; < arrayoptions.length; i++) { var opt = arrayoptions[i]; arrayoptions.push(opt); } client side javascript function getoptions(arrayoptions){ var select = document.getelementbyid("seloption"); for(var = 0; < arrayoptions.length; i++) { var opt = arrayoptions[i]; var el = document.createelement("option"); el.textcontent = opt; el.value = opt; select.appendchild(el); } well, passing data server client involves ajax requests. instance, post request, ca

merge dataset without duplicates R -

i'm trying merge 2 dataframes in r. df1 = data.frame(customerid = c(1:5,5), product = c(rep("toaster", 3), rep("radio", 3))) df2 = data.frame(customerid = c(2, 4, 4, 6,7), state = c(rep("alabama", 2), rep("ohio", 3))) loj=merge(x = df1, y = df2, = "customerid", all.x = true) actual result: customerid product state 1 1 toaster <na> 2 2 toaster alabama 3 3 toaster <na> 4 4 radio alabama 5 4 radio ohio 6 5 radio <na> 7 5 radio <na> expected result: customerid product state 1 1 toaster <na> 2 2 toaster alabama 3 3 toaster <na> 4 4 radio alabama 5 5 radio <na> 6 5 radio <na> however, if @ row 4 , 5, entry repeated. how can prevent doing that? want first match viewed , not care rest of matches may happen in ds2. e

angularjs - reload page after 3 seconds using Angular -

the following controller of page developing. rp3.controller('c1ctrl', [ '$scope', 'xfactory', '$timeout', '$route', function($scope, xfactory, $interval, $timeout, $route) { var layout_url = "json/dashboard/layout/mpu/layout.json"; xfactory.getjson(layout_url, function(layout) { // read // layout's // web // service $.each(layout, function(i, val) { chart.push({ "v" : val, "x" : xfactory }); // alert(chart[0]); var ctype = getcharttype(val.charttype); // alert(ctype); drawlayout(parentdiv.name, val.position, val.width, val.height, val.title, val.color, val.bgcolor, buttomctrl.withctrl, ctype); filllayoutdata(xfactory, val

java - .get() and .put() methods migrated from Eclipse to Android Studio -

i quite .net guy, developing in xamarin. however, got hands on piece of java code android implement in c#. problem project developed in eclipse, , ported android studio , cannot compiled. i got through issues gradle, stuck generated annotations , .put() , .get() methods, cannot referenced. there many things similar following: a normal interface mysharedpreferences has generated sealed (final) class counterpart mysharedpreferences_ . used in code: import com.someproject.mysharedpreferences_; ... public class someandroidclass { public mysharedpreferences_ prefs; public somemethod() { string x = prefs.somevalue().get; ... prefs.somevalue().put("abc"); } } now, cannot compiled, because mysharedpreferences_ class not generated android studio. tried rid of underscore , use mysharedpreferences interface instead. had problem referencing .get() , .put() methods. please, can me how deal problem? edit adding build.gradle file

Couchbase createIndex command times out -

i have couchbase bucket consisting of ~110 mn documents occupying ~58 gb of disk space. allocated dynamic ram quota of bucket 48.8 gb. index ram quota cluster ~36 gb. i'm trying build secondary index on bucket using gsi. the query create index runs ~2 mins , returns error gsi createindex() - cause: request timeout , i'm getting following warning web ui : approaching full indexer ram warning. usage of indexer ram on node "127.0.0.1" around 2669%. above threshold of 75%. is there someway can increase timeout period query? also, query runs 2 min before timing out, have ram warning, in increased hardware requirement? i created query workbench in couchbase 4.5 ui. using 4.5dp version? there indeed timeout on queries issued ui. should set 5 minutes, sure 2 minutes reporting, or 5 minutes? if it's 2 minutes, there bug. please note, however, index creation continues after timeout. if go indexes tab, should see index continues build. shouldn't pro

ios - Why I can't pass data using segue -

i have plist contains key , value... let say: key: alpha_male_body_language value: alpha male body language key: building_attraction value: building attraction key: fifteen_lessons value: fifteen lessons key: how_can_it_have_gone_wrong value: how can have gone wrong here implementation of tableview: #import "booktitleviewcontroller.h" #import "booklessonviewcontroller.h" @interface booktitleviewcontroller () @end @implementation booktitleviewcontroller{ nsdictionary *booktitles; } @synthesize tableview; @synthesize booktitles; - (void)viewdidload { [super viewdidload]; self.booktitles = [nsdictionary dictionarywithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"book" oftype:@"plist"]]; } - (void)viewdidunload { [super viewdidunload]; // release retained subviews of main view. self.booktitles = nil; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resourc

javascript - Jquery remove function not working on Mustache Template -

i trying implement form using mustache , jquery, have add button keeps adding new form , delete deletes respective form. html of form done using mustache , every form has delete button, want remove delete icon/button first form. i tried deleting using jquery not worked, not sure wrong doing... $(document).ready(function () { var output = $("#output"); var template = $("#test1").html(); // var rendered = mustache.render(template, {name: "luke"}); var customtemplate = mustache.render(template, {bikename: "abcd"}); $(customtemplate).find('.delete').hide(); output.append($(customtemplate)); $('#addepod').on('click', function(){ customtemplate = mustache.render(template, {bikename: "new bike"}); output.append(customtemplate); }); $('#output').on('click','#deletepod',function() { $(this).parent().remove();

java - Android studio finish(); doesnt kill the activity and it is running in background -

i have multiple activities on android application. when jump 1 activity next activity finish(); previous activity still running in background , creates issue application. how can stop activity stop running??? open each activity this. finish current 1 , should stop them stacking. intent intent = new intent(this, yourmainactivity.class); startactivity(intent); finish();

authentication - Node.js Express Serve static files only with SIMPLE authentification -

i've problem since 2 days ago now. want authentification on static files. @ lot of post on internet , nothing answer question simply. i try use basic-auth, has no effect on webpages. i want simple dialog box before open static pages ask name , password , in server.js thing : if name == 'foo' , password =='pwd' "send static content". but seems not simple might be. there code : /***************************************************************************/ //server node.js /** ************************************************************************ */ var express = require("express"); var app = express(); var bodyparser = require("body-parser"); // routers var router = express.router(); var mongoose = require("mongoose"); mongoose.connect('mongodb://localhost:27017/mydb'); var conn = mongoose.connection; var assert = require("assert"); var basicauth = require('basic-auth'); var auth =

c# - DataGrid.ColumnWidth="*" not working in a ScrollViewer -

i have datagrid columnwidth="*" in scrollviewer horizontalscrollbarvisibility="auto" . unfortunately combination doesn't seem work well. while datagrid spans on full window width columns super small ( minwidth ). if change horizontalscrollbarvisibility disabled works lose desired scrollviewer behavior. minimal working example: <window x:class="wpf_sandbox.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wpf_sandbox" title="mainwindow" x:name="thiscontrol"> <scrollviewer horizontalscrollbarvisibility="auto"> <datagrid autogeneratecolumns="false" columnwidth="*"> <datagrid.columns&

asp.net - Active Directory not working after hosting to IIS 7 -

active directory not working after hosting iis 7, waiting helps. my code snippets. string connection = configurationmanager.connectionstrings["adconnection"].tostring(); directorysearcher dssearch = new directorysearcher(connection); dssearch.filter = "(samaccountname=" + txtusername.text + ")"; searchresult sresult = dssearch.findone(); directoryentry dsresult = sresult.getdirectoryentry(); lblfname.text = dsresult.properties["givenname"][0].tostring(); lbllname.text = dsresult.properties["sn"][0].tostring(); lblemail.text = dsresult.properties["mail"][0].tostring(); in internet information services (iis) manager, expand , sites, , default web site in connections pane. click select virtual directory , click features view @ bottom of workspace pane list configurable features virtual directory. double-click authentication

javascript - Multiple Recaptcha on same page disappearing on failed submit? -

i have 2 ajax forms on page both partial views. both have recaptcha , can't seem find way recaptcha's reload after forms have been submitted , failed validation. the recaptcha's loaded explicitly , have 2 problems, firstly if use: <script src="https://www.google.com/recaptcha/api.js?onload=mycallback&render=explicit" async defer></script> on both forms receive 'uncaught error recaptcha placeholder element must empty'. can't that. if put above loaded overall layout entire page have second problem recpatcha's not reload once form has been submitted incorrectly. the script loads each recaptcha follows: var recaptcha1; var recaptcha2; var mycallback = function () { //render recaptcha1 on element id "recaptcha1" recaptcha1 = grecaptcha.render('recaptcha1', { 'sitekey': 'sitekeyhere', 'theme': 'light' }); //render recaptcha2 on element

Freeing up disk space on azure web apps -

i've been on support ticket azure, , they've recommended turning on local caching eliminate occasional outage blips. the problem that, need watch disk space, since >1gig not allowed. , if deploy git, do, that's issue because whole repository checked out, built locally, , kudu-synced. i've looked @ trimming repo down, that's going yield small savings. i'd remove repository folder once deployment has complete. sensible idea, or there other solutions problem? there upcoming change local caching behavior make skip repository folder (since it's not needed @ runtime). should in next couple of weeks. once change out, issue should automatically go away you.

android - Navigation from one webview to another -

i have created webview in if external link clicked goes webview loaded external link. wanted in such way goes page navigated if button clicked. example if navigate 4th page of main webview external link webview , if click should go 4th page , not 1st page. xml page reference. <webview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/activity_main_webview"/> <webview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="45dp" android:id="@+id/external_webview"> </webview> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:id="@+id/ext_link" android:layout_height="fill_parent"> <relativelayout android:orientat