Posts

objective c - How to convert a method name into a String -

i´m developing little game right , want have several levels. i´m asking if it´s first time app gets launched. if it´s user start @ level1. if want start method. have methods like: -(void)level1{}; -(void)level2{}; . . . till level 100 or so. after if got amount of times app got started want call method, fits. tried make like: [self [nsstring stringwithstring:@"level%d", level]]; because "level" has number 1,2,3...,100. tried make level1,level2, level3, , on. error -> unexpected interface name 'nsstring': expected expression. can please me? in advance! peace! you need use nsselectorfromstring() : nsstring* methodname = [nsstring stringwithformat:@"level%d", level]; sel sel = nsselectorfromstring(methodname); [self performselector:sel];

R ggmap ggplot2 error "Error: Discrete value supplied to continuous scale" -

Image
first of all, apologise. i know there numerous threads error, have tried numerous solutions , have not managed solve issue. i have tried transforming data numerous forms still same error, or ggplot2 not support data format. here code: library(ggmap) library(ggplot2) library(data.table) setwd("~/projects/reformat") map <- get_map(location = c(-4,54.5), zoom = 6) data <- read.csv('lonlatprice.csv') colnames(data) <- c('longitude','latitude','price') ggmap(map, extent = "device") + geom_point(aes(x = data$longitude, y = data$latitude), colour = "red", alpha = 0.1, size = 2) this data format like: > head(data) longitude latitude price 1 53.778274 -2.48129 147500 2 52.833819 -0.936527 182000 3 50.792457 0.046043 193000 4 51.476984 -0.612126 580000 5 51.460139 -0.01867 905000 6 52.235942 1.519404 641500 thanks in advance help, have ask...

javascript - d3.js to remove two elements with matching attribute when clicked consecutively -

i have 2 elements identical href attributes. clicked, adding class. if, in addition, href of element clicked first equal href of element clicked second, filtered out. removebubble = function(d) { var currentid; currentid = idvalue(d); d3.select(this).classed("clicked",true); // on click add class if (d3.selectall(".clicked").length === 2 && // 2 elements class clicked d3.select(this).prev.attr("href") === // href of 1st elem d3.select(this).next.attr("href")) // href of 2nd elem { // filter here } }; the task: 1. check if elements clicked have matching href how can achieve .prev() , .next() - jquery assessors - effect in d3.js ? so far: uncaught typeerror: a.target.classname.indexof not function here final working solution comments: removebubble = function(d) { var currentid; currentid = idvalue(d); // when clicked attach class var...

python - Beautiful soup webscrape into mysql -

the code far downloads , prints onto screen,but how printed material sql database.if wanted data csv files seems python(on day) creates file automatically.obviously transferring mysql assume have create database beforehand in order receive data.my question how data scrape database omitting csv step altogether. in anticipation have downloaded pymysql library.any suggestions aprreciated..looknow from urllib import urlopen bs4 import beautifulsoup html = urlopen("http://www.officialcharts.com/charts/singles- chart/19800203/7501/" ) bsobj = beautifulsoup(html) namelist = bsobj. findall("div" , {"class" : "artist",}) name in namelist: print(name. get_text()) html = urlopen("http://www.officialcharts.com/charts/singles- chart/19800203/7501/" ) bsobj = beautifulsoup(html) namelist = bsobj. findall("div" , {"class" : "title"}) name in namelist: print(name. get_text()) so there...

Unity3D Camera jittering when dragging -

i'm making game in want able drag camera across scene. wrote following code: // when dragging if(touchdetection.touchdragging && introbusy == false) { if(dragactive == false) { dragstartpos = touchdetection.touchpositionwp; camerastartpos = camera.main.transform.position; dragactive = true; camerafollowingplayer = false; } vector2 temp = touchdetection.touchpositionwp - dragstartpos; camera.main.transform.position = camerastartpos - new vector3(temp.x, temp.y, 0); } if(touchdetection.touchdragging == false) { dragactive = false; } during drag, however, camera move, has jitter while moving. further away drag, bigger jitter becomes. i've spent hours searching problem, have still not found solution. a couple of points 1. it's practice move cameras in lateupdate rather in update. allows camera render after bodies have been moved. ...

download - Files downloaded as Binary with Java are corrupted -

i have written downloader should used download text files, images. download files binaries. many of downloads work well, parts of text files , many image files corrupted. errors occur @ same files , @ same places (as long can tell when analysing text files). used code downloading: public file downloadfile(httpurlconnection connection) { return writefiledatatofile(getfiledata(connection)); } //downloads data of file , returns content string private list<byte> getfiledata(httpurlconnection connection) { list<byte> filedata = new arraylist<>(); try (inputstream input = connection.getinputstream()) { byte[] filechunk = new byte[8*1024]; int bytesread; { bytesread = input.read(filechunk); if (bytesread != -1) { filedata.addall(bytes.aslist(filechunk)); filechunk = new byte[8*1024]; } } ...

javascript - Blocked myself from server with form submissions -

so i've been working on client involving simple form generates url , resultant page outputs table. form explicitly set method="post" , action="" , js handling url so: onsubmit="this.action='{site_url}/entries/'+this.survey.value+'/'+this.job_number.value;" the form works fine, after several dozen submissions (mostly re-submissions of same form), server has blocked ip (via csf). what has caused , how can prevent happening again? the owner of service using either cooperating or not. if he/she cooperating you, should ask them cause of issue. sure give information need know server, not encounter issue again long follow policies. if not cooperating you, well, unlucky event, without solution.