devxlogo

Tip Bank

Unzipping an Archive from a Servlet

package com.extensions;import java.io.IOException;import java.io.File;import java.io.PrintWriter;import java.io.FileOutputStream;import java.io.FileInputStream;import java.io.OutputStream;import javax.servlet.ServletException;import javax.servlet.ServletContext;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpSession;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import java.util.zip.ZipEntry;import java.util.zip.ZipFile;import java.util.zip.ZipInputStream;import java.util.StringTokenizer;public class ExtractZipsServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse

Automating Visual Studio Solution Builds

You can make Visual Studio build a solution automatically at certain time of the day using a batch file. In the example below, devxtry.sln is the name of the solution

Using the EXISTS Command in SQL

Suppose you wanted to retrieve the department number (deptno) and name (dname) fields for employees in an emp table. One way to get the values is with this SQL query:

New IDE Feature in VS 2008: Tracepoints

When editing in Visual Studio, you would normally write a MessageBox.Show or a Console.Writeline to log the value of a variable. But you can eliminate that work now. Instead, try

An Alternative Way to Lock Your Computer

Here’s an alternative way to lock your Windows computer. Right-click an empty spot on the desktop, and select New ? Shortcut. In the Create Shortcut dialog box, type or copy

Run a Partial Query in TOAD

To run only a portion of a large SQL or PL/SQL query in TOAD, you can press Shift+F9 to run the specific part of the query situated at your cursor.

Customize Window Layouts in Visual Studio

Microsoft Visual Studio (VS) comes with four window layouts: Design, Debug, Full Screen Mode, and File mode. You can alter these layouts through the General Development Settings dialog, which allows

Write a Complex Query in Hibernate

This tip shows you how to use the findByExample method in Hibernate. The method uses the SQL AND operator to log in a user given an email address and password.