Posts

Showing posts from 2014

javascript - Tooltip on bootstrap checkbox label doesn't hide when marking / clearing the checkbox -

this show tooltip when hovering on label of checkbox , hide when not hovering. html: <div style="margin: 2em 0 0 2em"> <label id="checkbox-label"> <input type="checkbox">checkbox</label> </div> js: $('#checkbox-label').tooltip({ title: "this tooltip won't disappear when checkbox checked.", placement: "right" }) the problem when user checks or unchecks checkbox, tooltip doesn't hide until user clicks somewhere else on screen. how can make tooltip disappear when checkbox checked/unchecked? here's js fiddle reproducing problem: http://jsfiddle.net/elax5hdq/5/ just fyi although has been answered. for future reference when tooptip shown bootstrap fires show.bs.tooltip event. way can conditionally check something. if pass event function can run event.preventdefault() if condition fails , not want tooltip show. http://jsfiddle.net/seanwessell/elax5hdq/9/

angularjs - ajax angular local loading browser issue -

i got these includes work angular offline because of ajax works in firefox. there way work in browser locally no internet. demo non computer savvy people have use. <!-- test --> <div ng-include src="'_includes/link.html'"></div> so users not know how go command prompt etc. normally use like: <div data-ng-include="'_includes/link.html'"></div> reference

ios - How can I fix my MKOverlayRenderer now that I'm using Swift 2.0? -

so when using swift 1.2, function worked fine , gave me functionality needed. func mapview(mapview: mkmapview, rendererforoverlay overlay: mkoverlay) -> mkoverlayrenderer { if overlay mkpolyline { let pr = mkpolylinerenderer(overlay: overlay) pr.strokecolor = self.lightblue pr.linewidth = 14 return pr } //i error here, because need return } now, error saying "missing return in function expected return 'mkoverlayrenderer'". is still how method used? can remedy this? func mapview(mapview: mkmapview, rendererforoverlay overlay: mkoverlay) -> mkoverlayrenderer will called each overlay add instance of mkmapview. if add mkpolyline mapview, can sure when delegate function called, overlay parameter of type mkpolyline . since case, there no reason check if overlay parameter instance of mkpolyline if overlay mkpolyline . can this: func mapview(mapview: mkmapview, rendererforoverlay overlay: mkoverlay

javascript - jQuery ajax call getting error response with status of 200 -

i sent jquery ajax request express-powered node.js server, processed , responded. however, response triggers ajax error callback instead of success callback (despite status code being "200"). not expecting. ;o) here code: client.js: $.ajax( { url: "/httpupload", type: "post", processdata: false, contenttype: false, datatype : "json", data: formdata, success: function() { // stuff }, error: function( error ) { console.error( "httpupload failed: " + error.responsetext ); } } ); server.js: var express = require( "express" ); var app = express(); var server = require( "http" ).server( app ); var multipart = require('connect-multiparty'); app.use( express.static( "public" ) ); app.use( multipart() ); app.post( "/httpupload", function( req, res ) { console.log( "received post request"); res.send( "

r - Tried streamlining w/ SDCols - got "longer object length is not a multiple of shorter object length" -

i have tried searching stackoverflow , google answers question, couldn't find applied closely enough me able apply it. however, i'm new r, it's may need little walking through it. if use following code, works fine. > dput(b) structure(list(dump_end_shift_date = structure(c(1420070400, 1420070400, 1420156800, 1420156800, 1420243200, 1420243200, 1420329600, 1420329600, 1420416000, 1420416000, 1420502400), class = c("posixct", "posixt"), tzone = "utc"), quantity_reporting = c(235, 219, 232, 219, 219, 219, 219, 219, 219, 219, 235), wtrecv = c(32.71, 32.71, 20.19, 33.42, 21.61, 21.61, 21.61, 20.19, 21.61, 20.19, 24.2), lc12 = c(0, 0, 0, 94, 100, 100, 100, 0, 100, 0, 100), lc34 = c(0, 100, 0, 6, 0, 0, 0, 0, 0, 0, 0), lc5 = c(0, 0, 5, 0, 0, 0, 0, 5, 0, 5, 0), = c(25, 0, 60, 0, 0, 0, 0, 60, 0, 60, 0), uc = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ibc = c(75, 0, 35, 0, 0, 0, 0, 35, 0, 35, 0)), .names = c("dump_end_shift_date&q

php - Form not showing properly with Plesk on Mac Mail -

i have form emailing , posting database should. problem when sends email addresses on our own server (parallels plesk) , comes mac mail comes through little corrupt. text broken , there's $= on form. has part of html coding sat @ top of email, like: <= /tr><= td colspan='3'>further comments: = <= /tr><= td width='40%' colspan='2'>expectations but everytime it's different. i.e. there's no thing everytime comes through; everytime symbols , coding little different. this code emailing it: <?php $servername = "***"; $username = "***"; $password = "***"; $dbname = "***"; try { $conn = new pdo("mysql:host=$servername;dbname=$dbname", $username, $password); // set pdo error mode exception $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); // prepare sql , bind parameters $stmt = $conn->prepare("insert guestquestionnaire (

python - Using `itertools.groupby()` to get lists of runs of strings that start with `A`? -

the (abstracted) problem this: have log file a: 1 a: 2 a: 3 b: 4 b: 5 a: 6 c: 7 d: 8 a: 9 a: 10 a: 11 and want end list of lists this: [["1", "2", "3"], ["6"], ["9", "10", "11"]] where file has been broken "runs" of strings starting a . know can use itertools.groupby solve this, , right have solution (where f list of lines in file). starts_with_a = lambda x: x.startswith("a") coalesced = [g _, g in groupby(f), key=starts_with_a] runs = [re.sub(r'a: ', '', s) s in coalesced if starts_with_a(s)] so use groupby, have filter out stuff doesn't start "a". okay, , pretty terse, there more elegant way it? i'd love way that: doesn't require 2 passes is terser (and/or) more readable help me harness might of itertools ! yes, filter out lines don't start a use key produced groupby() each group returned. it's return value of key

c++ - Modify the image pixels using cvGet2D cvSet2D functions -

Image
how can use cvget2d , cvset2d result: code: std::string path = "c:\\image.jpg"; cv::mat img = cv::imread (path); cvscalar scal = cvget2d(m, 0, 2); cvset2d(m, 0, 2, new_value);*/ cv::imshow( "result window", img ); since know coordinates of top-left , bottom-right rectangle corners: point tl(250, 250); point br(350, 280); you can draw black filled rectangle: rectangle(img, rect(tl, br), scalar(0,0,0), cv_filled); result (note image has different size yours, results appear different): code: #include <opencv2\opencv.hpp> using namespace cv; int main() { // load image mat3b img = imread("path_to_image"); // set top-left , bottom-right rectangle points point tl(250, 250); point br(350, 280); // draw filled rect rectangle(img, rect(tl, br), scalar(0,0,0), cv_filled); // show result imshow("result", img); waitkey(); return 0; } note cvsetxd , cvgetxd old styl

accordion - angularjs $scope.$watch causes FireFox to do a complete reload -

i have simple watch on local scope variable make query update json array when value changes. works fine in chrome , ie11. in firefox watch causes entire page reload loosing data might have been collected. the radio in ui-bootstrap-tpls accordian header. here plunker details. http://plnkr.co/edit/10ms8azqb2okuendguus the plunker has 4 sections. radio in accordion w/o function stop propagation radio in body of accordion radio in according header function radio in body of 2nd accordion the radio in #1 causes accordion close not set value. items #2 , $4 work expected (watch console log). item #3 causes session restart in firefox. no errors presented in firebug's console. reloads. i need prevent accordion closing can set value of radio. firefox not function calling $event.stoppropagation(); any suggestions? thanks always.

ggplot2 - R - ggplot: Selection of which labels to appear in bar stack and their position -

Image
currently have struggled following many, many hours before posting question. we have huge number of data-sets similar following: income inhabitants percent below 15000 below 5000 4.664723 15000 - 3.000 below 5000 15.743440 30000 - 40000 below 5000 13.994169 40000 - 50000 below 5000 12.609329 50000 - 60000 below 5000 11.333819 60000 - 70000 below 5000 11.370262 70000 - 100000 below 5000 14.795918 above 100000 below 5000 5.211370 not know below 5000 10.276968 below 15000 5000-20000 4.225146 15000 - 3.000 5000-20000 13.157895 30000 - 40000 5000-20000 12.733918 40000 - 50000 5000-20000 11.739766 60000 - 70000 5000-20000 11.315789 7

ruby on rails - Is data.to_json.html_safe susceptible to XSS attack? -

i'm trying figure out if code safe. @ possible attack code? <script> data = <%= data.to_json.html_safe %>; </script> in other words, value of data result in successful attack? any string in data has "</script>" in can used implement xss in example. along lines of data = { b: "</script><script>alert('hi')</script>" } would work

Java Split String using regular expression -

i have string reads parsegeopoint[30.132531,31.312511] . how can coordinates saved in double variables. i.e. want have double lat = 30.132531; , double lang = 31.312511; here have tried: string mytext = "parsegeopoint[30.132531,31.312511]"; string [] latlong= mytext.split("["); //it needs escape character string [] latlong2= latlong[1].split(","); double lat = double.parsedouble(latlong2[0]); string[] latlong3= latlong2[1].split("]");//also escape character needed here double lang = double.parsedouble(latlong3[0]); two things: how split on square bracket given needs escape character? second, feel in way. there must simpler way. it? how split on square bracket given needs escape character? i guess mean doesn't compile: string [] latlong= mytext.split("["); to make compile, escape [ : string [] latlong= mytext.split("\\["); here's way extract doubles string using regular expression

ios - UIButton isn't responding to my touches on collectionView cells? -

i'm creating collectionview , inside in every cell i'm creating few buttons horizontally buttons aren't responding target selector. here code. implementationview.h -(ibaction)tagclicked:(uibutton*)sender; in implementationview.m -(void)configurescrapcell:(uicollectionviewcell*) cell forscrapdict:(scrapdictionary *)dict forindexpath:(nsindexpath*){ uiview *tagview = (uiview*)[cell viewwithtag:17]; uiview *layertagview = (uiview*)[cell viewwithtag:18]; cgfloat x = 0.0; if (layertagview) { [layertagview removefromsuperview]; } layertagview = [[uiview alloc] init]; layertagview.tag = 18; [tagview addsubview:layertagview]; if ([dict.sdtags count]>0) { int tagindex = 1; (nsstring *tag in dict.sdtags) { cgsize width = [tag sizewithfont:[uifont systemfontofsize:16]]; uibutton *scraptag = [[uibutton alloc]initwithframe:cgrectmake(x, 0,100, 30)]; [scraptag setbackgroundcolor:[uicolor greencolor]

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ca

javascript - Fully self-contained HTML files with Pandoc -

i have little knowledge in html , javascript, , want know following: i have master html file contains text, images ... , contains internal references other local html files, put in relative directory. possible make self-contained html file, other files still referenced url links content recorded in master file ? i had problem using --self-contained option in pandoc, writes necessary stuff (css stylesheet, ...) html header, while master html document still needs "see" actual local files. so far, tried iframe tag, opened, , not simple put in page,like one-line url link. have read answer using html+javascript not sure if compatible pandoc. anyone can me understand difficulty of such task ? usually 1 html file referenced 1 url, when follow links , change url navigate new file. somehow package multiple files, example epub file format has been invented (is zipped collection of html files, pandoc can generate it). other that, use hash links link data in sam

Parsing a csv file in python and saving to a dictionary which is in turn saved to a list -

my task read input datafile , line line, , first 10 lines (not including header) split each line on " , " , each line, create dictionary key header title of field, , value value of field in row. the function parse_file() should return list of dictionaries, each data line in file being single list entry. field names , values should not contain whitespace, spaces or newline characters. my question program generates data(list) has same value in list entries last line of csv file. import os datadir = "" datafile = "beatles-diskography.csv" def parse_file(datafile): data = [] count = 0 d = 0 my_dict = dict() open(datafile, "r") f: while d<10: line in f: count = count + 1 if count 1: p = line.split(',') length = len(p) else: r = line.split(',') l = 0 while l < length:

excel - Give column number of first column with symbol -

so have sheet following: row 1 2 3 4 5 6 1 x 2 x 3 x x 4 x 5 x x 6 x and have sheet want encapsulate data with: 1st appeared 1 2 1 4 2 6 i'm trying construct second sheet. there way each row start @ column 2 , go ith column , display first 'x' appears. (note can assume every row have @ least 1 'x' when row , column meet forming diagonal down entire first sheet) [note first spreadsheet 5,000 x 5,000 hence why i'd nice formula instead of doing things hand =)] thanks in advance! the match function return relative position in either row or column. use formula in second worksheet. =iferror(match("x", sheet1!1:1, 0) - 1, 0) fill down retrieve correct column index or 0 if not found. 1 subtracted since hte want position relative column b. iferror function return default 0 no ma

How do i manage the Facebook Comments? -

1) https://developers.facebook.com/docs/plugins/comments#configurator 2) https://developers.facebook.com/tools/comments/ hello. i have configured facebook comments & added website per link (1). i have got line in head section of website.. however, when go tools area (link 2), says not manager / admin of comments area. can advise a) how "verify" facebook website configued correctly comments ? b) how confirm "id" ? ive been 1 page has given me above id number, not on 'facebook' itself. on external website.

dependency injection - AngularJs service not injected in controller -

i having trouble simple inject basic service controller , despite reading documentation , other question don't see mistake i'm making. here's simplified code: angular.module ('travelapp', ['ui.bootstrap', 'ngroute']) //controllers .controller('searchcontroller', ['$scope','myparams', function ($scope,ngroute,myparams){ $scope.place = myparams.place; $scope.$watch('place', function(){ myparams.place = $scope.place; }); $scope.bind = function(){ console.log(myparams.getplace); }; }]) //services .service('myparams', function(){ this.place = 'start'; }); //my html <div class="container" ng-app="travelapp"> <div class="jumbotron" id="searchpage" ng-controller="place"> <div> <h3>start here</h3> <input type="text" class="form-control

c - Count distinct numbers constructed with k limited prime factors -

i can't understand solution following problem: alice , bob playing game. in game, players supposed show @ same time using hands integer between 0 , 10 million. if numbers shown both players equal, have tie. otherwise, players alternate writing down numbers in piece of paper. let integer shown alice in beginning of match , let b integer show bob, each number written down must product of |a - b| factors, factors being prime numbers, not distinct, belonging interval defined integers , b. alice play first. for example, if = 2 , b = 5, there 10 numbers (bob wins) can written down in paper, are: 8 = 2 x 2 x 2 12 = 2 × 2 × 3 20 = 2 × 2 × 5 18 = 2 × 3 × 3 30 = 2 × 3 × 5 50 = 2 × 5 × 5 27 = 3 × 3 × 3 45 = 3 × 3 × 5 75 = 3 × 5 × 5 125 = 5 × 5 × 5 the input has 2 numbers , b described. the output has 1 line containing singly match winner's name, assuming both players play optimally. if match ties, output line shall contain singly symbol '?'

r - How to compute all possible combinations of multiple vectors/matrices of different sizes and sum up columns simultaneously? -

assume have 3 matrices... a=matrix(c("a",1,2),nrow=1,ncol=3) b=matrix(c("b","c",3,4,5,6),nrow=2,ncol=3) c=matrix(c("d","e","f",7,8,9,10,11,12),nrow=3,ncol=3) i want find possible combinations of column 1 (characters or names) while summing columns 2 , 3. result single matrix length equal total number of possible combinations, in case 6. result following matrix... result <- matrix(c("abd","abe","abf","acd","ace","acf",11,12,13,12,13,14,17,18,19,18,19,20),nrow=6,ncol=3) i not know how add table in question, otherwise show more descriptively. thank in advance. you mixing character , numeric values in matrix , coerce elements character . better define matrix numeric , keep character values row names: a <- matrix(c(1,2),nrow=1,dimnames=list("a",null)) b <- matrix(c(3,4,5,6),nrow=2,dimnames=list(c("b","c"),nul

c++11 - C++ linked list crashed -

i new on data structure. trying write linked list string , display list screen. crash @ node *p = create("i "); warning of access violation writing location. here code, don't know how fix it. please help. thank much. #include <iostream> #include <cstdlib> #include <string> using namespace std; struct node { string data; node *prev, *next; }; node* create (string value) { node *temp = (node*)malloc(sizeof(node)); if (null==temp) return null; temp->data=value; temp->next=null; temp->prev=null; return temp; } void addhead (node* head, string value) { node *temp = new node; temp->data=value; temp->next=head; head->prev=temp; head = temp; temp->prev = null; } void addtail (node* head, string value) { node* s = new node; node* temp = new node; s=head; while (s->next!=null) s = s->next; s->next = temp; temp->prev = s; } void disp

php - Site width scaling -

i think have done bad thing. on site http://nwglobalva.com have been playing idea of having site scale width of browser. have realized bad idea because elements bunch , starts terrible. my issue have backed myself corner when comes making thing rigid again doesn't scale. have advice on how should above? imagine it's simple can't seem find way lock down elements displays okay. you having class="bg" outermost div contents. if css tricks class, problem may solve. following options can try out. 1] remove margin-left: 200px; , margin-right: 200px; css of class , see result. make site full width regardless of device width. 2] try giving css width: 95%; , margin: 0 auto; 3] if want make site device-friendly, bootstrap best option. 4] if want go current css rules can use media queries handle site dimensions according device. here link media queries standard devices

validation - Dealing with Missing Values in dataset -

upto extent should fill missing values feature in dataset doesnt become redundant ? i have dataset has max of 42000 observations. there 3 features have around 20000, 35000 , 7000 values missing. should still use them filling these missing values or dump these 3 features? how decide threshold keeping or dumping feature given number of missing values of feature ? generally, can interpolate missing values nearest samples in dataset, manual pandas missing values http://pandas.pydata.org/pandas-docs/stable/missing_data.html , lists many possible techniques interpolate missing values known part of dataset. but in case, think it's better remove 2 first features, because doubt there interpolation missing values, when have such big amount of them, more half of values. but may try fix third feature missing values.

sorting - Difference between Bubble sort and framework predefined sort C# -

i have normal sort what difference normal sort , bubble sort? there not bubble method? what difference , bubble sort? see documentation array.sort . here's does: this method uses introspective sort (introsort) algorithm follows: if partition size fewer 16 elements, uses insertion sort algorithm. if number of partitions exceeds 2 * logn, n range of input array, uses heapsort algorithm. otherwise, uses quicksort algorithm.

php - Phonegap Authentication without username/password -

i have phonegap app , want my app users access api getting data. i using php end. what did created key , authenticating key on server. key hard-coded in app meaning can @ code , figure out key , pass parameter , gain access api don't want. furthermore key seen using proxy. is there way dynamically generate key on both app , server gets authenticated? or other way. i don't want user give kind of username/password. i don't want user register or login..the user has no role in authentication..i authenticating app . yes sure can done, but several things before should start. create new table store api keys going generate per user when registering through app . php side: grab users password or unique thing eg: udid andriod, in ios have restricted access udid , might have store unique generated id in keychain . then when have password , udid can put them (or anyway want) , encrypt sha1 (or encryption algorithm) , save api key table ev

object - How does getClass in Java work -

here javadoc says: public final class <?> getclass() returns runtime class of object . returned class object object locked static synchronized methods of represented class. the actual result type class<? extends |x|> |x| erasure of static type of expression on getclass called. example, no cast required in code fragment: number n = 0; class<? extends number> c = n.getclass(); returns: class object represents runtime class of object. now , understand native method , is implemented in platform-dependent code. return type of method. public final class<?> getclass() also , consider code: class dog { @override public string tostring() { return "cat"; } } public class main { public static void main(string[] args) { dog d= new dog(); //class<dog> dd = new dog(); compile time error system.out.println(d.getclass()); } } output: class dog so

ios - Opengl View drawing issue -

Image
for dimension consideration, resize opengl view 2.0 scale origin, this: nsinteger dimension = 2; self.glview = [[wqpaintglview alloc] initwithframe:cgrectmake(0, 0, width*dimension, height*dimension)]; cgaffinetransform tscale = cgaffinetransformmakescale((float)1/dimension, (float)1/dimension); cgaffinetransform ttranslate = cgaffinetransformtranslate(tscale, -width, -height); self.glview.transform = ttranslate; [self.canvascontainerview addsubview:self.glview]; but strange issue, see: i can draw stuff in left bottom 1/4 area. what did wrong? the uiview transform , opengl not compatible. view resizing after opengl initialization troublesome , in cases new render buffer must created view. anyway since scaled view have larger surface should check following calls: glviewport should define part of buffer writing at. set (0, 0, viewwidth, viewheight). in case must include scale well. glortho (or glfrustum ) define coordinate system if used. shou

Using MailGun for ruby on rails application on Heroku -

i trying use mailgun send emails in rubyonrails application hosted on heroku. i added mailgun addon heroku application. updated config/environments/production.rb below: config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :port => env['mailgun_smtp_port'], :address => env['mailgun_smtp_server'], :user_name => env['mailgun_smtp_login'], :password => env['mailgun_smtp_password'], :domain => 'mydomain.herokuapp.com', #mydomain contains realvalue :authentication => :plain, } i created file in app/mailers directory: class applicationmailer < actionmailer::base default from: "myemail@gmail.com" def notify_user(user) puts "going send email!! to" puts user mail(to: user, subject: "welcome!") end end in application_controller.rb i have function: def notify_people() puts

Download link not working in android browser app -

recently created simple android browser app website. working fine when click on download link not start downloading. .apk file stored inside server. downloading working fine in other browsers chrome, android browser , others. here main-activity code. { setcontentview(r.layout.activity_main); webview ourbrow = (webview) findviewbyid(r.id.webviewapkapps); ourbrow.setwebviewclient(new ourviewclient()); ourbrow.loadurl("http://websitename .com"); ourbrow.getsettings().setjavascriptenabled(true); } adding downloadlistener you! { setcontentview(r.layout.activity_main); webview ourbrow = (webview) findviewbyid(r.id.webviewapkapps); ourbrow.setwebviewclient(new ourviewclient()); ourbrow.loadurl("http://websitename .com"); ourbrow.getsettings().setjavascriptenabled(true); ourbrow.setdownloadlistener(new downloadlistener() { public void ondownloadstart(string url, string us

java - Calling a Native Query in the same request life cycle as a JPA managed query causes automatic persist -

i'm sure feature, appreciate pointers/help on issue. i'm using spring (boot) / jpa (hibernate) stack. if query entity (called homes) using jpa, , increment calendar field homeinstance.getlisteddate().add(calendar.date, 1), example with no intention of saving change database (it's quick intermediary calculations several routines run on list of these entities). then call nativequery using injected entitymanager bean. @autowired entitymanager em; ... query nvqry = em.createnativequery(...) nvqry.getresultlist() doing automatically persists changes made entity above (which never supposed persisted. is there way disable feature without losing in-memory changes? manually persist want using repository, , such whole session persistence useless me. that's related hibernate flushmode . if haven't modified default configuration, set flushmode.auto . to alter behavior have provide entitymanagerfactory bean. in configuration pojo can declare thi

javascript - Load html in windows strore app from appdata folder -

i'm developing windows store app using javascript, html5 , c#. have developed functionality downloads zip web , extracts "appdata" folder in "c" drive. zip file has html files. question is, want display html in windows app. i'm able load html web in iframe not local drive. tried giving absolute path in iframe not working. use webbrowser.navigatetostring("parameter"). question possible duplicate: local html file - webbrowser - windows phone 7

java - Nesting calls to static methods -

i want below, not work. objective able nest function calls static helper classes more brevity. public class statichelper { public static class<statichelper> dosomthing() { system.out.println("i did !!"); return statichelper.class; } public static class<statichelper> dosomthingelse() { system.out.println("i did else !!"); return statichelper.class; } public static void main(string[] args) { // not compiles statichelper.dosomthing().dosomthingelse(); } } is possible? if simple example above helpful. i guess want this. public class statichelper { private final static statichelper instance = new statichelper(); public static statichelper dosomthing(){ system.out.println("i did !!"); return instance; } public static statichelper dosomthingelse(){ system.out.println("i did else !!"); return instance

javascript - Fullpage.js Slide horizontal on scroll -

Image
im using fullpage.js achieve vertical , horizontal scroll. i want slider slide when scroll on section 2. functionality similar website here's code : $(document).ready(function() { $('#fullpage').fullpage({ sectionscolor: ['#1bbc9b', '#4bbfc3', '#7baabe', 'whitesmoke', '#ccddff'], anchors: ['firstpage', 'secondpage', '3rdpage', '4thpage', 'lastpage'], menu: '#menu', css3: true, loop: false, afterload: function(anchorlink, index) { var loadedsection = $(this); //using index if (index == 3) { $.fn.fullpage.setallowscrolling(false); $.fn.fullpage.setkeyboardscrolling(false); $(window).bind('mousewheel dommousescroll', function(event) { if (event.originalevent.wheeldelta > 0 || event.originalevent.detail < 0) { $(".fp-prev").click();

android - Add image to buttons -

i have slidepuzzle plays numbers, want able make options play pictures. pictures in imageboard , dont know how make work. need in same class. public void oncreate(bundle savedinstancestat) { super.oncreate(savedinstancestat); board = new board(); board.shuffleboard(); updatetiletext(); } public void updatetiletext() { setcontentview(r.layout.activity_game); string str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str; button button1 = (button) findviewbyid(r.id.button1); button button2 = (button) findviewbyid(r.id.button2); button button3 = (button) findviewbyid(r.id.button3); button button4 = (button) findviewbyid(r.id.button4); button button5 = (button) findviewbyid(r.id.button5); button button6 = (button) findviewbyid(r.id.button6); button button7 = (button) findviewbyid(r.id.button7); button button8 = (button) findviewbyid(r.id.button8); button button9 = (button) findv

c# - Win8 - Winforms mouse transparent form with clickable controls in it -

Image
i'm trying make mouse transparent form in win8 , winforms, contains controls clickable. i'm able make form mouse transparent, using code int initialstyle = getwindowlong(this.handle, -20); setwindowlong(this.handle, -20, initialstyle | 0x80000 | 0x20); (on win8 wndproc approach not work) but when make form mouse transparent, controls contained in form mouse transparent what can do? you can create form , set both backcolor , transparencykey properties color.magenta . screenshot: click pass through window , reaches behind it, of click on button 1, button clicked. note: trick works colors, example if use color.red transparent handles clicks, using magenta form mouse transparent too.

nginx - How to setup health check page in django -

i have webapp required authentication access page of it. elb work have setup health-check page elb elb discover django app. this page should return http 200 , no auth required. how setup django/nginx world. this better handled nginx, fact it's serving django app should make no difference. you first need configure elb's health check ping specific url of instance, /elb-status . can follow instructions here: http://docs.aws.amazon.com/elasticloadbalancing/latest/developerguide/elb-healthchecks.html#update-health-check-config after that, need set nginx send http 200 status code. can add server block in nginx.conf : location /elb-status { access_log off; return 200; } see answer more details.

c# - Reactive-ui binding with async viewmodelupdate crashes -

i have question reactive ui, bindings, , how handles ui updates. assumed using reactiveui take care of ui updates on ui thread. found out isn't case. in short question is: how can use reactiveui two-way-model-bind viewmodel , view, , assure updating viewmodel doesn't crash when run on different thread ui-thread? without having manually subscribe changes , update explicitely on uithread, defeats purpose of reactiveui, making harder encapsulate logic in pcl. below i've provided simple (android) project using xamaring , reactiveui, following: button text 'hello world' clicking on appends 'a' button's text. i let activity implement iviewfor, , use viewmodel deriving reactiveobject, containing text want change. i bind activity's button.text viewmodel.text, let reactiveui deal changes , ui updates. finally, add function button's onclick append 'a' viewmodel. the issue have following: button.click += delegate { th