Posts

Showing posts from March, 2015

javascript - Why is my angularjs multiselect interface not working? -

i angular newbie using multiselect directive isteven . i wrote test case , works fine html in root folder, when incorporated my app , none of drop-downs visible. there no console.log error messages. i bundled html , controller same file. the "myapp.controller('mainctrl', function ($scope, $http)" not executed although "var myapp = angular.module( "myapp", [ "isteven-multi-select" ]);" does. <html data-ng-app="myapp" id="myapp" lang="en"> <head> <title>writer's tryst - enablers form</title> <link type="text/css" href="css/enablers.css" rel="stylesheet" /> <link rel="stylesheet" href="css/isteven-multi-select.css"> </head> <body data-ng-controller="mainctrl"> <div class="container center_div"> <!--<form id=&quo

node.js - Change URL after POST using ExpressJS -

i use expressjs nodejs server. user sends me login info through post , after checking credentials render page: router.post("/login", function (req: request, res: response, next) { if(credentialsok){ res.render('main'); } }); the problem url becomes http://myaddress/login , remove /login of address. don't want use redirect want send local variables through render. how can change url? you can still pass local variables through res.redirect . router.post("/login", function (req: request, res: response, next) { if(credentialsok){ req.session.localvar = yourlocalvar; res.redirect('/main'); } }); then in main router: router.get("/main", function (req: request, res: response, next) { var yourlocalvar = req.session.localvar; res.render('main'); });

javascript - vuejs using elasticsearch api methods -

i have vuejs script , need use elasticsearch api method. // ./main.js var vue = require('vue'); vue.use(require('vue-resource')); import es './elasticsearch.js'; new vue({ el: 'body', methods: { search: function() { // should call es.search... } } }); and elasticsearch script: // ./elasticsearch.js var es = require('elasticsearch'); var client = new es.client({ host: 'localhost:9200' ,log: 'trace' }); client.search({ index: 'my_index', type: 'my_type', body: { fields: {}, query: { match: { file_content: 'search_text' } } } }).then(function (resp) { var hits = resp.hits.hits; }, function (err) { console.trace(err.message); }); so, in method search in main.js should call client.search , send text searched in server (_search_text_). how bind it? or how use elasticsearch object inside vuejs meth

mocking - Testing Pull Subscription in Java EWS API using PowerMockito -

i have function processes events obtained pullsubscription microsoft exchange. public void processevents(exchangeservice service, pullsubscription subscription) throws exception { geteventsresults events = subscription.getevents(); // loop through item-related events. (itemevent itemevent : events.getitemevents()) { if (itemevent.geteventtype() == eventtype.newmail) { emailmessage message = emailmessage.bind(service, itemevent.getitemid()); emailparser emailparser = new emailparser(); emailparser.parse(message, service); } } } i trying test using powermockito because exchangeservice final class. have mocked exchangeservice , pullsubscription follows: exchangeservice servicemock = powermockito.mock(exchangeservice.class); pullsubscription subscriptionmock = powermockito.mock(pullsubscription.class); @test public void startpullnotification() throws exception { processemails pr = new process

c++ - Detect terms in an expression using regex -

i want detect terms in polynomial expression x^2+3x-2 i want string seperated sub-strings @ '+' , '-'. in other words, want have terms seperately. simplify things, add '+' or '-' @ start of string if not present simplify things. +x^2+3x-2 now, need regex can detect terms seperately. need keep in mind there can many terms possible. i did try [+-]?(.+?) but since new regex, don't think within capability make work. i need help. please note in case, desired results : +x^2 +3x -2 thanks in advance! a regular expression can limited job state, joseph's answer shows. but if want handle more complicated expressions regex wont cut it. consider x^(-2)+3x-2 or unexpanded expression such as x^2+3(x-2)-2 these require parser: see regular expression vs. string parsing

css - Inherit text-shadow with units relative to a child element without selecting all children -

i want create text shadow element, , want children of element inherit shadow. issue relative units (i.e.: em, ex, ch) of inherited text-shadow relative calculated font-size of element created on (i.e.: parent element). also, understand that parent, parent * { text-shadow: 1em 2em 3em currentcolor; } will work fine, i'd prefer avoid * selector. don't want select every single child element, more importantly, don't want mess specificity. (how) possible? (i unable comment restriction of 50 poitns comments, hence question in answer tab & possible solution update based on answers:p) so @uber5001, question 1: clarity, selecting child elements or not? first line did say, want select child elements. , @ end of question said, don't want select children of parent element. sorry couldn't understand meant that. in jsfiddle provided in comments, adding text-shadow: 5em 0em 0em #999; #parent p:first-child gives desired effect. http://jsfiddle

python - How to detect if a printer is conected with pyqt? -

i'm programming in linux windows application. in moment need solution detect if default printer connected. have next code: def mprint(self, value): font = qfont() font.setpointsize(10) self.meditor = qtextedit() self.meditor.setfont(font) self.printer = qprinter(qprinterinfo.defaultprinter()) self.printer.setcolormode(qprinter.grayscale) self.printer.setpagemargins(7, 20, 7, 7, qprinter.millimeter) self.printer.setorientation(qprinter.portrait) try: if value == 1: self.printcommand() else: self.printdelivery() except self.printer.error e: print(e) with qprinterinfo can default printer , know if exists. qprinterinfo.defaultprinter().isnull() but returns true, because have default printer in pc if not connected, goes printer queue. does knows how recognize if printer connected , how show qmessage if there exception? i find solution: self.meditor = qtextedit() self.med

c# - WCF HTTPS Multiple Domains on Multiple NICs -

i have 2 wcf services on same machine i'm opening using following constructor: servicehost = new servicehost(proxy, ub.uri); ... servicehost.open(); the uri looks like: https ://proxy.company.com , https ://api.company.com each respective service. my machine has two network cards , 2 available ip addresses. i've set url acls using like: netsh http add urlacl url="https://proxy.company.com" user="user1" netsh http add urlacl url="https://api.company.com" user="user2" however, wcf still trying grab entire 443 ip space (e.g. https:// + :443) on machine, of course results in error both servicehosts can't possibly reserve entire ip space. is there way instruct wcf not try register https:// + :443 , instead request applicable url space (e.g. https://proxy.company.com instead of https://+443 , etc.)?

javascript - How to enable jquery to insert multiple row to database which include @Html.DropDownListFor in the table -

i'm new mvc , jquery when use dropdownlist in table, jquery code never work table without dropdownlist, code of jquery work perfect must edit in jquery code work perfect code <div><a href="#" id="addnew">add new</a></div> <table id="datatable" border="0" cellpadding="0" cellspacing="0"> <tr> <th>color</th> <th>windowtype</th> <th>height</th> <th>width</th> <th></th> </tr> @if (model != null && model.count > 0) { int j = 0; foreach (var item in model) { <tr style="border:1px solid black"> <td>@html.dropdownlistfor(m => m[j].color, (selectlist)viewbag.color)</td> <td>@html.dropdownlistfor(m => m[j].windowtype, (selectlist)viewbag.windowtype)&l

ios - Xcode error importing module not being imported -

i left xcode unsupervised weekend , come , it's telling me have missing modules corelocation , sqlite at: import sqlite import corelocation both giving me error missing required module 'csqlite' . i'm not sure getting "csqlite" in relation corelocation i have sqlite.xcodeproj added general page linked building fine couple days ago , absolutely nothing's changed. in swift, if want use sqlite, can either use modulemap feature of llvm import c library or can use cocoapods , import sqlite based third party pod.

ios - Cannot override method with a custom class return type -

is there method can use override method returns custom class? when tried override method custom class return type, xcode throws me error below codes: class customclass { var name = "myname" } class parent: uiviewcontroller { override func viewdidload() { methodwithnoreturn() print(methodwithstringasreturn()) methodwithcustomclassasreturn() } } extension parent { func methodwithnoreturn() { } func methodwithstringasreturn() -> string { return "parent methodwithreturn" } func methodwithcustomclassasreturn() -> customclass { return customclass() } } class child: parent { override func methodwithnoreturn() { print("can override") } override func methodwithstringasreturn() -> string { print("cannot override") return "child methodwithreturn" } override func methodwithcustomclassasreturn() -> customclass { return customclass() } } the error when overrid

php - MySQL WHERE IN () + AND , PDO returns only one row -

following query returns wanted results if entered in phpmyadmin: select postid, voting postvotes userid = 1 , postid in (1007,1011,1012,1013,1014, 1015,1016,1017,1018,1019,1020,1021,1023,1025,1026, 1027,1028,1029,1030,1031) but pdo fails fetchall(). returns first match fetch(). what's wrong? php code: private function userpostvotings( $postids ) { // $postids contains string 1,2,3,4,5,6,7... // generated through implode(',', idarray) try { $userpostvote = $this->_db->prepare('select postid, voting postvotes userid = ? , postid in ( ? )'); $userpostvote->setfetchmode(\pdo::fetch_assoc); $userpostvote->execute( array( $this->_requester['id'], $postids ) ); while ( $res = $userpostvote->fetch() ) { var_dump( $res ); } } catch (\pdoexception $p) {} } if echo out query used in method , fire

php - Unset attribute value for a specific product magento -

i have attribute "clothes" multiselect options "skirt","pant","cargos"... the attribute id's say, skirt-198 pant-199 cargos-200 i have tag collection of products attribute skirt, way, $collection->setclothes('198'); $collection->save(); now want tag same collection attribute pant well, if use, $collection->setclothes('199'); it overwrites , product tagged pants , not both skirts , pants. i need in rightly tagging product multiple attributes(when multiselect used) and case where, have product tagged skirts , want untag skirts. i have tried best. can pls me solve this. have tried $collection->setclothes(array('198','199')); ? and untag, have to: $tags = $collection->getclothes(); //let's have 5 tags.. 192, 193, 194, 199, 198. $tagstoremove = array('194','199'); $collection->setclothes( array_diff($tags, $tagstoremove) );

php - Dealing with url request in CodeIgniter -

i started learning codeigniter , must pretty easy have problem dealing wrong urls, example: if have anchor tag http://example.com/info/2 in controller if have public function info( $x ) { $data['body'] = "personal_info"; $data['details'] = $this->person_model->get_detail( $x ); $this->load->view('view', $data); } the controller grabs links segment (3) and grab details of id database. instance if user manually edit link on browser , change segment(3) to lets 7 , there no id in database 4. how handle such problem? beginner please pardon me you use empty method check if there data , if not redirect away page. public function info( $x ) { $details = $this->person_model->get_detail( $x ); if(empty($details)) redirect('other/url'); $data['body'] = "personal_info"; $data['details'] = details; $this->load->view('view',

javascript - angularjs find properties of div in directive -

new angular, new stackoverflow. been trying solve days. here problem: i want center group of boxes. is there way access properties of div's (with id or class names) , manipulate them in directive? in html creating divs ng-repeat, divs boxes displayed. have directive i, now, trying use find , manipulate properties of div's/directives in html, can't seem this. i have googled lot , have found similar issues nothing seems work in code. here's fiddle: http://jsfiddle.net/3m87r/ app.directive('someboxes', function() { return function(scope, element, attrs) { element.css('border', '1px solid white'); //element.css('width', '200px'); var body = angular.element(document).find('.bookitem'); console.log(body[0].offsetwidth); if(scope.$last) { //console.log("element name is: " + element.attr("class")); //console.log(&q

c++ - Assertion failed : area > 1.19209 -

Image
i'm getting weird error when run program uses box2d unexpected because it's in file related project(unbuilt folder not linked project). obtained copy box2d vs12 , built project , setup-ed project following tutorial here: https://www.youtube.com/watch?v=keclrfkygkw&list=plspw4asqyyymu3pfg9gxywspghnsmioaw&index=53 here's code: void box::init(b2world* world, const glm::vec2& position, const glm::vec2& dimensions) { m_dimensions = dimensions; b2bodydef boxdef; boxdef.type = b2_dynamicbody; boxdef.position.set(position.x, position.y); m_body = world->createbody(&boxdef); b2polygonshape boxshape; boxshape.setasbox(position.x / 2.0f, position.y / 2.0f); b2fixturedef fixturedef; fixturedef.shape = &boxshape; fixturedef.density = 1.0f; fixturedef.friction = 0.3f; m_fixture = m_body->createfixture(&fixturedef); } where i've called init() : b2vec2 gravity(0.0f, -9.8f); m_w

Get android:padding attribute programmatically -

from view, how can value of android:padding attribute programmatically? using: private static final string android_namespace = "http://schemas.android.com/apk/res/android"; private static final string attribute_padding = "padding"; public activitywrapperview(context context, attributeset attrs) { super(context, attrs); int padding = attrs.getattributeintvalue(android_namespace, attribute_padding, -1); } this returns -1, have tried using "android:padding" attribute name -1 still returned. edit: requirement: when android:padding value specified in layout xml, view use padding. if padding not specified use default padding the easiest way use android.r.styleable, if had had been available. same way uses getting custom attributes. r.styleable class contains int arrays of attributes values. need create own int array, contains int values of atributes need. public activitywrapperview(context context, attributeset attrs) { super(co

c# - can we change persistent workflow bookmark? -

i have long running workflow on iis persistent bookmarks on sql server. sometimes, want restart workflow persistent instance. example, assume workflow 2 sequential bookmarks. start workflow entity instanceid = 'instance01' , moves second bookmark. now, though 'instance01' waiting external call of second bookmark need restart workflow instance. can restart workflow instance? or can change persistent bookmark instanec?

Convert Excel Formula to VBA code -

could please advise how convert formula vba code =sumproduct(subtotal(3,offset((at2:at644),row(at2:at644)-min(row(at2:at644)), ,1)) * (at2:at644="6")) i this, question how use "offset" in current code? application.worksheetfunction.sumproduct(application.worksheetfunction.subtotal(3, application.range.offset(("at2:at644"), application.rows("at2:at644") - application.worksheetfunction.min(application.rows("at2:at644")), , 1)) * ("at2:at644" = "6")) thanks, regards, lure migrated comment... debug.print sheet1.evaluate("sumproduct(subtotal(3,offset((at2:at644),row(at2:at644)-min(row‌​(at2:at644)), ,1)) * (at2:at644=""6""))") or whichever sheet need use, don't use application.evaluate unless want evaluate in context of activesheet.

java - Spring MVC : autowiring a controller in another controller -

i have 2 controllers loginviewcontroller , userviewcontroller @controller public class loginviewcontroller { @autowired private userviewcontroller userviewcontroller; //can't autowire, since spring creates proxy userviewcontroller class @requestmapping(value="/login", method=post) public string login(){ //username , password checking etc if(login_successfull){ //when login successfull, need redirect screen user dashboard model.addattribute("loginmessage", "you loggined successfully") return userviewcontroller.viewdashboard(userid); } } } @controller @requestmapping("/user") public class userviewcontroller { @autowired private userservice userservice; @requestmapping(value="/dashboard", method=get) public string viewdashboard(model model, @requestparam(value="id", required=true) long userid){ //fetch

c# - How to display the values from an app.config file -

i have loop increments , display increment number when mouse hovers on button. values each button stored in app.config file.how use incremented value show correct value name? current code public void controls() { (int = 1; <= applications; i++) { string iconpath = configurationmanager.appsettings["application"+i+"_icon"]; button button = new button(); this.controls.add(button); top += button.height+25; button.tag = i; button.mousehover += button_mousehover; button.mouseleave += button_mouseleave; button.visible = true; button.click += new eventhandler(button_click); } app.config : <appsettings> <add key="applications" value="3" /> <add key="catergory" value="1"/> <add key="application1_name" value="word"/> <add key="application1_executable_name" value="word

c# - Iwant to add Radio button Image inside a pdf document Dynamically by replacing the content using content.replace("String","string menhod) -

protected void btncreatepdf_click(object sender, eventargs e) { // create document object var document = new document(pagesize.a4, 50, 50, 25, 25); // create new pdfwrite object, writing output memorystream var output = new memorystream(); var writer = pdfwriter.getinstance(document, output); // open document writing document.open(); // read in contents of receipt.htm html template file string contents = file.readalltext(server.mappath("~/htmltemplate/receipt.htm")); // replace placeholders user-specified text contents = contents.replace("[orderid]", txtorderid.text); contents = contents.replace("[totalprice]", convert.todecimal(txttotalprice.text).tostring("c")); contents = contents.replace("[orderdate]", datetime.now.toshortdatestring()); var itemstable = @"<table><tr><th style=""font-weight: bold"">item #</th><th s

r - Repeating tk_choose.files to import multiple .csv files multiple times -

i using sapply(tk_choose.files) produce interactive window can choose .csv files (multiple) import. basic data manipulation mean of 1 particular column can plotted using ggplot. so far code looks this: >tfiles <- data.frame(sapply(sapply(tk_choose.files(caption="choose t files (hold ctrl select multiple files)"), read.table, header=true, sep=","), c)) >rfiles <- data.frame(sapply(sapply(tk_choose.files(caption="choose r files (hold ctrl select multiple files)"), read.table, header=true, sep=","), c)) i have calculated mean of particular column both tfiles , rfiles plot 100-tfiles-rfiles . while working fine 1 set of data, import more sets of data, preferably using sapply(tk_choose.files) . need t/rfiles1 , t/rfiles2 ...and repeat data manipulation process after that, plot of multiple sets of data. have no idea how without having copy , paste code! sorry if stupid question, new r stuck, appreciated! assuming

android - Setting alpha to bitmap in XML drawable not working on API Level 20 and below -

i setting alpha bitmap in xml (selector) , working fine on api level 23 , 22 , 21 doesn't work on api level 20 , below api levels . <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!--state selected--> <item android:drawable="@drawable/item_selected" android:state_selected="true"/> <!--state normal--> <item > <bitmap android:src="@drawable/item_selected" android:alpha="0.6"/> </item> edit please suggest me alternatives using xml . setting alpha programmatically work. try this. i have tried selector background of imageview : <imageview android:id="@+id/imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/select" /> my java code : imageview = (imageview)findviewbyid(r.id.imageview); imageview.setalpha(0.

sql - Condition in Mysql while selecting data form different tables -

i have code , working perfectly, have added 2 new columns in orders table in database: guest_user ('y'/'n' ) guest_phone what want if guest_user 'y' don't have users.email replace orders.guest_phone . how this. can fix please.... select distinct orders.id 'order id', users.email 'email', orders.price 'amount', orders.city_sj 'city', orders.order_from 'web/app', orders.payment_status 'cod/pwc', orders. @ 'date , time' users, orders, order_history users.id = order_history.uid , orders.id = order_history.oid , orders. real = 1 , orders.price > 1 , orders. status = 1 order orders.id; running above code getting below type of output: enter image description here thanks something should job want: select distinct orders.id 'order id', if(orders.guest_user = 'y', orders.guest_phone, users.email) 'phone

android - Toolbar overlaps activity under coordinate layout -

in activity viewpager , 3 fragments, want auto hide toolbar . this, using android.support.design.widget.coordinatorlayout . but viewpager giving me problem. if in coordinatelayout , toolbar overlaps activity. if outside coordinatorlayout toolbar activity not overlap webview activity. if viewpager outside coordinatorlayout , auto-hide not work. any appreciated. activity_main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity"> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-

javascript - Defining path tree in Node application -

ive got node.js application gulp has deep directory structure 5 levels. unfortunately, couldn't find better way define paths gulp build. started doing following, var path = require('path'), _joinpaths = function (parent, subpath) { return parent.dir ? path.join(parent.dir, subpath) : subpath; }, _subpath = function (parent, propname, subpath) { subpath = subpath || propname; parent[propname] = { dir: _joinpaths(parent, subpath) }; }, _entrypath = function (parent, entrypath) { parent.entry = _joinpaths(parent, entrypath); }, _pathpattern = function (parent, includes, excludes) { }; function paths() { var paths = {}; _subpath(paths, 'src', './'); _subpath(paths.src, 'lib'); // define more paths }; so in end can access paths paths.src.lib example. however, looks way cumbersome. there has better way achieve same thing. can give advic

Pagination With Php using Redis DB -

i want display list of customers pagination .structure of db follow: redis:> hset customerlist username userid (where username:almas userid:1) redis:> hmset customerlog:1 userid value1 name value2 contactno value3 (where value1:1 , value2: almas sayyad, value3: 8676756556) i have used hash set , want continue same datatype. greatfull if 1 can give me solution this. tl;dr paginating hash isn't trivial - should consider using different data structure more suitable task, namely sorted set. hashes have no order , way sanely iterate fields hscan . however, scanning unordered, can return duplicates , number of results each call varies - building pagination mechanism on top of challenging , inefficient. you can keep data, i.e. users, in hash, store field names in sorted set well. can give each user score order them or use lexicographical ordering - either way, you'll able paginate sorted set.

database - Issue with "Exceeded Data Storage" limit in one of my Salesforce Instance -

i have issue "exceeded data storage" limit in 1 of salesforce orgs . possible solutions: buy additional data storage space salesforce. delete unwanted data , archive remaining data on periodic basis on business needs in external database . provision access archived data salesforce whenever want to. retrieval of data display of data in salesforce my questions: there has code written in salesforce pushing data salesforce external database during archival, have write code @ database level store , retrieve data? if answer "no" can suggest affordable cloud database options operation can done seamlessly? 1)how external storage knew fields want export or salesforce fields @ all... export csv salesforce , create extrenal storage objects yourself. try match salesforce fields far can if want resore them easy you. regarding options mention,just small clarification (option #1): know there 2 ways buy more data : 1- licences (just math because

c# - Setting dialog button clicklistener in Android Xamarin -

i want display dialog alert in xamarin android app (c#), , want stuff dialog when click on buttons. from before, use code: alertdialog.builder builder = new alertdialog.builder(this) .settitle("delete") .setmessage("are sure want delete?) .setpositivebutton("no", (senderalert, args) => { }) .setnegativebutton("yes", (senderalert, args) => { databasehelper.delete(item); }); builder.create().show(); to make random example, lets want keep dialog box open until item deleted, want disable yes button , change message text while android working. possible code have access dialog , change it? neither senderalert nor args have useful properties or methods. i have been looking other ways build dialog, , have seen these two: 1) this guy using way bellow, dialoginterface not have .onclicklistener() builder.setpositivebutton("test", new dialoginterface.onclicklistener() { @override public void onclick(di

php - how to filter by tags in Mailgun API -

so want filter tags in query string : $querystring = array( 'begin' => $begin, 'ascending' => 'yes', 'pretty' => 'yes', 'tags' => 'my tag' ); but got error the parameters passed api invalid. check inputs! , changed 'tags' => ['my tag'] , still got same error, so please if has idea appreciative. i don't think it's supported longer, or broken. tried several notations.

performance - AWS network latency is high -

i provisioned 2 i2.8xlarge vms on aws , should have 10g network said on portal. but when run iperf3 test (with "-p 64", means run 64 tcp connections) on vms, gave me ~5gbps throughput. @ same time when running iperf3, icmp ping latency relatively high (about 19ms ). //by way, iperf3 1 tcp connection, gave me best throughput number, 7gbps. do miss configuration/setting aws deployment not able high throughput , reasonable low latency? thanks!

java - Hibernate multiple attribute mappings same table deletion -

i have simple problem in hibernate. have users , projects. users_projects (in case user_project_association) has attribute "role" if user project leader or normal user. @onetomany(mappedby = "project", cascade = cascadetype.all, orphanremoval = true, fetch = fetchtype.lazy) @lazycollection(lazycollectionoption.extra) private set<userprojectassociation> userprojectassociations = new hashset<>(); @manytomany(fetch = fetchtype.eager) @jointable(name = "user_project_role", joincolumns = @joincolumn(name = "project_id", referencedcolumnname = "id"), inversejoincolumns = @joincolumn(name = "user_id", referencedcolumnname = "id")) @wherejointable(clause = "role_id=7") @setter(accesslevel.none) private set<user> projectleaders = new hashset<>(); @manytomany @jointable(name = "user_project_role", joincolumns = @joincolumn(name = "project_id"

How to create PHP code for this JSON -

simple way create php part json code { "contacts": [ { "id": "c200", "name": "ravi tamada", "email": "ravi@gmail.com", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } }, { "id": "c201", "name": "johnny depp", "email": "johnny_depp@gmail.com", "address": "xx-xx-xxxx,x - street, x - country"

c++ - VS2015 vector iterator not dereferencable -

i have little problem, have build 2d game based on sdl. i keep getting errror when try delete 2 objects colliding in "scene". std::vector<waspobject*>::iterator itw; std::vector<projectileobject*>::iterator itp; (itp = _projectiles.begin(); itp != _projectiles.end();) { (itw = _wasps.begin(); itw != _wasps.end();) { if ((*itw)->get_positiony() + 37 >= (*itp)->get_positiony() + 0 && (*itp)->get_positionx()+0 >= (*itw)->get_positionx()+0 && (*itp)->get_positionx()+0 <= (*itw)->get_positionx()+49) { itw = _wasps.erase(itw); itp = _projectiles.erase(itp); } else { itw++; itp++; } } } _wasps , _projectiles std vectors in scene. can me find problem? in advance! if don't hits , increment itp in inner loop, might run past _projectiles.end() . for example if there more wasps projectiles. or if on

jquery - Overriding existing code for AJAX form handling -

the following code taking effect on pages, ajaxing form submissions. there default behaviour handling successful response. my question how can override default behaviour without modifying code? still want ajax submission , validation want different on successful response. $('form').each(formhandler); function formhandler(){ $(this).validate({ submithandler : function(e){ var $form = $(this.currentform), ajaxevent = $.event("submitstart"), successevent = $.event("submitsuccess"), errorevent = $.event("submiterror"); $form.trigger(ajaxevent); if (!ajaxevent.isdefaultprevented()) { $.ajax({ type: 'post', datatype: 'json', url: $form.attr('action'), data: $form.serialize(), complete: function(ajax){ },

Python programming with Eclipse+Pydev code assistant without sources -

i'm using eclipse+pydev plugin develop python applications using proprietary python framework. how can set code assistant in ide without having framework sources available? there open source tool generate documentation stub sources files , make readable pydev plugin without need of having these sorces in project? have ideas? thank you, alessandro well, if you're developing against it, should have @ least .pyc/.pyd files, so, make sure add proper folder containing pythonpath , add needed entries forced builtins ( http://www.pydev.org/manual_101_interpreter.html has instructions). if that's not enough (i.e.: pydev can't discover needed info introspection live interpreter), can create file provide "predefined completions" (again, http://www.pydev.org/manual_101_interpreter.html has instructions that).

vba - Macro for saving emails from outlook - Sender name query -

so, organisation work requires all project or task related emails saved, part of formal process, in specific name format: yymmdd-hhmm-sendername-recipientname-subject.msg we're not allowed use .pst files reason can imagine, doing individually tedious in extreme, , lazy, decided try , automate helpful macro. intensive googling led me create following website called slipstick: option explicit public sub savemessageasmsg() dim omail outlook.mailitem dim objitem object dim spath string dim dtdate date dim sname string dim enviro string dim strfolderpath string enviro = cstr(environ("userprofile")) strfolderpath = "desktop location here" each objitem in activeexplorer.selection if objitem.messageclass = "ipm.note" set omail = objitem sname = omail.subject replacecharsforfilename sname, "-" dtdate = omail.receivedtime sname = format(dtdate, "yyyymmdd", vbusesystemdayofweek, _ vbusesy

python - How could I infuse elements with other elements in an xml using Minidom? -

i'm using minidom python 3.5 the original xml data looks this: (# of beat , editdata_score node/tags fixed (in case 3 each). <editdata_score> <editdatatype>beat_score</editdatatype> <spot>20</spot> <time>7</time> <type>x</type> <beat> <editdatatype>beat_mark</editdatatype> <spot>26</spot> <beatlength>4.84472036</beatlength> </beat> </editdata_score> <editdata_score> <editdatatype>beat_score</editdatatype> <spot>36</spot> <time>10</time> <type>x</type> <beat> <editdatatype>beat_mark</editdatatype> <spot>48</spot> <beatlength>4.84472036</beatlength> </beat> </editdata_score> as can see, beat elements nested in editdata_score elements. , spot node's value increasing. want consolidate editdata_score elements, add minor alterations put , redistribute beats wi

Android - Wizard with multiple fragments - Back button behavior -

Image
imagine have mainactivity shows list of tasks. can add new task list clicking standard fab button. after new wizardactivity starts. adding new task 3 step process (each step single fragment): i need advice button behavior arrow in toolbar. let's i'm in step 2 , should on pressed? move step 1 or close activity? what's best ux pattern here? maybe should remove additional back , next buttons , move them toolbar (kinda on ios)? want right, intuitive. you can consider use button of device navigate step 3->step2->step1. if in step1 close activity. also don't forget save instance of fragment in step1 , step2 when user go previous fragment edit he/she not have give data again. instead of using external back/next button put next button each of fragment , let user choose go previous fragment using tab or pressing hardware button.

java - How to verify text in message generated by Constraint Validation API in HTML5? -

i test web application uses html5 constraint validation api generate error pop-ups. how verify text in pop-ups in selenium tests? cannot find appropriate locators. as per link provided sample html code snippet address problem : <form id="myform"> <input id="eid" name="email_field" type="email" /> <input type="submit" /> </form> i have gone through above html source , looked ,but there no html source code in source code validation message generates after clicking on "submit query". however can guide throw workaround work if had worked when have error message. please understand way: 1.please observer source code of input boxes constraint validation api in html5? 2.you see attribute defines type of data can take in our example attribute name , type. 3.they both above html code take input in form of email only. 4.so logic check value entered in input box of type of email or not

laravel - Build a multi level array from a has many relationship -

i building basic cms in laravel 5.2. i have 'pages' model. model has 'has many' relationship page can have many sub pages , sub page can have many sub sub pages etc. my model defined such: class page extends model { public function children() { return $this->hasmany('app\page', 'page_parent'); } } my database so +----+-----------------+------------------------+------------+-------------+ | id | title | description | project_id | page_parent | +----+-----------------+------------------------+------------+-------------+ | 1 | overview | overview page | 1 | 0 | | 2 | overview sub | child page | 1 | 1 | | 3 | young page | kiddy page | 1 | 2 | +----+-----------------+------------------------+------------+-------------+ then in controller have: public function index() { $pages = page::with('children')

angular - How to avoid adding prefix “unsafe” to link by Angular2? -

this question has answer here: in rc.1 styles can't added using binding syntax 1 answer using angular2, there setting avoid adding prefix “ unsafe: ” links. need set links protocol not whitelisted default in angular2, needed our internal applicaion, result invalid link: <a href="unsafe:notes://myserver/c1256d3b004057e8" .. in older angular there compileprovider.ahrefsanitizationwhitelist, cannot find similar in angular2. use domsanitizer : import {domsanitizer} '@angular/platform-browser'; ... constructor(private sanitizer:domsanitizer){} ... let sanitizedurl = this.sanitizer.bypasssecuritytrusturl('notes://myserver/c1256d3b004057e8'); or create method return sanitized url: sanitize(url:string){ return this.sanitizer.bypasssecuritytrusturl(url); } and in template: <a [href]="sanitize('notes://mys

hibernate - Adding the JPA @OrderColumn afterwards causes null index column for collection error -

let's say, have @onetomany relation entities , b. each can have many b. @entity public class a{ @id private long id; ... @onetomany(mappedby="ref") private list<b> items; ... } @entity public class b{ @id private long id; @manytoone @joincolumn(name = "a_id") private ref; } this application in production time , order of bs saved db not relevant till now. however, exact order of bs required. this, have added @ordercolumn below. @onetomany @ordercolumn(name="b_order") private list<b> items; it works fine , b table has b_order column order values. now production db needs updated. new column b_order has been added table b. however, existing rows, column has no value (null). when try retrieve list of bs existing record, following exception: org.hibernate.hibernateexception: null index column collection it ok have list of bs in order old records. @ordercolumn has property "nullable" default tr