11/25/15

Tutorial to create Drill Down Reports using Jasper Reports

Link demo: https://www.youtube.com/watch?v=w6fq1kdeElY
All in one images:
Step 1: open Hyperlink of a field in main report
Step 2: Select Link Target = Self   ;   Slect Link Type = ReportExecution
Step 3: Find on Target Report (DrillDown Report) two main input-parameters to open the report via link from main report. (in my case the drilldown report just need one parameter (requestID) and the Path will be got from Properties popup window of target report.


Now you can cook your linking report (main report) with all what I show here:




10/20/15

Ubuntu: Remmina Copy and Paste not Working

POSSIBLE WORKAROUND:
Ok, I was reading the README in the new source code. I got to the line were it says: install dependencies:
$ sudo apt-get install cmake intltool libgtk-3-dev libssh-dev libavahi-ui-gtk3-dev libvte-2.90-dev libxkbfile-dev
Once I installed that, I tested the old version I am currently using, Remmina 0.9.99.1 runs, (as it did) but copy paste functionality has resumed!
The source for version 1 still failed to compile, that's a bummer, but as long as i can copy and paste in a relatively new version, I'm ok with this solution. Try it if you like. I'll look into compiling the new version later.
At this point, the bug would seem to be a dependency issue. perhaps there are log files that will give more information about this.
A successful work-around (for me) was achieved by running the following (in one command-line):
sudo apt-add-repository ppa:remmina-ppa-team/remmina-next ; sudo apt-get update ; sudo apt-get install remmina remmina-plugin-rdp
You may have to reboot after this to see the new version of Remmina that this installs (I did).

10/14/15

STS shortcuts

Shortcuts
Description
“sysout” + Crtl + Space
Quick System.out.println()
Alt + Enter
Open project properties
Alt + Shift + R
Rename
Alt + Shift + S
Context menu with possible actions
Alt + Shift + S, C
Generate constructor from superclass
Alt + Shift + S, H
Generate hashCode() and equals()
Alt + Shift + S, O
Generate constructor using fields
Alt + Shift + S, R
Generate getters and setters
Alt + Shift + S, S
Generate toString()
ALT <- or ALT ->
Go to previous or next edit positions from editor history list
ALT SHIFT Z
Enclose block in try-catch
Crtl + Alt + Down arrow
Copy current line below
Crtl + D
Delete current line
Crtl + I
Indent lines
Crtl + L
Go To Line Number
Crtl + N
Open New file/project wizard
Crtl + Shift + C
Add / remove single line comments
Crtl + Shift + F
Format code
Crtl + Shift + L
Quick Text Search (STS only)
Crtl + Shift + O
Organize import statements
Crtl + Space
Autocomplete
Crtl + W
Close currently viewed file
CTRL /
Comment a line
CTRL E
Open a file (editor) from within the list of all open files
CTRL H
Java search in workspace
CTRL M
Maximize editor
CTRL O
List all methods of the class and again CTRL O lists including inherited methods
CTRL PAGE UP or PAGE DOWN
Navigate to previous or next file from within the list of all open files
CTRL SHIFT G
Search for current cursor positioned word reference in workspace
CTRL SHIFT P
Go to the matching parenthesis
CTRL SHIFT R
Open a resource
CTRL SHIFT U
Find reference in file
CTRL T
Show inheritance tree of current token.
F3
Go to the declaration of the variable.
F4
Show type hierarchy of on a class.
Shift + Enter
Insert blank line after current line
SHIFT F2
Show Javadoc for current element

10/12/15

Simply Singleton

An alternative thread-safe singleton implementation

Example 7 lists a simple, fast, and thread-safe singleton implementation:

Example 7. A simple singleton

public class Singleton {
   public final static Singleton INSTANCE = new Singleton();
   private Singleton() {
         // Exists only to defeat instantiation.
      }
}
The preceding singleton implementation is thread-safe because static member variables created when declared are guaranteed to be created the first time they are accessed. You get a thread-safe implementation that automatically employs lazy instantiation; here's how you use it:
Singleton singleton = Singleton.INSTANCE;
      singleton.dothis();
      singleton.dothat();
      ...
Of course, like nearly everything else, the preceding singleton is a compromise; if you use that implementation, you can't change your mind and allow multiple singleton instances later on. With a more conservative singleton implementation, instances are obtained through a getInstance() method, and you can change those methods to return a unique instance or one of hundreds. You can't do the same with a public static member variable.

8/19/15

Data codes related to 'LDAP: error code 49' with Microsoft Active Directory

Data codes related to 'LDAP: error code 49' with Microsoft Active Directory

Technote (troubleshooting)


Problem

When IBM® WebSphere® Portal accesses the LDAP (in this case Microsoft® Active Directory), either to start the server or during configuration tasks, "LDAP: error code 49" can be encountered.

Symptom

Generally, error references SECJ0369E and SECJ0055E will be generated in the SystemOut.log. There are, however, various root causes that can be derived from the values that follow the initial description. An example is shown below.
From SystemOut.log:

[date/time] 0000000a LdapRegistryI A SECJ0419I: The user registry is currently connected to the LDAP server ldap://:389.
[date/time] 0000000a LTPAServerObj E SECJ0369E: Authentication failed when using LTPA. The exception is [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 775, vece ].
[date/time] 0000000a distContextMa E SECJ0270E: Failed to get actual credentials. The exception is javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 775, vece ]
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3005)


In this case, validate-ldap is the config task that was failing, and from the ConfigTrace.log we see:

action-validate-ldap-was-admin-user:
[ldapcheck] ###########################
[ldapcheck] ldapURL : :389
[ldapcheck] ldapUser : CN=wasadmin,OU=WebspherePortal,OU=Service Accounts,DC=select,DC=corp,DC=sem
[ldapcheck] ldapPassword : *********
[ldapcheck] ldapSslEnabled : false
[ldapcheck] javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 775, vece ]
[ldapcheck] ERROR: 4
[ldapcheck] Invalid or insufficient authorization privileges.
Target finished: action-validate-ldap-was-admin-user

Cause

The error shown below is similar each time there is an LDAP authentication issue. 
    "The exception is [ LDAP: error code 49 - 80090308: LdapErr: DSID-0Cxxxxxx, comment: AcceptSecurityContext error, data xxx, vece ]."

However, there are several values that can indicate what LDAP function is causing the issue. Here are some general references for Microsoft Active Directory:

The AD-specific error code is the one after "data" and before "vece" or "v893" in the actual error string returned to the binding process

525user not found
52einvalid credentials
530not permitted to logon at this time
531not permitted to logon at this workstation
532password expired
533
534
account disabled
The user has not been granted the requested logon type at this machine
701account expired
773user must reset password
775user account locked

     
Common Active Directory LDAP bind errors: 

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893
HEX: 0x525 - user not found 
DEC: 1317 - ERROR_NO_SUCH_USER
 (The specified account does not exist.)
NOTE: Returns when username is invalid.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 52e, v893
HEX: 0x52e - invalid credentials 
DEC: 1326 - ERROR_LOGON_FAILURE
 (Logon failure: unknown user name or bad password.)
NOTE: Returns when username is valid but password/credential is invalid. Will prevent most other errors from being displayed as noted.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 530, v893
HEX: 0x530 - not permitted to logon at this time 
DEC: 1328 - ERROR_INVALID_LOGON_HOURS 
(Logon failure: account logon time restriction violation.)
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 531, v893
HEX: 0x531 - not permitted to logon from this workstation 
DEC: 1329 - ERROR_INVALID_WORKSTATION
 (Logon failure: user not allowed to log on to this computer.)
LDAP[userWorkstations: ]
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 532, v893
HEX: 0x532 - password expired 
DEC: 1330 - ERROR_PASSWORD_EXPIRED
 (Logon failure: the specified account password has expired.)
LDAP[userAccountControl: ] - PASSWORDEXPIRED
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 533, v893
HEX: 0x533 - account disabled 
DEC: 1331 - ERROR_ACCOUNT_DISABLED 
(Logon failure: account currently disabled.)
LDAP[userAccountControl: ] - ACCOUNTDISABLE
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 701, v893
HEX: 0x701 - account expired 
DEC: 1793 - ERROR_ACCOUNT_EXPIRED 
(The user's account has expired.)
LDAP[accountExpires: ] - ACCOUNTEXPIRED
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 773, v893
HEX: 0x773 - user must reset password 
DEC: 1907 - ERROR_PASSWORD_MUST_CHANGE 
(The user's password must be changed before logging on the first time.)
LDAP[pwdLastSet: ] - MUST_CHANGE_PASSWD
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 775, v893
HEX: 0x775 - account locked out 
DEC
: 1909 - ERROR_ACCOUNT_LOCKED_OUT (The referenced account is currently locked out and may not be logged on to.)
LDAP[userAccountControl: ] - LOCKOUT
NOTE: Returns even if invalid password is presented

The DEC: values are not presented in Portal logs; however, review of LDAP activity combined with analysis of SystemOut.log and relevant configuration tasks can help narrow down the root cause.

Resolving the problem

NOTE: This document is not meant to provide a solution to any LDAP errors. Since the full LDAP error described in the DEC statement is not captured in the Portal logs, this document can be used to associate the errors found in the SystemOut.log to common LDAP errors for MSAD.
Use the codes above to verify the settings and users in LDAP.

6/2/15

How to Compile Linux Kernel from Source to Build Custom Kernel


he life force of all Linux family of operating systems including Ubuntu, CentOS, and Fedora
For most part, you don’t need to compile the kernel, as it is installed by default when you install the OS. Also, when there is a critical update done to the kernel, you can use yum, or apt-get to update the kernel on your Linux system.

However you might encounter certain situation, where you may have to compile kernel from source. The following are few situation where you may have to compile Kernel on your Linux system.
  • To enable experimental features that are not part of the default kernel.
  • To enable support for a new hardware that is not currently supported by the default kernel.
  • To debug the kernel
  • Or, just to learn how kernel works, you might want to explore the kernel source code, and compile it on your own.
In this tutorial, we’ll explain how to compile Linux kernel from source.
Also, please note that if you just want to compile a driver, you don’t need to compile the kernel. You need only the linux-headers package of the kernel.

1. Download the Latest Stable Kernel

The first step is to download the latest stable kernel from kernel.org.
# cd /usr/src/

# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.3.tar.xz

2. Untar the Kernel Source

The second step is to untar the kernel source file for compilation.
# tar -xvJf linux-3.9.3.tar.xz

3. Configure the Kernel

The kernel contains nearly 3000 configuration options. To make the kernel used by most people on most hardware, the Linux distro like Ubuntu, Fedora, Debian, RedHat, CentOS, etc, will generally include support for most common hardware. You can take any one of configuration from the distro, and on top of that you can add your own configuration, or you can configure the kernel from scratch, or you can use the default config provided by the kernel.
# cd linux-3.9.3

# make menuconfig
The make menuconfig, will launch a text-based user interface with default configuration options as shown in the figure. You should have installed “libncurses and libncurses-devel” packages for this command to work.
We will use the default config provided by the kernel. So select “Save” and save the config in the file name “.config”.
The following is a sample of the “.config” file:
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y

4. Compile the Linux Kernel

Compile the main kernel:
# make
Compile the kernel modules:
# make modules
Install the kernel modules:
# make modules_install
At this point, you should see a directory named /lib/modules/3.9.3/ in your system.

5. Install the New Kernel

Install the new kernel on the system:
# make install
The make install command will create the following files in the /boot directory.
  • vmlinuz-3.9.3 – The actual kernel
  • System.map-3.9.3 – The symbols exported by the kernel
  • initrd.img-3.9.3 – initrd image is temporary root file system used during boot process
  • config-3.9.3 – The kernel configuration file
The command “make install” will also update the grub.cfg by default. So we don’t need to manually edit the grub.cfg file.

6. Boot Linux to the new Kernel

To use the new kernel that you just compiled, reboot the system.
# reboot
Since, in grub.cfg, the new kernel is added as default boot, the system will boot from the new kernel. Just in case if you have problems with the new kernel, you can select the old kernel from the grub menu during boot and you can use your system as usual.
Once the system is up, use uname command to verify that the new version of Linux kernel is installed.
$ uname -r
3.9.3

5/29/15

JAX-WS Web Service Example Using Eclipse(STS)

In this tutorial , we will create hello world SOAP web service example in eclipse(STS). Eclipse (STS) provides good API for creating web services. Eclipse(STS) will do all work for you-creating WSDL, stub, endpoints etc.


Steps for creating web services in eclipse(STS):

1. Create new dynamic web project and name it "WebService".


2. Create new package named "com.dineshonjava.com"


3.Create a simple java class named "HelloWorld.java"
  1. package com.dineshonjava.ws;  
  2.   
  3. import javax.jws.WebMethod;  
  4. import javax.jws.WebService;  
  5. import javax.jws.soap.SOAPBinding;  
  6. import javax.jws.soap.SOAPBinding.Style;  
  7.   
  8. /** 
  9.  * @author Dinesh Rajput 
  10.  * Service Endpoint Interface 
  11.  */  
  12.   
  13. @WebService  
  14. @SOAPBinding(style = Style.RPC)  
  15. public interface HelloWorld {  
  16.  @WebMethod   
  17.  String sayHelloWorld(String name);  
  18. }  

4. Right click on project->new->web service


5. Click on next.


In service implementation text box,write fully qualified class name of above created class(com.dineshonjava.ws.HelloWorldImpl) and move both above slider to maximum level (i.e. Test service and Test Client level)and click on finish. You are done!! A new project named "WebServiceClient" will be created in your work space.

6. Click on next.



7. Start Server.


8. After clicking start server,eclipse will open test web service API. With this test API, you can test your web service.




Note: Sometimes we get the following exception when we creating Web Service using Eclipse or STS

IWAB0506E Error when copying Axis jar files to web project
        java.io.FileNotFoundException: /lib/saaj.jar
        at org.eclipse.osgi.framework.internal.protocol.bundleentry.Handler.findBundleEntry(Handler.java:44)
        at org.eclipse.osgi.framework.internal.core.BundleResourceHandler.openConnection(BundleResourceHandler.java:168)
        at java.net.URL.openConnection(Unknown Source)
        at java.net.URL.openStream(Unknown Source)
        at

FileNotFoundException in Eclipse when creating a webservice

 




References
1. W3 School for Web Services
2. Wikipedia for Web Service