Posts

NSTimer IOS setting text of layer but text disappears once timer is destroyed -

NSTimer IOS setting text of layer but text disappears once timer is destroyed - i'm using nstimer write text catextlayer text displays split second. i set first timer this: -(void) startsentanceanimation{ float firsttime = [[sentancearray objectatindex:0][@"time"]floatvalue]; [nstimer scheduledtimerwithtimeinterval:firsttime target:self selector:@selector(timedsentances:) userinfo:sentancearray repeats:no]; } it calls method changes text , creates new timer. -(void)timedsentances:(nstimer *)timer{ nsarray *userinfo = timer.userinfo; timer = nil; nsstring *sentance = [userinfo objectatindex:sentancecount][@"sentance"]; [self nextline:sentance]; //textlayer.string = sentance; float intervallength = [[userinfo objectatindex:sentancecount][@"time"]floatvalue]; [nstimer scheduledtimerwithtimeinterval:intervallength target:self selector:@selector(timedsentances:) userinfo:userinfo repeats:no]; sen...

php - How to get the right max id and min id from a function? -

php - How to get the right max id and min id from a function? - i had big table 3 1000000 rows before, split 6 tables 500.000 rows each, i'm trying connect them, want read 1 table 1 not 6 tables @ same time, i'm trying utilize website pagination select table needs read , max id , min id. i made function: $content['data']['max_table'] = 6; $content['data']['min_table'] = 1; $content['data']['limit_page'] = 100; function tables( $start_num, $end_num ) { global $content; if($end_num <= 500000) { $table_number = $content['data']['max_table']; } else if($end_num > 500000) { $calc = intval($end_num/500000); $table_number = $content['data']['max_table']-$calc; } $array = array(); $array['table_number'] = $table_number; $array['max_id'] = ($table_number*500000)-$end_num; $array['...

ios - Xcode wont play sound in this folder? -

ios - Xcode wont play sound in this folder? - hi simple app play sound when button pressed. imported frameworks , folder whole host of sounds, when set path wont play sound , nse exception error when click on button play sound. took sound file out of folder though folder in project , magically plays? ideas? or code must add together in order play folder? #import <avfoundation/avaudioplayer.h> #import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller avaudioplayer *theaudio; - (ibaction)yes:(id)sender { nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"yes" oftype:@"mp3"]]; theaudio = [[avaudioplayer alloc] initwithcontentsofurl:url error:null]; [theaudio play]; } @end this chance larn both exceptions , bundles/files: first, exceptions: nsexception root class of exceptions, , not useful way describe h...

sbt - How to execute task that calls clean on subprojects without using aggregation? -

sbt - How to execute task that calls clean on subprojects without using aggregation? - i want create take cleanall executes clean task on number of subprojects. don't want utilize aggregation sake of clean . we've run issues play's asset routes when we've been using submodules. it's documented how create new task, how phone call task on subproject? based on illustration jacek laskowski i've come next plugin should placed in /project folder: import sbt._ import sbt.autoplugin import sbt.keys._ import sbt.plugins.jvmplugin object cleanallplugin extends autoplugin { val cleanall = taskkey[unit]("cleans projects in build, regardless of dependencies") override def requires = jvmplugin override def projectsettings = seq( cleanalltask ) def cleanalltask = cleanall := def.taskdyn { val allprojects = scopefilter(inanyproject) clean.all(allprojects) }.value } the plugin can added root project usage: v...

c# - Entity Framework, Stored Procedures and everything -

c# - Entity Framework, Stored Procedures and everything - so, promised see if help friend little asp mvc application. i've started regret though since haven't touched entity framework many years. have mssql database users can post , list own info (only). don't want have individual db users, users logon using oauth external providers, working good. need prepare crus , match useridentity own posts. our discussions there's 3 paths ahead. handling crud in webapp-code, lot of examples , seem work nice. friend kind of db-centric though , open database list info using crystal or excel scares him. handling in views, kind of little webapp guess result in slow joins if there lot of posts in end. handling crud stored procedures, old style i haven't used entity framework since brand new i'm not aware of it's features today. advice or resources on why take 1 on other welcome best regards! c# asp.net entity-framework

c++ - what is the proper method of using resource files in MFC project? -

c++ - what is the proper method of using resource files in MFC project? - i have made mfc-based game , project includes images , sounds. want create installer setup in order distribute it. i have used resources providing exact path in e.g img->load(l"c:\\users\\ad33l's\\desktop\\block mania\\block mania\\res\\db.png"); mciwndcreate(null, null,ws_popup|mciwndf_noplaybar|mciwndf_nomenu,l"c:\\users\\ad33l's\\desktop\\block mania\\block mania\\res\\tick.wav"); 1.can tell me way avoid hard-coding actual resource path these resource files not nowadays @ same exact path in other computers ? 2.also guide me handle these resource files during creation of standalone setup (i using advance installer ) (as actual answer). do not utilize absolute path, utilize relative path; relative exe file 1 solution. the exe path can found using getmodulefilename. char apppath[maxfilenamelen]; getmodulefilename(null, apppath, maxfilenamelen); ...

one mysql query getting, per each row, the average of the previous three rows -

one mysql query getting, per each row, the average of the previous three rows - i have this: id | value --------------- 201311 | 10 201312 | 15 201401 | 20 201402 | 5 201403 | 17 and need result this: 201311 | null or 0 201312 | 3.3 // 10/3 201401 | 8.3 // (15+10)/3 201402 | 15 // (20+15+10)/3 201403 | 13.3 // (5+20+15)/3 so far, got point can avg of lastly 3 previous rows this: select avg(c.value) (select b.value table b b.id < 201401 order b.id desc limit 3) c passing id manually. i'm not able each id. any ideas much appreciated! thanks lot. regards i think you'll have write stored procedure, utilize cursor, iterate through table , populate new table using values calculated in cursor loop. if need help writing out cursor loop, drop comment , can example. mysql

scala - How can I write a trait with @BeanProperty members that must be implemented? -

scala - How can I write a trait with @BeanProperty members that must be implemented? - i want define trait used java code , hence convenient have java-friendly setters , getters members. @beanproperty annotation me, can't work members left undefined in trait. following: import scala.beans.beanproperty trait { @beanproperty var usefoo: boolean } yields warning no valid targets annotation on method usefoo - discarded unused. may specify targets meta-annotations, e.g. @(scala.beans.beanproperty @getter) trait { @beanproperty var usefoo: boolean } however, not discarded unused. class extending above trait, example class b extends { var usefoo = false } is correctly rejected compiler not implement getter , setter of beanproperty. annotating usefoo field in class b @beanproperty makes work expected. however, seems not proper way this, since above warning generated. the documentation meta annotations suggests targets useful if want propagate other annotatio...

make - configure :error: No usable version of sed found: -

make - configure :error: No usable version of sed found: - i did ./configure create makefile but ran error: configure :error: no usable version of sed found: i typed see it shows /usr/bin/sed. so, what's wrong? why can't ./configure find sed? i happened have problem on mac. because os x uses old version of sed. installing gnu-sed brew install gnu-sed , alias gsed=sed solved problem. may install gnu-sed other method. make

algorithm - How can you find points in regions of space quickly -

algorithm - How can you find points in regions of space quickly - consider 5 dimensional space has been partitioned @ to the lowest degree 2 planes go through origin. if there n planes number of distinct pyramidal regions creates n^4/24-n^3/4+(23 n^2)/24-(3 n)/4+1 long in "general position", term create specific below. a hyperplane through origin can defined single vector starting @ origin orthogonal plane. hyperplanes in general position if no 3 of vectors defining hyperplanes coplanar. how can find 1 point per pyramidal part efficiently in 5 dimensional space? homecoming k points in 5d space, each of in different pyramidal region. value k part of input. my naive effort far picks points uniformly @ random on surface of hypersphere using (in python) def points_on_sphere(dim, n, norm=numpy.random.normal): """ http://en.wikipedia.org/wiki/n-sphere#generating_random_points """ normal_deviates = n...

javabeans - Refactoring old jsp site -

javabeans - Refactoring old jsp site - i'm refactoring old jsp site when *.jsp has embedded java code. cos logic big dont want alter technology, want run on tomcat 1 time again introducing beans, jstl. have ~ 10 kind of html templates constant part. found pattern refactoring: 1 jsp master layout plus 10 sections module html , configured beans <jstl:when test="<%=sitebean.getmodule()==sitemodules.index%>"> , configured beans within sections eg. <jsp:usebean id="editplayerbean" class="editplayerbean"/> <% editplayerbean.setsitebean(sitebean); %> is concept refactoring site performance - economical criteria? yes it's approach re-factoring site way. try remove script-lets , utilize look language rather. save beans in suitable scope , utilize them using el. transform conditions equivalent jstl tags. html parts remain same. after integrating jstl, ...

Should I use localhost in the endpoint address of a WCF service? -

Should I use localhost in the endpoint address of a WCF service? - if host publicly available wcf web service in iis, how should configure endpoint address? think can utilize either: <endpoint address="http://localhost/myservice" ... /> or <endpoint address="http://example.com/myservice" ... /> in both cases, client on machine must utilize sec alternative client binding. if utilize visual studio create client, both server bindings seem work fine. however, think had problem using new-webserviceproxy in powershell first option. does matter 1 utilize on server? msdn: specifying endpoint address: you must utilize relative endpoint addresses iis-hosted service endpoints. supplying fully-qualified endpoint address can lead errors in deployment of service. more information, see deploying net info services-hosted wcf service. from link: when hosted in iis, endpoint addresses considered relative address of .svc ...

Mailgun events api not returning results for recipient -

Mailgun events api not returning results for recipient - i'm trying retrieve "store" events particular user. if supply "recipient" parameter (or "to" parameter) empty results. if don't supply parameters store events, not ones i'm interested in. sample code (csharp using restsharp): restclient client = new restclient("https://api.mailgun.net/v2"); client.authenticator = new httpbasicauthenticator("api", "my-key"); restrequest req = new restrequest(); req.addparameter("domain", "mydomain.com", parametertype.urlsegment); req.resource = "{domain}/events"; req.addparameter("event", "stored"); // neither of next work // req.addparameter("recipient", "email@mydomain.com"); req.addparameter("to", "email@mydomain.com"); ...

php - Will file() affect the performance for files approximately 2 MB in size? -

php - Will file() affect the performance for files approximately 2 MB in size? - i have 1 alternative grab info text file, cannot utilize database store that. file function grab info beingness re-created everyday @ 00:00, it's not problem big. maximum 2 mb of size , maximum of 6,000 - 7,000 lines @ end of day. my concern grabs info , display on webpage can accessed lot of times ( approximately 10,000 per day or less ) -- somehow overload server using file() or little file should fine? please allow me know. taking time read question , perchance answer. example lines .txt file: 1,42,16, 201,stackoverflow_user, 1, 6762160, 39799, 9817242, 6762160, 39884, 10010545,stackoverflow_user, 2, 1351147, 1165, 483259, 1351147, 1115, 241630, 0 1,46,27, 201,[stackoverflow_user | stackoverflow_userother], 1, 4078465, 286991, 1594830, 4078465, 287036, 1643156,stackoverflow_user, 2, 1357147, 1115, 241630, 1357147, 1065, 120815, 0 my function: # read file array $lines = ...

Spark Streaming Cache and Transformations -

Spark Streaming Cache and Transformations - i new spark, using spark streaming kafka.. my streaming duration 1 second. assume 100 records in 1st batch , 120 records in 2nd batch , 80 records in 3rd batch --> {sec 1 1,2,...100} --> {sec 2 1,2..120} --> {sec 3 1,2,..80} i apply logic in 1st batch , have result => result1 i want utilize result1 while processing 2nd batch , have combined result of both result1 , 120 records of 2nd batch => result2 i tried cache result not able cached result1 in 2s possible? or show lite on how accomplish goal here? javapairreceiverinputdstream<string, string> messages = kafkautils.createstream(jssc, string.class,string.class, stringdecoder.class,stringdecoder.class, kafkaparams, topicmap, storagelevel.memory_and_disk_ser_2()); i process messages , find word result 1 second. if(resultcp!=null){ resultcp.print(); result = resultcp.union(words.mapvalues(new sum())); ...

java - IllegalArgumentException at URLPermission in jre8 -

java - IllegalArgumentException at URLPermission in jre8 - when run code below, -in applet on jre8, on line con.getinputstream() throws exception -in applet on jre7 or jre6 it not throws. -in desktop app on jre it not throws. when remove lines starts setrequestpropery, does not throws exception on jre. urlconnection con = new url(adress).openconnection(); con.setdooutput(true); con.setdoinput(true); con.setusecaches(false); con.setrequestproperty("content-type", "application/octet-stream"); con.setrequestproperty("pragma:", "no-cache"); printstream ps = new printstream(con.getoutputstream()); ps.println("test"); ps.close(); in = new datainputstream(conn.getinputstream()); exception: java.lang.illegalargumentexception: invalid actions string @ java.net.urlpermission.init(unknown source) @ java.net.urlpermission.<init...

Set goal for leader NetLogo -

Set goal for leader NetLogo - i getting error in this. need inquire leaders move toward goal. getting error face expected input agent got list [5 2] instead. error while turtle 63 running face called procedure leader-toward-goal called procedure go called button 'go' here piece of code patches-own [ is-visited? ] turtles-own [ is-leader? goals ] ;globals [ number ] setup allow number 70 ca inquire patches [set is-visited? false ] inquire n-of number patches [sprout 1 [set size 1 set is-leader? false ]] choose-leader inquire turtles [ set goals [ [15 10] [5 2] [0 0] ] ] ;tick end go ; inquire turtles [ is-leader? ] [ fd 1 ;let target one-of goals ;lt random 20 ;rt random 10 ;set is-leader? false] follow-leader visited-patch inquire turtles [ is-leader? ] [ leader-toward-goal] ;ask turtles [ tick ] end visited-patch if any? turtles-here [ set is-visited? true ] end choose-leader inquire max-n-of 7 turtles [ count turtl...

javascript - Watched directive attribute changed in $emit -

javascript - Watched directive attribute changed in $emit - i have directive that's watching controller property modified within event handler. the code looks this: vm = this; vm.someproperty = false; // event listeners $scope.$on('controller.loaded', function (event, data) { // data.someproperty === true. angular.extend(vm, data); }); i have directive uses property: <body mydirective="somecontroller.someproperty"> and $observe on property value within directive: attrs.$observe(attrs.mydirective, function (value) { when create changes vm.someproperty within event listener, $observe handler never triggered. guess alter outside of angular scope allow register change. do need trigger in case create sure observed properties , dependencies re calculated? javascript angularjs

how to import JSON data into highstocks candlestick type graph? -

how to import JSON data into highstocks candlestick type graph? - i working on stock analyzer project ,i ve got stock quotes yahoo finance,and want create dynamic graphs of them.i m using highstock-candlestick highcharts.com ...i have 0 info regarding json. ve seen there's 1 code import info chart.i ve got stock quotes using stock analyzer tutorials of "thenewboston"..i jst need know how link info highstock.. this sample data...how can add together real info yahoo finance website??? plz help $.getjson('http://www.highcharts.com/samples/data/jsonp.php?a=e&filename=aapl-ohlc.json&callback=?', function (data) <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>highstock example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <style t...

c# - Create a numeric value from text -

c# - Create a numeric value from text - i have searched allot on google without results looking for i numeric value string in c# ex. var mystring = "oompa loompa"; var numericoutput = convertstringtonumericvalue(mystring); output/value of numericoutput 612734818 so when set in string allow "c4rd1ff internat!onal @ gr3at place#" int output 73572753 . the values must remain constant, illustration if come in same text 1 time again of "oompa loompa" 612734818 again. i thought maybe in way of using font family char index of each character, don't know start this. the reason can utilize number generate index out of string other info in it, , same input string, same index 1 time again recall final output string validation. any help or point in right direction appreciated thanks tim ended doing following: var inputstring = "my test string ~!@#$%^&*()_+{}:<>?|"; byte[] asciibytes = encoding...