It is used in data science, AI, ML due to it's easy to understand syntax.
Sunday, January 26, 2020
Python 3
Python 3 Programming language is simple in syntax & interpreter based.
Tuesday, October 8, 2013
BIRT FAQ's
1.] How to remove decimal point and the digits after decimal on report?
-- Select the field of number value. Go to its properties section, select Format Number in it.
Select Format as field as Custom and Format Code as ##,##,##0 instead of ##,##,##0.00
2.] The BIRT report shows year as 2014 even though the value is 2013.
-- Change the date format from YYYY to yyyy.
-- Change the date format from YYYY to yyyy.
Friday, September 27, 2013
Installing BIRT in STS
1) Install STS
2) Click on help -
Install New Software --> Click on Add
-> give the URL (http://download.eclipse.org/birt/update-site/4.2/)
3) Select the BIRT components you want to install--> click Next and follow the instructions such as accept terms and conditions.
4) Click on Finish, it will start installing the BIRT components.
5) It is getting installed successfully and we can see the version details on the following path: Help-
About STS
-> click on Eclipse BIRT Project
Thursday, September 26, 2013
Cookies using JSP / Servlet
Login.jsp
<form action="rem" method="POST">
Enter Value: <input type="text" name="val" value=""/>
<input type="submit" value="Submit" />
</form>
----------------------------------------------------------------------------------
RemController.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String myValue = request.getParameter("val");
Cookie userCookie = new Cookie("u", myValue);
userCookie.setMaxAge(60*60*24);
response.addCookie(userCookie);
request.getRequestDispatcher("Remember.jsp").forward(request, response);
}
----------------------------------------------------------------------------------
Remember.jsp
<html>
<%
Cookie[] cookies=request.getCookies();
Cookie cookie=null;
if(cookies != null){
for(int i=0; i<cookies.length; i++){
cookie = cookies[i];
System.out.print(cookie.getName()+": ");
System.out.println(cookie.getValue());
}
}
%>
</html>
----------------------------------------------------------------------------------
<form action="rem" method="POST">
Enter Value: <input type="text" name="val" value=""/>
<input type="submit" value="Submit" />
</form>
----------------------------------------------------------------------------------
RemController.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String myValue = request.getParameter("val");
Cookie userCookie = new Cookie("u", myValue);
userCookie.setMaxAge(60*60*24);
response.addCookie(userCookie);
request.getRequestDispatcher("Remember.jsp").forward(request, response);
}
----------------------------------------------------------------------------------
Remember.jsp
<html>
<%
Cookie[] cookies=request.getCookies();
Cookie cookie=null;
if(cookies != null){
for(int i=0; i<cookies.length; i++){
cookie = cookies[i];
System.out.print(cookie.getName()+": ");
System.out.println(cookie.getValue());
}
}
%>
</html>
----------------------------------------------------------------------------------
Wednesday, September 25, 2013
Login Page using Servlet / JSP
1. Servlet Mapping in web.xml
Transfering control from JSP (Login.jsp) file to a servlet (RemController.java) file.
----------------------------------------------------------------------------------------------------------------------------
Login.jsp
<form action="rem" method="POST">
Username: <input type="text" id="username" name="username" value=""/><br/>
Password: <input type="password" id="password" name="password" value=""/><br/>
<input type="submit" id="submit" value="Submit" /><br/>
</form>
----------------------------------------------------------------------------------------------------------------------------
web.xml
<servlet>
<servlet-name>RemController</servlet-name>
<servlet-class>myPkg.RemController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RemController</servlet-name>
<url-pattern>/rem</url-pattern>
</servlet-mapping>
----------------------------------------------------------------------------------------------------------------------------
RemController.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("result", "hello!");
String name = request.getParameter("username");
String password = request.getParameter("password");
System.out.println(name+" "+password);
// response.sendRedirect("Remember.jsp");
request.getRequestDispatcher("Remember.jsp").forward(request, response);
}
----------------------------------------------------------------------------------------------------------------------------
Remember.jsp
<html>
<body>
<h1>Remember.jsp</h1>
<p>The result is ${result}</p>
</body>
</html>
----------------------------------------------------------------------------------------------------------------------------
Transfering control from JSP (Login.jsp) file to a servlet (RemController.java) file.
----------------------------------------------------------------------------------------------------------------------------
Login.jsp
<form action="rem" method="POST">
Username: <input type="text" id="username" name="username" value=""/><br/>
Password: <input type="password" id="password" name="password" value=""/><br/>
<input type="submit" id="submit" value="Submit" /><br/>
</form>
----------------------------------------------------------------------------------------------------------------------------
web.xml
<servlet>
<servlet-name>RemController</servlet-name>
<servlet-class>myPkg.RemController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RemController</servlet-name>
<url-pattern>/rem</url-pattern>
</servlet-mapping>
----------------------------------------------------------------------------------------------------------------------------
RemController.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("result", "hello!");
String name = request.getParameter("username");
String password = request.getParameter("password");
System.out.println(name+" "+password);
// response.sendRedirect("Remember.jsp");
request.getRequestDispatcher("Remember.jsp").forward(request, response);
}
----------------------------------------------------------------------------------------------------------------------------
Remember.jsp
<html>
<body>
<h1>Remember.jsp</h1>
<p>The result is ${result}</p>
</body>
</html>
----------------------------------------------------------------------------------------------------------------------------
Wednesday, September 4, 2013
Database FAQ's
Finding Non-unique rows.
SELECT LIC_NO, count(LIC_NO) AS cnt FROM LM_LICENSE GROUP BY LIC_NO HAVING cnt>1;
SELECT LIC_NO, count(LIC_NO) AS cnt FROM LM_LICENSE GROUP BY LIC_NO HAVING cnt>1;
Wednesday, August 14, 2013
JAVA FAQ's
1. Rounding of a double value to 2 digits.
-- Double TempTentSec = 0.0;
TempTentSec = 111.0;
TempTentSec = Math.round(TempTentSec * 100.0) / 100.0;
(Similarly to round of at 0 places:- Multiply & divide by 1.0)
2. Removing decimals without rounding off the double value.
-- TempTentSec = (double)Math.floor(TempTentSec);
-- Double TempTentSec = 0.0;
TempTentSec = 111.0;
TempTentSec = Math.round(TempTentSec * 100.0) / 100.0;
(Similarly to round of at 0 places:- Multiply & divide by 1.0)
2. Removing decimals without rounding off the double value.
-- TempTentSec = (double)Math.floor(TempTentSec);
Subscribe to:
Comments (Atom)
