Posts

Showing posts from September, 2015

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...

Display each bit in a char C++ -

Display each bit in a char C++ - i want display each bit in char. not work : char flags = bytefromfile(); for( int = 0; < 8; i++ ){ int tmp = ( flags >> ) & 0x2; cout << tmp; } cout << endl; what's wrong code? i zeros byte has value of 3 ( looked debugger ). there couple of problems in code. you using & 0x2 instead of & 0x1 . you printing to the lowest degree important bit first. the next should prepare both. #include <iostream> int main(int argc, char** argv) { unsigned char flags = argv[1][0]; (int = 7; >= 0; --i) { std::cout << ((flags >> i) & 0x1); } std::cout << '\n'; } c++

Is there a comprehensive list of special macros in Julia? -

Is there a comprehensive list of special macros in Julia? - http://julia.readthedocs.org/en/latest/manual/metaprogramming/ discusses macros in julia, start @ , lists 2 special macros, text_str , , cmd , handle text"string" , `shell command` , respectively. there comprehensive list of these special macros supported julia? possible define own? so macros, including string literal macros, in exports.jl . if asking these special syntax transformations in general string literal macros, don't think thats question thats answerable: there multiple arbitrary syntax translations that can't in user code (without using @ denote transforming syntax macro). julia macro-or-function-looking things aren't magic, string literals, ccall , , maybe things a'c , qualify. julia-lang julia-macros

python 2.7 - cannot change ticks in subplots -

python 2.7 - cannot change ticks in subplots - i trying alter ticks in subplot: result in image below. i utilize next code: plt.subplot(2,2,1) plt.scatter(d,d1,c=chi,s=25,edgecolor='') plt.xticks(tic,lab) plt.vlines(dm,min(d1),max(d1),color='b') plt.vlines(dma,min(d1),max(d1),color='b') plt.hlines(d1ma,min(d),max(d),color='b') plt.hlines(d1ma,min(d),max(d),color='b') plt.xlabel("$\delta$") plt.ylabel('$\delta_1$') plt.colorbar() plt.subplot(2,2,3) plt.scatter(d,l,c=chi,s=25,edgecolor='') plt.xticks(tic,lab) plt.vlines(dm,min(l),max(l),color='b') plt.vlines(dma,min(l),max(l),color='b') plt.hlines(lm,min(d),max(d),color='b') plt.hlines(lma,min(d),max(d),color='b') plt.xlabel("$\delta^\prime$") plt.ylabel('l') plt.colorbar() plt.subplot(2,2,4) plt.scatter(d1,l,c=chi,s=25,edgecolor='') plt.vlines(d1m,min(l),max(l),color='b') plt.vlines(d1ma,min...

Table Row Traversing with JavaScript jQuery -

Table Row Traversing with JavaScript jQuery - i have table formatted following: <table> <tbody> <tr class="node"> <td onclick='toggledesc(this.parentnode);'>blah</td> </tr> <tr class="subnode"> <td>sblah</td> </tr> <tr class="subnode"> <td>sblah</td> </tr> <tr class="subnode"> <td>sblah</td> </tr> <tr class="node"> <td onclick='toggledesc(this.parentnode);'>blah</td> </tr> <tr class="subnode"> <td>sblah</td> </tr> <tr class="subnode"> <td>sblah</td> </tr> </tbody> </table> i have function toggles displ...

graph theory - Solving a weighted network flow using Neo4J -

graph theory - Solving a weighted network flow using Neo4J - i have bipartite graph (guy , girl notes) nodes connected weighted edges (how compatible girl-guy pair is) , each node has capacity of 5 (each guy/girl can matched 5 people of opposite gender). need find best possible matching maximize weights. this can formulated weighted network flow - each guy source of 5 units, each girl sink of 5 units, , each possible arc has capacity of 1 unit. problem can solved either using linear programming, or graph traversal algorithm (such ford–fulkerson). i'm looking possible solutions using neo4j - have thought how go it? (or should go linear programming solution...) i think this. find 5 compatible relationships ordering weight of relationship in descending order , create them separate relationship match . match (guy:guy)-[rel:compatible]->(girl:girl) guy.id = 'xx' guy, rel, girl order rel.weight desc limit 5 create (guy)-[:match]->(girl) neo4j gr...

fortran - how to install mpfun90? -

fortran - how to install mpfun90? - i trying write multiprecision programme in fortran. wrote double precision programme in fortran. can help me convert multiprecision. discovered d. baily multiprecision library ( http://crd-legacy.lbl.gov/~dhbailey/mpdist/ mpfun90) unable install it. how can install mpfun90 on ubuntu? can help me (step step)? utilize gfortran compiler. download. ungzip , untar. use: gfortran mpfun90.f90 mpmod90.f90 yourprog.f90 -o yourprog.exe fortran multiprecision

ios - how to send background location when application terminated -

ios - how to send background location when application terminated - i want send location ground in every 10 min when app terminated or in background . please give code , how utilize .. possible if yes suggest me make sure add together next header: @interface viewcontroller : uiviewcontroller<cllocationmanagerdelegate> include framework: click project in navigator. click plus button under "link binary libraries" add corelocation project. import header file: #import <corelocation/corelocation.h> declare cllocationmanager: cllocationmanager *locationmanager; viewcontroller.m - (void)viewdidload { [super viewdidload]; nslog(@"today monday"); mytimer = [nstimer scheduledtimerwithtimeinterval: 60.0 target: self selector: @selector(first:) userinfo: nil repeats: yes]; } -(void)first:(id)sender { locationmanager = [[cllocationmanager alloc] init]; loc...

facebook - FB api comments notifications -

facebook - FB api comments notifications - i'm working on classified ads site works fb sdk. upload classified ad, user must give permission sdk application. after creating classified ad, fb comments shown below it. need when makes comment, gets notification advertisement owner link site. possible? hope can help me, days ago i'm looking solution , can not find it. may real time updates may help here facebook real time api. though not able find functionality such. you can come of sort. at end of day or low load times can traverse shared posts new comments in day. if there comment can extract , send admin of advertisement on email. facebook notifications comments subscribe

linux - Bash, Remove empty XML tags -

linux - Bash, Remove empty XML tags - i need help couple of questions, using bash tools i want remove empty xml tags file eg: class="lang-xml prettyprint-override"> <createofficecode> <operatorid>ve</operatorid> <officecode>1234</officecode> <countrycodelength>0</countrycodelength> <areacodelength>3</areacodelength> <attributes></attributes> <chargearea></chargearea> </createofficecode> to become: class="lang-xml prettyprint-override"> <createofficecode> <operatorid>ve</operatorid> <officecode>1234</officecode> <countrycodelength>0</countrycodelength> <areacodelength>3</areacodelength> </createofficecode> for have done command sed -i '/><\//d' file which not strict, more trick, more appropriate find <pattern>...

Key-specific timeoutlen in vim -

Key-specific timeoutlen in vim - is possible set different timeoutlen depending on typed key? example, have short timeout go <esc> remapping jk or jj set timeoutlen=200 but if start <leader> , i'd have timeoutlen longer, because have mappings require pressing sequence of keys, not easy type jk . there's nil built-in. regards mapping, mean :inoremap jj <esc> , , apply quickly, need ensure there no other insert mode mappings start with jj . avoid first j appears delay, could utilize :autocmds toggle 'timeoutlen' value: :autocmd insertenter * set timeoutlen=200 :autocmd insertleave * set timeoutlen=1000 vim

php - Laravel 4 stream mp3 from s3 without CNAME buckets -

php - Laravel 4 stream mp3 from s3 without CNAME buckets - according other answers, best way create cname bucket / record , stream way. however, unable due copyright concerns , must stream through app (in order log user plays, among many other things). i have mp3's on s3 in bucket my-bucket . mp3's publicly accessible @ https://s3.amazonaws.com/my-bucket . i have code router: router.php route::get("/music/{id}.mp3", "controller\music@play"); music.php namespace controller; class music extends \controller\base { public function play($id) { $return = file_get_contents("https://s3.amazonaws.com/my-bucket/$id"); if( !$return ) homecoming "false"; $response = response::make($return, 200)->header('content-type', "audio/mpeg"); homecoming $response; } } now, on ssl-secured server, actual sound file display not play or stream. thought on how ac...

python - Optimizing a robot vacuum's path -

python - Optimizing a robot vacuum's path - i'm trying solve botclean problem on hackerrank: https://www.hackerrank.com/challenges/botclean the solution came scan board dirty tile shortest distance navigate it, clean it, , repeat until it's clean. code: nextd = [] def next_move(posr, posc, board): global nextd if nextd == []: nextd = next_d(posr,posc,board) if (nextd[0] == posr) , (nextd[1] == posc): print("clean") board[posr][posc] = "-" nextd = [] homecoming if posc < nextd[1]: print("right") homecoming #posc += 1 elif posc > nextd[1]: print("left") homecoming #posc -= 1 if posr < nextd[0]: print("down") homecoming #posr += 1 elif posr > nextd[0]: print("up") homecoming #posr -= 1 #find closest d def next_d(posr, ...

java - Hibernate No Session (No Dependencies) -

java - Hibernate No Session (No Dependencies) - i have next jpa entity (generated netbeans): package com.tsystems.tf.db.models; import java.io.serializable; import java.math.bigdecimal; import java.util.date; import javax.persistence.basic; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.id; import javax.persistence.namedqueries; import javax.persistence.namedquery; import javax.persistence.table; import javax.persistence.temporal; import javax.persistence.temporaltype; import javax.xml.bind.annotation.xmlrootelement; /** * * @author johorvat */ @entity @table(name = "table1") @xmlrootelement @namedqueries({ @namedquery(name = "testcase.findall", query = "select t testcase t") }) public class testcase implements serializable { private static final long serialversionuid = 1l; // @max(value=?) @min(value=?)//if know range of decimal fields consider using these annotations enforce field val...

asp.net - Event from dynamic ItemTemplate not caught -

asp.net - Event from dynamic ItemTemplate not caught - i implemented new dynamic itemtemplate : private sealed class customitemtemplate : itemplate { public customitemtemplate() {} void itemplate.instantiatein(control container) { table itemtable = new table(); itemtable.cssclass = "tablewidth"; tablerow btnrow = new tablerow(); itemtable.rows.add(btnrow); tablecell btncell = new tablecell(); btncell.cssclass = "bgcolorbluelight"; btncell.columnspan = 2; btnrow.cells.add(btncell); imagebutton imgbtnfvprincipalinsertmode = new imagebutton(); imgbtnfvprincipalinsertmode.causesvalidation = false; imgbtnfvprincipalinsertmode.imageurl = "~/images/icon_insert_16.gif"; imgbtnfvprincipalinsertmode.commandname = "new"; imagebutton imgbtnfvprincipalupdatemode = new imagebutton(); imgbtnfvprincipalupdatemode.causesval...

ssh - unable to share codes using git -

ssh - unable to share codes using git - i'm real real tired on git error. step i'm wrong here my friend create repository in bitbucket.org , name test he force codes repository git force , both see codes online i clone on project via git clone /myfriend/url/path/test.git i codes, initialize git repository , start work on it i decided force on bitbucket add together remote url git remote set-url origin /myfriend/url/path/test.git, but, when push, got ugly error, please create sure have access right. step wrong here? i have set ssh key in bitbucket , have set repository public, not private , in access management, friend has added name admin also. i'm wrong guys. help please. i clone on project via git clone /myfriend/url/path/test.git from there, should not initialize git repo. should cd test/ (created git clone ) , start working on it. if git status without having changed directory test/ , error message "this isn't git repo" (b...

angularfire - How to get filtered data from Firebase? -

angularfire - How to get filtered data from Firebase? - this question has reply here: how query firebase property specific value within children 3 answers i have construction this: [{ id: 1, isdraft: true}, {id: 2, isdraft: false}, {id:3, isdraft: true},...] how values isdraft === true ? denormalize data: isdraft:{ 1:true, 3:true, .... } refisdraft.once('value', function(ss){ //ss.val() contains isdraft references } here read firebase angularfire

cross site - how to filter html in json response for xss securing your application? -

cross site - how to filter html in json response for xss securing your application? - how filter html in json response xss securing application?? we have application send html in response, how escape html show , how prevent execution of html tags in response. xss cross-site esapi

c# - NUnit: Unit Testing Entity Framework ViewModel in WPF MVVM? -

c# - NUnit: Unit Testing Entity Framework ViewModel in WPF MVVM? - i'm getting started absolute basics of unit testing. i've used beginners tutorial nunit beginners guide guide. here's test viewmodel has 1 method performs linq query ef. class in same project application now. namespace diientitlements.tests { [testfixture] public class entitlementsviewmodeltests : notifypropertybase { entitlemententities _context = new entitlemententities(); private observablecollection<vwaccountheader> _accountheadercollection; public observablecollection<vwaccountheader> accountheadercollection { { homecoming _accountheadercollection; } set { _accountheadercollection = value; onpropertychanged("accountheadercollection"); } } [test] public void getaccountheaders() { var query = in _context.vwaccountheaders ...

debugging java vacation program -

debugging java vacation program - thank viewing post , contributions program. can help me debugging java programme please. found bugs in main method cannot point out bug in other methods. // vaction 10 days // extendedvacation 30 days public class testclass1 { public static void main(string args[]) { debugvacation myvacation = new debugvacation(int days); debugextendedvacation yourvacation = new debugextendedvacation(int days); system.out.println("my holiday " + myvacation.getdays() + " days"); system.out.println("your holiday " + yourvacation.getdays() + " days"); } } //_____________________________________ class debugextendedvacation extends debugvacation { public debugextendedvacation(int days) { super(days); days = 30; } public int getdays() { super.getdays(); homecoming days; } } //____________...

php - CodeIgniter uploading files -

php - CodeIgniter uploading files - i strugling upload files codeigniter. doing wrong, can 1 explain me file premision, , how alter on windows. should set folder upload files or patent folders. code in form <div id="contact_box"> <form id="form" enctype="multipart/form-data" name="form" action="<?php echo site_url('admin/clients/add_client');?>" method="post" > client name: </br><input type="text" name="name" id="name"/> </br></br> logo: <input type="file" name="file" id="file"/> </br></br> <input type="submit"/> </form> </div> and controller $this->load->library('upload'); $config['upload_path'] = './att/'; $config['allowed_types'] = 'png|jpg|bmp'; $this->upload->ini...

javascript - why browser is adding extra backward slashes to the json Response and also JSON array length is wrong? -

javascript - why browser is adding extra backward slashes to the json Response and also JSON array length is wrong? - this way making callback request server json value $(document).on('click', '.currentorderrow', function(event ) { var orderid = $(this).attr("id_data"); $.ajax({ type: 'get', url: url+'/oms/oms1/getorderdetails?orderid='+orderid, jsonpcallback: 'jsoncallback', cache: true, datatype: 'jsonp', jsonp: false, success: function (response) { alert(response.json_value.length); console.log('response is'+json.stringify(response)); }, error: function (e) { alert('into error '); } }); }); i observing while json response shown in server console having slashes within in () { "json_value": "[{\"contact_phone_no\":\"9876543210\",\"surcharge...

sql - Is this method correct to find second or third or fourth highest value in a column in mysql -

sql - Is this method correct to find second or third or fourth highest value in a column in mysql - i have table (name "friend") in mysql , want select 2nd or 3rd or 4th highest amount (i.e salary) table. i using method: `select * friends order salary desc limit 1; -- highest salary.` and `select * friends order salary desc limit 1 offset 1; -- sec highest salary.` and `select * friends order salary desc limit 1 offset 2; -- 3rd highest salary.` is method right or have utilize logical method like. `select * friends salary = (select max(salary) friends salary < (select max(salary) friends)); -- sec highest salary`. please tell me professional method. the limit offset preferred , more legibale; select * friends order salary desc limit 3,1; mysql sql

coldfusion - Form variable is not being defined? -

coldfusion - Form variable is not being defined? - i have form want check box , record emp_id record check (name="add#cnt#") <cfform method="post" action="approver.cfm" > <cfoutput> <input type="hidden" name="txttotalrecords" value="#totalemployees.recordcount)#"> </cfoutput> <table > ..... <cfoutput query="totalemployees"> <tr > <cfset cnt= cnt+1> <td><cfif #approver# eq 1>yes <cfelse>no </cfif></td> <td><input type="checkbox" name="add#cnt#" value="yes"></td> <td><input type="hidden" name="emp_id#cnt#" value="#emp_id#"></td> </tr>...

bit shift - Java split the bits of a long in two parts using bit shifting -

bit shift - Java split the bits of a long in two parts using bit shifting - i need split bits of number 9( 1001 ) in 2 equal sized parts 10 , 01 in case. my first thought shift right number dont expected result ,i suspect due sign(no unsigned in java :( ). my current code following: long num=9; system.out.println(long.tobinarystring(num)); long num1=num>>2; system.out.println(long.tobinarystring(num1)); long num2=num<<2; system.out.println(long.tobinarystring(num2)); output: 1001 10 100100 any workaround? to lower part, need utilize bitwise and... if shift right 2 bits higher part, need , binary number 11 (two bits 1) lower part. here's code should shift: long num = 9; int shift = 2 system.out.println(long.tobinarystring(num)); long num1 = num >> shift; system.out.println(long.tobinarystring(num1)); long num2 = num & ( (1<<shift) - 1); system.out.println(long.tobinarystring(num2)); explanation of calculating num2 ...

java - MigLayout error: "Unstable cyclic dependency in absolute linked values!" -

java - MigLayout error: "Unstable cyclic dependency in absolute linked values!" - why sscce (with miglayout libraries) ... public static void main(string[] args) { seek { uimanager.setlookandfeel("com.sun.java.swing.plaf.windows.windowslookandfeel"); } grab (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception e) { e.printstacktrace(); } jframe frame = new jframe(); frame.setlayout(new miglayout(new lc().fill().insetsall("0"))); jtabbedpane jtp = new jtabbedpane(); jtp.add(new jpanel(), "tab 1"); jtp.add(new jpanel(), "tab 2"); jlabel label = new jlabel("label"); jpanel panel = new jpanel(new miglayout(new lc().fill())); panel.add(jtp, "id tabbedpane, grow, span"); panel.add(label, "pos (tabbedpane.w-label.w) 10, id label"); label.setbounds(100, 100, 10, 10); frame.ad...

git - What are references that are not tags or branch heads? -

git - What are references that are not tags or branch heads? - when git ls-remote like: 679ba3cdb7201763c0a243e0169a7f8fd210b5b1 head 045b31588f934722cd9df1570987ed84b6e9b070 refs/heads/feature/proto-version-update 7b278f052ab47c49a6c1ac9bd12d05b72a4af584 refs/heads/iml 679ba3cdb7201763c0a243e0169a7f8fd210b5b1 refs/heads/master 52dc74d4b4775d7e24534b87908fb5efcd6d3118 refs/pull-requests/14/from 453f675541cd12e01cb05a7f8a63fadfb26e62fa refs/pull-requests/14/merge i know lastly 2 entries refs/pull-requests/14/merge for - they're created our central repo (stash) manage pull requests. (i have no intention of modifying them, i'm curious , want peek under hood, understand git little improve on way) but don't understand are. don't appear branches or tags (adding --heads --tags command hides them), , fetch doesn't pull them. how can fetch them locally can inspect them further? what they? how can inspect them? (...