Posts

Showing posts from August, 2015

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

php - Laravel 5.2 Missing required parameters for [Route: user.profile] [URI: user/{nickname}/profile] -

i keep getting error errorexception in urlgenerationexception.php line 17: when ever page loads , i'm logged in. here nav looks like @if(auth::guest()) <li><a href="{{ url('/login') }}">log in</a></li> <li><a href="{{ url('/register') }}">sign up</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ auth::user()->nickname }}<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ route('user.profile') }}">profile</a></li> <li><a href="{{ route

code to print leap years between 1801 and 1900 using Java -

i trying write code outputs leap years between 1801 , 1900 , formatting output in lines of 10 years per each line.so far here have got for(int 1 == 1800; <1900; i++200 ){ if (i % 100 !=0 || i% 400 == 0 ) system.out.printf("%4d %n" + i); but giving me compilation errors.how can make sure code compiles without errors??? you need declare i , , want increment i one. need comma , printf , algorithm needs test % 4 == 0 . like public static void main(string[] args) { (int = 1800; < 1900; i++) { if ((i % 4 == 0 && % 100 != 0) || % 400 == 0) { system.out.printf("%4d%n", i); } } } update the output correct not formatting way want in lines of 10 leap years each. then modiy print like int count = 0; (int = 1800; < 1900; i++) { if ((i % 4 == 0 && % 100 != 0) || % 400 == 0) { system.out.printf("%d ", i); count++; if (count % 10 == 0) {

Splitting rows into columns in R using tidyr -

i have dataset looks this- col1 1 atom 1 n ile 12 67.611 47.640 52.312 1.00 12.44 n 2 atom 2 ca ile 12 66.381 47.660 51.520 1.00 25.25 c it has single column called col1. want separate 12 columns i'm using following command- try=separate(subset,col1,c("name","s.no","atom name","residue name","symbol","residue number","x-cor","y-cor","z-cor","uk1","uk2","symbol"), sep= " ") but keep on getting following error, not understand- warning message: many values @ 3929 locations: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ... and gives me following output- name s.no atom name residue name symbol residue number x-cor y-cor z-cor uk1 uk2 symbol 1 atom

ios - Passing data to custom UITableViewCell with adding subviews -

i'm passing data custom uitableviewcell , based on data want show or hide dynamically added subview. i'm reusing cell created in storyboard. working expected, until of cells reused, example while scrolling "randomly" hide or show dynamic added subview. what need i need way set data of cell through method (setdata), adding dynamically created subview, while allowing cell reused without creating glitches in appearance, in particular added subview cells state. problem i don't know should create subview, doesn't have recreated when cell reused , won't bug when want hide or show in setdata method. having access iboutlet storyboardlabel while creating new subview. customtableviewcell class customtableviewcell : uitableviewcell { var data: dataitem? var customsubview: uiview? @iboutlet weak var storyboardlabel: uilabel! //setting data of cell , adding subview func setdata(dataitem data) { // adding view let customsubv

reactjs - How To Do onRendered Template like on Meteor React's Component -

i show canvas on template rendered using react component. know in blaze's style perform like, template.test.onrendered = function(){ // draw canvas } how call canvas onrendered if using component? i believe you're looking componentdidmount() . meteor chef has few blog posts on blog. here's link 1 of first react walkthroughs .

How to read a file into an array line by line c++? -

i've written code , file read contains 3 multiple choice questions. program works fine , can store answers there problem. need randomize order of questions every time compile. way read file in arrays. can't seem figure out how that. appreciated. p.s i'm new c++ #include <iostream> #include <string> #include <fstream> using namespace std; int main() { char c; char d; string line_; ifstream file_("mpchoice.txt"); if (file_.is_open()) { while (getline(file_, line_)) { cout << line_ << '\n'; } file_.close(); } cout << "what response number 1\n"; cin >> c; if (c == 'a') cout << "that's wrong\n"; cout << "what's response second question\n"; cin >> d; if (d == 'a'){ cout << "that's correct\n"; } else

javascript - HTML form select with jQuery not working -

i using following code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <select name="cars" id="dynamic_select"> <option value="http://www.visionabacus.com/australia/1/suitea100/640/borrowing-power-calculator.aspx?id=mfaa">borrowing power calculator</option> <option value="http://www.visionabacus.com/australia/1/suitea100/640/loan-repayment-calculator.aspx?id=mfaa">loan repayment calculator</option> <option value="http://www.visionabacus.com/australia/1/suitea100/640/lump-sum-repayment-calculator.aspx?id=mfaa">lump sum repayment calculator</option> <option value="http://www.visionabacus.com/australia/1/suitea100/640/extra_repayment_calculator.aspx?id=mfaa">extra repayment calculator</option> <option value="http://www.visionabacus.com/australia/1/suitea100/640/budget-planner.aspx

c# - Equivalent of Copy to Output Directory for DNX applications -

i have dnx451 mvc web application , want copy .txt file output directory make easier copy application files. i have added file project @ same level project.json , added following project.json file. "content": [ "file.txt" ] but when build application file isn't copied output location. in previous versions, have set copy output directory option in file properties, doesn't exist in dnx project. what equivalent process of copy output directory content file copied output directory?

c# - UWP Tile notifications stop flipping -

my windows 10 uwp app has main "dashboard" has several listview items. i'm wanting show content these items in primary tile. code have shows content in tile tile stops flipping after few seconds , stuck content 1 of listview items. how make sure doesn't stop cycling through listview items , doesn't stop flipping. here's code looks like: public mainpage() { tileupdatemanager.createtileupdaterforapplication().enablenotificationqueue(true); } protected async override void onnavigatedto(navigationeventargs e) { updatemedium(new tilebindingcontentadaptive() { children = { new tiletext() { text = "some text listview item, style = tiletextstyle.base, wrap = true }, new tiletext() { text = "some other te

html - How to get selected text,value from the dropdown and assign into list object in angularjs -

here i'm using angularjs web api. want selected dropdown list values , assign list object , it'll save db. here code. selectmodule.controller("selectstatecontroller", function ($scope) { $scope.ilbasicinfodto.pyrornonresidencystateinfo.taxpayerearnedincomefromotherstate = { stateid: 10, statename: 'illinois' }, { stateid: 11, statename: 'new york' }, { stateid: 12, statename: 'michigan' }, { stateid: 13, statename: 'georgia' }, { stateid: 14, statename: 'california' }; $.ajax({ url: serviceurl + 'il/persistilbasicinfo', datatype: "json", type: "post", async: true, data: json.stringify({ userid: userid, taxreturndata: { userdataid: userdataid, taxdata: json.stringify($scope.ilbasicinfodto), istaxmetercall: false

Arduino IR Sensors Not Calling Functions -

with code written in arduino ide used able call functions based on infrared sensor detected object(right, left, or both). altered code little bit lately i've continued make sure wasn't missing key components made work in first place. i'm not sure if it's error in program or hardware now, no matter sensor detects object, robot turns left. //include servo library #include <servo.h> //define pins sensors , leds #define lsensorpin 8 #define rsensorpin 5 #define lefttranspin 7 #define righttranspin 6 i'm using continuous rotation servos using 0's , 180's how control them @ full speed. checked numbers on , on don't seem problem. //constants driving servo const int rforward = 0; const int rbackward = 180; const int lforward = rbackward; const int lbackward = rforward; const int rneutral = 90; const int lneutral = 90; //0 speed //name servos left , right motor servo lmotor; servo rmotor; the following 2 functions, when called, transmit i

MongoDB $lookup: Limitations & Usage -

with new aggregation pipeline stage $lookup able perform 'left outer joins'. at first glance, want replace 1 of our denormalised collections 2 separate collections , use $lookup join them upon querying. solve problem of having, when necessary, update huge number of documents. can update 1 document. but surely true? nosql, document database after all! mongodb's cto highlights concerns : we’re still concerned $lookup can misused treat mongodb relational database. instead of limiting availability, we’re going developers know when use appropriate, , when it’s anti-pattern. in coming months, go beyond existing documentation provide clear, strong guidance in area. what limitations of $lookup ? can use them in real-time, operational querying of our data or should left reporting, offline situations? i share same enthusiasm $lookup . i think there trade-offs. 1 of major concerns of sql databases (and 1 of reasons genesis of nosql) @ large s

RGB to fill color in excel vba -

i have task generate color code . have r g b values listed in 3 different columns , there around 256 rows of r g b values. need fill color corresponding r g b values in each row. list this how has been listed . , require generate corresponding color code next this sub changerowcolorbasedonatocrgbvalues() dim lrw long lrw = cells(rows.count, "a").end(xlup).row = 1 lrw range("a" & i).entirerow.interior.color = _ rgb(cells(i, "a").value, cells(i, "b").value, cells(i, "c").value) next end sub

bash - awk : how to pass and use array value -

i have awk script read search keywords input1.txt , search if search string present in input2.xml $ cat myawk.awk nr==fnr { keywordarray[nr]=$0; next; } /<record / { i=1 } { a[i++]=$0 } /<\/record>/ { if (found) { (i=1; i<=length(a); ++i) print a[i] >> result.txt } i=0; found=0 } /<keyword>keyword1<\/keyword>/ { found=1 } /<keyword>keyword2<\/keyword>/ { found=1 } ..... this need help. need pass keyword value stored in keywordarray. $ cat input1.txt keyword1 keyword2 keyword3 ... $ cat input2.xml <record category="xyz"> <person ssn="" e-i="e"> <title xsi:nil="true"/> <position xsi:nil="true"/> <names> <first_name/> <last_name></last_name> <aliases> <alias>cdp</alias> </aliases> <keywords> <keyword xsi:nil="true"/> <keyword>keyword1</keyword> </keywor

c# - Programmatically set console window size and position -

i open multiple console programs on desktop. have everytime: 1.right click desktop->screen resolution->detect (4 monitors). 2.open 16 different console programs (4 per screen). 3.clicking on windows z-order correctly. 3.right click taskbar->show windows stacked (to organize 16 windows perfect squares, 4 on each screen in order of z-index). is there way part of programmatically go quicker? you can use windows api move console window. use dllimport declare winapi functions want use: [dllimport("kernel32.dll", setlasterror = true)] static extern intptr getconsolewindow(); [dllimport("user32.dll", setlasterror = true)] internal static extern bool movewindow(intptr hwnd, int x, int y, int nwidth, int nheight, bool brepaint); then call them: e.g. intptr ptr = getconsolewindow(); movewindow(ptr, 0, 0, 1000, 400, true); you can use further winapi function setwindowpos . can find dllimport syntax searching web pinvoke , name of function. fol

How to retrieve Date value from Database using C#.net and set in HTML5 input Type 'date'? -

i want retrieve date database , set html5 input type 'date'. have 2 html5 date fields ids 'coursestartdate' , 'courseenddate', , using following code couldn't getting value in html5 date. coursestartdate.value = coursedr["start_date"].tostring(); courseenddate.value = coursedr["end_date"].tostring(); you should try convert date time specific format accepted html5 control. coursestartdate.text = datetime.utcnow.tostring("yyyy-mm-dd"); hope help.

android popupwindow - NullPointErexception when calling showAtLocation -

good day programmers. have problem nullpointerexception when call method showatlocation of popupwindow . in many forums written, exception happens because first parameter of method showatlocation null. check way: showatlocation (view parent, int gravity, int x, int y) parent.equals(null) //- returns false linearlayout lout = (linearlayout) parent; lout.getchildcount() //- returns true count of child elements ((textview) lout.getchildat(1)).gettext() //- returns text write in android:text field i have gridview , adapter customadapter ( extends baseadapter ). in class (customadapter) has onclicklistener in getview method. want set popupwindow each item of gridview. in onclicklistener call method showpopup : private void showpopup(final activity context, point p) { int popupwidth = 200; int popupheight = 150; // inflate popup_layout.xml linearlayout viewgroup = (linearlayout) context.findviewbyid(r.id.popup); layoutinflater layoutinflater = (layoutinfl

XSLT Merging two nodes into one -

i'm looking merge 2 nodes (or more) one. i've worked xslt little while, doing pretty simple stuff. i've done searching, solutions have been on head haven't been able adapt own problem. closest thing i've found answer martin honnen using function built called "eliminate-deep-equal-duplicates". my problem can have 2 or more <coverage> nodes have "coveragecd=addrl" , need combine these nodes only, no other coverage nodes other coveragecd values. want merge addrl nodes keep unique "addr" child node addrl iterations. one other caveat need have count of merged addrl nodes , place in "optionvalue" element. in example have 2 addrl coverage nodes optionvalue needs 2. xslt gives me need, duplicates miscparty/generalpartyinfo don't want. , while have variable addrlcount gives me correct value place in optionvalue, i'm not quite sure how incorporate current xslt. know main problem i'm not sure "eliminate-

c# - How do I save image in database in published application using C # in mvc -

i upload company logo in application,it's working when publish , check getting error here post method of image [httppost] public string logo() { webimage photo = null; var imagepath = ""; photo = webimage.getimagefromrequest(); string tempname = ""; if (photo.filename.contains("\\")) { tempname = photo.filename.substring((photo.filename.lastindexof("\\") + 1), (photo.filename.length - (photo.filename.lastindexof("\\") + 1))); } else { tempname = photo.filename; } string fname = tempname; imagepath = server.mappath("~/content/temp/") + fname; photo.resize(photo.width, 300, true); photo.save(imagepath); return "<img src='/content/temp/" + fname + "' class='preview' id='targetimage' >"; } i getting error system.unauthorizedaccessexception: access path 'c:\inetpub\www

zap - zaproxy scan report solution in PHP -

i using zaproxy automatic testing of site. there p1 alert in scan report. dont know how rectify err. can please me out:- https://example.com/index.php?id=1535&source=home&storyid=468&r=video%2fview%22%26timeout+%2ft+5%26%22&mode=current parameter r attack video/view"&timeout /t 5&" ok, timing attack. these prone false positives if server under load. you should try manually validate potential vulnerability reported scanning tool, including zap. in case open urls referenced in browser - did take around 5 seconds load? change '5' on url larger, eg '30' - did take 30 seconds? if took around same length of time false positive.

angularjs - How can you iterate through controllers in an ng-repeat from the parent? -

i want write loop goes through of child controllers , runs function in them. @ moment code running function in 1 instance of child controller. how iterate through instances of controller, generated through ng-repeat? basically, on click of button function in childcontroller should run 4 times, 1 each controller generated on each 'set' in 'wordlistsets'. html: <button ng-click="setall(true)">select all</button><button ng-click="setall(false)">deselectall</button> <ul> <li ng-repeat="set in wordlistsets" ng-controller="setcontroller"> <div class="parentselector"> <input type="checkbox" ng-click="selectallchildren(set.content)" ng-checked="parentchecked"> </div> <div ng-repeat="wordlist in set.content" ng-click="togglecheckbox(wordlist)"> <input type="c

How does ionic.config.js in ionic2 work -

i need know in detail, how ionic.config.js file (in ionic2 ) work. can use grunt instead of ionic.config.js ? yes can use grunt or gulp automating builds. regarding first question: can give more details? maybe tell bit more trying achieve config file, or give overview of tasks want accomplish?

html - JavaScript document.write not appearing in page source -

i have used document.write('test') in html page. everything working intended curious know why output 'test' appears in browser not appear in "view page source". so output of document.write() stored in browser memory? yes. when ask see source code, browser shows source code. doesn't show serialisation of current state of dom (which dom inspector for).

php - Laravel 5.2 - Change Data Format get from Eloquent -

i have model this- $feature_project = featureproject::select('feature_id') ->where('project_id', $project->id) ->get(); and if return it, getting output this- [ { "feature_id": 2 }, { "feature_id": 4 }, { "feature_id": 9 } ] but want t output this- [2,4,9] so need convert output. but not finding way without using for-each loop (make temp array, push elements array current array for-each loop). but think there more smart way in laravel that. i think laravel collection used purpose. you can call pluck() method on query builder. $feature_project = featureproject::select('feature_id') ->where('project_id', $project->id) ->pluck('feature_id'); // [2,4,9] https://laravel.com/api/5.2/illuminate/database/eloquent/builder.htm

c++ - Locating the largest element in the row of a multi dimensional array -

i'd subtract highest element in 5x2 matrix, it's subsequent element, in other column. for ex: highest element right 150, location (4,1). i'd subtract 150 89 , it's subsequent element. in same way if highest element belonged first column, should subtract element in next column. thanks int big=0,lead=0,m,n; int a[5][2]={140,82,89,150,110,110,112,106,88,90}; for(int j=0; j<5; j++) { for(int i=0 ; i<2; i++) { m=j; n=i; if(a[j][i] > big) { big = a[j][i]; if(big == a[j][i]) { lead = big-a[j][1]; } else { lead = big-a[1][i]; } } } } cout<<big<<"\n"<<lead<<"\n"<<m<<","<<n<<endl; } i think declare array wrong, build 2d array int a[2][5] = { {140,82,89,150,110}, {110,112,106,88

main(): Failed opening required 'core/autoload.php' (include_path='.:') laravel 5.2 -

Image
i trying add files route, used in application , file paths base_path().'/public/assets/global/plugins/ckeditor/kcfinder/browse.php'; base_path().'/public/assets/global/plugins/ckeditor/kcfinder/upload.php'; i created 2 routes in routes.php : route::get('kcfinder/browse.php', function() { include base_path().'/public/assets/global/plugins/ckeditor/kcfinder/browse.php'; }); route::get('kcfinder/upload.php', function() { include base_path().'/public/assets/global/plugins/ckeditor/kcfinder/upload.php'; }); after doing getting error: where have setup autoload file? says core/autoload.php can not find. any suggestions? how can resolve issue? thank you!

javascript - Tree Table Filters Sapui5 -

i have problem filtering rows in tree table, normal table same filters working fine thou here normal table aggregation code: ttotals.bindaggregation("rows",{ path: "totals>/prg_head", filters: [ new sap.ui.model.filter("id_prg_version", sap.ui.model.filteroperator.eq, filterkrvr.program), new sap.ui.model.filter("id_scenario", sap.ui.model.filteroperator.eq, filterkrvr.scenario), new sap.ui.model.filter("i_year", sap.ui.model.filteroperator.eq, filterkrvr.year) ]} ); and here tree table aggregation tevents.bindaggregation("rows",{ path: "events>/prg_years(id_scenario=" + filterkrvr.scenario + ",i_year=" + filterkrvr.year + "m)" + "/hisgto", filters: [

could not connect to cassandra using the latest cql driver and default settings? -

i using latest version of cassandra 3.0.2 , latest version of datastax cassandra core java driver 3.0.0. settings in cassandra.yaml remains unchanged. have not changed file. whatever default settings remain same. keep hearing rpc_address should 0.0.0.0 default localhost , broadcast_rpc_address default commmented out value 1.2.3.4 (again default commented out). have not changed of default settings cassandra.yaml file remains unchanged. don't understand why need set rpc_address , after hear latest version of cassandra had moved away rpc?! here snippet of code cluster cassandra = cluster.builder().addcontactpoint("localhost").withport(9042).build(); listenablefuture<session> session = cassandra.connectasync("demo1"); ...... here error when turn on debug flag com.datastax.driver.new_node_delay_seconds undefined, using default value 1 com.datastax.driver.non_blocking_executor_size undefined, using default value 8 com.datastax.driver.notif_lock_t

laravel - Constructor injection of route parameter -

i have class injecting controller along route parameter. using setter set route parameter in class. routes route::get('path/of/url/with/{paramvar}', 'testcontroller@testfunc) controller class testcontroller { public function testfunc(myclassinterface $class, $routeparamvar) { $class->setparam($routeparamvar); //do stuff here ... service provider public function register() { $this->bind('path\to\interface', 'path\to\concrete'); } i instead inject route parameter constructor of class injecting controller. know from question need use laravel container. i can inject other route parameters using request::class , how can inject route path parameter? i guess end this class testcontroller { public function testfunc(myclassinterface $class) { //do stuff here ... you can use $router->input('foo') function retrieve route parameter within service container.

haskell - GHC compiler not complaining about incorrect code paths -

i'm approaching haskell view of converting runtime errors compile-time errors. expect compiler figure out code paths in following code not error free. if authorizeuser returns unauthorizedcommand call (command $ authorizeuser cmd userid) fail during runtime. data command = unauthorizedcommand | command {command :: string, userid :: string} authorizedusers = ["1", "2", "3"] authorizeuser :: string -> string -> command authorizeuser cmd userid = if (userid `elem` authorizedusers) command {command=cmd, userid=userid} else unauthorizedcommand main :: io () main = cmd <- getline userid <- getline case (command $ authorizeuser cmd userid) of "ls" -> putstrln "works" _ -> putstrln "not authorized" is there compiler switch enable such checking? the main problem in example using record syntax in data type multiple constructors can end record selector functions partial. it's

sql server 2008 - Remove a column after selection with SQL -

i want result set include 1 column, i'm using different column group , order by. can somehow, after selecting , order removing column result set? using mssql2008 just add select around query, so: select sum_columnb (select columna , sum(columb) sum_columnb table group columna order columna , sum_columnb) resultset but if post query, answer more specific , maybe clearer.

machine learning - Torch CrossEntropyCriterion error -

i'm trying train simple test network on xor function in torch. works when use msecriterion, when try crossentropycriterion fails following error message: /home/a/torch/install/bin/luajit: /home/a/torch/install/share/lua/5.1/nn/thnn.lua:699: assertion `cur_target >= 0 && cur_target < n_classes' failed. @ /tmp/luarocks_nn-scm-1-6937/nn/lib/thnn/generic/classnllcriterion.c:31 stack traceback: [c]: in function 'v' /home/a/torch/install/share/lua/5.1/nn/thnn.lua:699: in function 'classnllcriterion_updateoutput' ...e/a/torch/install/share/lua/5.1/nn/classnllcriterion.lua:41: in function 'updateoutput' ...torch/install/share/lua/5.1/nn/crossentropycriterion.lua:13: in function 'forward' .../a/torch/install/share/lua/5.1/nn/stochasticgradient.lua:35: in function 'train' a.lua:34: in main chunk [c]: in function 'dofile' /home/a/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in

.htaccess - Wordpress URL - Need to remove a GET parameter -

i know there lot of threads .htaccess url rewriting, case seems bit different , have tried lot doesn't work. my current url: http://example.com/forest/trees/?type=perennial what need is: http://example.com/forest/trees/perennial i need remove ?type= url. edit: url may contain hyphens - between strings @ point (except domain name ofcourse). can dense-forest or non-perennial too. it's custom code , plugin, can't modify it. need url beautified. any appreciated. what i've tried far in .htaccess : rewritecond %{the_request} ^(get|post|head)\ /forest\/trees\/\?type=([^&]+) rewriterule ^ \/forest\/trees\/%2\/? [l,r=301] and rewriterule ^\/forest\/trees\/([^/]*)? /forest/trees/?type=$1 [l] my current wordpress .htaccess is: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] &l