Posts

Showing posts from June, 2013

android - Native crash at /dev/ashmem/dalvik-jit-code-cache -

i'm getting crashes numerous devices native crash android game, geoguess ( https://play.google.com/store/apps/details?id=uk.co.quinny898.game.geoguess ) it's java, don't see why crash happening. crash on 34 unique devices (and counting) , causing problems users (it appears on launch) the stack trace follows: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** build fingerprint: 'samsung/serranoltexx/serranolte:4.4.2/kot49h/i9195xxucnh5:user/release-keys' revision: '5' pid: 23657, tid: 23704, name: asynctask #1 >>> uk.co.quinny898.game.geoguess <<< signal 16 (sigstkflt), code -6 (si_tkill), fault addr -------- r0 42049ee8 r1 00000000 r2 663c69c3 r3 00000000 r4 622a880e r5 64489e8c r6 6447ca98 r7 000020f4 r8 417bbf80 r9 622a8806 sl 00000000 fp 42b5f278 ip 65c49fec sp 64861c40 lr 00000000 pc 663c69d8 cpsr 600d0030 d0 0000000000000000 d1 0000000000000000 d2 0000000000000000 d3 0000000000000000 d4 00000000000

c# - Check if all database entries are linked in pairs -

i have database table of accounts. each account has (amongst other fields) id , linkedid . the linkedid used store id of account linked. i want check accounts table pick out invalidly linked accounts. an account invalid if: its linkedid zero; its linkedid equals own id (i.e. it's linked itself); its linkedid not id of account in accounts table; its linkedid id of account, account's linkedid not id of first account (so if #3 links #564, #564 should link #3). how go doing without dragging in accounts database? i using c#, asp.net mvc , entity frameworks. this got to: list<account> accounts = db.accounts .where(x => x.linkedid == 0 || x.linkedid == x.id || ????????) .tolist() use simple linq statement: var accountswithinvalidlinks = in db.accounts let linkedaccount = db.accounts.firstordefault(a2 => a2.id == a.linkedid) a.linkedid == 0 || a.linkedid == a.id || linkedaccount == null |

php - Login [ Auth->identify() ] always false on CakePHP 3 -

i started using cakephp 3 after time using cakephp 2 , having troubles create authentication login. the new auth function $this->auth->identify() return false. on database, password encrypted perfect , query takes user it's ok too. my code: appcontroller: [...] class appcontroller extends controller{ public function initialize(){ $this->loadcomponent('flash'); $this->loadcomponent('auth', [ 'loginredirect' => [ 'controller' => 'admin', 'action' => 'index' ], 'logoutredirect' => [ 'controller' => 'pages', 'action' => 'display' ] ]); } public function beforefilter(event $event) { $this->auth->allow(['display']); } } usercontroller: [...] class userscontroller extend

database - How do I search for a specific file type using PHP's glob function? -

so, attempt @ searching .wav sound file in database using php , glob not working. i have saved 4 sound files directory specified, when try glob, nothing back. attempt 1: $files = array(); foreach (glob($authorurl.'/'.$titleurl."*.wav") $file) { $files[] = $file; echo $file; } attempt 2: $dir1 = $authorurl.'/'.$titleurl.'/'.$wordsurl; $dir = glob("$dir1/*.{wav}"); $files = scandir($dir); if(!empty($files)) { foreach ($files $file) print " <div class='fileicon'> <audio controls='controls'> <source src='".$dir.$file."' /> </audio> <button class='button' disabled>reply</button> </a> </div>"; } else { echo "there no annotations book"; } any appreciated! i'm not sure

html - How to force a flex box to display 4 items per row? -

i'm using flex box display 8 items dynamically resize page. how force split items 2 rows? (4 per row)? here relevant snip: (or if prefer jsfiddle - http://jsfiddle.net/vivmaha/oq6prk1p/2/ ) .parent-wrapper { height: 100%; width: 100%; border: 1px solid black; } .parent { display: flex; font-size: 0; flex-wrap: wrap; margin: -10px 0 0 -10px; } .child { display: inline-block; background: blue; margin: 10px 0 0 10px; flex-grow: 1; height: 100px; } <body> <div class="parent-wrapper"> <div class="parent"> <div class="child"></div> <div class="child"></div> <div class="child"></div> <div class="child"></div> <div class="child"></div> <div class="child"></div> <div class="child"></div>

How to sum all range output in python 3 -

this simple question want sum range output code flow for b in range (1, 11): ui = (b**b) print (ui) the output 1 ------------------ 4 ------------------ 27 ------------------ 256 ------------------ 3125 ------------------ 46656 ------------------ 823543 ------------------ 16777216 ------------------ 387420489 ------------------ 10000000000 ------------------ but want sum of these answer. please me. you can use generator expression within sum function >>> sum(i**i in range(1,11)) 10405071317

Excel If formula not evaluating correctly? -

i have if formula evaluating 2 cells data returned other formulas. =if(b5>d5,d5,b5) seems simple enough, right? however, when attempt use it, seems evaluating formulas in cells instead of evaluating values being returned. i.e.: if b5 returns 414 , d5 returns 416, 416 instead of 414. what missing here? in testing, formula worked me. trying display lower number of cells? if so, try this =min(b5,d5)

c# - How to select all textbox text and textbox opacity in WP application -

i use textbox address bar wp browser application. want select text when user selects textbox , modify opacity. i tried using gotfocus method that. see whole text selected 1 second or , deselected. need modify opacity once focus on textbox , when textbox loses focus. using gotfocus method can modify opacity when focus lost, when set again opacity percent nothing happens. can give me hint regarding events determine text selected short period of time , opacity problem? private void urltextbox_gotfocus(object sender, routedeventargs e) { urltextbox.opacity = 50; urltextbox.selectall(); } private void urltextbox_lostfocus(object sender, routedeventargs e) { urltextbox.opacity = 10; } you can try subscribing 1 of tunnelling events ( previewgotkeyboardfocus , previewlostkeyboardfocus ) instead of gotfocus event.

javascript - Save file to folder -

i using jspdf generate pdf file. when use save function, saves / download file 'download' folder. instead of that, save file specific folder automatically through javascript assuming you're talking doing in browser, can't this. user chooses file saved. if browser saving downloads folder without asking should downloaded to, that's because that's default setting browser. if you're using javascript in offline capacity, local script, answer different. won't know unless provide of code.

ios - objective-c clear NSURLCredential - NSURLCredentialPersistenceForSession -

i using nsurlcredentials in method: -(void)userlogin:(nsstring *)user andpasswordexists:(nsstring *)password completionhandler:(void (^)(nsarray *resultsobject, nserror *error))completionhandler { nsurl *url = [nsurl urlwithstring:kip]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; nsurlcredential *credential = [nsurlcredential credentialwithuser:user password:password persistence:nsurlcredentialpersistenceforsession]; [operation setcredential:credential]; [[nsoperationqueue mainqueue] addoperation:operation]; [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) { if (completionhandler) { completionhandler(responseobject, nil);

xml - Assigning variable values programmatically during html parsing -

i expanding previous question html parsing include question blank values. suppose have empty values variables pulling html. there multiple variables empty, want systematic approach handling them (loop or function). this question assigning variables programmatically, , of information have found suggests avoiding use of eval(parse(text , i'm not sure how replace in case. have following html: html <- '<!doctype html> <html> <body> <div class="foo"> <div class="fooname">name of 1st foo</div> <div class="abc">abc value present here</div> <span>1st span in 1st foo</span> <span>2nd span in 1st foo</span> </div> <div class="foo"> <div class="fooname">name of 2nd foo</div> <span>only 1 span in 2nd foo</span> <

mysql - Rails: does minitest use schema.rb to recreate the test schema? -

i trying bring legacy rails system more current standards having problems getting test database reflect state of schema.rb plus changes made via migrations. tl;dr running rake minitest:all invoke same code rake db:schema:load ? environment rails 3.2.20 ruby 1.9.3 minitest gem 4.6.2 minitest-rails 0.5.2 mysql 5.1 local os x, test , production linux original system state the system set people not software engineers, didn't know rails, etc. several mysql-specific types added (e.g. unsigned int ) not supported using rails' migrations , schema.rb . system used structure.sql , sloppy how kept updated, checked in git, , on. further, @ point later, decided replace of usual numeric, auto-incrementing primary key id fields varchar containing self-generated guid. field name still id new datatype. but of hundreds of tests (they did write lot of tests) had been written reference fixture instances based on ids, not fixture names , there dependencies bet

javascript - CKEditor - Using GetData() -

i struggling implementing following: i have button creates cke instance (outside form): <button type="submit" class="btn btn-default btn-sm" onclick="javascript: var editor81 = ckeditor.replace('divtext81')" value="edit">edit</button> i have save button (outside form): <button type="submit" class="btn btn-default btn-sm" id="save81" value="save">save</button> i use following javascript post mysql database: $(document).ready(function (argument) { $('.btn').click(function () { id = $(this).attr('id').replace('save',''); $edit = ckeditor.instances.editor81.getdata(); $cid = $('#cid' + id).val(); $action = $('#action' + id).val(); $eid = $('#eid' + id).val(); $.ajax({ url: 'include/editupdate.

javascript - Best way to pass props for react component -

in react js can pass component props in 2 ways: <component prop1={value} prop2="value" prop3={this.othervalue} /> or let props = { prop1: value, prop2: "value", prop3: this.othervalue } <component {...props} /> what variant better? which prefer? neither "right", though think you're more see first variant, since seems bit clearer pass props explicitly. spread params variant used avoid duplication - if specify props on parent want pass them child, spelling them out explicitly on child feels bit laborious.

perl - Mojolicious, redirects, session and trying to create an authentication system -

i'm trying away basic auth in mojolicious application. able detect absence of session key , redirect login page. login page posts application , authenticate end process. end process returning success , mojo app sets session thus: $self->session( user => $name, groups => $groups ); in debugging this, $name , $group both defined , valid. wish redirect "protected" space of app. redirect lands in right place fails detect $self->session('user') (is undef when debugging) end redirecting login repeatedly. i'll include snippets of setup below. missing? myapp.pm my $r = $self->routes; $r->route('/verify')->via('post')->to('util-auth#verify')->name('verify'); $r->route('/login')->via('get')->to('util-auth#login')->name('login'); $app = $r->under('/myapp')->to('util-auth#check'); $app->route('/foo')->via('get

c++ - How to add any reusable interface for an ActiveX control using MFC? -

i have activex control container accepts predefined set of interfaces (properties). need design quite few mfc activex controls expose properties, initial attempt create interface class contains required properties pure virtual members , activex control inherit interface class. activex control have interfaces inherited, how can expose them container? if use class wizard add properties, know can expose them. whole point avoid adding them 1 one each activex control. if don't use class wizard, mean have manually modify begin_dispatch_map() & end_dispatch_map() section , corresponding .odl file, don't think thing do. so question is, using mfc, how can inherit abstract class (interface class) implement predefined properties (interfaces) activex control , expose them user? example: base class has property defined as: long newproperty. , activex control b inherit a, b has newproperty. question how expose newproperty in b? how can have , set functions new property using clas

javascript - Building a (non-bootstrap) WP site and want to include a bootstrap plugin -

i want use bootstrap scrollspy in wordpress site, theme i'm working not use bootstrap foundation. possible? thanks in advance! you can implement downloading bootstrap library via plugin. try installing this: https://wordpress.org/plugins/wordpress-bootstrap-css/ the author says scrollspy included: https://wordpress.org/support/topic/scrollspy

c++ - Is it possible on windows to prevent other applications hooking in system DLLs -

Image
i desperately looking cause of crashes in qt-based application. after observation i've detected, alone opening qfiledialog, standard windows file dialog, without selecting file, causes application crash after minutes. doesn't happen on machines. i've opened application in dependency walker , profiling revealed, opening of file dialog loads tons of dlls, don't need in application - tools hooked in windows shell. among others - tortoisesvn, makes depends freeze. is possible in application context prevent other dlls codecs or shell-hooks loaded? is @ least possible create qfiledialog without loading tool hooked in windows? this possible, it's not trivial. have insert api hook on loadlibrary (and/or native api equivalent.) when hook called, can examine dll filename , decide whether want pass along real loadlibrary or return error. a couple places find more info on api hooks: a tutorial on codeproject microsoft detours microsoft's li

ruby on rails - Multiple Conditional Classes in HAML -

using ruby , haml, there shorter way represent logic: %tr{class: "#{'success' if admin.approved?} #{'warning' unless admin.approved?}"} thanks! you can simplify logic using ternary statement (one line if/else): %tr{class: admin.approved? ? 'success' : 'warning'} or move logic helper. example, create helper method in application_helper.rb : def admin_row_class(admin) admin.approved? ? 'success' : 'warning' end then use helper in view: %tr{class: admin_row_class(admin)}

Python String Formatting, difference in code -

hi trying understand how string formatting works float: i have tried >>> print("%s %s %s %s %-9.10f"%("this","is","monday","morning",56.3648)) it gives output of this monday morning 56.3648000000 however this, >>> print("%s %s %s %s %10f"%("this","is","monday","morning",56.3648)) gives output of this monday morning 56.364800 what causing difference? the way pattern strings parsed . %9.10f sets (minimum) field width 9 , precision 10, while %10f sets width 10. think meant write %.10f instead: in [4]: '%10f' % 56.3648 # width out[4]: ' 56.364800' in [5]: '%.10f' % 56.3648 # precision out[5]: '56.3648000000' also, consider using the newer str.format formatting style . first example turn into in [6]: '{} {} {} {} {:<9.10f}'.format('this', 'is', 'monday', 'mornin

haskell - Parsec how to find "matches" within a string -

how can use parsec parse matched input in string , discard rest? example: have simple number parser, , can find numbers if know separates them: num :: parser int num = read <$> many digit parse (num `sepby` space) "" "111 4 22" but if don't know between numbers? "i live 111 years <b>old</b> if work out 4 days week starting @ 22." many anychar doesn't work separator, because consumes everything. so how can things match arbitrary parser surrounded things want ignore? edit : note in real problem, parser more complicated: optiontag :: parser fragment optiontag = string "<option" manytill anychar (string "value=") n <- many1 digit manytill anychar (char '>') chapterprefix text <- many1 (noneof "<>") return $ option (read n) text chapterprefix = many digit >> char '.' >> many space for arbitrary

Estimating latency of Windows events programmed in C# with .NET -

i have working c# application using .net framework , tasked estimating data latency program input (usb serial port) program output (udp socket). program makes use of windows event handlers receiving input , thread coordination within application. wondering if can recommend how estimate time until event handler raised/executed. need estimation method or reference, not exact number. aware windows not real-time os have variance, perhaps dependent upon current load. thanks michael

How to persist data in a PHP application -

why might static variable i've initialized in class become unset? here class( 'static' ): class events { // static events collection private static $events = null; // private(unused) constructor private function __construct() {} // initializes class public static function initialize($events){ self::$events = $events; } // returns event collection public static function get(){ return self::$events; } } i set $events this: functions.php: include_once "events.php"; // function initialize application function init(){ // retrieve events database $events = get_events_from_server(); // initialize events class events::initialize($events); } init() called index.php. variable seems unset after index.php has loaded. post javascript server page: get_events.php request list of json encoded events. @ get_events.php static events variable null. here get_events.php: <?php in

java - Need to retain values of checkings and savings variables through methods -

i'm having hard time keeping values of checkings , savings , being able display checkings , savings current balance. package atmmethod; import java.util.locale; import java.util.scanner; /** * * @author jfumar */ public class atmmethod { private static int option; /** * @param args command line arguments */ public static void main(string[] args) { //prompts user options in simulation using methods { system.out.println("welcome new , improved atm program methods!"); displaymainmenu(); double savings = 1000; double checkings = 500; system.out.println("savings balance is: " + savings); system.out.println("checking balance is:" + checkings); scanner input = new scanner(system.in); system.out.print("enter option here: "); int option = input.nextint(); switch (option) { case 1: depositoption(); break;

spring - Entity listeners at repository level - how to also affect cascated entities -

i've added listener layer project overriding simplejparepository , looks this: @override @transactional public <s extends e> s save(s entity) { if (entityinformation.isnew(entity)) { persister.beforecreatelistenersfor(entity.getclass()).execute(entity); entitymanager.persist(entity); persister.aftercreatelistenersfor(entity.getclass()).execute(entity); return entity; } else { s merged; persister.beforeupdatelistenersfor(entity.getclass()).execute(entity); merged = entitymanager.merge(entity); persister.afterupdatelistenersfor(entity.getclass()).execute(entity); return merged; } } @override public void delete(e entity) { assert.notnull(entity, "entity must not null."); if (entity instanceof logicremovable) { ((logicremovable) entity).setlogicremoved(true); save(entity); } else { persister.beforedeletelistenersfor(entity.getclass()).execute(en

excel - Range.Find fails on ranges that are both hidden AND part of a filter -

i'm experiencing peculiar problem in excel 2003 range.find method fails when searching value in cell both hidden , part of filtered range. to clear, method call in question: cells.find(searchstring, lookin:=xlformulas, lookat:=xlwhole) if cell containing searchstring merely hidden, range.find works. if cell containing searchstring merely part of filtered range (but not hidden), range.find works. if cell containing searchstring both hidden (by filter or otherwise), , part of filtered range, range.find fails. many sources on various excel sites , forums claim specifying "lookin:=xlformulas" force range.find search within hidden cells. though nonsensical, seems true if searchstring in cell merely hidden. if cell both hidden , part of filtered range, fails. note doesn't matter if cell being hidden by filter . example, can search heading of filtered range (which never hidden filter itself), if heading happens in column you've hidden, range.find fai

javascript - Highcharts doesn't display bars properly -

my highchart doesn't display bars scattered if have different values. what's going wrong? my json data: [ { "name":"finwts_main -1", "st_date":"04/9/2015", "ed_date":"04/9/2015", "st_time_am_pm":" am", "ed_time_am_pm":" am", "intervals":[ { "from":1431160907000, "to":1431160955000, "label":"completed", "color":"#63ca00" } ] }, { "name":"finwts_main -2", "st_date":"04/9/2015", "ed_date":"04/9/2015", "st_time_am_pm":" am", "ed_time_am_pm":" am", "intervals":[ {

python - Getting MAC Address -

i need cross platform method of determining mac address of computer @ run time. windows 'wmi' module can used , method under linux find run ifconfig , run regex across output. don't using package works on 1 os, , parsing output of program doesn't seem elegant not mention error prone. does know cross platform method (windows , linux) method mac address? if not, know more elegant methods listed above? python 2.5 includes uuid implementation (in @ least 1 version) needs mac address. can import mac finding function own code easily: from uuid import getnode get_mac mac = get_mac() the return value mac address 48 bit integer.

swift - Is it best practice to explicitly declare variable types on declaration? -

i new swift language, trying develop healthy programming habits while coding. is best practice explicitly declare variable types on declaration? example: var str:string = "likethis" or acceptable: var str= "likethis" as know, either option acceptable. however, standard practice have seen not declare variable types unless necessary, rationale these extraneous tokens reduce readability. here, unnecessary because compiler infer variable type. ray wenderlich's swift style guide agrees.

javascript - Performance issue while evaluating email address with a regular expression -

i using below regular expression validate email address. /^\w+([\.-]?\w+)*@\w+([\.-]?w+)*(\.\w{2,3})+$/ javascript code: var email = 'myname@company.com' var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?w+)*(\.\w{2,3})+$/ if(pattern.test(email)){ return true; } above regular expression evaluates email address when provide below invalid email address.(i have added #$ in middle of name) aseflj#$kajsdfklasjdfklasjdfklasdfjklasdjfaklsdfjaklsdjfaklsfaksdjfkasdasdklfjaskldfjjdkfaklsdfjlak@company.com but when try evaluate below email address takes , browser gets hanged. (i have given com1 in end) asefljkajsdfklasjdfklasjdfklasdfjklasdjfaklsdfjaklsdjfaklsfaksdjfkasdasdklfjaskldfjjdkfaklsdfjlak@company.com1 i sure regular expression correct not sure why taking time evaluate second example. if provide email address shorter length evaluates quickly. see below example dfjjdkfaklsdfjlak@company.com1 kindly me fix performance issue. your regex runs catastrophic b

ios - 64-bit CFCalendarComposeAbsoluteTime generated unexpected value -

i used below codes generate absolute time in 64-bit app: cftimezoneref cftz = cftimezonecopydefault(); cfcalendarref cfgd = cfcalendarcreatewithidentifier(kcfallocatordefault, kcfgregoriancalendar); cfcalendarsettimezone(cfgd, cftz); cfabsolutetime @ = 0.0; cfcalendarcomposeabsolutetime(cfgd, &at, "ymdhms", year, month, day, hour, minute, second); where year, month, day, hour, minute , second were: 2005, 4, 18, 12, 0, 0.0 but generated absolute time not expected. turned 2005-04-19 13:17:27 pdt. and go far wrong if added more control, example, locale. any 1 suffered same issue before? or know api?

ios - Does app run just a little bit slower when testing on device from xcode? (made in unity) -

i made app in unity , used unity remote test , make it. problem when pressed play , tested in unity gameobjects transform.translate moved speed when rendered out apk , tested on andriod phone of sudden same objects moved @ double speed. calibrated difficulty of game following speed on phone thinking thats end gameplay like. i fine until tried uploading app ios. in xcode when press play , try test on iphone app automatically installs on phone , starts playing. (i not sure how system works). same gameobjects move @ speed shown in unity editor. i not sure speed true speed. andriod apps gonna move @ speed moved on andriod phone while tested , ios ones run @ speed ran @ did through xcode? or xcode being weird , actual game run same speed on andriod phone when publish apk , test on andriod phone.

ios - App reads my Apple ID -

i interested know, can app read apple id? here issue: have outsourced app company. app social networking app: create profile , insert few profile details: name, age, gender. not relay on phone numbers whats app, email addresses or facebook profiles. the app live in app store , have ipad , iphone registered on same apple id. have downloaded app on phone , created profile. have downloaded on ipad , seeing same profile created on phone. i've have tried other apps use similar logic, no phone numbers, emails or fb profiles (whisper app being 1 of them) , can create 2 different profiles 1 on phone , other on ipad. wondering if problem surfaces because there in code makes app read apple id. i appreciate help apple doesn't provide api allowing application read information user's apple id. helps protect identity of user, don't want any third-party app reading information apple id.

c# - How to show "An app on your PC needs the following Windows feature." dialog programmatically? -

when try run .net 3.5 applications on windows 8.1 has not .net 3.5 framework, windows show "an app on pc needs following windows feature. .net framework 3.5 (includes .net 2.0 , .net 3.0)" dialog automatically. but want show dialog programmatically. think dialog more friendly dism command. any appreciated. the dialogue searching provided tool called fondue (features on demand user experience tool). request .net 3.5 need invoke this: fondue.exe /enable-feature:netfx3 available features can listed using dism: dism.exe /online /get-features you can find additional details on fondue invocation using fondue.exe /? or on technet .

variable assignment - Python printing none -

so have assignment completed there's 1 last step print says none. here's code #copy definition of function print_chars below def print_chars(multiples, char): print_chars= multiples* char print (print_chars) #copy definition of function sum_arithmetic_seq below def sum_arithmetic_seq(n): return n* (n+1)//2 #copy definition of function factorial below import math def factorial(n): return math.factorial(n) #here's program n in range(1,7,1): print(n) print('sum:', print_chars(sum_arithmetic_seq(n) ,'*')) print('factorial:', print_chars(factorial(n),'#')) the output end (i'm going put part of because it's long.) 1 * sum: none # factorial: none how it's supposed be: 1 sum: * factorial: # print_chars doesn't return anything. make return printing can use it's output. in last print, can't utilize value because there nothing there. change print return fix it.

python - Legend overriding x-label and x-ticks -

Image
i have following figure produced plotting multiple subplots pandas dataframe: you'll notice 2 subplots on left not have x-ticks or x-labels. here code use plot figure: plt.suptitle(suptitle,fontsize=fs+6) ax1 = fig.add_subplot(gs[0:8,0]) title = 'e1 on object a' plt.title('bias vs separation ' + title,fontsize=fs) plt.ylim([(min_mean - 2*min_s_mean)*min_offset,(max_mean + max_s_mean)*max_offset]) plt.xlabel('separation (arcsec)',fontsize=fs) plt.ylabel('residual',fontsize=fs) f_m_e1_a = format_df(means_e1_a,x_min,x_max,means_e1_a.index) f_s_m_e1_a = format_df(s_means_e1_a,x_min,x_max,s_means_e1_a.index) plt.legend(loc=0,prop={'size':leg_fs}) ax1p = f_m_e1_a.t.plot(ax=ax1,style=['k--o','b--o','g--o'],yerr=f_s_m_e1_a.t) ax2 = fig.add_subplot(gs[11:19,0]) title = 'e1 on object b' plt.title('bias vs separation ' + title,fontsize=fs) plt.ylim([(min_mean - 2*min_s_mean)*min_offset,(max_mean + ma

c++ - How do you fix a program from freezing when you move the window in SDL2? -

i'm making small game friend , 1 problem when drag window around, freezes , program stops until let go. searched simple solution found out happens everything. also, screws delta time since acts long frame. there way either have program continue running while move or if that's complicated, fix delta time? thanks? your application "freezing" because has winmain loop similar this: while (true) { if(peekmessage(&msg,null,0,0,pm_remove)) { translatemessage(&msg); dispatchmessage(&msg); } else { tickgame(); } } so instead of ticking processing wm_move message . 1 simple work around call games tick function within move message, or perhaps makes sense pause game when first move message , unpause if haven't gotten 1 second or two. is, people going dragging window while playing, unlikely. to answer second question, typically games (physics engines especially) use fixed time step stabilize simu

ios - RestKit does not recognize path pattern with params -

i have path pattern api/v1.2/user/:userid/friends for list friends given userid it simple query, register responsedescriptors key path, , call api method like [self.api getobjectsatpath:@"api/v1.2/user/:userid/friends" parameters:@{ @"userid" : @1 } success:^(rkobjectrequestoperation *operation, rkmappingresult *result) { nslog(@"friends"); } failure:^(rkobjectrequestoperation *operation, nserror *error) { nslog(@"error"); }]; i got error , full url path http://localhost/api/v1.2/user/:userid/friends?userid=1 restkit not replace path param. but use retrofit in android programming, , there it's do @get("/group/{id}/users") list<user> grouplist(@path("id") int groupid); how restkit replace path params? you can't compare different libraries different platforms... to inject parameters need use rkroute set request. route deals creating path , injecting parameters calling getob

c - Trying to return char array via pointer and it's giving incorrect results -

my code is: #include <stdio.h> #include <string.h> char *getuserinput() { char command[65]; //ask user valid input printf("please enter command:\n"); fgets(command, 65, stdin); //remove newline command[strcspn(command, "\n")] = 0; return command; } int main() { char *reccommand = getuserinput(); printf("%s", reccommand); return 0; } when code executed, console: please enter command: test <-- command entered *weird unknown characters returned console* why there weird unknown characters being returned console instead of "test"? it because returning value of local variable. try putting this: char *getuserinput() { static char command[65]; //ask user valid input printf("please enter command:\n"); fgets(command, 65, stdin); //remove newline command[strcspn(command, "\n")] = 0; return command; }

asp.net - Post data must be key value pair? If not how to read raw data in .Net -

i don't think have in pairs, if send plain text below: httpclient httpclient = new httpclient(); httpclient.postasync("http://hey.com", new stringcontent("simple string, no key value pair.")); then formcollection below doesn't seem offer way read that.. public actionresult index(formcollection collection){ //how string sent collection? } the formcollection object key value pair collection. if sending simple string on collection empty unless formatted key\value pair. this can done in multiple ways. option 1: send key value pairs, formcollection read string key mystring : httpclient httpclient = new httpclient(); var content = new formurlencodedcontent(new[] { new keyvaluepair<string, string>("mystring", "my string value") }); httpclient.postasync("http://myurl.com", content); option 2: read contents directly request. reads raw request.inputstream streamreader string public acti

android intent - Cannot go to the next activity -

i creating application input height , weight, compute bmi click next button go class , display bmi result on fragment within class.i want know why stops after clicking button. here code: package com.example.hcon; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; public class firstactivity extends activity { button button1; edittext et_name; edittext et_height; edittext et_weight; double ht = 0; double wt = 0; textview bmiout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_first); et_name = (edittext) findviewbyid(r.id.et_name); button1 = (button) findviewbyid(r.id.but