Sunday, September 14, 2014

Do's and Don'ts of Group Work

Do's when working with a group


  1. Do create a to do list
                  Make yourself an old fashioned to-do list with check boxes. List everything, big and small, that you have to do for your entire day; break big activities into smaller bits if necessary. Then, as you work through your day check off each of the items on your list.
               Keep a notebook by hand before you start your workday. Write every thought down that comes up during work. Every single to do or things you want to do at that specific moment. Don't do it, put it on a list and do it later. This prevents you from getting into the "procrastination zone".


   2. Do Speak in the group - not at them
   
                People who speak at a group leave no space for response and tend to dominate. People who speak in a group consider the other members.Make contributions, but don't dominate. Ask questions, but not too many. Suggest ideas that the whole group can comment on, "Why don't we…" or "What do people think about…". Most communication is non-verbal: Pay attention to people's body language as this can reveal a lot about how they feel about the group.


  3. Do give yourself a break.

              If you can’t seem to focus and are working half-heartedly at your tasks, give yourself a brief break. Set a timer for ten minutes, and take a nap, read a book, or call your friend. Do whatever it is you’ve been daydreaming about so that the temptation is removed once you get back to work. Just be sure to follow through with your deadline rather than ignoring it when you alarm finally goes off.


  4. Do focus on the end goal



         It’s easy to see only the giant list of things to do, rather than the anxiety-free feeling of accomplishment at having finished them. As you work, focus on all the free time, relaxation, money, whatever it may be that you get when you finish. This will help you to stay on task and work towards your goal.






  5. Do assign tasks and set deadlines


              Go beyond simply agreeing that something needs to be done; assign tasks and allocate timelines.


Don'ts when working with a group

  1. Don’t be a perfectionist


               If you’re waiting for the perfect time, the perfect supplies, or you won’t stop until you've “perfected” your project, you’re putting off completing your task. Avoid this “perfect” thinking by considering quantity over quality. If your project doesn't require perfection but you’re still focused on it, stop and move on to your next task. When you've finished everything, you can backtrack and finish perfecting your original task.



  2. Don't just agree
     
       It is important that all perspectives are put forward so that intellectual debate can flourish. Be a genuine contributor to your group.

  3. Don't sabotage your group.
 
          It is quite easy to sabotage a group, often unintentionally through ; Being late for the session, Not preparing,Whispering or chatting while someone is addressing the group

Friday, September 12, 2014

Commenting Function with PHP Codeigniter


 A user is able to comment on an image according to our project. So let's take a look at how this commenting function happens.



View

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update and Delete with Slide Effect.....</title>
<link href="frame.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
  <script type="text/javascript">
 $( document ).ready(function () {

//class of comment button
//what to do when btn is clickd
$(".comment_button").click(function() 
{
var element = $(this);
   
   //assign value of comment box to boxval
   //#content is id of comment box
   var boxval = $("#content").val();
    var dataString =  "comment="+ boxval +"&img_id="+ <?php echo $_GET['img_id'] ?> + "&userName=<?php echo $_SESSION['email']; ?>"  +"";

if(boxval=='')
{
alert("Please Enter Some Text");
}
else
{
//#flash is id of div tag
$("#flash").show();
$("#flash").fadeIn(1000).html('<img src="ajax.gif" align="absmiddle">&nbsp;<span class="loading">Loading Update...</span>');

$.ajax({
//URL to send the request to
url: 'addComment',
type: 'POST',
//specifies data to be sent to the server
data: dataString,
 //A function to be run when the request succeeds 
success: function(html) {
document.getElementById('update').innerHTML = document.getElementById('update').innerHTML + html;
document.getElementById('content').value='';
$("#flash").hide();
},
//A function to be run when the request fails 
error: function(data) {
    alert("ERROR !");
}
});
}
return false;
});
});
</head>
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" width="500px">
<tr>
<td>
<div id="test">
</div>
<div style="height:7px"></div>
<div id="flash" align="left"  ></div>
<ol  id="update" class="timeline">

<div id="old_updates">
</div>
<?php
//assign the current element's key to the $key variable on each iteration
//$comments arr created in viewImage.php
foreach ($comments as $key => $val) {
$user = $val['userName'];
$comment = $val['comment'];

echo "<li>";
echo "$user </br>$comment";
echo "</li>";
}
?>

</ol>
<div align="left">
<form  method="post" name="form" action="">
<?php if($_SESSION['teamRole']=='Scrum Master'){ 
echo '<table cellpadding="0" cellspacing="0" width="500px">
<tr><td align="left"><div align="left"><h3>What do you think?</h3></div></td></tr>
<tr>
<td style="padding:4px; padding-left:10px;" class="comment_box">
<textarea cols="30" rows="2" style="width:480px;font-size:14px; font-weight:bold" name="content" id="content" maxlength="145" ></textarea><br />
<button type="submit" id="update" name="submit" class="comment_button">Comment</button>
</td></tr></table>';
}?>
</form>
</div>
</div>
</td></tr></div>
</li></table></div>
</body></html>


Comments have been written in the code to explain each line of the code. Basically what happens is in the body part the textbox needed to add the comment is there. Above it is an ordered list to show all the previously written comments. Only the Scrum master can write comments for a particular image.The developers can only view these comments.  


Model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class model_viewImage extends CI_Model{
public function __construct(){
parent::__construct();
}

public function getComments($imgID){ 
                  $this->db->select("message, msg_id, userName");
                  $whereCondition =array('img_id' =>$imgID);
                  $this->db->where($whereCondition);
                  $this->db->from('comment');
                  $query = $this->db->get();
                  return $query->result(); //returns a boolean value
            }

            public function insertComment($userName, $img_id, $comment){ 
                  $data = array(
                  'message' => $comment ,
                  'img_id' => $img_id ,
                  'userName' => $userName
                  );
                  $this->db->insert('comment', $data); 
            }
}

?>

The function insertComment() inserts the comments to the database where as the function getComments() is used  to get the saved comments from the database.

Friday, September 5, 2014

Search Function with PHP-Codeigniter

   Working with CodeIgniter as a developer is a great experience. Including AJAX inside CodeIgniter is a pleasure. CodeIgniter + AJAX offers a great user-experience if they are combine in a harmonious way.
 
   Providing a search function that searches your Web pages is a design strategy that offers users a way to find content. Users can locate content by searching for specific words or phrases, without needing to understand or navigate through the structure of the Web site. This can be a quicker or easier way to find content, particularly on large sites.


 Let’s start!




View


<head>
<script type="text/javascript" src=<?php echo base_url('assets/jquery-ui/js/jquery-1.10.2.js'); ?>></script>
<script type="text/javascript" src=<?php echo base_url('assets/jquery-ui/js/jquery-ui-1.10.4.custom.min.js'); ?>></script>
<!-- <script type="text/javascript" language="javascript" src="<?php echo base_url(); ?>js/jquery.js"></script>-->
<script type="text/javascript" src=<?php echo base_url('assets/js/json2.js'); ?>></script>
<script>

function check_(){
if($("#search_prj").is(':checked')){
if($("#search_usr").is(':checked'))
$("#vall").val('3');
else
$("#vall").val('1');
}
else{
if($("#search_usr").is(':checked'))
$("#vall").val('2');
else
$("#vall").val('0');
}
}
$(document).ready(function(){
$("#search_prj").change(function(){
check_();
});

$("#search_usr").change(function(){
check_();
});

$("#search").keyup(function(){
if($("#search").val().length>3){
$.ajax({
type: "post",
url: "search",
cache: false,
data:'search='+$("#search").val() +'&v='+$("#vall").val(),

success: function(response){
$('#finalResult').html("");
var obj = JSON.parse(response);
if(obj.length>0){
try{
var items=[];
$.each(obj, function(i,val){
items.push($('<li>').text(val.name));

});
$('#finalResult').append.apply($('#finalResult'), items);
}catch(e) {
alert('Exception while request..');
}
}else{
$('#finalResult').html($('<li/>').text("No Data Found"));
}

},
error: function(){
alert('Error while request..');
}
});
}
return false;
});
});
</script>
</head>
<body>
<?php echo form_open('search/getDetails'); ?>
<center>
<table border="0">
<tr>
<td>search </td>
<div id="container">
<td> <input type="text" id="search" name="keyword" autocomplete="off"> &nbsp;<ul id="finalResult"></ul></td>
</div>
<td> <button type="submit" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-search"></span>
</button> </td>
</tr>
<tr>
<td><input type="radio" name="search_val" id="search_prj" value="1">Projects </input></td>
</tr>
<tr>
<td><input type="radio" name="search_val" id="search_usr" value="2">Users </input>
         <input type="text" hidden value="0" id ="vall"/> </td>
</tr>
</table>
</center>
<?php echo form_close(); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src=<?php echo base_url('assets/js/bootstrap.min.js'); ?>></script>
</body>
</html>

   This code gives the interface of the search function. The ajax code written in the head section gives the auto-complete of our search function. If I give a breif description of the ajax code...

  First we should create a textbox and make it hidden so that we can check if the radio buttons are selected. vall is the id of this hidden textbox. If the Users radio button is clicked value of the hidden textbox will be 1 where as if the Projects  radio button is clicked value of the hidden textbox will be 2. Then it checks if the radio button is actually checkd by the check() function.
  In the keyup function, that is when the key is released it checks if the value of the search textbox is greater than 3 in length. in the success function the serch results will be listed down as in the error function an alert will be shown.


Model

<?php
class model_search extends CI_Model {

function getEmployee($search, $v){
if($v=="1"){
$this->db->select("name");
$whereCondition =array('name' =>$search);
$this->db->where($whereCondition);
$this->db->from('project');
$query = $this->db->get();
return $query->result();
}
else if($v=="2"){
$this->db->select("username as name");
$whereCondition =array('fName' =>$search);
$this->db->where($whereCondition);
$this->db->from('users');
$query = $this->db->get();
return $query->result();
}
else if($v=="3"){
return null;
}
}
}
?>


Here the value of the hidden textbox is checked. If the value=1 the given query will be executed where all projects will be selected. If value=2 is selected all usernames will be be selected else it will return null.


Controller

<?php
class search extends CI_Controller {
   
    public function __construct(){
            parent::__construct();

            $this->load->helper('url');
            $this->load->helper('html');
            session_start();
    }

    public function index(){
        $this->load->model('model_search');
        if(!(isset($_POST['search']))){
            $this->load->view('view_header');
            $this->load->view('view_search');
        }
        else{
            $v = $this->input->post('v');
            $search=  $this->input->post('search');
            $query = $this->model_search->getEmployee($search, $v);
             echo json_encode ($query);
        }
    }

    public function getDetails()
    {
        $this->load->model('model_search');
        $search_q=  $this->input->post('keyword');
        $this->load->view('view_header');
        $this->load->model('model_getSearchValue');

        $search_val=$this->input->post('search_val');
     
        if($search_val=='1'){
            $data1['result1']=$this->model_getSearchValue->getProjects($search_q)->result();
            $this->load->view('view_searchProjects',$data1);
        }
        if($search_val=='2'){
            $data2['result2']=$this->model_getSearchValue->getUsers($search_q)->result();
            $this->load->view('view_searchUsers',$data2);

        }
    }
}
?>

This is the controller which calls all models and views created.In the index function if there is any value in the searchbox it will call the abouve created model's functions. The getDetails function is where you load the interfaces when you click on the search button. search_val is the name we have given for  post value of the 2 radio buttons we have added. If the id of the radio button is 1 it will search for the given project name where as if the id is 2 it will view the user we want to search.

Saturday, August 30, 2014

Before Starting to Code......

Bootstrap

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.Bootstrap makes front-end web development faster and easier. It's made for folks of all skill levels, devices of all shapes, and projects of all sizes.
In order to add the bootstrap framework into your project
  1. Go to http://getbootstrap.com/ and download the files.                  
  2. Create a folder inside codeigniter folder named 'assets'.
  3. Create a folder inside assets folder named 'css'.
  4. Put css files into css folder along with the 'bootstrap.min.css' file.
  5. Add this code segmant inside the head section in your view files.

  6. <?php
    echo link_tag('assets/css/filename.css');
    echo link_tag('assets/css/bootstrap.min.css');
    ?>

Codeigniter URLs

  URLs in CodeIgniter are designed to be search-engine and human friendly. Rather than using the standard "query string" approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment-based approach. By default, the index.php file will be included in your URLs
   eg.  example.com/index.php/news/article/my_article


Removing The index.php File
  1. download the .htaccess file from the link provided below.                     http://www.mediafire.com/view/ql6ni1sae04h1n4/htaccess
  2. copy that file in to your Codeigniter folder.
  3. go to C:\wamp\www\Rally_CI\application\config and open the config file.
  4. make $config['index_page'] = 'index.php'; to $config['index_page'] = '';
  5. click on the wamp icon -> Apache -> Apache modules -> enable 'rewrite_module'

Introduction to PHP - Codeigniter

PHP
     PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
      PHP code can be simply mixed with HTML code, or it can be used in combination with various templating engines and web frameworks. PHP code is usually processed by a PHP interpreter, which is usually implemented as a web server's native module or a Common Gateway Interface (CGI) executable. After the PHP code is interpreted and executed, the web server sends resulting output to its client, usually in form of a part of the generated web page – for example, PHP code can generate a web page's HTML code, an image, or some other data. PHP has also evolved to include a command-line interface (CLI) capability and can be used in standalone graphical applications.


Any language is easy to learn with a framework. Therefore out team came up with the idea of coding using php-codeigniter framework.



PHP - Codeigniter



   CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.CodeIgniter is loosely based on the popular Model-View-Controller development pattern. While view and controller classes are a necessary part of development under CodeIgniter, models are optional. CodeIgniter is most often noted for its speed when compared to other PHP frameworks.














CodeIgniter Is Right for You if…
  •     You want a framework with a small footprint.
  •     You need exceptional performance.
  •     You need clear, thorough documentation.
  •     You are not interested in large-scale monolithic libraries.
  •     You need broad compatibility with standard hosting.
  •     You prefer nearly zero configurations.
  •     You don't want to adhere to restrictive coding rules.
  •     You don't want to learn another template language.
  •     You prefer simple solutions to complexity.
  •     You want to spend more time away from the computer.

    Advantages of CodeIgniter:
  •      Easy and hassle-free migration from server hosting to server hosting.
  •      Easy to learn, adopt and deploy
  •      Easy handling and customizing.
  •      A new functionality has been applied without affecting the customization at all.
  •      Offers flexibility and easy management With MVC based framework.
  •      Active Record Implementation is simply superb and easy to remember.
  •      Provides easier configuration and customization of configuration files.
  •      Facilitates easy working with a variety of developers.
  •      Good collection of possessed libraries.
  •      Awesome documentation of the user guide, which makes it easy for any coder to use the whole framework.
  •      Enables to incorporate its own existing scripts as well as develop core librariesfor the system
  •      Lightweight and extensive.
     
     Disadvantages of CodeIgniter:
  •       Its PHP based only and not very object-oriented in some parts
  •       PHP4 legacy code
  •       Company-driven instead of community-driven
  •       Irregular releases
  •       Framework itself has no built-in ORM (only via 3rd party solutions).



Friday, August 29, 2014

AGILE

What Is Agile?

The Agile movement proposes alternatives to traditional project management. Agile approaches are typically used in software development to help businesses respond to unpredictability.
Agilityagility is defined as "the ability of a system to rapidly respond to change by adapting its initial stable configuration".

Why Agile?

  • Customer satisfaction by rapid delivery of useful software
  • Welcome changing requirements, even late in development
  • Working software is delivered frequently (weeks rather than months)
  • Working software is the principal measure of progress
  • Close, daily co-operation between business people and developers
  • Face-to-face conversation is the best form of communication (co-location)
  • Projects are built around motivated individuals, who should be trusted
  • Continuous attention to technical excellence and good design
  • Simplicity
  • Self-organizing teams
  • Regular adaptation to changing circumstances

Scrum

Scrum is the most popular way of introducing Agility due to its simplicity and flexibility. Scrum emphasizes empirical feedback, team self management, and striving to build properly tested product increments within short iterations. 

Scrum Roles


Agile Project Life Cycle

  • In agile software development life cycle the product or solution is first divided into features which need to be developed. If there are new features identified in the midst of complete product release it again gets planned across sprints. Agile Sprint duration is decided based on feature to be developed. Every sprint goes through the phases of Requirement, Design, Development and Testing phase.
  • In the requirements phase, software requirements are framed.
  • In the Design phase, design of the product / solution to be done is come up with. Here test team understands the requirements and comes up with a test strategy / plan to proceed with testing of the piece being developed.
  • In the Development phase, Developers are actively involved in writing source for solutions to be provided and then in unit testing of the functionalists developed. Here the test team is involved in writing test cases for functionalists being developed.
  • In the Test phase, Manual testing happens on the basis of test cases written. Automation testing for the test cases automated is also done. Here the development team is involved in fixing the bugs reported and test team re-verifies it.

Pros and Cons of Agile

ProsCons
  • Is a very realistic approach to software development
  • Promotes teamwork and cross training.
  • Functionality can be developed rapidly and demonstrated.
  • Resource requirements are minimum.
  • Suitable for fixed or changing requirements
  • Delivers early partial working solutions.
  • Good model for environments that change steadily.
  • Minimal rules, documentation easily employed.
  • Enables concurrent development and delivery within an overall planned context.
  • Little or no planning required
  • Easy to manage
  • Gives flexibility to developers
  • Not suitable for handling complex dependencies.
  • More risk of sustainability, maintainability and extensibility.
  • An overall plan, an agile leader and agile PM practice is a must without which it will not work.
  • Strict delivery management dictates the scope, functionality to be delivered, and adjustments to meet the deadlines.
  • Depends heavily on customer interaction, so if customer is not clear, team can be driven in the wrong direction.
  • There is very high individual dependency, since there is minimum documentation generated.
  • Transfer of technology to new team members may be quite challenging due to lack of documentation.

Thursday, August 14, 2014

Hello World!




 This is my first blog post. This blog was created to give my experience about the project we do at my university as a 3rd year student and to help all of you gather some knowledge about the coding language we use PHP codeigniter . SEP or Software Engineering Project! SEP is a module where we had to get in to groups of 4 and create a system according to a real time customer requirements. At first it all sounded so much fun but then came the part where we all had do work our minds off. So by going through my blog you will be able to experience my experience of the work we do for our SE project; the fun time we have, the lessons we learn, experiences at presentations, the arguments etc. I'm sure all of you will learn a good lesson from my experience :)