rss
twitter
    Find out what You Want :)
Home    Downloads    Corner    Market    News sites    About Us

Saturday, January 1

CS 101 Assignment # 3


CS 101 Assignment # 3

<html>
<head>
<script language="JavaScript" type="text/javascript">

function alert_showmsg(msgs)
{
    var whole_msg="";
    var first_elmnt=null;
    for(var m=0;m < msgs.length;m++)
    {
        if(null == first_elmnt)
        {
            first_elmnt = msgs[m]["input_element"];
        }
        whole_msg += msgs[m]["msg"] + "\n";
    }
           
    alert(whole_msg);

    if(null != first_elmnt)
    {
        sfm_set_focus(first_elmnt);
    }
}

function sfm_validator_enable_focus(enable)
{
    document.set_focus_onerror = enable;
}



function set_addnl_vfunction(functionname)
{
  this.formobj.addnlvalidation = functionname;
}

function sfm_set_focus(objInput)
{
    if(document.set_focus_onerror)
    {
        objInput.focus();
    }
}

function sfm_enable_show_msgs_together()
{
    this.show_errors_together=true;
    this.formobj.show_errors_together=true;
}
function clear_all_validations()
{
            for(var itr=0;itr < this.formobj.elements.length;itr++)
            {
                        this.formobj.elements[itr].validationset = null;                      
            }
}

function form_submit_handler()
{
   var bRet = true;
    document.error_disp_handler.clear_msgs();
            for(var itr=0;itr < this.elements.length;itr++)
            {
                        if(this.elements[itr].validationset &&
               !this.elements[itr].validationset.validate())
                        {
                          bRet = false;
                        }
        if(!bRet && !this.show_errors_together)
        {
          break;

        }
            }

            if(this.addnlvalidation)
            {
              str =" var ret = "+this.addnlvalidation+"()";
              eval(str);

     if(!ret)
     {
       bRet=false;
     }

            }

   if(!bRet)
    {
      document.error_disp_handler.FinalShowMsg();
      return false;
    }
            return true;
}

function Validator(frmname)
{
  this.formobj=document.forms[frmname];
            if(this.formobj.onsubmit)
            {
             this.formobj.old_onsubmit = this.formobj.onsubmit;
             this.formobj.onsubmit=null;
            }
            else
            {
             this.formobj.old_onsubmit = null;
            }
            this.formobj._sfm_form_name=frmname;
            this.formobj.onsubmit=form_submit_handler;
            this.ValAddition = add_validation;
            this.setAddnlValidationFunction=set_addnl_vfunction;
            this.clearAllValidations = clear_all_validations;
    this.disable_validations = false;//new
    document.error_disp_handler = new sfm_ErrorDisplayHandler();
    this.EnableOnPageErrorDisplay=validator_enable_OPED;
            this.EnableOnPageErrorDisplaySingleBox=validator_enable_OPED_SB;
    this.show_errors_together=true;
    this.EnableMsgsTogether=sfm_enable_show_msgs_together;
    document.set_focus_onerror=true;
    this.EnableFocusOnError=sfm_validator_enable_focus;

}

function add_validation(itemname,descriptor,errstr)
{
            var condition = null;
            if(arguments.length > 3)
            {
             condition = arguments[3];
            }
  if(!this.formobj)
            {
                        alert("Error: The form object is not set properly");
                        return;
            }//if
            var itemobj = this.formobj[itemname];
    if(itemobj.length && isNaN(itemobj.selectedIndex) )
    //for radio button; don't do for 'select' item
            {
                        itemobj = itemobj[0];
            }         
  if(!itemobj)
            {
                        alert("Error: Couldnot get the input object named: "+itemname);
                        return;
            }
            if(!itemobj.validationset)
            {
                        itemobj.validationset = new ValidationSet(itemobj,this.show_errors_together);
            }
            itemobj.validationset.add(descriptor,errstr,condition);
    itemobj.validatorobj=this;
}
function validator_enable_OPED()
{
    document.error_disp_handler.EnableOnPageDisplay(false);
}

function validator_enable_OPED_SB()
{
            document.error_disp_handler.EnableOnPageDisplay(true);
}

function edh_clear_msgs()
{
    this.msgdisplay.clearmsg(this.all_msgs);
    this.all_msgs = new Array();
}
function edh_FinalShowMsg()
{
    this.msgdisplay.showmsg(this.all_msgs);
}
function edh_EnableOnPageDisplay(single_box)
{
            if(true == single_box)
            {
                        this.msgdisplay = new SingleBoxErrorDisplay();
            }
            else
            {
                        this.msgdisplay = new DivMsgDisplayer();               
            }
}
function edh_ShowMsg(msg,input_element)
{
           
   var objmsg = new Array();
   objmsg["input_element"] = input_element;
   objmsg["msg"] =  msg;
   this.all_msgs.push(objmsg);
}
function AlertMsgDisplayer()
{
  this.showmsg = alert_showmsg;
  this.clearmsg=alert_clearmsg;
}
function sfm_ErrorDisplayHandler()
{
  this.msgdisplay = new AlertMsgDisplayer();
  this.EnableOnPageDisplay= edh_EnableOnPageDisplay;
  this.ShowMsg=edh_ShowMsg;
  this.FinalShowMsg=edh_FinalShowMsg;
  this.all_msgs=new Array();
  this.clear_msgs=edh_clear_msgs;
}
function alert_clearmsg(msgs)
{

}

function sfm_show_error_msg(msg,input_elmt)
{
    document.error_disp_handler.ShowMsg(msg,input_elmt);
}
function SingleBoxErrorDisplay()
{
 this.showmsg=sb_div_showmsg;
 this.clearmsg=sb_div_clearmsg;
}

function sb_div_clearmsg(msgs)
{
            var divname = form_error_div_name(msgs);
            show_div_msg(divname,"");
}

function ValidationDesc(inputitem,desc,error,condition)
{
  this.desc=desc;
            this.error=error;
            this.itemobj = inputitem;
            this.condition = condition;
            this.validate=vdesc_validate;
}
function vdesc_validate()
{
            if(this.condition != null )
            {
                        if(!eval(this.condition))
                        {
                                    return true;
                        }
            }
            if(!validateInput(this.desc,this.itemobj,this.error))
            {
                        this.itemobj.validatorobj.disable_validations=true;

                        sfm_set_focus(this.itemobj);

                        return false;
            }
            return true;
}
function ValidationSet(inputitem,msgs_together)
{
    this.vSet=new Array();
            this.add= add_validationdesc;
            this.validate= vset_validate;
            this.itemobj = inputitem;
    this.msgs_together = msgs_together;
}
function add_validationdesc(desc,error,condition)
{
  this.vSet[this.vSet.length]=
  new ValidationDesc(this.itemobj,desc,error,condition);
}
function vset_validate()
{
    var bRet = true;
    for(var itr=0;itr<this.vSet.length;itr++)
    {
        bRet = bRet && this.vSet[itr].validate();
        if(!bRet && !this.msgs_together)
        {
            break;
        }
    }
    return bRet;
}

function TestRequiredInput(objValue,strError)
{
 var ret = true;
 var val = objValue.value;
 val = val.replace(/^\s+|\s+$/g,"");//trim
    if(eval(val.length) == 0)
    {
       if(!strError || strError.length ==0)
       {
         strError = objValue.name + " : Required Field";
       }//if
       sfm_show_error_msg(strError,objValue);
       ret=false;
    }//if
return ret;
}
function TestMaxLen(objValue,strMaxLen,strError)
{
 var ret = true;
    if(eval(objValue.value.length) > eval(strMaxLen))
    {
      if(!strError || strError.length ==0)
      {
        strError = objValue.name + " : "+ strMaxLen +" characters maximum ";
      }//if
      sfm_show_error_msg(strError,objValue);
      ret = false;
    }//if
return ret;
}
function TestMinLen(objValue,strMinLen,strError)
{
 var ret = true;
    if(eval(objValue.value.length) <  eval(strMinLen))
    {
      if(!strError || strError.length ==0)
      {
        strError = objValue.name + " : " + strMinLen + " characters minimum  ";
      }//if              
      sfm_show_error_msg(strError,objValue);
      ret = false;  
    }//if
return ret;
}
function TestInputType(objValue,strRegExp,strError,strDefaultError)
{
   var ret = true;

    var charpos = objValue.value.search(strRegExp);
    if(objValue.value.length > 0 &&  charpos >= 0)
    {
              objValue.style.background="red";
     if(!strError || strError.length ==0)
      {
        strError = strDefaultError;
      }//if
      sfm_show_error_msg(strError,objValue);
      ret = false;
    }//if
 return ret;
}

function TestLessThan(objValue,strLessThan,strError)
{
var ret = true;
              if(isNaN(objValue.value))
              {
                sfm_show_error_msg(objValue.name +": Should be a number ",objValue);
                ret = false;
              }//if
              else
              if(eval(objValue.value) >=  eval(strLessThan))
              {
                if(!strError || strError.length ==0)
                {
                  strError = objValue.name + " : value should be less than "+ strLessThan;
                }//if              
                objValue.style.background="lightblue";
                        sfm_show_error_msg(strError,objValue);
                ret = false;                
               }//if  
return ret;         
}
function TestGreaterThan(objValue,strGreaterThan,strError)
{
var ret = true;
     if(isNaN(objValue.value))
     {
       sfm_show_error_msg(objValue.name+": Should be a number ",objValue);
       ret = false;
     }//if
             else
     if(eval(objValue.value) <=  eval(strGreaterThan))
      {
        if(!strError || strError.length ==0)
        {
          strError = objValue.name + " : value should be greater than "+ strGreaterThan;
        }//if              
        objValue.style.background="lightblue";
                        sfm_show_error_msg(strError,objValue); 
        ret = false;
      }//if 
return ret;          
}
function CheckBtwValues(objValue,strGrtVal,strError)
{
var ret = true;
     if(isNaN(objValue.value))
     {
       sfm_show_error_msg(objValue.name+": Should be a number ",objValue);
       ret = false;
     }//if
             else
     if(objValue.value == '')
      {
                        strError = "Please enter a GPA number only.";
                        fldColor = "yello";
      }//if 
             else
     if(eval(objValue.value) >=  1 && eval(objValue.value) < 2)
      {
        strError = "FAIR - YOU HAVE GOT D GRADE.";
                        fldColor = "green";
      }//if 
             else
     if(eval(objValue.value) >=  2 && eval(objValue.value) < 3)
      {
        strError = "GOOD - YOU HAVE GOT C GRADE.";
                        fldColor = "green";
      }//if 
             else
     if(eval(objValue.value) >=  3 && eval(objValue.value) < 4)
      {
        strError = "VERY GOOD - YOU HAVE GOT B GRADE.";
                        fldColor = "green";
      }//if 
     if(eval(objValue.value) == 4)
      {
        strError = "EXCELLENT - YOU HAVE GOT A GRADE.";
                        fldColor = "green";
      }//if 
        objValue.style.background=fldColor;
                        sfm_show_error_msg(strError,objValue); 
        ret = false;       
return ret;          
}

function validateInput(strValidateStr,objValue,strError)
{
    var ret = true;
    var epos = strValidateStr.search("=");
    var  command  = "";
    var  cmdvalue = "";
    if(epos >= 0)
    {
     command  = strValidateStr.substring(0,epos);
     cmdvalue = strValidateStr.substr(epos+1);
    }
    else
    {
     command = strValidateStr;
    }
    switch(command)
    {
        case "req":
        case "required":
         {
                           ret = TestRequiredInput(objValue,strError)
           break;            
         }//case required
        case "maxlength":
        case "maxlen":
          {
                                     ret = TestMaxLen(objValue,cmdvalue,strError)
             break;
          }//case maxlen
        case "minlength":
        case "minlen":
           {
                                     ret = TestMinLen(objValue,cmdvalue,strError)
             break;
            }//case minlen
        case "dec":
        case "decimal":
           {
                ret = TestInputType(objValue,"[^0-9\.]",strError,
                                                                        "Enter numbers only");
                                                                       
                break;              
           }
        case "lt":
        case "lessthan":
         {
                  ret = TestLessThan(objValue,cmdvalue,strError);
              break;
         }
        case "gt":
        case "greaterthan":
         {
                                    ret = TestGreaterThan(objValue,cmdvalue,strError);
            break;
         }//case greaterthan
                        case "CheckGPA":
                        {
                                    ret = CheckBtwValues(objValue,strError);
                            break;
                        }                     
    }//switch
            return ret;
}
</script>
</head>
<body>
<h2 align="center">YOUR STUDENT ID :: Assignment NUMBER</h2>
<form action="http://www.vu.edu.pk" method="post" id="cs101frm">
  <table width="800" border="1" align="center">
    <tr>
      <td width="116" height="50" align="center" bgcolor="#CCCCCC">GPA</td>
      <td width="468" bgcolor="#CCCCCC"><input name="GPA" type="text" id="GPA" size="75" /></td>

    </tr>
    <tr>
      <td height="50" bgcolor="#CCCCCC">&nbsp;</td>
      <td bgcolor="#CCCCCC"><input type="submit" name="button" id="button" value="Find Grade" /></td>
    </tr>
  </table>
</form>
<script language="javaScript" type="text/javascript">
 var ValidFrm = new Validator("cs101frm");
  ValidFrm.ValAddition("GPA","decimal");
ValidFrm.ValAddition("GPA","maxlen=4","Maximum length is 4");
 ValidFrm.ValAddition("GPA","gt=0","Please enter a number which is greater than 0");
 ValidFrm.ValAddition("GPA","lt=5","Please submit number between 1 to 4 only");
 ValidFrm.ValAddition("GPA","CheckGPA");
</script>
</body>
</html>

Friday, December 31

MCM-411-Assignment


QUESTION NO.1
Article 19 of the constitution of Pakistan gives “every citizen the right of freedom of speech and expression” Do you think the citizens of Pakistan enjoys this freedom? Discuss.
ANSWER:
Every citizen shall have the right to freedom of speech and expression, and there shall be freedom of the press, subject to any reasonable restrictions imposed by law in the interest of the glory of Islam or the integrity, security or defense of Pakistan.
Every citizen has the right to: join an association/union; freedom of speech and expression; freedom of the Press is guaranteed
Every citizen shall have the right to freedom of speech and expression, and there shall be freedom of the press, subject to any reasonable restrictions imposed by law in the interest of the glory of Islam or the integrity, security or defense of Pakistan or any part thereof, friendly relations with foreign States, public order, decency or morality, or in relation to contempt of court, commission of or incitement to an offence
Blasphemy laws Main article: Blasphemy law in Pakistan
The Pakistani government does not restrict religious publishing per se. However, it restricts the right to freedom of speech with regard to religion. Speaking in opposition to Islam and publishing an attack on Islam or its prophets are prohibited. Pakistan's penal code mandates the death penalty for anyone defiling the name of Muhammad, whom Muslims view as a prophet. This penal code mandates life imprisonment for desecrating the Koran, and up to 10 years' imprisonment for insulting another's religious beliefs with intent to outrage religious feelings.
Pakistan's wickedness laws are considered to be relatively strict, and have been the source of controversy in recent years. It has been alleged in some cases that Muslims who have engaged in public debate about their religion have been prosecuted for wickedness.
QUESTION NO.2
It is a common perception that PTV doesn’t portray both sides of an issue? Do you agree? Discuss.
ANSWER:
When Pakistan Television (PTV) started broadcasting in 1964, the few hours of transmission would commence with recitation from the Holy Quran.
Advertising, too, was free of any religious images and messages. In fact, PTV’s code prohibited the use of mosques, azan, images of Namaz, etc in advertising as it was considered an exploitation of religion for commercial purposes
PTV channels are family oriented and the salient features of its policy are as follows:
  • PTV Corporation's broadcasts are family oriented and they carters the need of local audience by showing eastern family programs.
  • It also acts on social development theory of media, that’s why it shows informative programs about health and social issues.
  • It also censors commercials and holds a conservative standard as compared to other channels.
  • It supports government policies on national and international matters.

Thursday, December 30

Eng 201 Assignment(Feasibility Reports)

Feasibility Reports
When the managers of a company or an organization plan to undertake a new project
(such as a move, the development of a new product, an expansion, or the purchase of new
equipment) they try to determine the project’s chances for success. A feasibility report
documents the study conducted to help them make this determination. This report
presents evidence about the practicality of the proposed project: How much will it cost/ Is
sufficient personnel available? Are any legal or other special requirements necessary?
Based on the evidence, the writer of the feasibility report recommends whether or not the
project should be carried out. Management then considers the recommendation and
makes the decision.
Before beginning to write a feasibility report, state clearly and concisely the purpose of
the study. In a feasibility report, the scope should include the alternatives for
accomplishing the purpose of the study and the criteria by which each alternative will be
examined.
In writing a feasibility report, you must first identify the alternatives and then evaluate
each against your established criteria. After completing these analyses, summarize them
in a conclusion. This summary of relative strengths and weaknesses usually points to one
alternative as the best or most feasible. Make your recommendation on the basis of this
conclusion.
Every feasibility report should contain the following sections: (1) an introduction, (2) a
body, (3) a conclusion, and (4) a recommendation.
Introduction
The introduction should state the purpose of the report, describe the problems that led to
the report, and include any pertinent background information. You may also discuss the
scope or extent of the report in the introduction and any procedures or methods used in
the analysis of alternatives. Any limitations on the study should be noted here as well.
Body
The body of the report should present a detailed evaluation of all alternatives under
consideration. Evaluate each alternative according to your established criteria. Ordinarily,
each evaluation would comprise a separate section of the body of the report.
Conclusion
The conclusion should summarize the evaluation of all alternatives, usually in the order
discussed in the body of the report.
Recommendation
This section presents the alternative that best meets the criteria.
Source: Brusaw, C. T., Alred, G. J., Oliu, W. E. (1996). The Concise Handbook for
Technical Writing. New York: St. Martin’s Press.

IT430 E-Commerce Assignment#2


Assignment No. 02
Semester: Fall 2010
IT430 E-Commerce

Total Marks: 10
Due Date: 03/01/2011

What are the steps involved in symmetric cryptography? Also explain key management in conventional cryptography using some example.

Answer
1) Symmetric Cryptography
When one party wishes to communicate secured data with another and they both share
the same key for encrypting and decrypting the data, the process is known as symmetric
Cryptography.
The shared key is referred to as a symmetric key.
Because the same key is used to encrypt and decrypt the data with symmetric
cryptography, the decryption process is essentially a reversal of the encryption process.
STEPS INVOLVED IN SYMMETRIC CRYPTOGRAPHY:
Symmetric encryption involves the following steps:
  1. The sender creates an encoded text message by encrypting the plaintext message
 with a symmetric encryption algorithm and a shared key.
2. The sender sends the encoded text message to the recipient.
  1. The recipient decrypts the encoded text message back into plaintext with a shared
 key.
2) Conventional cryptography
In conventional cryptography, (also called secret-key or symmetric-key encryption),
one key is used both for encryption and decryption.

Key management in conventional cryptography:

Conventional encryption is very fast. It is especially useful for encrypting data that is not going anywhere. However, conventional encryption alone as a means for transmitting secure data can be quite expensive simply due to the difficulty of secure key distribution.
The expense of secure channels and key distribution relegated its use only to those who could afford it, such as governments and large banks.
EXAMPLES:
Following are the examples of key management in conventional cryptography
1-The Data Encryption Standard (DES): is an example of a conventional crypto system that is widely employed by the Federal Government.

2-Captain Midnight's Secret Decoder Ring: (which is an "encoder" ring as well) is also an example of conventional cryptography which allows you to do a simple substitution encryption. It usually has two concentric wheels of letters, A through Z.

3-Julius Caesar's cipher : The Caesar cipher is named for Julius Caesar who used an alphabet with a left shift of three is also an example of conventional cryptography.

Wednesday, December 29

Isl201-Assignment #2


RECIPIENTS OF ZAKAT:
The recipients of Zakat, according to Quran are as follows:
"Alms
are for the poor and the needy, and those employed to administer (the
funds); for those whose hearts have been (recently) reconciled (to
truth); for those in bondage and in debt; and for the wayfarer: (Thus is
it) ordained by Allah, and Allah is full of Knowledge and Wisdom."
 (Quran 9:60)
  1. FUQARA: people who are poor and who possess more than their basic needs but do not possess wealth equal to Nisaab.
  2. MASAKEEN: people who are destitute and extremely needy to the extent they are forced to beg for their daily food rations.
  3. AL-AMILEEN: people appointed by an Islamic Government to collect Zakat.
  4. MU-ALLAFATUL-QULUB: persons who have recently accepted Islam and are in need of basic necessities who would benefit from encouragement by Muslims which would help strengthen their faith.
  5. AR-RIQAAB: slaves who are permitted to work for remuneration and have an agreement from their masters to purchase their freedom on payment of fixed amounts.
  6. AL-GHAARIMEEN: persons who have a debt and do not possess any other wealth or goods with which they could repay that which they owe. It is conditional that this debt was not created for any un-Islamic
    purpose.
  7. FI-SABILILLAH: persons who have to carry out an obligatory deed which has become obligatory on them and subsequently (due to loss of wealth) are unable to complete that obligation.
  8. IBN-US-SABEEL: persons who are travelers and during the course of their journey do not possess basic necessities, though they are well to do at home. They could be given Zakat in order to fulfill
    travel needs to return home.
PERSONS WHO CANNOT BE GIVEN ZAKAT:
  1. Zakat cannot be given to the descendants of Muhammad (P.B.U.H);
  2. Zakat cannot be given to parents and grandparents. In the same manner one's children and grandchildren cannot be given Zakat. A husband and wife cannot give Zakat to each other.
  3. Zakat contributions cannot be given to such institutions or organizations who do not give the rightful recipients possession of Zakat, but instead use Zakat funds for constructions, investment or
    salaries.

VIRTUES OF ZAKAT:
Allah says in the Quran:
"The
parable of those who spend their wealth in the way of Allah is that of a
grain of corn. It grows seven ears and each ear has hundred grains.
Allah increases manifold to whom He pleases." 
(Quran 2:261)
It is stated in the Hadith that by giving Zakat the following benefits are derived:
  1. Gain the pleasure of Allah.
  2. Increase in wealth and protection from losses.
  3. Allah's forgiveness and blessings.
  4. Protection from the wrath of Allah and from a bad death.
  5. A shelter on the Day of Judgment;
  6. Security from seventy misfortunes.

THE PUNISHMENT FOR NOT GIVING ZAKAT:
Allah says in the Quran:
"And
there are those who hoard gold and silver and do not spend it in the
way of Allah, announce to them a most grievous penalty (when) on the Day
of Judgment heat will be produced out of that wealth in the fire of
Hell. Then with it they will be branded on their forehead and their
flanks and backs. (It will be said to them) This is the treasure which
you hoarded for yourselves, taste then the treasure that you have been
hoarding." 
(Al-Quran 9:34-35)

Discus Your Study Problems Here

Is This Blog Is Useful For You?

Face Book Fans