Posts

Showing posts from July, 2015

c++ - Checking for collision -

i'm coding game our final project in our major using allegro issues collision. game battleships , did after loading screen, screen appear wherein can select coordinates of ships using arrow keys , lock space bar. , if coordinates chose occupied space bar doesn't work. my problem can't check ships' length , width collision before placing. ships length , width considered when you've placed ship , next ship can overlap other ships. i've tried issues. , not part of grid cannot chosen though it's empty. void shipplacement(){ //something cursor ship placement shipx = 0; shipy = 0; while(!placed) { allegro_event ev; al_wait_for_event(prepqueue, &ev); if(ev.type == allegro_event_key_down) { switch(ev.keyboard.keycode) { case allegro_key_up: key[key_up] = true; break; case allegro_key_down: key[key_down] = true; break; case allegro_key_left: key[key_left] = ...

Constructing do while loop to handle account numbers not working C++ -

i'm trying use while loop evaluate account numbers. valid account number has have 5 digits , start letters r or b, not case sensitive. valid account number examples: r90000 b10101 r88888 b77777 invalid account number examples: y90000 r888822 this loop i've made, , can't figure out what's wrong parameters that's causing repeat on , on again, never excepting account number. char accounttype; int accountnum; cout << "please enter account number." <<endl; cout << ">> "; cin >> accounttype >> accountnum; cout <<endl; { cout << "that not valid account number. please enter account number." <<endl; cout << ">> "; cin >> accounttype >> accountnum; cout <<endl; }while ( (accountnum <= 9999) || (accountnum >= 100000) && (accounttype != 'r') || (accounttype != 'r') || (accounttype != 'b')...

c# - How to create crystal report for an invoice which has many items -

Image
i want make crystal report invoice have many items shown below: but, problem if invoice have many items, invoice number repeating item. when create report in access same database report show image above. please me this. i working on visualstudio c#

android - activity.finish() is not stopped current activity -

i have created android apps using async task call web service, when authentication fail, user stop current activity , redirect login page. my problem when user redirect login page, toast text still showing, toast text under async thread onpostexceute() event. any solution problem? in webservice.cs catch (unauthorizedexception ua) { log.d(tag, ua.getmessage()); intent intent = new intent(activity, loginactivity.class); if(condition a){ intent.putextra("toast_text", r.string.a); }else{ intent.putextra("toast_text", r.string.b); } activity.finish(); activity.startactivity(intent); } return null; then in asynctask.cs protected jsonarray doinbackground(string... parameters) { connectivitymanager cm = (connectivitymanager) singleformactivity.this.getsystemservice(context.connectivity_service); networkinfo activenetwork = cm.getactivenetwork...

jquery - Change Css Class of Same Id which is more than one Id with same name in html page -

i want change css class same id appear more 1 in page. try when there 2 id same name reflect first id not other. i try: view page : <i id="{{obj.id}}"></i> controller $(getjson.id).removeclass('busy b-white bottom'); $(getjson.id).addclass('on b-white bottom'); so, how can achieve ? ► first of id must unique. when ever using id same name , try use class instead of that. your solution $('[id='+getjson.id+']').removeclass('busy b-white bottom').addclass('on b-white bottom'); this simple method tho select elements same id. $('[id=test]').removeclass('yellow').addclass('red') .yellow{ background-color:yellow; } .red{ background-color:red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p id="test" class="yellow">q</p> <p id="test" clas...

sql - Parse.com: Performing "SELECT FROM - INSERT INTO" operations in Classes -

i'm making changes in classes estructure in parse.com (before migration own sever). need move masively information 1 table another: i need query information user class i must insert result of step 1 in vehicles class if sql, like: insert vehicles (veh_brand, veh_line, veh_model, veh_cap) (select veh_brand, veh_line, veh_model, veh_cap user); is there way perform operation? i'm not understanding weel parse.com documentation. must run operation? thanks in advance. remove values keyword insert vehicles (veh_brand, veh_line, veh_model, veh_cap) select veh_brand, veh_line, veh_model, veh_cap user

wordpress responsive theme or twitter bootstrap -

i have been reading twitter bootstrap quite while now. gives pre-made functionality many things using css classes, can create anything. along lot of jquery plugins integrated in package. on other hand see there theme name responsive available in wordpress gives same functionality. confused choose should choose upcoming-project. going use wordpress project. need know following. which 1 easy learn? responsive documentation doesn't seem user friendly. is fine use bootstrap in wordpress theme? have customization responsive if use bootstrap ? will using responsive give me benefit on bootstrap , in future how can reuse responsive theme. i don't know responsive theme or types of customization referring to. while can't speak specific theme, can few things bootstrap. bootstrap offers lots of flexibility when comes responsive layout witnessed in docs . can use fixed or fluid layouts , nest , offset content. bootstrap offers lot of flexibility in aesth...

python 3.4 - Counts the Vowels in an input -

instead of showing how many vowels appear in ends counting them. how can fix issue? def main(): sentence=input("please type sentence") counta=0 in sentence: if =="a": counta+=1 print("the letter appears:", counta,"times") counte=0 in sentence: if == "e": counte+=1 print("the letter e appears:", counte,"times") counti=0 in sentence: if == "i": counti+=1 print("the letter appears:", counti,"times") counto=0 in sentence: if == "o": counto+=1 print("the letter o appears:", counto,"times") countu=0 in sentence: if == "u": countu+=1 print("the letter u appears:", cou...

javascript - How can I show data based on my requirements in angularjs? -

in example based on mobile brand selection mobile models coming checkbox working. based on user brand selection mobile models coming. for htc brand have models image when user clicks htc models should show images instead of showing htc 1 x9 desire 820 desire 810s it should show images check box while submit should pass model name. 1 appreciated var myapp = angular.module('myapp', []); myapp.controller('myctrl', function($scope, $http) { $scope.selectedbrands = []; $scope.selectbrand = function(selectedphone) { // if deselect brand if ($scope.selectedbrands.indexof(selectedphone.brandname) === -1) { // deselect phones of brand angular.foreach($scope.phones, function(phone) { if (phone.brandname === selectedphone.brandname) { phone.selected = false; } }); } } $scope.checkselectedphones = function() { var modelnames = []; var jsonarr = []; var submodelarr = ...

c# - What is the correct way to transfer database in mojoportal? -

i have exported database server , imported on local pc. have changed connection string in user.config file. database same. after when visit page in mojoportal project, shows me error saying: guid should contain 32 digits 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.formatexception: guid should contain 32 digits 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).* can tell me why happening? or how can solved? i hope have changed connection string on right place ( inside portal web.config). there 2 connection string 1 authentication , 1 application. please check , if wont work path of error stack trace tell method throwing error after need debug that. (seems uniqueidentier field not defined/manged)

JavaScript: Display array items after 3 seconds one a time -

i have code segment: var = 0; (function loop() { text_objects[i].displaytext(); if (++i < text_objects.length) { settimeout(loop, 3000); } })(); which supposed display contents of array 1 @ time, separated 3 seconds. however, when run program, first item, , sort of freezes there, without updating , showing rest of items in array. what doing wrong? as correctly mentioned @nnnnnn, loop() named function expression, , reference loop should in scope within function also code works fine. var = 0; var test = function(value){ this.text = value; } test.prototype.displaytext = function(){ document.write(this.text + "<br/>"); } var text_objects = []; (var j = 0; j<10; j++){ text_objects.push(new test(j)); } (function loop() { text_objects[i].displaytext(); if (++i < text_objects.length) { settimeout(loop, 3000); } })(); alternate approach: var = 0; ...

angularjs - IONIC Framework - template is getting reloaded 10-12 times & so the controller functions -

i have verified, controller getting loaded once not multiple times. also, if add more routes in app.js number of print keeps increasing well. issue demo: http://codepen.io/anon/pen/xxxxpm (check console in browser) .controller('authsignupctrl', function($scope, $state) { var i=01; $scope.test = function() { console.log(i++); }; }); $stateprovider .state('login', { url: '/login1', templateurl: 'templates/login.html', controller: 'authsignupctrl' }); i don't think template being reloaded. think because bound function expression. try typing text box, cause digest loop cycle , fire function, resulting in more output in console.

Sharing a piece of code with methods inside a class in Python -

i started making draft 1 of classes supposed used in programm , first wrote piece of code: import math import numpy np r = 6.371e6 phi_src, theta_src = 10, 40 phi_det,theta_det = -21, 10 depth_src, depth_det = 0,0 # both on surface l = 0 class trajectory: def __init__(self, phi_src, theta_src, phi_det, theta_det, depth_src, depth_det, l): self.phi_src = phi_src self.theta_src = theta_src self.phi_det = phi_det self.theta_det = theta_det self.depth_src = depth_src self.depth_det = depth_det self.l = l @property def r(self): r_src = r - self.depth_src r_det = r - self.depth_det x_src = r_src * math.cos(self.phi_src) * math.cos(self.theta_src) y_src = r_src * math.cos(self.phi_src) * math.sin(self.theta_src) z_src = r_src * math.sin(self.phi_src) ...

oracle - SQL Select exact matches to multiple items with duplicate ID's -

i trying select speaks exact same languages (french, italian, , russian) table. should return maja: person lang ---------- ---------- ann english ann japanese bill english bill japanese bill russian chris english chris russian david english david japanese david russian ernie english ernie french ernie japanese fumie japanese fumie korean maja french maja italian maja russian the code have understandably doesn't work since names duplicated , query returns 0 results: select distinct person speaks lang = 'french' , lang = 'russian' , lang = 'italian'; any appreciated cannot figure out how deal these duplicate names. try this: select person speaks lang in( 'french', 'russian', 'italian') group person having count(distinct lang) = 3 the distinct inside co...

php - Change the old password -

hi guys im new programmer can me this, cant change password , keep saying error on echo "password change successful"; please me. thank you. <?php if(isset($_post["login"])) { if(!empty($_post['oldpass']) && !empty($_post['password'])) { $oldp=$_post['oldpass']; // connection $con=mysqli_connect('localhost','root','') or die(mysqli_error()); mysqli_select_db($con,'databaseprac') or die("cannot select db"); // select database $query=mysqli_query($con,"select * tblusers password='".$oldp."'"); $numrows=mysqli_num_rows($query); if($numrows!=0) { while($row=mysqli_fetch_assoc($query)) { $dbpassword=$row['password']; ...

css - How can I put an image outside of the paragraph? -

instead of <p>hello <img src="helloworld.jpg"> world</p> i have: <p>hello</p><img src="helloworld.jpg"><p>world</p> <p> has padding of 40px , images use space available. you can turn off paragraphs content ( link ), far know can't turn off elements only. what can modify html after retrieving database before outputting it. haven't specified server-side language, c# i've found csquery great.

android:checkableBehaviour="all" submenu still closes after selection / how to suppress submenu close -

i have actionbar menu this <item android:id="@+id/action_select_filter" android:title="@string/action_filter" app:showasaction="ifroom|withtext"> <menu> <group android:id="@+id/action_select_filters" android:checkablebehavior="all" > <item android:id="@+id/action_filter_open" android:checkable="true" android:title="@string/action_filter_open" /> ... </group> </menu> </item> i multiple choice filter menu dropping down actionbar. when click 1 of options, submenu closes. stay there until user decided filters wanted switch on, indeed on. i'm aware of question it's quite old , solution hack. android checkable submenu options i tried returning false/true onoptionsitemselected(menuitem item)...

android - Facebook login with app not installed redirects to login page -

on android followed session login sample create login flow app working on. problem i'm having on few devices if facebook app not installed when user logs in through facebook via webdialog , page seems redirect login page. i'm using facebook sdk 3.0.1, i've upgraded 3.5 see if fix issue, did not. sample provided in 3.0.1 sdk doesn't work , sample included 3.5 sdk performs app. i have tried code below on other devices not have facebook app installed , work fine. when try on nexus 7 (4.3 installed) run problem described above. any ideas? private session.statuscallback statuscallback = new sessionstatuscallback(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity); settings.addloggingbehavior(loggingbehavior.include_access_tokens); session session = session.getactivesession(); if (session == null) { if (savedinstancestate != null) { ...

javascript - Generate date from week number in moment.js -

as mentioned in title, have week number , year value. there way of finding monday of week using moment.js? trying, not succeeded sorry found solution myself: var test = moment().day("monday").week(week number here);

javascript - AJAX Get from a JSON Tree -

i'm starting out ajax, trying use jquery's $.getjson function (or related, ie $.load(), $.ajax(), etc). have json file structure this: [ { "id": 1, "email": "user@domain.com", "password": "password" }, { "id": 2, "email": "one@two.com", "password": "password" } ] how can call on json file (let's call users.json) user specific email? thought second paramter in $.getjson, seems return whole tree. thanks! short answer - can't directly ajax. jquery can extract portions of html , xml documents, not json. easiest answer - retrieve entire object (you have to, anyway) , use jsonpath structure want longer answer - retrieve entire object, , traverse object want best answer - make email address parameter whatever script produces json , have server return data want.

Display posts without using GET in PHP -

how 1 make view contain without using variable in php i trying display post/id this www.domain.com/view/1234 instead of www.domain.com/view.php?id=1234 you need rewrite url htaccess , intercept somehow using php , loading file somewhere. rewrite url mod_rewrite (i.e.: domain.com/23234234/0 domain.com?id=23234234&nr=0) make call database requesting post id 23234234 show user is looking for? (based on previous answer)

sql - C# Textbox enters info but leaves a ' * ' in textbox -

i have registration system, people scan barcodes , logs them in. barcodes hold unique number following '*'. when scan code enters listbox , clears remainder out of textbox, but, not clearing ' * '. any ideas ? here chuck of code: private void textbox1_keyup(object sender, keypresseventargs e) { object returnvalue; string txtend = textbox1.text; returnvalue = textbox1.text.replace(@"*", ""); if (e.keychar != '*') return; { if (listbox1.items.contains(returnvalue)) { (int n = listbox1.items.count - 1; n >= 0; --n) { string removelistitem = returnvalue.tostring(); if (listbox1.items[n].tostring().contains(removelistitem)) { //listbox1.items.removeat(n); } } } else listbox1.items.add(returnvalue); textbox1.clear...

ios - Making a particle follow a path in spriteKit -

Image
i have created particle , when test moving on xcode's property window, looks this: i have added particle scene, made circle , forced particle run circle using this: nsstring *myparticlepath = [[nsbundle mainbundle] pathforresource:@"particle" oftype:@"sks"]; skemitternode *myparticle = [nskeyedunarchiver unarchiveobjectwithfile:myparticlepath]; [self addchild:myparticle]; cgpathref circle = cgpathcreatewithellipseinrect(cgrectmake(0,0,400,400), null); skaction *followtrack = [skaction followpath:circle asoffset:no orienttopath:yes duration:1.0]; skaction *forever = [skaction repeatactionforever:followtrack]; [myparticle runaction:forever]; this how looks like. block of white sugar candy. node particle following path, not generated particles. i have represented circle in dashed can see path following... any ideas? thanks you sent particle emitter follow path. if want individual particles run action, us...

ruby - Parsing HTML from a defined start point to a defined end point? -

i have html: <hr noshade> <p><a href="#1">some text here</a></p> <p style="margin-top:0pt;margin-bottom:0pt;line-height:120%;"><span style="color:#000000;font-weight:bold;">this description</span></p> <hr noshade> <!-- <hr noshade> delimiter me --> <p><a href="#2">some more text here</a></p> <p style="margin-top:0pt;margin-bottom:0pt;line-height:120%;"><span style="color:#000000;font-weight:bold;">this description more text</span></p> <hr noshade> while parsing using nokogiri, want print information between each of these set of tags separated own delimiter <hr noshade> . so, first block should print information between "p" tags lie between 2 hr noshade tags , on. i'm using accepted answer on xpath select elements between 2 specific elements i have semi-safisfactor...

java - Access permissions during android file sharing -

why sufficient openfileoutput() file mode mode_world_readable (as manual says ) make file readable other apps (via share intent)? even if file readable, doesn't directory remain private (rwx------ rather rwxrwxrwx)? even if file readable, doesn't directory remain private (rwx------ rather rwxrwxrwx)? having directory deny-all prevent third parties listing contents of directory or creating new files there. has no impact on being able read file given fully-qualified path file. that being said, please not use mode_world_readable . use fileprovider instead , have finer-grained control on has access content. way, example, can have file inaccessible except specific share operation.

diff - Python watchdog: what is the 'empty' directory snapshot? -

watchdog pretty awesome @ letting take recursive snapshots of particular directory. lets compare snapshots function called directorysnapshotdiff . my program watches directory evolves in real-time, , has been made consume output of function. reasonable. let's take snapshots s1, s2... of file system @ arbitrary times. compare last snapshot latest 1 create difference objects. d1 d2 # detected differences (my app eats these up) s1 -> s2 -> s3 # evolving states (snapshots taken) of file system. t=0 -------------------> time omnomnomnom. that's great. but, first time run app, need know current state. want pretend there null state s0 , transitions s1 ; can diff format. i.e. d0 # want create 'bootstrapping' difference set (s0) -> s1 # assume s0 empty snapshot: reports addition how do that? the motivation behind is: love functional programming. instead of writing code consume snap...

mysql - Sql left join across two columns with filter -

update: resolved, making syntax error. can join , filter across 2 columns in left join? example: tbl_people id food side value pizza fries 10 b pizza shake 2 c burger fries 3 tbl_sides food side pizza fries burger fries then using sql: select id, food, side, value tbl_people people left join tbl_sides sides on sides.food = people.food , sides.side = people.side can add flag can determine whether or not food pair in joined or if it's null? don't want inner join, because need count total food/sides per person, , matching food/side pairs per person. tried: select id, food, side, value, case when side.side not null , side.food not null 1 else 0 end match_flag tbl_people people left join tbl_sides sides on sides.food = people.food , sides.side = people.side but it's not working. need flag when join isn't applied i'm having trouble. i think want this:...

scheme - Creating a new image with scriptfu -

i'm experimenting script-fu, trying teach myself how use it. have following basic script, thought create, display, new image: (define (script-fu-test) (let* ( (image (car (gimp-image-new 10 10 rgb))) ) (gimp-display-new image) (gimp-context-pop) ) ) i'm calling script so: ./gimp-2.8 -i -b '(script-fu-test)' and it's failing, so: batch command experienced execution error: error: ( : 32662) procedure execution of gimp-display-new failed anyone have hint might messing here? i'm running on mac os x (ie /applications/gimp.app/contents/macos/gimp-2.8) when try use simplified version of code, following results: $ gimp -b '(gimp-display-new (car (gimp-image-new 10 10 rgb)))' batch command executed $ gimp -i -b '(gimp-display-new (car (gimp-image-new 10 10 rgb)))' batch command experienced execution error note in first case there's no -i , user interface available. in second case,...

android - Cordova features aren't work on server -

i developer of disciplinexgames! developing mobile app. have downloaded cordova test suite here ( https://github.com/apache/cordova-mobile-spec ). when upload on disciplinexgames server shows error in alert box "error: apache cordova did not initialize. demo not run correctly." when upload same folder on phonegap server works fine. unfortunately doesn't solve our problem building our mobile app on our server , using phonegap redirect user page hosted on disciplinexgames server if there's internet in user's mobile. first error got in console area in google chrome cordova.js missing when provided outputs error cordova/channel required. hope can guide through how can use cordova's amazing features on our server instead of phonegap's local server. i bit confused trying accomplish here going take stab. you want develop app when app launches, checks see if device has internet connectivity. if does, app opens mobile website hosted on servers. ...

refresh - Visio 2010 Data Model from an Existing Netezza Database -

Image
i'm looking build visio data model existing database. i open visio, select option create new document data model, , select database tab. the database netezza, i'm using generic ole db provider , ibm netezza ole db data provider i complete wizard entering correct data source , username/password... when test connection "connection successful" ...but when click "ok" connection disappears. there appears "save" button missing. bug in visio? missing step? thanks advice/ thoughts/ comments. i'll tell when try 'link data shapes' netezza, error box says "microsoft visio cannot connect data source" detail message "error 80040e21: odbc driver not support requested properties." using odbc. using ole db, got same error first time. trying reproduce retrieve specific ole db error, i've crashed visio twice. i believe situation hopeless. visio making driver calls ibm not support in drivers. ooh! a...

javascript - Backbone Marionette : Reusable UI Elements -

Image
i'm building first backbone marionette application, i'm confused how add reusable ui view templates, ui elements have javascript interaction. i have built number of ui elements input element shown below. input element can interacted via javascript, example clicking up/down arrows change input's value. these ui elements should reused again , again in multiple views, , there can many instances of these ui elements contained within given view. mockup 1 such view, containing several ui elements, shown below. a model view might this, , have javascript interaction of ui elements interacting view's model. in other words, javascript interaction on ui element have able pass event model of view inside ui element shown. var fontstyles = backbone.model.extend({ defaults: { fontfamily: "helvetica neue", fontweight: "regular", color: "rbg(1,197,255)" ... } }); my question for structured backbo...

ruby on rails - Complex sorting on association in rails3 -

i have 3 model hotel , package , packageprice , , association like: hotel can have many packages , each package has 1 packageprice models are: class hotel < activerecord::base attr_accessor :excel_sheet, :excel_sheet_file_name attr_accessible :hotel_name, :stars, :location, :searchable, :excel_sheet, :excel_sheet_file_name has_many :package_prices, :dependent => :destroy has_many :packages, :through => :package_prices, :order => 'package_prices.price' end class package < activerecord::base attr_accessible :package_name has_many :package_prices, :dependent => :destroy, :order => 'price desc' has_many :hotels, :through => :package_prices, :order => 'package.package_prices.price' end class packageprice < activerecord::base attr_accessible :price, :package_id, :hotel_id belongs_to :package belongs_to :hotel end and corresponding tables are: mysql> desc hotels -> ; +------------+---------...

c++ - How to list the word with the highest score -

i'm trying find out how list word highest score, based on function calculate score, words come array of words, or so. how can tackle this? since need word highest score, there no need keep track of scores all candidate words. keeping track of best 1 enough. string best_word; int best_score = 0; (auto word &: all_the_words) { int cur_score = scrabblescore(word); if (cur_score > best_score) { best_word = word; best_score = cur_score; } } // have best_word , best_score. edit : extend take care of words same best score. vector<string> best_words; int best_score = 0; (auto word &: all_the_words) { int cur_score = scrabblescore(word); if (cur_score > best_score) { best_words.clear(); best_words.push_back(word); best_score = cur_score; } else if (cur_score == best_score) { best_words.push_back(word); } } // have best_words , best_score.

c++ - data write in array in multi-threading environment -

i have block in multi-threaded program following operation: void func(args){ computation; for(i = 0; < n ; i++) value[i] += computed_value; } multiple thread execute function. need make program thread-safe using lock. locking making program slower single threaded program. have tried using lock making program slow. please suggest alternative approaches. according code, not have locks. i'd use locks instead of no locks start approach. (without more clarification, cannot out much). if can, lock operations inside of computation. psuedo example int computation(int i) lock(); = + 1; unlock(); return i;

Using schtasks on Windows XP to Stop a Task After Running for a Specific Amount of Time -

Image
how use schtasks command line tool on windows xp stop task after runs specific amount of time? page @ enter link description here not explain how though lists option when querying task. if else fails, can create second scheduled task ends first task @ time. less cpu intensive , think schtasks service anyway, in background. aalso, on windows 7 option /du sets "duration" of task, , think ends task afterwards. similarly, setting /st , /et ("start time" , "end time") kill task after end time has passed, though doesn't seem apply here. i think scheduled tasks automatically killed after period of time. additionally, schtasks /create /? on windows 7 states for /v1 tasks, if /ri specified, duration defaults 1 hour "/v1 tasks" tasks have been created compatible pre-vista versions of windows. in mind, means task made command line defaults 1 hour anyway, , it's possible kill-time required , since need default pre-vista t...

c++ - 'Invalid use of void expression' passing arguments of functions -

this piece of code solves systems of differential equations. vector dydx(neq); void diffeq(vector x, vector &dydx) { dydx(0) = x(1); dydx(1) = -x(0); } double midpoint(int n, vector x) { double h=h/n; matrix z(n+1,n+1); z.fillrow(0,x); diffeq(x, dydx); z.fillrow(1,addvec(x, dydx*h)); //error: invalid use of void expression (int j=1; j<n; j++) { diffeq(z.getrow(j), dydx); z.fillrow(j+1, addvec(z.getrow(j-1), dydx*h*2)); //error: void value not ignored ought } diffeq(z.getrow(n), dydx); return 0.5*addvec(z.getrow(n), z.getrow(n-1), dydx*h); //error: invalid use of void expression } the classes vector , matrix custom. vector class vector { public: vector(size_t size): vsize(size), vdata(size){} int getsize(){return vsize;} double& operator()(size_t i){return vdata[i];} double operator()(size_t i) const {return vdata[i];} void operator+(double d) ...

unit testing - Selenium running same test twice when executed from withing a script - Python -

i have python script runs different selenium webdrivers have been exported python. script , webdrivers want them do. when script executes webdriver, webdriver needs go , continue script pause , firefox pop again , execute same webdriver task again. doesn't affect results webdrivers or script increases run-time significantly. after first exectution of webdriver shell return: ran 1 test in 192.680s ok however, when repeats webdriver unexpectedly returns period "." here code webdriver, from selenium import webdriver selenium.webdriver.common.by import selenium.webdriver.support.ui import select selenium.common.exceptions import nosuchelementexception import unittest, time, re class webdriverviewas(unittest.testcase): def setup(self): self.driver = webdriver.firefox() self.driver.implicitly_wait(30) self.base_url = #website i'm interested in visiting self.verificationerrors = [] self.accept_next_alert = true ...

asp.net - Functionality in Update Panels not working in IE9 or IE10 -

we have issue functionality within microsoft ajax "updatepanel" not work or takes extremely long time react in ie 9 and/or ie 10. if set compatibility ie 8 functionality works properly. <meta http-equiv="x-ua-compatible" content="ie=8" /> the functionality works fine in other browser (chrome/firefox). also, behavior happens in environments not others running same code base. setting compatibility mode solves functionality problem limits css ability ie users.

c# - Equal sign in data "causes" BeginGetRequeststream to fail -

the line marked in code below (//this async call). not call async call if pass in value query function: <verb>get</verb><resourcelist><catalogquery><itemquerylist><itemidlist><id>16-=-cedar-bonsai</id></itemidlist><attributestype>all</attributestype></itemquerylist></catalogquery> note part of xml: <id>16-=-cedar-bonsai</id> however works if switch equal sign else <verb>get</verb><resourcelist><catalogquery><itemquerylist><itemidlist><id>16-here-cedar-bonsai</id></itemidlist><attributestype>all</attributestype></itemquerylist></catalogquery> whats confusing me contents of query should have absolutly no effect on callback being called. right? here code //get item attributes async public xelement makeasynccall(string query,bool create = false,bool resent = false) { manualre...

SqlDataAdapter.FillSchema with stored procedure that has temporary table -

i'm running problem similar question here ( display datatype , size of column sql server query results @ runtime ) has not had solid solution. i wonder if has found solution or work around it. can use sqldataadapter.fill() no problem, .fillschema() report error temp table create in stored procedure doesn't exist. my goal able fill datatable data , schema source. if not need dataset, 1 datatable, can use datatable dt= new datatable(); dt.load(cmd.executereader()); for dataset, must @ least tell names of tables (this means number) sp returning. dataset ds = new dataset(); sqldatareader sdr = cmd.executereader(); ds.load(sdr, loadoption.overwritechanges,"table1");

Python - Property setting from list causes maximum recursion depth exceeded -

i have following class: class vehicle(object): def __init__(self, name): self.name = name self.kinds_list = ["tank", "car", "motorbike", "bike", "quad" ] @property def kind(self): return self.kind @kind.setter def kind(self, x): if x in self.kinds_list: self.kind = x else: raise attributeerror('no attribute {0} found !'.format(y)) setting kind causes maximum recursion depth exceeded aka stack overflow. q: how re-write setter make work fixed list only? the reason reached maximum recursion depth inside setter, self.kind = ... , recursively calls same setter. should store value private attribute, rename self.kind self._kind . class vehicle(object): def __init__(self, name): self.name = name self.kinds_list = ["tank", "car", "motorbike", "bike", "quad" ] ...

32 bit - How to change or add openssl 32 bit driver on Centos 6.4 -

i have no idea how need 32 bit openssl work in order install application. this version info: (result of openssl version -a) openssl 1.0.1e 11 feb 2013 built on: wed feb 13 11:31:32 est 2013 platform: linux-x86_64 options: bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) compiler: gcc -fpic -dopenssl_pic -dzlib -dopenssl_threads -d_reentrant -ddso_dlfcn -dhave_dlfcn_h -dkrb5_mit -m64 -dl_endian -dtermio -wall -o2 -g -pipe -wall -wp,-d_fortify_source=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -wa,--noexecstack -dpurify -dopenssl_ia32_sse2 -dopenssl_bn_asm_mont -dopenssl_bn_asm_mont5 -dopenssl_bn_asm_gf2m -dsha1_asm -dsha256_asm -dsha512_asm -dmd5_asm -daes_asm -dvpaes_asm -dbsaes_asm -dwhirlpool_asm -dghash_asm openssldir: "/etc/pki/tls" engines: rsax dynamic i don't know start (other google) the architect @ work figured out, don't have exact steps got: yum install glibc.i686 yum ins...

multidimensinal array: group and output php -

hi have array coming in: $myregiondata = array ( [0] => stdclass object ( [howmuch] => 1 [country] => id [state] => jawa barat ) [1] => stdclass object ( [howmuch] => 1 [country] => ro [state] => bucuresti ) [2] => stdclass object ( [howmuch] => 2 [country] => [state] => california ) [3] => stdclass object ( [howmuch] => 1 [country] => [state] => texas ) ) im trying group array outuput such id jawa barat (1) ro bucuresti (1) california (2) texas (1) i have tried key value associations, loops etc.. , can seem combine states in display. any advice appreciated i'd reorganise country first make things easier: // hold re-indexed array $indexed ...

.net - ListChanged Event when property of a custom class in binding list changes -

i have bindinglist (bindinglist (of foo)) several objects of sample class: class foo implements inotifypropertychanged private _name string private _numer integer private _otherclass otherclass private _bindinglistofanotherclass bindinglist (of anotherclass) end class now want informed, when property of item in bindinglist changes. as can see, have interface implemented , i'm throwing events. listchanged events thrown primitive properties not if property in otherclass or in anotherclass changes (or if item added / removed in _bindinglistofanotherclass). i'm throwing propertychanged events in otherclass , anotherclass. any idea? unfortunately there no auto-wireup foo class know when otherclass changes unless foo listens propertychanged event of otherclass subscribing event handler. in event handler fire property changed event on foo saying otherclass property has changed. this can little tricky because if property exposed getter/setter of kind, need u...

vba - MS Access ComboBox with own values -

in ms access application have table , form customers contains numeric field status ( 1 - means active , 2 - inactive , 3 - n/a ) on form need have combobox values active , inactive , na , , when user selects value, 1 , 2 or 3 value should save status field. when try set [row source type] [value list] , [row source] ["active";1;"inactive";2;"na";3] , [bound column] =2 , combobox shows me needless column values 1 , 2 , 3 when set [bound column] = 1 , tries store in table ["active", "inactive", "na"] instead of 1 , 2 , 3 who knows how it's possible implement, i'm doing wrong? when use [value list] [row source type] have set columncount right value manually. columncount = 2 also hide id column columnswidth=";0"

java - Android getSystemService(Context.USB_SERVICE) error -

i'm new @ android , i'm trying use android usb send data. tried use example code // usbmanager android. usbmanager manager = (usbmanager) getsystemservice(context.usb_service); // find first available driver. usbserialdriver driver = usbserialprober.acquire(manager); if (driver != null) { driver.open(); try { driver.setbaudrate(115200); byte buffer[] = new byte[16]; int numbytesread = driver.read(buffer, 1000); log.d(tag, "read " + numbytesread + " bytes."); } catch (ioexception e) { // deal error. } { driver.close(); } } and i'm getting error the method getsystemservice(string) undefined type tcpclient i'm not sure if i'm missing points. great. i'm using eclipse juno , jdk 1.7. getsystemservice(string) method defined context class: context#getsystemservice(string) . since activity subclass of context, using this.getsystemservice(string) or getsystemservice(string) works fine ...

Dynamic access to MySQL database in Java -

i looking way how access mysql database more dynamically. for example, want insert text table. have method called insert() called approximately every half of second , insert stuff. the code looks this: public void insert(string string) { class.forname("com.mysql.jdbc.driver").newinstance(); java.sql.connection conn = java.sql.drivermanager.getconnection(...); java.sql.statement stat = conn.createstatement(); stat.executeupdate("insert mytable (mytext) values ('"+ string +"')"); conn.close(); } but think cause many problems because opening , closing connections often. so isn't there way open "mysqlstream" database , print data without opening , closing connection again , again? thanks replies. create connection object @ beginning of program, , use every query. close @ end of program. oftentimes 1 connection good, may declare static. public static java.sql.connection ...

statsd - Graphite summarize returning inconsistent data -

Image
i've set two-node graphite cluster connected using carbon-relay : i sent 500 counters metric cluster-test-500 on ~1min period, @ approximately 60/10 seconds. based on aggregation rules: meta data: aggregation method: sum max retention: 31536000 xfilesfactor: 0 archive 0 info: offset: 52 seconds per point: 10 points: 2160 retention: 21600 size: 25920 archive 1 info: offset: 25972 seconds per point: 60 points: 10080 retention: 604800 size: 120960 archive 2 info: offset: 146932 seconds per point: 600 points: 52560 retention: 31536000 size: 630720 the data appeared in both nodes' whisper dbs: data: 12 63 61 62 63 60 61 57 0 data: 261 239 0 data: 500 0 then, when queried graphite using summarize function, on past day: http://graphite.mysite.com/render?target=summarize(stats.counters.cluster-test-500.*.*.*.count,"1day","sum","false")&format=json&tz=utc&from=18:00_20130923&unti...

objective c - Confusion between instance and class methods -

not sure if use class method or instance method create nsarray.... mean there alots of ways of creating them... sorry new ios development. there 3 ways get, eg, nsarray: the standard alloc/init. conceptually, @ least, [nsarray alloc] call on class method of nsarray, , resulting object invokes special form of instance method init.. step. [nsarray arraywithsomethingoranother..] . invokes class method on nsaarray internally alloc/init (with few twists) , "fills in" object required. [someobject arraybydoingsomething..] . instance method on object (which may or may not nsarray object) returns nsarray. there aren't many cases there's overlap between (2) , (3) -- can't think of offhand nsarray, though there's handful similar nsstring functions. , while purists may prefer old alloc/init vs arraywith... class methods, there's not real need use alloc/init on nsarray in arc environment (though still has place in manual ref count environmen...

How can I use cancan to secure all of my controllers in rails? -

is there way add code application_controller rails automatically secures every controller cancan, instead of having add load_and_authorize_resource in every controller? yes, can use inheritance: class homecontroller < applicationcontroller # [etc] end class settingscontroller < applicationcontroller end class userscontroller < settingscontroller end class productscontroller < settingscontroller end so can give access settingscontroller: can :manage, settingscontroller which give access controllers inherit settingscontroller.

c - Using Strings and Malloc/Realloc -

i'll honest, i'm complete novice @ c. thus, things malloc , realloc alien concepts. think have basics down, can't quite there 100%. while (int args = scanf("%s", string)) { if (args < 0) break; count++; if (array == null) { array = (char *) malloc(strlen(string)); if (array == null) { printf("error allocating memory"); exit(1); } } else { printf("%s %d\n", string, strlen(string)); array = (char *) realloc(array, (sizeof(array) + strlen(string) + 1)); if (array == null) { printf("error allocating memory"); free(array); exit(1); } printf("%lu\n", sizeof(array)); } strcpy(&array[count - 1], string); } it's reading terminal - cat file | ./program , bunch of words of arbitrary length. i'm trying them array (array). edit: should mentino i'm apparently ...

c++ - Sorting words in a character array -

for given array, need write function sort words alphabetically: char strings [][10] = { "hello", "world", "computers", "are", "awesome" }; i've tried write function sortwords using insertion sort, think swap function isn't working: void swap(char *e1, char *e2) { int tmp = *e1; *e1 = *e2; *e2 = tmp; } void sortwords( char (* words2darray)[10], unsigned short length ) { unsigned int i, curpos; char curchars[10]; for(i = 1; < length; i++) { // copy current word curchars strncpy_s(curchars, words2darray[i], 10); curpos = i; // compare , move word correct position while(curpos > 0 && strcmp(curchars, words2darray[i-1]) > 0) { swap(words2darray[curpos], words2darray[curpos-1]); curpos--; } } } i've attempted debugging code using local windows debugger , found curchars being copi...

java - longest substring with exclude list of strings -

i using this algorithm find common substring between 2 strings. please, me using array of common substrings of strings, should ignore in function. my code in java: public static string longestsubstring(string str1, string str2) { stringbuilder sb = new stringbuilder(); if (str1 == null || str1.isempty() || str2 == null || str2.isempty()) { return ""; } // java initializes them 0 int[][] num = new int[str1.length()][str2.length()]; int maxlen = 0; int lastsubsbegin = 0; (int = 0; < str1.length(); i++) { (int j = 0; j < str2.length(); j++) { if (str1.charat(i) == str2.charat(j)) { if ((i == 0) || (j == 0)) { num[i][j] = 1; } else { num[i][j] = 1 + num[i - 1][j - 1]; } if (num[i][j] > maxlen) { maxlen = n...