Recent Notes

Displaying keyword search results 11 - 20
Created by alfa on June 02, 2011 15:26:37    Last update: June 02, 2011 15:26:37
While doing some Java reflection code, I noticed the method Class.isSynthetic() , which the JavaDoc says returns " true if and only if this class is a synthetic class as defined by the Java Language Specification". However, there's no definition of "synthetic class" in the JLS ! The only thing that I can find that remotely resembles a definition is in the JVM spec , where it defines the synthetic attribute : "The Synthetic attribute is a fixed-length attribute in the attributes table of ClassFile (§4.1), field_info (§4.5), and method_info (§4.6) structures. A class member that does not appear in the source code must be marked using a Synthetic attribute." By this definition, a default constructor, which does not appear in the source code, should...
Created by jinx on May 03, 2011 08:56:55    Last update: May 03, 2011 08:57:54
These error level constants are defined in PHP : Constant Value Description E_ERROR 1 Fatal run-time errors. Execution of the script is halted. E_WARNING 2 (1<<1) Run-time warnings (non-fatal errors). Execution of the script is not halted. E_PARSE 4 (1<<2) Compile-time parse errors. Parse errors should only be generated by the parser. E_NOTICE 8 (1<<3) Notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. E_CORE_ERROR 16 (1<<4) Fatal errors that occur during PHP's initial startup. This is like an E_ERROR, except it is generated by the core of PHP. E_CORE_WARNING 32 (1<<5) Warnings (non-fatal errors) that occur during PHP's initial startup. This is like an E_WARNING, except it is generated...
Created by Dr. Xi on April 27, 2011 15:58:31    Last update: April 27, 2011 20:05:22
From JavaDoc : java.util.concurrent.locks.ReentrantLock is a reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities. The extended capabilities are: tryLock() : acquire the lock if possible, otherwise immediately return false. tryLock(long timeout, TimeUnit unit) : acquire the lock within the timeout, return false after timeout. lockInterruptibly() : try to acquire the lock and enter wait state, but can be interrupted by other threads and exit waiting. The following shows how java.util.concurrent.locks.ReentrantLock can be used. Start two threads to manipulate the same counter, one incrementing, the other decrementing. Since the counter is incremented and decremented the same number of times, in the end, it should be 0. Without locking,...
Created by meiu on February 09, 2010 03:26:14    Last update: March 31, 2011 09:00:19
Simple JDBC code for Oracle. import java.sql.*; public class JDBCHelloWo...
Created by Dr. Xi on February 17, 2011 16:09:49    Last update: February 17, 2011 16:09:49
This is a common problem with shell scripts running from cron. Everything works perfectly fine from the command prompt, but fails when running from cron. In the worst cases, the job fails silently, even giving a return code of 0! Usually, these are caused by differences between the execution environments: the interactive shell (command line) has more environment variables defined/exported (through .kshrc , .bashrc etc.) than the shell started by cron. A simple way to resolve the differences is to run set in the command prompt and compare the output with the output of set from cron (add a single line to the shell script). You can also make the shell script more verbose by adding the -x switch: #!/bin/sh -x
Created by Dr. Xi on February 09, 2011 15:35:41    Last update: February 09, 2011 15:36:08
Perl BEGIN and END blocks are executed at the beginning and at the end of a running Perl program. By the Perl doc : A BEGIN code block is executed a s soon as possible , that is, the moment it is completely defined, even before the rest of the containing file (or string) is parsed . You may have multiple BEGIN blocks within a file (or eval'ed string); they will execute in order of definition. Because a BEGIN code block executes immediately, it can pull in definitions of subroutines and such from other files in time to be visible to the rest of the compile and run time. Once a BEGIN has run, it is immediately undefined and any code it used is returned...
Created by nogeek on December 31, 2010 11:56:25    Last update: December 31, 2010 11:56:25
These are the steps to create a JBoss 5.1.0 configuration with Tomcat from the built-in minimal configuration. Change directory to $JBOSS_HOME/server . Make a copy of the minimal configuration. cp -R minimal tomcatonly Copy bindingservice.beans from the default configuration. cp -R default/conf/bindingservice.beans tomcatonly... Copy login-config.xml from the default configuration. cp default/conf/login-config.xml tomcatonly/conf/ Edit tomcatonly/conf/jboss-service.xml : Add jars from the common/lib directory: <!-- Load all jars from the JBOSS_DIST/serv... Add the JAAS security manager section (copy from the default profile, and yes, JBoss tomcat can't live without the JBoss JAAS manager). <!-- JAAS security manager and realm mappin... Copy the Tomcat (JBoss web) deployer from the default configuration. cp -R default/deployers/jbossweb.deployer tomcaton... Copy metadata-deployer-jboss-beans.xml and security-deployer-jboss-beans.xml from the default profile. cp default/deployers/metadata-deployer-jboss-b... Copy...
Created by Dr. Xi on April 06, 2010 22:55:13    Last update: April 06, 2010 22:56:38
These are the steps to diagnose the "javax.jms.Destination found at the specified destination-location" error an MDB in the Oracle application server (oc4j) environment. The data source is correctly configured and connection can be successfully established. Test this from the Oracle AS em console. The destination queue exists and is started. If you are using PL/SQL Developer, you can check this by right clicking on the queue name and make sure that "Enqueue Enabled" and "Dequeue Enabled" are checked. Deployment descriptors are correctly set up. The database user used for the JDBC connection pool has the proper privileges to enqueue and dequeue. Usually this means that the database user is assigned the AQ_USER_ROLE . The ultimate test is to run some PL/SQL code in the oc4j...
Created by Dr. Xi on September 29, 2008 23:21:38    Last update: January 16, 2010 23:36:05
Create a startup script for inetd Copy /etc/init.d/skeleton to /etc/init.d/inetd . Change the top section of the script to read: PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="In... Now inetd can be stopped/started/restarted like this: sudo /etc/init.d/inetd stop sudo /etc/init.... Add links to rc*.d $ sudo update-rc.d inetd defaults Adding sy... If you no longer need to start inetd at boot up: $ sudo update-rc.d -f inetd remove update-r... This would remove the links from the start up sequence but leave /etc/init.d/inetd in place. Contents of /etc/init.d/skeleton : #! /bin/sh ### BEGIN INIT INFO # Provide...
Created by Dr. Xi on October 09, 2009 19:27:22    Last update: October 09, 2009 19:30:01
PL/SQL code from Pandazen : CREATE OR REPLACE FUNCTION GET_INSERT_SCRIPT(V_TAB... Usage: To create the script for generating the INSERT statements: set head off set pages 0 set trims on set... Run the resulting script to generate the INSERT script: set pages 0 set trims on set lines 2000 ... PL/SQL code from Oracle Ask Tom set serveroutput on size 100000 set feedbac...
Previous  1 2 3 Next