Friday, November 16, 2012

Avoid auto formatting in Excel for CSV



="11:00"
Add these [="][value]["] ; so it will be considered as an String.   

Share Article : Avoid auto formatting in Excel for CSV
Share/Save/Bookmark

Thursday, September 6, 2012

Excel export With "save as Excel" Prompt from JSP



<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%      
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=\"report.xls\"");

%>
<sql:query var="result" dataSource="jdbcJNDI">
        
        select * FROM 
        X
        WHERE
        X.y = ? and X.z = ?
        
       
        
        <sql:param  value="${param.from}"/>
        <sql:param  value="${param.to}"/>
    </sql:query>
    <table border="1">
        <!-- column headers -->
        <tr>
        <c:forEach var="columnName" items="${result.columnNames}">
            <th><c:out value="${columnName}"/></th>
        </c:forEach>
    </tr>
    <!-- column data -->
    <c:forEach var="row" items="${result.rowsByIndex}">
        <tr>
        <c:forEach var="column" items="${row}">
            <td><c:out value="${column}"/></td>
        </c:forEach>
        </tr>
    </c:forEach>
</table>

Share Article : Excel export With "save as Excel" Prompt from JSP
Share/Save/Bookmark

CSV, how to avoid crappy auto-format in Excel



Output date as a String as following

"=\""+$F{dd/mm/yyyy date}+ "\""   (in jasper)


 "=""01/01/2012"""  (finally following will be generated)

Share Article : CSV, how to avoid crappy auto-format in Excel
Share/Save/Bookmark

Monday, July 30, 2012

Win 7 ODBC


In case drivers are not there in 64 bit ODBC
Control Panel\System and Security\Administrative Tools\Data Sources (ODBC)


try 32 bit
%windir%\SysWOW64\odbcad32.exe


http://support.microsoft.com/kb/2721825/EN-US

Share Article : Win 7 ODBC
Share/Save/Bookmark

Friday, July 27, 2012

Embedding image in html email



<img src="data:image/jpg;base64,/*base64-data-string here*/" />

Share Article : Embedding image in html email
Share/Save/Bookmark

Tuesday, July 24, 2012

AUTO LOG WITH TRIGGER



create
TRIGGER TRIG_MYTBL_LOG AFTER
  UPDATE ON  MYTBL  FOR EACH ROW BEGIN
  INSERT
  INTO  MYTBL_LOG
    (
      ITEM_CODE,
      GTIN,
      REGID,
      REGIP,
      REGDATE
    )
    VALUES
    (
      :OLD.ITEM_CODE,
      :OLD.GTIN,
      :OLD.REGID,
      :OLD.REGIP,
      :OLD.REGDATE
    );
END;

Share Article : AUTO LOG WITH TRIGGER
Share/Save/Bookmark

Tuesday, July 17, 2012

How to Delete all .svn folders using Windows Command Prompt



You can use the following command to delete all .svn folders in curent directory recursively.

FOR /R . %f IN (.svn) DO RD /s /q %f

Share Article : How to Delete all .svn folders using Windows Command Prompt
Share/Save/Bookmark

Saturday, July 14, 2012

Recursive Permission




Share Article : Recursive Permission
Share/Save/Bookmark

Friday, March 9, 2012

Killing an Oracle session to remove a LOCK


Get List of LOCKS

SELECT  l.inst_id,
SUBSTR(L.ORACLE_USERNAME,1,8) ORA_USER,
SUBSTR(L.SESSION_ID,1,3) SID,
S.serial#,
SUBSTR(O.OWNER||'.'||O.OBJECT_NAME,1,40) OBJECT, P.SPID OS_PID,
DECODE(L.LOCKED_MODE,   0,'NONE',
1,'NULL',
2,'ROW SHARE',
3,'ROW EXCLUSIVE',
4,'SHARE',
5,'SHARE ROW EXCLUSIVE',
6,'EXCLUSIVE',
NULL) LOCK_MODE
FROM    sys.GV_$LOCKED_OBJECT L
, DBA_OBJECTS O
, sys.GV_$SESSION S
, sys.GV_$PROCESS P
WHERE     L.OBJECT_ID = O.OBJECT_ID
  and     l.inst_id = s.inst_id
  AND     L.SESSION_ID = S.SID
  and     s.inst_id = p.inst_id
  AND     S.PADDR = P.ADDR(+)
order by l.inst_id

Just a matter of Killing 
ALTER SYSTEM KILL SESSION 'sid#,serial#' IMMEDIATE;

Share Article : Killing an Oracle session to remove a LOCK
Share/Save/Bookmark

Monday, January 16, 2012

Remove Blank Lines in Java Code with NetBeans (regex)


Open the 'Find and Replace' window. Type \n\s*(\n) in the Find What field and $1 in the Replace With field. Check the Regular Expressions box and click Replace All.
Boom! All blank lines are removed now.

Share Article : Remove Blank Lines in Java Code with NetBeans (regex)
Share/Save/Bookmark