Snmp call on the issue of java

  Abstract: On the issue of java call snmp 


  Younger brother recently wrote graduation design, topic is using java to make a network monitoring software, the need to use java call snmp 
  Like using C / C + + snmp call for the more, ask you master, how to use java call, please tell younger brother steps to test the best if you ~ ~ ~ 
  Thank you 



  Up 



  It seems that the java snmp packages, snmp4j, joesnmp and so on, to find some on sourceforge 


  ↑ Back 

Jbuilder paper this morning compiler error for help

  Abstract: This morning jbuilder help compile a paperwork error 


  Compiler error after tips are as follows: 
  Unable to load document from file (../website1/defaultroot/WEB-INF/weblogic.xml) 
  Connection timed out: connect: Connection timed out: connect 
  Depressed compiler or through yesterday, this morning to report on this wrong, I do not know why 



  Find WEBLOGIC server connectivity overtime 




  Weblogic server connectivity overtime 



  Up 



  How to resolve ah 


  ↑ Back 

Jboss the security mechanism involving several configuration files

  Abstract: Jboss the security mechanism involving several configuration files 

  1. Webapp own web.xml file: Configuration containers role and access to resources such as 
  2. Web-inf \ classes directory under roles.properties and users.properties, configure users and user role here is the role defined in web.xml file in the role. 
  3. Server \ default \ cof \ login-config.xml, the definition of the use of various webapp login strategy, which is the definition-login module. 
  4. WEB-INF \ jboss-web.xml file, configuration and the webapp-config.xml login sign in the corresponding relations strategy. 
  ↑ Back 

Environmental variables, asked the experts to help look at?

  Abstract: The problem of the environment variable, and asked the experts to help look at? 


  I javac HelloBean.java error in the operation, suggesting that 
  HelloBean.java: 3: cannot resolve symbol 
  Symbol: class CreatException 
  Location: package ejb 
  Import javax.ejb.CreatException; 

  Environment variables are as follows: 
  CLASSPATH: C: / Sun/AppServer/lib/j2ee.jar; C: / bea/wlserver6.1/lib/weblogic.jar 
  JAVA_HOME: C: / j2sdk1.4.2_10 
  J2EE_HOME: C: / Sun / AppServer 
PATH:
  % SystemRoot% / system32;% SystemRoot%% SystemRoot% / System32/Wbem; C: / Program Files / Microsoft SQL Server/80/Tools/BINN; C: / PROGRA ~ 1/Borland/Delphi6/Bin; C: / PROGRA ~ 1/Borland/Delphi6/Projects/Bpl; C: / j2sdk1.4.2_10/bin; C: / Sun / AppServer / bin 



  / / Need to introduce this type of class or interface 
  Import javax.ejb.CreatException; 
  Import javax.ejb.SessionBean; 
  Import javax.ejb.SessionContext; 

  Public class HelloBean implements SessionBean 
  ( 
  Private SessionContext ctx; 
  Private String words; 
  Public void setSessionContext (SessionContext ctx) 
  ( 
  This.ctx = ctx; 
  ) 
  / / And the corresponding definition of the interface method, we must realize 
  Public void ejbCreate () throws CreateException 
  ( 
  Words = "Hello Word !!!"; 
  ) 
  / / Client call for the business logic, here simply print string, the string and return to the client 
  Public String SayHello () 
  ( 
  System.out.println ( "I am in an EJB of Server." + Words); 
  Return words; 
  ) 
  ) 



CLASSPATH
  Also.; Dt.jar path; tools.jar path 



  Gefengxztg: 
  I would like to ask about, and I dt.jar Add classpath tools.jar path, and still can not find ejb suggested that this package. 

  New configuration path is as follows: 
  CLASSPATH: C: / Sun/AppServer/lib/j2ee.jar; C: / bea/wlserver6./lib/weblogic.jar; 
  C: / bea/jdk131/lib/tools.jar; C: / bea/jdk131/lib/dt.jar 
  JAVA_HOME: C: / bea/jdk131 
  J2EE_HOME: C: / Sun / AppServer 
PATH:
  % SystemRoot% / system32;% SystemRoot%% SystemRoot% / System32/Wbem; C: / Program Files / Microsoft SQL Server/80/Tools/BINN; C: / PROGRA ~ 1/Borland/Delphi6/Bin; C: / PROGRA ~ 1/Borland/Delphi6/Projects/Bpl; C: / j2sdk1.4.2_10/bin; C: / Sun / AppServer / bin; 
  C: / bea/jdk131/bin 



  The main problem is not ejb this package. 



  CLASSPATH: C: / Sun/AppServer/lib/j2ee.jar; C: / bea/wlserver6.1/lib/weblogic.jar wrong should be a plus. 

  Still inside path to C: / Sun/AppServer/lib/j2ee.jar; C: / join bea/wlserver6.1/lib/weblogic.jar 



  Wmzsl; 
  I now re-configuration of a path, but the compiler procedures, or find tips ejb this package, the source is at the top. 

  New configuration path is as follows: 
CLASSPATH:
  C: / Sun/AppServer/lib/j2ee.jar; C: / bea/wlserver6.1/lib/weblogic.jar; C: / bea/jdk131/lib/tools.jar; C: / bea/jdk131/lib / dt.jar. 

  JAVA_HOME: C: / bea/jdk131 
  J2EE_HOME: C: / Sun / AppServer 

PATH:
  % SystemRoot% / system32;% SystemRoot%% SystemRoot% / System32/Wbem; C: / Program Files / Microsoft SQL Server/80/Tools/BINN; C: / PROGRA ~ 1/Borland/Delphi6/Bin; C: / PROGRA ~ 1/Borland/Delphi6/Projects/Bpl; C: / j2sdk1.4.2_10/bin; C: / Sun / AppServer / bin; C: / bea/jdk131/bin; C: / Sun/AppServer/lib/j2ee . jar; C: / bea/wlserver6.1/lib/weblogic.jar 




  Source should be CreateException, missed a e 



  OK, thank you, ask more than one way, I am now in the machine inside a c: / j2sdk1.4.2_10 and C: / bea/jdk131, What is the difference between them?    If I JAVA_HOME variables will be c: / j2sdk1.4.2_10, what would be the difference? 



  Distinction is a version of a high-end version, if used at the end of version 1.3 can not use, such as 1.4 nio will only emerge when the function, probably it is so 



  Oh, I would like to thank the. 


  ↑ Back 

Come to look at the masters

  Abstract: experts come to see 


  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 
  You do so from out if it is INT has been assigned to a database of the operation if I do so only id = a check that his scope enough ah ~ 




  ? 



  Halo … 
  Your definition of a try in the outside 
  Int a = 0 
  Try ( 
  A =?; 
  ) 
  Catch () ( 

  ) 
  A method in the whole scope of the applicable 



  Int a = 0; 

  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 




  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 

  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  ) 
  Changed so the best 




  Catch inside write these rare.    .    .    This will not improve code efficiency 



  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 
======================================
  What this messy, so use? 

==>

  Try ( 
  Int a = Integer.parseInt (kob.getArea ()); 
  / / System.out.println (a); 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) Catch (NumberFormatException ex1) ( 
  Ex1.printStackTrace (); 
  ) 




  This is in order to fill because of abnormal operating in the database can not be read out when the judgement is not just numbers or strings unusual to use it to control you Xianxiao the issue is resolved ~ ~ 



  Up 



  Recommendations if (ex1.equals ( "") | | ex1 == null) ( 
  Changed if (ex1 == null | | (ex1.equals ("")) 
  Otherwise mistakes 



  Ex1 how likely equals ("")? 
  Niutoubuduimazui ah 


  ↑ Back 

Save me!

  Abstract: Save me! 


  Using JSP do NEE such as a chat room how he was landing user name (or global variables, can be in what I would like to use the time when the use of, for example, I want to modify a table straight, the condition is userName to mean that I landing userName) 
  Session can not be used should be in the category I want to use my user information is packaged in a User's category Whenever I hear the landing from users u.setUserName () Add category, the use of u.getUserName () removed.    In the end I do not know what facing which, painful ah, but also expect it to help me interview ah!    How do? 




UP



  As this is the preservation of user information session tracking, it is necessary to do the session because session to session is devoted to tracking, it will visit the Web site each user in the time allocated to each user a session, and this sessionid stored in a user's local, cokie.    Therefore, user requests each visit can be judged from the user information come from?    And you do it with class unable to determine the users come from its second visit you can not judge is a user.    This session tracking If you do not have to session, unless you write a session function.    As a matter of fact this is impossible. 



  I also think that should be preserved in a session 


  ↑ Back 

Rookie ask: What is a plant?

  Abstract: Rookie ask: What is a plant? 


  EJB connection pool and the use of the time should be used factory class, which Big Brother can tell me what is the factory?    The more detailed the better explanation, thank you! 



  Is used to manufacture products, the specific reference to the factory design pattern mode 



  For example, in tomcat in the server.xml configuration file when the connection pool:    Type = "org.apache.catalina.UserDatabase" 
  Description = "User database that can be updated and saved" 
  Factory = "org.apache.catalina.users.MemoryUserDatabaseFactory" 
  Pathname = "conf / tomcat-users.xml" /> 
  Of which: factory = "org.apache.catalina.users.MemoryUserDatabaseFactory" is to do what is the use? 



  Halo, is not familiar with the java began with a tomcat. 
  First learn j2se Zailong web bar. 



  We have followed the paste:) 



  Passing, friendship up! 



  Passing, friendship up! 




  A design model, you can look at the design pattern java, I understand it is an interface, its own module abstract it, and then extends it 



  Passing, friendship up! 



  Passing, friendship up! 


  ↑ Back 

POI use of electronic forms generated genuine documents

  Abstract: POI generates true electronic form documents 

  A large number of articles have mentioned the cfm the issue of creating an electronic form:) 

  Many are generated by a txt file cfhead modify header deceived browser 

  <cfset Tabchar=chr(9) /> 
  <cfset Newline=chr(13)&chr(10) /> 
  <cfcontent Type="application/msexcel; charset=gbk"> 
  <cfoutput> String # # </ cfoutput> 

  This of course will change several of the more obvious advantage txt file can be the majority of the office into the right tools and display content 

  But if we need to generate a genuine form of electronic documents time, or do I need to create a work table contains several excel document, this method is insufficient we need to use apache POI project 

  Http://jakarta.apache.org/poi/hssf/quick-guide.html 

  Here to refer to the relevant information first of all, you need to download the file and put poi.jar cfusion / lib directory to coldfusion visit to the class poi 

  Then 

  New Workbook 
  HSSFWorkbook wb = new HSSFWorkbook (); 
  FileOutputStream fileOut = new FileOutputStream ( "workbook.xls"); 
  Wb.write (fileOut); 
  FileOut.close (); 

  New Sheet 
  HSSFWorkbook wb = new HSSFWorkbook (); 
  HSSFSheet sheet1 = wb.createSheet ( "new sheet"); 
  HSSFSheet sheet2 = wb.createSheet ( "second sheet"); 
  FileOutputStream fileOut = new FileOutputStream ( "workbook.xls"); 
  Wb.write (fileOut); 
  FileOut.close (); 

  Creating Cells 
  HSSFWorkbook wb = new HSSFWorkbook (); 
  HSSFSheet sheet = wb.createSheet ( "new sheet"); 

  / / Create a row and put some cells in it. 0 Rows are based. 
  Sheet.createRow HSSFRow row = ((short) 0); 
  / / Create a cell and put a value in it. 
  HSSFCell cell row.createCell = ((short) 0); 
  Cell.setCellValue (1); 

  / / Or do it on one line. 
  Row.createCell ((short) 1). SetCellValue (1.2); 
  Row.createCell ((short) 2). SetCellValue ( "This is a string"); 
  Row.createCell ((short) 3). SetCellValue (true); 

  / / Write the output to a file 
  FileOutputStream fileOut = new FileOutputStream ( "workbook.xls"); 
  Wb.write (fileOut); 
  FileOut.close (); 

  Call interface and is very simple, having chosen a coldfusion we should be able to do more simply because the project need to use this function in a simple package, some of the most essential functions 

<cfcomponent>

  <cffunction Name="createWorkbook" access="public" output="false" returntype="struct"> 
<cfscript>
  Structnew instance = (); 
  Instance.HSSFWorkbook = createObject ( "java", "org.apache.poi.hssf.usermodel.HSSFWorkbook"). Init (); 
  </ Cfscript> 
  <cfreturn This /> 
  </ Cffunction> 

  <cffunction Name="save" access="public" output="false" returntype="void"> 
  <cfargument Name="file" required="no" default="Sheet1" type="string" /> 
<cfscript>
  / / Init File Stream 
  Instance.FileOutputStream = createObject ( "java", "java.io.FileOutputStream"). Init (arguments.file); 
  Instance.HSSFWorkbook.write (instance.FileOutputStream); 
  Instance.FileOutputStream.close (); 
  </ Cfscript> 
  </ Cffunction> 

  <cffunction Name="createSheet" access="public" output="false" returntype="void"> 
  <cfargument Name="SheetName" required="no" default="Sheet1" type="string" /> 
<cfscript>
  / / Create sheet 
  Instance.HSSFSheet = instance.HSSFWorkbook.createSheet (); 
  / / Alert sheet name 
  Instance.HSSFWorkbook.setSheetName (0, arguments.SheetName, instance.HSSFWorkbook.ENCODING_UTF_16); 
  </ Cfscript> 
  </ Cffunction> 

  <cffunction Name="setSheetName" access="public" output="false" returntype="void"> 
  <cfargument Name="SheetName" required="no" default="Sheet1" type="string" /> 
<cfscript>
  / / Alert sheet name 
  Instance.HSSFWorkbook.setSheetName (0, arguments.SheetName, instance.HSSFWorkbook.ENCODING_UTF_16); 
  </ Cfscript> 
  </ Cffunction> 

  <cffunction Name="createRow" access="public" output="false" returntype="void"> 
  <cfargument Name="RowsNumber" required="no" default="0" type="numeric" /> 
<cfscript>
  / / Create a row and put some cells in it. 0 Rows are based. 
  Instance.HSSFRow = instance.HSSFSheet.createRow (arguments.RowsNumber); 
  </ Cfscript> 
  </ Cffunction> 

  <cffunction Name="createCell" access="public" output="false" returntype="void"> 
  <cfargument Name="Column" required="no" default="0" type="numeric" /> 
  <cfargument Name="CellValue" required="no" default="" type="string" /> 
<cfscript>
  / / Create a cell and put a value in it. 
  Instance.HSSFCell = instance.HSSFRow.createCell (arguments.Column); 
  Instance.HSSFCell.setencoding (instance.HSSFCell.encoding_UTF_16); 
  Instance.HSSFCell.setCellValue (javacast ( "String", arguments.CellValue)); 
  </ Cfscript> 
  </ Cffunction> 

  </ Cfcomponent> 

  Java is actually several of the above functions in a package called to cfc way as Below 

  Temp_file = application._physical_cache_jdbc_dir & application._separator & createUUID () &. "Tempxls"; 

  Rs_agents = createobject ( "component", "# # application._components_prefix database.mail.utility"). Get_agent_fed (); 

  Obj = createobject ( "component", "# # application._components_prefix xls.entity"). CreateWorkbook (); 

  Obj.createSheet ( "Information Rapporteur feedback"); 
  Obj.createRow (0); 

  Obj.createCell (0, "Information Rapporteur #"); 
  Obj.createCell (1, "name"); 
  Obj.createCell (2, "classes"); 
  Obj.createCell (3, "Feedback"); 
  Obj.createCell (4, "Registry Reply"); 
  Obj.createCell (5, "Teaching Week"); 
  Obj.createCell (6, "date"); 

  While (rs_agents.next ()) ( 
  Obj.createRow (rs_agents.currentrow); 
  Obj.createCell (0, rs_agents.sender_id); 
  Obj.createCell (1, rs_agents.stu_name); 
  Obj.createCell (2, rs_agents.taskclass_chs); 
  Obj.createCell (3, xls_safe (rs_agents.mail_content)); 
  Obj.createCell (4, iif (rs_agents.reply_content neq "," de ( "# xls_safe (rs_agents.reply_content )#"), de (" "))); 
  Obj.createCell (5, rs_agents.current_week); 
  Obj.createCell (6, LSDateFormat (rs_agents.mail_senttime, "YYYY-MM-DD")); 
  ) 

  Obj.save (temp_file); 

  Xls can directly generate a document 

  ↑ Back 

Weblogic under a question on the ejb

  Abstract: Under Weblogic on an issue ejb 


  The following code of the unusual 

  ELoginHome = (EjbLoginHome) ejbCtx.lookup ( "EjbSLogin.EjbLoginHome"); 

  Dished out 
  Javax.naming.NameNotFoundException: While trying to lookup 'EjbSLogin.EjbLoginHome' didn't find subcontext 'EjbSLogin'.''Resolved; remaining name 'EjbSLogin / EjbLoginHome' 

  Many of the poor to the Internet are similar but there is no clear answer seems to be the jndi not configured weblogic 

  Please advice to people!    Thank you 



  ELoginHome = (EjbLoginHome) ejbCtx.lookup ( "EjbSLogin.EjbLoginHome"); 
  Lookup parameters should be EjbLogin it is the name of your Ejb otherwise, you go to Weblogic console, "serversmyserver" point right, "View Jndi Tree" look at the deployment of the latter, what is the name of Ejb 



  ELoginHome = (EjbLoginHome) ejbCtx.lookup ( "EjbSLogin.EjbLoginHome"); This code should be no problem with this is the normal operation of the system the original section of the code.    In the corresponding ejb-jar.xml and weblogic-ejb-jar.xml referred to the EjbSLogin.EjbLoginHome This is where I am very confused. 

  My guess is that should be in the jndi weblogic part configuration.    Specific Let me how to do is confuse the guidance of Senator Wang 



  Bangding 



  Most of the code there is no problem, the problem may be in the deployment descriptor file. 

  Weblogic-ejb-jar.xml 
///////

DidoleoService
  Csdn / DidoleoServiceBean 

  ↑ Back 

(Urgent) server bandwidth in the 10 M / s, at the same time support the number of users will probably visit?

  Abstract: (urgency) server bandwidth in the 10 M / s, at the same time support the number of users will probably visit? 


  Server bandwidth in the 10 M / s, at the same time support the number of users will probably visit? 
  Is the main website, and includes part of the video 



  This just, first of all, many people, the customers will definitely slow speed, it is estimated about 1,000 bar, 



  Specific depends on the efficiency of your process 



  Bandwidth and the effectiveness of the procedure have any relations?    I would like to provide me with the types of resources? 
  I would like to know if the majority of the web site, plus part of the video, probably at the same time the number of users online at the beginning because the server bandwidth reasons for the delay. 



  The video also with dozens of words between 30-50 around, but also broadcast media types. 



  Video is only a relatively small part of the main or ordinary website + picture, 
  Ps: What type of video is relatively good?    RM? 



  Up 



  Up 



  10M is the actual nominal bandwidth or bandwidth, if it is the actual bandwidth can be 1000 (video only 50), the need to reduce the nominal bandwidth is 10 times 


  ↑ Back 

keep looking »