Friday, 19 December 2014

lord

<%--
    Document   : LetterHead
    Created on : 22-Nov-2014, 17:24:43
    Author     : nitz
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="../../favicon.ico">

        <title>Welcome to Jay Siyaram Printers</title>

        <!-- Bootstrap core CSS -->
        <link href="Bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
        <link href="Bootstrap/css/awesome-bootstrap-checkbox.css" rel="stylesheet" type="text/css"/>


        <!-- Custom styles for this template -->
        <link href="Bootstrap/css/starter-template.css" rel="stylesheet" type="text/css"/>

        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
        <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
        <script src="../../assets/js/ie-emulation-modes-warning.js"></script>

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <p class="text-center">
            <h4 align="center">
        <%
            if ((session.getAttribute("name") == null) || (session.getAttribute("name") == "")) {
                RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
                rd.forward(request, response);
        %>
        You are not logged in<br/>
        <a href="login.jsp">Please Login</a>
        <%} else {
        %>
        Welcome, <%=session.getAttribute("name")%>
        <a href='Loggedout.jsp'>Log out.</a>
        <%
            }
        %></h4></p>

        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="index.jsp">Jay Siyaram Printers</a>
                </div>
                <div id="navbar" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">

                        <li class="active"><a href="index.jsp">Home</a></li>
                        <li><a href="#about">About</a></li>
                        <li><a href="ContactUs.jsp">Contact</a></li>
                    </ul>
                </div><!--/.nav-collapse -->
            </div>       
        </nav>
        <div class="container">
            <hr class="featurette-divider">

            <form  name="f1" action="LetterHeadServlet" method="post" class="form-horizontal well span6" onsubmit="return validate()">
                <h1> LetterHead Printing Details:</h1>
                <hr class="featurette-divider">
                <div class="form-group">
                    <label class="col-sm-2 control-label">Color</label>
                    <div class="col-sm-3">
                        <select class="form-control" id="sel1" name="drdColor">
                            <option>Single Color</option>
                            <option>Two Color</option>
                            <option>Multi Color</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">Paper Material</label>
                    <div class="col-sm-3">
                        <div class="radio">
                            <input type="radio" name="radioMaterial" id="radio1" value="70" checked>
                            <label for="radio1">
                                70
                            </label> g/m<sup>2</sup>
                        </div>
                        <div class="radio">
                            <input type="radio" name="radioMaterial" id="radio2" value="85">
                            <label for="radio2">
                                85
                            </label> g/m<sup>2</sup>
                        </div>
                        <div class="radio">
                            <input type="radio" name="radioMaterial" id="radio3" value="100">
                            <label for="radio3">
                                100
                            </label> g/m<sup>2</sup>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">Font size</label>
                    <div class="col-sm-5">
                        <input type="text" name="txtFontSize" class="form-control" class="span3" /><span id="sizeloc" ></span>
                    </div>
                </div>
                <div class="form-group"><br>
                    <label class="col-sm-2 control-label">Orientation </label>
                    <div class="col-sm-3">
                        <div class="radio">
                            <input type="radio" name="radioOrient" id="radio4" value="Horizontal" checked>
                            <label for="radio4">
                                Horizontal
                            </label>
                        </div>
                        <div class="radio">
                            <input type="radio" name="radioOrient" id="radio5" value="Vertical">
                            <label for="radio5">
                                Vertical
                            </label>
                        </div>                       
                    </div>
                </div>
                <div class="form-group"><br>
                    <label class="col-sm-2 control-label">Quantity</label>
                    <div class="col-sm-5">
                        <input type="text" name="txtQuantity" class="form-control" class="span3" /><span id="qtyloc" ></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">Paper Format </label>
                    <div class="col-sm-3">
                        <div class="radio">
                            <input type="radio" name="radioPformat" id="radio6" value="A4" checked>
                            <label for="radio6">
                                A4 Format
                            </label>
                        </div>
                        <div class="radio">
                            <input type="radio" name="radioPformat" id="radio7" value="Legal">
                            <label for="radio7">
                                Legal Format
                            </label>
                        </div>                       
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type="submit" name="btnSubmit" value="Submit" class="btn btn-success"/>
                    </div>
                </div>
            </form>


            <hr class="featurette-divider">
            <!-- FOOTER -->
            <footer>
                <p class="pull-right"><a href="#">Back to top</a></p>
                <p>&copy; 2014 4everHappy, Inc. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
            </footer>
        </div>
        <!-- /.container -->


        <!-- Bootstrap core JavaScript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->

       

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script src="Bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
    </body>
</html>

mobile services

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myprint.screenprint;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.JSONObject;

/**
 *
 * @author nitz
 */
public class LetterHeadServlet extends HttpServlet {

    /**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        try (PrintWriter out = response.getWriter()) {

            response.setContentType("application/json");

            JSONObject js = new JSONObject();
           
            String color = request.getParameter("drdColor");
            int material = Integer.parseInt(request.getParameter("radioMaterial"));
            int fontSize = Integer.parseInt(request.getParameter("txtFontSize"));
            String orientation = request.getParameter("radioOrient");
            int quantity = Integer.parseInt(request.getParameter("txtQuantity"));
            String paperFormat = request.getParameter("radioPformat");

            if (LetterHeadDao.validate(color, material, fontSize, orientation, quantity, paperFormat)) {

                RequestDispatcher rd = request.getRequestDispatcher("NewPrint.jsp");
                rd.forward(request, response);
            } else {

                js.put("msg", "Error");
            }

            out.print(js);
            out.close();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}

letterhead

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myprint.screenprint;

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 *
 * @author nitz
 */
public class LetterHeadDao {

    public static boolean validate(String color, int papermaterial, int fontsize, String orientation, int quantity, String paperformat) throws ClassNotFoundException, SQLException, ParseException {
        boolean status = false;

        Connection conn = null;
        PreparedStatement stmt = null;
        PreparedStatement stmt1 = null;
        PreparedStatement stmt2 = null;
        Statement s2 = null;
        ResultSet rs = null;

//        String dob = request.getParameter("DOB");
       
//        SimpleDateFormat formater = new SimpleDateFormat("dd MMM yyyy HH:mm");
       
       
//        DateFormat formatter = new SimpleDateFormat("dd-MMM", Locale.ENGLISH);
       

//        DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
//        Date date = (Date)formatter.parse(dt);
       

//        java.util.Date today = new java.util.Date();
    //        Date date = new SimpleDateFormat("yyyy-MM-dd").parse(string);
//        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
//        //get current date time with Date()
//        Date date = new Date();
//        //System.out.println(dateFormat.format(date)); don't print it, but save it!
//        String yourDate = dateFormat.format(date);
//
//       
//       
//        date = new SimpleDateFormat("yyyy-MM-dd").parse(yourDate);
//        java.util.Date utilDate = new Date();
//// Convert it to java.sql.Date
//        java.sql.Date date = new java.sql.Date(utilDate.getTime());

//        java.sql.Date sqlDate = new java.sql.Date(currentDatetime.getTime());
        String typ = "Letter Head";

        try {

            String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=printersdb;user=sa;password=password@123";
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            conn = DriverManager.getConnection(connectionUrl);

            String query1 = "insert into orderdetails values(?)";
            stmt1 = conn.prepareStatement(query1);
            stmt1.setString(1, typ);
            int j = stmt1.executeUpdate();
            if (j > 0) {
                status = true;
            }

            int maxID = 0;
            s2 = conn.createStatement();
            s2.execute("SELECT MAX(orderid) FROM orderdetails");
            ResultSet rs2 = s2.getResultSet(); //
            while (rs2.next()) {
                maxID = rs2.getInt(1);
            }

            String query = "insert into letterheaddetails(orderno, papermaterial, fontsize, quantity, paperformat, color, orientation) values(?,?,?,?,?,?,?)";
            stmt = conn.prepareStatement(query);
            stmt.setInt(1, maxID);
            stmt.setInt(2, papermaterial);
            stmt.setInt(3, fontsize);
            stmt.setInt(4, quantity);
            stmt.setString(5, paperformat);
            stmt.setString(6, color);
            stmt.setString(7, orientation);
//            stmt.setDate(8, new java.sql.Date(date.getTime()));
//                    setDate(1, today.getTime());
//                    .setDate(8,new java.sql.Date(today.getTime())); 

            int i = stmt.executeUpdate();
            if (i > 0) {
                status = true;
            }

            return status;

        } catch (Exception e) {
            System.out.println("Error Trace : " + e.getMessage());
        }
        return status;

    }

}

mobile phone gadgets

http://www.thaicreate.com/java/java-jsp-example-update-database.html

Saturday, 5 January 2013

Latest Sony Ericsson Smartphone Xperia Z Information.

The Cool Sony Ericsson Experia Z also known as yuga is out now and we, bring you the exclusive images extracted from a promotional video of Sony Ericsson experia Z.

Well, as we can see from the images this amazing smartphone will have a water resistant chasis that too with a 13 Megapixel camera Exmor RS, with HDR capability for capturing pictures and shooting videos.

This mobile will be soon available with an expected price of 650$.










Friday, 30 November 2012

Best solution for Battery saving on Android.



Tip for longer battery backup on Android:

First thing first avoid using Gmail app for android to sync email instead choose to use stock 'Email' app and you can set a schedule of 15min from the settings of email app . It's same like we use in an iPhone like we choose fetch option instead of push option.

1. Gmail app in android is like we choose push service in iPhone ios, which is always connected with internet to see a new mail and will notify you immediately when a new mail will arrive.

2. But the app named 'Email' in android and setting schedule of 15min is like fetch service of iphone ios.

It really made a difference at least for me because i was an iPhone user and remember when we choose push in iPhone then its backup was really worst instead when we choose fetch then the backup was of almost 3 to 4 days for me, it was iPhone 4 and because we all knows they are producing same phone since 2010 with little changes i decided to switch to android and i tested huge phones but like i posted below, when i tried note 2 , i bought it in no time.

The only issue I had with it was the battery which was lasting just within 24 to 35 hours, but after using Email app instead of Gmail app its battery lasting in 60+ hours.


There are other way also for power saving on android powered devices

3. Disable your internet connectivity:

you might have seen that there are many applications that connect to Internet to update or to process some data. So it is necessary to keep a check on the internet usage, because these usage highly affect your smartphones battery backup.

One thing you can do to stop using packet data ie; Internet services. is to install some app viz; juice defender or to do it manually from the settings, you can simply do it by changing the APN of your service provider.

To do this manually go to Settings > Wireless Controls > Mobile Networks > Access Point Names. From here you will get list of services that you use to connect to your Internet, simply select the service click edit and change the name of the apn.

How it works is that incorrect apn name will not provide you access to internet and thus avoiding your applications to drain your battery.




4. Airplane mode:

Most of the people switch off their mobiles during the night time to save the battery or turn it to silent mode, but the sad part of it is that it doesn't save your battery it hardly provides 5-10% backup. Instead you can go for Airplane mode. This mode lets you keep your smartphone on but not using any network services as i said above the network services drain you battery than any other use on your smartphone.

You can do it by long pressing call/button and from there you can select the airplane mode






5. Other tips:

Always Turn OFF your Bluetooth,WiFi or any other services and task when not in use.Also try keeping your Display Brightness low.





And I thought to post here and hope it'll really help others too :-)
specifically for those who are using WiFi or may be data also. 

Monday, 19 November 2012

Bug in Android 4.2

Yes we have found an another bug in the Android 4.2x update which has omitted an entire month of December. This is a silly bug but then too it has a very drastic effects on your schedules and mettings and Birthdays. This missing month just elimnates the contacts with the asigned birhtdate for the month of December. Also, in the Android Jelly Bean Update the contacts app is missing even no december in it.

*click on image to enlarge it*



As this effects is been discovered the google Developers might soon release an update to jelly bean debugging it. So the users till then need to face the silly yet an embarrasing bug of the  Android 4.2x update.