Posts

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