Posts

java - How to display search item in Jtable? -

i not able search particular item database , put jtable here code using: try{ string filename="stock.mdb"; string database="jdbc:odbc:driver={microsoft access driver (*.mdb)};dbq="; database += filename.trim()+ ";driverid=22;readonly=false}"; conn=drivermanager.getconnection (database, "", ""); statement sta= conn.createstatement(); string str=search.gettext(); string sql="select '"+str+"' stockdb"; resultset rs= sta.executequery(sql); table.setmodel(dbutils.resultsettotablemodel(rs)); system.out.println("search updated"); }catch(exception e) { system.out.println(e); } what wrong it? do see problem code? variable names should not start upper case character ("table" should "table"). your select statement isn't doing search. selecting column name. when search should have "...

ajax - Pass session ID to multiple PHP scripts within on HTML page -

i have single html page uses carousel style log in system. each step in sign works off of different php script. there 3 forms on page appear user progresses through sign up. progress need keep user id first step in variable in order update parts of account later on. the forms executed via ajax , first php script calls session_start(); and sets session variable $_session['user_id']=$account_id; as progress through form put @ top check if session variable passing through if (empty ($_session['user_id'])) { $message = 'cant find session id';} and not. don't have session_start() @ top of other php scripts. am misunderstanding how pass variable? session_start(); needs called @ beginning of each page load in order make $_session available. don't worry, won't reset session. in simplest terms, session_start() tells php expecting session exist, , needs run code give access it.

jsp - Comparing different format dates in javascript -

i have got date objects in jsp. 1 coming java page , other 1 coming same jsp. formats of dates are: wed may 07 00:00:14 cdt 2014 07-may-2014 now how compare these 2 dates, please help. don't know how convert these in javascript same format. can please help? why don't export date in java in same format javascript uses? simpledateformat sdf = new simpledateformat("dd-mmm-yyyy"); or simpledateformat sdf = new simpledateformat("eee mmm dd hh:mm:ss z yyy"); that way easier compare using: var n = date1.localecompare(date2);

javascript - Forcing people to open a webpage in Chrome or IE -

can force users click on webpage in firefox/safari open in chrome or ie javascript? assuming have browsers downloaded. no. if other browsers present on user's system. choice browser use. even popping message advising site works better in browser x pretty poor experience user , pretty bad form developer.

java - Making a method that will call a second from a qualified name -

i need method call second 1 second class. e.g class commandclass = class.forname("foo.class"); method method = commandclass.getmethod("method", string.class, string.class); method.invoke(method, "param1", "param2"); but have tried put in method harder thought. public method can called class parameters of type. just pass arguments needed method , call code. // pass "null" paridentifiers , parameters if it's method without public static void invokemethod(string classname, string methodname, class<?>[] paridentifiers, object[] parameters) { try { // code class<?> commandclass = class.forname(classname); method method = commandclass.getmethod(methodname, paridentifiers); method.invoke(method, parameters); } catch (nosuchmethodexception | securityexception | classnotfoundexception | illegalaccessexception | illegalargumentexcept...

abstract - Create dynamic Type Java -

explain problem: i have super abstract class called first , have lot of class inherit it. want build method "say" "create arraylist of 1 of types inherit first class", i'm not able find solution. example: public abstract class first{ public first(){ } } public class firstone extends first{ ........... } //it's pseudo-code public class myprogramclass{ public creatingmethod(typethatinheritfromfirstclass x ){ return arraylist<typethatinheritfromfirstclass>; } } i insert creatingmethod in program class,but can anywhere(i prefer in first class static method, it's example) thank time you use type token : public class somegenerics { public static void main(string[] args) { list<subfirst1> list1 = creatingmethod(subfirst1.class); list<subfirst2> list2 = creatingmethod(subfirst2.class); } public static <t extends first> list<t> creatingmethod(class<t...

c# - Visual Studio 2013 interprets my file as a form file -

Image
i create simple cs file 1 class: using system; using system.collections.generic; using system.linq; using system.net; using system.text; using system.threading.tasks; namespace bed { public class timeoutwebclient : webclient { protected override webrequest getwebrequest(uri uri) { webrequest w = base.getwebrequest(uri); w.timeout = 30 * 1000; return w; } } } suddenly visual studio has interpreted form class.. did go wrong? these versions use: microsoft visual studio ultimate 2013 version 12.0.21005.1 rel microsoft .net framework version 4.5.50938 i'm not sure how happened how fix it: right-click on project , choose 'unload' right-click on project , choose 'edit' find in file 'timeoutwebclient' i expect find this: <itemgroup> <compile include="timeoutwebclient.cs"> <subtype>form</subtype> <...