Showing posts with label HTML/CSS. Show all posts
Showing posts with label HTML/CSS. Show all posts

2 September 2014

SignalR - Real Time Communication

Hi All,

Today lets talk about "SignalR", I hope You might have heard about it.  But How to use it you might face some problem.
SignalR is used for real time communication, eg like - social networking site for notification, in your mail inbox for new mail arriving, real time chat application, group chatting forums and other.  Real time communication make sense and we know what does it mean.

When we try to implement real time relationship, the first way came in our mind it polling.. Long-polling or short-polling.. But what about if I say we have one more efficient method then polling?  Oh you got it? is that Web-Socket??  Yes it is.. but if you are going to use Web-Socket or any other HTML5 elements you have to make it sure you are going to support few old browsers as well which doesn't support HTML5 elements.

Now you  might think about long-polling with Web socket?  web-socket for new browser and polling for old browser? Right?

Yes that the way to support the old and new browser. But you have to code for polling and web-socket, then check the browser support, then call the supported coding snippet.  But I am saying no need to code for all SignalR here to do all this.  SignalR is enough intelligent to figure out what to use and how to use.  No need to code for polling and web-socket.

SignalR check the client and Server both, if both support the Web-Socket it goes for web-socket else efficient polling.  The best part is you no need to worry about it and coding part, it takes care for that. :)  Lets see for example and dependencies..


  • JQuery > 1.6 
  • SignalR  JS file
  • SignalR dll
  • Owin dll
  • Newtonsoft.Json dll


but again no worry, follow the below steps one by one - (Download Sample from here)

  • Open your Visual Studio and Create new blank Web Project.
  • Go to TOOLS >  NuGet Package Manager  >  Package Manager Console.  Type the following command on console and hit the  <Enter>, it will process and install and add the reference to your project..
    install-package Microsoft.AspNet.SignalR
  • install this package, it will automatically download all the dependencies and required dll all jquery files.
  • Right click project and add one class called as "Startup.cs"(name should be same) and paste the following code.
  • using Microsoft.Owin;
    using Owin;
    
    [assembly: OwinStartup(typeof(SignalR_For_Upload.Startup))]
    namespace SignalR_For_Upload
    {    
      public class Startup
      {
        public void Configuration(IAppBuilder app)
        {
           app.MapSignalR();
        }
      }
    }
    
    
  • Now create another class file and named it as "MyHub.cs", and paste the below code
  • using Microsoft.AspNet.SignalR;
    using Microsoft.AspNet.SignalR.Hubs;
    
    namespace SignalR_For_Upload
    {
      [HubName("newNameOfHub")]
      public class MyHub : Hub
      {
        public void SendMsg(string message)
        {
          Clients.All.ReceiveMsg(message);
        }
      }
    }
    
    
  • So the above is the Hub which keeps track of all the client and send the message to them using the statement stated above. 
  • Clients.All.ReceiveMsg(message);
    here 'Client.All' mean all the clients while 'ReceiveMsg(message)' is the dynamic expression which can be considered as event name for client 
    
  • Thats all now no more coding .. :) just need to bind up this event from client using javascript snippet. let have a look at that part as well.
  • Create your "Default.aspx" page and replace the "body" section with the following code(You can take the plain html page as well :) no worries).
  • <body>
      <input type="text" id="msg" value=" " />
      <input type="button" id="send" value="send" />
      <ul id="message">
      </ul>
        
      <script src="Scripts/jquery-1.6.4.min.js"></script>
      <script src="Scripts/jquery.signalR-2.1.1.min.js"></script>    
      <script src='<%: ResolveClientUrl("~/signalr/hubs") %>'></script>
      <script>        
        $(function () {
            
           var con = $.hubConnection();
           var hub = con.createHubProxy('newNameOfHub');
            
           hub.on('ReceiveMsg', function (message) {
              $('#message').append('<li>' + message + '</li>');
           });
    
           con.start().done(function () {
              $('#send').click(function () {
                 hub.invoke('sendMsg', $('#msg').val());                    
              });
           });
    
        });
      </script>
    </body>
    
  • So thats it.. just save the page. and run this in two browser and check they are communication in real time.  :)  Download Sample


Happy Code Sharing.. :)

26 March 2014

Parent Div height zero(0) even child div has content

Hi,

Let see what happened when we float the child div to Left or Right. Parent Div shows the height as 0.

<html>
  <head>
    <style>
      #parent
      {
        width:100%;
        height:auto;
      }
      #child
      {
        float:right;
        width:25%;
        height:auto;
        border:1px solid black;
        margin:10px;
      }
    </style>
  </head>
  <body>
    <div id="parent">
      <div id="child">
        this is the content inside the child
      </div>
    </div>
  </body>
</html>

It shows the result as -


Notice child div has content so it has the height but if child div has the height why parent div showing height as zero(0)??

Its because of you set the
float:right; 
on child div which make it position:absolute and thats why parent div height is zero.  To correct is you just need to set the overflow:hidden on parent div.

modified the css part as below -
      #parent
      {
        width:100%;
        height:auto;
        overflow:hidden;
      }
And you are good to go you will get the correct result as -

Happy Blogging and Sharing.. ☺☻

17 October 2013

Design a Logo using SVG (Scalable Vector Graphics)

Hi  All,

Let see how can we create Java Logo using SVG.  If you are aware with basic of SVG else you can get basic SVG understand from this link.

To design a Logo you must know the basic path tag and curve etc. Open notepad and paste the following content and save the file and "JavaLogo.svg" and open it in any browser to see the Java Logo you just designed . :)

<svg version="1.1" id="Layer_1" xmlns="https://www.w3.org/2000/svg" x="0px" y="0px"
      width="300px" height="550px" viewBox="0 0 300 550">
    <path style="fill:#5382A1;" 
             d="M102.681,291.324
                c0,0-14.178,8.245,10.09,11.035
                c29.4,3.354,44.426,2.873,76.825-3.259  
                c0,0,8.518,5.341,20.414,9.967
                C137.38,340.195,45.634,307.264,102.681,291.324"/>
             
    <path style="fill:#5382A1;" 
             d="M93.806,250.704
                c0,0-15.902,11.771,8.384,14.283
                c31.406,3.24,56.208,3.505,99.125-4.759 
                c0,0,5.936,6.018,15.27,9.309
                C128.771,295.215,30.962,271.562,93.806,250.704"/>
                
    <path style="fill:#E76F00;" 
             d="M168.625,181.799
                c17.896,20.604-4.702,39.145-4.702,39.145
                s45.441-23.458,24.572-52.833 
                c-19.491-27.394-34.438-41.005,46.479-87.934
                C234.974,80.177,107.961,111.899,168.625,181.799"/>
                
    <path style="fill:#5382A1;" 
             d="M264.684,321.369
                c0,0,10.492,8.645-11.555,15.333
                c-41.923,12.7-174.488,16.535-211.314,0.506 
                c-13.238-5.759,11.587-13.751,19.396-15.428
                c8.144-1.766,12.798-1.437,12.798-1.437
                c-14.722-10.371-95.157,20.364-40.857,29.166
                C181.236,373.524,303.095,338.695,264.684,321.369"/>
                
    <path style="fill:#5382A1;" 
             d="M109.499,208.617
                c0,0-67.431,16.016-23.879,21.832
                c18.389,2.462,55.047,1.905,89.193-0.956 
                c27.906-2.354,55.927-7.359,55.927-7.359
                s-9.84,4.214-16.959,9.075
                c-68.475,18.009-200.756,9.631-162.674-8.79
                C83.313,206.851,109.499,208.617,109.499,208.617"/>
                
    <path style="fill:#5382A1;" 
             d="M230.462,276.231
                c69.608-36.171,37.424-70.931,14.96-66.248
                c-5.506,1.146-7.961,2.139-7.961,2.139 
                s2.044-3.202,5.948-4.588
                c44.441-15.624,78.619,46.081-14.346,70.52
                C229.063,278.055,230.14,277.092,230.462,276.231"/>
                
    <path style="fill:#E76F00;" 
             d="M188.495,4.399c0,0,38.55,38.563-36.563,97.862
                c-60.233,47.568-13.735,74.69-0.025,105.678  
                c-35.159-31.722-60.961-59.647-43.651-85.637
                C133.663,84.151,204.049,65.654,188.495,4.399"/>
                
    <path style="fill:#5382A1;" 
             d="M116.339,374.246
                c66.815,4.277,169.417-2.373,171.847-33.988
                c0,0-4.671,11.985-55.219,21.503  
                c-57.028,10.732-127.364,9.479-169.081,2.601
                C63.887,364.361,72.426,371.43,116.339,374.246"/>
                
    <path style="fill:#E76F00;" 
             d="M105.389,495.048
                c-6.303,5.467-12.96,8.536-18.934,8.536
                c-8.527,0-13.134-5.113-13.134-13.314 
                c0-8.871,4.936-15.357,24.739-15.357
                h7.328
                V495.048 
                M122.781,514.671
                v-60.742
                c0-15.517-8.85-25.756-30.188-25.756 
                c-12.457,0-23.369,3.076-32.238,6.999l2.56,10.752
                c6.983-2.563,16.022-4.949,24.894-4.949
                c12.292,0,17.58,4.949,17.58,15.181
                v7.677
                h-6.135
                c-29.865,0-43.337,11.593-43.337,28.994
                c0,15.017,8.878,23.553,25.594,23.553
                c10.745,0,18.766-4.436,26.264-10.928
                l1.361,9.22
                H122.781z"/>
                
    <path style="fill:#E76F00;" 
             d="M180.825,514.671
                h-21.692
                l-26.106-84.96
                h18.943
                l16.199,52.2l3.601,15.699 
                c8.195-22.698,13.991-45.726,16.89-67.899
                h18.427
                C202.15,457.688,193.266,488.396,180.825,514.671"/>
                
    <path style="fill:#E76F00;" 
             d="M264.038,495.048
                c-6.315,5.467-12.984,8.536-18.958,8.536
                c-8.512,0-13.131-5.113-13.131-13.314 
                c0-8.871,4.948-15.357,24.749-15.357h7.34
                V495.048 
                M281.428,514.671
                v-60.742
                c0-15.517-8.872-25.756-30.185-25.756
                c-12.466,0-23.382,3.076-32.247,6.999l2.556,10.752
                c6.986-2.563,16.042-4.949,24.907-4.949
                c12.283,0,17.579,4.949,17.579,15.181
                v7.677
                h-6.145
                c-29.874,0-43.34,11.593-43.34,28.994
                c0,15.017,8.871,23.553,25.584,23.553
                c10.751,0,18.769-4.436,26.28-10.928
                l1.366,9.22
                H281.428z"/>
                
    <path style="fill:#E76F00;" 
             d="M36.847,529.099
                c-4.958,7.239-12.966,12.966-21.733,16.206
                l-8.587-10.105 
                c6.673-3.424,12.396-8.954,15.055-14.105
                c2.3-4.581,3.252-10.485,3.252-24.604
                v-96.995
                h18.478
                v95.666 
                C43.311,514.038,41.802,521.663,36.847,529.099"/>
</svg>

And the output will be this Java Logo  - 


To understand the basic of SVG follow the link SVG and Tags.

Happy Knowledge sharing.. :)


15 October 2013

URL Coder/Encoder

Hi All,

Let see how can we use coding / encoding url.

  • Paste the encoded text and click decode button to DECODE.
  • Paste the decoded text and click encode button to ENCODE

URL Decoder/Encoder



Lets see how can we write our own URL encoder decoder.
  • Open notepad.
  • Paste the following contents.

<html>
<head>
   <title>MyTacTics.blogspot.in</title>
   <script type="text/javascript">
      function encode() {
         var obj = document.getElementById('dencoder');
         var unencoded = obj.value;
         obj.value = encodeURIComponent(unencoded).replace(/'/g,"%27").replace(/"/g,"%22");   
      }
      function decode() {
         var obj = document.getElementById('dencoder');
         var encoded = obj.value;
         obj.value = decodeURIComponent(encoded.replace(/\+/g,  " "));
      }
   </script>
</head>
<body>
   <form onsubmit="return false">
   <h1>
   URL Decoder/Encoder</h1>
   <textarea cols="80" id="dencoder" rows="20" style="resize: none;"></textarea>
   <div>
      <input onclick="decode()" type="button" value="Decode" />
      <input onclick="encode()" type="button" value="Encode" />
   </div>
   </form>
</body>


  • Save the file as URL.html, and its done.

Happy Knowledge sharing.. :)

14 October 2013

Full/Half Circle, Rectangle in SVG file.

Hi Friends,

Today let see how can we create the a logo or any icon using the SVG (Scalable Vector Graphics).

Initially we need to understand the basic on svg file.  Whats the basic and how can we start to create our first svg file.
1.  Open notepad and write the following lines -


<svg version="1.1" height="100px" width="100px"  xmlns="https://www.w3.org/2000/svg" >
      <circle cx="50px" cy="50px" r="40px" style="fill:green" />
</svg>

2.  Save the file as FirstSVG.svg.

3.  Open the file in any browser it will show you a circle with filled green color.


Here the first and last line is mandatory and in between we write the code according to what we want. here its basic SVG file.

we have few standard tags for different-different design which we can use to draw icon or logo, like - Line, Circle, eclipse, rectangle, polygon or any other path.

Line- 
<svg version="1.1" height="100px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <line x1="0" y1="0" x2="200" y2="100"
          style="stroke: #E28965;stroke-width:2" />
</svg>


Circle- 
<svg version="1.1" height="100px" width="100px"  xmlns="https://www.w3.org/2000/svg" >
      <circle cx="50px" cy="50px" r="40px" style="fill:#89BDFF; stroke:#E28965;
      stroke-width:5;" />
</svg>



Rectangle- 
<svg version="1.1" height="100px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <rect x="10px" y="10px" height="80px" width="180px" style="fill:#89BDFF;
      stroke:#E28965; stroke-width:5;" />
</svg>



Ellipse- 
<svg version="1.1" height="100px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <ellipse cx="100px" cy="50px" rx="90px" ry="40" style="fill:#89BDFF;
      stroke:#E28965; stroke-width:5;" />
</svg>



Polygon- 
<svg version="1.1" height="200px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <polygon points="100,10 40,180 190,60 10,60 160,180" style="fill:#89BDFF;
      stroke:#E28965;stroke-width:5;fill-rule:evenodd;" />
</svg>



Half-Circle(Clipping)- 
<svg version="1.1" height="200px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <clipPath id="cut-off-bottom">
          <rect x="0" y="0" width="200" height="100" />
      </clipPath>

      <circle cx="100" cy="100" r="100" clip-path="url(#cut-off-bottom)" />
</svg>



Path- 
<svg version="1.1" height="200px" width="200px"  xmlns="https://www.w3.org/2000/svg" >
      <path d="M10,10 L100,190 L190,100 Z" style="fill:#89BDFF;
      stroke:#E28965;stroke-width:5;" />
</svg>

Lets understand the tag <path> and its parameter d = "... "

M10,10  -> we want to start from 10,10
L100,190 -> draw a line to the point 100,190
L190,100 -> draw a line to the point 190,100
Z -> go from current point to start point mean (10,10)

Curv (<Path> tag)- 
<svg version="1.1" height="200px" width="220px"  xmlns="https://www.w3.org/2000/svg" >
      <path style="fill:#89BDFF;stroke:#E28965;stroke-width:2;" d="M10,60
 c0,0,50,-50,100,-13
 c0,0,50,40,100,13
 c0,0,-50,50,-100,13
 c0,0,-50,-40,-100,-13
 " />
</svg>


To Understand the tag <path>  in more details refer this page 

Happy Knowledge Sharing.. :)


1 October 2013

Disable Right Click in webpage using jQuery

Hi Friends,

Let see how can we disable the "Right Click" in a web page using the jQuery.  Sometimes we need this snippet to prevent the user to perform few operations. But remember this is OK for normal user but for expert it would not work.  They know lot of way to show the context menu.

Well whatever lets see how can we disable the right click..
<html>
<head>
  <title>Right Click Disabled</title>
  <script src="https://code.jquery.com/jquery-1.9.1.js" type="text/javascript">
  </script>
  <script type="text/javascript">
    $(function () {
      // to disable the right click on whole web page
       $(document).bind("contextmenu",function(e){
         e.preventDefault();
         alert("Right Click is not allowed");
      });
     
     // to disable the right click on all the images use the below code
     
  /*
      $('img').bind("contextmenu",function(e){
         e.preventDefault();
         alert("Right Click is not allowed on images");
      });      
      */
    });
  </script>
</head>
<body style="height:400px; border:1px solid black;">
    This is the body content. 
    <img src="head.png" />
</body>
</html>
Without prompting any alert just to disable the right click you have to remove the alert box
$(function () {
      // to disable the right click on whole web page
       $(document).bind("contextmenu",function(e){
         e.preventDefault();
         alert("Right Click is not allowed"); 
      });
  });
Happy knowledge sharing.. :)

23 September 2013

Download - Uploading in JSP - Servlet with MySql DB

Hello Friends,

Lets see how can we code to upload and download file in JSP and Servlet.  Here I am using the database MySql.  I'm saving the file in database directly, I used the Medium Blob to store the file in database. Remember as I'm using medium blob(Max. size=16 MB) so I am considering we will upload a file with maximum size 15 MB.

By default MySql packet size is 1 MB so to support the uploading for 15 MB file, we need to change a attribute in my.ini file.

MySql installed directory > bin > "my.ini" file
search for "max_allowed_packet" you will find a line with value "1M" change to "15M"
max_allowed_packet =  1M 

max_allowed_packet = 15M
Now your MySql server is capable to transfer a big data packet to server size upto 15MB.

Create the table to store the document in MySql server
CREATE TABLE IF NOT EXISTS 'documents' (
  'Doc_id' int(11) NOT NULL AUTO_INCREMENT,
  'FileName' varchar(100) NOT NULL,
  'type' varchar(20) NOT NULL,
  'upload_time' timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  'content' mediumblob NOT NULL,
  'upload_by' varchar(50) NOT NULL,
  PRIMARY KEY ('Doc_id')
)


Lets code for first index page which is used to select the file to upload..
Index.html
<form enctype="multipart/form-data" action="uploadfile.jsp" method="post" onsubmit="return verify()">      
<table border='1'>
<tr>
   <td>   
      Remember you can upload only MS-word, MS-Excel, txt and PDF files.max size = 15mb       
   </td>
</tr>
<tr>
   <td>
      <input type="file" name="filename" id="filename"
      accept=".txt,
           application/pdf,
           application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
           application/vnd.ms-excel,
           application/vnd.openxmlformats-officedocument.wordprocessingml.document,
           application/msword"/>                                                            
   </td>
</tr>
<tr>
   <td>
      <input type="submit" value="Save File" />
   </td>
</tr>
</table>
</form>
Code for uploadfile.jsp file which is used to get the select file and upload it to server.
uploadfile.jsp
<%
String rtempfile = File.createTempFile("temp","1").getParent(); 

// get the file from the previous page form           
// save the file in temporary directory of server
// specify the max size = 15MB
MultipartRequest multi = new MultipartRequest(request,rtempfile, 15*1024*1024);

Enumeration files = multi.getFileNames();

String st="insert into documents(filename, type,content, upload_by) values (?,?,?,?)";

// get the connection object from another class MyConnection's method getConnection();
// and create the prepareStatement
PreparedStatement psmt=MyConnection.getConnection().prepareStatement(st);

         
String name="";
String fileExtesion="";
File ff =null;
FileInputStream fin =null;

while (files.hasMoreElements())
{
   name=(String)files.nextElement();                                        
   ff = multi.getFile(name);
   fileExtesion = ff.getName().substring(ff.getName().lastIndexOf("."));
   
   // check user has select the correct file or not
   boolean fileAllowed = fileExtesion.equalsIgnoreCase(".txt")||
                         fileExtesion.equalsIgnoreCase(".pdf")||
                         fileExtesion.equalsIgnoreCase(".doc")||
                         fileExtesion.equalsIgnoreCase(".docx")||
                         fileExtesion.equalsIgnoreCase(".xls")||
                         fileExtesion.equalsIgnoreCase(".xlsx");
   
   if((ff!=null)&&fileAllowed)
   {
     
     try
     {
       fin=new FileInputStream(ff);
       psmt.setString(1, ff.getName());
       psmt.setString(2, fileExtesion);
       psmt.setBinaryStream(3,(InputStream)fin, (int)(ff.length()));
       psmt.setString(4, "Logged User name or ID");        // pass the user name or id 
       boolean sss = psmt.execute();
       
       out.print("uploaded successfully..");
       out.print("<br/> Go to <a href='downloadfile.jsp'>Download</a> page");
     }
     
     catch(Exception e)
     {
       out.print("Failed due to " + e);
     }
     
     finally
     {
      // next statement is must otherwise file will not be deleted from the temp as fin using f.
      // its necessary to put outside otherwise at the time of exception file will not be closed.
           fin.close();
           ff.delete();
     }
   }
   else
   {
         out.print("Please select the correct file...");
   }// end of if and else
}// end of while

MyConnection.CloseConnection();     // close the connection
%>

get the list of the uploaded file and link to download the file.
downloadfile.jsp
<table border="1">
  <tr>
    <th>File Name</th>
    <th>Uploaded By</th>
    <th>File Type</th>
    <th>Upload Time</th>
    <th>Action</th>
  </tr>
<%
  String query = "select doc_id,filename,type, upload_time, upload_by from documents";
  ResultSet rs = MyConnection.getResultFromSqlQuery(query);
  int count =0;
  while(rs.next())
  {
    out.println("<tr>"
        + "<td>"+rs.getString(2)+"</td>"
        + "<td>"+rs.getString(5)+"</td>"
        + "<td>"+rs.getString(3)+"</td>"
        + "<td>"+rs.getString(4)+"</td>"
        + "<td>"
        +   "<a href='download.jsp?Doc_id="+rs.getInt(1) +"'> Download </a>"
        + "</td>"
        + "</tr>");
    count++;
  }
  rs.close();
  MyConnection.CloseConnection();
  if(count==0)
  {
    out.println("<tr><td colspan='4'> No File Found..!! </td></tr>");
  }
%>            
</table>
This page will give you the list of the file uploaded by any user with few details and a link to download the file from server.  As file is saved in database in blob so we have to create the file from blob and have to send it to client.

Lets see the code which extract the information from database and send the file to client.
download.jsp
<%
  String doc_id = request.getParameter("Doc_id");     
  String query = "select filename, type, content from Documents where doc_id = " + doc_id;
  ResultSet rs = MyConnection.getResultFromSqlQuery(query);
  rs.next();
  
  // clear the response header information.
  response.reset();                        
  // check the file type and set the header contentType accordingly..   
  if(rs.getString(2)==".txt")
  {
      response.setContentType("application/octet-stream");
  }
  else if(rs.getString(2)==".pdf")
  {
      response.setContentType("application/pdf");
  }
  else if((rs.getString(2)==".doc")||rs.getString(2)==".docx")
  {
      response.setContentType("application/msword");
  }
  else if((rs.getString(2)==".xls")||(rs.getString(2)==".xlsx"))
  {
      response.setContentType("application/vnd.ms-excel");
  }
  // add header information to response object
  response.addHeader("Content-Disposition","attachment; filename="+rs.getString(1));
  // create the byte array from Blob
  Blob blb = rs.getBlob(3);
  byte[] bdata = blb.getBytes(1, (int) blb.length());
  
  // get the response Output stream object to write the content of the file into header
  OutputStream output =  response.getOutputStream();
  output.write(bdata);
  output.close();
  // close the obejct of ResultSet
  rs.close();
  
  // close the connection object.. 
  MyConnection.CloseConnection(); 
%>

Remember you have to create the table document as specified at top.

You need to change the MyConnection class.  Provide you database credentials.
MyConnection.java
public class MyConnection
{    
  static Connection con;
  public static Connection getConnection()
  {
    try
    {            
      if(con==null)
      {
        Class.forName("com.mysql.jdbc.Driver");  
        String url = "jdbc:mysql://localhost:3306/Your_DB_Name?"+
                     "user=db_user&password=user_password";
        con= DriverManager.getConnection(url);
      }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }        
    return con;
  }
  
  public static void CloseConnection()
  {
    try
    {
       con.close();
       con = null;
    }
    catch (SQLException e)
    {
       e.printStackTrace();
    } 
  }
  
  public static ResultSet getResultFromSqlQuery(String SqlQueryString)
  {
     Statement stmt;
     ResultSet rs = null;
     try
     {  
        getConnection();  
        stmt = con.createStatement();
        rs = stmt.executeQuery(SqlQueryString);
     }
     catch (SQLException e)
     {
        e.printStackTrace();
     }       
     return rs;
  }
}
To make it work you also required two jar files-
1. MySql Connector jar file download
2. Another jar file to handle the uploading download
you need to add the reference of these two files into your project.

You can download the netbeans sample project. Download


Happy Coding..

26 December 2012

Claude in Your HTML Page

Hi Friends.. This is all about how to use the running claude effect in you web site page.
 
You are required to download and use the following Plugin by me and You will get the

Claude like the following picture.

Claude Plugin Demo Click to download the sample.





after adding the plugin in your web page you are required to add the one line only that is

 " $(document).Claude({count:3, SkyHeight:250});" under the script tag. So the code

would be like -


   <script type="text/javascript">
        $(document).ready(function () {

             $(document).Claude({count:3, SkyHeight:250});
        })       
    </script>


here "count :3" is the number of claude and Sky Height is the height from top in which claudes

are allowed to visible. It automatically set the speed, vertical position and color randomly.