Posts

Showing posts from April, 2015

python 3.x - text based adventure game, save game function -

python 3.x - text based adventure game, save game function - i making text based adventure game. half way done , before much farther story line want implement save game function. i've been trying figure out afternoon can't seem find indication of how right, scenario anyways. here decent portion of code, have more didn't paste here it's story pacing basically. want able have selection ie. 5 = save game saves players1 statistics , when loaded puts player in same spot in game /w s enter code here i can't code paste in here due length believe have pastebin link. http://pastebin.com/gjpa2tee any help much appreciated, i'm trying larn programming. you seem have things define state : self.__player_health, self.__player_name, self.__health_potion, self.__big_wrench, self.__blue_keycard. need read more carefully, couldn't find state defines progression. defines state can save , read text file - if aiming @ simplicity. one way go having dict c

javascript - Drop menu with jQuery doesn't work on mouseover -

javascript - Drop menu with jQuery doesn't work on mouseover - i trying simple drop menu show when mouseover, script shows div links. it works fine when seek select 1 link other div hides. jquery(document).ready(function() { jquery("#menu_link").mouseover(function() { jquery(".1").show(); }); jquery("#menu_link").mouseout(function() { jquery(".1").hide(); }); }); http://jsfiddle.net/sx8o1tbh/1/ if go , set cursor on word "inicio" see shows other div links when seek go new div hides, think wrong in jquery code. thanks help. the problem not in javascript code. changed css , avoid gap between menu , submenu: #show_links { top:35px; position:absolute; min-width:10%; width:auto; min-height:100px; height:auto; border:2px solid; } http://jsfiddle.net/sx8o1tbh/7/ javascript jquery

cygwin - Shell script works in the console but not when saved as a text file -

cygwin - Shell script works in the console but not when saved as a text file - consider simple shell script: #!/bin/sh fruitlist="apple pear tomato peach grape" fruit in $fruitlist if [ "$fruit" = "tomato" ] || [ "$fruit" = "peach" ] echo "i ${fruit}es" else echo "i ${fruit}s" fi done when paste cygwin window works fine when save text file test.sh , run cygwin terminal i'm getting this: $ ./test.sh ./test.sh: line 4: syntax error near unexpected token `$'do\r'' '/test.sh: line 4: `do however, if remove newlines works: #!/bin/sh fruitlist="apple pear tomato peach grape" fruit in $fruitlist if [ "$fruit" = "tomato" ] || [ "$fruit" = "peach" ] echo "i ${fruit}es" else echo "i ${fruit}s" fi done how can create script more readable maintaining new lines in file, \n doesn't s

Unknown jQuery variable in Firefox web-console -

Unknown jQuery variable in Firefox web-console - accessing jquery variable in firefox web-console see (form autocomplete) sec jquery variable; variable looks jquery85448957324.. ('jquery' followed random number). initially accessing variable gave result refered ... tojson: .noop() ..., it's returning referenceerror: jqueryxxxxxxxxxxxxxxx not defined what variable refer to? you doing wrong breaks jquery , maby jquery ui too. are using ajax? seek check if response valid json... are using jsonp? maby callback throws error... are using custom itemrender? create sure have valid ui.item... debug items using ui autocomplete callback like: selected: function(event, ui) { console.log(ui.item); } api: http://api.jqueryui.com/autocomplete/#event-select jquery firefox web-console

matlab - Storing the number of iterations of a nested loop in an array -

matlab - Storing the number of iterations of a nested loop in an array - i relatively new matlab , quite stuck in specific problem. i have equation trying solve using while loop. works guessing parameter e_0 , filling equation, until converges. illustration found below, initial guessing value equals 100: clear i=1; e_0=100 e_1= e_0 + log(0.6) - log(exp(e_0)/(exp(e_0)+1)) while( < 1e10 & abs((e_1 - e_0)) > 1e-12), = + 1; e_0=e_1; e_1= e_0+log(0.6)-log(exp(e_0)/(exp(e_0)+1)) end now exact same procedure multiple values of e_0 @ same time, e.g. 101, 102, 103 , on, , count how many more iterations take. reckon hence need set for-loop that. thought this: clear i=1; e_0 = 100:105 e_1= e_0+log(0.6)-log(exp(e_0)/(exp(e_0)+1)) while( < 1e10 & abs((e_1 - e_0)) > 1e-12), = + 1; e_0=e_1; e_1= e_0+log(0.6)-log(exp(e_0)/(exp(e_0)+1)) end end however, iterations different guessing val

javascript - Uncaught TypeError: Cannot read property 'jQuery110102358926620800048' of undefined -

javascript - Uncaught TypeError: Cannot read property 'jQuery110102358926620800048' of undefined - i store json object in html5 localstorage used generate number of different form fields. $(document).on('click','.checklistobject', function(){ var allchecklists = json.parse(localstorage.checklists); var element_id = this.id; $.each(allchecklists,function(key,val){ if (val.id == element_id) { displaychecklist(val, undefined); } }); }); on first click on unordered list corresponds above, error in console: uncaught typeerror: cannot read property 'jquery110102358926620800048' of undefined however on sec click, works, , fires correctly. error said found in jquery.js see total traceback here "http://pastebin.com/rr9d6myx", refers 1 line in code, one: $('#content-body').trigger('create'); which applies jquery mobile css-styling dynamical

jquery - Creating multiple draggable Javascript objects with individual properties -

jquery - Creating multiple draggable Javascript objects with individual properties - i trying create draggable objects have each have own properties. beginner @ javascript minimal experience, , project involves creating simple circuit simulator. so far, have been able drag, drop & clone components in dom courtesy of helpful stackoverflow-ers. struggling move on next bit, making each component unique, editable properties such name, type , coordinates, when click on object again, can pull little pop-up menu allows me modify properties of specific object. able offer pointers of how go doing it? here jsfiddle of have far - http://jsfiddle.net/3lnqocf3/ any help much appreciated! javascript - jquery(function() { jquery(".component").draggable({ // utilize helper-clone append 'body' not 'contained' pane helper: function() { homecoming jquery(this).clone().appendto('body').css({ 'zinde

ANOVA in R: Degrees of freedom almost all equal 1 -

ANOVA in R: Degrees of freedom almost all equal 1 - this honors thesis! advisor doesn't know how utilize r , don't know how utilize else, here am. i have info set begins this: > d.weight r n p c d.weight 1 1 0 0 go 45.3 2 2 0 0 go 34.0 3 3 0 0 go 19.1 4 4 0 0 go 26.6 5 5 0 0 go 23.5 6 1 45 0 go 22.1 7 2 45 0 go 15.5 8 3 45 0 go 23.4 9 4 45 0 go 15.8 10 5 45 0 go 42.9 ... and on. r rep , there 5 of them (1-5). n nitrogen level, , there 5 (0, 45, 90, 180, 360). p phosphorus level, , there 5 (0, 35, 70, 140, 280). c plant combination, , there 4 (go, gb, lo, lb). d.weight dry weight in grams. however, when anova wrong degrees of freedom. run anovas on subsets of total set of data, let's analysis wouldn't otherwise, can see of df wrong. > example.aov=aov(d.weight ~ r+n+p+c, data=d.weight) > summary(example.aov) df sum sq mean sq f

r - How to order factor variables in ggplot -

r - How to order factor variables in ggplot - i order plant growth form factor variables on x-axis decreasing slope value rather alphabetically. have tried reorder() function without success. slope = c(1.0508194, 0.9406335, 1.1271495, 1.0496251, 0.9874658, 0.9358822, 0.8621570, 1.0403310, 1.0380560, 1.0401669) veg3 <- data.frame(plant_growth_form = as.factor(c("fern", "fern ally", "grass", "herb","herbaceous climber", "herbaceous shrub", "tree sapling", "undet", "woody climber", "woody shrub"))) ggplot(veg3, aes(x = plant_growth_form, y = slope)) + geom_point(cex=2) + xlab("growth form") + ylab("slopes") + ylim(0,2) + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) a reproducible info subset gen

java - Parsing XML, skip certain tags -

java - Parsing XML, skip certain tags - i next mkyong's great tutorial on how parse xml in java, have situation need read tags within area. e.g. <?xml version="1.0"?> <company> <staff id="1001"> <firstname>yong</firstname> <lastname>mook kim</lastname> <nickname>mkyong</nickname> <salary>100000</salary> </staff> <staff id="2001"> <firstname>low</firstname> <lastname>yin fong</lastname> <nickname>fong fong</nickname> <salary>200000</salary> </staff> <changes> <staff id="2001"> <firstname>low</firstname> <lastname>yin fong</lastname> <nickname>fong fong</nickname> <old_salary>175000</salary> <ne

javascript - Parsing a price with , and ,-- exception with parseFloat() -

javascript - Parsing a price with , and ,-- exception with parseFloat() - i'm trying parse cost out of html document: here how html element looks like: <div> <span id="market_buynow_dialog_totals_total" class="market_dialog_totals_cost">0,11€</span> <span class="market_dialog_totals_label">total:</span> </div> there , , don't want restricted either left or right side of , , in illustration above love int 11 , 399,99 love 39999. here current solution: var currentprice = parsefloat(document.getelementbyid("market_buynow_dialog_totals_total").innerhtml.replace(/[,€]/g, "")); however there exception breaks little solution: cost can 300,-- or 250,-- @ times. in cases currentprice is 300 or 250 instead of desired 30000 or 25000. i'm trying find elegant , short solution problem. can help me out? try this: var currentprice = parsefloat(document.getelementbyid(

php - Where to optain Google Analytics API access_token? -

php - Where to optain Google Analytics API access_token? - according google analytics api reference oauth access token can used access stats of page. using oauth pretty complicated or @ to the lowest degree seems me in php. according docs should able utilize access_code parameter. i tried several ways access_token google developer console, neither working returning next error: {"error":{"errors":[{"domain":"global","reason":"required","message":"login required","locationtype":"header","location":"authorization"}],"code":401,"message":"login required"}} thus i'm wondering how none expireing api access code google analytics page properties? if possible @ all? you need register application on google developer console first. matter of using oauth2 access token. access token first asking user permission access data

how to disambiguate using @DocumentField in spring data mongoDB -

how to disambiguate using @DocumentField in spring data mongoDB - while trying save object mongo db using spring-data mongodb, getting exception. ambiguous field mapping detected! both <child class field> , <parent class field> map same field name <field name>! disambiguate using @documentfield annotation! i hiding field in kid class , causing issue. essential me hide field declared in super class. cannot find @documentfield annotation anywhere. how can proceed here? there other solution? i believe error in exception. need utilize @field instead , specify different name parameter so: public class parent { private string myfield; } @document(collection = "children") public class kid extends parent { @field("childfield") private string myfield; } spring-data spring-data-mongodb

ios - SQLite syntax error with Encrypted-Core-Data -

ios - SQLite syntax error with Encrypted-Core-Data - i've been running syntax error long time , unsure causing it. debug log follows: sql debug: select ecdimages.checksum, ecdimages.creationdate, ecdimages.filename, ecdimages.height, ecdimages.latitude, ecdimages.locationstring, ecdimages.longitude, ecdimages.order, ecdimages.photoid, ecdimages.photologvalues, ecdimages.requiresdeletion, ecdimages.requiresupload, ecdimages.rotationangle, ecdimages.scale, ecdimages.source, ecdimages.timestamp, ecdimages.title, ecdimages.transform, ecdimages.width, ecdimages.x, ecdimages.y, ecdimages.book__objectid, ecdimages.page__objectid ecdimages ecdimages.__objectid=?; not prepare statement: near "order": syntax error order of type integer 16 , reference, using encrypted-core-data found on github. thoughts? as pointed out cl in comments, using reserved keyword. refer sqlite keywords. ios objective-c sqlite core-data encrypted-core-data-sql

c# - Is it a good idea to make my MEF parts lifetime Shared on this case? -

c# - Is it a good idea to make my MEF parts lifetime Shared on this case? - i've used csla part of web solution's architecture and, in order able manage repository pattern, ioc container dataaccess layer works mef (by using csla-contrib). known first load of mef catalog takes while deppending on how huge libraries. the point solution works ok moment but, after break times no 1 uses solution takes while load , because mef catalog loaded again. i've been thinking of changing life time of each part shared instances available until mef catalog disposed. do think it's thought create alter mef parts? thank you attention. ronald i forgot absolutely important: configuration of pools. as remember, default inactivity time 20 pool. if applications associated pool has no activity after 20 minutes iis closes working process if utilize web apps after time working process start 1 time again (and initial charge of catalog). what did set inactivity time 0

java - How can I analyze a heap dump in IntelliJ? (memory leak) -

java - How can I analyze a heap dump in IntelliJ? (memory leak) - i have generated heap dump java application has been running days jmap tool -> results in big binary heap dump file. how can perform memory analysis of heap dump within intellij idea? i know there tools eclipse , netbeans rather utilize thought if possible. the basic results of analysis tell me number of instances of each object in memory, per-class, allow me able start debugging memory leaks. the best thing out there memory analyzer (mat), intellij not have bundled heap dump analyzer. java intellij-idea heap-dump jmap memoryanalyzer

kendo ui - KendoUI Template for Context Menu -

kendo ui - KendoUI Template for Context Menu - i'm trying wire context menu json info source, can't seem set template. if have datasource (as specified in docs) var datasource = [{ text: "hello", imageurl: "pencil_icon.png", content: "i'm on side" }] all fine , dandy (it's using default template imagine) however, if seek utilize own template, undefined. <script type="text/x-kendo-template" id="contextmenutemplate"> <li data-action="#=onclickjavascript#"><img src="@web_helpers.stratosphereimageurl("#=image#")" /> #=text#</li> </script> var datasource = [{ text: "bonjour", image: "@@pencil_icon", onclickjavascript: "alert('hello');" }] var menu = $("#contextmenu").kendocontextmenu({ template: kendo.template($("#contex

How do i to store input in a batch file? -

How do i to store input in a batch file? - i'm trying create batch file choices. use: errorlevel or set /p c=choose.. if /i "%c%" equ "1" goto :place1 what can't figure out - how maintain selection input later. if input 32, want store later use, like: start batchfile32 batchfile same, start batchfile&%choice% enough. syntax eludes me however. what have tried? because seems works: set /p c=choose.. start batchfile%c% gives output: choose..32 scheme cannot find file batchfile32. edit: of course of study not have file named batchfile32 , scheme trying start it. showing variable used correctly. batch-file

linux - -bash: $: command not found when installing Dart package -

linux - -bash: $: command not found when installing Dart package - i trying install http://stagehand.pub i alter terminal path ":/users/king/desktop/dart/dart-sdk" i check see if path alter , run "echo $path" in terminal , get green:~ king$ echo $path /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/users/king/desktop/dart/dart-sdk i type "$ pub global activate stagehand" , output "-bash: $: command not found" the instructions on stagehand.pub simple new don't know wrong please help. you need add together .../dart-sdk/bin path. linux bash path terminal dart

linux - Trying to output the page counts of a large number of PDF's to a log file -

linux - Trying to output the page counts of a large number of PDF's to a log file - i have 1,550 .pdf files want find page counts for. i used command ls -q | grep \.pdf > ../lslog.log output file names extension .pdf output .log file double quotes around them. opened lslog.log file in gedit , replaced " (double quotes) ' (apostrophe) can utilize files contain parentheses in final command. when utilize command exiftool -"*count*" (which outputs exifdata of selected file contains word "count") on single file, example, exiftool -"*count*" 'examplepdf(withparantheses).pdf' like, "page count: 512" or whatever page count happens be. however, when utilize on multiple files, example: exiftool -"*count*" 'examplepdf(withparantheses).pdf' 'anotherexamplepdf.pdf' file not found: examplepdf(withparantheses).pdf, ======== anotherexamplepdf.pdf page count : 362 1

objective c - iOS: UIButton doesn't show up -

objective c - iOS: UIButton doesn't show up - i'm creating simple button , adding subview main view. doesn't show though. this code setting up: uibutton* contactbutton = [[uibutton alloc] init]; contactbutton.titlelabel.text = @"contact developer"; [contactbutton sizetofit]; [self.view addsubview:contactbutton]; nslog(@"x: %f || y: %f || width: %f || height: %f", contactbutton.frame.origin.x, contactbutton.frame.origin.y, contactbutton.frame.size.width, contactbutton.frame.size.height); as may have noticed, placed bit of debug code @ end see position , dimensions of button. are: x: 0, y: 0, width: 30, height: 34 this means should showing in upper left corner doesn't. whats wrong? one possible reason used titlelabel directly. consider using settitle:forstate: method instead. to sure, consider setting backgroundcolor , debug step, create sure it's appearing. edit others suggested, seek using buttonwithtype: instead o

assembly - Is this the correct interpretation of x86-64 shift instructions? -

assembly - Is this the correct interpretation of x86-64 shift instructions? - movl %eax, %edx sarl $31, %edx shrl $31, %edx i have above x86-64 code. interpreting mean sarl shift value of edx (which equivalent of eax) right arithmetically, meaning important bit fill 31 of 32 bits out of register, filling in right. then, shrl, fills 31 important bits 0, leaving 1 lone bit in edx register. bit read '0' if eax positive , '1' if eax negative. is right interpretation, or grasping concept incorrectly? assembly x86-64 shift

android annotations - How can I cancel a Rest operation in androidannotations -

android annotations - How can I cancel a Rest operation in androidannotations - i've read throughout whole document , find no reply that. is there anyway can cancel rest operation? you can't. spring rest-template not provide feature. android-annotations

import from excel - Write keywords to files using a table of filenames and keywords -

import from excel - Write keywords to files using a table of filenames and keywords - i conduct research on rainforest cats in africa. have been using exiftool extract keywords photos create tables can analyse. more photographic camera trap studies starting utilize method, suspect question may relevant quite few people, when thousands of files routinely backed off-site prior keywording. i have had students in south africa keyword 1 of photographic camera trap surveys. these students have made errors in past, need double check work before analysing. have of photos (which gave them) same filenames. know if possible them extract keywords .txt file (using -filename , -keyword operators) in south africa, email file me , me write keywords same files on hard drive. considerably easier transferring 60 gb of photographs. i using macosx 10, perhaps more of automator problem, many photographic camera trap users have pcs, improve utilize exiftool if possible. david, can expor

bash - Filter before copy in shell -

bash - Filter before copy in shell - i have directory files jan 2014 nov 2014. sadly files have no dates in name, way can know month file belongs using ls -lrt , checking month there. so have re-create these files location based on month file created. ls -lrt | grep oct will give me oct files. now, tried ls -lrt | grep oct | cp * /../../oct2014 this didn't work. there anyway can perform such task? edit: give thanks much replying such great answers finish explanation. humbled. seek these tomorrow morning. further, files dealing not have special characters in names. again. this 1 way ls -ltr | awk '/oct/{print $nf}' | xargs -i{} cp {} newdir or utilize find find . -type f -newermt "oct 01" ! -newermt "oct 31" | xargs -i{} cp {} newdir more robust find (credit broslow) find . -type f -newermt "oct 01" ! -newermt "oct 31 23:59:59" -print0 | xargs -0 -i{} cp {} newdir if need accura

c - Time issue with Successive execution of OpenMP scripts -

c - Time issue with Successive execution of OpenMP scripts - i'm having issues execution times of c openmp scripts. timing within script done on block of code using gettimeofday() function: gettimeofday(&tim, null); double t1=tim.tv_sec+(tim.tv_usec/1000000.0); .. timed code here gettimeofday(&tim, null); double t2=tim.tv_sec+(tim.tv_usec/1000000.0); printf("%.6lf seconds elapsed\n", t2-t1); however when run scripts successively time each execution increases: the script has not been edited since yesterday did not have issue. also, found when leaving time (say 10-20 seconds) rerunning programme execution time starts decrease. my guess is to process itself. using gcc version 4.8.2 compile on linux mint 17 using xfce (gcc 4.8.2-19ubuntu1): gcc bluromp.c -fopenmp -o bluromp.out any ideas? edit: added clock() time.h testing: start_t = clock(); .. timed code here total_t = (double)(end_t - start_t) / clocks_per_sec; printf("time.h

c - Trying to use clock_gettime(), but getting plenty of "undeclared" errors from time.h -

c - Trying to use clock_gettime(), but getting plenty of "undeclared" errors from time.h - this question has reply here: linux: gcc -std=c99 complains not knowing struct timespec 2 answers i trying measure running time of function using clock_gettime() . including time.h , added -lrt makefile, , added right path on eclipse cdt. however, when seek compile maintain getting these kinds of errors: experiments.c: in function ‘main’: experiments.c:137:2: error: unknown type name ‘timespec’ timespec time1, time2; ^ experiments.c:139:2: warning: implicit declaration of function ‘clock_gettime’ [-wimplicit-function-declaration] clock_gettime(clock_process_cputime_id, &time1); ^ experiments.c:139:16: error: ‘clock_process_cputime_id’ undeclared clock_gettime(clock_process_cputime_id, &time1); this happens type of clock_ seek use. i've been reading

c# - NullReferenceException on textbox -

c# - NullReferenceException on textbox - this question has reply here: what nullreferenceexception , how prepare it? 21 answers i have simple button click method sets textbox's text viarable textfromtb. private void button1_click(object sender, eventargs e) { string textfromtb = textbox1.text; } if run once, okay, set text textbox1 textfromtb. if run method sec time throws nullreferenceexepction. why that? i tried initialize textbox that private void button1_click(object sender, eventargs e) { textbox textbox1 = new textbox(); string textfromtb = textbox1.text; // line returns null } but sets textbox1.text null or empty string. how can alter code work multiple times without exceptions? thanks in advance! are sure it's textbox null , not textfromtb ? c# visual-studio visua

angularjs - angular routing with optional parameter not working when refresh f5 -

angularjs - angular routing with optional parameter not working when refresh f5 - i have angular routing: $locationprovider.hashprefix("!").html5mode(true); $routeprovider .when('/', { templateurl: '/home/index', controller: 'homectrl' }) .when('/su-kien/:sename?', { templateurl: function (params) { homecoming typeof (params.sename) != "undefined" ? '/app/main/views/sukien/detail.html?sename=' + params.sename : '/app/main/views/sukien/index.html' }, controller: 'eventctrl' }) .when('/:pagename', { templateurl: '/app/main/views/common/index.html', controller: 'commonctrl' }) .otherwise({ redirectto: '/' }); i don't know why :pagename works fine f5 refresh page, /su-kien/:sename? works f5 reload works routing without paramter :sename e.g: /abc => /:pagename job /su-kien => works too, f5 ok /su-kien/aaaa=>

c++ - How to organize a system of parent and child windows that hide their parent. QT -

c++ - How to organize a system of parent and child windows that hide their parent. QT - let’s have main window. then when click button want kid window open , main windows hide. when close kid window want main windows reappear. right i’m opening kid window doing: s=new signupwindow(null,temp); s->show(); where s private pointer of main window. when seek do: s=new signupwindow(this,temp); s->show(); the s window doesn’t show up. here signature of it’s constructor in it's header: signupwindow (qwidget* parent=null, netflix *n=null); can explain why set parent null in header? issues when seek play around it's parameters , errors like: candidate expects 1 argument, 2 provided qt thanks you're help -a tired college pupil learning qt update next header main window: class loginwindow : public qwidget { q_object public: loginwindow (qwidget* parent=null, netflix *n=null); public slots: void log

java - Get R.drawable int inside of onClick() -

java - Get R.drawable int inside of onClick() - i have few imageviews, using same onclick(). how can id or r.drawable int specific imageview open image depending on image clicked on? i imagine have image views in xml layout file: <linearlayout android:layout_width="match_parent" android:layout_height="match_content" > <imageview android:id="@+id/image_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image_drawable_1" android:onclick="dosomething" /> <imageview android:id="@+id/image_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image_drawable_2" android:onclick="dosomething" /> <imageview android:id="@+id/image_3"

javascript - Backbone dropdown change doesn't update model in a collection -

javascript - Backbone dropdown change doesn't update model in a collection - i'm new backbone , have problem while learning, trying solve time , get's annoying. i'm rendering 1 dropdown each of attributes in model. when alter selected value, update model. when seek grab alter event in orderview, not work. if in orderingview, works, need search current model. what doing wrong here? the situation: have model: var order = backbone.model.extend({ defaults:{ column: '', order: '' } }); and corresponding collection having order model. views: var orderview = backbone.view.extend({ model: new order(), initialize: function(){ this.template = _.template(order_template); }, render: function(){ var temp = this.template({model:this.model.tojson(),order_columns:this.order_columns}); this.

Python multiple inheritance questions -

Python multiple inheritance questions - sorry if question has been asked before, not find reply while searching other questions. i'm new python , i'm having issues multiple inheritance. suppose have 2 classes, b , c, inherit same class a, defined follows: class b(a): def foo(): ... homecoming def bar(): ... homecoming class c(a): def foo(): ... homecoming def bar(): ... homecoming i want define class d, inherits both b , c. d should inherit b's implementation of foo, c's implementation of bar. how go doing this? resisting temptation "avoid situation in first place", 1 (not elegant) solution wrap methods explicitly: class a: pass class b( ): def foo( self ): print( 'b.foo') def bar( self ): print( 'b.bar') class c( ): def foo( self ): print( 'c.foo') def bar( self ): print( 'c.bar') class d( b, c ):

javascript - Dynamic array creation (bound to a grid) based on a user entered number in the UI -

javascript - Dynamic array creation (bound to a grid) based on a user entered number in the UI - i have employee info beingness entered in angular application. got input type=number accepts number (let's number of employees). user enters number ex: 3, dynamically ui needs populate table of 3 rows in ui (we need ng-repeat on numberofemployees here obviously). each row should bound employee object names. so, json object bound ui looks this, { numberofemployees : null, "employees" : [ { firstname: "set view", lastname: "set view", amount: "set view" }, { firstname: "set view", lastname: "set view", amount: "set view" } ] } input type=number in view should bound numberofemployees. grid should bound employees array. i think have setup watch on numberofemployees , push, splice in employees array. logic becomes wonky quic

javascript - Why this ajax call is not working? -

javascript - Why this ajax call is not working? - $(document).ready(function(){ $('.clickthetext').click(function(){ $.post("submit.php", $("#formbox").serialize(), function(response) { $('#content').html(response); }); homecoming false; }); }); my target pass content form , edit info , show response @ current page. .clickthetext button content: <div class="clickthetext">click here see result</div> content within id #formbox: part of form within id. rest of form out side id processed later. content/input within of id "formbox" processed. whatever response get, show within of "#content" id. what doing wrong here? ----edit---- i didn't add together on submit.php show response, wrote there: <?php echo 'somthing blah blah blah something'; ?> maybe there problem result of submit.php you can seek callin

caching - Get the last time a given Redis key was accessed -

caching - Get the last time a given Redis key was accessed - i'd view time of recent access specific key on redis server. i know info stored each key because used in redis's lru algorithm eliminating old keys. is there easy way see info given key? you can utilize object idletime command purpose. works number of seconds since key accessed, if need time subtract reply now(). caching redis key lru

c# - Take snapshot of video -

c# - Take snapshot of video - i'm trying take snapshot of video , save thumbnail. have found this question , have done it's there. exception: win32exception unhandled user-code - scheme cannot find file specified what have done wrong? my code here: ffmpeg f = new ffmpeg(); f.getthumbnail(server.mappath("~/uploads/" + unique), server.mappath("~/thumbnails/" + unique.remove(unique.indexof(".")) + ".jpg"), "1200x223"); and there's folder structure. you have wrong path of ffmpeg.exe ffmpeg.startinfo.filename = httpcontext.current.server.mappath("~/ffmpeg.exe"); c# ffmpeg thumbnails snapshot

Youtube Closed Caption for HTML5 Not Working -

Youtube Closed Caption for HTML5 Not Working - i having issues displaying closed caption on youtube videos using iframe player. here's code using: <!doctype html> <html> <body> <!-- 1. <iframe> (and video player) replace <div> tag. --> <div id="player"></div> <script> // 2. code loads iframe player api code asynchronously. var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); // 3. function creates <iframe> (and youtube player) // after api code downloads. var player; function onyoutubeiframeapiready() { player = new yt.player('player', { height: '390', width: '640', videoid: 'm7

sharedpreferences - Android app crashes by setting default values -

sharedpreferences - Android app crashes by setting default values - i seek set default values in app. i tried this: preferencemanager.setdefaultvalues(this, r.xml.defaults, false); and this sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(this); preferencemanager.setdefaultvalues(this, r.xml.defaults, false); but crashes. here res/xml/defaults.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="programtitles">["x", "a", "b", "c", "d", "e"]</string> <string name="programsubs">["", "as", "bs", "cs", "ds", "es"]</string> </resources> logcat: 10-09 08:16:21.820: w/dalvikvm(1557): threadid=1: thread exiting uncaught exception (group=0xb1a5fba8) 10-09 08:16:21.840: e/androidruntime(1557): fatal exception: main 10

java - LibGDX iOS RoboVM Landscape Orientation not fullscreen -

java - LibGDX iOS RoboVM Landscape Orientation not fullscreen - fixed in libgdx 1.4.1 thank badlogic, guys rock! the project generated using gdx-setup.jar file in stable build version 1.3.1 testing purposes. (i show later how update libgdx latest snapshot) here screenshot of project on mac desktop: *** can't post images, here url: http://i.imgur.com/ma43b8v.png here screenshot of project on iphone 5s: *** can't post images, here url: http://i.imgur.com/yqi9vhs.png here build.gradle file project root folder. buildscript { repositories { mavencentral() } dependencies { classpath 'org.robovm:robovm-gradle-plugin:1.0.0-alpha-04' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appname = 'my-gdx-game' gdxversion = '1.3.2-snapshot' robovmversion = '1.0.0-alpha-04' } repositories {

Java ArrayList printing out empty? -

Java ArrayList printing out empty? - my problem simple. when sending value of x when input == 1, method supposed add together value of x al arraylist. this, when effort print values of al , prints out empty. first class: import java.util.scanner; public class todo { scanner s = new scanner(system.in); scanner g = new scanner(system.in); void start(){ incompletetasks incompletetasks = new incompletetasks(); completetasks completetasks = new completetasks(); alltasks alltasks = new alltasks(); int input = 999; string x = ""; while (input != 0){ system.out.println("what do? type '0' cancel"); system.out.println(); system.out.println("1. add together task"); //done system.out.println("2. view current tasks"); system.out.println("3. delete task"); //done input = s.nextint(); if (input == 1){ while (!x.equals("quit")){ system.out.print("

Detect if new install or updated version (Android app) -

Detect if new install or updated version (Android app) - i have app on play store. want set requirement if users want utilize part of app, have invite friend before beingness able so. want impose restriction new installs of app (to fair users have installed app before restriction). sorry long intro, question how can find out if current device has updated app or new install? check if old version of app saves info on disk or preferences. info must safe, i.e. cannot deleted user (i'm not sure it's possible). when new version freshly installed, info won't exist. if new version upgrade old version, info exist. worst case scenario, old user flagged new 1 , have restricted usage. android

php - Enable Doctrine 2 cache in a ZF2 project -

php - Enable Doctrine 2 cache in a ZF2 project - how enable cache in project working zend framework 2 , doctrine 2? , cache should enabled doctrine cache or zend cache? here i've tried can't see diference in time execution added in module\application\config\module.config.php 'doctrine.cache.my_memcache' => function ($sm) { $cache = new \doctrine\common\cache\memcachecache(); $memcache = new \memcache(); $memcache->connect('localhost', 11211); $cache->setmemcache($memcache); homecoming $cache; }, 'doctrine.cache.apc' => function ($sm){ $apc = new \doctrine\common\cache\apccache(); homecoming $apc; }, // doctrine config 'doctrine' => array( 'driver' => array( __namespace__ . '_driver' => array( 'class' => 'doctrine\orm\mapping\driver\a

node.js - Cannot find module (nodejs) -

node.js - Cannot find module (nodejs) - module: getmac https://www.npmjs.org/package/getmac backstory: using module getmac before , worked charm. time ago updated nodejs 0.11. , today tried utilize again. installed (npm install mac) tried use. nope. "cannot find module". see getmac folder in node_modules. npm ls shows: ├─┬ getmac@1.0.6 │ └─┬ extract-opts@2.2.0 │ └── typechecker@2.0.8 i using 20+ other modules without problems. os: windows 7 32bit, administrator account how test if work: of possibility project can issue: i created new folder. then open command line , use: npm install getmac i created test.js 1 line: require('getmac'); in command line: nodejs test.js every time result same: module.js:340 throw err; ^ error: cannot find module 'getmac' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ module.require (module.js:364:17) @ require (module.

java - Parse classes from jar using javassist -

java - Parse classes from jar using javassist - i'm noob in javassist. can give sample how load classes jar , save them using javassist? jar = new jarfile(filename); enumeration<jarentry> entries = jar.entries(); while (entries.hasmoreelements()) { jarentry jarentry = (jarentry) entries.nextelement(); if(jarentry == null) break; if(jarentry.getname().endswith(".class")) { // ?????? } else { resources.add(new rresource(jarentry.getname(), jar.getinputstream(jarentry))); } you can load bytes respective class within jar file via code below: jarfile jarfile = new jarfile(file); // lets reference .class-file contained in jar zipentry zipentry = jarfile.getentry(classname.replace(".", "/")+".class"); if (zipentry == null) { jarfile.close(); homecoming null; } // our valid reference, able bytes out of jar-archive inputstream fis = jarfile.getinputstream(zipentry); byte[] classbytes = new byte[fis.availa

Using gmail gem with Rails 4 -

Using gmail gem with Rails 4 - i'm trying utilize nu7hatch/gmail gem rails , i've run problems. rule out conflict rest of app started new c9.io instance absolute minimum of code , still got same problem. changed basic rails scaffold follows: gemfile (added): gem 'gmail' routes.rb (added): root 'welcome#index' welcome_controller.rb: class welcomecontroller < applicationcontroller def index gmail.connect("username", "password") |gmail| @emails=gmail.inbox.find(:unread) end end end index.html.erb (view): <%= @emails.each |email| %> <p><%= email.subject %></p> <% end %> when visit root of app, next error: cannot load such file -- mime/message rails tell me error refers line: @emails=gmail.inbox.find(:unread) does have ideas how can create work please? i'm not sure if you've answered or not, thought add together found. think right way set in c

how to get rid of compiler error: C# use of unassigned local variable? -

how to get rid of compiler error: C# use of unassigned local variable? - i have questions why c# doesn't coordinates[j] part , can it. string[] lines = system.io.file.readalllines(@"c:\users\sp\dropbox\projecteuler\102\p102_triangles.txt"); string[] coordinates_str; double[] coordinates; //contains coordinates each line a1(x,y), a2(x,y), a3(x,y) long ln = lines.length; console.writeline("length: " + ln.tostring()); (int = 0; < ln; i++) { console.write(i); console.write(lines[i]); coordinates_str = lines[i].split(','); (int j = 0; j < 6; j++) { coordinates[j] = convert.todouble(coordinates_str[j]); } } you assign values elements of coordinates without allocating storage first double[] coordinates = new double[6]; so far have said coordinates reference array of doubles, have not said how big array (you have not allocated storage). c# compiler-errors unassigned-variable

ruby on rails - How to update a resource as current user or a non-user? -

ruby on rails - How to update a resource as current user or a non-user? - in application have next resources post , user. want user able update own post , invitee post , want invitee able update other invitee post not users. invitee non-user ( @post.user.blank ). post model belongs_to :user # columns: user_id, name, body end user model has_many :posts end my controller confused because i'm not sure how create updating post can done current user or invitee without allowing update anyones post. user updating users post. def update @post = post.find(params[:id]) if @post.update(post_params) redirect_to @post else render action: 'edit' end end def post_params params.require(:post).permit(:name, :body) end i thinking of doing: def update @post = post.find(params[:id]) if @post.user == current_user or @post.user.blank? if @post.update(post_params) redirect_to @post else

X11 behaviour without window manager -

X11 behaviour without window manager - i working on scheme on want prevent end user moving/resizing windows. hence starting x11 server , graphical application (named app1) without window manager. now need start graphical application (app2) on top of app1. i've done tests , seems x11 behavior stack each new created window on top of previous ones. clicking on window not create focus or alter it's "z" position relatively other windows. i wondering if default x11 behaviour (is documented somewhere ?) , if tunable ? mika window x11

c# - How to show entire Decimal -

c# - How to show entire Decimal - i have variable this: string energya14 = "0.17"; //kwh which add together property so: energya14 = convert.todecimal(energya14) but when print out shows 17 want show 0.17 how create entire decimal shown? thanks help in advance. i guess it's problem of used culture. . not interpreted decimal delimiter, resulting number 17.000 . try utilize other overload of convert.todecimal , utilize invariant culture: energya14 = convert.todecimal(energya14, cultureinfo.invariantinfo) same decimal.tryparse : decimal.tryparse(energya14, numberstyles.float, cultureinfo.invariantinfo, out energya14) c# decimal converter