Showing posts with label CODES. Show all posts
Showing posts with label CODES. Show all posts

Friday, March 6, 2015

TCPClient.py

   No comments     
categories: 
# Python TCP Socket Client Application
from socket import *
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
sentence = raw_input('Input lowercase sentence:')
clientSocket.send(sentence)
modifiedSentence = clientSocket.recv(1024)
print 'From Server:', modifiedSentence
clientSocket.close()

UDPClient.py and UDPServer.py

   No comments     
categories: 
UDPClient.py
UDPServer.py

if you copy the code from the book and run then you'll end up with errors
because the text formatting is there in the code

 UDPClient.py code is available here

UDPServer.py code is available here

Tuesday, August 26, 2014

"HelloWorld" program in PHP CodeIgniter using Netbeans.

   No comments     
categories: 

"HelloWorld" program in PHP CodeIgniter using Netbeans.

Step 1:- download the CodeIgniter framework form the following link “http://ellislab.com/codeigniter/download”.
 

and extract it into “C:/xampp/htdocs/” rename the folder as "codeignter". open a browser and type "http://localhost/codeigniter", you will get following.
s
Step 2:- open netbeans , select 'new project' . in the new project window select 'PHP' and 'PHP Application with Existing Sources'.
then click next
new
type your 'Source folder' and 'project name' in the shown space.
 2
Step 3:-
Create a file at application/controllers/pages.php with the following code.
<?php
class Pages extends CI_Controller {
    public function view($page = 'home')
    {     
    if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
    {
        // Whoops, we don't have a page for that!
        show_404();
    }
    $data['title'] = ucfirst($page); // Capitalize the first letter

    $this->load->view('templates/header', $data);
    $this->load->view('pages/'.$page, $data);
    $this->load->view('templates/footer', $data);
}  
}
?>
Step 4:-
Create a folder at application/views/templates
Create the header at application/views/templates/header.php and add the following code.
<html>
<head>
    <title><?php echo $title ?> - CodeIgnite</title>
</head>
<body>
    <h1>CodeIgniter 2 Tutorial</h1>
Create the footer at application/views/templates/footer.php and add the following code.
<strong>&copy; 2011</strong>
<script type="text/javascript">if(!NREUMQ.f){NREUMQ.f=function(){NREUMQ.push(["load",new Date().getTime()]);var e=document.createElement("script");e.type="text/javascript";e.src=(("http:"===document.location.protocol)?"http:":"https:")+"//"+"js-agent.newrelic.com/nr-100.js";document.body.appendChild(e);if(NREUMQ.a)NREUMQ.a();};NREUMQ.a=window.onload;window.onload=NREUMQ.f;};NREUMQ.push(["nrfj","beacon-5.newrelic.com","eb488e72a1","3758250","NgEEZBYHDUFWVk0KWg9LJUUXEgxfGFZWB1AIAwhZEAMRHR0=",0,117,new Date().getTime(),"","742446fde086bef8","","",""]);</script></body>
</html>
Step 5:-
In that directory, create two files named home.php and about.php. Within those files, type some text and save them. try "Hello World!".
Open the routing file located at application/config/routes.php and add the following two lines
3
Open the config file located at application/config/config.php and change the following line as shown below
h
Step 6 :- run the project by pressing F6 on your keyboard or as the following button.
ff
get your "hello World"
tt

Monday, August 25, 2014

"HelloWorld" program in PHP CodeIgniter

   No comments     
categories: 
Its really simple and i'll show you the steps.

Step 1:- download the CodeIgniter framework form the following link “http://ellislab.com/codeigniter/download”.



and extract it into “C:/xampp/htdocs/” rename the folder as "codeignter". open a browser and type "http://localhost/codeigniter", you will get following.


















Step 2:- open a notepad or any other editor and write the following program .

 <?php
class HelloWorld extends CI_Controller
{
    function index()
    {
        echo "Hello World";
    }
}
?>

 After writing the above program save it to “C: /xammp/htdocs/codeigniter/application/controllers” as “HelloWorld.php”. And now type “http://localhost/codeigniter/index.php/HelloWorld” you will get output as “Hello World” like following.