Thursday, June 23, 2016

Codeigniter tutorial 3

   No comments     
categories: 
I introduced CodeIgniter routing and parameter passing on the controller in previous posts.

Now I show creating functions to load 'view' files where we have our UI.
Create a file in 'code\application\views'. Here the 'code' is the renamed folder of extracted CodeIgniter zipped file. 

first_view.php

<html>
<head>
<title>View</title>
</head>
<body>
<h1>This is a view file</h1>
<h2>The UI part</h2>
</body>
</html>

in the code\application\controllers edit the hello.php.

<?php
class Hello extends CI_Controller{
public function index(){
$this->first();
}
public function first(){
$this->load->view('first_view');
}

}
?>

This function will load the view file.

Then the URL to get the view file from the controller method is;
localhost/code/index.php/hello



Here, since I used special function my URL does not contain any controller function name.

Now I create another file in view say `header_view.php`

<html>
<head>
<title>View</title>
</head>
<body>
<h2>Header</h2>
 <hr/>
</body>
</html>


And I load both the functions by the following file `hello.php`

<?php
class Hello extends CI_Controller{
public function index(){
$this->first();
}
public function first(){
$this->load->view('header_view');
$this->load->view('first_view');
}
}
?>


Here both the view files loaded as one output.

Codeigniter tutorial 2

   No comments     
categories: 
CodeIgniter special method

For routing first, the browser looks the controller name then the method name and parameters if available.

In Codeigniter tutorial, we created a function and a function with the parameters.
What if we missed any parameter value in our URL

We get warning and notice about missing argument.

But we can give default values for the parameters;
for example,

hello.php

<?php
class Hello extends CI_Controller{
public function first($p1,$p2="Nimishan"){
echo "This is the first method<br>";
echo "My parameters are : $p1 and $p2";
}
}
?>

here I gave a value 'Nimishan' for the second parameter. and I call the function in URL as below,
localhost/code/index.php/hello/first/blog

So, the output is,



here I call the function only with one parameter, the second parameter is the given value in the php code.

This parameter passing is not a functionality of codeIgnter, It is a functionality of PHP

Create a new function and call that function only.

<?php
class Hello extends CI_Controller{
public function first($p1="Hello", $p2="Nimishan"){
echo "This is the first method<br>";
echo "My parameters are : $p1 , $p2";
}
public function second(){
echo "This is the second method<br>";
}
}
?>

The output with the URL shown below:



What if we have two functions to be shown and we call those functions only with the controller name?
if we type this: localhost/code/index.php/hello
We get 404 error.

We can call the URL only with the controller name by creating a special function called  'index' .

<?php
class Hello extends CI_Controller{
public function index(){
echo "This is a special function";
}
public function first($p1="Hello", $p2="Nimishan"){
echo "This is the first method<br>";
echo "My parameters are : $p1 , $p2";
}
public function second(){
echo "This is the second method<br>";
}
}
?>

Thus the above URL gives no error but this,


therefore we can use this special function to get all the functions without any struggle to call them.

the code:

<?php
class Hello extends CI_Controller{
public function index(){
echo "This is a special function<br><br>";
$this->first();
$this->second();
}
public function first($p1="Hello", $p2="Nimishan"){
echo "This is the first method<br>";
echo "$p1 , $p2<br><br>";
}
public function second(){
echo "This is the second method<br>";
}
}
?>

Here I have used some break tags to show and separate the outputs of each function.



In the output, we have all three methods.

Here the browser found no methods in the URL it looks for the index method.



Codeigniter tutorial

   No comments     
categories: 

CodeIgniter  

                        Is light Weight
                        No installation required
                        Flexible

CodeIgniter has a very efficient URL structure, it generates a well optimised Search engine friendly URL.

URL Routing in CodeIgniter

General URL structure for CodeIgniter:
<baseURL>/index.php/<controller_name>/<controller_function>

Download CodeIgniter here.

I renamed the extracted CodeIgniter folder into 'code' for my convenience. My PHP development environment is XAMPP. So, 'code' folder location will be 
C:\xampp\htdocs

type 'localhost/code' on a browser, it shows the CodeIgniter welcome message. if not check your XAMPP Control Panel.

First, I create a controller function. 


hello.php

<?php
class Hello extends CI_Controller{
public function first(){
echo "This is the first method";
}
}
?>

Here the file name is 'hello.php', where the class name is capitalised file name, that is 'Hello' and the base class is CI_Controller.

for call the method in the browser, type localhost/code/index.php/hello/first

hello is the controller name and the first is the controller function name.
The output is:


Function with Parameters

We can input parameters inside the parenthesis. the same program,

<?php
class Hello extends CI_Controller{
public function first($p1,$p2){
echo "This is the first method <br>";
echo "My parameters are : $p1 and $p2";
}
}
?>

Here I have created two parameters as $p1 and $p2
So the URL for calling the function with parameters is 
localhost/code/index.php/hello/first/one/two

and the output was:



  thus, you can change the value for the parameter and get the output as your wish.

Thursday, May 19, 2016

Bash pocket reference.pdf

   No comments     
categories: 
bash_pocket_reference.pdf:

Topics include:
  • Invoking the shell
  • Syntax
  • Functions and variables
  • Arithmetic expressions
  • Command history
  • Programmable completion
  • Job control
  • Shell options
  • Command execution
  • Coprocesses
  • Restricted shells
  • Built-in commands

Download Bash Quick Reference pdf

   No comments     
categories: 

Wednesday, May 18, 2016

Basic MS-Dos commands

   No comments     
categories: ,
Here is a list of basic commands that you can use in a DOS prompt


  • cd <directory name>
    • cd is the basic DOS command, it allows you to change directory
  • dir [name of directory]
    • dir allows you to list all contents of the specified directory
  • md  <directory name>
    • md allows you to make a new directory, also can use mkdir command
  • rd   directory name>
    • rd is used for remove a directory
  • copy <source> <destination>
    • Allows you to copy a file from a <source> folder to a <destination folder>
  • del<file>
    • Deletes a specific file
  • move <source> <destination>
    • Allows you to move a file from a <source> folder to a <destination folder>
  • ren <source> <destination>
    • Renames the specified file
  • edit <filename>
    • Opens the default DOS editor to allow modification of a specified file
  • cls
    • Clears the DOS screen
  • exit
    • Leaves the DOS terminal

Saturday, May 14, 2016

Basics of Compiler Design pdf

   No comments     
categories: 
What is a compiler?

A compiler translates (or compiles) a programme written in a high-level programming language that is suitable for human programmers into the low-level machine
language that is required by computers. During this process, the compiler will also
attempt to spot and report obvious programmer mistakes.

A program for a computer must be built by combining these very simple commands
into a program in what is called machine language.

The phases of a compiler
Lexical Analysis
Syntax Analysis
Type checking
Intermediate code generation
Register allocation
Machine code generation
Assembly and linking

 download pdf




Artificial Intelligence A Modern Approach 3rd edition

   No comments     
categories: 
Stuart Russell and Peter Norvig 

 click here to download

Artificial Intelligence (AI) is a big field, and this is a big book. In this book the authors have tried to explore the full breadth of the field, which encompasses logic, probability, and continuous  mathematics; perception, reasoning, learning, and action; and everything from microelectronic devices to robotic planetary explorers. The book is also big because the authors went into some depth. The subtitle of this book is "A Modern Approach." The intended meaning of this rather empty phrase is that we have tried to synthesize what is now known into a common framework, rather than trying to explain each subfield of AI in its own historical context

GoF Design Patterns (gang of four)

   No comments     
categories: 

click here(image) to download the pdf


Chapter1 
Creational Patterns
 Factory, Abstract Factory, Builder, Prototype and Singleton 
Chapter 2 
Structural Patterns
 Adapter, Bridge, Composite, Decorator, Facade, Flyweight and Proxy 
Chapter 3
 Behavioral Patterns
 Chain-of-responsibility, Command, Iterator, Mediator, Memento, Observer, State and Strategy 

Friday, May 13, 2016

Software Engineering (9th Edition)

   No comments     
categories: 
software_engineering_9th_edition_by_ian_sommerville.pdf  


 Click to Download


The book is primarily aimed at university and college students taking introductory and advanced courses in software and systems engineering. Software engineers in the industry may find the book useful as general reading and as a means of updating their knowledge on topics such as software reuse, architectural design, dependability and security, and process improvement.

Thursday, July 9, 2015

Introduction-to-parallel-computing-second-edition book

   No comments     
categories: 

Sunday, May 31, 2015

Download Bishop Pattern Recognition and Machine Learning pdf

   No comments     
categories: 
 click the link below.

Download

Download Introduction to Algorithms 3rd Edition pdf

   No comments     
categories: 

Sunday, April 5, 2015

Video Compression as Fast As Possible

   No comments     
categories: 


We need to compress video 

Video compression technologies are about reducing and removing redundant video data so that a digital video file can be effectively sent over a network and stored on computer disks.
Uncompressed video (and audio) data are huge.
The high bit rates that result from the various types of digital video make their transmission through their intended channels very difficult.

Lossy methods have employed since the compression ratio of lossless methods (e.g., Huffman, Arithmetic, LZW) is not high enough for image and video compression, especially when the distribution of pixel values is relatively flat.

The following compression types are commonly used in Video compression:
  • Spatial Redundancy Removal - Intraframe coding (JPEG)
  • Spatial and Temporal Redundancy Removal - Intraframe and Interframe coding (H.261, MPEG)

Monday, March 9, 2015

Download Composite Design-Pattern.ppt

   No comments     

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()

TCPServer.py

   No comments     
categories: 
# Python TCP Socket Server Application
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print 'The server is ready to receive'
while 1:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024)
capitalizedSentence = sentence.upper()
connectionSocket.send(capitalizedSentence)
connectionSocket.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

Sunday, November 23, 2014

Install moodle on windows (moodle நிறுவல் - தமிழில்)

   No comments     
categories: 
Install moodle on windows (moodle நிறுவல் - தமிழில்)

moodle ஆனது இலவச பாட மேலாண்மை அமைப்பாகும் (OPEN SOURCE COURSE MANAGEMENT SYSTEM). PHP படிவ நிரலாக்க மொழி மூலம் உருவாக்கபட்ட ஒரு தகவல் தளத்தோடு செயற்படும்.
moodle இனை இலவசமாக https://docs.moodle.org/download என்ற இணைய இணைப்பில் தரவிறக்கம் செய்து கொள்ளலாம்.

moodle இனை நமது  கணினியில் நிறுவுவதற்கு சில அடிப்படை தேவைகளை கணினி கொண்டிருக்க வேண்டும்.

Disk space :
                   160MB(min), அத்தோடு தரவுகளை களஞ்சியப்படுத்த தேவையான அளவு Space அவசியம் (5MB).
Memory :
                250 MB(min).
Software :
                ஒரு இயக்கதளம் (an Operating System).
                 platform
                 Web server.
Database(MySQL,Oracle, MongoDB, etc)
browser

install Moodle.

முதலில் நமக்கு தேவையான moodle பதிப்பினை தரவிறக்கம் செய்து கொள்ள வேண்டும்.
zip folder இனை Extract செய்து அவ் folder இனை C:\xampp\htdocs இல் இடம் மாற்றிக்கொள்ளவேண்டும்.

moodle இனை எமது web-server இல் நிறுவுவதற்கு XAMPP server இல்ஒரு வெற்று தகவல்தளத்தை (database) உருவாக்க வேண்டும்.
database : moodle.
browser இல் localhost/moodle என்று type செய்ய serverஇல் install ஆகும்.
moodle இற்கு fileகளை களஞ்சியப்படுத்த ஒரு கோப்பு (directory) அவசியம். ஆகவே moodle, XAMPP folderஇல் moodledata என்ற folderஐ உருவாக்கிக்கொள்ளும்.
பின் browser இல் அறிவுறுத்தல்களுக்கும், உங்கள் தெரிவுகளுக்கும் அமைய moodleஇனை நிறுவிக்கொள்ளலாம்.

Friday, November 21, 2014

Install Zend framework – Easy Steps.

   No comments     
categories: 


Install Zend framework – Easy Steps.






Download the Zend Framework zip folder, for example Zend framework 1.11.10 minimal.zip.


Extract the zip file, and then copy the ‘bin file’ and ‘library file’ from it.
Make a folder in C:\XAMPP\PHP and paste those in that folder.
Go to ‘System’ in Control Panel and click ‘Advance system settings’. Open the Environmental variable window.


Copy the ‘bin’ path and paste it in the path followed by a colon (‘;’).


In XAMPP\PHP open php.ini (a configuration file) using a editor such as notepad, notepad++.
Find the “include path” line (line 830) in that configuration file and copy the library path following by a colon.

Open cmd and just type ‘zf’ then enter.
It will show the Zend commands if not, there is a problem in php
.
Then, copy the PHP path and past it in the environmental variables as we did for bin path.
Done.