Java Reading from a socket

Socket socket = new Socket(); try { socket.connect(new InetSocketAddress("", 7777)); System.out.println("connected!"); BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

Java Eclipse Remote Debugging

This could be needed to remote debug a java program first on the remote or to simulate it on your machine issue the below code to run it in debug mode java.exe -Xdebug -Xrunjdwp:transport=dt_socket,address=9991,server=y,suspend=n -jar C:\Users\tugrul.aslan\xxx.jar   then in eclipse Run ==> Debug configurations

LAMP Stack on Windows

Apache 2.4 Installation Download Apache 2.4.16 win32 from Apache lounge – Unzip entire content to C: and keep the folder name as given Visual C++ Redistributable for Visual Studio 2015 package for Win32 and install it – Go to unzipped Apache folder –> conf edit httpd.conf and edit those lines; Listen *:80 remove #

Callable Interface

Normally when we work with threads and runnable does not return a processed product, for that reason we either need to have our own implementations using observer pattern or Callable interface provided default by Java Even Callable interface has been designed by using observer patter. Observer pattern is simply to notify other concrete classes when one

Spring + ZKoss Customized Login, Logout, Authorization and Authentication public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter { @Autowired private xxService xService; static final Logger logger = Logger.getLogger(CustomAuthenticationFilter.class); @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { String username = request.getParameter(getUsernameParameter()); String password = request.getParameter(getPasswordParameter()); String server = request.getParameter("server"); if(username.trim().length() == 0 || password.trim().length() == 0){ logger.error("Error empty credentials entered " + username + password