Posts

sql server - Continue inserting data in tables skipping duplicate data issue -

set xact_abort off; begin tran declare @error int declare @sql nvarchar(max) set @sql=n''; select @sql=some select query fetch insert scripts begin try exec sp_executesql @sql commit end try begin catch select @error=@@error if @error=2627 begin continue inserting data end if @error<>2627 begin rollback end end catch i unable continue inserting data when duplicate data comes. there alternative way continue running sql queries irrespective of duplicate data? don not want alter index or table. i unable continue inserting data when duplicate data comes. there alternative way continue running sql queries irrespective of duplicate data. dont want alter index or table. what can change insert scripts call them, in pseudo statement: select @sql=some select query fetch insert scripts change generation script: instead of generating insert ... values(...) statements, generate if not exists(...) insert ... values(...) statem...

jpa - Multiple persistence units in Wildfly? -

is possible have 2 persistence units in wildfly (9.0.2) application? i "wflyjpa0061: persistence unitname not specified , there 2 persistence unit definitions in application deployment deployment "jasper-web.war". either change application deployment have 1 persistence unit definition or specify unitname each reference persistence unit." i have unitname specified in @peristencecontext annotations. read somewhere disable <!-- <subsystem xmlns="urn:jboss:domain:jpa:1.1"> <jpa default-datasource="" default-extended-persistence-inheritance="deep"/> </subsystem> --> in standalone.xml . removed error message, disabled injection of entitymanagers (null pointer referencing them in code) i have tried split persistence units on 2 different ejb-jars, each own persistence.xml, they're still included in same war, wildfly still complains. the 2 persistence units used hibernate, 1 postgresql database ...

How to generate directed acyclic graph with long shortest path between two nodes in python -

i want compare several routing algorithms in terms of time needed find shortest path between 2 nodes in directed acyclic graph (dag). i wrote code algorithms, having problem generate dag computationally complex find shortest path. example, when generated 100-node dag following this approach, graph connected , combination of source , destination nodes got three-hop long route in "best" case. any idea how overcome problem? let graph union of path , "half complete graph". "half complete graph" (sorry silly name) graph, connect each node other nodes higher id (eg. 1 -> 2, 1 -> 3, 2 -> 3 ). guarantees big number of edges (due "half complete graph") , long shortest path because of path. can connect of nodes in path nodes in "half complete graph". example graph 14 nodes: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 11 - 12 11 - 13 11 - 14 12 - 13 12 - 14 13 - 14 2 - 13 4 - 14 can continue adding edges nodes 1-9 nodes...

css - How do I make my ionic buttons "slimmer"? -

i've been using developer tools try , make ionic button "pill-like", button narrow. close example buttons on stack overflow, such "ask question" button. there not spacing on top , bottom of text. how can achieve effect buttons? here's codepen shows button i'm trying modify: http://codepen.io/anon/pen/mkpdey <button class="button button-small button-calm"> hello i'm small button </button> you have override padding , min-height : .button.button-small.button-calm { min-height: 0; padding-top: 0; padding-bottom: 0; } here codepan fork if that's still not enough, change line-height : .button.button-small.button-calm { line-height: 100%; /* play fit needs */ }

Calling the constructor without knowing the name of the class (java) -

this problem easier understand code words: map<integer, parent> objectmap = new hashmap<integer, parent>(); parent myparent; child1 mychild1; child2 mychild2; //a lot more mychilds objectmap.put(1, mychild1); objectmap.put(2, mychild2); //place mychilds mychild1 = new child1(); //constructor expensive, object may not used mychild2 = new child2(); //constructor expensive, object may not used //call constructor of mychilds parent finalobject; int number = 1; //this can number finalobject = objectmap.get(number); as see, don't know in advance class finalobject be. code works without problem, here question: how can avoid calling both constructors? as mychild1 or mychild2 used , constructor methods quite expensive, want call 1 used. something like finalobject.callconstructor(); in last line any ideas? thanks in advance. edit: want know how call constructor without knowing name of class . check updated code. how this? parent finalobj...

html - Dropdown menu items not stacking vertically -

hi have website dropdown menu , reason items stack horizontally. html this <li id="menuitem">a</li> <ul id="dropdown"> <li id="dropdownelement">b</li> </ul> and css sets ul hidden unless hover. , li elements relative https://jsfiddle.net/u8pmtc4z/ there few problems implementation. you can test demo , see if desired behaviour. you should set ul ul elements positioned absolute , , ul li relative inline-block display prop. then, change #navbar ul li:hover ul this: #navbar ul li:hover ul { display: block; position: absolute; left: 0; padding: 0; } this sets nested dropdown positioned below parent aligned left. also, have used #accountdropdownelement id twice in markup. replaced class in demo because id s must unique! here's full code: #navbar ul { position: relative; display: inline-table; list-style-type: none; width: 965px; } #navbar ul:after { conten...

java - Parsing a ListView item onclick to another activity and match a specific data from JSON -

can me parse listview item on click activity preferably 1 , match parsed id json data. working on volley library , want related data of specific item clicked. // called when activity first created. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linkedlist<string> mlinked = new linkedlist<string>(); (int = 0; < drugs.length; i++) { mlinked.add(drugs[i]); } setlistadapter(new mylistadaptor(this, mlinked)); listview lv = getlistview(); lv.setfastscrollenabled(true); lv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { // when clicked, show toast textview text toast.maketext(getapplicationcontext(), ((textview) view).gettext...