Saturday, November 5, 2011

Time Difference function between two time in php

 /*
     *#Auth: Amit Sharma
     *#Desc: Fucnction for Time difference
     *#Note: use 24 hours Format only
 */

//Start from here;

<?php

//Call a function:
returnTimeDifference("10:00","14:00");

//echo returnTimeDifference("10:00","14:00");

function returnTimeDifference($dtime,$atime)
{

    echo $dtime."-".$atime."
";
    $nextDay=$dtime>$atime?1:0;
     //use 1 to add for next day if time increases
   
    $dep=explode(':',$dtime);
    $arr=explode(':',$atime);
    // echo $dep[0];

    //use mktime function for two dates difference
    $diff=abs(MKTIME($dep[0],$dep[1],0,DATE('n'),DATE('j'),DATE('y'))-MKTIME($arr[0],$arr[1],0,DATE('n'),DATE('j')+$nextDay,DATE('y')));

    // echo DATE('y');//return code
     echo $diff."
";
     $hours=floor($diff/(60*60));
     $mins=floor(($diff-($hours*60*60))/(60));
     $secs=floor(($diff-(($hours*60*60)+($mins*60))));
   
     if(strlen($hours)<2){$hours="0".$hours;}
     if(strlen($mins)<2){$mins="0".$mins;}
     if(strlen($secs)<2){$secs="0".$secs;}

     return $hours.':'.$mins.':'.$secs;
   
}

?>

Thursday, October 6, 2011

HOW to Divide the time

Hi friends today i want to display the logic behind the , time division in your programming as well as daily routine work or to crack the math questions also..


Lets take an example :

Suppose I have 5 hours and 30 minutes (5h30m)

Then the step I follow are:

  • First divide the hours by 2 .  like 5/2 we got 2 as dividend and 1 as reminder.
  • Now convert this reminder  to minutes by multiplies it to 60.
  • After that add this 60 to the 30(already given minutes).
  • total is 90 (minutes you have).
  • then divide the Ninety   by 2 we got 45.
  • So at last, half of the given time is  2 hour 45 (2h 45m)
  • Basically we have to make the conversion like 
  • hours:minutes:seconds format.
 
The same logic work for Minutes and second (mm::ss) format


Hope you got the point.....

Friday, September 23, 2011

Best Chat module for Jomsocial

Keep in mind that you use joomla1.7 and jomsocial  2.2.3 version

Today i will Explain you the Step by step Guide in Easy and very Clean way how to add a chat module for Joomla1.7 and jomsocial 2.2.3 even this is done by me.

so here i show some links and paths so work as i told to you, hope you find it easy, me  take it 10 days to Do this.

  • Name of Chat module that i found is Cometchat here is its website.(http://www.cometchat.com)
  •  Purchase the Cometchat  for jomsocial from here(or download it from other source if you can)
  • After downloading : Unzip it.
  • Go to the folder where you put your put your Jomsocial folder and Save here the cometchat folder.
    • This one path example: /www/joomla1_7/cometchat
    • or just same where your , Component folder exists.
  • After that on your url :
    • type the complete url :
      • like: www/joomla/cometchat/install.php
      • Install.php is the key file to install this.
      • as you do this some instruction you have to follow like:
        • Full 777 permission to the folders.
        • Copy some code and paste into the HEAD section of your Template page(main template like bee20, default etc)
        • also  Define('') code be updated in config.php  file
      • After completing that , delete the install.php file.
  • Then go to the jomsocial -> login it and enjoy the chat, with your friends.

Also you find this link may be helpful : Guide me!
to downloads the cometchat :use this link but i am not sure that this links works or not

Hope you understand this: if not the Post your Comment sure i will helps you....




Thursday, September 15, 2011

facebook connect in with jomsocial

how to add Facebook sign in Button on my site
or
how to add Facebook sign in Button on your site

here are some step that can easily helps you how to use:
Facebook Connect In on your website.

  • Step 1: go to www.facebook.com and login to it
  • step 2: type www.developer.facebook.com/apps
  • step 3: see the link create application. new apps
  • step4: the type the name of your site, as well as convas url i.e your default index or home page of the site.
  • step5: the you got the  API key as well as secret key.
  • Step6 : then go to your jomsocial->congifration->input the API and secret key ->save it.
  • step 8: congrats you able to do this. At last refresh your site page, you see a facebook sign in button there

Wednesday, September 7, 2011

how to add new software application in openWith option : ubantu

To add new software application in openWith option : ubantu(10.10)

You are using Ubuntu 10.10   - the Maverick Meerkat - released in October 2010 and supported until April 2012.
   
It is very simple:

Steps are:--
  • Right click on any item you want to choose from your system
  • select the option '' custom command to open ''
  • click on browse option-> then choose->file system.
  • file_system->usr i.e. then select usr folder.
  • usr->bin i.e. select the bin folder.
  • then search the software you want to choose.
  • select it and press ok.
  • your application open in that application you want
  • congrts.
Hope you find it easy ....

Tuesday, August 30, 2011

how to change default home page in joomla1.7

In joomla 1.7 if you want to change the Home page

follow these steps in easy ways:


    • LOGIN to site
    • Go to Menu Option
    • Then select the page  you want to New HOME page
    • choose default option. or click on star ( * ).
     
  • Hope you Got it...

Friday, August 26, 2011

Easy way to create Facebook site in Joomla1.7


This is the short and easy method that i share with you how to make a site like Facebook in Joomla1.7.


  • For this:
  • Please check the joomla version and jomsocial version for compatibility before do anything 
    • you have to download free version of JomSocial Component from Internet.
    • then install the Com_community zip folder from the downloaded files in joomla
    • then follow some instruction and click on next.



Wait this i am testing on this tutorial and provide you everyhting about that.


"Under Process....."





Thursday, August 25, 2011

uninstall component from joomla 1. 7?

this is vary easy to uninstall component from joomla 1.7.


Follw these steps:

  1. Login the site
  2. go to extension menu.
  3. then Click on Manage
  4. from right corner drop-downlist select " name of compoment "
  5. check it and click option un-install
  6. So simple :)

This is an example for Remove Jomsocial from jooma1.7

Thursday, August 11, 2011

cake php

  • Before read this i think you have some programming knowledge and client server architecture. 
  • What is Cake PHP:
    • a quick list of features you’ll enjoy when using CakePHP:
    • Active, friendly community
    • Flexible licensing
    • Compatible with versions 4 and 5 of PHP
    • Integrated CRUD for database interaction
    • Application scaffolding
    • Code generation
    • MVC architecture
    • Request dispatcher with clean, custom URLs and routes
    • Built-in validation
    • Fast and flexible templating (PHP syntax, with helpers)
    • View Helpers for AJAX, JavaScript, HTML Forms and more
    • Email, Cookie, Security, Session, and Request Handling Components
    • Flexible ACL
    • Data Sanitization
    • Flexible Caching
    • Localization
    • Works from any web site directory, with little to no Apache configuration involved
  • Requriment for cake php:
    • Requirements

      • HTTP Server. For example: Apache. mod_rewrite is preferred, but by no means required.
      • PHP 4.3.2 or greater. Yes, CakePHP works great on PHP 4 and 5.



      CakePHP supports a variety of database storage engines:
      • MySQL (4 or greater)
      • PostgreSQL
      • Microsoft SQL Server
      • Oracle
      • SQLite

  • It is a MVC based php framework for rapid application development.
  • Used to build a rapidly develop robust web applications, without any loss to flexibility.
Now what is MVC in very easy and static way i explain in 6 step:


  • See the picture above it helps you a lot:
    • step 1 : User send a request for page.
    • step 2 : Request goes to server's controller.
    • step 3 : Controller find the specific page in model(also called a database table , rss feed or any other file) .
    • step 4 : If found come back to controller and after that controller.
    • step 5 : Then controller goes to the view, it is the view who represent the data in the form of html or pdf or other way.
    • step 6 : At last it is the view that transfer to the client back.
  • This is all over MVC hope you got it... 
  • here the file structure of cake php  :
    • the Root folder contain:
      • /app
      • /cake
      • /plugins
      • /vendors
      • .htaccess
      • index.php
      • README
  • The app folder will be where you work your Programming Code files: it’s where your application’s files will be placed.
  • The cake folder contained very useful predefined data files. make sure that you never  edit files in this folder. This is the core of Cake .
  • Finally, the vendors folder is where you’ll place third-party PHP libraries you need to use with your CakePHP applications.

The App Folder

CakePHP’s app folder is where you will do most of your application development. Let’s look a little closer at the folders inside of app.

config : Holds the (few) configuration files CakePHP uses. Database connection details, bootstrapping, core configuration files and more should be stored here.
controllers :Contains your application’s controllers and their components.
libs: Contains 1st party libraries that do not come from 3rd parties or
external vendors. This allows you to separate your organization's internal libraries from vendor libraries.
locale: Stores string files for internationalization.
models: Contains your application’s models, behaviors, and datasources.
plugins: Contains plugin package.
tmp: This is where CakePHP stores temporary data. The actual data it stores depends on how you have CakePHP configured, but this folder is usually used to store model descriptions, logs, and sometimes session information.

Make sure that this folder exists and that it is writable, otherwise the performance of your application will be severely impacted. In debug mode, CakePHP will warn you if it is not the case.
vendors: Any third-party classes or libraries should be placed here. Doing so makes them easy to access using the App::import('vendor', 'name') function. Keen observers will note that this seems redundant, as there is also a vendors folder at the top level of our directory structure. We'll get into the differences between the two when we discuss managing multiple applications and more complex system setups.
views: Presentational files are placed here: elements, error pages, helpers, layouts, and view files.
webroot: In a production setup, this folder should serve as the document root for your application. Folders here also serve as holding places for CSS stylesheets, images, and JavaScript files.


Another important point is CakePhp Convension:

CakePHP Conventions:

  • It will take a time to learn CakePHP’s conventions.
  • But this will helps you save time in the long run.
  • By the following convention you able to do:
    • the maintenance nightmare of tracking config files.
    • Convention also makes for a very uniform system development.
    • Allowing other developers to jump in and help more easily.

File and Classname Conventions:

 

In general, filenames are underscored while classnames are CamelCased. So if you have a class MyNiftyClass, then in Cake, the file should be named my_nifty_class.php. Below are examples of how to name the file for each of the different types of classes you would typically use in a CakePHP application:
  • The Controller class KissesAndLovesController would be found in a file named kisses_and_loves_controller.php (notice _controller in the filename)
  • The Component class MyFutureComponent would be found in a file named my_future.php
  • The Model class OptionValue would be found in a file named option_value.php
  • The Behavior class MyNewBehavior would be found in a file named my_new.php
  • The View class SuperSimpleView would be found in a file named super_simple.php
  • The Helper class BestEverHelper would be found in a file named best_ever.php

Each file would be located in or under (can be in a subfolder) the appropriate folder in your app folder.
--------------------------------------------------------------------------------

Model and Database Conventions:

  1. Model classnames are singular and CamelCased. Person, BigPerson, and ReallyBigPerson are all examples of conventional model names.

  • Table names corresponding to CakePHP models are plural and underscored.
  • The underlying tables for the above mentioned models would be people, big_people, and really_big_people, respectively.
  • Field names with two or more words are underscored like, first_name.

 

Controller Conventions:

Controller classnames are plural, CamelCased, and end in Controller. PeopleController and LatestArticlesController are both examples of conventional controller names.

C.T.M: 

  • The first method you write for a controller might be the index() method.
    When a request specifies a controller but not an action, the default CakePHP behavior is to execute the index() method of that controller. 
    For example, a request for http://www.example.com/apples/ maps to a call on the index() method of the ApplesController, whereas http://www.example.com/apples/view/ maps to a call on the view() method of the ApplesController.

 

URL Considerations for Controller Names:

As you've just seen, single word controllers map easily to a simple lower case URL path. For example, ApplesController (which would be defined in the file name 'apples_controller.php') is accessed from http://example.com/apples.
i keep updating this :   stay tuned.... thanks ..


View Conventions:

  • View template files are named after the controller functions they display, in an underscored form. 
  • The getReady() function of the PeopleController class will look for a view template in /app/views/people/get_ready.ctp. 
  • The basic pattern is /app/views/controller/underscored_function_name.ctp.
Here’s a final example that ties the conventions
  • Database table: "people"
  • Model class: "Person", found at /app/models/person.php
  • Controller class: "PeopleController", found at /app/controllers/people_controller.php
  • View tem
  • plate, found at /app/views/people/index.ctp
-------------------------------------------------------------------
Let us start some delelopment:
The next big thing you have to done is:

Creating the Blog Database:

if you haven't already done this, create an empty database for use in this tutorial, with a name asn you wish.

  • create table name posts

    1. /* First, create our posts table: */
    2. CREATE TABLE posts (
    3. id INT AUTO_INCREMENT PRIMARY KEY,
    4. title VARCHAR(50),
    5. body TEXT,
    6. created DATETIME DEFAULT NULL,
    7. modified DATETIME DEFAULT NULL
    8. );
    9. /* Then insert some posts data  for testing: */
      • INSERT INTO posts (title,body,created)
      • VALUES ('The title', 'This is the post body.', NOW());
      •  
      • INSERT INTO posts (title,body,created)
      • VALUES ('A title once again', 'And the post body follows.', NOW());
      •  
      • INSERT INTO posts (title,body,created)
      • VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());
 After that:


Controller in brief:-

  • if you were building a site for an online examsystem, you might have a OnlineexamController .
  • In CakePHP, controllers are named after the model they handle, in plural form. 
  • So the The OnlineExam model is handled by the OnlineexamController and so on. 
  • Imp Point remember:
    • Your application's controllers are classes that extend the CakePHP AppController class, which in turn extends a core Controller class, which are part of the CakePHP library. 
    • The AppController class can be defined in /app/app_controller.php and it should contain methods that are shared between all of your application’s controllers.
  • Controllers can include any number of methods called as actions. 
  • Actions are controller methods used to display views. An action is a single method of a controller.
   
<?    class OnlinexamController extends AppController {
        function view($id)     {
            //action logic goes here..
        }

        function share($student_id, $stuname_id) {
            //action logic goes here..
        }

        function search($query) {
            //action logic goes here..
        }
    }

    ?>

-------------------------------------------------------------------



Source CakePhp.org

Wednesday, August 10, 2011

Format a number in php

 for this we have a function called : number_fomat();

Syntax is:

< ?php

$myno=123456;

$myno_after_format=number_format($myno);

echo $myno_after_format;

output is:123,456


also another way:


$myno=1234.56;

# this will show only one decimal digit.
$myno_after_format=number_format($myno,1);


echo $myno_after_format;

output is:
1234.5


? >



Friday, August 5, 2011

what is Cloud Computing simple and easy defination


Cloud Computing

First of all know what is cloud computing: ,
A very clean and simple language/words Defination of Cloud Computing is::
  • In old system, we purchase the computer software and other software. Each time we need a CD or DVD so that again install or reinstall that kind of software.
  • This is the problem for every household as well as IT Companies.
  • So to resolve this Big IT Gaint like Google, Yahoo, IBM start the Cloud way.
  • Now you able to understand the definition:
    • Cloud computing is the way to store your software or data in Internet (server) and you simply use this either free or sometime paid.
  • Hope you understand!!  :) 



    what is exactly success in every Field?

    Today i share some experience word with all of you, regarding the Word SUCCESS.if you really want to got success in your field then simple follow some tips that i share.

    1. Success is not for those who are lazy, it's true.
    2. So if you are lazy, then be become punctual and obey the rule.
    3. Count your seconds, it automatically fruitful for you..
      • Above line means never waste time.
    4. Don't fear About Interview, it is the time when you learn most of the things you don't know.SO enjoy it with relief and comfort.
    5. Face the challenge and fix the target.
    6. Till you not set any target you never succeed.
    7. So Set the Target work upon it and see the result.
      1. if something Wrong then  Improve that..




      How to change the width of dropdown list in HTML,PHP,JAVA,DOT NET

      Let us assume the drop down list is this one:--



      <select name="drop-list" style="width: 200px;">
      <option> First value <option>
      <option> second value <option>
      <option> third value <option>
      <option> fourth value <option>
      <option> fifth value <option>
      <select>
       output is :




      It is very simple just do this way:

      ------------------------------------------------------------------------------------

      Now see the large width Drop down List


      Type the following code:

      <select name="drop-list" style="width: 400px;">
      <option> First value <option>
      <option> second value <option>
      <option> third value <option>
      <option> fourth value <option>
      <option> fifth value <option>
      <select>


      see the output:

      Tuesday, August 2, 2011

      Php Array types

      Array is a datatype in php...

      It is mostly used to store multiple item under a single variable name.

      Types of array in PHP:

      1.Numeric or Index array.
      2.Associative array.
      3.Multi-dimensional array.



      1. Numeric array:

      syntax to create this:

      php code begin here


      /*
        #Write a program to Numeric array in PHP
       #comment: make a array variable name $var
       #Author : amit sharma
       */


      $var = array (value1,value2,value3...);

      #in detail

      $var = array(10,20,30,40,50,60);

      now in above line we create a array name $var in php that store 6 values 10,20,30,40,50 and 60 .

      php code end here


      Wednesday, July 27, 2011

      JOB IN NIT HAMIRPUR



      JOB in Faculty NIT Hamirpur center, Himachal Pradesh

      LAST DATE is 26th and 27 july 2011


      more info click here:  NIT hamirpur

      please hurry to enroll your interview time 2:30 sharp

      Monday, July 25, 2011

      PHP difference between single and double quotes

      1. Single quote treat all variable as string. while double quotes treat variable and string diferent.
      2. 'Single quote ' are effective with . (concatenation operator), while less need of . operator by using "double quote"

      example:

      Double Quote


      $my_var_name=120;


      echo "the value is $_my_var_name";


      output is:


      the value is 120


      ----------------------------------------------------------



      Single Quote

      $my_var_name=120;

      echo "the value is $_my_var_name";

      output is:

      the value is $_my_var_name 



      So i think ,the difference clear to you.


      Thursday, July 14, 2011

      Business communication

      Mode of communication in Business:

      1. Written Communication
      2. Oral Communication
      3. E-mail communication

      Written communication:
        • Neat and clean
        • Clear idea
        • No large sentance
        • Proper grammar
        • use of picture if possible
      • It must be 
      1. complete
        •  Means full and clear information about content
      2. concise
        • Means straight-foreword 
        • To the point
        • Relevant
        •  Simple Language
      3. clear
        •  
      4. concrete
        •  
      5. correct
        •  
      6. considerate
        •  
      7. courteous. 


      Best Public busines communication notes are:

      Best Business Communication notes

        Thursday, June 23, 2011

        How to Install RAR software for Ubantu

        it is very simple and easy:

        follw these steps:


        open the command prompt; Go to applicaton->Accessories->Terminal


        step 1: copy and paste this command    "   sudo apt-get install unrar-free  
        then if ask for super user password then type your password.




        step 2: copy and paste this command    "  sudo apt-get install unrar  


        Enjoy...

        Friday, June 10, 2011

        cost gurd Job

        INDIAN COAST GUARD
        (MINISTRY OF DEFENCE)
        EXCELLENT OPPORTUNITY FOR MEN AND WOMEN TO BECOME OFFICERS
        IN INDIAN COAST GUARD - 01/2012 BATCH
        (TRAINING COMMENCING – JAN 2012)


        1.
        The Indian Coast Guard, an Armed Force of the Union, offers a challenging
        and inspiring career as a Group ‘A’ Gazetted Officer in the pay scale for
        Assistant Commandant at Rs.15600-39100 with Grade Pay Rs 5400.


        2.click here for more info:   


        http://www.indiancoastguard.nic.in/indiancoastguard/jobs/jobs.html










        ========================================

        Sunday, June 5, 2011

        CGPA TO Percentage convert here

        Grade Point  Equivalent
        Percentage
        6.25  55%
        6.75  60%
        7.25  65%
        7.75  70%
        8.25  75%

        Saturday, May 21, 2011

        PHP 5 with new exiting features


        New OOPs Concept with PHP5.

        Here i am begin small tutorial for beginner as well as Professional..


        Class:- It is an real world entity, like Person, Car, Employee etc
        it contain properties also call variable and functions or Methods.

        Object:- it is the instance of class. it like a variable , that is capable of using all class member variable as well as class member function.

        Constructor: it is the important part of Class,behave like a function. It is  a class function that execute automatically when we declare the object of that class.
        their is no need to execute constructor by calling method. example 

        class className
        {
        //in php5 
        function __construct()
        {// this is the constructor , here we mention such type of statements that execute automatically when the object is created.
        }

        }// end of class 

        ACCESS MODIFIERS :
        the access modifiers are those who will specify the Scope of variable as well as functions...
        here the name of some are as:
        • Private
        • Public
        • Protected
        • Final
        • Abstruct


        Tuesday, May 10, 2011

        PHP 5 with new exiting features

        Technology news

         Google and Yahoo start collaboration with Indian Govt.

        Google and Yahoo start collaboration with Indian Govt. to set up approximate 20 new IIIT  in different parts of the country. This Venture is named as PPP public private partnership.



        It's celebration time at Mahindra Satyam...

         

        Tuesday, March 1, 2011

        SQL SERVER 2005 Notes

        SQL- Structured Query Language is an DataBase Management language(DBML).and sql server is an DBMS.

        Mysql,oracle etc are name of different kind of DBMS..

        database is a collection of tables;
        and table is a collection of fields or columns.
        further record is a collection of related columns value.


        Database:

        How to create data base:
        Sql is case in-sensitive. so be happy buddy and enjoy your typing. keep in mind spelling is correct.:)...

        Syntax is:

        Create Database databaseName

        then execute this: by press F5 or {!excute} button on tool bar.


        Create database Mydatabase

        after creating you have to Use this database.

        Syntax for this is:

        Use Database databasename

        use database mydatabase
        then (F5)

        Monday, February 7, 2011

        Commanly asked questions ans their answers.

        1. Introduction

        First important  question in interviews is about your introduction.
        You must have a short statement pre-pared in your mind.Also keep in Mind it does seems to be  look like rehearsed. always use less words to explain.Never use large sentence for any answer.


        2. Why did you leave your previous job?


        Stay positive when such kind of questioning is being done .Also Never mention your problem with the  organization and never use hatred words for seniors, co-employers or the organization. If you do like that ,you never be ale to get the right kind of job. make smiley face, with pleasant answers. 

        3. Experience
        Another important question is experience in certain field you want to join.
        if you have good experience than tell them, otherwise simply say i am less experience in this field.
         
        4. Wording of colleagues about you:
        another crucial question is your colleague expression about you. say some nice wording that you often listen about your self from the mouth of your friends.

        6. knowledge about Employer organization?
        Before going to interview you must have to investigate about the company of organization you want to visit for interview.
        •    Name of  MD
        •    Any achievement of company or organization.


        A lot more please stay visit here for more updation....

        Saturday, January 29, 2011

        Bank Demands More people as Most of staff going to retire....

        So there is a chance to all of you get involved in it and Enjoy it.