Posts

Showing posts from January, 2012

python - How to select all URLs in a web site excluding those of a given class? -

i select urls twitter followers page using regex. if use https://twitter\.com/.* select urls matching pattern in website, i'd exclude users on follow section. urls within whotofollow class. so, question is: can use xpath, regex or combination of both select urls matching previous pattern excluding urls within whotofollow class in python? thanks! dani if correctly understood, can use such xpath, taking a tag not class whotofollow , having url beginning https://twitter.com/ . takes content of href //a[not(@class="whotofollow") , starts-with(@href, "https://twitter.com/")]/@href

python - What is the point of initializing extensions with the flask instance in Flask? -

following miguel grinberg's book flask web development, have initialize alot of exetensions flask instance point of doing this? examples app = flask(__name__) manager = manager(app) bootstrap = bootstrap(app) moment = moment(app) you can @ source of each of extensions see they're doing. in general, setting configuration, setting callbacks before , after request events, , using information app initialize. if don't pass app (or later call init_app ), extension can't finish initializing , unusable.

javascript - Gracefully Handle Tel URL -

i have link on website: <a href="tel:0123456789">call me, maybe</a> that's great browsers can initiate calls degrades elegance of hippopotamus. like: <h1>the address wasn't understood</h1> i thought of attaching on onclick listener , showing popup number. however, although listener runs, browser still follows url (and shows error) , i don't think there's reliable way detect whether there's tel: protocol handler. is there solution this? i think work see if device automatically wraps telephone number. <div id="testtel" style="display:none">+1 (111) 111-1111</div> var istelsupported = (function () { var div = document.queryselector("#testtel"), hasanchor = document.getelementsbytagname("a").length > 0; div.parentnode.removechild(div); return hasanchor; }()); alert(istelsupported);

How to resolve "GitLab: API is not accessible" when pushing to a new repository? -

we have locally-hosted enterprise edition of gitlab @ place of employment (currently @ v7.12.00-ee ceb5083). can create repository through gui without issue. when try add repository, error: d:\ws\testing [master]> git push -u origin master counting objects: 3, done. writing objects: 100% (3/3), 219 bytes | 0 bytes/s, done. total 3 (delta 0), reused 0 (delta 0) remote: gitlab: api not accessible http://gitlab.ops.cld/duffrw/testing.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed push refs 'http://gitlab.ops.cld/duffrw/testing.git' i see in /var/log/gitlab/gitlab-shell/gitlab-shell.log file api isn't responding, , giving "internal server error": e, [2015-07-22t16:05:51.812454 #15110] error -- : api call <post http://127.0.0.1:8080/api/v3/internal/allowed> failed: 500 => <{"message":"500 internal server error"}>. a few questions... can go here? there must sort of service provid...

tcp - vb.net - how create p2p connection without port forwarding (over internet)? -

first sorry bad english. :) i'm trying create p2p chat based on ip address , client application in vb.net. here tutorial used base chat forms, or similar codes i need port forward connection port in router send/receive messages. there other way create based on ip address , chat client app? skype, old god msn messenger? so without port forwarding , without server side app, want directly client client connection. i found similar questions here, this , know how create that? give example or something? thank you.

categories - Wordpress: How do I remove the category "uncategorized" from all posts in bulk? -

scenario: i have 1000 posts have "uncategorized" category, , want remove "uncategorized" of posts , set different category posts. in other words– take uncategorized posts , move them category, in 1 fell swoop. can in bulk without going through each post individually? what looking wordpress bulk editor. go posts > categories > uncategorized click "screen options" tab in top right corner, change "number of items per page:" 1000. (if on slow server might consider doing less @ time) now select of items on page , click "bulk actions" drop-down above select , select "edit” option. hit apply in bulk editor click “new category” want change of posts , hit update. once have added of posts “new category” need remove “uncategorized” category. this: go settings > writing now change “default post category” besides “uncategorized” go posts > categories , delete “uncategorized” category now can create...

python - Set value for particular cell in pandas DataFrame with iloc -

i have question similar this , this . difference have select row position, not know index. i want df.iloc[0, 'col_name'] = x , iloc not allow kind of access. if df.iloc[0]['col_name] = x warning chained indexing appears. for mixed position , index, use .ix . need make sure index not of integer, otherwise cause confusions. df.ix[0, 'col_name'] = x update: alternatively, try df.iloc[0, df.columns.get_loc('col_name')] = x example: import pandas pd import numpy np # data # ======================== np.random.seed(0) df = pd.dataframe(np.random.randn(10, 2), columns=['col1', 'col2'], index=np.random.randint(1,100,10)).sort_index() print(df) col1 col2 10 1.7641 0.4002 24 0.1440 1.4543 29 0.3131 -0.8541 32 0.9501 -0.1514 33 1.8676 -0.9773 36 0.7610 0.1217 56 1.4941 -0.2052 58 0.9787 2.2409 75 -0.1032 0.4106 76 0.4439 0.3337 # .iloc get_loc # =================================== df.iloc[0, df.co...

ios - Random Parse query with multiple factors -

i have kind of result algorithm need improve. the pfquery should request bunch of relevant results mix of different factors. 3 factors: the closest object - found [query wherekey:xxx neargeopoint:xxx withinkilometers:xxx]; the object highest "tscore" - found [query orderbydescending:@"tscore"]; the there's class among others includes 2 "userid"s in columns "userone" , "usertwo". here "usertwo" should equal [pfuser currentuser]["userid"] . "userone" should used actual query, like: [query wherekey:@"userid" equalto:theuseroneuseridfromanotherquery]; . aware class algo calling not pfuser class.. sooo, these different query conditions not running on same time out put should mix of factors. example limit query 21 results , output 7 of closest objects, 7 of objects highest "tscore" , 7 of objects userid equals userone value in object current user's userid equals usertwo...

WPF NotifyIcon From Background Thread -

i know 1 not supposed touch ui elements threads other ui thread, new wpf , wondering if current working implementation can improved. i have application comprised solely of notification tray icon, , want update icon background thread. here program.cs entry point: static class program { [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); using (iconhandler notify = new iconhandler()) { notify.display(); application.run(); } } } this iconhandler.cs notification icon handler class: class iconhandler : idisposable { notifyicon ni; public iconhandler() { ni = new notifyicon(); } public void display() { ni.mouseclick += new mouseeventhandler(ni_mouseclick); ni.icon = resources.icon1; ni.visible = true; new thread(new threadstart(updateicon)).start(); } pu...

c# - Excel Worksheet Name Not Recognized -

i have c# application use create excel file import application. problem is, application accepts imports reporting 'tables' looking not exist. tables respective sheets name in c# follows: worksheet1 = workbook.sheets[1]; microsoft.office.interop.excel.worksheet worksheet = (worksheet)worksheet1; worksheet1.name = "pay"; from research, renaming sheet way not rename sheet. ideas on this? the issues application looking named ranges opposed actual sheet names.thanks all!

retrofit - Android use only cellular(3G, 4G, EDGE) data for server requests -

i have app , i'd use cellular data server requests. don't need disable wi-fi completely like: wifimanager wifimanager = (wifimanager) context.getsystemservice(context.wifi_service); wifimanager.setwifienabled(false); maybe there a way app . note i'm using retrofit okhttp client, smth like: private static void setuprestclient() { okhttpclient client = new okhttpclient(); client.setconnecttimeout(5, timeunit.seconds); client.setreadtimeout(5, timeunit.seconds); client.setretryonconnectionfailure(true); restadapter restadapter = new restadapter.builder() .setloglevel(restadapter.loglevel.full) .setendpoint(new endpointmanager()) .setclient(new okclient(client)) .build(); } check app connected wifi , prevent requests happening follows: public static boolean isonwifi(context context) { connectivitymanager connmanager = (connectivityman...

php - Trying to use beginTarnsaction() and commit() but it fails when I put the commands in -

i'm little confused why doesn't work, far can tell, i've done nothing different various other examples i've seen. if run following code; try{ //set connection $db = new pdo($dbcon, $user, $pass); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); //start transaction $db->begintransation(); //sql insert basic info $sql1 = //insert statement here $query1 = $db->prepare($sql1); $query1->execute(array(...)); //run sql commands above $db->commit(); //set success message $return['message'] = 'success'; } catch(exception $e) { $db->rollback(); $return['message'] = "error: ".$e; }; //$return = $_post; $return["json"] = json_encode($return); echo json_encode($return); then update fails. if run same command without begin/commit lines; try{ //set connection $db = new pdo($dbcon, $user, $pass); $db->setattribute(pdo...

How to extract lines from each contour in OpenCV for Android? -

Image
i'd examine each canny detected edge , main lines in (to check if seem shape rectangle, example if 2 pairs of lines parallel etc.). imgproc.houghlinesp want, gives lines whole image, , want know lines come same edges. i tried findcontours, , looking main lines in each contour approxpolydp, doesn't adapted because there gaps in canny detected edges. gives contours of edges , not edges themselves. here test image example : how can set of lines each shape ? if you're using opencv 3.0.0 can use linesegmentdetector , , "and" detected lines contours. i provide sample code below. it's c++ (sorry that), can translate in java. @ least see how use linesegmentdetector , how extract common lines each contour. you'll see lines on same contour same color. #include <opencv2/opencv.hpp> using namespace cv; using namespace std; int main() { rng rng(12345); mat3b img = imread("path_to_image"); mat1b gray; cvtcol...

javascript - Scrape html from js with node.js and horseman -

i trying scrape array of batters salary information page: https://www.swishanalytics.com/optimus/mlb/dfs-batter-projections i using node.js , node-horseman. here code: var horseman = require('node-horseman'); var horseman = new horseman(); horseman.open('https://www.swishanalytics.com/optimus/mlb/dfs-batter-projections'); if (horseman.status() === 200) { console.log('[+] successful page opening') horseman.screenshot('image.png'); console.log(horseman.html()); } horseman.close(); the issue return horseman.html() still lot of javascript , cannot extracted cheerio. how can execute javascript programatically? for example, if view source @ same link see area has batters starts function model(){ this.batterarray = [{"team_short":"rockies","mlbam_id":"571448","player_name":"nolan arenado", obviously still javascript... i'm assuming @ point must executed , ...

python - How can I continue the for loop of the outer side? -

def countprimes(self, n): if n <= 1: return 0 if n == 2: return 1 count = 0 counted = [2, ] num in xrange(3, n+1, 2): c in counted: if num % c == 0: continue count += 1 counted.append(num) return count i writing code solution of primes counting problems. used counted array storing primes have been examined , use them examination next prime. tried using continue drop out inner loop count += 1 , counted.append(num) not executed once num found not valid prime. however, met implementing problem here, continue statement take me c instead of num . if understand question correctly, want know how break inner c loop, avoid other code, , continue num . other answers, want make use of break smart booleans. here's loop might like: for num in xrange(3, n+1, 2): next_num = false c in counted: if num % c == 0: ...

javascript - Non-controller ng-click function not working in directive -

this simplification of actual issue. when button clicked it's parent meant have red background. function not controller function, it's simple view thing. works expected when button not in directive. when used in directive doesn't work. know scope issue, , it's simple solution, i'm knobhead. i've seen solutions similar issues when click function controller based. here's plunker: http://plnkr.co/edit/nzpsejy6vh2n4gyethux?p=preview angular stuff: var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { $scope.boxes = [ { id: 1 }, { id: 2 }, { id: 3 } ]; }); app.directive('box', function() { return { templateurl: 'box.html', scope:{ makered: '@' } }; }); view: <body ng-controller="mainctrl"> <div class="box-wrapper" ng-repeat="box in boxes" ng-class="{redbox...

excel - How to return multiple values using index/match? -

i have below simple table: a 1 b 2 c 2 d 1 using index/match formula, have set looks @ 1 row @ time. however, when drag formula down , ask return second column 2. receive n/a @ top , bottom of lookup. is there way me ask skip when there na or return multiple rows? here code: =index(b2,match(1,c2)) which returns: a 1 b 2 #n/a c 2 #n/a d 1 d i return: a 1 b 2 d c 2 d 1 so skiiping rows there no match. the easiest way have skip value na either put if statement =if(a1 = "na","",index(match)) or if na because not finding match =iferror(index(match),"") one of 2 should it. if not please post code.

How to pass a c++ functor rvalue reference to a capture of a lambda ? -

i have following function template<class function> void f(function&& g) { h(..., [&g](){g();}); } it's function f accepting function, lambda or functor argument. inside calls function h pass lambda argument calling g , receives g capture. should pass g or &g in capture field of lambda ? will functor copied above code ? if capture g reference, is, syntax &g shown in snippet, no copy performed. preferred way. should copy if lambda might called after f finishes, potentially implies destruction of object g refers to. in case, forwarding cheaper though: template<class function> void f(function&& g) { h(…, [g=std::forward<function>(g)] {g();}); }

On closures and groovy builder pattern -

starting grasp closures in general , groovy features. given following code: class mailer { void to(final string to) { println "to $to" } void from(final string from) { println "from $from" } static void send(closure configuration) { mailer mailer = new mailer() mailer.with configuration } } class mailsender { static void sendmessage() { mailer.send { 'them' 'me' } } } mailsender.sendmessage() what happens under hood when pass closure mailer.send method? does to , from passed arguments closure point of view? types closure maps them? and inside mailer.send method @ moment mailer object calls mailer.with receiving configuration object, object maps them method calls. groovy reflection? groovy can dynamically define delegate of closure , this object. with setting delegate , executing closure. verbose way achieve same: def math = { g...

playframework 2.0 - How to create subprojects inside Play with Intellij? -

currently have following play project structure: playapp modules common sub_project_two playapp marked module, dependent on common. modules directory. common sub project(also play app). sub_project_two sub project(also play app), dependent on common. unfortunately cannot right click on "modules" , create new module(play app) , move on. currently, literally have right click playapp , create new module move "modules", , running dependency issues in intellij , failing import classes inside "common". what correct way of creating subprojects inside intellij? there no special way create subprojects in intellij. subprojects defined in sbt build file. intellij discover these projects , configure them long have scala plugin. imagine following project structure in build file: lazy val playapp = project("playapp", file(".")).aggregate(common, subprojecttwo) lazy val common = project("common", file(...

go - Golang PutItem DynamoDB: Runtime Error invalid memory address or nil pointer dereference -

new programming golang , aws. block of code in function, trying out creating new table , writing values using aws dynamodb. creation successful, program crashes when write happens. not sure why..i'd grateful if me out! **logs**: 2015/07/22 15:46:46 tablestatus: 0xc208193cb0 2015/07/22 15:46:46 end 2015/07/22 15:46:48 sleep 2: before write 2015/07/22 15:46:48 before defining input panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x20 pc=0x401b28] **code block:** { log.println("entry+++") cfg := aws.defaultconfig svc := dynamodb.new(cfg) tabledefinition := &dynamodb.createtableinput{ tablename: aws.string("table1"), attributedefinitions: make([]*dynamodb.attributedefinition, 1, 1), keyschema: make([]*dynamodb.keyschemaelement, 1, 1), provisionedthroughput: &dynamodb.provisionedth...

c++ - How to compute julian arithmetic -

i have problem need find difference between 18-digit current julian-timestamp , constant amount of minutes , result should 18-digit julian timestamp again. now have lib provided api 18-digit current julian-timestamp, not able find simple way compute rest. j = 18-digit current julian-timestamp; /* have */ m = integer, indicates number of minutes elapsed. j-m = r 18-digit julian-timestamp please suggest simplified way compute r. the common usage store julian dates in double. according julian day on wikipedia , julian day january 1, 2000 12:00 ut 2,451,545. need 7 decimal digits process day. since double has precision of 13 decimal digits, still left 6 decimal digits fraction of day. day contains 86400 seconds, julian day contained in float can represent dates since noon on january 1, 4713 bc, in proleptic julian calendar precision of @ least 1 second. and julian period (same reference) *a chronological interval of 7980 years beginning 4713 bc, can still represent 20...

java - Verify business rules -

i have rules validade model class mybean. it's done ifs chain inside 1 method (validatemybean). don't way, seems fuzzy. what's best approach validade many business rules? public class mybean { private int id; private string email; private int age; private string country; private double otherfield; //getter , setter } public class mybeanfacade { //database connection , other methods } public class mybeanbusiness { private mybeanfacade facade; private mybean mybean; public boolean validatemybean() { if(!this.mybean.getemail().contains("@") { return false; } if(this.mybean.getage()<18 || this.mybean.getage()>150) { return false; } if(this.mybean.getcountry().startswith("a") || this.mybean.getcountry().startswith("b") || this.mybean.getcountry().startswith("c") || ) { return false; } ...

java - Apache pig UnsatisfiedLinkError -

i'm getting stack trace when trying run pig job involving joining contents of snappy compressed avro file. org.apache.hadoop.mapred.yarnchild: error running child : java.lang.unsatisfiedlinkerror org.xerial.snappy.snappynative.uncompressedlength the weird thing running code line line in grunt works fine, , can store contents of avro file else fine. this issue seems relevent, refers spark , not pig i faced same issue, , solved replacing snappy-java-xxx.jar under $pig_home/lib latest version downloaded maven

spring mvc - @PreAuthorize Does not restrict user from Access Controller Action -

using grails spring security , spring security acl . have controller: class admincompanycontroller { @preauthorize("hasrole('role_admin')") def create() { println("create") [company: new company()] } } even user has role role_user can access create() action. i know can spring security annotation @secured want acl. how prevent user not have role_admin from access create() action using acl? edit: use grails 2.4.5 and compile ":spring-security-core:2.0-rc5" runtime ':spring-security-acl:2.0-rc2' @preauthorize has used in services. in controllers have stay @secured.

elasticsearch - Renew _ttl on an already expired document -

i'm trying update ttl of document expired has not been deleted yet elasticsearch's bulk operation configured i followin error: org.elasticsearch.index.mapper.mapperparsingexception: failed parse [_ttl] @ org.elasticsearch.index.mapper.core.abstractfieldmapper.parse(abstractfieldmapper.java:411) @ org.elasticsearch.index.mapper.internal.ttlfieldmapper.postparse(ttlfieldmapper.java:174) @ org.elasticsearch.index.mapper.documentmapper.parse(documentmapper.java:552) @ org.elasticsearch.index.mapper.documentmapper.parse(documentmapper.java:493) @ org.elasticsearch.index.shard.indexshard.prepareindex(indexshard.java:493) @ org.elasticsearch.action.index.transportindexaction.shardoperationonprimary(transportindexaction.java:192) @ org.elasticsearch.action.support.replication.transportshardreplicationoperationaction$primaryphase.performonprimary(transportshardreplicationoperationaction.java:574) @ org.elasticsearch...

Nginx: WS upgrade breaks for Android OS < 5 -

i using nginx wss ws forwarding. ws server running on chrome-android (the debugging port). ws server runs fine when tested independently. want wss request. able run same android mobiles having os >= 5.0. doesn't work android mobile having os < 5.0. when tcp-dump on ws port, same request being sent nginx in both cases: android >=5 , android < 5. android phone version < 5 gives "404 response". i think nginx http -> ws upgrade might not working properly. my nginx.conf file http://pastebin.com/ncyg0xbv . kindly mention if going wrong somewhere.

ruby on rails - How to rewrite deleting link_to helper to use it with glyphicon icon? -

i want unattractive delete link become glyphicon icon. how can rewrite following code? <%= link_to 'delete', user_task_path(current_user, task.id), data: { confirm: 'are sure?' }, :method => :delete, remote: true %> try this <%= link_to user_task_path(current_user, task.id), method: :delete, data: { confirm: 'are sure?' }, remote: true %> <i class="glyphicon glyphicon-trash"></i> <% end %>

vbscript - Variable values in For Each loop being retained -

i'm new vbscript , running trouble. script making api call , pulling account information, placing data csv file. i'm pulling data array, looping through each account and, if properties qualify, assigning them variable written csv . problem having if 1 account qualifies property, sets variable , if next account doesn't qualify, variable still retaining value, giving false results in csv . set sftpserver = wscript.createobject("sftpcominterface.ciserver") accounts = sftpserver.adminaccounts each admin in accounts adminname = admin.login dim count : count = admin.getpermissionscount() = 0 cint(count )- 1 set permission = admin.getpermission(i) ' adminpermissionspolicy: ' servermanagement = 0, ' sitemanagement = 1, ' stmanagement = 2, ' usercreation = 3, ' changepassword = 4, ' commanagement = 5, ' reportmanagement = 6, select case permission.permission c...

java - drawString and Ellipse2D compatability issues -

i have gui using drawstring label rows of ellipse2d objects. problem both aren't displayed on same tabbedpane @ same time want them to. question: why happening? drawellipse.java import javax.swing.*; import java.awt.*; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.awt.geom.ellipse2d; import java.util.*; @suppresswarnings("serial") class drawellipses extends jpanel { private static final int oval_width = 30; private static final color inactive_color = color.red; private static final color active_color = color.green; private java.util.list<point> points; private java.util.list<ellipse2d> ellipses = new arraylist<>(); private map<ellipse2d, color> ellipsecolormap = new hashmap<>(); /* * method used populate ellipses initialized ellipse2d */ public drawellipses(java.util.list<point> points) { jlabel outbound = new jlabel("<html><...

python - How to tell scrapy crawler to STOP following more links dynamically? -

basically have regex rule following pages each page has 50 links when hit link old (based on pre-defined date-time) i want tell scrapy stop following more pages, not stop entirely, must continue scrape links has decided scrape -> (complete request objects created). must not follow more links. program grind stop (when it's done scraping links) is there way can inside spider? once hit "too old" page, throw closespider exception. in case, scrapy finish processing links being scheduled , shut down.

linker - Virtual/Logical Memory and Program relocation -

virtual memory along logical memory helps make sure programs not corrupt each others data. program relocation similar thing of making sure multiple programs not corrupt each other.relocation modifies object program can loaded @ new, alternate address. how virtual memory, logical memory , program relocation related ? similar ? if same/similar, why need program relocation ? relocatable programs, or said way position-independent code, traditionally used in 2 circumstances: systems without virtual memory (or basic virtual memory, e.g. classic macos), code for dynamic libraries, on systems virtual memory, given dynamic library find lodaded on address not preferred 1 if other code @ space in address space of host program. however, today main executable programs on systems virtual memory tend position-independent (e.g. pie* build flag on mac os x) can loaded @ randomized address protect against exploits, e.g. using rop**. * position independent executable ** return-...

git - How do I change the user name and email for ALL my Android repo projects? -

i used google's repo tool download cyanogenmod source code android device. set source tree correctly, evidenced fact able build own unofficial rom scratch. having found number of minor bugs, want contribute project doing repo upload. unfortunately, had used vulgar-sounding user name , bogus email address when ran "repo init". don't want upload tagged vulgar, politically incorrect name. there "appears" repo option change user name: "--config-name". surprisingly, after fresh "repo sync", change in user name , email affects 2 config files found in ".repo/manifests.git/" directory. new user name , email don't propagate config files found under ".repo/projects/", project meta-information stored. this discrepancy in user names between manifest configuration , configuration files under ".repo/projects/" wreaks havoc on attempt "repo upload" because of obvious authentication problems regard s...

generic programming - How to get string representation of an expr in Nim template -

is there possibility string representation of expression (or identifier) inside template ? example, having next code: template `*`*(name: expr) {.immediate.} = var `name`* {.inject.}: string = "" # want print 'name' here, not value backticks is possible string representation of name expression inside template? you can use asttostr magic system module this: template foo*(name: untyped) = var `name`* {.inject.}: string = "" # want print 'name' here, not value backticks echo "the variable name ", name.asttostr foo test the output be: the variable name test the use of immediate pragma discouraged latest version of compiler. see following answer more details: typed vs untyped vs expr vs stmt in templates , macros

ruby - String split by certain condition -

i'd split string ' ' if has ':' : "a:hey b:are c:you there" c:you there should not split. result should be: ["a:hey", "b:are", "c:you there"] how can this? \s+(?=\s*:) you can split this. see demo. https://regex101.com/r/hf7zz1/4 this use lookahead make sure space being split upon followed non space characters , : .so work want.

javascript - How to render an .aspx page into a modal in MVC -

i need way open modal in mvc inside webform .aspx page. i've tried open .aspx in new window javascript. window.open("test.aspx", "test", "width=800, height=600"); it works, design of project i'd have in modal. i thought renderize .aspx in control , pass result string javascript ajax call... but don't know how to... you should able render partial @html.partial("test") (if using razor). not sure though since don't know more architecture of app. more info on partials: mvc partials

java - OSM map, custom tile source is not used -

i have following code: public class mainactivity extends activity { mapview map; xytilesource customtilesource; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); map = (mapview) findviewbyid(r.id.mapview); map.setmultitouchcontrols(true); map.setmaplistener(new mymaplistener()); itilesource tilesource = tilesourcefactory.mapnik; string tileurl[] = {"https://bla_bla_bla__don't wanna show here"}; customtilesource = new myxytilesource("point", null, 8, 18, 256, ".png", tileurl); map.settilesource(customtilesource); geopoint startpoint = new geopoint(47.021461, 28.86383); imapcontroller mapcontroller = map.getcontroller(); mapcontroller.setcenter(startpoint); mapcontroller.setzoom(10); mapeventsoverlay eventsoverlay = new mapeventsove...

Present view swift iOS -

Image
i have easy question : can see in image, how supposed show "loginvc" view when i'm in "signupvc" (with code)? create segue between views , use performeseguewithidentifier method.

https - Does tomcat know that haproxy is a proxy server? -

i have couple of questions in regards haproxy (1.5.2) , tomcat (7.0.54). both newbie in. in tomcat have application on login ( https://my.tomcat.host:8080/access ) redirect user (via 303 code) web page ( http://my.tomcat.host:8080/access/sessionid=1234567 ). setting haproxy set frontend engine (my-frontend-https) receive https requests , send them backend (my-backend-https) - in turn sends tomcat server http requests. this haproxy.cfg (for my.haproxy.host) looks like: frontend my-frontend-https bind *:8443 ssl crt /my/certs/server.pem mode http option httplog default_backend my-backend-https backend my-backend-https balance roundrobin mode http option httplog option forwardfor server my-tomcat-srv my.tomcat.host:8080 check on sending following query ( https://my.haproxy.host:8443/access ) found location flag being returned tomcat of form: http://my.haproxy.host:80/access/sessionid=1234567 . looking @ tomcat server found had enable remoteipvalve class ...

java - Lucene search special character -

in lucene index store names special characters (e.g. savić) in field 1 described below. fieldtype fieldtype = new field(); fieldtype.setstored(true); fieldtype.setindexed(true); fieldtype.settokenized(false);<br> new field("name", "savić".tolowercase(), fieldtype); i use stopwordanalyzerbase analyzer , lucene version.lucene_45. if search in field "savić" doesn't find it. how deal special characters? @override protected tokenstreamcomponents createcomponents(final string fieldname, final reader reader) { patterntokenizer src; // diese zeichen werden nicht als trenner verwendet src = new patterntokenizer(reader, pattern.compile("[\\w&&[^§/_&äÄöÖüÜßéèàáîâêûôëïñõãçœ◊]]"), -1); tokenstream tok = new standardfilter(matchversion, src); tok = new lowercasefilter(matchversion, tok); tok = new stopfilter(matchversion, tok, tribuna_words_set); return new tokenstreamcomponents(src, tok) { @override protected void s...

winrt xaml - Link with ms-windows-store: navigates to music player instead Windows Store -

i developing universal app. 1 of buttons should navigate user store page reviewing app. have following code: void btnrate_tapped(object sender, tappedroutedeventargs e) { windows.system.launcher.launchuriasync(new uri("ms-windows-store:reviewapp")); } according dev center link navigates review page of current app. me, link starting ms-windows-store opens in music player in windows phone , leads error page in windows. why that? hint how fix that? in regards hint for works, have : associate app store, have @ least version of app published/available through store. i highly recommend use version providing appid : ms-windows-store:reviewapp?appid=[app id] regards

PHP longest increasing subsequence -

so there answers on here apply c trying in php, , in particular way. i have array of numbers : 7, 2, 6, 3, 10 i want find longest increasing subsequence happens first in order given. example in case want result be: 2, 6, 10 and not 2, 3, 10. what best way accomplish ? okay, here's solution question yielding answer expect. basically, every element found start list , add items when greater last item in list far. $input = array(7,2,6,3,10); $trial = array(); echo "input: "; print_r($input); echo "<br><br>\n"; foreach ($input $key => $value) { // create new trial each starting point // ------------------------------------------ $trial[$key][0] = $value; echo "trial $key started<br>\n"; // process prior trials // ------------------------ ($i = $key-1; $i >= 0; $i--) { echo "looking @ trial $i "; $last = count($trial[$i]) - 1; $lastval = $trial[$i][$last]...

jenkins - Maven downloads from central though other repo configured and artifact already present -

i run jenkins build on server without internet access. artifacts must downloaded nexus proxy repositories. goes fine, tens of jars being downloaded proxy, until maven tries download central artifact has downloaded. below lines of log: [info] downloading: http://{mynexus}/nexus/content/groups/{myrepo}/commons-lang/commons-lang/2.6/commons-lang-2.6.jar . . . [info] downloaded: http://{mynexus}/nexus/content/groups/{myrepo}/commons-lang/commons-lang/2.6/commons-lang-2.6.jar (278 kb @ 3118.6 kb/sec) . . . [info] downloaded: http://{mynexus}/nexus/content/groups/{myrepo}/com/google/guava/guava/10.0.1/guava-10.0.1.jar (1467 kb @ 23275.9 kb/sec) [info] downloading: http://repo.maven.apache.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar picked java_tool_options: -agentlib:jvmhook [warning] failed getclass org.codehaus.mojo.sonar.sonarmojo it doesn't try check configured repository first, , artifact has been downloaded proxy. wonder last 2 lines mean, not normal ...

sharepoint - What is the difference between item content type and document content type -

what difference between item content type , document content type?. can list item associated item content type moved document library document library having document content type?..please help an item equivalent row in table, or record in database. consists of columns of metadata. tables in reside in sharepoint called lists. a document type of item, additional functionality. additional functionality depends on fact document has associated file. in sharepoint, documents exist in special type of list called document library. instead of record in database, document more file in file system; not have columns of metadata, has underlying file (the document itself). can't exist without underlying file. only items of document content type, or items content type inherits document content type, can placed in document libraries. items content types not inherit document content type cannot exist in document libraries because not have necessary file association.

c# - Rich Text Format Line Spacing -

i try convert plain text in rtf-format. therefore, use richtextbox (winforms). concerned method rtf-markup string. now, want insert line spacing in markup. found there 2 parameters: - \slx (space between lines in twips) - \slmultx (either 0 or 1) if set \slmult0 , line spacing above line of text. when set \slmult1 , line spacing below line of text. i calculate spacing in following way: (linespacing + fontsize)*20 when switched \slmult0 \slmult1 , determined, line distance little smaller \slmult0 . does know reason behavior? have calculate formula? if set \slmult0, line spacing above line of text. when set \slmult1, line spacing below line of text. that not read in specs . the way understand it, means \slmult0 says value of \sln used directly distance in unit, whereas \slmult1 says n in \sln meant factor regular line spacing multiplied. see last post here (some) more details! (but there note taking effect 1 line late..) also note im...

search - Sitecore indexing strategies (auto index rebuild not happening) -

i have configured indexing async strategy, index not rebuilding after specified time interval. configuration indexing: <indexupdatestrategies> <intervalasyncweb type="sitecore.contentsearch.maintenance.strategies.intervalasynchronousstrategy, sitecore.contentsearch"> <param desc="database">web</param> <param desc="interval">00:01:00</param> <checkforthreshold>true</checkforthreshold> </intervalasyncweb> <intervalasyncmaster type="sitecore.contentsearch.maintenance.strategies.intervalasynchronousstrategy, sitecore.contentsearch"> <param desc="interval">00:01:00</param> </intervalasyncmaster> <intervalasynccore type="sitecore.contentsearch.maintenance.strategies.intervalasynchronousstrategy, sitecore.contentsearch"> <param desc="interval">00:05:00</param> </intervalasynccore> ...

How to count number of semicolon in the Textbox field In Infopath 2013? -

field value : test1;test2;test3;test4 i need count number of semicolon present in field : 3 its possible without coding? try this: field a: test1;test2;test3;test4 field b(default value): string-length(translate(fielda, "1234567890abcdefghijklmnopqrstvwxyzabcdefghijklmnopqrstuvwxyz", "")) result: 3 translate function convert other characters blank(no space) , using string-length count semicolons left. edit: created blog post 1 detailed explanation , steps.

javascript - Dynamically add multiple CKEDitor in IFRAME Yii -

i need multiple ckeditor in iframe yii. i have followed link works without iframe have popup dialog iframe iframe works single instance editor need mulipte code single instance : <?php echo $form->textarea($model, 'message', array('id'=>'question_editor','maxlength'=>508)); ?> <script src="<?php echo yii::app()->baseurl.'/assets/ckeditor/ckeditor.js'; ?>"></script> <script type="text/javascript"> ckeditor.config.toolbar_ma=[ ['format','bold','italic','underline','-','superscript','-','justifyleft','justifycenter','justifyright','justifyblock','-','numberedlist','bulletedlist','-','outdent','indent'] ,{ name: 'links', items: [ 'link', 'unlink', 'anchor' ] },{ name: 'colors', items: [ ...

ajax - Django pagination: "show all" implementation -

i have page list of objects , 2 buttons: show more , show all . objects loaded ajax, sending itemslistview page number: class itemslistview(listview): paginate_by = 2 on initializing page, js variable current_page set 1 , , js sends ajax request itemslistview view, gets 2 objects first page , renders them. when user clicks on show more button, current_page value increments, , js requests objects next page. now want implement show all button. example, if have following list of objects: [1, 2, 3, 4, 5, 6, 7, 8, 9] , on page load objects 1 , 2 rendered. after user clicks on show more , render objects 3 , 4 . after user clicks on show all , render objects 5 , 6 , 7 , 8 , 9 . i changed dynamically paginate_orphans in view: class itemslistview(listview): paginate_by = 2 paginate_orphans = 0 def get_paginate_orphans(self): show_all = json.loads(self.request.get.get('show_all', 'false')) page_kwarg = self.page_kwarg...

php - Bot-blocking code ignored in htaccess? -

i've been trying solve several days now, can't find answer. on shared hosting account i'm using, i'd modify .htaccess file block bots visiting site. code i've used: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / setenvifnocase user-agent .*dotbot.* bad_bot setenvifnocase user-agent .*gigabot.* bad_bot setenvifnocase user-agent .*ahrefsbot.* bad_bot <limit post head> order allow,deny allow deny env=bad_bot </limit> rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress it's wordpress site. strangely enough, seems it's bot blocking part being ignored. i've tried using 302 redirect , worked fine, file being read , processed. i've noticed code seem work on sites, not others. have being addon domain? seems case code not working on primary domains either. the .htaccess file (together domai...

Change MS Excel Row Colour in Excel using C# -

i creating small program allow user input data windows form. once data has been input form added excel document using oledb. i have no problems above section , can input data no bother problem comes when try change colour of excel row. i looking change colour of row red if row has no fill. the code using: excel.application application = new excel.application(); excel.workbook workbook = application.workbooks.open(@"c:\users\jhughes\desktop\screenupdate.xls"); excel.worksheet worksheet = (excel.worksheet)workbook.sheets["dailywork"]; excel.range usedrange = worksheet.usedrange; excel.range rows = usedrange.rows; try { foreach (excel.range row in rows) { if (row.cells.entirerow.interior.colorindex = 0) { row.interior.color = system.drawing.color.red; } } } catch(exception ex) { ...

java - how to configure websocket handle using class + spring 4.0.0 -

can 1 me please how configure web socket bean , handler using class base rather xml file. <bean id="websocket" class="co.syntx.example.websocket.handler.websocketendpoint"/> <websocket:handlers> <websocket:mapping path="/websocket" handler="websocket"/> <websocket:handshake-interceptors> <bean class="co.syntx.example.websocket.handshakeinterceptor"/> </websocket:handshake-interceptors> </websocket:handlers> thanks do in websocketconfig.java @configuration @enablewebsocket public class websocketconfig implements websocketconfigurer { @override public void registerwebsockethandlers(websockethandlerregistry registry) { registry.addhandler(new websocketendpoint(), "/websocket") .addinterceptors(new handshakeinterceptor()); } } in above code, new websocketendpoint() websocketendpoint.java websocket handler , new han...

ios - How to move view at the center of visible frame when keyboard appears? -

Image
i have standard uiview (containing image view, 2 textfield , button) embedded in root scroll view. i'm using autolayout put uiview @ center of scroll view, shown in screenshot below. i trying write method moves uiview when keyboard appears, view appear @ center of smaller visible frame. achieve this, calculated heights. - (void)keyboardwillshow:(nsnotification *)notification { // determines size of keyboard frame cgsize keyboardsize = [[[notification userinfo] objectforkey:uikeyboardframebeginuserinfokey] cgrectvalue].size; [uiview animatewithduration:0.3 animations:^{ // gets root 'uiview' frame , stores in variable cgrect viewframe = self.itemsview.frame; // height of visible frame once keyboard appears double visibleframeheight = (self.view.frame.size.height - keyboardsize.height); // how 'uiview' should move double offset = ((visibleframeheight - viewframe.size.height / 2); // move...

xcode - Accidentally deleted info.plist file under supporting folders: what to do? -

i had done lot of work in project , when tried import ton of images put them under supporting folders in image files seemed have caused xcode start throwing errors , in panic accidentally deleted info.plist file (that comes new project default). not file know , have taken granted far. can me restore it, or have start over? thanks. i have done before. check trash on computer, should in there , re-add project.