Wednesday 15 May 2013

django - Have multiple accpunts on the same provider in python-social-auth -



django - Have multiple accpunts on the same provider in python-social-auth -

i using python-social-auth bundle authenthication in django site. want users able associate multiple social accounts on django account. if phone call social:begin view when user logged in business relationship same provider, nil , logs in old account. there way tell forcefulness adding of new business relationship provider?

thanks.

you need tell provider want show user "select account" form 1 time again (when possible, since provider dependent), or inquire user logout original business relationship if wants add together association.

for example, google-oauth2 can adding setting

social_auth_google_oauth2_auth_extra_arguments = { 'prompt': 'select_account' }

you can play other option:

social_auth_google_oauth2_auth_extra_arguments = { 'approval_prompt': 'force' }

python django python-social-auth

cakephp - Array to string Error while uploading an Image -



cakephp - Array to string Error while uploading an Image -

i trying upload image using cakephp , got next error :

notice (8): array string conversion [core\cake\model\datasource\dbosource.php, line 1009]

<?php echo $this->form->create('user',array('type'=>'file')); echo $this->form->input('profile_pic', array('type'=>'file')); echo $this->form->end('submit'); ?>

anything wrong i've did ?

you study cakephp manual how form type can file ?????? :)

use

<?php echo $this->form->create('user',array('enctype'=>'multipart/form-data')); echo $this->form->input('profile_pic', array('type'=>'file')); echo $this->form->end('submit'); ?>

cakephp image-uploading

javascript - Slide div in from right -



javascript - Slide div in from right -

i have next code in shopify theme.

<script language="javascript"> function setvisibility(id) { if(document.getelementbyid('opensign').value=='hide layer'){ document.getelementbyid('opensign').value = 'show layer'; document.getelementbyid(id).style.display = 'none'; }else{ document.getelementbyid('opensign').value = 'hide layer'; document.getelementbyid(id).style.display = 'inline'; } } </script>

can add together boxes slided in right? code boxes below:

<a href="#" id="opensign" onclick="setvisibility('sign');";>sign in</a> <div id="sign"> blaslasd. </div>

you can utilize css class hiding, should added beginning:

.hide { left: 100%; opacity: 0; }

and class transitions:

.animated { transition: left 1s; -webkit-transition: left 1s; }

then in javascript, add together , remove hide class. can see demo on codepen here.

javascript html css

java - How to use getConstructor with Generic class? -



java - How to use getConstructor with Generic class? -

this first brush reflection , generics in java please pardon ignorance. trying instantiate class using reflection , generics getting error in toy program. goal instantiate constructor of inst class.

code:

/* *this builder class build instance */ bundle generics.expclasst; import java.lang.reflect.constructor; import java.lang.reflect.invocationtargetexception; public class builder { public static<e> e createinst(class<e> c) throws instantiationexception, illegalaccessexception { //class<?>[] type = new class<?>[1]; //type[0] = inst.class; seek { constructor<e> ctor = c.getconstructor(c); //c.getconstructor(type); homecoming (ctor.newinstance("testing")); } grab (nosuchmethodexception | securityexception | illegalargumentexception | invocationtargetexception e) { e.printstacktrace(); homecoming null; } } } /* * class need instance */ bundle generics.expclasst; public class inst { private string var; public inst(string s) { this.var = s; } public string getvar() { homecoming var; } public static void main(string args[]){ inst instobj; seek { instobj = builder.createinst(inst.class); system.out.println(instobj.getvar()); } grab (instantiationexception | illegalaccessexception e) { //e.printstacktrace(); } } }

exception:

java.lang.nosuchmethodexception: generics.expclasst.inst.<init>(generics.expclasst.inst) @ java.lang.class.getconstructor0(class.java:2800) @ java.lang.class.getconstructor(class.java:1708) @ generics.expclasst.builder.createinst(builder.java:15) @ generics.expclasst.inst.main(inst.java:19) exception in thread "main" java.lang.nullpointerexception @ generics.expclasst.inst.main(inst.java:20)

thank in advance time , assistance!!

constructor<e> ctor = c.getconstructor(c); should constructor<e> ctor = c.getconstructor(string.class);

from javadocs

returns constructor object reflects specified public constructor of class represented class object. parametertypes parameter array of class objects identify constructor's formal parameter types, in declared order. if class object represents inner class declared in non-static context, formal parameter types include explicit enclosing instance first parameter. constructor reflect public constructor of class represented class object formal parameter types match specified parametertypes.

parameters: parametertypes - parameter array

this, basically, means, getconstructor(class...) expects pass class types have been defined classes constructor, in case public inst(string s)

builder import java.lang.reflect.constructor; import java.lang.reflect.invocationtargetexception; public class builder { public static <e> e createinst(class<e> c) throws instantiationexception, illegalaccessexception { //class<?>[] type = new class<?>[1]; //type[0] = inst.class; seek { constructor<e> ctor = c.getconstructor(string.class); //c.getconstructor(type); homecoming (ctor.newinstance("testing")); } grab (nosuchmethodexception | securityexception | illegalargumentexception | invocationtargetexception e) { e.printstacktrace(); homecoming null; } } } inst public class inst { private string var; public inst(string s) { this.var = s; } public string getvar() { homecoming var; } } main public class test { public static void main(string[] args) { inst instobj; seek { instobj = builder.createinst(inst.class); system.out.println(instobj.getvar()); } grab (instantiationexception | illegalaccessexception e) { //e.printstacktrace(); } } }

you might have read through code conventions java tm programming language, create easier people read code , read others

java generics reflection

PHP Private Static Function -



PHP Private Static Function -

i junior php programmer. still have lot learn. that's why inquire question. in class have public function can phone call outside class. have private function can phone call several times in class private function resides, reusable purpose. set private function static , phone call function with:

self::privatefunctionname();

by using self reminds me private function resides in class. if utilize $this->privatefunctionname() non-static function, in superclass/base class or in subclass itself. why utilize static private function. in professional point of view, thought utilize static private function instead of non-static? there disadvantage professional programmer prefers avoid static function?

only using self::... must not mean method static. parent:: , self:: work non-static methods. can find in php manual - scope resolution operator (::) , add together exemplary code excerpt @ end of answer.

you perhaps might want read through answers of before question:

when utilize self vs $this?

in total there more details short description in answer.

you might have been confused scope-resolution-operator :: used those. had similar understanding problem grasping that.

however, not take utilize static methods such limited reason. static class methods should used in limited , narrowed situations. rule of thumb:

"do not utilize static class methods."

if start object oriented programming, utilize normal object methods.

here excerpt existing code shows self:: parent:: used standard (non-static) methods:

<?php ... /** * class xmlelementiterator * * iterate on xmlreader element nodes */ class xmlelementiterator extends xmlreaderiterator { private $index; private $name; private $didrewind; /** * @param xmlreader $reader * @param null|string $name element name, leave empty or utilize '*' elements */ public function __construct(xmlreader $reader, $name = null) { parent::__construct($reader); $this->setname($name); } /** * @return void */ public function rewind() { parent::rewind(); $this->ensurecurrentelementstate(); $this->didrewind = true; $this->index = 0; } /** * @return xmlreadernode|null */ public function current() { $this->didrewind || self::rewind(); $this->ensurecurrentelementstate(); homecoming self::valid() ? new xmlreadernode($this->reader) : null; } ...

php static-methods static-function

With Meteor, how do I store a file upload's input value to be retrieved on form submit? -



With Meteor, how do I store a file upload's input value to be retrieved on form submit? -

i have form:

<form> <input type="text" placeholder="name"> <input id="picture" type="text" placeholder="/images/picture.png"> <input type="file"> <button type="submit">save changes</button> </form>

now i'm using bootstrap file upload , form much more complex demo purposes stripped down. file input area displays in 2 different ways conditional:

{{#if profile.picture}} shows version of file upload has thumbnail of picture. has button remove/change picture. {{else}} shows fresh upload because profile.picture info empty. {{/if}}

helper

template.profile.helpers({ profile: function() { homecoming profile.findone(id); } });

so can see how i'm using spacebars determine show in page.

events

template.profile.events({ "change #picture-select input": function(event, template) { var fileslist = event.currenttarget.files; if (fileslist.length) { $('#picture').val("/images/" + fileslist[0].name); } else { $('#picture').val(""); } } });

so can retrieve files , send them methods save file , update document. no problem far.

so problem i'm facing is, proper way on form submit, , not when file input changes?

logic:

"submit form": function(event, template) { // perform file upload if fileslist has length ( in input file upload ) // also, best way retrieve this? did in "change #picture-select input" function });

i tempted utilize traditional methods via jquery parse through form, have gut feeling should using type of reactively stored true/false/fileslist value somewhere can retrieve using events/rendered/callbacks/some type of method.

i tried looking @ event.target on save, embedded/massive amounts of arrays overwhelming through.

so guess question is, should doing on the:

"change #picture-select input": function(event, template) {});

to have proper info stored query against on forms submit?

hope made sense... perhaps i'm making complex.

thank you.

if i'm not mistaken, don't need reactive variable this.

you declare var @ top of file , global file (so no worries polluting global namespace). whenever "change" event runs, set var value of event.currenttarget.files, , can access in "submit" event normal variable.

meteor

SQL filetype commands not working in vim (filetype detected correctly) -



SQL filetype commands not working in vim (filetype detected correctly) -

there various features fo sql filetype plugin mentioned in helpfile not seem work me. have installed next files in right places (all called sql.vim)

syntax - http://www.vim.org/scripts/script.php?script_id=498 ftplugin - http://www.vim.org/scripts/script.php?script_id=454

was necessary? syntax highlighting correct, should in help files default require downloading plugins?

anyway, example, functions [[,]],[] , ][ not work described, , :sqlsettype not recognised command. need more enable these?

thank in advance help

the sql syntax , filetype plugins david fishburn indeed distributed vim runtime; need install them ~/.vim/ directory if want newer version delivered current vim version. (so usually, no.)

if syntax working filetype definitions aren't, you're missing

:filetype plugin indent on

in ~/.vimrc. can check :scriptnames output , :verbose nmap ]].

sql vim

objective c - How to integrate Chartboost IOS SDK with Swift -



objective c - How to integrate Chartboost IOS SDK with Swift -

i trying integrate chartboost ios sdk swift. have followed instructions on chartboost ios integration page https://answers.chartboost.com/hc/en-us/articles/201220095-ios-integration , have created bridging header utilize framework in swift project.

bridgingheader.h

#import <chartboost/chartboost.h> #import <chartboost/cbnewsfeed.h> #import <commoncrypto/commondigest.h> #import <adsupport/adsupport.h>

my bridgingheader.h file loacated in project root directory http://i.imgur.com/dctcixo.png , have followed necessary steps add together bridgingheader.h build settings http://i.imgur.com/jvtzs7a.png when run project 52 errors -> http://i.imgur.com/wcvyooz.png. why getting these errors , how rid of them?

it looks headers require uikit , foundation. add together line @ top of bridging header.

#import <uikit/uikit.h>

also, have made sure bridging header in project's root in file system? hierarchy of xcode's project navigator isn't same file system.

it's looking header in /users/andrew/documents/dev/ios/protect paigridge/ open finder , create sure header in directory. xcode may have created level deeper rest of code files are. if that's case, can edit entry in build settings or move file.

objective-c swift chartboost

java - Spring Boot and angularJS - Routing is not working in my demo project -



java - Spring Boot and angularJS - Routing is not working in my demo project -

i facing problem implement angular routing in 1 of learning project, trying create simple project learning purpose , seems got stuck in initial stage itself, please guide me doing wrong here, below respective elements have used in project, index.html home page works , somehow not able accomplish routing.

my goal : want create single page application , want view1, view2 should end on index.html , purpose have used <div data-ng-view=""></div> in index.html.

note: have not shared spring elements (classes , maven pom , etc..) sense spring boot working doing wrong in angularjs side.

any help appreciable :)

app.js appdemo.controller("view1controller",function($scope){ }); appdemo.controller("view2controller",function($scope){ }); appdemo.config(['$routeprovider',function($routeprovider) {$routeprovider. when('/demo/view1', {templateurl: 'view1.html',controller: 'view1controller'}). when('/demo/view2', {templateurl: 'view2.html',controller: 'view2controller'}). otherwise({redirectto: '/demo/view1'}); }]); index.html <!doctype html> <html data-ng-app="demoapp"> <head> <meta charset="iso-8859-1"> <title>demo</title> <script src="https://code.angularjs.org/1.2.20/angular.min.js"></script> <script src="https://code.angularjs.org/1.2.20/angular-resource.min.js"></script> <script src="https://code.angularjs.org/1.2.20/angular-route.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </head> <body> <div class="form-group"> <div data-ng-controller="view1controller"><a href="/demo/view1">get view1</a></div> <div data-ng-controller="view1controller" ><a href="/demo/view2">get view2</a></div> <div data-ng-view=""></div> </div> </body> </html> homecontroller.java @controller public class homecontroller { private static final logger logger = loggerfactory.getlogger(homecontroller.class); @requestmapping(value = "/", method = requestmethod.get) public string greeting(map<string, object> model) { homecoming "index"; } }

view1.html

<!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> </head> <body> <h1>view1</h1> </body> </html>

view2.html

<!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> </head> <body> <h1>view1</h1> </body> </html>

i not sure if responsive. easy try. experimenting angular , spring-boot well. did utilize web-jars version of angular. if using spring-boot is hard debug. spring-jars seems route people taking if using maven , client side scripting. also, when added spring script tags in index needed load angular-min.js, angular-resource.min.js, , angular-load.min.js before able spring-boot work. 1 time 3 modules loaded angular seemed work champ in spring-boot.

java angularjs spring spring-boot

javascript - Show a Fixed DIV when Form is changed and hide it when Form is Saved -



javascript - Show a Fixed DIV when Form is changed and hide it when Form is Saved -

i have page html form add/edit/delete project task rows. saved database.

as page can long/tall, right there save button @ top , bottom of page uses ajax save changes.

to create things easier, user create save wanting show fixed div across top of screen save button.

this fixed div should show when there un-saved changes. when page load not see right away until create alter on page. @ point comes view.

clicking ajax save button saves task records database , fixed div/save button go hidden 1 time again until alter detected.

right have 90% working.

i have javascript has events phone call showtaskunsavedchangesheaderbar() function shown below when:

text input changed textarea changed selection dropdown changed button clicked add together new task row button clicked delete task row/record

so see have code in place observe change on page. triggers function makes fixed div save button come view.

now 1 time click save button saved info using ajax , phone call hidetaskunsavedchangesheaderbar() function shown below.

this makes fixed div save button go beingness hidden it's css display: none property set.

up until point described above works expected, except in showtaskunsavedchangesheaderbar() function added code create fixed div show when scrolled downwards screen @ to the lowest degree 100px not shown @ top of screen right now.

this scroll trigger part works fine.

the problem is, 1 time create save , hidetaskunsavedchangesheaderbar() called, hides fixed div scroll @ again, keeps showing up, though no new changes have been made info on screen.

just looking @ code below, can tell me missing? when hidetaskunsavedchangesheaderbar() function called , div hidden, should re-set process until alter on page made must missing because goes hidden single px scroll or downwards triggers view again

update seems when hidetaskunsavedchangesheaderbar() function called, need somehow kill event $(window).scroll(function() until showtaskunsavedchangesheaderbar() function called again, possible though?

i realize jsfiddle page might helpful, work on setting 1 if there isn't simple solution posted soon. held off page complex , i'll have dumb downwards lot fiddle working demo

// when there un-saved changes on task edit view, show fixed header div save button function showtaskunsavedchangesheaderbar(){ if ($('#task-edit-unsaved-header-bar').length > 0) { var unsavedchangesheaderbar = $('#task-edit-unsaved-header-bar'); var fixmetop = 100; $(window).scroll(function() { var currentscroll = $(window).scrolltop(); if (currentscroll >= fixmetop) { unsavedchangesheaderbar.css({ display: 'block', position: 'fixed', top: '0', left: '10' }); } }); } } // when there un-saved changes on task edit view, show fixed header div save button function hidetaskunsavedchangesheaderbar(){ if ($('#task-edit-unsaved-header-bar').length > 0) { var unsavedchangesheaderbar = $('#task-edit-unsaved-header-bar'); unsavedchangesheaderbar.css({ display: 'none' }); } }

you bound event in function $(window).scroll(function() {

so after code fire on scroll. if phone call showtaskunsavedchangesheaderbar bind handler multiple times, making fire multiple times.

solution

you have unbind event handler when not needed anymore. improve set somewhere outside , switch flag variable in functions scroll handler knows do.

javascript jquery

ios - No iPhone6 or iPhone6+ Simulators in XCode6 -



ios - No iPhone6 or iPhone6+ Simulators in XCode6 -

on new project in xcode 6 don't have iphone6 , iphone 6+ simulators. why that?

i have simulators iphone5s.

i have tried reinstalling xcode doesn't prepare it.

anyone have thought how prepare it?

to add together iphone 6 , plus simulator: in xcode go windows -> devices , press plus in bottom corner , add together devices wish.

ios xcode6

r - knitr hook to separate 000's, but not for years -



r - knitr hook to separate 000's, but not for years -

i define hook @ top of rnw separate '000s commas:

knit_hooks$set(inline = function(x) { prettynum(x, big.mark=",") })

however, there numbers don't want format this, such years. there improve way write hook, or way override hook when print \sexpr{nocomma} in illustration below?

\documentclass{article} \begin{document} <<setup>>= library(knitr) options(scipen=999) # turn off scientific notation numbers opts_chunk$set(echo=false, warning=false, message=false) knit_hooks$set(inline = function(x) { prettynum(x, big.mark=",") }) wantcomma <- 1234*5 nocomma <- "september 1, 2014" @ hook separate \sexpr{wantcomma} , \sexpr{nocomma}, don't want separate years. \end{document}

output:

the hook separate 6,170 , september 1, 2,014, don’t want separate years.

if things don't want comma-separated strings have years in, use:

knit_hooks$set(inline = function(x) { if(is.numeric(x)){ return(prettynum(x, big.mark=",")) }else{ return(x) } })

that works calendar string. suppose want print year number on own? well, how using above hook , converting character:

what \sexpr{2014}? % gets commad \sexpr{as.character(2014)}? % not commad

or perchance (untested):

what \sexpr{paste(2014)}? % not commad

which converts scalar character , saves bit of typing. we're not playing code golf game here though...

alternatively class-based method:

comma <- function(x){structure(x,class="comma")} nocomma <- function(x){structure(x,class="nocomma")} options(scipen=999) # turn off scientific notation numbers opts_chunk$set(echo=false, warning=false, message=false) knit_hooks$set(inline = function(x) { if(inherits(x,"comma")) return(prettynum(x, big.mark=",")) if(inherits(x,"nocomma")) return(x) return(x) # default }) wantcomma <- 1234*5 nocomma1 <- "september 1, 2014" # note name alter here not clash function

then wrap sexpr in either comma or nocomma like:

hook separate \sexpr{comma(wantcomma)} , \sexpr{nocomma(nocomma1)}, don't want separate years.

if want default commaify alter line commented "# default" utilize prettynum. although i'm thinking i've overcomplicated , comma , nocomma functions compute string format , wouldn't need hook @ all.

without knowing cases don't think can write function infers comma-sep scheme - illustration have know "1342 cases in 2013" needs first number commad , not second...

r knitr

html - Trouble horizontally centering contaning -



html - Trouble horizontally centering <div> contaning <ul> -

i can't seem list center. li elements center fine seems can't ul center on page.

i need ul or ul's container width: 100%; want have background ul should stretch fill page width , ul+margin height.

i have looked around webb no answers seem fit needs, first question , i'm new scene please understanding if i've done wrong.

html (with php used in wordpress)

<div class="body-news"> <ul id="newsbar"> <li> <?php dynamic_sidebar( 'in-body-widget-area' ); ?> </li> <li> <?php dynamic_sidebar( 'in-body-widget-area2' ); ?> </li> <li> <?php dynamic_sidebar( 'in-body-widget-area3' ); ?> </li> </ul> </div>

css

.body-news{ } .body-news ul{ margin: 0 auto; overflow: hidden; text-align: center; } #newsbar li{ text-align: left; float: left; display:inline; width: 300px; margin: 15px 20px; }

one simple solution remove text-align: left li elements , utilize display: table ul:

class="snippet-code-css lang-css prettyprint-override">.body-news { } .body-news ul { margin: 0 auto; overflow: hidden; text-align: center; display: table; } #newsbar li { float: left; display:inline; width: 300px; margin: 15px 20px; } class="snippet-code-html lang-html prettyprint-override"><div class="body-news"> <ul id="newsbar"> <li> <p>widget1</p> </li> <li> <p>widget2</p> </li> <li> <p>widget3</p> </li> </ul> </div>

html css wordpress list

VBA EXCEL To Prompt User Response to Select Folder and Return the Path as String Variable -



VBA EXCEL To Prompt User Response to Select Folder and Return the Path as String Variable -

this question has reply here:

vba - folder picker - set start 4 answers

i trying write vba code dialog box appear user select want save files. however, need path value (e.g. c:\desktop\values) returned string variable utilize in function. help appreciated.

consider:

function getfolder() string dim fldr filedialog dim sitem string set fldr = application.filedialog(msofiledialogfolderpicker) fldr .title = "select folder" .allowmultiselect = false .initialfilename = application.defaultfilepath if .show <> -1 goto nextcode sitem = .selecteditems(1) end nextcode: getfolder = sitem set fldr = nil end function edit

this code adapted ozgrid

excel vba excel-vba

java - JPA insertion in the database failed -



java - JPA insertion in the database failed -

i have problem when seek insert info database. doing jpa (persist). here code phone call method insert

private static serviceticketremote serviceticket; ...... ...... public void insertdevices(actionevent acteven) { java.sql.date sqldate = new java.sql.date(datedev.gettime()); if(modele.equals("")|| serialnumber.equals("") || sqldate.equals("") || categorie.equals("select device")) { facesmessage msg = new facesmessage(facesmessage.severity_error, "champ(s) vide(s)", ""); facescontext.getcurrentinstance().addmessage(null, msg); } else { devices device = new devices(); personnel = getbeanlogin().getagentsupport(); agentinfo agent = getbeanagentinfo().getselectedagentinfo(); device.setagentinfo(agent); device.setpersonnel(as); device.setcategorie(categorie); device.setmodele(modele); device.setnumeroserie(serialnumber); device.setdateenvoi(sqldate); seek { serviceticket.insertdevices(device); facescontext.getcurrentinstance().addmessage(null, new facesmessage (facesmessage.severity_info,"device added", "")); } catch(exception e) { system.out.println("##########error########createpers()########loginbean#######" + e.getmessage()); facesmessage msg = new facesmessage(facesmessage.severity_error,"echec de l'ajout : error", e.getmessage()); facescontext.getcurrentinstance().addmessage(null, msg); } } }

and in class serviceticketremote have method insertdevices (devices device) phone call this:

@persistencecontext(unitname = "jpa") private entitymanager em; @override public devices insertdevices(devices device) { seek { em.persist(device); } grab (exception e) { system.out.println("##error# insertnewticketting " + e.getmessage());} homecoming device; }

and entity bean devices:

@entity public class devices implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.auto) @column(name="id_device") private int iddevice; //bi-directional many-to-one association agentinfo @manytoone(fetch=fetchtype.lazy) @joincolumn(name="id_agentinfo") private agentinfo agentinfo; //bi-directional many-to-one association personnel @manytoone(fetch=fetchtype.lazy) @joincolumn(name="id_per") private personnel personnel; @column(name="categorie") private string categorie; @column(name="modele") private string modele; @column(name="numero_serie") private string numeroserie; @temporal(temporaltype.timestamp) @column(name="date_envoi") private date dateenvoi; public double getiddevice() { homecoming iddevice; } public void setiddevice(int iddevice) { this.iddevice = iddevice; } public agentinfo getagentinfo() { homecoming agentinfo; } public void setagentinfo(agentinfo agentinfo) { this.agentinfo = agentinfo; } public personnel getpersonnel() { homecoming personnel; } public void setpersonnel(personnel personnel) { this.personnel = personnel; } public string getcategorie() { homecoming categorie; } public void setcategorie(string categorie) { this.categorie = categorie; } public string getmodele() { homecoming modele; } public void setmodele(string modele) { this.modele = modele; } public string getnumeroserie() { homecoming numeroserie; } public void setnumeroserie(string numeroserie) { this.numeroserie = numeroserie; } public date getdateenvoi() { homecoming dateenvoi; } public void setdateenvoi(date dateenvoi) { this.dateenvoi = dateenvoi; } }

when run application, shows "device added", don't have errors, seems working fine have nil in database, no insertion.

can help me solve problem???

just wild guess: ejb references should not declared static.

private static serviceticketremote serviceticket;

try changing to:

private serviceticketremote serviceticket;

and see happens.

java jpa

jquery - Re-using JavaScript Method -



jquery - Re-using JavaScript Method -

i have these 2 methods pretty much same thing. improve re-using other method, method overriding in object oriented programming.

method 1 summary: based on level, create post request servlet returns courses particular level in json format (response). load these courses combo box ($loadto). after pre-select course provided , show modal.

function loadcoursesbylevelthenset(level, course, $loadto) { $.post( ... , ... , function(response) { var options = '<option value="">please select course...</option>'; (var = 0; < response.length; i++) { ... } $loadto.html(options); $loadto.val(course); $('#modal').modal('show'); }).fail(function() { alert('something went wrong while loading options courses. please seek again.'); }); }

method 2 summary: based on level, create post request servlet returns courses particular level in json format (response), load these courses combo box ($loadto).

function loadcoursesbylevel(level, $loadto) { $.post( ... , ... , function(response) { var options = '<option value="">please select course...</option>'; (var = 0; < response.length; i++) { ... } $loadto.html(options); }).fail(function() { alert('something went wrong while loading options courses. please seek again.'); }); }

this came up, doesn't work correctly:

function loadcoursesbylevelthenset(level, course, $loadto) { if (loadcoursesbylevel(level, $loadto) === true) { //after courses loaded //select course of study //and show modal $loadto.val(course); $('#modal').modal('show'); } } function loadcoursesbylevel(level, $loadto) { $.post( ... , ... , function(response) { var options = '<option value="">please select course...</option>'; (var = 0; < response.length; i++) { ... } $loadto.html(options); }).fail(function() { alert('something went wrong while loading options courses. please seek again.'); }).done(function() { homecoming true; }); }

what doing wrong? there way accomplish this? give thanks you.

the problem attempted solution can't homecoming value because ajax asynchronous.

you pass callback loadcoursesbylevel(), , have run after runs own success code. checking if callback undefined, can create optional more flexibility.

function loadcoursesbylevel(level, $loadto, callback) { $.post( ... , ... , function(response) { var options = '<option value="">please select course...</option>'; (var = 0; < response.length; i++) { options += '<option value="' + response[i].code + '">' + response[i].course + '</option>'; } $loadto.html(options); if(typeof callback != 'undefined'){ callback(); // <------------- execute callback } }).fail(function() { alert('something went wrong while loading options courses. please seek again.'); }); } function loadcoursesbylevelthenset(level, course, $loadto) { loadcoursesbylevel(level, $loadto, function() { $loadto.val(course); $('#modal').modal('show'); }); }

javascript jquery

javascript - calling and iterating over function return value using ng-repeat in AngularJS -



javascript - calling and iterating over function return value using ng-repeat in AngularJS -

i refactoring main controller in little angularjs application after reading mocking server dependancies in js , angularjs apps.

in markup iterate on "main events" using ng-repeat directive:

this angularjs module, refactored repository , controller.

however unable access main event array in way - missing?

// module var app = angular.module('maineventapp', ['cloudinary']); // repository app.service('maineventrepository', ['$http', function($http) { this.$http = $http; this.getmainevents = function() { homecoming [ { id: 1, roman_numeral: 'i', name: 'hulk hogan & mr t vs rowdy roddy piper & paul orndorff', venue: 'madison square garden', state: 'new york', attendance: 19121 }, { id: 2, roman_numeral: 'ii', name: 'hulk hogan vs king kong bundy', venue: 'split-transmission', state: 'new york/illinois/california', attendance: 40085 } ]; }; }]); // controller app.controller("maineventctrl", ['$scope', 'maineventrepository', function ($scope, maineventrepository) { maineventrepository.getmainevents().then(function(main_events) { //$scope.main_events = main_events; homecoming main_events; }); }]);

my live application can seen here (not yet refactored).

first, utilize main_events in markup need have property in controller scope.

second, service returns simple array, in controller utilize if homecoming promise.

so, controller code should linke this:

app.controller("maineventctrl", ['$scope', 'maineventrepository', function ($scope, maineventrepository) { $scope.main_events = maineventrepository.getmainevents(); }]);

and markup:

<li ng-repeat="event in main_events"></li>

javascript arrays angularjs http

sql - Postgres LEFT JOIN with SUM, missing records -



sql - Postgres LEFT JOIN with SUM, missing records -

i trying count of types of records in related table. using left join.

so have query isn't quite right , 1 returning right results. right results query has higher execution cost. id utilize first approach, if can right results. (see http://sqlfiddle.com/#!15/7c20b/5/2)

create table people( id serial, name varchar not null ); create table pets( id serial, name varchar not null, kind varchar not null, live boolean not null default false, person_id integer not null ); insert people(name) values ('chad'), ('buck'); --can't maintain pets live insert pets(name, alive, kind, person_id) values ('doggio', true, 'dog', 1), ('dog master flash', true, 'dog', 1), ('catio', true, 'cat', 1), ('lucky', false, 'cat', 2);

my goal table of people , counts of kinds of pets have alive:

| id | alive_dogs_count | alive_cats_count | |----|------------------|------------------| | 1 | 2 | 1 | | 2 | 0 | 0 |

i made illustration more trivial. in our production app (not pets) there 100,000 dead dogs , cats per person. pretty screwed know, illustration simpler relay ;) hoping filter 'dead' stuff out before count. have slower query in production (from sqlfiddle above), love left bring together version working.

typically fastest if fetch all or rows:

select pp.id , coalesce(pt.a_dog_ct, 0) alive_dogs_count , coalesce(pt.a_cat_ct, 0) alive_cats_count people pp left bring together ( select person_id , count(kind = 'dog' or null) a_dog_ct , count(kind = 'cat' or null) a_cat_ct pets live grouping 1 ) pt on pt.person_id = pp.id;

indexes irrelevant here, total table scans fastest. except if live pets rare case, partial index should help. like:

create index pets_alive_idx on pets (person_id, kind) alive;

i included columns needed query (person_id, kind) allow index-only scans.

sql fiddle.

typically fastest small subset or single row:

select pp.id , count(kind = 'dog' or null) alive_dogs_count , count(kind = 'cat' or null) alive_cats_count people pp left bring together pets pt on pt.person_id = pp.id , pt.alive <some status retrieve little subset> grouping 1;

you should @ to the lowest degree have index on pets.person_id (or partial index above) - , perchance more, depending ion where condition.

related answers:

count on left bring together not returning 0 values group or distinct after bring together returns duplicates get count of foreign key multiple tables

sql postgresql left-join aggregate-functions

php - .htaccess rewrite for user profile page does not work -



php - .htaccess rewrite for user profile page does not work -

i have problem htacces file , thing trying profile url ex : www.mysite.com/profilename --> link take me user profile , working because of

rewriteengine on rewriterule ^([a-za-z0-9_-]+)$ profile.php?u=$1 rewriterule ^([a-za-z0-9_-]+)/$ profile.php?u=$1

no thing whenever seek access other directory illustration www.mysite.com/login changes url www.mysite.com/login/u?=login

depending on if login actual file or directory rather script needing htaccess rule.

rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f

this checks first see if directory or file exists before executing rewriterule directive.

php .htaccess

android - file.entry phonegap doesn't work -



android - file.entry phonegap doesn't work -

i'm trying take file in android device using getpicture pluging, in success callback i've code:

function showalbumonsuccess(imageuri){ window.resolvelocalfilesystemuri(imageuri, function(entry){ alert(decodeuri(entry.name)); //this show file name entry.file(function(file){ var reader = new filereader(); reader.onloadend = function (evt) { alert("read success"); console.log(evt.target.result); }; reader.readasdataurl(file); },function(error){ alert("error "+error); }); },function(error){ alert("error : "+error); }); }

when run code en mi app show

file.entry errorcallback (error code: [object : object])

java.net.malformedurlexception: no installed handlers url

i need base64 code file selected.

thank you.

android file cordova base64

vba - Finding linked objects in Word -



vba - Finding linked objects in Word -

i want find objects in microsoft word 2010 file linked external files. example, if author has graph linked excel want find graph in document. can step through inlineshape collection in vba , examine properties have not found way tell me in document these shapes are. in other words, know, say, page number shape sits in. want inquire authors send me spreadsheets (typically) behind pictures , want convert of these shapes pictures. can wholesale convert them pictures in vba i’d rather 1 @ time can examine result. searching hand in big document tedious!

i wrote next code display info on linked pictures , re-create lastly linked image clipboard. there can paste scrap document know looking for, rough way job.

sub links_finder() ' find things linked elsewhere ' oct 20, 2014 dim oshape inlineshape, n integer, strmsg string strmsg = "found many linked things in document: " n = 0 on error resume next each oshape in activedocument.inlineshapes oshape.select if oshape.type = wdinlineshapechart n = n + 1 debug.print n debug.print oshape.linkformat.sourcefullname debug.print oshape.linkformat.sourcepath debug.print oshape.linkformat.type oshape.select selection.copy strmsg = strmsg & n & vbcrlf strmsg = strmsg & "copied lastly 1 found clipboard" strmsg = strmsg & vbcrlf & oshape.linkformat.sourcefullname strmsg = strmsg & vbcrlf & oshape.linkformat.sourcepath & vbcrlf & " link type: " & oshape.linkformat.type ' break link , insert picture, utilize this: 'selection.copy 'selection.pastespecial link:=false, datatype:=wdpasteenhancedmetafile, _ placement:=wdinline, displayasicon:=false end if next msgbox strmsg end sub

it turns out pretty close answering own question. l42 suggested, oshape.activate, in code, bring page shape in question. added code nowadays source in message box , inquire myself if want stop there or go on looking. message box appears in document above shape in question. revised code below.

sub links_finder() ' find things linked elsewhere ' oct 24, 2014 dim oshape inlineshape, n integer, strmsg string dim msg, style, title, response, mystring strmsg = "found many linked things in document: " n = 0 on error resume next each oshape in activedocument.inlineshapes oshape.select if oshape.type = wdinlineshapechart n = n + 1 debug.print n debug.print oshape.linkformat.sourcefullname debug.print oshape.linkformat.sourcepath debug.print oshape.linkformat.type oshape.select selection.copy strmsg = strmsg & n & vbcrlf strmsg = strmsg & "copied lastly 1 found clipboard" strmsg = strmsg & vbcrlf & oshape.linkformat.sourcefullname strmsg = strmsg & vbcrlf & oshape.linkformat.sourcepath & vbcrlf & " link type: " & oshape.linkformat.type msg = "source graphic: " & oshape.linkformat.sourcefullname & vbcrlf msg = msg & "do want go on looking?" ' define message. style = vbyesno ' define buttons. title = "looking linked tables" ' define title. response = msgbox(msg, style, title) if response = vbyes ' user chose yes. mystring = "yes" ' perform action. else ' user chose no. exit mystring = "no" ' perform action. end if ' break link , insert picture, utilize this: 'selection.copy 'selection.pastespecial link:=false, datatype:=wdpasteenhancedmetafile, _ placement:=wdinline, displayasicon:=false end if next msgbox strmsg end sub

vba ms-word word-vba

html - Host relative URL -



html - Host relative URL -

i have rtmp , http service in same host, , have web page include video link:

<video class="video-js vjs-default-skin"> <source src="rtmp://[server ip]/live" type="rtmp/mp4"> </video>

is there way link rtmp url without specifying ip/hostname? (like root-relative or protocol-relative url)

i know how in js ('rtmp://' + location.host + '/live'), want know there pure url syntax can this.

not url syntax. must specify right of point relative to.

html url

c++ - my visual studio 2010 won't run any program -



c++ - my visual studio 2010 won't run any program -

install windows , must re-install of software when installed microsoft visual studio 2010 started programming in c++ , built failed tried many programs same , getting error

1>link : fatal error lnk1123: failure during conversion coff: file invalid or corrupt

i tried disabling antivirus , security software nil happened

right click project -> properties >linker -> set enable incremental linking no. work

c++ visual-studio-2010 visual-studio fatal-error

java - How should unit tests for beans that perform CRUD operations be designed? -



java - How should unit tests for beans that perform CRUD operations be designed? -

i developing java ee 7 based application uses combination of ejb, cdi , jpa perform create, read, update , delete operations against sql database. develop series of unit tests service layer of application struggling see how can create meaningful unit test cases add together value , aren't unit tests sake of code coverage. of examples i've found in fact integration tests utilize in-memory database.

the service layer of application designed using entity, control, , boundary pattern.

the entity jpa annotated bean containing various getters, setters , named queries, along standard tostring, equals , hashcode methods.

the command cdi managed bean annotated @dependent , contains create, update, delete void methods invoke jpa entity manager persist, merge , remove methods. command contains few read methods utilize either jpa named query or jpa criteria api homecoming list object database. create, update , delete methods perform basic checks such checking whether record exists, 1 time again done via relevant jpa entitymanager methods.

the boundary ejb managed bean annotated @stateless , contains methods recognisable end user such createwidget, deletewidget, updatewidget, activatewidget, discontinuewidget, findallwidgets , findaspecificwidget. more complex entities boundary apply business logic, number of entities simple , don't contain business logic. createwidget, deletewidget, updatewidget, activatewidget, discontinuewidget methods declared void , create utilize of exceptions handle failures such database constraint violation passed web layer of application nowadays user friendly message user.

i know when writing unit tests, should test method in isolation using mocking framework emulate things such entitymanager , when method declared void test case should check whether state of has been changed correctly. issue i'm struggling see how of unit tests doing more checking mocking framework working correctly rather application code.

my question how should design meaningful unit tests validate right operation of boundary , command components, given command component calling various jpa entitymanager methods , boundary component in several cases applying no business logic? alternatively in instance there no benefit , instead should concentrate on writing integration tests.

update

the next illustration of service component used maintain list of widgets:

public class widgetservice { @persistencecontext public entitymanager em; public void createwidget(widget widget) { if (checkifwidgetdiscontinued(widget.getwidgetcode())) { throw new itemdiscontinuedexception(string.format( "widget %s exists , has been discontinued.", widget.getwidgetcode())); } if (checkifwidgetexists(widget.getwidgetcode())) { throw new itemexistsexception(string.format("widget %s exists", widget.getwidgetcode())); } em.persist(widget); em.flush(); } public void updatewidget(widget widget) { em.merge(widget); em.flush(); } public void deletewidget(widget widget) { seek { object ref = em.getreference(widget.class, widget.getwidgetcode()); em.remove(ref); em.flush(); } grab (persistenceexception ex) { throwable rootcause = exceptionutils.getrootcause(ex); if (rootcause instanceof sqlintegrityconstraintviolationexception) { throw new databaseconstraintviolationexception(rootcause); } else { throw ex; } } } public list<widget> findwithnamedquery(string namedqueryname, map<string, object> parameters, int resultlimit) { set<map.entry<string, object>> rawparameters = parameters.entryset(); query query = this.em.createnamedquery(namedqueryname); if (resultlimit > 0) { query.setmaxresults(resultlimit); } (map.entry<string, object> entry : rawparameters) { query.setparameter(entry.getkey(), entry.getvalue()); } homecoming query.getresultlist(); } public list<widget> findwithcomplexquery(int first, int pagesize, string sortfield, sortorder sortorder, map<string, object> filters) { criteriabuilder cb = em.getcriteriabuilder(); criteriaquery<widget> q = cb.createquery(widget.class); root<widget> referencewidget = q.from(widget.class); q.select(referencewidget); //code apply sorting , build filtercondition removed brevity q.where(filtercondition); typedquery<widget> tq = em.createquery(q); if (pagesize >= 0) { tq.setmaxresults(pagesize); } if (first >= 0) { tq.setfirstresult(first); } homecoming tq.getresultlist(); } public long countwithcomplexquery(map<string, object> filters) { criteriabuilder cb = em.getcriteriabuilder(); criteriaquery<long> q = cb.createquery(long.class); root<widget> referencewidget = q.from(widget.class); q.select(cb.count(referencewidget)); //code build filtercondition removed brevity q.where(filtercondition); typedquery<long> tq = em.createquery(q); homecoming tq.getsingleresult(); } private boolean checkifwidgetexists(string widgetcode) { int count; query query = em.createnamedquery(widget.count_by_widget_code); query.setparameter("widgetcode", widgetcode); count = ((number) query.getsingleresult()).intvalue(); if (count == 1) { homecoming true; } else { homecoming false; } } private boolean checkifwidgetdiscontinued(string widgetcode) { int count; query query = em .createnamedquery(widget.count_by_widget_code_and_discontinued); query.setparameter("widgetcode", widgetcode); query.setparameter("discontinued", true); count = ((number) query.getsingleresult()).intvalue(); if (count == 1) { homecoming true; } else { homecoming false; } } }

the next illustration of boundary component used maintain list of widgets:

@stateless public class widgetboundary { @inject private widgetservice widgetservice; public void createwidget(widget widget) { widgetservice.createwidget(widget); } public void updatewidget(widget widget) { widgetservice.updatewidget(widget); } public void deletewidget(widget widget) { widgetservice.deletewidget(widget); } public void activatewidget(string widgetcode) { widget widget; widget = widgetservice.findwithnamedquery(widget.find_by_widget_code, queryparameter.with("widgetcode", widgetcode).parameters(), 0).get(0); widget.setdiscontinued(false); widgetservice.updatewidget(widget); } public void discontinuewidget(widget widget) { widget.setdiscontinued(true); widgetservice.updatewidget(widget); } public list<widget> findwithcomplexquery(int first, int pagesize, string sortfield, sortorder sortorder, map<string, object> filters) { homecoming widgetservice.findwithcomplexquery(first, pagesize, sortfield, sortorder, filters); } public long countwithcomplexquery(map<string, object> filters) { homecoming widgetservice.countwithcomplexquery(filters); } public list<widget> findavailablewidgets() { homecoming widgetservice.findwithnamedquery(widget.find_by_discontinued, queryparameter.with("discontinued", false).parameters(), 0); } }

your code hard test because responsibilities aren't correctly separated.

the widgetboundary doesn't anything, , delegates widgetservice.

the widgetservice mixes business logic (like checking if widget discontinued before creating it) persistence logic (like saving or querying widgets).

that makes widgetboundary dumb, , not worth test, whereas widgetservice complex tested easily.

the business logic should moved boundary (which phone call service). service (which should called dao) should contain persistence logic.

that way, can test queries executed dao work correctly (by populating database test data, calling query method, , see if returns right data).

and can test business logic , quickly, mocking dao. way, don't need database test business logic. example, test of createwidget() method this:

@test(expected = itemdiscontinuedexception) public void createwidgetshouldrejectdiscontinuedwidget() { widgetdao mockdao = mock(widgetdao.class); widgetservice service = new widgetservice(mockdao); when(mockdao.countdiscontinued("somecode").thenreturn(1); widget widget = new widget("somecode"); service.createwidget(widget); }

java unit-testing java-ee mocking

jboss - How to calculate launch configuration properties? -



jboss - How to calculate launch configuration properties? -

in eclipse jboss 7.1 vm arguments ram 8gb vm arguments have statements ; -server -xms64m -xmx512m -xx:maxpermsize=1024m how calculate bold numbers?

**

caused by: java.lang.outofmemoryerror: java heap space

**

you getting error because server used of available memory (in case, 512mb). can increment xmx param, sets maximum amount of memory server can use.

outofmemoryerror can happen because of insufficient memory assignment, or memory leaks (objects java's garbage collector can't delete, despite not beingness needed).

there no magic rule calculate params, depend on deploying jboss, how much concurrent users, etc, etc, etc.

you can seek increasing xmx param, , check jvisualvm memory usage, see how behaves..

jboss

Implementing live video android streaming with wowza -



Implementing live video android streaming with wowza -

i trying implement live video streaming wowza have problem video quality. using rtmp.

when utilize code works fine

msession = sessionbuilder.getinstance() .setcontext(getapplicationcontext()) .setaudioencoder(sessionbuilder.audio_aac) .setaudioquality(new audioquality(8000, 16000)) .setvideoencoder(sessionbuilder.video_h264) .setsurfaceview(msurfaceview).setprevieworientation(0) .setcallback(this).build();

video resolution got here 172 x 144 when seek set other resolution etc.

msession = sessionbuilder.getinstance() .setcontext(getapplicationcontext()) .setaudioencoder(sessionbuilder.audio_aac) .setaudioquality(new audioquality(8000, 16000)) .setvideoencoder(sessionbuilder.video_h264) .setvideoquality(new videoquality(320,240,20,500000)) .setsurfaceview(msurfaceview).setprevieworientation(0) .setcallback(this).build();

it's not working on devices(green screen on web side) etc when seek shot samsung galasy s3.

so how set quality devices or need set different quality different devices?

thanks.

android streaming live wowza libstreaming

Python: Print List Items Not in Separate Index List -



Python: Print List Items Not in Separate Index List -

i have 2 lists: list = ["a","b","c","d"] i_to_skip = [0,2]

i'd print in list except indices in i_to_skip. i've tried following, returns generator object:

print(x x in list if x not in i_to_skip)

the reason comprehension work x value, "a", not index, 0, , of course of study "a" not in [0, 2].

to index along value, need enumerate. can this:

print([x i, x in enumerate(list) if not in i_to_skip])

also, note printing generator look (as did) going print <generator object <genexpr> @ 0x1055fd8b8>; that's why converted code printing out list comprehension, ['b', 'd'] instead.

if instead wanted print, say, 1 line @ time, loop on generator expression:

for x in (x i, x in enumerate(list) if not in i_to_skip): print(x)

but really, it's easier collapse single loop:

for i, x in emumerate(list): if not in i_to_skip: print(x)

or, simpler, format whole thing in single expression, maybe this:

print('\n'.join(x i, x in enumerate(list) if not in i_to_skip))

… or allow print you:

print(*(x i, x in enumerate(list) if not in i_to_skip), sep='\n')

finally, side note, calling list list bad idea; hides type/constructor function, may want utilize later on, , makes code misleading.

python list

mysql - Load a Doctrine persisted entity in async process -



mysql - Load a Doctrine persisted entity in async process -

my application creates pdf documents html code. set print configuration doctrine in mysql database , phone call commandline script calls symfony controller action printjob id.

now problem: got id right after persisting data, info isn't in mysql while first process still running.

how can tell doctrine, write info in database? tried tips like

$em->clear() // or $em->getconnection()->commit()

but not help or caused other problems.

try flush info flush like:

$em->flush()

you can flush single entity:

$em->flush($object)

mysql symfony2 asynchronous doctrine2 doctrine

asp.net - Simple temporary authentication without a username or password -



asp.net - Simple temporary authentication without a username or password -

i need add together authorization/authentication logic existing web form. essentially, user come in email address, check email address against existing database, , if exists send email address containing activation link web application. 1 time user clicks link, want client considered "authorized" short amount of time (like browser session, instance). can access pages until authentication expires.

this extremely easy using custom asp.net forms authentication, after doing research there seems many more options today in terms of authorization/authentication. things asp.net identity 2, katana/owin, , more, getting quite overwhelming.

i'm looking suggestions on simplest way implement in mvc4 application. should able upgrade application mvc5 if necessary.

this same process password resets use, can pretty much approach same way:

create table track these "authentications". pretty much need column token, column datetime, column boolean. datetime can either track creation date , time of token, you'd utilize in code calculate if it's old based on desired time frame, or can track expire date , time of token , check in code if expire date has passed or not. boolean track whether email address has been confirmed, via having followed link token in email send out.

in initial form, collect email address , combine salt , one-way encryption produce token. send email link includes token. save token , appropriate datetime value in table.

on page user goes after clicking link, utilize token url lookup matching row in table, check date value, , set boolean true confirmed. then, store token in session.

on each subsequent request, check 1) there's token in session , 2) that token still valid (lookup in database , check datetime , confirmed status). if token doesn't exist or no longer good, delete row, remove token session, , redirect user original email address collection form. otherwise, allow user view whatever content there.

asp.net asp.net-mvc authentication

mysql - REGEX for NOT matching phone number -



mysql - REGEX for NOT matching phone number -

im trying match doesn't match phone number format of ###-###-####

i have find string of 10 digits

select id, cust_num `leads` cust_num regexp '[0-9]{10}'

this finds 10 digits long. thats been far finding entries typed string of digits number,

however want find doesnt match format.

555-555-5555

so want find , don't match above format

/* example, should find these*/ 5555555555 555 555 5555 (555)5555555 555-555-555 (555)-555-5555

what right regex find not match ###-###-####

thanks

select id, cust_num `leads` cust_num not regexp '[0-9]{3}-[0-9]{3}-[0-9]{4}'

should it.

mysql regex phone

sprite kit - SKAction Perform Selector syntax error -



sprite kit - SKAction Perform Selector syntax error -

using skaction sequence trying add together delay , phone call method 2 parameters, maintain getting next (new obj c simple):

// code skaction *fireaction = [skaction sequence:@[[skaction waitforduration:1.5 withrange:0], [skaction performselector:@selector(addexplosion:firstbody.node.position andthename: @"whiteexplosion") ontarget:self]]];

// error

expected ':'

method declaration

-(void) addexplosion : (cgpoint) position andthename :(nsstring *) explosionname{

when substitute method phone call without parameters seems work fine.

any input appreciated.

use [skaction runblock:^{}] instead of selector.

i utilize selectors if method has no parameters. using block much more powerful. beware of how utilize them may maintain expected deleted objects alive.

__weak typeof(self) weakself = self; skaction *fireaction = [skaction sequence:@[ [skaction waitforduration:1.5 withrange:0], [skaction runblock:^{ [weakself addexplosion:position andthename:explosionname]; }]]];

or utilize completion block:

__weak typeof(self) weakself = self; skaction *fireaction = [skaction waitforduration:1.5 withrange:0]; [somenode runaction:fireaction completion:^{ [weakself addexplosion:position andthename:explosionname]; }];

sprite-kit skaction

java - what does this code do, I need to understand -



java - what does this code do, I need to understand -

if can explain these lines of codes does/mean. grateful. thanks

jsonobject req = new jsonobject(); boolean flag = false; seek { req.put("name", p_name.gettext().tostring()); string res = httpclient.sendhttppost(constants.name, req.tostring()); if(res != null){ jsonobject json = new jsonobject(res); if(json.getboolean("status")){ flag = true; string id = json.getstring("userid"); app.getuserinfo().setuserinfo(id); } }

in brief

this code sends name remote api, returns userid , successful status (presumably if name found remote service). userid stored in our local application.

line line explanation

first, create json object named req.

jsonobject req = new jsonobject();

then save string stored in p_name name field of req

boolean flag = false; seek { req.put("name", p_name.gettext().tostring());

then http post string serialization of json object our server. res store response receive string.

string res = httpclient.sendhttppost(constants.name, req.tostring());

after post returns, check response see if it's null.

if(res != null){

if it's not null, turn response json object (presumably server returns valid json.

jsonobject json = new jsonobject(res);

we check see if field status in our response object true. (response {"status":"true","userid":"a-user-id"} if looked @ raw server output.)

if(json.getboolean("status")){

if so, set flag true, field userid response object, , set our application's user id returned id server.

flag = true; string id = json.getstring("userid"); app.getuserinfo().setuserinfo(id);

java android

ruby on rails - Why is everything in my database (create and update times, topic_id, post_id) displaying in my view? -



ruby on rails - Why is everything in my database (create and update times, topic_id, post_id) displaying in my view? -

i'm new programming , have been learning ruby on rails 6 weeks. i've added commenting functionality app, , while comments beingness displayed properly, else in (sqlite3) database associated comment - created_at, updated_at, comment_id, post_id. partial displays comments has next code:

<%= form_for [post, comment] |f| %> <p><%= @comments.each |comment| %></p> <small> <p><%= comment.body %></p> </small> <% end %> <% end %>

as can see, i'm trying display comment body, i'm displaying everything.

here create method comments controller:

def create @post = post.find(params[:post_id]) @comment = current_user.comments.build(params_comment) @comment.post = @post authorize @comment if @comment.save flash[:notice] = "comment created" redirect_to [@post.topic, @post] else flash[:error] = "comment failed save" redirect_to [@post.topic, @post] end end end

i'm not sure why everyting displaying if i'm calling .body on comment. i've researched problem haven't found anything. help appreciated.

here prepare :-

<%= form_for [post, comment] |f| %> <!-- here removed `=` `<%` %> --> <p><% @comments.each |comment| %></p> <small> <p><%= comment.body %></p> </small> <% end %> <% end %>

#each returns collection when block finished total iteration. now, used <%= ..%>, printing homecoming value of #each. if <%..%>, wouldn't print although @comments.each still returning @comments collection.

ruby-on-rails sqlite3 erb

Performance of function declaration vs function expressions in javascript in a loop -



Performance of function declaration vs function expressions in javascript in a loop -

in next jsperf: http://jsperf.com/defined-function-vs-in-loop-function/3

you notice code:

for (var = 0; < loops; i++) { function func(a, b) { homecoming + b; }; func(i, i); }

performs on par code:

function declaredfn(a, b) { homecoming + b; }; (i = 0; < loops; i++) { declaredfni, i); }

but code:

for (i = 0; < loops; i++) { var func = function(a, b) { homecoming + b; }; func(i, i); }

is slower code:

var expfunc = function(a, b) { homecoming + b; }; (i = 0; < loops; i++) { expfunc(i, i); }

why? happening internally?

if define function using function fn() {} declaration, gets hoisted top. therefore, code:

for (var = 0; < loops; i++) { function func(a, b) { homecoming + b; }; func(i, i); }

is exactly equivalent code:

function declaredfn(a, b) { homecoming + b; }; (i = 0; < loops; i++) { declaredfn(i, i); }

because function declaration gets hoisted top.

however, var fn = function() {} expressions do not hoisted, end defining function on over every single loop.

see this answer more info.

javascript performance

asp.net mvc 3 - Whether Multiple Master Page can use in MVC 3 -



asp.net mvc 3 - Whether Multiple Master Page can use in MVC 3 -

i want know whether multiple master pages can used in mvc 3. please give me illustration how use.

you can have many master pages (layout) want. add together them under views -> shared folder , mention layout want utilize in view

layout = "~/views/shared/_mylayout.cshtml";

asp.net-mvc-3

ember.js - Ember QUnit moduleFor (testing) adapter retrieving Store -



ember.js - Ember QUnit moduleFor (testing) adapter retrieving Store -

i writing test custom ds.restadapter, uses our own sdk transporter instead of ajax calls. now, want test adapters find, findall, findquery ... functions require me pass instance of store parameter. example:

findall: function(store, type, sincetoken){...}

to able test this, need pass "store" param not available in modulefor in ember-qunit (unlike in moduleformodel can access store via this.store within test instance).

is there way gain access current instance of store?

thanks.

edit:

i solved creating mocks both, store , type. can create store instance by:

var store = ds.store.create({ adapter: @subject })

and mock type, ordinary object required properties test.

you can mock method (for instance, using sinon plugin qunit). solution accessing store (but i'm not sure work in case) helped me access store global namespace using setup , teardown methods:

setup: function () { ember.run(app, app.advancereadiness); }, teardown: function () { app.reset(); }

testing ember.js ember-cli ember-qunit

google chrome - Raw sockets on NaCl? -



google chrome - Raw sockets on NaCl? -

right i'm trying migrate code written in c application chrome browser.

i'm new in programming on nacl chrome apps , don't if native client can utilize raw sockets. need utilize raw sockets because must create modified packets such udp ttl low.

so in general question is, can utilize raw sockets (c style) nacl? if reply yes, if provide information, great.

you can utilize tcp , udp sockets, via nacl_io library. @ nacl_io demo in native client sdk. can found in subdirectory examples/demo/nacl_io_demo.

please note these sockets apis allowed when running chrome app, not on open web.

sockets google-chrome google-nativeclient raw-sockets

sql - vertica check if unique elements for each group from two columns are identical -



sql - vertica check if unique elements for each group from two columns are identical -

table in vertica:

gid b 1 2 2 1 3 2 1 1 1 2 2 1 2 1 2 2 1 1 3 1 1 3 2 1

note, values in 2 columns not distinct given gid (see gid=2) each gid, want check if unique elements in col same unique elements in col b, if equal, status = 1 else 0. expected result be:

gid status 1 0 2 1 3 0

how accomplish in vertica or sql?

assuming values in 2 columns distinct given gid, can full outer join , group by:

select coalesce(t.gid, t2.gid) gid, (case when count(t.gid) = count(*) , count(t2.gid) = count(*) 1 else 0 end) invertica t total outer bring together invertica t2 on t.gid = t2.gid , t.a = t2.b grouping coalesce(t.gid, t2.gid);

if values not distinct, need clarify question specify whether counts need same in each column. (if don't care counts, above work.)

edit:

you express using not exists:

select t.gid, max(val) (select t.gid, (case when not exists (select 1 invertica t2 t.gid = t2.gid , t.a = t2.b) 0 when not exists (select 1 invertica t2 t.gid = t2.gid , t.b = t2.a) 0 else 1 end) val invertica t ) t grouping t.gid;

sql comparison unique vertica

node.js - Javascript async callback hell -



node.js - Javascript async callback hell -

i have application used async avoid "spaghetti callback" , worked properly, in parallel calls had create changes because values have changed before returning, these changes made same routine thought create function , save code, not work application (i'm new javascript , i'm learning).

debug (console.log), error in cases same callback called different requests (if local variables not understand how happens). have tried alter code foreach , async.each, in both cases have errors , no longer more alter maintain trying, can't find fault.

my original code (i summarize avoid long post):

async.parallel({ today: function(callback){ data.get('data', function(err, dataget){ if(err){ callback(err); } callback(null, dataget); }); }, .... yesteday, week, month .... year: function(callback){ data.get('data', function(err, dataget){ if(err){ callback(err); } callback(null, dataget); }); } }, function(error, results){ --- routine ---- });

and new code this:

function

function getdatachange(key, valuepass, callback){ var values = [ .... ], totaldata = 0.00; /* async.each(values, function(value, cb){ var keyr = key.replace(/%value%/g, value.tolowercase() ); data.get(keyr, function(err, dataget){ if(err){ cb(err); } dataget = ( dataget !== null ) ? dataget : 0 ; if( valuepass === value ) { totaldata += parsefloat( dataget ); cb(); } else { valueconverter.convert({ force: true, multi: true }, function(data){ totaldata += parsefloat( info ); cb(); }); } }); }, function(err){ if(err){ callback(err); } else { callback(null, totaldata ); } }); */ var totals = values.length; values.foreach(function(value){ var keyr = key.replace(/%value%/g, value.tolowercase() ); data.get(keyr, function(err, dataget){ if(err){ homecoming callback(err); } dataget = ( dataget !== null ) ? dataget : 0 ; total--; if( valuepass === value ) { totaldata += parsefloat( dataget ); if( totals === 0 ){ callback(null, totaldata); } } else { valueconverter.convert({ force: true, multi: true }, function(data){ totaldata += parsefloat( info ); if( totals === 0 ){ callback(null, totaldata); } }); } }); }); //callback(null, totaldata); }

and changes principal routine:

var keybase = '......', value = '.....'; async.parallel({ today: function(callback){ /* data.get('data', function(err, dataget){ if(err){ callback(err); } callback(null, dataget); }); */ getdatachange(keybase + 'datad', value, function(err, returndata){ if(err){ callback(err); } //console.log('## homecoming info today'); callback(null, returndata); }); //callback(null, 0); }, .... yesteday, week, month .... year: function(callback){ getdatachange(keybase + 'datay', value, function(err, returndata){ if(err){ callback(err); } console.log('## homecoming info year'); callback(null, returndata); }); } }, function(error, results){ --- routine ---- });

i think i'll have duplicate code introducing in parallel async calls, since not able operate.

my errors varied. in various tests commented phone call function , have established returned callback 0, in several parallel calls, , have seen not running final async.parallel callback function (for example, if commented calls except today, yesterday , week). in other cases (establishing calls comment , setting value 0, except @ yesterday , week), runs twice week callback. if calls function commented, except week , today, causes exception showing message "error: callback called".

i've been stuck several days , can not find error or how solve problem :-s

thanks you.

fixed !

one of modules used function called request web api, much delayed response.

javascript node.js asynchronous callback

c++ - Millimeter paper in QT -



c++ - Millimeter paper in QT -

i have paint millimeter grid on widget. existing class can help me that? need paint math charts.

please, help good. im stucked.

before reinventing wheel please take in business relationship charting libraries discussed here. both qcustomplot , qwt easy include , not hard customize. both provide several examples; perchance 1 of them solution addressing issue.

if available libraries don't fulfill needs can create own solution subclassing qwidget , reimplementing painevent(). qpainter , qpainterpath key classes task. qt provides lot of interesting tutorials, "basic drawing example" , "painter paths example". enjoy this simple example or this one. starting these references should able draw grid easily.

finally, graphics view framework contains qgraphicsscene (citing docs)

provides surface managing big number of 2d graphical items.

such class has been used charting purposes , grids, exploiting painting apis introduced above. while using class crucial, guarantee overall performance, draw grid in drawbackground() function done instance here (or utilize background bitmap).

all api discussed work in pixels. if concerned exact millimeters representation on screen, can exploit qscreen object, straight accessible qapp pointer. provides several functions, in particular physicaldotsperinch() (logicaldotsperinch() android since other returns infinite value on kitkat). pixel approximation millimeter can calculated follows:

int dotpermillimeter = qround(qapp->primaryscreen()->physicaldotsperinch() / 25.4)

c++ qt grid draw qwidget

python - When to use .shape and when to use .reshape? -



python - When to use .shape and when to use .reshape? -

i ran memory problem when trying utilize .reshape on numpy array , figured if somehow reshape array in place great.

i realised reshape arrays changing .shape value. unfortunately when tried using .shape 1 time again got memory error has me thinking doesn't reshape in place.

i wondering when utilize 1 when utilize other?

any help appreciated.

if want additional info please allow me know.

edit:

i added code , how matrix want reshape created in case important.

change n value depending on memory.

import numpy np n = 100 = np.random.rand(n, n) b = np.random.rand(n, n) c = a[:, np.newaxis, :, np.newaxis] * b[np.newaxis, :, np.newaxis, :] c = c.reshape([n*n, n*n]) c.shape = ([n, n, n, n])

edit2: improve representation. apparently transpose seems of import changes arrays c-contiguous f-contiguous, , resulting multiplication in above case contiguous while in 1 below not.

import numpy np n = 100 = np.random.rand(n, n).t b = np.random.rand(n, n).t c = a[:, np.newaxis, :, np.newaxis] * b[np.newaxis, :, np.newaxis, :] c = c.reshape([n*n, n*n]) c.shape = ([n, n, n, n])

numpy.reshape re-create info if can't create proper view, whereas setting shape raise error instead of copying data.

it not possible alter shape of array without copying data. if want error raise if info copied, should assign new shape shape attribute of array.

python arrays numpy

cordova - Phonegap Command failed with exit code 74 -



cordova - Phonegap Command failed with exit code 74 -

trying build phonegap app in terminal , getting these errors. go here? there way identify code 74?

xcodebuild: error: unable read project

cannot opened because project file cannot parsed.

error: phonegap command failed exit code 74.

after doing research believe it's because linking to: xmlns:gap="http://phonegap.com/ns/1.0">

but should have been linking to: xmlns:cdv="http://cordova.apache.org/ns/1.0">

cordova phone

mysql - Get custom tables from database in wp-config.php -



mysql - Get custom tables from database in wp-config.php -

i want utilize wordpress installation gets it's tables original wordpress prefix. installed both wp installations in same database prefix. utilize wp event manager , original prefix this:

wp_em_events

i want same plugin @ new installation automatically it's tables orginal one, next code users @ wp-config.php:

define('custom_user_table', 'wp_users');

is there rule can utilize @ wp-config.php file 1 gets users? or there way info orginal table new one?

eventually worked using next code in wp-config.php:

define('em_events_table', 'wp_em_events');

it works other (wordpress) tables:

define('posts_table', 'wp_posts');

pages seen posts. sure al tables plugin, pages, users etc. . in cases have table meta information.

php mysql wordpress apache .htaccess

web services - Consuming Webservice in JavaScript -



web services - Consuming Webservice in JavaScript -

now, want utilize service http://www.webservicex.net/globalweather.asmx weather javascript. seek code:

var wsurl = "http://www.webservicex.net/globalweather.asmx?op=getweather"; $.ajax({ type: "post", url: wsurl, contenttype: "text/xml", datatype: "xml", data: soaprequest, success: processsuccess, error: processerror }); }); }); function processsuccess(data, status, req) { if (status == "success") $("#response").text($(req.responsexml).find("getweatherresult").text()); } function processerror(data, status, req) { alert(req.responsetext + " " + status); // alert("error"); }

javascript web-services

node.js - Mongoose, AngularJS, NodeJS -



node.js - Mongoose, AngularJS, NodeJS -

i using mongodb database. front end angularjs.

also, using mongoose.

i have:

app.get("/images", function(req, res) { mongoose.model('image').find(function (err, images) { res.send(images); }); }); app.listen(3000);

it works fine when go to: http://localhost:3000/images

then:

<div ng-repeat="photo in photos"> <!-- info list --> <h3>{{photo.name}}</h3> </div>

until here, fine.

but have one thousand , one thousand info display. need "infinite scroll" front end , need limit api http://localhost:3000/images query range or pagination ???

how can proceed lots of data?

thanks!

use server side pagination in mongoose using mongoose-paginate , limit query output. same way include pagination in angular utilize angular-ui pagination. if want utilize infinite scroll in angular utilize nginfinitescroll.

hope helps.

node.js angularjs mongoose

android - Is Google Cloud Messaging Service required for push notifications -



android - Is Google Cloud Messaging Service required for push notifications -

i looking create android app uses mysql database located on server. when changes made database, i'd force notification sent app users. question is, google cloud messaging service required implement this? page http://developer.android.com/google/gcm/index.html seems suggest using google developers console required. if so, possible export project eclipse? in advance.

my question is, google cloud messaging service required implement this?

yes , no, if want real force messages yes required if dont want utilize gcm can utilize xmpp send messages devices

android mysql google-play-services google-cloud-messaging

c# - Sorting an image list loaded from resources by name -



c# - Sorting an image list loaded from resources by name -

say have list<image>, add together images found in solution's resources using this;

using (resourceset resourceset = someproject.properties.resources.resourcemanager.getresourceset(cultureinfo.currentuiculture, true, true)) { foreach (dictionaryentry entry in resourceset) { somelist.add((image)entry.value); } }

in case, there'll 3 images in our resources. apple.png banana.png, cactus.png

how can sort list alphabetically can loop through in right order, getting apple -> banana -> cactus?

i've read how sort resourceset in c# tried apply situation no avail.

by myself i've tried assigning entry.key image's tag , doing somelist.orderby(f => f.tag).tolist();

here's total code utilize test this

list<image> somelist = new list<image>(); private void button1_click(object sender, eventargs e) { using (resourceset resourceset = windowsformsapplication52.properties.resources.resourcemanager.getresourceset(cultureinfo.currentuiculture, true, true)) { foreach (dictionaryentry entry in resourceset) { image = (image)entry.value; i.tag = entry.key; somelist.add((image)i); } somelist.orderby(f => f.tag).tolist(); } foreach(var x in somelist) { picturebox pb = new picturebox(); pb.image = x; pb.size = new system.drawing.size(200, 200); pb.sizemode = pictureboxsizemode.zoom; flowlayoutpanel1.controls.add(pb); } }

this result seem every time,

i don't know if takes file size business relationship in case file sizes of images in order. (apple.png largest, cactus smallest).

help appreciated.

you can add together images sorted dictionary image name key. foreach on dictionary retrieve images in alphabetical order name.

c# sorting visual-studio-2013

objective c - How do I release C style arrays? -



objective c - How do I release C style arrays? -

i have quantumclone class has array of cgpoints. single quantumpilot object creates quantumclone @ origin of each level. during next level quantumpilot records velocities quantumclone. @ origin of new level game loop runs code

quantumclone *c = [[self.pilot clone] copy]; c.bulletdelegate = self; c.weapon = self.pilot.weapon; [self.clones addobject:c];

but game reset , each quantumclone object in clones nsmutablearray removed.

am leaking memory assigning values cgpoint pastvelocities[4551] ?

how reset these? can't release them since not objective-c objects. need phone call c functions release memory?

@interface quantumclone : quantumpilot <nscopying> { cgpoint pastvelocities[4551]; } - (id)copywithzone:(nszone *)zone { quantumclone *c = [[[quantumclone alloc] init] autorelease]; c.weapon = self.weapon; (nsinteger = 0; < 4551; i++) { [c recordvelocity:pastvelocities[i] firing:pastfiretimings[i]]; } [c recordlatestindex:timeindex]; homecoming c; } - (void)recordvelocity:(cgpoint)vel firing:(bool)firing { cgpoint p = pastvelocities[timeindex]; p.x = vel.x; p.y = vel.y; pastvelocities[timeindex] = p; bool fired = firing; pastfiretimings[timeindex] = fired; timeindex++; } @interface quantumpilot : ccnode {} .... @property (nonatomic, retain) quantumclone *clone; - (void)copydeltas { [self.clone recordvelocity:ccp(self.vel.x, -self.vel.y) firing:self.firing]; } - (void)createclone { self.clone = [[[quantumclone alloc] init] autorelease]; self.clone.active = yes; self.clone.weapon = self.weapon; }

am leaking memory assigning values cgpoint pastvelocities[4551] ?

short answer: no.

long answer: array in code big chunk of contiguous memory cgrects live in, , has automatic storage, means allocated , deallocated automatically (when goes out of scope). in other words, when parent object destroyed, array gone along 4551 objects.

you can verify size printing result of sizeof(pastvelocities). dividing result sizeof(cgrect) tell how many objects of type can stored in it.

a deallocation must married explicit allocation. need release memory allocated dynamically (explicitly), example, using alloc function family (malloc, calloc, realloc, etc).

how reset these?

memset(pastvelocities, 0, sizeof(pastvelocities));

this reset entire array.

objective-c arrays nscopying

python 3.x - 'module' does not support the buffer interface -



python 3.x - 'module' does not support the buffer interface -

from pil import image, imagesequence import glob images2gif import writegif fn0 = glob.glob('*.jpg') im = [image.open(filename) filename in fn0] writegif('1.gif', im, duration=0.1 ) #file "images2gif.py" line 578 #gifwriter.writegiftofile(fp,images,duration,loops,xy,dispose) #file "images2gif.py" line 439 #fp.write(globalpalette) #error: 'module' not back upwards buffer interface

i used module images2gif on winpython, , i've installed imageio before it. don't know error comes from. using latest images2gif module : https://code.google.com/p/visvis/source/browse/vvmovie/images2gif.py

thanks!

writegif wants open, writable file (or acts it), rather string representing name of file.

maybe work better?

with open('1.gif') fp: writegif(fp, im, duration=0.1 )

python-3.x python-imaging-library

stored procedures - Using a parameter as a table name in a DB2 SQL cursor and adding two cursors -



stored procedures - Using a parameter as a table name in a DB2 SQL cursor and adding two cursors -

i trying parameterise stored procedure , utilize parameter table name. sec part add together returning numbers , assign them variable:

create or replace procedure test (in tab1 char(20), in tab2 char(20), out msg integer) result sets 1 language sql begin declare c1 cursor homecoming select count(*) tab1; declare c2 cursor homecoming select count(*) tab2; open c1; open c2; set msg= c1 + c2; phone call dbms_output.put_line( msg ); end @

the problem is, parameters not set table name resulting in error tab1 not known table. don't know if adding works, didn't far yet, maybe can see error in already.

i hope can help me since driving me crazy.

thanks in advance.

thevagabond

the table name 1 place can't utilize parameters.

you'll need utilize dynamic sql along prepare/execute or execute immediate. note opens door sql injection attacks.

additionally, you're confusing cursors , host variables. can't add together cursors together, can fetch them or homecoming them results sets.

take @ select instead.

sql stored-procedures parameters cursor db2

mod wsgi - mod_wsgi + python 2.7.5 + Apache 2.4.9 compiled -



mod wsgi - mod_wsgi + python 2.7.5 + Apache 2.4.9 compiled -

where can download mod_wsgi python 2.7.5 + apache2.4.9 + windows. have tried hard , many times compile on windows, lot of errors. there link download these specifications, or has compile it. need server python 2.7.5 win32. thank's

at page: click!. it's thought bookmark page, contains lot of unofficial windows binaries python.

python mod-wsgi

maven - Getting "The POM for is invalid, transitive dependencies (if any) will not be available" only in Eclipse -



maven - Getting "The POM for <name> is invalid, transitive dependencies (if any) will not be available" only in Eclipse -

i have upgraded jaxb 2.2.11 , noticed in eclipse console next message:

10/15/14, 11:42:46 pm gmt+2: [info] creating new launch configuration 10/15/14, 11:42:58 pm gmt+2: [info] c:\projects\workspaces\mj2p\maven-jaxb2-plugin-project\tests\jaxb-1044 10/15/14, 11:42:58 pm gmt+2: [info] mvn -b -x -e clean install 10/16/14, 12:09:07 gmt+2: [warn] pom com.sun.xml.bind:jaxb-impl:jar:2.2.11 invalid, transitive dependencies (if any) not available: 1 problem encountered while building effective model com.sun.xml.bind:jaxb-impl:2.2.11 [error] 'dependencymanagement.dependencies.dependency.systempath' com.sun:tools:jar must specify absolute path ${tools.jar} @ 10/16/14, 12:09:07 gmt+2: [warn] pom com.sun.xml.bind:jaxb-xjc:jar:2.2.11 invalid, transitive dependencies (if any) not available: 1 problem encountered while building effective model com.sun.xml.bind:jaxb-xjc:2.2.11 [error] 'dependencymanagement.dependencies.dependency.systempath' com.sun:tools:jar must specify absolute path ${tools.jar} @ 10/16/14, 12:09:07 gmt+2: [warn] pom com.sun.xml.bind:jaxb-core:jar:2.2.11 invalid, transitive dependencies (if any) not available: 1 problem encountered while building effective model com.sun.xml.bind:jaxb-core:2.2.11 [error] 'dependencymanagement.dependencies.dependency.systempath' com.sun:tools:jar must specify absolute path ${tools.jar} @

what puzzles me not getting warning in console. poms in question seems correct. sure using same maven installation in console , in eclipse (m2e). repository seems correct.

does happen know, causing this?

please note not duplicate (almost identically-named) question:

the pom <name> invalid, transitive dependencies (if any) not available

this question differences between maven execution in console , eclipse.

the pom com.sun.xml.bind.jaxb-impl has com.sun.xml.bind:jaxb-parent has parent.

jaxb-parent pom has next section:

<profile> <id>default-tools.jar</id> <activation> <file> <exists>${java.home}/../lib/tools.jar</exists> </file> </activation> <properties> <tools.jar>${java.home}/../lib/tools.jar</tools.jar> </properties> </profile> <profile> <id>default-tools.jar-mac</id> <activation> <file> <exists>${java.home}/../classes/classes.jar</exists> </file> </activation> <properties> <tools.jar>${java.home}/../classes/classes.jar</tools.jar> </properties> </profile>

in eclipse, neither of profile seems activated due ${tools.jar} not have value.

one possibility java_home value set incorrectly.

eclipse maven jaxb m2e