Posts

Showing posts from September, 2011

java - Supporting 3D secure cards for recurring -

my target support 3d secured cards recurring billing. right have implemented paypal direct payment. paypal direct payment api not support 3d secure recurring billing ; 3-d secure not supported direct recurring billing , reference transactions. cards require 3-d secure authentication cannot use these apis 3d secure implementation so did research , came across 2checkout supports 3d secure. here 2checkout supports recurring billing . first thing want know not written, 2co supports 3d secure recurring well? secondly there other way or source through can achieve target more 2co. any highly appreciated. 3d secure available on first , initial transaction, reason expression chargeback , e.g. friendly chargeback done on recurring transaction , not on initial one, since have been approved 3d secure , pretty hard disprove it's authenticity.

c# - Altering array while keeping a backup copy -

i have array 3 integers. want duplicate array , change first integer. magical reason, both arrays first integer adjusted. have no idea why happening , it's driving me crazy. int [] numbers1 = {1, 2, 3} int [] numbers2 = {3, 4, 5} numbers2 = numbers1; at point did system.console.writeline see both arrays {1, 2, 3}. far good. numbers1[0] = 4; when i'm doing system.console.writeline see both arrays {4, 2, 3}. want numbers2 stay same. currently passing reference. numbers in array stored in memory. when reference object in memory points object. not create new object in memory when referencing, need clone ints array points different object in memory. numbers2 = numbers1; you need clone arrays. numbers2 = (int[])numbers1.clone(); as others have noted can use .toarray() method. creates copy of items in array. numbers2 = numbers1.toarray();

c++ - Unhandled exception at 0x000FBA44 in Top Down Shooter -

i posted question dealing linker errors... whatever reason errors went away , replaced this. when try run program, window opens , appears run, visual studio 2013 presents me error: unhandled exception @ 0x000fba44 in top down shooter.exe: 0xc0000005: access violation reading location 0xccccccd0. and takes me xutility file breakpoint here: #if _iterator_debug_level == 2 if (_myproxy != _parent_proxy) { // change parentage _lockit _lock(_lock_debug); _orphan_me(); _mynextiter = _parent_proxy->_myfirstiter; _parent_proxy->_myfirstiter = this; _myproxy = _parent_proxy; } the arrow on _mynextiter line. know happening? using iterators go through lists had, commented them out yet still error , i'm not sure why edit: ok, after going through stack of methods called, last piece of code called mine this: chunkmanager::chunkmanager(b2world *w){

Android : Custom ArrayAdapter not working to display text -

i working on android project, want create customarray adapter first display names of restaurants server, , when user clicks on 1 of object, it's id retrieved in backend(not displayed, nothing on ui). currently, having issues not working. note please note, not android programmer, thankful if me out, please try understand, not familiar android concepts, may not understand trying , might have follow comments. if have time it, please post answer in simple manner code. sorry this, had similar problem , not experience. thanks. apologies if rude, felt important. here layout code : <?xml version="1.0" encoding="utf-8"?> <listview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" > </listview> here restrestaurant class : public class restrestaurant { private int restaurantid

php - Display subheading with excerpt -

i want display subheading , excerpt of blog post <?php { the_subheading(); the_excerpt(); } ?> when used above code displays subheading, follwed <p> , followed excerpt() . want remove <p> . possible? there other way? i found answer. <?php echo get_the_excerpt(); ?> instead of <?php the_excerpt(); ?> solved problem. hope useful someone!

javascript - tweeting from node.js "Timestamp out of bounds" -

i've been trying work twitter streaming api node.js , tried make simple test program logs tweets. console.log("start"); var twitter = require('twitter'); var client = new twitter({ consumer_key: '****', consumer_secret: '****', access_token_key: '****', access_token_secret: '****' }); console.log("middle"); client.stream('statuses/filter', {track: "coffee"}, function(stream) { stream.on('data', function(tweet) { console.log(tweet); console.log("this won't show up."); }); console.log("this will."); }); console.log("end"); when run "node twitter.js" logs start,middle,this will,end. why client not streaming in data?

CPLEX and Bluemix integration -

i new bluemix , want use cplex. want know if possible integrate cplex bluemix framework? examples appreciated ibm provides cloud based service run cplex - decision optimization on cloud, or docloud. there java , rest apis available access service, create application on bluemix utilizes these. https://onboarding-oaas.docloud.ibmcloud.com/software/analytics/docloud/

regex - How to change "x" and "y" in a line into "y" and "x" using hash -

i trying replace strings in huge file contains many lines. file.txt line1: "x" = 5.5; "y" = 7.5; "z" = 9.0; line2: "v" = 66; "y" = 3; "u" = 11.0; so on ... the replacement hash (%rhash) contains map information $rhash{"x"} = "y"; $rhash{"y"} = "x"; $rhash{"z"} = "a"; $rhash{"v"} = "b"; $rhash{"u"} = "c"; when tried while (($cur, $cng) = each(%rhash)) { $line =~ s/\q"$cur"\e/\"$cng\"/g; } line 1 change either "x" = 5.5; "x" = 7.5; "a" = 9.0; or "y" = 5.5; "y" = 7.5; "a" = 9.0; but correct change is "y" = 5.5; "x" = 7.5; "a" = 9.0; how can achieve this.. thanks help... you need change them simultaneously. easiest way make compound executable regexp, , substitution bas

ios - Why does UITableView lock up when switching focus from UITextField to UITextView? -

i have uitableviewcontroller used present series of questions via custom uitableviewcells. each uitableviewcell has uitextfield data input , uitextview adding necessary notes relevant question. when uitextfield calls textfielddidendediting performs calculations , reloads tableview data. works great, except instances when user switches focus uitextfield uitextfield. in instances, app locks few seconds , cpu goes 100%. here relevant code: func textfielddidendediting(textfield: uitextfield) { //println("reloading table") self.answer = textfield.text self.updatecalculations() self.tableview?.reloaddata() } this happens when moving uitextfield uitextview. moving uitextfield not cause issues, , moving uitextview uitextfield not cause issues. if move of textfieldshouldendediting lockup stops, reloaddata doesn't seem fire. thought might calculation function using, if take out, problem still occurs. far can tell, there kind of hangup happens when calling

css3 - Transition from one animation to another -

so, simple question: i have element, has animation in normal state - transform-animation ( perspective , rotatex , rotatez - rotatez changes) runs constantly. on :hover want change animation (remove rotatex , perspective transform, keep rotatez animation) - that's no problem, want animation transition new animation , have no clue how accomplish that. jsfiddle from: @-webkit-keyframes rotatespace { 0% { transform:perspective(555px) rotatex(55deg) rotatey(0deg) rotatez(0deg) scale(1.25); } 100% { transform:perspective(555px) rotatex(55deg) rotatey(0deg) rotatez(360deg) scale(1.25); } } to: @-webkit-keyframes rotateflat { 0% { transform:perspective(0) rotatex(0deg) rotatey(0deg) rotatez(0deg) scale(1.25); } 100% { transform:perspective(0) rotatex(0deg) rotatey(0deg) rotatez(360deg) scale(1.25); } } instead of applying transform styles 1 element use :before pseudo element animated block , element "3d" effect (

javascript - equality check with more than 1 var -

i have following code: const mult = (a, b) => * b; const result = mult(2, 3) + mult(4, 5); const result1 = 6 + mult(4, 5); const result2 = 6 + 20; console.log(result); console.log(result1); console.log(result2); console.log(result === result1 === result2); the expression result === result1 === result2 equates false when result === result1 true , result1 === result2 true. can explain why? it solved left side right, resolving as: (result === result1) === result2; true === result2; for example, event fail: 1 === 1 === 1 it due type conversion not done === operator. following resolves true! 1 == 1 == 1

python - Inserting data in a Dictionary with raw_input dynamically? -

i writing code school project user enters data student along numbers 3 subject , if needed can update them later. have 2 questions. 1) how insert key value pair dictionary when inputs in 1 line of console? ex:- >>>enter data? >>>alex 45 26 35 here key 'alex' , values 45 26 35 expected output {'alex': '45 62 35'} 2) perform update single command line statement? with syntax >>>'action' 'data' ex:- >>>update alex 45 47 41 the main problem facing here how split statement in action , data program can identify them individually , further data key value pair? if want split string @ first space, can use string.split(s, maxsplit=n) s string split , maxsplit=n number of splits stop at. if not give value s call function string.split(maxsplit=n) split whitespaces. example - >>> s = "alex 45 26 35" >>> s.split(maxsplit=1) ['alex',

Selenium web driver: unable to locate element -

i new selenium: have source , trying click on button using xpath selenium webdriver. button(last line in html) trying click on: i use xpath: "//div[@id='innerbody']/div[4]/div/div/ul/li[3]/button" , gives me unable locate element. any idea why , how should go it. <document> <html class="fullpage" xmlns="http://www.w3.org/1999/xhtml" style=""> <head> <body class="brand brand-mastwide fullpage no-footer width-hd" style=""> <div id="cboxoverlay" style="display: none;"/> <div id="colorbox" class="" style="padding-bottom: 2px; padding-right: 2px; display: none;"> <div id="masthead" class="masthead full-width"> <div id="toast-absolute" class="full-width"> <!-- content --> <div id="outer-outer" class="with-nav"> <div id="outer-wrapper&quo

javascript - How can I run a lot of functions in sequence? -

maybe question duplicate. found lot of similar questions, no 1 can solve problem. task: function animate(){ $ul.each(function(){ $(this).find('li').each(function(){ //animate block $(this).animate({top:'-100%'},100,function(){ $(this).css({top:'100%'}); }); //endblock }); }); } as may know, 'animate block' functions run @ same time. want them run in sequence. how can achieve that? i have read jquery 'deferred', 'q' relate article, still confusing. sorry english. ---------addition------ if want run animate function several times, should do? if want avoid jquery's awkward .queue() / .dequeue() , can build promise chain jquery collection of <li> elements. function animate($ul) { var p = $.when(); //resolved starter promise $("li", $ul).each(function(i, li) { p = p.then(function() { return $(li).

c++ - having issues using gl_VertexID to draw const vertices that are inside the shader -

hi there having problems gl_vertexid seems not updating or when use in opengl program draw vertices stored in shader vec4's,as far know should straightforward , job without problems or issues have done correctly unfortunately isnt showing here : my main program #include "shaders.h" int main(){ glfwinit(); glfwwindowhint(glfw_context_version_major, 4); glfwwindowhint(glfw_context_version_minor, 3); glfwwindowhint(glfw_opengl_profile, glfw_opengl_core_profile); glfwwindowhint(glfw_opengl_forward_compat, gl_true); glfwwindowhint(glfw_resizable, gl_false); glfwwindow* window = glfwcreatewindow(800, 600, "opengl", null, null); glfwmakecontextcurrent(window); glewexperimental = gl_true; glewinit(); //create vertex array object //vertex array object holds state gluint vao; glgenvertexarrays(1, &vao); glbindvertexarray(vao); //compile , link shaders here gluint program = compile_shaders(); gluseprogram(program); while(!glfwwindowshouldc

reactjs - Jest fails to load moment -

i have simple react component utilizes moment library: import react 'react'; import moment 'moment'; let { component } = react; export class simpleapp extends component { constructor (props) { super(props); var currentdate = this.props.data[this.props.current].date; this.state = { currentdate: currentdate, currentfromatted: moment(currentdate).format('dddd, mmmm yyyy') }; } render() { return ( <div classname="simple">{this.state.currentdate}</div> ); } } module.exports = simpleapp; and have test test component: import react 'react/addons'; import simpleapp '../js/components/pages/simple.react'; var testutils = react.addons.testutils; jest.dontmock('../js/components/pages/simple.react'); jest.dontmock('moment'); describe('simpleapp', () => { it('should not anything', ()

oop - Generic interface inheritance Java -

first of show code. have generic interface: basewebservicecool: public interface basewebservicecool<i extends sessionpeticionbasebean, o extends wsrespuestabasebean> { o create(i wsrequest); o read(i wsrequest); o update(i wsrequest); void delete(i wsrequest); } sessionpeticionbean: public class sessionpeticionbasebean implements serializable { private string token; private string uuidusuariologado; } wsrespuestabean: public class wsrespuestabasebean implements serializable { private string codigorespuesta; private string mensajerespuesta; private boolean error; private map<string, string> errors; } getters , setters skipped. have specific interface extends above base interface that: wspersonasinterface: public interface wspersonasinterface<i extends sessionpeticionbasebean, o extends wsrespuestabasebean> extends basewebservicecool<i, o> { } the point web controller must impleme

xml - C# check XmlNode value attribute -

i wrote code check if xmlnode has value, when run crash on !=null. strange because solution known. private static void traversenodes(xmlnodelist nodes) { foreach (xmlnode node in nodes) { if (!node.haschildnodes) { console.writeline(node.name + " " + node.attributes["id"].value); } if (node.attributes["splitcombinationoperator"].value != null) { console.writeline(node.name + " " + node.attributes["splitcombinationoperator"].value); } else { console.writeline(node.name); } traversenodes(node.childnodes); } } the error following: object reference not set instance of object. you should check null values this: node.attributes["splitcombinationoperator"] != null && node.attributes["splitcombinationoperator"].value != null otherwise nullreferenceexception when node.

excel - VBA timer gives 0s for everything -

i have timer calculates differences in execution times between data types performing same calculation. here macro: public declare function gettickcount lib "kernel32.dll" () long sub function1_var_randnumcounter() dim var_randnum_x variant, var_randnum_y variant, count variant count = 1 count = 1000000000 var_randnum_x = rnd(now) ' rnd vals based on now, built-in vba property var_randnum_y = rnd(now) next count select case isnull("a2") case true cells.clear set target_sheet = activesheet target_sheet.range("a2").value = -t case false set target_sheet = activesheet target_sheet.range("a2").value = -t end select 'msgbox gettickcount - t, , "milliseconds" call function1_dec_randnumcounter end sub sub function1_dec_randnumcounter() dim count, var_randnum_x, dec_randnum_x, var_randnum_y, dec_randnum_y dec_randnum_x = cdec(var_randnum_x) dec_randnum_y = cdec(var_ra

Android Studio Importing, cannot find file "settings.jar"? -

i decompiled apk file folder.(tried apktool , online decompiler) importing project android studio, shows "cannot find file ...decompiled_apk_file_name\settings.jar". in decompiled folder there folders: build, dist, res, smali, and 2 files: androidmanifest.xml, apktool.yml how solve this? much!

Ruby on rails tutorial chapter 10...account activation not matching route -

trying go through ruby on rails tutorial on chapter 10. have pretty decent understanding of routing far. here issue: account activations send token email performs hash on , tries verify (after link clicked). have route set /account_activations/:id/edit and url sending: account_activations/$2a$10$gtxhcostrwnvmdmwawljk.wm1xgnicwxupkymin5orqvwrib%2ftnxy/edit?email=me%40gmail.com i have verified hash correct in several different testing scenarios. tells me cannot find route it. quoting closest thing (in terms of priority) as: edit_account_activation_path /account_activations/:id/edit(.:format) account_activations#edit the path in routes.rb looks like: resources :account_activations, only: [:edit] looks me should match though :id should act wildcard string. if needs more info let me know. understand why isn't working. thanks.

c# - How to run 2 async functions simultaneously -

i need know how run 2 async functions simultaneously, example check following code: public async task<responsedatamodel> datadownload() { responsedatamodel responsemodel1 = await requestmanager.createrequest(postdata); responsedatamodel responsemodel2 = await requestmanager.createrequest(postdata); //wait here till both tasks complete. return result. } here have 2 createrequest() methods runs sequentially. run these 2 functions parallel , @ end of both functions want return result. how achieve this? if need first result out of 2 operations can calling 2 methods, , awaiting both tasks `task.whenany: public async task<responsedatamodel> datadownloadasync() { var completedtask = await task.whenany( requestmanager.createrequest(postdata), requestmanager.createrequest(postdata)); return await completedtask; } task.whenany creates task complete when first task of of supplied tasks completed. returns 1 task completed can resu

ios - Xcode Constraints -

i'm having problem xcode constraints. i'm laying out entire layout, selecting items , having xcode 'fill in missing constraints'. when run application in simulator, labels , textboxes not in right places. not visible @ (appear off screen) so there tips or tricks? should layout 1 item @ time, set constraints automatically move next? don't trust xcode , 'fill in missing constraints' feature. best option set constraints manually. after practice it's not hard. need indicate x , y coordinates , height/weight. i don't advice setting constraints automatically. causes more problems benefits. also check console log @ runtime. may happen there conflicts between constraints , need fix it. check out official guidlines

email - Loopback Verify User with lb-mandrill-connector: Uncaught AssertionError: template name should be defined -

i'm trying send email mandrill through loopback user.verify method i'm stucked in error: uncaught assertionerror: template name should defined googleing around found pr on loopback: https://github.com/strongloop/loopback/pull/1517/files but seems has not been merged brake travisci tests... from pr, tried workaround in code: let options = { type: 'email', port: '80', to: ac.email, from: app.get('emailfrom'), subject: 'thanks registering.', verifyhref: verifyhref, template: null, user: ac }; var template = loopback.template(path.resolve(__dirname, '../../server/views/verify.ejs')); options.html = template(options); but seems loopback set default template if no specified, suggestion? i'm running on loopback#2.18 the solution here not user.verify generate token , call user.save , proceed call mandrill. context.req.app.models.user.generateverificationtoken(user, function (err

text editor - To open Vim in specific ":" mode from terminal -

i use vim in inspecting data. start vim in specific ":" mode, instance processing binary data in terminal: xxd -ps r328_0000.raw > /tmp/1 && vim /tmp/1 :%s/ffff//gn | ? how can start vim in ":"-mode in terminal? you can -c option (or +) this: vim -c "%s/ffff//gn" vim +"%s/ffff//gn" from manpage: +{command} -c {command} {command} executed after first file has been read. {command} interpreted ex command. if {command} contains spaces must enclosed in double quotes (this depends on shell used). example: vim "+set si" main.c note: can use 10 "+" or "-c" commands.

ios - Facebook Login without FBSDKLoginButton in Swift -

i trying add facebook login app. using fbsdkloginbutton comes own button , once login turns logout. don't want that. need add own button view. , in button's @ibaction want facebook login take place. code using is class viewcontroller: uiviewcontroller,fbsdkloginbuttondelegate { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. if (fbsdkaccesstoken.currentaccesstoken() != nil) { // user logged in, work such go next view controller. } else { let loginview : fbsdkloginbutton = fbsdkloginbutton() self.view.addsubview(loginview) loginview.center = self.view.center loginview.readpermissions = ["public_profile", "email", "user_friends"] loginview.delegate = self } } func loginbutton(loginbutton: fbsdkloginbutton!, didcompletewithresult result: f

asp.net mvc - Http Request Timeouts on Azure Web Apps -

we have collection of mvc 5 websites running on azure cloud hosting platform. have several different versions of environment these websites run (development, staging, production), , experiencing difficult troubleshoot issue. seems that, intermittently, when request made production environment, request rejected, or file served point of server timing out , aborting request. seems occur in production environment, , not appear happen in development or staging. given our websites started receiving traffic, production environment lesser used in case, not matter of machine being out of resources. also, have capability monitor resources of machine through web ui, , not see issues here. when configuring these systems, not have ton of control on how set up. end, it's unlikely there configuration difference between them, setup (presumably) image, , configured through web ui. settings on these systems same between them far can tell. ensure not issue of configuration of machine, have mi

performance - Speed up this MySQL query -

i have query getting slower , slower because there more , more records in table. i'm trying speed things up. database size: records: 1,200,000 data 22,9 mib index 46,8 mib total 69,7 mib the purpose of query counting number of records exist match conditions. conditions date (current date) , status number. see query below: select count(id) total order_process date(datetime) = curdate() , status = '7'; at moment, query taking 800ms. , need run query multiple times different dates. these in same script script execution going on 3 seconds @ moment. how can speed up? what have done: created indexes (index on status , datetime both don't speed query). tested innodb engine (which slower, reading on table) to make complete, below current table setup. create table if not exists `order_process` ( `id` int(11) not null auto_increment, `order_id` int(11) not null, `status` int(11) not null, `datetime` timestamp not null d

csv - PowerShell Shares ACL List -

i have script goes each file of 1 shared drive , lists acls, don't want go far because there millions of files , never finish (ran on day , got csv file on 6 gb). i tried using get-childitem *** doesn't seem work. appreciated. ideally, 2 levels deep nice. thx $erroractionpreference = "continue" $strcomputer = $env:computername $coldrives = get-psdrive -psprovider filesystem #if ($driveletter -eq "n:\") $startpath = "n:" get-childitem $startpath\*\*\ -recurse | foreach { $fullpath = get-item -literalpath (get-item -literalpath $_.pspath) (get-item -literalpath $fullpath).getaccesscontrol() | select * -expand access | select @{n='server name';e={$strcomputer}}, @{n='full path';e={$fullpath}}, @{n='type';e={if($fullpath.psiscontainer -eq $true) {'d'} else {'f'}}}, @{n='owner';e={$_.owner}}, @{n=

javascript - Page scroll to the bottom of a div -

how align bottom of div bottom of page on button click? similar using window.location.href = '#div1' align screen top of ' div1 ' <html> <head> </head> <body> <div id="div1" style="border: 1px solid #cccccc; position: absolute; background: #fa8258" onclick="window.location.href='#div2'"> div orange. click see div yellow. </div> <div id="div2" style="border: 1px solid #cccccc; position: absolute; top: 800px; background: #f4fa58" onclick="window.location.href='#div3'"> div yellow. click see div blue. want div @ bottom instead of top on click of div orange. </div> <div id="div3" style="border: 1px solid #cccccc; position: absolute; top: 1600px; background: #a9f5e1;" onclick="window.location.href='#div1'"> div blue. click se

jquery getting x values in sparkline -

i new jquery , trying make sparkline. want when mouse points point in graph, both x-value , y-value should seen. now, y-values visible. <script> $(document).ready(function () { $("#sparkline").sparkline([1, 4, 6, 6, 8, 5, 3, 5], { type: 'line', height: '200', width: '240', barwidth: 20, barspacing: 10, barcolor: '#615c5a', fillcolor:"white" }); }); </script> you can try this: $('#sparkline').sparkline([1, 4, 6, 6, 8, 5, 3, 5], { type: 'line', height: '200', width: '240', barwidth: 20, barspacing: 10, barcolor: '#615c5a', fillcolor:"white", tooltipformatter: function (sparkline, options, fields) { return "x: " + fields.x + " y: " + fields.y + "&

.net - sgen serialization assembly not signed -

Image
i have been reading past 2 days how make asmx web service first call quicker. after tracing , testing realized service doing nothing on initialize after reading couple of answers on matter, xmlserialization assembly make sense do, @ least tick 1 of possible solutions. the issue service third party service , have dll's service. tried generate xml serialization assembly error: generated serialization assembly not signed please specify strong name key file via/compiler:/keyfile switch not sure how. is possible extract xmlserialization assembly or need source code such task? does trying make sense or mislead or misunderstanding whole thing. appreciated. we had same issue sgen using hosted build controller. builds worked fine debug mode, not release . after reading related post made sense need turn off sgen serialization under project properties -> build -> output section release solution configuration ( or other non-debug solution configuration using ).

javascript - "this" variable not working when assigning JSONP array to AngularJS controller -

i have rest service call in angular controller via jsonp. want save returned array variable. here doing: this.testtherest = function() { $http.jsonp('myrestservice', { params: { callback: 'json_callback', format: 'json' } }) .success(function (data) { this.testlist = data.noparamsresult; console.log(this.testlist); }) .error(function (data) { alert(data); }); console.log(this.testlist); } i have defined testlist variable in controller beforehand: this.testlist = []; note 2 console output calls. problem is, first 1 shows correct array: array [ object, object ] but second 1 shows empty array (probably 1 initialization): array [ ] what have keep returned objects in array? thanks in advance, frank this scoping issue. try assigning outer this variable (e.g. tha

asp.net - Angularjs inlcudes an empty option in select -

i have dropdownlist data being bound dynamically way @ page_load: <asp:dropdownlist id="ddlset" datatextfield="title" datavaluefield="pksetid" runat="server" appenddatabounditems="true" ng-model="setid"></asp:dropdownlist> the rendered html : <select id="cpcontent_ddlset" ng-model="setid"> <option value="? undefined:undefined ?"></option> <option value="3">test3</option> </select> the option test3 should selected default when page loads, isn't happening. have set $scope.setid=3 , don't know value before hand. i see similar questions here dropdownlists data bound angular way, can set selected item $scope. how tackle this. either build server side asp application or build client side angular application, don't mix 2 technologies. let angular whole frontend logic , rendering , asp provide rest services

graphics - How to get the intersection point? Ray Triangle Intersection C++ -

i intersection point on triangle when ray go through it. followed on line tutorial , made function, not correct coordinates of intersection point. for example, should intersection point (0, 3, -1), if use ray origin (0, 2, -1), ray direction (0, 1, 0), triangle vertices p0 (0, 3, 0), p1 (-0.5, 3, -1), p2 (0.5, 3, -1). however, have got intersection point (0, 7, -1), not correct. i appreciate time , help. :-) float kepsilon = 0.000001; v3f crossproduct(v3f point1, v3f point2){ v3f vector; vector.x = point1.y * point2.z - point2.y * point1.z; vector.y = point2.x * point1.z - point1.x * point2.z; vector.z = point1.x * point2.y - point1.y * point2.x; return vector; } float dotproduct(v3f dot1, v3f dot2){ float dot = dot1.x * dot2.x + dot1.y * dot2.y + dot1.z * dot2.z; return dot; } //orig: ray origin, dir: ray direction, triangle vertices: p0, p1, p2. bool raytriangleintersect(v3f orig, v3f dir, v3f p0, v3f p1, v3f p2){ // compute plane's normal

java - Getting IndexOutOfBound Android -

i have made registration demo login functionality. while login credentials, give me indexoutofboundexception. below required code & error log you. login.java package com.example.registrationexample; import java.util.arraylist; import android.r.string; import android.support.v7.app.actionbaractivity; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; public class login extends actionbaractivity { edittext edt_txt_username, edt_txt_pwdactual; button btn_loginactual; arraylist<regusergetset> singleuserdata; sharedpreferences sp; public static string sharedpref = "sharedprefuserdata"; public static string userfullname =

arrays - How to parse a specific Netbackup bpimagelist format data file, records separated by empty line, each line with data label and label -

nbu bpimagelist data output format snippet here. a single record separated blank or empty line , each line contains variable length data label separated colon, random number of spaces, variable data content. single record can of variable length , not specific number of lines. i'd convert file comma separated format import excel in order analyze it. able extract data labels without problem. client: <hostname> backup id: <hostname>_1396674012 policy: m-portwarew2k03-prod-clf policy type: ms-windows (13) proxy client: (none specified) creator: root name1: (none specified) sched label: monthly_full schedule type: full (0) retention level: 5 weeks (4) backup time: sat apr 5 01:00:12 2014 (1396674012) elapsed time: 2448 second(s) expiration time: sat apr 3 01:00:12 2021 (1617426012) compressed: no client encrypted: no kilobytes: 37997291 number of files: 240819

exception - Method that fails loudly vs silently -

i have method (or function, or procedure, doesn't matter sake of question) void dostuff() . has depends on data , has side effects. also, valid operation in state; in other state operation can not performed. now, although i'm developing api, i'm thinking api used. there 2 typical situations operation performed: user code should've checked, if state valid, , implement custom logic of it's own if it's not. if code ends trying implement operation in invalid state means it's programmer error, , should reported , investigated. the client doesn't need custom logic in case, , doesn't need know if operation successful or not. to make api useful in both situations, want expose 2 variants of method: 1 dostuff() throw exception — or, let's say, use given language's capabilities report error loudly possible signify logic error. , other, trydostuff() , not error reporting @ all, , fail silently. so, have 2 questions: does sound idea cre

sql - Select all parents records in mysql -

table structure: id(int) title(varchar) parent(int) 1 accessories 0 2 man 1 3 women 1 4 watches 2 5 new watches 4 6 used watches 5 suppose if on forth or fifth level children category, how retrieve parent categories in query. want show breadcrumbs hierarchy. you can try with: select @start := id 'id', title, parent table1 join (select @start := 0) temp parent = @start , id <= 4; note without id < 4 check, you'll full tree "top" ( 0 ) "bottom" ( 6 ). checkout sqlfiddle , too.

c# - Not able to store information while postback after creating dynamic dropdown in ASP.NET -

here code after button 2 click event creating dropdown in table rows when try save button 1 click event disappear. have not find solution regarding this. have used find control view state etc it's not helping. i want store selected values of dropdown after button_1 click event starts. public partial class studentclasssectionmapping : system.web.ui.page { protected void page_load(object sender, eventargs e) { if(!ispostback) { classcode.enabled = false; } } protected void button2_click(object sender, eventargs e) { updatemodalshowflag.value = "true"; check.value = "true"; createtablerows(); } private void createtablerows() { long h = long.parse(linkbuttonidcarrier.value); list<studentsclasssectionmapping.studentsclasssectionmappingform> allstudentsinclass = studentsclasssectionmapping.getstudentsinclass(h);