Posts

Showing posts from July, 2015

java - Poker game hand evaluator arrays condition structure -

i made quick poker game. generates 5 random numbers , converts numbers actual cards values , symbols based on value. however, have problems when comes making hand evaluation. so far did flush right it's easy it's not perfect (it prints user has flush 5 times... ) , appreciate if me pair, 2 pair, 3 of kind , straight. rest afterwards need heads-up on how those. thank in advance help, here code : package tests; import java.util.*; public class tests { public static void main(string[] args) { boolean[] pack = new boolean[52]; // array not generate same number twice int[] cards = new int[5]; //the 5 unique random numbers stored in here. string[] cardsvalues = new string[5]; // assign card's value based on random number's value char[] cardssymbols = new char[5];//this assign card's symbol based on random number's value char symbols[] = {'♥', '♦', '♣', '♠'}; // possible symbols random number can take ...

statistics - Global closest fit calculation of missing value -

i trying understand calculation of global closest fit method calculate missing attribute value. trying understand example shown here on page 10, chapter: 2.8 global closest fit i understand how did computed distance example between case 1 , 3 shown in th table 1.10 i grateful human-like explanation :). the distance between 2 cases sum of distances between attributes. cases have 3 attributes: temperature, headache, , nausea. compare them 1 one: temperature | case 1 | case 3 | | high | ? | distance = 1. reason: 1 of cases has ?, falls under condition 2 of distance(xi, yi) formula ("xi = ? or yi = ?"). headache | case 1 | case 3 | |--------|--------| | ? | no | distance = 1. reason: 1 of cases has ? again. nausea | case 1 | case 3 | |--------|--------| | no | no | distance = 0 reason: both same, falls under condition 1 ("xi = yi") conclusion | attribute | case 1 | case 3 | distance | |-------------...

c++ - QT ofstream use variable as a path name -

i'm trying make function takes qstring int. convert qstring variable filename ofstream, take integer , place file. far have managed take constant filename such "filename.dat" , write variable it. when try use qstring : void write(const char what,int a){ std::ofstream writefile; writefile.open("bin\\" + what); writefile << a; writefile.close(); } i error void write(const char,int)': cannot convert argument 1 'const char [5]' 'const char this function calls write(); void server::on_dial_valuechanged(int value) { write("dial.dat",value); } when use "bin\dial.dat" instead of combining "bin\" string works fine. ofstream.open(); uses "const char*". i've tried filetypes may not match description the question is- have idea how combine "bin\" , qstring , make work ofstream? i've spend lot of time googling still can't make work. thanks! suggestions...

mysql - Need SQL Query Help: How to Search and Replace Specific Text LIKE x AND NOT LIKE xx -

and in advance help. i'm working on fixing broken links in massive wordpress multisite database , need writing sql query run via php myadmin. i've searched, can't perfect solution... problem: have more thousand broken links start http:/ instead of http:// challenge: following result in numerous links starting http:/// update wp_1_posts set post_content = replace (post_content, 'http:/', 'http://'); process: want write query select these links first, can review them ensure don't damage when replacing text string. downloading db dump , doing manual s&r not option since we're talking multi-gigabyte database. i thought work... select * wp_1_posts post_content '%http:/%' , post_content not '%http://%' but throws syntax error. close? question #1: how can find instances of "http:/" without returning "http://" instances in query results. question #2: how might safely ...

ios - Global import for Swift CocoaLumberjack -

i configured cocoalumberjack using swift pod. and can log whatever: ddlogvervose("") ddloginfo("") but have in every class use it: import cocoalumberjack isnt there way can globaly import ? the "trick" have available in classes use pch (precompiled header) , import cocoalumberjack there. it's header gets imported in files.

racket - How to convert a list into xexpr? -

#lang racket (struct result (q) #:mutable) (define result (result '())) (define (insert-result! result val) (set-result-q! result (cons val (result-q result)))) (insert-result! result "hello") (insert-result! result "wrold") (print (result-q result)) (define (iter l) `(div ((class "result")) ,(for ([i (result-q l)]) `(p ,i)))) (iter result) i'm trying xexpr. result should '("wrold" "hello") after code run. in iter function want produce output: '(div ((class "result")) (p "world") (p "hello")) somehow code above gives me '(div ((class "result")) #<void>) instead. how fix issue? you should use: ,@(for/list ([i (result-q l)]) `(p ,i)) notice use of ,@ splicing unquote, for/list collecting results list.

AJAX freezes in Safari after 9th request -

i'm trying use $.getjson , $.ajax , works fine in ever browser except in safari on 9th request safari hangs. in network tab can see request resulted in 200 code has loading spinner next request, duration column has "-" in , success callback never fired. has encountered before? i'm on safari 10.0.1 , resource i'm requesting on same domain. i've tried following javascript: $.getjson(url, function (data) { log('downloaded batch ' + (lastupdate || self.lastupdate) + ' @ ' + performance.now()); callback(data); }); $.ajax({ url: url, success: function(data) { log('downloaded batch ' + (lastupdate || self.lastupdate) + ' @ ' + performance.now()); callback(data); } }); var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate === 4 && xmlhttp.status === 200) { log('downloaded batch ' + (lastupdate || self.lastupdate) + ' @ ' + per...

c++ - Class member function at() and switch statements with a loop -

this first time posting here, apologies in advance if i'm doing wrong.i'm working on project part of program needs translate phone word (ie "rad-code") corresponding phone digits (ie 723-2633). i'm trying use switch statement along at() , length() class member functions. i've tried switching order of code section, keeps giving me error stating: "enter phone word: rad-code 723-2633terminate called after throwing instance of 'std::out_of_range' what(): basic_string::at: __n (which 8) >= this->size() (which 8)" here's code in question: else if (choice == phone_word) { cout << "\nenter phone word: "; cin >> phoneword; /*while (phoneword.length() != 8) { cout << "please enter valid phone number length: "; getline(cin, phoneword); }*/ (int = 0; < phoneword.length(); i++) switch (phoneword.at(i)) { ...

c - Get string of keys pressed over terminal -

i'm writing own ascii game engine in bare metal on raspberry pi 3. i'd create keyboard interface work planned nes controller on gpio. way can swap input i'm using or have multiplayer support. my question is, possible (maybe using vt100 or like) query putty string of keys being pressed @ given time? plan pull state of button being pressed (ie no interrupts). how can ask or receive keys being pressed? i'm assuming putty wont send me keys pressed in scenario: + b + left arrow. thanks :)

javascript - Passing JS variable to PHP -

i trying pass js variable php , have php echo js variable back. keep getting empty null string. doing wrong? function(u){ if(u){ var dt = {'ud':u}; console.log(dt); $.post('xrege.php', dt, function(r){ console.log(r.responsetext); console.log(typeof(r.responsetext)); }); } }); <?php $ud = $_post['ud']; echo json_encode($ud); ?> you should separate php code different file , should working. if(u){ var dt = {'ud':u}; console.log(dt); $.post('xrege.php', dt, function(r){ console.log(r); console.log(typeof r); },"json"); } name above code 123.html , keep below code in xrege.php <?php $ud = $_post['ud']; echo json_encode($ud); ?>

java - For polymorphic classes, is it OK to use protected instance variables? -

i have superclass called seat (for concert hall). goldseat , silverseat , bronzeseat subclasses. i've read keep data private enable encapsulation. if need write methods use these instance variables in subclasses, considered acceptable make them protected ? of similar stack overflow questions don't address correct object-oriented design, rather focus on differences between access modifiers , processing efficiency or technical difference of each. if missed one, apologise in advance , happily review it. i use getter methods in subclasses instance variables, seems bizarre in case, @ least data private . is considered acceptable make them protected? yes. don't think break law of encapsulation when use protected modifier. allow subclass access instance, still control should accessed others , can access instance. i use getter methods in subclasses instance variables, seems bizarre in case in cases, want preprocessing before others ...

java - Receiving an 'else' without 'if' error -

import javax.swing.joptionpane; public class cortana2 { public static void main(string[] args) throws exception { //declaring variables (add more commands) string command; // command stay same // strings below commands put in string steam; string league; league=("league"); steam=("steam"); command= joptionpane.showinputdialog("give valid command"); if (command == null) { joptionpane.showmessagedialog(null, "this not valid command. if have forgotten commands valid, please refer devon assistance"); joptionpane.getrootframe().dispose(); } else if (command == league) { runtime.getruntime().exec("\"d:/leagueclient.exe\""); } else if (command == steam) { runtime.getruntime().exec("\"c:/program files (x86)/steam/steam.exe\""); } } } not ...

ruby - Rails 5 - Simple Form - namespaced resources -

i trying learn how use namespacing in rails 5 app. i have resource called randd_fields. the table in database called: randd_fields i have model.rb files with: randd.rb module randd def self.table_name_prefix 'randd_' end end class randd::field < applicationrecord end the controller called: the views organised in files views/rannd/fields in _form.html.erb, i'm trying find way form render. i have tried each of these. <%= simple_form_for(@field), multipart: true |f| %> <%= simple_form_for(@randd, @field), multipart: true |f| %> <%= simple_form_for([:randd, @field]), multipart: true |f| %> each of them gives error: the first, gives error says: undefined method `model_name' nil:nilclass the second 2 give error says: syntax error, unexpected tlabel ...r([:randd, @field]), multipart: true |f| @output_buffer.s... how can use new path namespaced resource? my routes show: rake routes | grep field ...

android - java.lang.RuntimeException: Unable to start activity ComponentInfo -

i'm trying update data sqlite database shows null pointer exception @ line isupdate= getintent().getextras().getboolean("update"); in expense.java plz me find out error. here expense.java public class expenses extends activity { databasehelper mydb; private calendar calendar; private int year, month, day; button add; edittext amt, dte, spinner; textview tbal; string id, categ, amount, date; private sqlitedatabase database; boolean isupdate; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.expenseactivity); calendar = calendar.getinstance(); year = calendar.get(calendar.year); month = calendar.get(calendar.month); day = calendar.get(calendar.day_of_month); mydb = new databasehelper(this); add = (button) this.findviewbyid(r.id.button); spinner = (edittext) this.findviewbyid(r.id.spinner); amt = (edittext) this.findviewbyid(r.id.edittext3); dte = (edi...

Is it possible to make single page application with laravel blade templates and angularjs -

i want make single page application laravel , angularjs angular support html , laravel blade template php there possibility make single page application laravel blade , angularjs yes possible. here links: https://github.com/dimitrimikadze/lumen-angular-todo http://the-amazing-php.blogspot.com.ng/2015/05/lumen-micro-framework-with-angularjs.html https://github.com/bestmomo/lumenangular http://anvel.io/ anvel of lumen version 5.3 , angular 2 webpack , there documentation.

javascript - How to dynamically create Firebase select query? -

Image
i need information firebase database through filters applied checkbox. i have courses , user has options. can choose more 1 option don't know how required information when chooses options , presses okay. don't want retrieve courses data; data selected options. i explain in more detail in photo: that's code firebase. i'm looking query dynamically in ionic 2 app public getcourseslist(){ // write here?? , want assignment objects in this.coursesa return new promise(resolve => { let coursea = []; this.coursesdata.getcourseslist(this.department.id).map( eachsnapshot => { eachsnapshot.on('child_added',function(coursesnapshot){ coursesnapshot.foreach(function(snap):boolean{ let coursedetails = { class:snap.val().class, coursename: snap.val().coursename, start:snap.val().start, end:snap.val().end, lecture: snap.val().lecture, }; console.log("ad"+cours...

Access the css ":after" selector with jQuery -

this question has answer here: selecting , manipulating css pseudo-elements such ::before , ::after using jquery 17 answers i have following css: .pagemenu .active::after { content: ''; margin-top: -6px; display: inline-block; width: 0px; height: 0px; border-top: 14px solid white; border-left: 14px solid transparent; border-bottom: 14px solid white; position: absolute; right: 0; } i'd change border-width of top, left, , bottom border using jquery. selector use access element? tried following doesn't seem working. $('.pagemenu .active:after').css( { 'border-top-width': '22px', 'border-left-width': '22px', 'border-right-width': '22px' } ) you can't manipulate :after , because it's ...

asp.net mvc - Cannot find the object "dbo.Addresses" because it does not exist or you do not have permissions -

my code this public class address { public int id { get; set; } public string city { get; set; } public int postno { get; set; } public string street { get; set; } } public class applicationdbcontext : identitydbcontext<applicationuser> { public applicationdbcontext() : base("defaultconnection", throwifv1schema: false) { } public static applicationdbcontext create() { return new applicationdbcontext(); } public system.data.entity.dbset<mearnit.models.address> addresses { get; set; } } and when run update-database command on nuget package manager console hrows error. cannot find object "dbo.addresses" because not exist or not have permissions. i have no idea why it's throwing error this. can point out what's going wrong here? try command line: open file explorer , browse folder project (within src folder). hold down shift on keyboard , @ same time right c...

android - What is so special about Rewarded Video Ads? -

in addition banner ads , interstitial ads, admob provides kind of ads called rewarded video ads. special rewarded video ads? can't attach adopen event handler ordinary banner or interstitial video ad, , reward players there? allowed google? additionally, why status of chartboost source 'pending' in admob mediation? have set account, ads , campaign in chartboost, , waited 6 hours. how long have wait? must install chartboost sdk first in unity 5.3? rewarded video special because, on average, has higher ecpm (effective cost per mill impressions). in basic terms: as publisher (showing ads in games), make more money , cost less uninstalls , bad reviews. the user chooses watch video, not annoyed involuntary popup. reward @ end, positive experience. means less have negative feelings towards game, leading less uninstalls , less bad reviews. as advertiser higher quality installs in cost effective manner. this due fact people seeing ad , installing know mor...

javascript - Dynamically updating d3 bar chart -

this function runs on page load, , when data entered in form. draws graph fine on page load, doesn't redraw when new info submitted. when log element after data join, shows updated length of data array, , updated number of elements, don't redraw. ideas, scanning code? feel it's close, i'm not understanding steps of data updating process. this based on basic bar graph tutorial let's make bar chart , uses divs instead of svg elements, don't think should matter. this.render = function(self){ if(self.data){ self.x = d3.scalelinear() .domain([0, d3.max(self.data.map(function(d) { return parseint(d.daily_count); })) ]) .range([0, 500]); var bars = d3.select("#chart") .selectall("div") .data(self.data) .enter().append('div') .attr('class', 'bar-container row...

rx java - Use Reactive-Streams Processor with RxJava 2.0 -

i have org.reactivestreams.processor use rxjava 2.0. however, while there conversions integrate an org.reactivestreams.publisher rxjava, io.reactivex.flowable#frompublisher , not clear me how best integrate org.reactivestreams.processor (or org.reactivestreams.subscriber ). can shine light on this? you wrap publisher side , keep subscriber side is: processor proc = ... subscriber sub = proc; flowable flow = flowable.frompublisher(proc); flow.map(v -> v.tostring()).subscribe(system.out::println); sub.onnext(1);

java - Install rJava on macOS Sierra 10.12.1: linker error licuuc -

i trying install rjava within r-studio error ld: library not found -licuuc clang: error: linker command failed exit code 1 (use -v see invocation) make[2]: *** [libjri.jnilib] error 1 make[1]: *** [src/jri.jar] error 2 make: *** [jri] error 2 error: compilation failed package ‘rjava’ * removing ‘/users/imaclinda/library/r/3.3/library/rjava’ warning in install.packages : installation of package ‘rjava’ had non-zero exit status r version _ platform x86_64-apple-darwin16.1.0 arch x86_64 os darwin16.1.0 system x86_64, darwin16.1.0 status major 3 minor 3.2 year 2016 month 10 day 31 svn rev 71607 language r version.string r version 3.3.2 (2016-10-31) nickname sincere pumpkin patch how can fix linker error? i have found solution elsewhere macports, steps 1-5 guided here , steps 6 guided here . as root (sudo bash), edit /opt/local/library/frameworks/r.framework/resources/etc/makeconf , change line libs = -llzma -lm -liconv -licuuc -licui18n libs = -llzma ...

php - Laravel Update Many-to-Many Foreign Key Record -

i have user , role , , user_role table many-to-many relationship between user , role table. class user extends model { public function roles { return $this->belongstomany('app\role'); } } class role extends model { public function users { return $this->belongstomany('app\user'); } } user - id - other_columns role - id - other_columns user_role - id - user_id - role_id - other_columns user_role can have multiple same record different role_user.id . how update user 's role without changing or deleting record of user_role table? or in other word how update user_role.role_id without changing or deleting user_role.id ? i have tried: $user->roles()->updateexistingpivot($userroleid, ['role_id' => $newroleid]); and $user->roles()->sync($userroleid, ['id' => $userroleid, 'role_id' => $newroleid, 'user_id' => $userid]); but don't work. update this ...

python - Having trouble viewing more than one graph in the Spyder iPython console window -

i new coding in spyder 3 (with python 3.5 on windows7 laptop) & therefore having issue plotting graphs. reason when run code below, able view 1 graph. i've switched 2 graphs around , second 1 one shown in ipython console. think you'll find relevant code in last 12 lines. console output included after program. have no problem of rest of output. aspect of getting 1 graph... thanks! import pandas import numpy import seaborn import matplotlib.pyplot plt data = pandas.read_csv('addhealth_pds.csv', low_memory=false) data["h1su1"]=data["h1su1"].convert_objects(convert_numeric=true) data["h1hr12"]=data["h1hr12"].convert_objects(convert_numeric=true) data["h1hr13"]=data["h1hr13"].convert_objects(convert_numeric=true) #theseven variables missing data changed "nan" elements, #keeps them out of analysis. data["h1su1"]=data["h1su1"].replace(6,numpy.nan) data["h1su1"]=dat...

.locked() returns True even after release() called in python multithreading environment -

i trying write first code using python thread. please see code there issue when release lock thread using release() says lock still availabe [locked() returns true after release()] import threading import time class thread (threading.thread): def __init__(self,t,d,arr,lock): threading.thread.__init__(self) self.name=t self.delay=d self.array=arr; self.lock=lock def run(self): self.fun1() def fun1(self): print "the thread %s want take lock now" %self.name self.lock.acquire() print "lock status after lock acquire foe",self.name,self.lock.locked() time.sleep(self.delay) print "release lock %s" %self.name self.lock.release() time.sleep(2) print "lock status after lock release is",self.name,self.lock.locked() lck=threading.lock() obj1=thread('t1',5,[1,2,3],lck) obj2=thread('t2',10,[4,5,6],lck) obj1.sta...

powershell - Using [array] in a class based DSC resource -

i have been creating few class based custom dsc resources , running following issue: whenever try use array input resource, error. for example dscproperty(mandatory)] [array]$products would result in following error when try create mof file using resource: write-nodemoffile : invalid mof definition node 'nodename': exceptioncalling "validateinstancetext" "1" argument(s): "convert property 'products' value type 'string[]' type 'instance' failed. the input object $products (for example): $products = @("windows server 2012", "windows sql server", "windows 8.1") i have no idea why write-nodemoffile function try convert array (it should not need converting, right?) , if needed converted - why convert array string[] instance ? anyone has clue why happens? way got work creating long string array of strings , seperating them within resource. declare array : [stri...

javascript - How do I click on an image change to other image and click to a video -

i'm having problem on processing keypressed/mousepressed. if example have data file of images apple, dog & cat, 2 videos forest & garden. the problem want press button , change image , when pressed again change video. for example start video = "forest.mp4" > keypressed = > apple.jpg ; with 2 selection of left or right > if keypressed = left > dog.jpg if keypressed = right > cat. jpg both of them keypressed = > video = "garden" movie mymovie[]; int index = 0; boolean start = false; float t0; //movie begin float t; //current time void setup(){ size(1280,720); img = new image[2]; img = new image(this, "apple.jpg"); img = new image(this, "dog.jpg"); img = new image(this, "cat.jpg"); mymovie = new movie[3]; mymovie[0] = new movie(this, "forest.mp4"); mymovie[1] = new movie(this, "garden.mp4"); } void draw(){ image (img, 0 ,0); image(img, 0 ,height, img.height, img, ...

php - Next/Previous Page bug -

i need help, want make next / previous page have problems... this php code, how try make it. problem doesn't show 3 data on first page , on next page puts same data again not other one. code: $statement = $connect->prepare("select count(*) anzahl `accounts`"); $statement->execute(); $row = $statement->fetch(); $max_data = $row['anzahl']; $page = 1; if(isset($_get['page'])) { $page = intval($_get['page']); } $max_info = 3; $start = ($page - 1) * $max_info; $number_page = ceil($max_data / floatval($max_info)); for($a = 1; $a <= $anzahl_seiten; $a++) { if($page == $a){ echo " <b>$a</b> "; } else { echo " <a href='acp.php?page=list_all_player&seite=$a'>$a</a> "; } }

java - How to update values in HashMap with LinkedList? -

this hashmap: public static hashmap<string, linkedlist<linkedlist<string>>> partitionmap; partitionmap = new hashmap<string, linkedlist<linkedlist<string>>>(); my program has initial step of initialization keys added, without values. after that, need retrieve key , add value. problem got null pointer exception if initizalize linkedlist. init step: linkedlist<linkedlist<string>> ll = new linkedlist<linkedlist<string>>(); partitionmap.put(key, ll); after that: linkedlist<linkedlist<string>> l = partitionmap.get(key); l.add(partition); //crash, null pointer exception partitionmap.put(key, l); the problem related linkedlist , initialization. there way avoid problem? edit: full code. //this function called n time fill partitionmap keys public void init(dlrparser.signaturecontext ctx) { linkedlist<linkedlist<string>> l = new linkedlist<linkedlist<string>>(); pa...

jquery - Layout issues when using Masonry with Bootstrap 4 -

i using masonry ( http://masonry.desandro.com ) style portfolio page unfortunately running issues. happens when new user enters website layout off ( http://imgur.com/a/m55wf ) items overlapping each other. on refresh issue gone can recreated randomly after more control + shift + r. suspecting because of bootstrap 4 issue created can wrong. here's how structure individual item: <div class="row masonry-container"> <div class="col-md-4 col-sm-6 item"> <div class="individual_item"> <img src="img/portfolio7.jpg"> <div class="shadow"></div> <h3>tagtrain</h3> <button type="button" data-toggle="modal" data-target="#modal_seven"></button> </div> </div> ..... </div> and how calling masonry: $('.masonry-container').masonry(); please note pre...

ggplot2 two layers plot, define x and y lim for geom_abline -

Image
i using ggplot2 plot graphs, basic aim is: graph has 2 layers, lower layer (scatter plot) use data gathered public database, , add data study on top of it. added regression line data. can have brief idea of have picture: problem that, due different dimensions of 2 data sets, regression lines long (full range), makes picture strange. want define x , y axis layer of data, however, can not reach this. for regression, use geom_abline define slope, intercept, etc, instead of using geom_lm , see can take argument fullrange = false .

mysql - Is amazon RDS charge increase on database volume -

suppose have database in amazon rds 100 data available. made query fetch single data these 100 data. after few days 100 data become 100k data , made same query again fetch single data. here question-> query cost same both? or second 1 higher first one? rds pricing based on cost of hourly rds instance class, plus cost of storage , backups, , database types (aurora) there i/o rate cost. other i/o rate, pricing pretty straight-forward , should answer question.

javascript - THREE.FileLoader is not a constructor(…) -

i'm trying load model scene. i've included these files @ top of project: <script src="js/build/three.min.js"></script> <script src="js/loaders/objloader.js"></script> this code var loader = new three.objloader(); loader.load( "res/rose/modelsandtextures/rose.obj", function ( object ) { scene.add( object ); } ); but error: objloader.js:46 uncaught typeerror: three.fileloader not constructor(…) i looked in objloader.js file , find three.fileloader - line error on: var loader = new three.fileloader( scope.manager ); other peoples examples of work fine check out if you're using right objloader.js . take @ example shows how use object properly: var scene = new three.scene(); var renderer, camera, banana; var ww = window.innerwidth, wh = window.innerheight; renderer = new three.webglrenderer({ canvas: document.getelementbyid('scene...

sorting - How to sort an Observable with Observable parameters ? rxjs -

i trying modify , sort list. noob @ :( i able 'combinelatest' problem have modify array function below 'groupbydateandtournament'. outcome: create observable of list , sorting parameters (favoritetournaments, teamranks) modify list 'groupbyandtournament' if observable list has changed sort favorite if obsevable favoritetournament has changed sort ranks if observable teamrank has changed this.subscription = this.matchesservice.getupcoming() .merge( this.favoriteservice.getfavoritetournaments().flatmap((data) => { return {'favoritetournaments': data} }), this.teamsservice.getteamranking().flatmap((data) => { return {'teamranks': data} }) ).scan((acc, curr) => { let upcomingmatches; if (curr.upcoming) { upcomingmatches = this.groupbydateandtournament(curr); } if (curr.favoritetournaments) { upcomingmatches = this.sortbyfavorite(curr) } if (...

asp.net - swift get info from asp table with form -

and reading. table asp website , download code can parse it, problem not know how table because need submit drop down list , click button right 1 show. the website is: http://amiasaf.iscool.co.il (for wonders thats hebrew , school's classes , updates site). lets table first drop down list's second value , button on right of first drop down area. could please show me how code this? i not asking whole code way this. (of-course more better) thank , have lovely day!

Julia - using dictionary key as index for a multidimensional array -

i have dictionary keys shown: testdict = dict{array{int64,1},float64}([1,3,1] => 0.0, [2,3,1] => 0.0, [1,3,2] => 0.0, [2,3,2] => -2.64899e-16, [2,1,2] => 0.858307, [1,2,1] => 0.0, [1,2,2] => 0.0, [2,2,1] => 0.0, [2,2,2] => 0.65796, [2,1,1] => -5.81556e-16, [1,1,2] => -3.50541e-16, [1,1,1] => 0.0) these keys vary considerably both regarding range , length, initialized array in beginning of function im writing...it [2,3,2] for dictionary above..., or [10,3,50,60] creating dictionary keys [1,1,1,1], [1,1,1,12] ... , [10, 3, 50, 59], [10,3, 50, 60] and need accomplish, create multidimensional array result_array = array(float64, tuple([2,3,2]) but need populate array values dictionary, need set element [1,1,1] result_array[1,1,1] = 0.0 how can use keys dictionary set indices of result_array respected values? splat key turn result_array[[1,1,1]...] result_array[1,1,1] . testdict = dict{array{int64,1},float64}([1,...

python - Python3/SQLite3 | How to create multiple tables from a list or list of tuples? -

i have list of tuples so: >>> all_names = c.execute("""select name fb_friends""") >>> name in all_names: ... print(name) ('jody ann elizabeth lill',) ('georgia gee smith',) ...(282 more)... ('josh firth',) ('danny hallas',) and want create table each individual person. first need replace spaces underscore in order sqlite3 table names, so: >>> all_names = c.execute("""select name fb_friends""") >>> name in all_names: ... friends_name = name[0].replace(" ", "_") ... print(friends_name) jody_ann_elizabeth_lill georgia_gee_smith ...(282 more)... josh_firth danny_hallas so if understand correctly have list, not list of tuples..? should simple create tables list so: >>> all_names = c.execute("""select name fb_friends""") >>> name in all_names: ... friends_name = name[...

c# - How to save shapes which I draw on a Panel as binary -

i have mini paint program . want create save button saves panel details(shapes , been drawing) binary file. did this: savefiledialog sfd = new savefiledialog(); binaryformatter bf = new binaryformatter(); var stream = new binaryreader(file.open(sfd.filename,filemode.create)); bf.serialize(stream,object); but has error using object invalid in bf.serialize . how should this? you don't need serialize panel, panel not serializable. can consider either of these options: you can draw on bitmap , save bitmap, or draw control image , save image. way flatten shapes single image , after loading image not editable shapes anymore. paint. you can make shapes serializable , serialize list of serializable shapes in file. can deserialize them again. way can load shapes , let user edit them, example visio. i shared 2 examples here: save image example: saves drawings painted on panel bitmap image file. serialization example: in example i've created serializable s...

How to start single PHP session? -

i'm looking way start single php session, nothing seems work. i've tried doing this: session_start($_session['check_rank']); but didn't work.. got following error: php notice: undefined variable: _session in /applications/mamp/myprojects/teste/teste.php on line 4 php warning: session_start() expects parameter 1 array, null given in /applications/mamp/myprojects/teste/teste.php on line 4 is there way start single section? what "single" php session? never heard of it. session_start() takesno parameter, starts session. if want call/start named session, have use session_name(). e.g. <?php session_name("my-session"); session_start(); $_session store session variables, e.g. <?php session_name("my-session"); session_start(); $_session["foo"] = "bar";

python - Locating the dictionary within a list when inputting a specific value -

let have few clusters represented dictionaries below: cluster1 = {'disks' : [0,1,2,3,12] , 'left': true , 'right': false} cluster2 = {'disks' : [3,4,5,2] , 'left':true ,'right': false } cluster3 = {'disks' : [6,7,8,2] , 'left':false ,'right': false } cluster4 = {'disks' : [10,11,12] , 'left':true, 'right':true } listofclusters = [cluster1,cluster2,cluster3,cluster4] then make list of clusters above store them.... if want search list particular disk , tell me clusters within list have disks how that? according requirement: to search list particular disk , tell me clusters within list have disks use following approach form dict cluster_numbers key disk number , value list of cluster names(cluster order numbers) let's find cluster names(numbers) have 1 or more disk numbers following list [2, 10, 7] search_disks = [2, 10, 7] cluster_numbers = {d:[] d in s...

android - Common practice for handling time field EditTexts? -

so if have 3 edittexts: 1 hours, minutes, seconds, max length of 2 numbers per field, conceivable inputs "99" seconds or "99" hours example -- numbers >=60. if entered 60 seconds you'd want same "1 minute 00 seconds" example. is there common practice this, or common input field in android allows input of time in standardized way? because otherwise end delving awkward dance of trying "translate" edittexts when done editing them (apparently there's no clean, consistent way this), there issue of happens when enters 9's , there no room "carry over" anything. is there standardized input this? yes, there standard widget enter time in android. can see in different forms here , there. it's timepicker widget. can find quick tutorial here .

php - Ajax call controller function -

this jquery code $(document).foundation() //sorting lists , add them database $(function() { $('#sortable').sortable({ axis: 'y', opacity: 0.7, handle: 'span', update: function(event, ui) { var list_sortable = $(this).sortable('toarray').tostring(); // change order in database using ajax $.ajax({ url: "index.php/lists/update_order", type: 'post', data: {list_order:list_sortable}, success: function(data) { //finished } }); } }); }); it works if put csrf false in config, possible leave true , open controller function? if enable true 403 error. also, in controller what's best way of updating list_order in lists table?

angularjs - how to protect my routes using webtoken angular js and node js -

my routing tree app.config(['$routeprovider', '$httpprovider', function ($routeprovider, $httpprovider) { $routeprovider .when("/",{ templateurl:"build/views/home.html" }) .when("/login",{ templateurl: "build/views/login.html" }). otherwise({ redirectto: '???' }); }]); i want protect home.html .... accessible when login success app.controller('loginctrl', function ($scope, $http, $window,$location) { $scope.user = {username: '', password: ''}; $scope.isauthenticated = false; $scope.welcome = ''; $scope.message = ''; $scope.submit = function () { $http .post('http://localhost:8080/authenticate', $scope.user) .success(function (data, status, headers, config) { $window.sessionstorage.token = data.token; $scope.isauthenticated = true; var encodedp...

ruby - Error in irb free() invalid size error when calling library from FFI -

description i trying call omnipage ocr library ruby using ffi on linux. in particular, there recprocesspagesex method following signature: recerr recapipls recprocesspagesex ( int sid, lpctstr pdocfile, lpctstr * pimagefiles, lponetouch_cb pcallback, void * pcontext ) i've defined methods in ruby (note :rec_err enum type definition defined elsewhere): module omnipage extend ffi::library nuance_directory = '/usr/local/lib/nuance-omnipage-csdk-lib64-19.2/'.freeze lib_paths = %w(librecapiplus.so libkernelapi.so libtxtconv.so librtfconv.so).map |file| file.join(nuance_directory, file) end ffi_lib lib_paths attach_function :init, :recinitplusa, [:pointer, :pointer], :rec_err attach_function :set_license, :krecsetlicensea, [:pointer, :pointer], :rec_err attach_function :set_output_format, :recsetoutputformata, [:int, :pointer], :rec_err attach_function :set_output_level, :recsetoutputleve...

can not add script tag to index.html in react-script project -

i create project react-script. i add weixin js-sdk public/index.html head tag. <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="%public_url%/favicon.ico"> <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js?v=1"></script> <!-- notice use of %public_url% in tag above. replaced url of `public` folder during build. files inside `public` folder can referenced html. unlike "/favicon.ico" or "favicon.ico", "%public_url%/favicon.ico" work correctly both client-side routing , non-root public url. learn how configure non-root public url running `npm run build`. --> <title>react app</title> but got error: error 'wx' not defined

Pausing slider after click Jquery -

i have been trying create slider pauses on hover , resets on mouse leave. part works. issue slider not pausing after next, previous button or dots (small screen) clicked ( please hover on slideshow see arrows(large screen)). slideshow needs remain in pause state once clicked until user no longer hovering slideshow - reset timeout , carry on loop. i believe issue somewhere in "auto slide" section slider works automatically imitating "click". // set height slider. function retrieve_height() { var img_height = $(".top-slides li img").outerheight(); $(".top-slides").css("height", img_height); } $(window).load(retrieve_height); $(window).resize(retrieve_height); $(document).ready(function() { function content_slider() { var slide_progress = $(".progress-bar"), // class progress bar indicates duration of slide slide_duration = 5000, // set duration of 1 slide. 5000 = 5 seconds. ...