Wednesday, October 24, 2007

Send Files to IP address in C#


 Send Files to IP address in C#
=============================

string sourceDir = @"C:\\tt";
string destIP = @"\\10.10.10.10\shared-folder-amit";
string[] sourceFiles = Directory.GetFiles(sourceDir, "*", SearchOption.AllDirectories);
foreach (string files in sourceFiles) {
  string localFile = files.Replace(sourceDir, "");
  if (!Directory.Exists(Path.GetDirectoryName(destIP + "\\" + localFile)))
    Directory.CreateDirectory(Path.GetDirectoryName(destIP + "\\" + localFile));
  File.Copy(files, destIP + "\\" + localFile, true);
}

Tuesday, October 16, 2007

Image rotate in jQuery

Image rotate in jQuery



<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<img style="transform: rotate(285.4deg);" id="myimg"  src="WOW.jpg">
<script type="text/javascript">
    jQuery(function($) {
        $(document).ready(function() {
            window.imagerotate = function () {
                $('#myimg').rotate({
                                angle:0,
                                animateTo:-360,
                                callback: imagerotate,
                                //t: current time,b: beginning value,c: change in value,d: duration
                                easing: function (x,t,b,c,d) {
                                    return c*(t/d)+b+10000;
                                }
                            });
                        };
                        setTimeout('imagerotate()', 1000);
                });
});
</script>
</body></html>

Thursday, September 20, 2007

Floating effect with jQuery

Floating effect with jQuery

Listed below the code for how to make any object float-able in html webpage .

aa.html

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script>
//jqfloat.js
(function(e){var t={init:function(t){return this.each(function(){e(this).data("jSetting",e.extend({},e.fn.jqFloat.defaults,t));e(this).data("jDefined",true);var n=e("<div/>").css({width:e(this).outerWidth(true),height:e(this).outerHeight(true),"z-index":e(this).css("zIndex")});if(e(this).css("position")=="absolute")n.css({position:"absolute",top:e(this).position().top,left:e(this).position().left});else n.css({"float":e(this).css("float"),position:"relative"});if((e(this).css("marginLeft")=="0px"||e(this).css("marginLeft")=="auto")&&e(this).position().left>0&&e(this).css("position")!="absolute"){n.css({marginLeft:e(this).position().left})}e(this).wrap(n).css({position:"absolute",top:0,left:0})})},update:function(t){e(this).data("jSetting",e.extend({},e.fn.jqFloat.defaults,t))},play:function(){if(!e(this).data("jFloating")){e(this).data("jFloating",true)}n(this)},stop:function(){this.data("jFloating",false)}};var n=function(t){var r=e(t).data("jSetting");var i=Math.floor(Math.random()*r.width)-r.width/2;var s=Math.floor(Math.random()*r.height)-r.height/2-r.minHeight;var o=Math.floor(Math.random()*r.speed)+r.speed/2;e(t).stop().animate({top:s,left:i},o,function(){if(e(this).data("jFloating"))n(this);else e(this).animate({top:0,left:0},o/2)})};e.fn.jqFloat=function(n,r){var i=e(this);if(t[n]){if(i.data("jDefined")){if(r&&typeof r==="object")t.update.apply(this,Array.prototype.slice.call(arguments,1))}else t.init.apply(this,Array.prototype.slice.call(arguments,1));t[n].apply(this)}else if(typeof n==="object"||!n){if(i.data("jDefined")){if(n)t.update.apply(this,arguments)}else t.init.apply(this,arguments);t.play.apply(this)}else e.error("Method "+n+" does not exist!");return this};e.fn.jqFloat.defaults={width:100,height:100,speed:1e3,minHeight:0}})(jQuery)
</script>
<script>
$(document).ready(function() {
    $('#nato').jqFloat({
        width:10,
        height:50,
        speed:1800
    });
   
    $('#butterfly').jqFloat({
        width:400,
        height:100,
        speed:3500
    });
});
</script>
</head>
<body>
<div id="nato" style="width:106px;height:105px;position:absolute;z-index:8;top:12%;right:15%"><img src="2.jpg"/></div>
    <div id="butterfly" style="width:35px; height:27px; position:absolute; z-index:20; left: 383px; top: 77px;"><img src="butterfly.JPG"/>
   </div>
</body>
</html>

Thursday, September 13, 2007

Date and Time with AM/PM Format in mysql

Date and Time with AM/PM Format in mysql:
use listed below sql:



SELECT DATE_FORMAT(my_entry_date_time, '%d/%M/%Y %r') FROM my_table

Tuesday, August 14, 2007

Show mysql timestamp/datetime column with AM and PM in JSP/JAVA


How to show mysql timestamp/datetime column with AM and PM in JSP/JAVA

<%@ page import="java.sql.*" %>
<%@ page import="java.util.Date.*" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="java.text.*" %>


SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date date = format.parse(rs.getString("entry_date_time"));
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
out.print(calendar.get(Calendar.DATE)+"/");
out.print((calendar.get(Calendar.MONTH)+1)+"/");
out.print(calendar.get(Calendar.YEAR)+"&nbsp;&nbsp;&nbsp;");
out.print(calendar.get(Calendar.HOUR)+":");
out.print(calendar.get(Calendar.MINUTE)+":");   
out.print(calendar.get(Calendar.SECOND));       
if(calendar.get(Calendar.AM_PM)==0) out.print("AM"); else out.print("PM");   

Wednesday, July 11, 2007

Submit form with jQuery

Submit form with jQuery


posting.php file
<script language="javascript" src="js/jquery-1.6.3.min.js" type="text/javascript"></script>
<form id="myform" name="myform" action="postdata.php" method="post">
  <input type="text" id="nm" name="nm" />
  <input type="submit" value="Go" />
  <span id="errorspan"></span>
</form>
<div id="banner">
  Submit form with jQuery.
</div>
<script>
$('#myform').submit(function() {
  if($("#nm").val()=="") {
      $("#errorspan").text("Not valid!").show().fadeOut(3000);
      return false;
  } else {
      return true;
  }
});

$('#banner').click(function() {
  $('#myform').submit();
});
</script>



postdata.php file
<?php
echo $_POST['nm'];


?>


Wednesday, July 4, 2007

Show all objects of LDAP Server in PHP

Show all objects of LDAP Server in PHP

<?php
//$ldapServer = "ldap://111.222.111.222:389";

$ldapServer = '111.222.111.222';
$ldapBase = 'DC=abc,DC=com';
$ldapConn = ldap_connect($ldapServer);
if (!$ldapConn)
{
  die('Cannot Connect to LDAP server');
}
$ldapBind = ldap_bind($ldapConn);
if (!$ldapBind) {
  die('Cannot Bind to LDAP server');
}
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
$ldapSearch = ldap_search($ldapConn, $ldapBase, "(cn=*)");
$ldapResults = ldap_get_entries($ldapConn, $ldapSearch);
for ($item = 0; $item < $ldapResults['count']; $item++) {
  for ($attribute = 0; $attribute < $ldapResults[$item]['count']; $attribute++) {
    $data = $ldapResults[$item][$attribute];
    echo $data.":&nbsp;&nbsp;".$ldapResults[$item][$data][0]."<br>";
  }
  echo '<hr />';
}
?>

Wednesday, June 13, 2007

make single line paragraph in word

Make single line paragraph in word. 

There is a very common double paragraph problem in Microsoft word. and you want to set it in single line paragraph. follow the listed below steps.
1) Select the matter which you want to convert in single line paragraph.
2) Right click and select paragraph and set the listed below parameter:

General:::::::::
Alignment: left
Outline level: Bodytext
Indentation::::::
Left=0"    Right=0"   Special=(none)     By=Empty
Mirror indents=uncheck
Spacing::::::::::
Before= 0 pt       After=0 pt   Line Spacing =At least
At=5 pt