Posts

java - Resource not found(404) when adding ContextLoaderListener and RequestContextListener in web.xml -

when adding contextloaderlistener web.xml got message of resource not found(404). when remove listener class web.xml index.php running adding <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class> </listener> this 2 lines give me resource not found error eclipse kepler version.when adding these 2 lines in web.xml , prepare code heading error: java.lang.illegalstateexception: no webapplicationcontext found: no contextloaderlistener registered? i tried hard , new spring framework. can tell me setup needed listener or else? error in console: * jan 27, 2016 12:47:24 pm org.apache.catalina.core.standardcontext listenerstart severe: exception sending context initialized event listener instance of class org.springfr...

if statement - Excel Formula for less than 60 but greater than 30 -

my current excel formula is: =if([dvt contract end dates days left]<=0,"expired",if([dvt contract end dates days left]<60,"expiring soon","")) i want modify below : remove days less 30 , marked expiring more 30. try this =if([dvt contract end dates days left]<=0,"expired",if(and([dvt contract end dates days left]>30, [dvt contract end dates days left]<60),"expiring soon",""))

php - One to one relationship error on can't alter table when run artisan command -

i've multiple packages , users can have 1 package @ time, not multiple. so, i've created 1 one relationship , added foreign key in users table. here's relevant users table: public function up() { schema::create('users', function (blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password', 60); $table->string('role'); $table->unsignedinteger('package_id'); $table->remembertoken(); $table->nullabletimestamps(); $table->foreign('package_id') ->references('id') ->on('packages'); }); } and here's packages table: public function up() { schema::create('packages', function (blueprint $table) { $table->increments('id'); $table->string(...

Android Robolectric unit test for Marshmallow PermissionHelper -

i wanna learn robolectric use unit tests on android marshmallow app. wrote permissionhelper methods make permission handling bit easier. started unit tests class, trying test simple method: public static boolean haspermissions(activity activity, string[] permissions) { (string permission : permissions) { int status = activitycompat.checkselfpermission(activity, permission); if (status == packagemanager.permission_denied) { return false; } } return true; } here robolectric test wrote far: @runwith(robolectrictestrunner.class) @config(constants = buildconfig.class) public class permissionhelpertest { private permissionhelper permissionhelper; private shadowapplication application; @before public void setup() { pictureactivity activity = robolectric.buildactivity(pictureactivity.class).get(); permissionhelper = new permissionhelper(activity, activity, 1); application = new shadowapplicatio...

java - manipulation with dynamically added textfield values -

jpanel consists 5 jtextfields . adding dynamically jpanels addbutton . , retrieving dynamically added jpanel values savebutton . code of savebutton : private void writefile(jpanel panel_name, printwriter file){ component[] children = panel_name.getcomponents(); (component sp : children) { if (sp instanceof subpanel) { component[] spchildren = ((subpanel)sp).getcomponents(); int count=1; (component spchild : spchildren) { if (spchild instanceof jtextfield) { string text = ""; if(count==1) text=((jtextfield)spchild).gettext(); if(count==2) text=((jtextfield)spchild).gettext(); if(count==4) text=((jtextfield)spchild).gettext(); if(count==5) text=((jtextfield)spchild).gettex...

itextsharp - How to edit PdfTemplate width (in Java) -

Image
is possible edit width of pdftemplate object before close of document ? in pdf process create document, , set template write total page number. set width doesnot works : // onopendocument pdftemplate pagenumtemplate = writer.getdirectcontent().createtemplate(10, 20); globaldatamap.put("mytemplate", pagenumtemplate) // onclosedocument font font = (font) globaldatamap.get("myfont"); string pagenum = string.valueof(writer.getpagenumber()); float widthpoint = font.getbasefont().getwidthpoint(pagenum, font.getsize()); pdftemplate pdftemplate = (pdftemplate) globaldatamap.get("mytemplate"); pdftemplate.setwidth(widthpoint); columntext.showtextaligned(pdftemplate, element.align_left, new phrase(pagenum), 0, 1, 0); an error in op's initial code you call columntext.showtextaligned string third parameter: string pagenum = string.valueof(writer.getpagenumber()); [...] columntext.showtextaligned(pdftemplate, element.align_left, pagenum, 0, 1...

php - Why is my code not retrieving the data in a graph? -

<?php session_start(); include "../../lib/mssql.connect.php"; $params = array($_post['year'], sha1($_post['month'])); $sql ="select count(*) totalguestbook_totalcount, month(guestbook_createddate) mth tbl_guestbook year(guestbook_createddate) ='2015' group month(guestbook_createddate)"; // run query $result = sqlsrv_query($conn, $sql, $params) while($row = sqlsrv_fetch_array( $result, sqlsrv_fetch_assoc)) { $dashboardresult[] = array('label' =>$row['guestbook_createddate'], 'values' =>$row['totalguestbook_totalcount']); } echo json_encode($dashboardresult); ?> do not include $params in query execution use: $result = sqlsrv_query($conn, $sql); instead of : $result = sqlsrv_query($conn, $sql, $params)