How to register dll

In this programming tutorial you will learn how to register dll. It is quite easy as you just have to execute a simple command, but before knowing the command i want to tell you that you must have Administrator rights over the operating system (Windows).
You just have to run the following command

regsrv32 dllname-with-its-complete-path

you have to give dll name and its complete path where it exists, let's suppose we have a dll iTextSharp and it exists in project folder located in our D drive then the command will be

regsrv32 D:\Project\iTextSharp.dll 

That's it. I hope you will find this tutorial very handy.

I love your feedback.

Read more...

Uppercase and lowercase strings using jquery

In this programming tutorial we will learn how to convert strings in uppercase and lowercase using jquery. It is not a difficult task in jquery. Jquery has two built-in functions for handling these two cases. Those two functions are .toUpperCase() and .toLowerCase(). Let's have a look over the example given below that demonstrates how to do so.
Convert string in uppercase
var name="Adeel Fakhar";//Very simple
var nameUpperCase=name.toUpperCase(); 

Output
ADEEL FAKHAR

Convert string in lowercase
var name="Adeel Fakhar";
var nameLowerCase=name.toLowerCase(); //Very simple

Output
adeel fakhar

So that's it. I hope you will find this tutorial very useful.

Stay tuned with nice-tutorials.blogspot.com for bundle of jquery tutorials.

I love your feedback.
Read more...

Add new item in dropdown using jquery

In this programming tutorial we will learn how to add new item in dropdown using jquery. It is quite easy in jquery. Let's have a look over the code snippet given below in which i will add a new country in dropdown when button is clicked.
Add new item in dropdown using jquery
before

After
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Add new item in dropdown using jQuery</title>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnClick").click(function () {
                var newCountry = $("#txtItem").val();
                if (newCountry.length > 0)
                    {
                    $("#ddlCountry").append($("<option>").val(newCountry).text(newCountry));
                    $("#txtItem").val("");
                   }
            });
        });
    </script>
</head>
<body>
    <div style="font-family:verdana;font-size:12px;">
   New Country: <input type="text" id="txtItem" />
 Country:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
 <select id="ddlCountry">
 <option value="Pakistan">Pakistan</option>
 <option value="China">China</option>
 <option value="United States">United States</option>
 </select>
        <input id="btnClick" type="button" value=" Add Country " />
    </div>
</body>
</html>

In this above mentioned example, i have a textbox, a dropdown and a button in my page. Country dropdown by default contains three countries which are Pakistan, China and United States. Now for adding new country such as Australia or india, i have written a code in document.ready(), that will execute when button's click event will be fired.
$("#ddlCountry").append($("<option>").val(newCountry).text(newCountry));
The above mentioned code snippet will dynamically add new item or in this example we can say new country to the dropdown using append() function of jquery, which is a built-in function in jquery.

So that's it. This is the way to add new item or element in dropdown using jquery.
I love your feedback.
Read more...

Install php on windows server 2008 R2

In this programming tutorial we will learn how to install php on windows server 2008 R2. Couple of weeks ago one of my colleague asked me to install php on windows server 2008 R2 as he had to deploy a website and I have done it successfully without any problem. Let’s have a look over how to accomplish our task.
Simply go to this tutorial Install PHP on Windows 7 with IIS 7 via FastCGI and that's it. You just have to repeat the steps that you have performed on Windows 7 in order to accomplish this task.

Note:-
Depending on your location you can set a specific date.timezone value by setting the date.timezone property in php.ini file:
date.timezone = "US/Central"

Don't forget to uncomment the date.timezone by removing its preceding semicolon.

So that's it.
Your feedback gives me energy.
Read more...

Learn jquery from beginners to advanced level - part 3 (Final Part)

Finally I am writing the third and last tutorial of this tutorial series. Again I am saying if you are new visitor and haven't read my first two tutorial of this series then please read those tutorials first. Click to read Part 1 and click to read Part 2. One thing I want to ensure you is that if you read and understand all of these three tutorials then you can say yourself the expert of jquery, and you can do any task in jquery with minimum effort. Ok. Now let's start right from there, where we were.
Events

When the DOM is ready…

$(document).ready(function(){
 //Your code will come here
});

  • Fires when the document is ready for programming.
  • Uses advanced listeners for detecting.
  • window.onload() is a fallback.

Attach Event

// execute always
$("div").bind("click", fn);
// execute only once
$("div").one("click", fn);

Possible event values:

blur, focus, load, resize, scroll, unload, beforeunload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error (or any custom event)

jQuery.Event object
Detaching Events
$("div").unbind("click", fn);

(Unique ID added to every attached function)

Events Triggering
$("div").trigger("click");

Triggers browser’s event action as well. Can trigger custom events. Triggered events bubble up.

Events Helpers
// attach / trigger
elem.blur(fn) / elem.blur()
elem.focus(fn) / elem.focus()
elem.click(fn) / elem.click()
elem.change(fn) / elem.change()

And many others…

Preventing Browser Default Action
// use different triggering function
$("div").triggerHandler("click");

// prevent default action in handler
function clickHandler(e) {
 e.preventDefault();
}

// or just return false
function clickHandler(e) {return false;}

Preventing Bubbling
// stop bubbling, keep other handler
function clickHandler(e) {
 e.stopPropagation();
}

// stop bubbling and other handlers
function clickHandler(e) {
 e.stopImmediatePropagation();
}

// or just return false
function clickHandler(e) {return false;}

Live Events (Attach events to dynamically created elements)
// attach live event
("div").live("click", fn);
// detach live event
("div").die("click", fn);

Currently supported events:

click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, keydown, keypress, keyup

Effects

Showing or Hiding Element
// just show
$("div").show();
// reveal slowly, slow=600ms
$("div").show("slow");
// hide fast, fast=200ms
$("div").hide("fast");
// hide or show in 100ms $(“div”).toggle(100);

Sliding Elements
$("div").slideUp();
$("div").slideDown("fast");
$("div").slideToggle(1000);

Fading Elements
$("div").fadeIn("fast");
$("div").fadeOut("normal");
// fade to a custom opacity
$("div").fadeTo ("fast", 0.5);

Fading === changing opacity

Detecting animation completion
$("div").hide("slow", function() {
  alert("The DIV is hidden");
});

$("div").show("fast", function() {
  $(this).html("Hello jQuery");
}); // this is a current DOM element 

Every effect function has a (speed, callback) overload

Custom Animation
// .animate(options, duration)
$("div").animate({
    width: "90%",
    opacity: 0.5,
    borderWidth: "5px"
     }, 1000);

Chaining Animation
$("div").animate({width: "90%"},100)
  .animate({opacity: 0.5},200)
  .animate({borderWidth: "5px"});

By default animations are queued and than performed one by one

Controlling Animations Sync
$("div")
 .animate({width: "90%"},
      {queue:false, duration:1000})
 .animate({opacity : 0.5});

The first animation will be performed immediately without queuing

AJAX with jQuery

Loading content
$("div").load("content.htm");
// passing parameters
$("#content").load("getcontent.aspx",
     {"id":"33","type":"main"});

Sending GET/POST requests
$.get("test.aspx", {id:1},
  function(data){alert(data);});

$.post("test.aspx", {id:1},
  function(data){alert(data);});

Retrieving JSON Data
$.getJSON("users.aspx", {id:1},
  function(users)
  {
   alert(users[0].name);
  });

Retrieving JS Files
$.getScript("script.js",
  function()
  {
   doSomeFunction();
  });

Extending the Library

Adding Methods
// definition
jQuery.fn.printLine = function(s) {
 return jQuery(this).each(function() {   this.append("<div>"+ s +"</div>");
 });
};
// usage
$("#log").printLine("Hello");

Closure to solve the $ issue
(function ($) {
  jQuery.fn.printLine = function(s) {
 return $(this).each(function() {    this.append("<div>"+ s +"</div>");
 });
};
})(jQuery);

Custom Selectors
$.expr[‘:’].test = function(o, i, m, s) {
// o – current object in the selection
// i – loop index in the stack
// m – meta data about your selector
// s – stack of all the elements
// return true to include the element
// return false to exclude the element
};

So that's it. I tried my level best to teach you jquery from beginners to advanced level in this series of tutorials. Now just you have to practice more and more to get a grip on jquery.

I love your feedback.
Read more...

footer

footer