Posts

Showing posts from January, 2014

Correctness of networkx line digraph construction -

the following python code: import networkx nx g = nx.digraph() g.add_nodes_from([0, 1]) g.add_edges_from([(0,0), (0,1), (1,0), (1,1)]) nx.write_dot(g, 'g.dot') gl = nx.line_graph(g) nx.write_dot(gl, 'gl.dot') creates following dot format graphs: --- g.dot --- digraph { 0 -> 0; 0 -> 1; 1 -> 0; 1 -> 1; } --- gl.dot --- strict digraph { "(0, 1)" -> "(1, 1)"; "(1, 0)" -> "(0, 0)"; "(0, 0)" -> "(0, 1)"; "(1, 1)" -> "(1, 0)"; } should edges: "(1, 0)" -> "(0, 1)"; "(0, 1)" -> "(1, 0)"; "(0, 0)" -> "(1, 1)"; "(1, 1)" -> "(0, 0)"; be in line graph construction? http://en.wikipedia.org/wiki/line_graph#line_digraph nx.line_graph creates strict digraph. strict means there no loops , no repeated edges. "(0, 1

c# - How to remove redundance in text attributes? -

say have piece of code such as: [myattribute("long long text 1", "some more long text 1")] [myattribute("long long text 2", "some more long text 2")] [myattribute("long long text 3", "some more long text 3")] public class testclass { [...] } is there way introduce consts substitute common substrings in these attributes (i.e. long long text , some more long text in example) ? understand might not possible in terms of actual 'const' surely there must feature ? you can use constants: public class someclass { public const string someconstant = "long long text 1"; } [myattribute(someclass.someconstant)] public class someotherclass { } you have reference them properly.

xml - how to transfer more then one string from one activity to another in android -

i have transfer more 1 string 1 activity activity in android , know how transfer 1 string 1 string in android more 1 string can not found ways code here , if (long_insert_row_index>0){ //spinner spdepcmpname = (spinner) findviewbyid(r.id.spdepcmpname); // string strcmp= spdepcmpname.getselecteditem().tostring(); //string strcmp=depositecmpname; //startactivity(new intent(depositactivity.this, auditpointdetailsactivity.class).putextra("insert_row_index",""+long_insert_row_index).putextra("segment_name", spinner_segment.getselecteditem().tostring()).putextra("audit_type_name", spinner_audit_type.getselecteditem().tostring()).putextra("audit_type_id", audit_type_id).putextra("segment_id", segment_id)); ///please see commented section @ bottom startactivity(new intent(depositactivity.this, depositenextactivity.clas

cordova - App does not appear in Android emulator -

Image
i creating phonegap app using webstorm (phonegap/cordova app) on mac. problem have app not appear in android emulator. emulator appears screen word "android" not change reveal app: i have followed instructions on cordova site android setup on mac: this emulator setup: i have tried activating , deactivating "use host gpu" per answers , comments question no use - android emulator shows nothing except black screen , adb devices shows "device offline" the app appears , works correctly when choose "browser" platform in configuration: any ideas else need do? edit 1 : log information when running in verbose mode suggested @dar running command: /users/username/documents/projects/harkme/platforms/browser/cordova/run --emulator static file server running @ http://localhost:8000/index.html ctrl + c shut down android_home=/usr/local/cellar/android-sdk/24.3.4/ java_home=/system/library/java/javavirtualmach

css - Html dropdown not overlaying on top of other webpage elements -

before posting question, have looked various stack overflow questions , implemented them didn't work me. please not post question duplicate. my problem dropdown not coming on top of other elements. i have posted code in jsfiddle note: please drag output window towards left proper view of header in scss window, user profile dropdown handled class navbardropdown .navbardropdown { float: right; padding: 0px 10px; position: relative; img { margin-top: -5px; height: 40px; } ul { background-color: $base-secondary-color; padding: 4px 0; position: absolute; z-index: 999; top: 30px; left: 0; width: auto; border: none; border-radius: 1px; } ul { height: 30px; padding: 0 40px 0 10px; display: block; } } i have tried position:absoulute , z-index. i don't know mistake. appreciated? by looks of it, reason drop down list hidden because overflows content of nav element, ".navbar"

difference - how to subtract two resultant values in mysql -

say have table tablea , query select id, if(cond1, value, 0) firstval, if(cond2, value, 0) secondval, firstval-secondval diff tablea the above query gives unknown column firstval in field list error. know can calculate diff if(cond1, value, 0)-if(cond2, value, 0) diff don't want add condition again , without inner/sub queries. edit: abstract idea follows table structure id | type | recorddate | value ========================================= 1 2015-12-17 9 2 b 2015-12-19 5 3 2016-01-13 31 4 b 2016-01-14 23 5 2016-01-31 44 6 b 2016-02-07 38 and on... query: select type, if(max(recorddate), value, 0) firstval, if(secondmax(recorddate), value, 0) secndval, firstval-secndval diff table month(recorddate)=1 group type rollup resultant table based on above query: type | firstva

c++ - Undefined reference to vtable in final class constructor and destructor -

this question has answer here: undefined reference vtable 26 answers hello trying learn c++ book "c++ introduction programming jesse liberty , jim keogh" doing questions chapter 12 multiple inheritance. q4 asks me derive car , bus vehicle car adt , derive sportscar , wagon , coupe car , implement non pure virtual function vehicle in car . compiling on codelite @ build time gives error undefined reference 'vtable coupe' on constructor , destructor coupe please can tell me doing wrong can learn more how handle virtual function definitions correctly vtables. #include <iostream> using namespace std; class vehicle { public: vehicle(){}; virtual ~vehicle(){}; virtual int getitsspeed() = 0; int getitstyresize(); virtual int getitsregistration() { return itsregistration; } protected: int itsspeed; int itsregistration; }; class car : p

ruby on rails - Preventing ActionView::MissingTemplate in a Backend-only (API) application? -

my backend api-only application responding clients restclient::internalservererror: 500 internal server error because of following code ( , there being no templates render ). def create @project = project.create(params.require(:project).permit(:name)) @project.update_attributes(key: devise.friendly_token) respond_to |format| format.html format.json { render json: @project } end end current solution: based on rails guide layouts , rendering , can prevented using render json: @project source: http://guides.rubyonrails.org/layouts_and_rendering.html the ask: but want give client option of format, respond_to block more ideal choice. is there way combine these use first block not result in 500 error? thanks kindly. what should user see if asks html response? if requests should handled js, take out whole respond_to structure. if html should something, must create view return or render (or render nothing: true ). if want r

TimeUUID vs timestamp in Cassandra? -

if can extract time timeuuid, make sense use timestamp column in cassandra? also how can extract time timeuuid , make range queries(eg. jan 2016 may 2016) on it? you don't need store timestamp in different column, if have choosen use timeuuid. you looking this . please take notice min , max . lsb bits determine uniqueness. i.e last 8 bits can range 00000000 ffffffff . so please prepare range query accordingly. hope helps!

mysql - Join query is going wrong -

i have 2 tables: first travellers_details , second user_info . traveller_details table has columns id, travel_mode , dep_from , arr_to , dep_date , user_id , status . user_info table has columns user_id , first_name , last_name , email . i want records of both table join user_id , wrote following query not correct: $sql="select * `traveller_details` full outer join `user_info` on traveller_details.user_id=user_info.user_id traveller_details.dep_from='".$this->from."' , traveller_details.arr_to='".$this->to."' , traveller_details.dep_date='".$this->sending_date."' , traveller_details.status='n'"; mysql doesn't support full outer join , query doesn't work. suspect left join sufficient: select * `traveller_details` td left outer join `user_info` ui on td.user_id = ui.user_id td.dep_from = '".$this->from."' , td.arr_to = '".$

GNU Parallel and Solaris 11 -

i'm trying run number of jobs using parallel command in solaris 11 following command: find . -name "job*" | parallel -p 64 ::: the cwd has script files job1...job256 need run. these files have few variable definitions , run fine running: ./job1 & ./job2 & etc however, following error gnu parallel when run command: /usr/bin/bash: 1: command not found ... /usr/bin/bash: 1: command not found 256 times these procedure runs fine in debian box not in solaris 11 + sparc box. can please point out solution? thanks! i don't know if problem, question had google juice me , maybe can people same problem had. it first time used gnu parallel, , set parallel=1 on bash script flag use enable parallel tests. when ran it, saw error message. when stripped down test command simple echo. outside bash script error wouldn't occur. hmmm. parallel=2 caused "2: command not found". turns out, read gnu parallel. from man page: $

javascript - Angular2: Send data from one component to other and act with the data -

i'm learning angular2. in order that, have 2 components, on click of 1 of components, other component should notified , act that. this code far: export class jsontextinput { @output() rendernewjson: eventemitter<object> = new eventemitter() json: string = ''; process () { this.rendernewjson.next(this.json) } } the process function being called on click on first component. on second component have code: export class jsonrendered { @input() jsonobject: object ngonchanges () { console.log(1) console.log(this.jsonobject) } } the ngonchanges never runned, dont how pass info 1 component other edit there app component parent of 2 components. none of both parent of other this how clasess now: export class jsonrendered { private jsonobject: object constructor (private jsonchangeservice: jsonchangeservice) { this.jsonchangeservice = jsonchangeservice this.jsonobject = jsonchangeservice.jsonobject jsonchangese

java - Android FATAL exception in Fragments -

i new android.i getting following error. have looked same questions , have applied answers code. still getting same error. 05-28 09:30:12.800 2016-2016/com.example.yatisawhney.fragmentdemo e/androidruntime: fatal exception: main process: com.example.yatisawhney.fragmentdemo, pid: 2016 java.lang.runtimeexception: unable start activity componentinfo{com.example.yatisawhney.fragmentdemo/com.example.yatisawhney.fragmentdemo.mainactivity}: android.view.inflateexception: binary xml file line #21: error inflating class fragment @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) @ android.app.activitythread.access$800(activitythread.java:135) @ android.app.activitythread$h.handlemessage(activitythread.java:1196) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflec

c# - How to display vlc video from small screen to another vlc big screen "vlcplugin21" -

i'm trying display video in big screen when click on button "view video" after loaded windows in small screen via vlc player "vlcplugin21" in windows form application the following code load video windows , display via vlc player: public void readvlc1() { ofd.filter = "all files (*.*) | *.*"; if (ofd.showdialog() == dialogresult.ok) { vlc1.playlist.items.clear(); vlc1.playlist.add("file:///" + ofd.filename,ofd.safefilename, null); txt_videoname.text = ofd.safefilename; } } i want click on button example "view video in full screen" , display same video big vlc screen. any help??

jquery change event on date calculation -

i add x number of months dropdown (month_number) start date end date calculated , shown correctly: $('#start_date').change(function(){ var months = +$('#month_number').val(); var end = new date($(this).val()); end.setmonth(end.getmonth() + months); $('#end_date').val( (end.getmonth() + 1) + '/' + end.getdate() + '/' + end.getfullyear()) ; demo: https://jsfiddle.net/8epztlv2/3/ but want changing dropdown (month_number) end date not changing ! here's fiddle . $('#start_date, #month_number').change(function() { var months = $('#month_number').val(); var end = new date($('#start_date').val()); end.setmonth(end.getmonth() + number(months)); $('#end_date').val((end.getmonth() + 1) + '/' + end.getdate() + '/' + end.getfullyear()); }); you have add changing event select element. value of end getting $('#start_date').val() instead of $(this).val() .

xpath - Scrapy can't get data when following links -

i have asked question scrapy can't data . have new problem when using spider. i've pay attention xpath, seems there same error in program. here spider's code: from scrapy.contrib.spiders import crawlspider, rule scrapy.selector import selector scrapy import item, field scrapy.contrib.spiders import crawlspider, rule scrapy.contrib.linkextractors.sgml import sgmllinkextractor db_connection import db_con class uniparc(item): database = field() identifier = field() version = field() organism = field() first_seen = field() last_seen = field() active = field() source = field() class uniparcspider(crawlspider): name = "uniparc" allowed_domains = ["uniprot.org"] start_urls = ["http://www.uniprot.org/uniparc/?query=rna&offset=25&sort=score&columns=id%2corganisms%2ckb%2cfirst-seen%2clast-seen%2clength"] rules = ( rule(sgmllinkextractor(allow=(), restrict_xpaths=('//*[@id=

java - Android MediaPlayer loading from localhost but not from online server -

android mediaplayer loading files localhost not online server. as told android developers guide string url = "http://10.0.2.2/music.mp3"; // works string url = "http://example.com/audios/music.mp3"; // not works mediaplayer mediaplayer = new mediaplayer(); mediaplayer.setaudiostreamtype(audiomanager.stream_music); mediaplayer.setdatasource(url); mediaplayer.prepare(); mediaplayer.start(); logs show: 05-28 20:31:20.403 942-2444/? e/nucachedsource2: source returned error -1, 10 retries left 05-28 20:31:24.308 942-2444/? e/nucachedsource2: source returned error -1, 9 retries left 05-28 20:31:28.231 942-2444/? e/nucachedsource2: source returned error -1, 8 retries left 05-28 20:31:32.150 942-2444/? e/nucachedsource2: source returned error -1, 7 retries left 05-28 20:31:36.061 942-2444/? e/nucachedsource2: source returned error -1, 6 retries left 05-28 20:31:39.974 942-2444/? e/nucachedsource2: source returned error -1, 5 retries left 05-28 20:31:43.937 942-2

Does ElasticSearch scan-and-scroll fetch account for updates? -

imagine i'm doing scan-and-scroll perform index migration. if update document during such operation, see new version of document in document stream, or skipped? it skipped scan operasion snapshot in time before document updated. next scan updates. here quout elasticsearch docs: the results returned scroll request reflect state of index @ time initial search request made, snapshot in time. subsequent changes documents (index, update or delete) affect later search requests. hope helps.

find failed predicate in prolog - automated debug mode? -

how find if predicate in long computation return fail ? possible using debug mode ? searched in google, no results. for swi-prolog there possibility hook debugger . if visit site, take @ context: funny hackers corner section.

html - How to make a css media query snippet in ATOM editor -

i have started exploring atom again after break of year , less buggy now, exploring making snippets parts , going through this piece of documentation, now on how make css snippet , of course tried same syntax used fot js snippets , had css snippet looked following in snippets file: '.source.css': 'css-media': 'prefix': 'css-media' 'body': '@media (min-width:$1) { $2 }' the problem above gives me following output: @media (min-width:) { } rather then: @media (min-width:) { } now did go through few css packages online this one , did't find example of making media query snippet in atom. can tell me how can right ? see bottom of page linked: http://flight-manual.atom.io/using-atom/sections/snippets/ you can use multi-line syntax using """ larger templates so template should be '.source.css': 'css-media': 'prefix': 'css-

Count dates inside an array PHP -

i have array : array ( [0] => array ( [x] => 2016-04-19 ) [1] => array ( [x] => 2016-05-25 ) [2] => array ( [x] => 2016-05-26 ) [3] => array ( [x] => 2016-05-27 ) [4] => array ( [x] => 2016-05-28 ) [5] => array ( [x] => 2016-05-29 ) [6] => array ( [x] => 2016-05-29 ) [7] => array ( [x] => 2016-06-02 ) [8] => array ( [x] => 2016-06-03 ) [9] => array ( [x] => 2016-06-07 ) [10] => array ( [x] => 2016-06-10 ) [11] => array ( [x] => 2016-06-17 ) [12] => array ( [x] => 2016-06-24 ) ) i'm trying count how many days duplicates , number in variable. example can see there 2 same dates: 2016-05-29 i've tried array_count_values() says can count strings , integers. that's correct because date variable. it's code: $eventdates = $object->get("date"); $result = $eventdates->format("y-m-d"); $data[] = array("x"=>$result); any idea of how c

postgresql - Django only serves index page, 404 on all others -

i have simple django app im trying throw on digital ocean. have configured nginx proxy port , serve static files. however, when click on link go page, 404s on me. serves index page correctly, else 404. if of back-end wizards have other do's/don't's i'm doing, feel free add in response. i'm new nginx please dumb down :) thanks. server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; # make site accessible http://localhost/ server_name localhost; location /static { alias /home/rchampin/ryan_the_developer_django/static; } location / { # first attempt serve request file, # directory, fall displaying 404. try_files $uri $uri/ =404; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $remote_addr; proxy_set_header host $host;

angularjs - accessing request header in angular -

i have setup via nginx config file traffic on port 8000 routed index.html page invokes angular code processes request. new angular don't know how request makes code does. code looks this, , control passed init = function() : module.exports = function($scope, $routeparams, $sce, $timeout, $http, config) { $scope.config = config; $scope.identifiers = []; var init = function(){ ... } in function want request headers. there way that? edit in attempt clarify: i know it's screwy, didn't write this, dropped in lap. when request sent on port 8000 angular code runs. know it's client side, that's happens. need check auth of initial request. if cannot in client can @ nginx level somehow?

c++ - STL Sort use of Static Function -

i trying make enemies in game sorted in vector in order of distance player , using sort function. obviously, enemies objects basic predicate isn't enough , have make own function, did. however, these functions have static, , so, how, in function, can compare distance between enemy , player? double world::getplayerdistance(entity* enemy){ int xdistance = enemy->m_xvalue - m_pplayer->m_xvalue; int ydistance = enemy->m_yvalue - m_pplayer->m_yvalue; double dist = sqrt(pow((double)xdistance, 2) + pow((double)ydistance, 2)); return dist; } this code i'm trying use, static function (defined static in header) doesn't have access member variables , following doesn't work: bool world::sortxdistance(entity *i, entity *j) { return (getplayerdistance(i) < getplayerdistance(j)); } (also defined static in header) use stl sorting vector. i have tried googling around, perhps don't recognise true problem, appreciated, or alternate way of doing cons

dictionary - Sorting maps Java -

i have hashmap of values, objects , keys, names of objects (names unique). objects contain lot of variables , sort map, using 1 of them. far there's no problem, thing values might same 2 or more objects, program overwrite them. in situation of 'collision' sort pairs has same key other key , on, until sort them in alphabetical order. i've tried create structure, it's not correct, cause it's sorting alphabetically no matter what. sortedmap<integer, sortedmap<integer, sortedmap<integer, sortedmap<string, someclass>>>> mymap; could please me bit? have figured out @ least close result? :) thanks! edit: sortedmap<string, abstracteventactivityclass> mapnameobject = new treemap<>(); sortedmap<integer, sortedmap<string, abstracteventactivityclass>> bydislikes = new treemap<>(collections.reverseorder()); sortedmap<integer, sortedmap<integer, sortedmap<string, abstracteventactivityclass>>>

Increment index of an array in PHP -

i want find element placed right after $input seems type of index not int , because of can not mathematical operations on . $index = array_search($input,$tmp); $index += 1 ; $hold = $tmp[$index]; echo $hold; don't on think it, use array_values() : $index = array_search($input, array_values($tmp)); $index += 1; $hold = array_values($tmp)[$index]; echo $hold; you want checking make sure key returned array_search() , check next index isset() . $vals = array_values($tmp); $index = array_search($input, $vals); if($index !== false && isset($vals[++$index])) { $hold = $vals[$index]; // has incremented ++$index echo $hold; }

Scala regex match failing with scala.MatchError for \w and \d (word or digit) match -

i trying basic regex pattern matching. although syntax seems correct, it's failing when use \w or \d word , digit matching. import scala.util.matching.regex object ex { def main(args:array[string]):unit = { val pattern = new regex("(\\w)\\s(\\d)"); val pattern(words,num) = "asas1 11" print(words+" "+num) } } this error get: exception in thread "main" scala.matcherror: asas1 11 (of class java.lang.string) @ com.cccu.semantic.ex$.main(ex.scala:8) @ com.cccu.semantic.ex.main(ex.scala) note: using scala ide build of eclipse sdk, build id 4.4.1 scala 2.11.8 on windows machine. \w , \d match single character, need add there + modifier. throwing exception because can't match input against regular expression. scala> val pattern = new regex("(\\w+)\\s(\\d+)"); val pattern(words,num) = "asas1 11" pattern: scala.util.matching.regex = (\w+)\s(\d+) words: string = asas1 n

xtify reactor onBeforeMessage is not working -

i using reactor http://getreactor.xtify.com/ on backbone application , trying build custom inbox box. use auto-run="false" config param. define function onbeforemessage reactor.onbeforemessage(function(message){ console.log('new message'); }); this function of times been called other not. first question why onbeforemessage triggered although specify auto-run="false" ? second question why onbeforemessage not triggered ? you'll need use: data-auto-run="false" instead of: auto-run="false" the 'data-' prefix the html5 way store metadata on html element. you can see js fiddle in-depth explanation of how implement custom inbox here: http://goo.gl/8ej9vm note function register reactor.onbeforemessage() accepts list of messages have been triggered rather single message. can see more documentation here: http://getreactor.xtify.com/documentation/notifications.php

c - Porting network auditing software to Windows -

i attempting port network auditing program called argus windows using gnulib. first time using gnulib, or porting software @ matter, , i've gotten stuck because source code argus not contain makefile.am gnulib seems need (the configure.ac available, though). possible continue without automake file? gnulib best option this? alternatives have? have little experience guidance on matter appreciated. thanks!

c# - Does async Task method never throw? -

it appears async method captures exceptions task method returns including thrown before first await ". in other words following code works intended , no exceptions thrown until line task.whenall : async task dosomethingasync(int i) { if (i == 2) throw new invalidoperationexception(); await task.delay(1000); } ... var tasks = new list<task>(); for(int = 0; < 3; ++i) { var t = dosomethingasync(i); // no awaits here tasks.add(t); } // wait tasks await task.whenall(tasks); // throws invalidoperation when other 2 tasks succeed the question: is behavior of async methods part of language spec or way implemented in current version of .net? can rely on behavior in code? is behavior of async methods part of language spec yes is. section 10.15.1 of c# 5 specification: if function body terminates result of uncaught exception (§8.9.5) exception recorded in return task put faulted state. section 10.15.2 gives de

php - When to use single quotes, double quotes, and backticks in MySQL -

i trying learn best way write queries. understand importance of being consistent. until now, have randomly used single quotes, double quotes, , backticks without real thought. example: $query = 'insert table (id, col1, col2) values (null, val1, val2)'; also, in above example, consider "table," "col[n]," , "val[n]" may variables. what standard this? do? i've been reading answers similar questions on here 20 minutes, seems there no definitive answer question. backticks used table , column identifiers, necessary when identifier mysql reserved keyword , or when identifier contains whitespace characters or characters beyond limited set (see below) recommended avoid using reserved keywords column or table identifiers when possible, avoiding quoting issue. single quotes should used string values in values() list. double quotes supported mysql string values well, single quotes more accepted other rdbms, habit use single quot

java - Cannot find web elements at "chrome://downloads/" page -

i using java , selenium write tests chrome. need chrome://downloads/ , click on clear all button. can page remotewebdriver driver = (remotewebdriver) driverchrome; driver.executescript("window.open();"); thread.sleep(500); tabs = new arraylist<string>(driverchrome.getwindowhandles()); driverchrome.switchto().window(tabs.get(1)); thread.sleep(500); driverchrome.get("chrome://downloads/"); but cannot click on button, whatever xpath use says no such element below here javascriptexecutor example perform click on clear all button using selenium :- javascriptexecutor executor = (javascriptexecutor)driver executor.executescript("var dm = document.getelementsbytagname('downloads-manager')[0];var toolbar = dm.shadowroot.getelementbyid('toolbar');var actions = toolbar.shadowroot.getelementbyid('actions');actions.getelementsbyclassname('clear-all')[0].click();"

jenkins - Artifact Version Search API Call in Groovy -

i'm trying integrate below's rest api call groovy , use jenkin's dynamic parameter list versions of artifact. please assist groovy script the artifactory version search rest api method can used list of available artifact versions groupid , artifactid in local, remote or virtual repositories. example: get /api/search/versions?g=org.acme&a=artifact&repos=libs-release-local { "results": [ { "version": "1.2", "integration": false },{ "version": "1.0-snapshot", "integration": true },{ "version": "1.0", "integration": false } ] }

r - How do I get the derivative of the function? -

how derivative of following function? g <- expression(x^2) derivg <- d(g, 'x') derivg # 2 * x g1 <- derivg(2) # error: not find function "derivg" i want find derivative @ x = 2. derivg call, not function. evaluate @ x = 2 , can do eval(derivg, list(x = 2)) [1] 4

python - "Sound of sorting" -

i writing small program in python 2.7.10 pygame. im using multithreading play sounds (with winsound) , still draw things fast. trying replicate similar idea of videos saw on youtube of sorting algorithms. unfortunately runs 10 seconds randomly crashes, sounds keep going pygame window goes not responding , drawing not change. if put print "hi" in code somewhere still printing in console pygame still have gone not responding. cant think of whats wrong may multithreading (im new it!) from random import randint import pygame,winsound,threading,time pygame.locals import * screen=pygame.display.set_mode([1000,500]) def bubblesort(listname): sorting=true while sorting: listchanged=false in range(len(listname)-1): draw(listname,1000/len(listname),500/11,i) if listname[i] < listname[i+1]: listname[i],listname[i+1]=listname[i+1],listname[i] threading.thread(target=playsound,args=([listname[i]])).

ruby - Is there a difference between @var = var_val and self.send("var=", var_val)? -

when initialize instance variables in initialize method, there difference between using @var = var_value , self.send("var=", var_value) ? mean, there reason prefer 1 way on other reason, if means style reason? class mysuperclass attr_accessor :columns, :options end class mysubclass < mysuperclass def initialize(columns, options) @columns = columns @options = options end end class myothersubclass < mysuperclass def initialize(columns, options) self.send("columns=", columns) self.send("options=", options) end end there difference. @var = x assigns instance variable. there no method call. there no virtual dispatch. there no (sane) way of intercepting assignment. send invokes method (or "sends message"). in context, :var= assessor "setter method" wraps instance variable assignment. it's method, invoked via virtual dispatch honoring inheritance, , - including being overridden in

spring integration - SpringIntegration Mail Failed to create new store connection Unrecognised SSL message -

i have strange exception happens since week in production environment, sporadically. worked fine until now. in code connecting using imap ms exchange server read emails. part of code still working ok. once email has been read archived in subfolder. this part sending exception. the exception "failed create new store connection". and after message have following exception in traces: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection? @ org.springframework.integration.mail.mailreceivingmessagesource.receive(mailreceivingmessagesource.java:117) @ org.springframework.integration.endpoint.sourcepollingchanneladapter.receivemessage(sourcepollingchanneladapter.java:144) @ org.springframework.integration.endpoint.abstractpollingendpoint.dopoll(abstractpollingendpoint.java:192) @ org.springframework.integration.endpoint.abstractpollingendpoint.access$000(abstractpollingendpoint.java:55) @ org.springframework.integration.endpoint

Admob invalid click activity -

if person don´t know, lives far away me, clicks on ads day long, can admob account suspended? scenario counts invalid click activity? yes account can disabled due invalid click activity, if accidental clicks place ads somewhere user wont click them accident if doing on purpose should implement technique avoid click abuse adding addlistener adview , catching clicks of adview can remove adview 1 hour example if clicked more 3x in period etc, depends on needs. more info can check out google's documentation on ad click abuse , how prevent : admob click abuse

javascript - Glossary with floating alphabet in HTML -

Image
top of pic , bottom of pic i learning html , need create glossary above. requirements are: - alphabet must appear on top. - when click on letter, letter must not underlined more, , when click on letter, recent clicked letter underlined again, new clicked letter not underlined more. i planning split windows 2 divs: - divright picture - divleft consists of 2 smaller div: lefttop alphabet, leftbottom content still dont satisfy requirements: alphabet part shifted , tried lot of methods mentioned in stackoverflow remove underline after clicking still not work. please give me hint or better code! many thanks! :) this code: .divright { position:fixed; margin: 0px; float: right; width: 200px; height: 100%; top: 0em; right: 0em; border: 1px solid green; } .divleft { margin-right: 200px; overflow: hidden; border: 1px solid blue; } .leftop {

tcp - How can I specify the port range for OpenMPI to use? -

i'm using open mpi 1.6.5 run openfoam in parallel on 3 nodes. i'm allowed open few tcp ports security reasons. opened ports 49990-50009 open mpi , set values in openmpi-mca-params.conf follows: btl_tcp_port_min_v4=49990 btl_tcp_port_range_v4=10 oob_tcp_static_ports=50000-50009 when ran mpirun, got message: mca_oob_tcp_init: unable create ipv4 listen socket: unable open tcp socket out-of-band communications. did miss something? how can set mpi run range of ports? the value of oob_tcp_static_ports should comma-separated list of specific ports used, not range of ports. set port range tcp oob, assign oob_tcp_dynamic_ports instead. note port numbers (also tcp btl) affect listening sockets, i.e. incoming connections. connection initiator side uses whatever port number os binds socket to. reference - the open mpi user's mailing list .

html - CSS - Triangle down -

this question has answer here: create down arrow pointer 3 answers how create arrow down (triangle) when hovering on link? something result tab on codepen, see here i trying create triangle following the tutorial above, no luck a{ background: red; float: left; width: 30%; padding: 5px; display block } a:hover {background: green;} i'm not sure mean, answer: css: .arrow_down_on_hover{ position: relative; } .arrow_down_on_hover:before{ content: ""; width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; display: none; border-top: 20px solid #f00; position: absolute; right: 50%; margin-right: -10px; bottom: -20px; } .arrow_down_on_hover:hover:before{ display: block; } html: <a class="arrow_down_on_hover" href="#!">hove

javascript - Make a meteor publication reactive to time -

i'm having little trouble figuring out how make subscription reactive publication query. my publication follows: meteor.publish('alldata', function(){ return data.find({ttl: {$gt: new date()}}) }) as can see, documents contain ttl field. long time live still greater current time, can sent client, if not, shouldn't. the subscription: this.autorun(() => { this.subscribe('alldata') }) on initial load, data fine, whenever ttl expires, document remains on client unless reload page. there anyway handle reactively, making expired documents disappear client? a combination of reactivevar , autorun did trick me. it's possible overkill, works. let cutofftimestamp = new reactivevar(); meteor.setinterval(function() { cutofftimestamp.set(date.now() - 1); }, 60000); meteor.publish("mypub", function() { this.autorun(function() { return mycollection.find({ timestamp: { $gte: cutofftimestamp.get(); } }); })

php - SELECT * FROM table | Only getting the first row out of all -

solved: use fetchall instead of fetch i have simple sql query works in phpmyadmin, in php first row returned. table has lot of rows, since it's cities of world table (around 44.000 rows). function getallcities(){ include 'db.php'; $response = json_decode('{"status":"error"}'); if(isset($_session['user'])) { $query = $conn->prepare("select * cities_countries"); $query->execute(); $result = $query->fetch(pdo::fetch_assoc); $response->status = "success"; $response->cities = $result; } echo json_encode($response); } this gets returned: { status: "success", cities: { id: "1", name: "bombuflat, india" } } as mentioned above, if run query in phpmyadmin, results. what doing wrong? if want output results should use fetchall method

ios - Update function for SingleViewApplication -

i have used spritekit create mobile applications. want start using singleviewapplication . know in spritekit , there built in update function updates every frame. wondering if there can use singleviewapplications . here how update function looks in spritekit : override func update(currenttime: cftimeinterval) { } i thinking can add nstimer update as update function does, thinking may add lag app. also, when add code in viewcontroller , gives me error saying this method not override methods form superclass . thanks in advance!

java - Spring secuirty don't let me get access to my protected static files -

i'm trying protect static html pages, since i'm using angularjs , html partials pages can accessed users have role. so tried creating folder inside web-inf folder called private , put html files there , put in spring security configuration file path of these files annotation hasanyauthority this .antmatchers("/privatepartials/protectedpartial.html").hasanyauthority("rolea") also tried hasrole annotation this .antmatchers("/privatepartials/protectedpartial.html").access("hasrole('rolea')") but 403 error, if user doesn't have "rolea" have since print in console roles user have when logins. i tried create folder inside resources folder doesn't work since user can view protected page doesn't matter role user have. think because have method in security configuration class lets users access resources. @override public void configure(websecurity web) throws exception { web.ignoring().antmatcher