Posts

Showing posts from March, 2010

jquery - Can't select direct parent element -

jquery - Can't select direct parent element - i have html page globally exists of div , section , , ul elements (of course of study more, common) now in 4th list on page (e.g. below in bold) <body> <div> <header> <ul id="firstlist"> <li> [..] <section> <ul id="secondlist"> [..] <section> <ul id="thirdlist"> [..] <section> <ul id="fourthlist"> <li><a>test 1</a></li> <li><a>test 2</a></li> <li><a>test 3</a></li> </ul> [..] the thing that, when clicks on test, want loop through list-items position of click in list (it there items before or after) herefore have following $("a").click(function(event){ [..] var parentel = $(this).parents('ul').filter(":first").tagname; alert($(parentel).attr("id...

java - Communication entre MainActivity et Fragment via FragmentPagerAdapter -

java - Communication entre MainActivity et Fragment via FragmentPagerAdapter - i starting java , android : to resume : i have main activity (activitymain) lunch service (service ioio board) , bunding connexion. service (ioio) sending handler activitymain in loop(). activitymain have setupfragment() fonction when oncreate(). void setupfragments() { // gestion des fragments // création de la liste de fragments que fera défiler le pageradapter list<fragment> fragments = new vector<fragment>(); // ajout des fragments dans la liste fragments.add(fragment.instantiate(this,fragmentgraphique.class.getname())); fragments.add(fragment.instantiate(this,fragmentmain.class.getname())); fragments.add(fragment.instantiate(this,fragmentoptions.class.getname())); // création de l'adapter qui s'occupera de l'affichage de la liste de // fragments this.mp...

ios - How to stop/cancel/suspend/resume tasks on GCD queue -

ios - How to stop/cancel/suspend/resume tasks on GCD queue - how stop/cancel/suspend/resume tasks on gcd queue how 1 stop background queue operations? want stop screens in our app. , screens should auto resume. so, how 1 pass queue in ios? i mean when user have browsing app time run background thread in dispatch_queue_t. never stops , resume in code. how 1 suspend , resume queue to suspend dispatch queue, it's dispatch_suspend(queue) . doesn't impact tasks running, simply prevents new tasks starting on queue. also, suspend queues created (not global queues, not main queue). to resume dispatch queue, it's dispatch_resume(queue) . there's no concept of "auto resume", you'd have manually resume when appropriate. to pass dispatch queue around, pass dispatch_queue_t object created when called dispatch_queue_create() . in terms of canceling tasks queued on dispatch queues, new feature of ios 8 , you'd phone call dispatch_block_cance...

Show blank text boxes and buttons in MS Access form even when there is no data -

Show blank text boxes and buttons in MS Access form even when there is no data - i have split form in ms access bound query. query homecoming no results , when happens, form goes totally blank. is there way have form still show fields , buttons , have fields blank? possible reply here. i'm guessing can't around status sounds it's set have filter (that returns no results), check whether have of scenarios described in status b , seek prepare those. forms ms-access

Why are stdin and stdout considered files in C? -

Why are stdin and stdout considered files in C? - for example, stdio.h library has functions require file * argument take stdin user input terminal. c stdio functions operate on streams, not files. far code concerned, stream consumer (output stream) or producer (input stream) of bytes. a stream may associated file on disk. may associated terminal. or printer. or network socket. or else might want communicate with. stream abstraction of can read or write string of bytes. stdin , stdout (along stderr ) predefined file * objects refer console, although can override either @ command line or within code. c stdout stdin

ruby on rails - Conflict between RefineryCMS and Forem: could not find compatible versions for gem for friendly_id -

ruby on rails - Conflict between RefineryCMS and Forem: could not find compatible versions for gem for friendly_id - i thinking bug bundler? bundler -v bundler version 1.7.12 ruby -v ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux] rails 4.2 has else run this? i'm trying install latest version of forem on site has latest version of refinerycms bundle install fetching git://github.com/radar/forem.git fetching gem metadata https://rubygems.org/......... fetching additional metadata https://rubygems.org/.. resolving dependencies... bundler not find compatible versions gem "friendly_id": in snapshot (gemfile.lock): friendly_id (5.1.0) in gemfile: forem (>= 0) ruby depends on friendly_id (~> 5.0.0) ruby running `bundle update` rebuild snapshot scratch, using gems in gemfile, may resolve conflict. so run 'bundle update' not prepare problem: [ec2-user@ip-172-31-27-73 fiit]$ bundle update updating https://githu...

content management system - Drupal or from-scratch web app development? -

content management system - Drupal or from-scratch web app development? - i looking develop multi-user web application supports next key features: fill out forms demographic info on individuals define , administer surveys & polls generate nice reports graphs) user rights administration , generic login stuff my dilemma whether utilize cms (drupal?) or develop scratch. putting time , cost issues aside minute, obvious cms strength, weaknesses , potential risks using cms? gut tells me cms easy , quick start with, when features list begins grow - pay bill having delve unfamiliar db construction , code, seek tweak existing modules or write own scratch. is better, on long run, utilize cms? there 2 basic types of cmses: focused on features focused on flexibility the first type - focused on features - offer lot of modules or extensions expand basic functionality. can build web site using ready-to-use 3rd party modules. there's disad...

View hidden fields in the gsp code via if-operator in Grails -

View hidden fields in the gsp code via if-operator in Grails - i writing form. if checkbox in form filled, hidden fields in form must shown. part of form: <div class="checkbox"> <label><g:checkbox name="isadmincafee" value="${false}"/>register admin</label> </div> <g:if test="${isadmincafee == true}"> admin info </g:if> i've decided utilize if-operator solving task, when set check-box on, hidden fields don't show. how prepare it? it seems trying show some admin data when user checks checkbox , hide some admin data when user unchecks checkbox. you have used g:if tag library interpreted in server , render part within if test status true. instead of using g:if tag library, need hide some admin data using css , utilize javascript show or hide when user checks or unchecks checkbox. grails gsp

embedded - read() not working when called from a pthread C -

embedded - read() not working when called from a pthread C - i writing c server goal of using pthreads handle client connections, works fine until introduce pthreads. fire client off on pthread , created , ran fine; however, no longer 'read()' client's file descriptor. i have been trying figure out 2 weeks now. have included code snippets of both server code (including , excluding pthreads.) , client handler code. here main server loop (pthreaded): /*sets , runs server. (max 10 clients)*/ void publicserver(void) { //server locals int serversocket_fd; int clientsocket_fd; socklen_t serverlength; socklen_t clientlength; struct sockaddr_in serveraddress; struct sockaddr_in clientaddress; //threading locals pthread_t threadpool[20]; //pool of threads, used in fifo fashion. int threadpointer = 0; //points location of next available thread. //clear old sockets puts("unlinking server socket"); unlin...

javascript - Access the return value of a spied function in Jasmine -

javascript - Access the return value of a spied function in Jasmine - when spying on function bound event handler keystrokes, how 1 access homecoming value? here illustration of event handler: class="snippet-code-js lang-js prettyprint-override"> function onkeydown(event) { if (!$(event.target).is("input, textarea, select, *[contenteditable=true]")) { switch (event.keycode) { case 8: // // ... return false; break; case 46: // // ... return false; break; } homecoming true; } } here illustration of unit test testing it: class="snippet-code-js lang-js prettyprint-override"> describe("myscript.js", function () { var stubs = {}; beforeeach(function() { $(document).bind("keydown.myscript", onkeydown); stubs.myscriptkeydown = spyon(window, "onkeydown").and.callthrough(); }); it(...

javascript - Get array index by Max value? -

javascript - Get array index by Max value? - this question has reply here: javascript: min & max array values? 32 answers return index of greatest value in array 5 answers i found solutions max value of indexes, how can max value when have array this: myarray = []; myarray[1] = 10; myarray[2] = 99; alert(math.max(myarray)); i index of max value. in case index 2 of value 99. the result nan.alert(math.max(myarray)); 1. if want first instance: var arraymaxindex = function(array) { homecoming array.indexof(math.max.apply(null, array)); }; console.log(arraymaxindex([1,2,7,2])); //outputs 2 2. if want occurrences of max: function getallindexes(arr, val) { var indexes = [], = -1; while ((i = arr.indexof(val, i+1)) != -1){ indexes.push(i); ...

Code Coverage, Jacoco -

Code Coverage, Jacoco - say have 1,000 lines of java code, , added 10 lines, , ran tests , got code coverage report. i'm involvement in coverage of 10 lines got added. if test case covers 10 lines, 10 out of 1000, pretty low 1% coverage, far i'm concerned 100% coverage in sense every added line has been tested. to create question harder, assuming added lines in same file, same package, same class , same method, lines spread around , not next each other. is there way measure test coverage of lines got added? code-coverage jacoco

responsiveness - Make Site Responsive -

responsiveness - Make Site Responsive - i have responsive problems site. the theme genbu , has been customized have 2 equal sidebars , narrower margins. this custom css code: class="snippet-code-css lang-css prettyprint-override"> #main { padding: 10px; } .main-wrap { float: left; margin-left: 1rem; margin-right: 21rem; } #sidebar-primary-wrap { float: left; margin-left: 1rem; margin-right: -21rem; width: 20rem; } #sidebar-secondary-wrap { float: left; margin-right: -20rem; position: relative; width: 20rem; } i have responsive problems 240x320, 320x480 and768x1024 device when checked site with: http://mattkersley.com/responsive/ can help me @media stuff? @user29769 sum up, if want optimize 240px width site version, can : - align text articles (i checked , either solved issue, or work begenning) - cut down margins between left , right edges of screen , border of article - place searchbar elsewhere : under header, or c...

GIT - How to know the branch a branch branched from? -

GIT - How to know the branch a branch branched from? - support create multiple branches (aaa, bbb, ccc) commit. then, create new branch (ddd) 1 of branch (bbb) , create commit on it. then pushed remote. how person knows new branch (ddd) comes branch? the git commands did was: git branch aaa git branch bbb git branch ccc git branch ddd bbb git checkout ddd echo 2 >> file git add together file git commit -m "2" and git log show * commit d259a3b (head, ddd) | | 2 | * commit efb038c (develop, ccc, bbb, aaa) | | 1 | * commit dd24bb6 (master) it possible know ddd branched bbb? thanks it indeed impossible in general. git records only1 single commit-id (sha-1) reference name (such branch or tag) points. history of commit determined solely commit's parent ids, not record branch-names. when force remote, "push" operation sends sha-1 of commit you're pushing (plus more sha-1s other li...

Convert a decimal number into probability in MATLAB -

Convert a decimal number into probability in MATLAB - i have array of numbers ranging 0 1, illustration (0.0000, 0.2500, 0.5000, 0.7500, 1.0000). now want convert them probability farther processing, example: want statement executed probability of 0.75. i know matlab provided rand function provides implementation of probability. how efficiently solve problem while want convert massive number corresponding probability (the probability can 0 1, such 0.0125, 0.0005 etc.)? matlab probability

function - Python homework help: issues with finding least common string in csv file -

function - Python homework help: issues with finding least common string in csv file - i issues homework create programme reads csv files reply question, unfortunately gasp of isn’t strong other. have written bulk of code , thought clear clear syntax incorrect. according assignment have reply question: count number of (t's) in field [correct] how many times to the lowest degree mutual string appear in field [gas] find sum of values in field [quant] less (408) how many values in 'code' field not match format 9999(x9+)9? what average value of numbers in field [age] in range (30) , (107) inclusive find sum of numbers in field [length] between (2.482) , (6.428) inclusive count lines gas's have value (nitrogen) or quant less 318 so wrote code best of ability. code is stage 2 function import string def getfile(): filename = input('filename: ') #the file name should .csv file = open(filename, 'r') firstline = true li...

javascript - HTML5 Canvas Pathfinding for an object within a drawn polygon -

javascript - HTML5 Canvas Pathfinding for an object within a drawn polygon - good afternoon all, i come yet request lesson/example/answers. while messing around canvas in html5, have learned how manipulate depth(z-buffer) , several other neat things. however, trying find way perform pathfinding canvas. of examples on net little hard comprehend me due fact handling pathfinding far differently trying achieve(which utilize tile based pathfinding). other examples seem deal in boxes or rectangles well. this code used illustration draw polygon: var canvas = document.getelementbyid('canvaspath'); var context = canvas.getcontext('2d'); // begin custom shape context.beginpath(); context.moveto(170, 80); context.beziercurveto(1, 200, 125, 230, 230, 150); context.beziercurveto(250, 180, 320, 200, 340, 200); context.beziercurveto(420, 150, 420, 120, 390, 100); context.beziercurveto(430, 40, 370, 30, 340, 50); context.beziercurveto(320, 5, 250, ...

bandwidth utilization percentage for an interface -

bandwidth utilization percentage for an interface - how calculate bandwidth utilization percentage using wmi classes. tried formula. utilization % = ((bytestotalpersec*8)/currentbandwidth)*100 but result crossing 100%. is there problem formula used?? bandwidth utilization

asp.net - Get selected value from rowlist and pass it to query string laong with page number in JqGrid -

asp.net - Get selected value from rowlist and pass it to query string laong with page number in JqGrid - have row list [10,20,30] want pass selected row list ie if (20 selected sick pass 20 query string , retrieve value). , want select page number too. possible ways accomplish selected value row list , current page number , pass value query string. i tried var page=$(".ui-pg-input").val() not firing think missing out here. i got done. using predefined session values in it asp.net jqgrid

winform combobox lambda expression -

winform combobox lambda expression - i have combobox in vs 2010 using vb.net. i'd utilize ilist drive combobox. have working when seek order combobox using lambda expression, nil shows in combobox. me.cbagency .datasource = os.orderby(function(o) o.agency) .displaymember = "agency" .tag = os .selectedindex = nil end take out orderby(function(o) o.agency) , works. i've used syntax before in asp.net , seems work.. wondering different or i've done wrong. thanks you might have phone call tolist() on iqueryable execute query: .datasource = os.orderby(function(o) o.agency).tolist() combobox lambda

escaping - How can I decode a URL escape string in C#? -

escaping - How can I decode a URL escape string in C#? - possible duplicate: how decode url param c# i want alter %20 ect. spaces ect. httputility.urldecode(string) , httputility.urlencodeunicode(string) c# escaping

asp.net - AssociatedControlID for RadListBox and RadDateTimePicker controls? -

asp.net - AssociatedControlID for RadListBox and RadDateTimePicker controls? - i using radlistbox , raddatetimepicker in traditional c# asp.net 3.5 web application, , have labels this: <asp:label id="lblstartdate" runat="server" text="start date" associatedcontrolid="dtpstartdate" /> <telerik:raddatetimepicker id="dtpstartdate" runat="server"> </telerik:raddatetimepicker> the label doesn't connect date picker attribute because picker complex command , can't work out element target. telerik propose javascript solution this, seems unwieldy me , depends on client side scripting. is there improve way provide reasonable level of accessibility? either wrapping telerik solution somehow or altogether alternative approach? yep, telerik picker composite command , similar javascript attach label date input should trick. reference input field, utilize get_dateinput() property client api ...

Include jquery ui function in plugin -

Include jquery ui function in plugin - i wondering how can include drag functionality jquery ui library in separate plugin modifying. want create div draggable, don't want have write own method. i suggest building plugin jquery ui widget , making jquery ui draggable widget dependency of widget. create div draggable using $(div).draggable();. jquery jquery-ui jquery-plugins

How to deal with java encoding problems (especially xml)? -

How to deal with java encoding problems (especially xml)? - i searched java , encoding , did not found resource explaining how deal commons problems arise in java when encoding , decoding strings. there lot of specific questions single errors did not found wide response/reference guide problem. main questions are: what string encoding? why in java can read files wrong charatecters? why when dealing xml got invalid byte x of y-byte utf-8 sequence exception? main causes , how avoid them? since stackoverflow encourages self answers seek responde myself. encoding process of converting info 1 format another, response details how string encoding works in java (you may want read more generic introduction text end encoding). introduction string encoding/decoding process transforms byte[] string , viceversa. at first sight may think there no problems, if more process issues may arise. at lowest level info stored/transmitted in bytes: files sequence of bytes , ne...

linear programming - Does the 'semis' variable of an lp format in gurobi mean it is continuos? -

linear programming - Does the 'semis' variable of an lp format in gurobi mean it is continuos? - i generating '.lp' file using text operations formulate mip model. planning solve model using gurobi shell after reading '.lp' file object. in mip model, need variables strictly integer variables. others can continuous. so .lp file reads as generals x y z semis b c d e f g h is right method desired results ? just in case if want of them integers should skip 'semis' command ? format linear-programming gurobi

erlang - 'Bad Connection Handle' in aerospike ejabberd integration -

erlang - 'Bad Connection Handle' in aerospike ejabberd integration - tried integrate aerospike ejabberd, , after little bit of struggle , had nail issue says " debug:[util_extract_common_lead_parms()]:connection handle bad c(0) debug:[util_extract_common_lead_parms()]:connection handle bad c(32680) " made connection next way, -behaviour(gen_mod). -define(conn_name, 'ejabberd_aerospike_client'). init()-> host = "127.0.0.1", port = 3000, case aerospike:connect( host, port ) of {ok, c } -> register(?conn_name,c), ok; {error, _} = err -> ?error_msg("failed start aerospike client: ~p", [err]), err end. open on discuss.aerospike.com. erlang ejabberd aerospike erlang-driver

java - Difficulties with internal tags when parsing xml -

java - Difficulties with internal tags when parsing xml - i have next xml: <fitness> <group id="1" name = "firstgroup"> <exercises id="1" name = "exercise1"> <implementation> hw </implementation> <videourl> apgw5xi8xfq </videourl> </exercises> </group> <group id = "2" name = "group2"> <exercises id = "5" name = "exercise5"> <implementation>just it</implementation> <videourl>let's see it</videourl> </exercises> </group> <group id = "3" name = "group3"> <exercises id = "6" name = "exercise6"> <implementation>just it</implementation> <videourl>let's see it</videourl> </exercises...

php - Mysql database backup sql file security? -

php - Mysql database backup sql file security? - i have php script backup database dbname.sql can accessible anyone. need encrypt/decrypt backup database accessible in application. how can this? note: have list page download database backups. want server able utilize database only. when backup file, move location can not accessed in root directory of server. example, if you're public directory public_html, move file outside (or same level) public_html file. then 2 ways access either script (with proper calls) or via ftp client. php encryption mysqldump database-backups file-security

java - Loading data updates into cache or datastore first? -

java - Loading data updates into cache or datastore first? - there 2 scenarios - 1 loading updates first cache , datastore , sec loading datastore first , updating cache. flow improve in terms of performance , in scenario? java performance caching concurrency

schema.org - Why does Google Testing Tool use the "id" attribute to generate a URL for the Microdata item? -

schema.org - Why does Google Testing Tool use the "id" attribute to generate a URL for the Microdata item? - i'm using microdata describe blog post, , i'm surprised value homecoming schema.org’s blogposting google developers testing tool. i have expected itemprop url , not merge of website url , item id . doing wrong, or google display issue? class="lang-html prettyprint-override"> <div itemscope="itemscope" itemprop="blogpost" itemtype="http://schema.org/blogposting" id="foobar"> <a itemprop="url" href="/realone">real</a> </div> value returned https://developers.google.com/structured-data/testing-tool/: class="lang-none prettyprint-override"> blogposting: http://www.example.com/foobar url: http://www.example.com/realone this strange. it’s not conforming microdata note. apart microdata’s itemref ...

python 2.7 - How to search for a specific kind of qt gui control -

python 2.7 - How to search for a specific kind of qt gui control - i have qwidget contains qgroupbox , contains qcombobox , qlineedit , qcheckbox . i need go around controls, , if command qcheckbox , inquire if checked or not. need know how qcheckbox checked - thought this: count = 0 command in groupbox.controls(): if command type of qtgui.qcheckbox: if control.ischecked: count = count + 1 else: print('no checked') else: print('no qtgui.qcheckbox') print ('there '+ str(count)+ 'checked') if checkboxes children of groupbox, can seek this: count = 0 checkbox in groupbox.findchildren(qtgui.qcheckbox): if checkbox.ischecked(): count += 1 print('there %s checked' % count) the checkboxes children of groupbox if created this: checkbox = qtgui.qcheckbox('title', groupbox) python-2.7 pyqt iteration state qcheckbox

google chrome - jQuery scrollLeft not working with overflow-x -

google chrome - jQuery scrollLeft not working with overflow-x - here fiddle: http://jsfiddle.net/pj39dw5x/6/ html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow-x: hidden; text-align: center; } div#all{ width: 200%; height: 100%; } div.menu{ position: fixed; top: 0; left: 0; } div.wrap{ width: 50%; float: left; } div.body{ text-align: left; margin: 0 auto; max-width: 960px; width: 100%; padding-top: 100px; } $('a[href*=#]').on('click', function(event){ if($(this).hasclass('external')===false){ event.preventdefault(); $('html,body').animate({scrollleft:$(this.hash).offset().left},500); $('html,body').animate({scrolltop:$(this.hash).offset().top},500); } }); <div id="all"> <div class="menu"><a href="#kotva1">lorem</a> <a href="#kotva2"...

c# - Decimal validation (data annotation) -

c# - Decimal validation (data annotation) - i want pass decimal value controller. utilize asp.net mvc knockout.js. in view have: @html.textboxfor(x => x.test, new { data_bind = "value: test", @class = "form-control" }) @html.validationmessagefor(x => x.test) my viewmodel: [required(errormessage = "error")] [range(0, int32.maxvalue)] public decimal test{ get; set; } and can't pass e.g 1,5 (with comma) because mvc validation doesn't allow me, if pass 1.5 (with dot), controller doesn't have value (it passed 0), if pass 5 it's work. if turn off mvc validation , pass 1,5 (with comma) it's work. do know how can solve problem ? pass value comma , dot. this allow positive values , can pass in decimals. validates numbers, or without decimal places, , comma 1000 separators. [regularexpression(@"^(((\d{1,3})(,\d{3})*)|(\d+))(.\d+)?$",errormessage = "error")] [range(0, int32.maxvalue)] publ...

ios - Error: Use of undeclared type 'SCNView' -

ios - Error: Use of undeclared type 'SCNView' - im doing transition obj-c swift , after 5 seconds i'm stuck :/ i have storyboard scnview object i drag connection view controller xcode writes out @iboutlet var scene: scnview! i error: 'weak' cannot applied non-class type '<<error type>>' utilize of undeclared type 'scnview' what this? i'm using latest xcode 6.3. you need tell swift frameworks (modules) intend utilize in source code file import statement, tell objc such using #import or #include . import scenekit class myviewcontroller: uiviewcontroller { @iboutlet var sceneview: scnview! // ... } this both makes classes, functions , other symbols available utilize in source file , makes xcode link in scenekit framework binary when building app. ios swift storyboard scenekit

Do you know why mysql fails creating this table? -

Do you know why mysql fails creating this table? - maybe question silly... couln't found problem, when do: create table prefixes ( id int(11) not null auto_increment, primary key(id), index id (id)) engine = innodb auto_increment = 1 default character set = utf8; mysql says: error 1005 (hy000): can't create table 'sms.prefixes' (errno: 150) i though old foreign key or pointing/using table, did export (complete) , searched in export key "prefixes" , found nothing, no foreign key problem or something, if create same table naming "prefixes2" or else works!!! please if have clue maybe can helpful. thanks! try this: create table `sms.prefixes` ( id int(11) not null auto_increment, primary key(id), index id (id)) engine = innodb auto_increment = 1 default character set = utf8; sql fiddle demo mysql

CS-Cart: payments with non-default currency -

CS-Cart: payments with non-default currency - meet unexpected , terrible problem cs-cart cms 4.2 version. utilize default currency in database different currency on frontend: main location republic of finland euro currency, webshop in sweden currency sek. must have euro base of operations currency sales in sek, amount of order must transferred payment gate in sek. i'm think normal situation , never had little uncertainty i'll got problem it. after month preparing launch new website on cs-cart, when done, found cs-cart cannot utilize "user" currency when payments!!! the same situation have in russian federation i'm has currency in backend different form frontend... cs-cart back upwards forum tells me i'm 1 in world such demand. i'm stupid in matter, made several attempts prepare it, found fn_get_order_info function makes array order data, returns $order_info['total'] in default currency... i can't find function or descript...

Does " - " mean stdout in bash? -

Does " - " mean stdout in bash? - is " - " shortcut stdout in bash? if not mean? example, wget -q -o - $line how stdin? thanks , regards! as far know, bash isn't involved usage of dash. it's convention of many unix command line utilities take - placeholder stdin or stdout when set in place of input or output file name on command line. edit: found it, behavior specified in posix utility syntax guidelines, §12.2.13 of the open grouping base of operations specifications: utilities utilize operands represent files opened either reading or writing, '-' operand should used mean standard input (or standard output when clear context output file beingness specified). bash

python - Function not running correctly -

python - Function not running correctly - i'm making python 2.7 text-based rpg , function fighting isn't running properly. here's code: def attack(self): print "a %r appears! wants fight!" % (self.name) while (player.health > 0) or (self.health > 0): player.health = player.health - ( ( randint(0,5) ) + attack_multiplier(self.level) ) print "%r strikes! health downwards %r" %(self.name, player.health) try: player.weapon = (raw_input("what attack with? >>").lower) if (player.inventory.get(player.weapon) > 0) , (player.health > 0) , (self.health > 0): if weapon_probability() == "critical hit": self.health = self.health - (((randint(0,5))) + (attack_multiplier(weapon_levels.get(player.weapon))) * 2) print "critical hit!" elif weapon_probability() == "hit": ...

Matlab - neural networks - How to use different datasets for training, validation and testing? -

Matlab - neural networks - How to use different datasets for training, validation and testing? - best i've question neural networks in matlab. first of all, i've little nn, 2 inputs, 1 hidden layer 10 neurons , 1 output. , works fine. question i've is. can determine training date, validation info , test data? i know, if utilize e.g. net = feedforwardnet(10); can split overall dataset e.g.70/100 15/100 , 15/100. don't want this, because in case want train nn 1000 data-points, validate them data-points , utilize independent data-set of 1000 data-points test them. other words, want command these 3 interdependent data-sets. thus, can help me? kind regards edit, don't want utilize data-set 3000 data-points , set devideparams on 1/3 1/3 & 1/3. best myself when utilize feedforwardnet can define split parameters net.divideparam.trainratio = 1/3; net.divideparam.valratio = 1/3; net.divideparam.testratio = 1/3; you know info di...

ios - How to use Navigation Controller inside of UITabBarController with Storyboard on Swift -

ios - How to use Navigation Controller inside of UITabBarController with Storyboard on Swift - i'm using swift. utilize navigation within of tabbar storyboard. @ first, first display show within of tab menu. when move sec display, sec display show without tab menu. i selected segue type "show (e.g.push)" how can maintain displaying tab menu on views? in interface builder: create uitabbarcontroller , set initial view controller. create uitableviewcontroller . select uitableviewcontroller , go menu bar > editor > embed in > navigation controller . select uitabbarcontroller , ctrl-drag uinavigationcontroller . choose relationship segue > view controllers . now, view controller add together in uinavigationcontroller stack presented in same uitabbarcontroller . to perform segue first-in-stack uitableviewcontroller connected uinavigationcontroller , viewcontroller must of course of study first create viewcontroller, create segue in ...