Posts

Showing posts from June, 2010

neo4j - Structr drag-n-drop shared component fails -

structr (2.0.0 , 2.0.1) - drag-n-drop component project shared component fails. ubuntu 14.04, chrome version 54.0.2840.100 (64-bit), java version "1.8.0_20". selects in pages tree view, visible dragging across page disappears release of mouse button. attempting work demo project, moving head element shared components. other components , components welcome page fail well. just in case, 3 warnings server log: 17:08:18.051 [main] warn o.s.n.structrwrappingneoserverbootstrapper - specified file server configuration [/etc/neo] not exist. using default non-user-defined server configuration. 17:08:18.057 [main] warn o.s.n.structrwrappingneoserverbootstrapper - no database tuning file explicitly set, defaulting [/etc/neo4j.properties] 17:08:18.057 [main] warn o.s.n.structrwrappingneoserverbootstrapper - specified file database performance tuning properties [/etc/neo4j.properties] not exist. suggestions? missed subtlety in documentation. selecting element mea...

c++ - How to use input stream overloading to insert item to map member in class? -

i have c++ class question hold data file questions.txt of multiple choice questions , answers: update: have updated &operator>> operator overload have one: it insert first multiple choice question of 2 multiple choice questions"read first question " data in file questions.txt : a programming language used in course? 3 1. c 2. pascal 3. c++ 4. assembly compiler can use compile programs in course? 4 1. dev-c++ 2. borland c++builder 3. microsoft visual c++ 4. of above i'm trying insert multiple answers map. want ask how overload operator>> iterate on multiple answers insert them map: #include <string> #include <iostream> #include <sstream> #include <map> using namespace std; class question { string question; int correctindex; map<int,string> answers; friend std::istream &operator>>(std::istream &is, question &q) { getline(is, q.question, '?'); // sto...

python - List containing the given set of elements in the given order -

i having difficulties in writing code finding elements in list. i need write program prints "yes" if list contains numbers 1, 2, 3 (all of them) in arbitrary order , "no" otherwise. [10, 2, 4, 15, 3, 6, 1] # yes [1, 17, 2, 45] # no (because number 3 missing) also, need modify program prints "yes" if contains numbers 1, 2, 3 occurring in order listed (but not consecutively) , "no" otherwise. [45, 1, 5, 2, 77, 3] # yes [45, 1, 3, 77, 2] # no (incorrect order) clearly, program should print "no" if 1 of 1, 2, 3 missing. tricky part of task cases of multiple occurrences of 1, 2, 3. instance program should print "yes" if [3, 2, 1, 2, 3] because there occurrences of 1, 2, 3 appearing in correct order while "no" should printed [3, 3, 2, 2, 1, 2] because there no such occurrences. i not pro @ programming, little bit confused, because source code first task doesn't give me right...

class - I have a issue with python classes -

ok i'm making text based rpg game have issue python classes i'm not sure how fix i've tried looking problem haven't been able find posts pertain maybe i'm looking wrong things? don't know. anyways here's issue have class in file called unit.py in folder named subfiles class enemy(object): def __init__(self,name,hp,atk): self.name = name self.hp = hp self.atk = atk in main file have from subfiles.unit import * wolf = enemy("wolf", 100, 10) cow = enemy("cow", 50, 0) nmelist = [wolf,cow] def gennme(): global nme ##choose enemy fight nme = random.choice(nmelist) def attack(): nme.hp -= 10 print nme.hp attack() when run attack definition subtracts wolf.hp should, that's not i'm trying achieve, because next time battle comes against wolf dead how can have wolf = enemy("wolf", 100, 10) set out default values , after battle on , wolf killed, next time fight wolf loads d...

Haskell function seeking further explanation -

i've been trying create haskell function gets largest odd integer in list. sounds easy, , sure thought looks i'm stuck! here code, far returns largest number in list including both odd , numbers: maximum :: (ord a) => [a] -> maximum [x] = x maximum (x:xs) = max x (maximum xs) thank in advance help! first of - if have elements in list have problem, function not total (i.e. produces error) - best modify type of result account possibility: also others have mentioned - odd requires constraint integral instead of ord . maximodd :: integral => [a] -> maybe maximodd xs = case filter odd xs' of [] -> nothing xs' -> (maximum xs') the function filter odd removes non-odd elements (i.e. numbers) - pattern match on result account failure. if want work original function code gets lot more tricky: maximum :: integral => [a] -> maximum [x] = x maximum (x:xs) = let y = maximum xs ...

c# - All extensions methods for type string -

how methods "string" type, extensions methods "aggregate", "select" , other c# reflection? know type implement interface ienumerable<>, extension methods in enumerable class first generic parametr tsource.ok... code: var type = typeof(string).getmethods(); //i methods string type //i want type extensions methods "select" "where" //so interfaces type.getinterfaces(); //icompareble //icloneable //... //ienumearable, interfaces don't have extensions methods //they locate in enumerable class //how can use string type go enumerable class , methods //somthigs typeof(enumerable).getmethods(); //i want methods using type "string" //aggregate //select //where extension methods can of course defined in different assemblies, first question assemblies care about. we'll start with var assemblies = gettype().assembly .getreferencedassemblies() .select(an => assembly.load(an)) .concat(enumerab...

algorithm - Maximum number divisible by another one created from sum of previous numbers -

there given numbers 1, 2, ...., b-1 . every number of these can used a[1], a[2], ...., a[b-1] times. from them biggest possible number (from data given) has concatenated, while sum of digits (partial numbers) has divisible b . "digits" of number can of base bigger 2. biggest number of base b has created, concatenating numbers 1...b-1 , a[1]...a[b-1] times each, while sum of used partial numbers/digits has divisible b . for example: there 5 times 1 , 10 times 2 , 4 times 3 , 2 times 4 . stated above, have concatenate biggest number divisible b (here 5 ). give: 44333322222222221111 . concatenating biggest lowest gives needed number, sum divisible 5. 1 times 1 is: 0 because 1 not divisible 2, no numbers should used then. what algorithms or similar problems this? how can approached? at first, can arrange numbers biggest lowest, concatenated number naturally biggest. then, have take least amount of these numbers, sum divisible b . when there can taken dif...

pdf - FPDF - php output -

i installed fpdf create pdf-docs through php. even when try output simple example code snippet, page full of weird charactrers i have searched everywhere, , can not find solution. no errors shown. maybe has key ... in advance. %pdf-1.3 3 0 obj <> endobj 4 0 obj <> stream xœ3rðâ2Ð35w(çr qÐw3t04Ó30pisp êz*˜[š€…¤(hx¤æää+”çå¤h*„d” bv endstream endobj 1 0 obj <> endobj 5 0 obj <> stream xœ]rËnƒ0¼ó>¦‡l‚%„di8ô¡Ò~%e ràï»»vÒªhxã±gvvk?/¥îá¿™±©`]¯[óx5 ˆ3\zíÉp´} ³¸¯ÍpožâjjÝ^’øïx6/f›¬Ïðàù¯¦Óë‹Ø|æî«ë4}Ãz—¦¢…}žëé¥@ø,Û–-ž÷˺eÍïuò^Ú,ÍØÂ<Õ ˜z_Àk‚ iq ¤èößydçîïÕck€_ê%q„8>à!j"v!2&bgÄ£%r"h¢¬dîÈ}2el1n¥ºh¾jƒå– eä»"a h¬‹ØÕ:ÞÛdá˜î„9cÅüŽ[Èx1~²¼"œ3¿gÏãÑò;oâ•õ> endobj 2 0 obj << /procset [/pdf /text /imageb /imagec /imagei] /font << /f1 6 0 r >> /xobject << >> >> endobj 7 0 obj << /producer (fpdf 1.81) /creationdate (d:20161113014141) >> endobj 8 0 obj << /type /catalog /pages 1 0 ...

how do I get the JavaScript date version of this: "Saturday 5th November, 2016"? -

being scouring net javascript date version of following: saturday 5th november, 2016 i've tried looking @ day , month arrays... im kinda stumped. particular date format got php date format of: date("l js f, y"). there javascript version of - (complete date suffix)? tips great. cheers. the closest format, try this var d=new date; var str=d.todatestring(); console.log(str); it output "sun nov 13 2016"

angularjs - How can I rewrite the jQuery plugin on Angular -

i'm using pagination on page, when click on item pagination, have shifted base frame, not know how written on angular i have pagination component, code: app.component(function(storageservice){ storageservice.model = this.model = { list: ["a", "b", "c"], pagenumber: 1, totalrows: 5, }; this.openpagepagination = function(i){ storageservice.model.pagenumber = i; } }); <div> <ul> <li ng-repeat="el in model.list">{{el}}</li> </ul> <pagination processtype="model" /> </div> <ul class="pagination" data-count="{{ $ctrl.processtype.totalrows }}" ng-class="{'hide': !($ctrl.processtype.totalrows > 1)}" slidepagination> <li class="pagination-left waves-effect" ng-class="{ 'disabled' : ($ctrl.processtype.pagenumber == 1) ? 1 : 0 }...

phoenix framework - Debugging an Elixir Application -

i come ruby on rails background. so, binding.pry best friend. started picking elixir , i'm enjoying it, i'm curious best debugging techniques are? basically, counterpart of pry elixir? also, debugging paradigm different because it's functional? the closest thing pry iex.pry . you can start elixir/phoenix application this: iex -s mix phoenix.server or, if don't use phoenix: iex -s mix this spawn repl works ruby's irb , can pretty debug want. this comprehensive article authors of elixir explains how use iex.pry , other debugging techniques, may want have read.

How to deploy a python client script on heroku? -

basically, have python script using python-twitter api fetches tweets particular hashtag , store in database. script doess after every 30 seconds. how deploy script run on heroku. define "worker" process type in procfile invokes script.

javascript - best way to implement location.path in angularjs -

as know, visit route , pass param url $location.path('/home').search({key:'value'}) this clear every param , url , visit route, history keep $location.search('').path('/home'); how don't keep history? transactional flow, once user paid, don't want let user able go back. know there's history service think there's more simpler way it. tried use valina javascript redirect method reloaded entire page inconsisten spa. you can call $location.search('').path('/home').replace(); and not create record in back-history of browser. see documentation here .

ruby on rails - React component re-renders on state change, then re-initializes and re-renders -

i have tabs based on: https://codepen.io/amwill/pen/qomyep , when clicking on tab, browser renders selected tab switches first one! react dev console shows upon state change, components rendered expected, briefly displaying selected tab, createreactelement() gets called again! constructor balances gets called , state cleared, causing re-render first tab, regardless of tab clicked! i using: rails 5.0.0.1 react_on_rails ~> 6 here view file: <%= react_component 'balancesapp', props: {balances: @balances} %> my entry point file: import react 'react'; import reactonrails 'react-on-rails'; import balances '../containers/balances'; const balancesapp = (props) => ( <balances {...props} /> ); reactonrails.register({ balancesapp }); and top level component: export default class balances extends react.component { static proptypes = { balances: proptypes.array.isrequired }; constructor(props, context) { ...

animation - Drawing Concentric Circles, appearing one at a time, Java -

i'm trying draw concentric circles appear 1 @ time, smallest largest outward. i'm wanting give illusion of circle expanding, adding additional circle outside of existing outer circle each time loop executes. @ moment circles appear @ same time when run program. please help, have no idea how this. in advance. public static void drawcircles(graphics g) { int radius = 10; int x = 0; while(x <= 10) { int z = radius / 2; g.drawoval(100 - z, 100 - z, radius, radius); x++; radius = radius + 10; } } to pause program between circle draws add call thread.sleep(long millis) millis number of milliseconds want pause. public static void drawcircles(graphics g) { int radius = 10; int x = 0; while(x <= 10) { int z = radius / 2; g.drawoval(100 - z, 100 - z, radius, radius); try { thread.sleep(1000); } catch (interruptedexception e) { } x++; radius = radius + 10; }...

android - ListView in BottomSheet -

i ran problem had simple listview in bottomsheet , listview had enough items fill screen , scroll more. when scroll down, seems work when tried scroll up, scrolling bottomsheet , closing view instead of scrolling listview . i able find solution after while , since couldn't find anywhere here, figured post here. the solution extend listview this: public class bottomsheetlistview extends listview { public bottomsheetlistview (context context, attributeset p_attrs) { super (context, p_attrs); } @override public boolean onintercepttouchevent(motionevent ev) { return true; } @override public boolean ontouchevent(motionevent ev) { if (canscrollvertically(this)) { getparent().requestdisallowintercepttouchevent(true); } return super.ontouchevent(ev); } public boolean canscrollvertically (abslistview view) { boolean canscroll = false; if (view !=null &...

html - How can I set a color to just some characters of one word? -

first of all, i'm talking persian language .. noted rtl language. here current word: سلامتی as see, persian characters adhered (stick) together. need set red color 4 first characters. this: span{ color:red; } <span>سلام</span>تی as see, when set red color character, word 2 different partitions .. while whole of single word , characters should stick each other (like سلامتی ) . how can fix it? in case have insert zero-width joiner &zwj; @ end of content want join other. like this: .red{color:red;} <span class="red">سلام&zwj;</span>تى

sql - Why MySQL union all shows different result for "practically" the same query? -

i making query , i'm wrong results, modified , works, query similar original, it: original: (didn't work) select username, password tbl_user union select username password, password username tbl_user results: user1 | pass1 userunion1 | passunion1 solution: (working) select username, password tbl_user union select password username , username password tbl_user results: user1 | pass1 passunion1 | userunion1 the intension of query union same result columns inverted, in original query doesn't invert columns, in solution query ¿why? (note in original query i'm ordering asume password username , username password), can explain? in first query: select username, password tbl_user union select username password, password username tbl_user you taking union of tbl_user itself. aliases in second half of union ignored. query identical doing: select username, password tbl_user union select username, password tbl_user similarly, working seco...

excel vba - Run-time error message 91 (object variable not set) -

i have following code in excel vba (using excel 2010), find specific date, in european format (dd/mm/yyyy), , cancel rows below cell (with date in it): sub macro1() ' macro1 dim variant ' input box insert date = inputbox("insert date of last entry format dd/mm/yyyy", "user date", format(now(), "dd/mm/yyyy")) if isdate(a) = format(cdate(a), "dd/mm/yyyy") else msgbox "date in wrong format!" end if 'find date above, in variable a, in excel sheet cells.find(what:=a, after:=activecell, lookin:=xlformulas, _ lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false).activate range(selection, selection.end(xldown)).select range(selection, selection.end(xltoright)).select selection.entirerow.delete end sub however, when run macro, run-time error message 91 object variable not set. many help. this error appears because find method didn't return ...

android - Java extends from class with <class name> -

can explain meaning of in below code snippet public class noteadapter extends arrayadapter<note>{ } in example note java class. it means note adapter inherits arrayadapter generic class.the generic class arrayadapter accepts argument of type note .to understand more visit topic generics in java

Different default currency for different users in Salesforce -

i have 1 question related salesforce, know can change default currency whole organization, can put default currency different users? when user logins, sees currency dollars, , when user b logins, sees pounds, possible? yes, can enabling multi-currency (can't disabled once enabled). you'd set corporate currency , users using currency different corporate, can set user (personal) currency .

codenameone - Google Maps on iOS error: is depending on legacy on-demand authorization, which is not supported for new apps -

i working on native google maps cn1 java app. works ok on android, , cn1 simulator, fails on real iphone. following part of system log. nov 12 23:57:56 my-iphone6spou locationd[64] : getclienteffectiveregistrationresult, /private/var/containers/bundle/application/c483cd2d-48bb-4eb3-8ad6-440fe1c4c651/mymaps.app/mymaps, com.company.cn1.maps, , clclientregistrationresult, kclclientregistrationresultfailedunavailable, clcommonlocationservicesenabled, 1 nov 12 23:57:56 my-iphone6spou locationd[64] : message 'kclconnectionmessagelocation' received client 'com.company.cn1.maps' nov 12 23:57:56 my-iphone6spou locationd[64] : client com.company.cn1.maps (0x10283ae00) unsubscribing notification kclconnectionmessagelocation nov 12 23:57:56 my-iphone6spou locationd[64] : client com.company.cn1.maps (0x10283ae00) unsubscribing notification kclconnectionmessagelocationunavailable nov 12 23:57:56 my-iphone6spou locationd[64] : client 'com.company.cn1.map...

In Twilio, what is the difference between Twilio number and logged in agent number? -

in twilio, difference between twilio number (for customer number) , logged in agent number? every agent have unique twilio number receive incoming call? i assume agent number referring twilio client name. twilio number number bought twilio can used in following cases .   1.you can configure call number. i.e., if number receives call, can redirect number or common message or configure ivr menu etc.,   2.to initiate outbound call twilio, can set number caller id. twilio client on other hand, used connect our web application client(browser) side twilio , vice-versa. client name created while generating capability token used setting twilio device in our client side.then ,the browser tab identified client name twilio. (used while dialling browser tab) you can set same client name limited number of twilio devices. detailed information on twilio client, visit this site.

Parallel requests be processed parallel/sequential by one Spring singleton bean -

i have refered these links still has doubt concurrent request singleton bean another less relevant link my q/doubt : parallel requests processed parallel/sequential 1 spring singleton bean[as 1 object/instance] e.g. @controller, @service on multi-core processor(parallel thread execution capability) hopefully not, how works. first link, got understanding - 1 singleton bean object, 1 instance of byte code of singeton bean - accessed thread stack independently - not able corelate will parallel requests processed parallel/sequential 1 spring singleton bean e.g. e.g. @controller, @service ? the requests @controller , @service processed parallelly different threads created j2ee container. number of threads can created j2ee container limited memory availability. a single object can serve number of requests (limited memory available mentioned above). to understand concept better, can take spring mvc's dispatcherservlet (or servlet default behavior), ...

api - Python Requests giving response 401 -

i downloading data api getting error 401: understand error 401 dont know wrong in code. import json import requests path='c:/users/sharm_000/desktop/price comparison/' cat=str('https://affiliate-api.flipkart.net/affiliate/api/swapnilsh5.json') r = requests.get(cat, auth=('swapnilsh5', '7018e1141bcd4ace9c3fe12277924035')) print (r) the above code returns 201 response great, challenge comes when go next level of data download link='https://affiliate-api.flipkart.net/affiliate/1.0/feeds/swapnilsh5/category/j9e-abm-c54.json?expiresat=1479062969473&sig=1ef27c056140e0ff7cac143670584e9d&instock=1' r = requests.get(str(link), auth=('swapnilsh5', '7018e1141bcd4ace9c3fe12277924035')) print(r) this return 401 error, not able figure out, when run above link using curl curl -h "fk-affiliate-id:swapnilsh5" -h "fk-affiliate-token:7018e1141bcd4ace9c3fe12277924035" "https://affiliate-api.flipkart.n...

ios - how to call View controller of MainStoryBoard from UI cellView xib -

the problem want call view controller of mainstoryboard. have created uicellview in xib file , on have button want move on addlocationvc viewcontroller when pressed button. i have written code uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; addlocationvc *view = [storyboard instantiateviewcontrollerwithidentifier:@"addlocation"]; its not worked when pressed button not redirect me on view controller addlocationvc controller coming in section of code. the efficient way of doing use protocols or blocks . delegate protocol steps be: define delegateprotocol in custom cell class in cellforitem/rowatindexpath: make viewcontroller delegate of cell , implement protocol in it. here you'll instantiate new viewcontroller , present/push it on button tap call delegate method

javascript - Codeigniter populate dropdown value from database based on date selected -

i not codeigniter , javascript.but dont know if possible. working on dental appointment booking sytem final year project. on booking function, have trouble generate dropdown automatically list available timeslot based on date selected user. but how make happen? have try search tutorial , question. found related answer involved ajax function not familiar it, , still stuck on it. have has idea or example can refer? please me. thank :'( as have figured out have use ajax here. can use onchange event listener in dropdown , ajax call selected value return required result. how it, hove find yourself. google friend.

Clearing python list with slice operator copy -

i came across following python 2.6 code python for in elements[:]: elements.remove(i) i'm trying figure out reason use syntax clearing list. understand concept of inplace deletion, why not example: del elements[:] or elements[:] = [] thx ! you must think of python lists 'pointers'. for example, if declare list so: elements = [1, 2, 3] this seen in memory this: elements → [ ↓, ↓, ↓ ] 1 2 3 so when change element in list doing this: elements[1] = 4 4 elements → [ ↓, ↑, ↓ ] 1 2 3 notice how number 2 has no pointer reference 'gone or lost memory' , it's no longer accessible. same happens when re-assign variable itself: elements[:] = [] [] elements ↑ [ ↓, ↓, ↓ ] 1 4 3 the key understand here original list 'gone or lost memory' , it's no longer accessible. important key understand slicing: elements[:] get's pointer (or arrow ...

python - Most efficient method to combine pandas DataFrames which have the same column value -

for example, have 2 dataframe contain identical sample name different feature data. i want compare how many samples existed in both dataframe. data here df1 df2 a dummy way achieve problem have though about: hit = 0 in range(0,len(df1),1): j in range(0,len(df2),1): if df1.sample_name.iloc[i] == df2.sample_name.iloc[j]: hit+=1 i thouth loop procedure may waste lot of time. there simple technology takcle with? beside, how extract subset of each dataframe idential sample_name , connect feature data new dataframe. i have tried pd.concat(df1, df2, keys = 'sample_name') here's vectorized approach using numpy broadcasting hit value - np.count_nonzero(df1.sample_name.values[:,none] == df2.sample_name.values)

c - gcc plugins with arm64 cross compiler : cannot open shared object file -

i trying compute sizes of each struct @ compile time using gcc plugin. searching, came across this article . i tried out on test program below native x64 gcc compiler , got following results. #include <stdio.h> struct test { int a; unsigned long b; char p[100]; }; int main(int argc, const char *argv[]) { struct test t; t.a = 10; t.a += 1; scanf("%s", t.p); scanf("%lu", &t.b); scanf("%d", &t.a); printf("%d\n", t.a); return 0; } results :- loaded structsizes plugin (gcc 5.4.0..) ignoring unnamed struct struct '_io_file' has incomplete type struct '_io_file' has incomplete type struct '_io_file' has incomplete type ignoring unnamed struct ignoring unnamed struct ignoring unnamed struct struct '_io_jump_t' has incomplete type struct '_io_file' has incomplete type struct '_io_marker' has incomplete type struct '_io_file' has incomplete type s...

php - HTML, CSS - I want to create a button "Preview" which will show user his input -

let's have simple form example: <form> enter title here: <input type="text" name="title" /> gender: <select name="gender"> <option value="male">m</option> <option value="female">f</option> </select> yourself: <textarea name="aboutme"></textarea> click on button see how form submit. <button>preview</button> </form> this simple form example. now, can't figure out next thing: when user clicks on button "preview", want show him how when clicks on submit. guess need additional css, , php?? with js easy. try this: function formalert() { alert_string = ''; alert_string = alert_string + document.getelementbyid('title').value; alert_string = alert_string + ', '; alert_string = alert_string + document.geteleme...

java - How to see the arguments types of the methods from the superclasses when overriding methods in IntelliJ? -

Image
i extend class has many overloaded methods (same name, different argument). override 1 of these methods, box suggestions contains method names without types. there setting it? i use ctrl + o / ctrl + i select method want override/implement. there methods possibly can overridden/implemented full signature , return type in opening dialog box. if "quick documentation" feature configurated popup, convenient press ctrl + q on selected suggestion see method documentation.

c - Parsing an uninitialized value into a function -

i'm trying write little program goes through list of numbers in array , inserts them binary search tree. here's have: #include <stdio.h> #include <stdlib.h> typedef struct node_t node_t; struct node_t { int data; node_t *left; node_t *right; }; int insert(node_t *node, int n); int main(void) { int array[8] = {5, 8, 3, 6, 9, 2, 4, 7}; int i; node_t *root; (i = 0; < 8; i++) { insert(root, array[i]); } return 0; } int insert(node_t *node, int n) { if (node == null) { node = malloc(sizeof node); node->data = n; return 1; } if (n > node->data) { insert(node->left, n); } else if (n < node->data) { insert(node->right, n); } else { return -1; } return 0; // suppress 'control reaches end of non-void function' } when compile gcc warning saying "'root' may used uninitialized in function". r...

I want to check the grammatical mistakes of user data by using NLTK (python)? -

i have download language-check package , pasted in d:\lib\site-packages\nltk when type code on python interpreter as: import language_check it gives me error: no module named language_check . you need install package first, example using pip install language_check here couple of links you: https://docs.python.org/3/installing/ how install python packages on windows?

python - Conways Game of Life in PyGame -

so read conways game of life , tried implement pygame. i tried make object-oriented. way works have list of cell-instances, check how many neighbours have , either stay alive or die, based on neighbours. process repeats itself. the problem when test known starting patterns (e.g. in code below (cell_map)) not work way should. i read code on , on , dont i'm missing here. posted whole code below dont know mistake is, i'd highly appreciate if point me in right direction. thanks in advance! import pygame class cell: def __init__(self, live, xcor, ycor): self.alive = live self.x = xcor self.y = ycor self.neighbours = 0 def checkneighbours(self, celllist): cell in celllist: #left if cell.x == self.x-1 , cell.y == self.y , cell.alive == true: self.neighbours += 1 #right elif cell.x == self.x+1 , cell.y == self.y , cell.alive == true: self.neighbours += 1 #upl...

jquery - Javascript and html: button isn't working -

i making program has array of numbers , user inputs values in , clicks on verify. value enters has in order array of numbers , if isn't user gets alert message sorry value inside first input bar decides number of array should comparison should start. example, if array holds numbers {2,4,6,8,10} , user enters 6 in first input bar , enters 8 , 10 in next 2 bars, should result "678" if doesn't first number right lets enters 3, , since 3 isn't in array, doesn't matter enters in other input bars, result "sorry". similarly, if user types 4 in first input bar then in second bar types 8, should still result "sorry" since order of array {4,6,8} not {4,8}.. now, made program thing is, whenever click on verify button, nothing happens :/.. here codes. , here result getting: https://jsfiddle.net/53j19rpt/ <html> <head> </head> <script type="text/javascript"> var arr = []; var t; var num = 2; var x...

swift - Drawing a line on view/imageview in iOS/swift3 -

i found question similar own here: draw line realtime swift 3.0 after piecing have in own program, not sure make call drawlinefrom(frompoint: cgpoint, topoint: cgpoint) in code can draw. app runs, still can't draw. code below. override func touchesbegan(_ touches: set<uitouch>, event: uievent?) { swiped = false if let touch = touches.first { lastpoint = touch.location(in: self.view) } } func drawlinefrom(frompoint: cgpoint, topoint: cgpoint) { uigraphicsbeginimagecontextwithoptions(view.bounds.size, false, 0) tempimageview.image?.draw(in: view.bounds) let context = uigraphicsgetcurrentcontext() context?.move(to: frompoint) context?.addline(to: topoint) context?.setlinecap(cglinecap.round) context?.setlinewidth(brushwidth) context?.setstrokecolor(red: red, green: green, blue: blue, alpha: 1.0) context?.setblendmode(cgblendmode.normal) context?.strokepath() tempimageview.image = uigraphicsgetimagefrom...

ios - Crash on self.view.endEditing with UITextField in tableviewheader -

i experience quite rare crash when call self.view.endediting(true) . 0.3% of users affected. cannot reproduce crash on own device. anyway fix it. i have uitableview contains uitextfield in tableviewheader, setup in viewdidload() . have strong reference uitextfield. set delegate nil in deinit . when user taps row, call self.view.endediting() , app crashes exc_breakpoint. app in focus when crashes. crash happens on iphone 5, 5c, 5s , 6 (ca. 80%) i tried resignfirstresponder same issue, verifying if textfield not nil before calling resignfirstresponder did not help. so @vinodh checked viewcontroller in storyboard. there still connections searchviewcontroller, put out of use. deleting connections got me rid of crash.

How can I remove perl object from memory -

i'm having issues memory usage of perl script wrote (code below). script initiates variables, fills them data, , undefines them again. however, memory usage of script after deleting still way high contain no data. accoring ps script uses 1.027 mb memory (rss) during first 39 seconds (so before foreach loop). then, memory usage starts rising , ends fluctuating between 204.391 mb , 172.410 mb. however, in last 10 seconds of script (where data supposed removed), memory usage never goes below 172.410 mb. is there way permanently delete variable , data in in perl (in order reduce memory usage of script)? if so, how should it? use strict; use warnings; sleep(30); $elements = 1_000_000; $max_element = 1_000_000_000; $if_condition = 1; sleep(5); %hash = (1 => {}, 2 => {}, 3 => {}, 4 => {}); foreach $key (keys %hash){ if( $if_condition ){ $arrref1 = [ (rand($max_element)) x $elements ]; $arrref2 = [ (rand($max_element)) x $elements ]; ...

C program behaves differently in gcc and llvm compiler -

i wrote program consists of main , function expand. problem code returns intended result when compiled , run xcode (latest version) when compiled , run gcc compiler through terminal code stuck after running (no warnings or errors!). command use compile code in terminal: gcc expand.c -o expand -wall -pedantic -ansi below code. have no idea problem is: #include <stdio.h> #define max_len 100 #define atoi_gap 48 void expand(char s1[], char s2[]); int main() { int i; char s2[max_len]; /* declare target array */ char s1[4]; /* declare source array */ s1[0] = 'a'; s1[1] = '-'; s1[2] = 'z'; s1[3] = '\0'; for(i = 0; < max_len; ++i) { /* print s2 array */ printf("%d ", s2[i]); } expand(s1, s2); for(i = 0; s2[i] != '\0'; ++i) { /* print s2 array */ printf("%c ", s2[i]); } return 0; } /* function gets string s1 of format "letterx-lettery" , fills "-" consequent letters letterx lett...

Android compare 2 images and tell to fruit category to is fruit (apple/banana) or not fruit -

Image
android compare 2 images use bitmap code , tell fruit category fruit (apple/banana) or not fruit. i have problem compare bitmap , bitmapfactory have runtime error , have solution problem. activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <imageview android:id="@+id/imageview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" /> <button android:id="@+id/buttonintent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="tru...

Add a common module for methods to be used by my client / server in Maven -

i wanted create "common" module in order store common methods in client , server use. created module, , added following sub-modules pom s: <dependency> <groupid>com.christopher.kade</groupid> <artifactid>common</artifactid> <version>1.0-snapshot</version> </dependency> additionally, don't want common module generate .jar file, want other modules access content, here pom : <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactid>jcoinche</artifactid> <groupid>com.christopher.kade</groupid> <version>1.0-snapshot</version> </parent> <modelversion>4.0.0</modelversion> <artifac...

asp.net - VB.net Findcontrol Not Working -

simple findcontrol not working - kicking back: system.nullreferenceexception: object reference not set instance of object. i've got asp.net label on web page. <asp:label id="lblmenuitemname1" runat="server" text="label"></asp:label> the label control not inside other control (datagrid, repeater, etc). calling code on button click. dim lblmenuitemname label lblmenuitemname = ctype(page.findcontrol("lblmenuitemname1"), label) lblmenuitemname.text = "hello" i've tried (and half dozen of scenarios): lblmenuitemname = findcontrol("lblmenuitemname1") lblmenuitemname = me.findcontrol("lblmenuitemname1") i'm doing this, instead of referencing control directly, because i've got ten of these labels , i'm going assign text through loop using findcontroll("lblmenuitemname" & x.tostring) fyi - referencing control directly works fine. lblmenuitemname1.text =...

python - How to update with method PUT django-rest-framework -

when prompted put (update) out error can not call .is_valid () no data = keyword argument passed when instantiating serializer instance. view: def get_serializer(self, *args, **kwargs): queryset = producer.objects.get(pk=self.kwargs['pk']) if self.request.user.is_authenticated: return producerserializer(queryset, fields=('short_info',)) if self.request.method == 'put' or self.request.method == 'patch': return producerupdateserializer else: return producerserializer(queryset, fields=('website', 'phone', 'email', 'contacts', 'short_info')) def get_queryset(self): return producer.objects.filter(pk=self.kwargs['pk']) my serializer class dynamicfieldsmodelserializer(serializers.modelserializer): ...