Thursday, 9 January 2014

Step by Step WordPress Configuration

Installing wordpress on WAMP in windows 7 – Manual Detail.

A couple of items need to be done in order to install.
1. Download wordpress and know where your unzipped "wordpress" folder is located.
2. Know where your WAMP document root is - I would expect it to be c:\wamp\htdocs for a default install
3. copy the wordpress folder to your document root folder and leave untouched (this will be you base to install multiple test wordpress sites).
3. while in Windows Explorer at c:\wamp\htdocs your should now see a wordpress folder.

4. make of copy of the wordpress folder which should create a folder named wordpress Copy.
5. Rename your wordpress folder to you new site test name (something for you to make up) for example testsite1
6. you should now have a folder c:\wamp\testsite1
7. Verify your WAMP Apache and MySql servers are active
8. Go to localhost/phpmyadmin in your browser (or how ever you get to phpMyAdmin in WAMP
9. in phpMyAdmin Create a new database - your name choice - something like testdb1 (remember this, it is needed for the install)
10. while still in phpMyAdmin go to databases and click your database
11. while still in your new database click the Privileges tab
12 Click add new user - again give any name and password you'd like just remember them (also make sure server is "localhost") - for our example you should have something like user = testuser1 and password testpass1.
13. ******* now you are ready to Install WordPress *******
14. In you browser address window type localhost/testsite1/wp-admin hit enter and you should begin the wordpress install dialogue (which should begin with an offer to create your config file - let it and then it will ask for the database info from above.
15. Error will occur to complete. Open wp-config-sample.php file in wordpress folder.
Edit the database user name,password,hostname etc. details. Save the file as  wp-config.php

It will complete the process after successful installations.
Localhost/sitename/wp-admin/  enter  not clear this one.
Ask your user name,password as your mentioned in site name details. Not DB user name and password all other thinks. Username = kpdon, password = apso123…!
Logout and alogin again to open
Locahost/sitename/wp-admin/  enter.

Wednesday, 8 January 2014

YII framework Install

Step 1: Assigning PHP engine location path in system variable
  • Go to “My Computer” ->Right click and select "Properties"
  • Click "Advanced system settings" from left pane
  • Under "Advanced" tab click on "Environment Variables"
  • Under "System variables" scroll down and find text "Path" then Double click on it
  • Now enter your PHP engine location on end of the "variable value" field
    i.e. for me I entered "C:\wamp\bin\php\php5.3.10". Just enter location without double quotes
  • Click ok and finally exit from this.
Step 2: Create project folder under "www"
Just create a blank folder in "www" that should be your project name. i.e "bid" You can also make this using command window. For this-
  • Open command window
  • C:>cd wamp\www\
  • C:\wamp\www>mkdir bid
Step 3: Download Yii framework and put into www directory and install the framework for bid project
  • Go "http://www.yiiframework.com/" and download latest Yii framework zipped file
  • Unzip and rename folder to "yii"
  • Using command-
    • C:\wamp\www>cd yii\framework\
    • C:\wamp\www\yii\framework>yiic webapp C:\wamp\www\bid
      Create a Web application under ‘C:\wamp\www\bid’? [Yes|No] y
      Your application has been created successfully under C:\wamp\www\bid.
Now you are ready to browse your project by accessing the URL : http://localhost/bid/
If you want to use this installation for multiple project then just copy "bid" folder and past and rename with your project name. Its better if you make "bid" folder as your backup project folder then when you need to work with a new project then just you need to copy and past this folder and rename to your new project name.
If you want to install an updated version of Yii framework then please download updated version zipped folder from "http://www.yiiframework.com/" and unzip. After unzip the file just copy the framework folder and then go "yii" folder under "www" directory and just replace previous framework folder with latest one.

Google Tranallator in php

Google API Translator in PHP file: 

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="google-translate-customization" content="bac05922687cae8e-236a0f2245013f08-g7adb1266d3e9e6e3-1a"></meta>
        <title></title>
        <script type="text/javascript">
          // Javascript function which takes care for multiple uploads
          var attachmentlimit = 5; // Limiting maximum uploads to 5
          var attachmentid = 1;
          function attachmore() { // Function is called when user presses Attach Another File
            attachmentid += 1;
            document.getElementById('attachmentdiv').innerHTML += '<div id="attachmentdiv_' + attachmentid + '" style="margin-top:5px"><input type="file" id="attachment_' + attachmentid + '" name="attachment_' + attachmentid + '" size="30" onchange="document.uploadattachments.submit();"/></div>';
            if(attachmentid == attachmentlimit) {
              document.getElementById('addanother').style.display='none';
            }
          }
        </script>
        <script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    </head>
    <body>
        <form action="test1.html" />
        <div id="google_translate_element"></div>
        <form action="controller/Controller.php" method="POST">
            <table>
                <tr>
                    <td>
                        <label>Username:</label>
                    </td>
                    <td>
                        <input type="text" name="user"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>Password:</label>
                    </td>
                    <td>
                        <input type="password" name="pass"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="submit" />
                    </td>
                    <td>
                        <input type="reset" value="Cancel" />
                    </td>
                </tr>
            </table>
        </form>
        <form id="uploadattachments" enctype="multipart/form-data" name="uploadattachments" target="attachmentiframe" action="upload.php" method="post">
          <div id="attachmentdiv" style="margin-left:30px">
            <iframe name="attachmentiframe" style="display:none"></iframe>
            <div id="attachmentdiv_1" style="margin-top:5px">
                <input type="file" id="attachment_1" name="attachment_1" size="30" onchange="document.uploadattachments.submit();"/>
            </div>
          </div>
          <!-- div showing error message for invalid file type -->
          <div id="typeerrormessage" style="display:none;margin-left:30px">
            <font color=#990000 size=1>Only png, jpg and gif file type are supported</font>
          </div>
          <!-- div showing error message for exceeded file size -->
          <div id="sizeerrormessage" style="display:none;margin-left:30px">
            <font color=#990000 size=1>File exceeded maximum allowed limit of 100 Kb</font>
          </div>
          <div id="addanother" style="margin-left:30px;margin-top:5px">
            <a href="javascript:void(0)" onclick="attachmore();"><font size=2>Attach another file</font></a>
          </div>
    </form>
    </body>
<style>

#google_translate_element{

left: 900px;

position: relative !important;

top: 20px;

}

.goog-te-gadget img {
display: inline;
}</style>
</html>
Thanks to work from Mr.JDK

PhoneGap3.3 Setup and project creation

Phonegap3.3 project creation = Setup config

Before start creation, check out PATH varible VALUE = > java_home,ant_home,DIR:\android|sdk\tools,DIR:\android|sdk\platform-tools\ in your windos system variable. 

For JAVA_HOME - > Install jdk or copy installed jadk in 64 Bit Program files.

-> Environment Variable - > System Variable - >
JAVA_HOME == C:\Program Files (x86)\Java\jdk1.6.0_45

Add Path - > ;%JAVA_HOME%\bin;

Not in the User Variable.

Same thing for ANT_ HOME
ANT_HOME = C:\ant
Add path == ;%ANT_HOME%\bin;
1. Download and Install node.js
GOTO node.js Official Site and click windows installer exe file.

CHECK OUT npm >

Error stat : ENOET occurs

Download and install. Some time ENOET error is occur when 32 bit node js in 64 bit machine. So, Add manuallly to appdata/roaming\ to mkdir npm in cmd promt
2.CMD:> node --version or CMD:>nodejs --version
 
AND CMD:>npm <check out> 3.Install cordova 3.3(latest phonegap) CMD:>npm install -g cordova 4.Cordova is install by default folder location is C:\user\<name>\AppData\roaming\npm\

<checkout>
cmd:> c:\user\new\ dir <enter> cd AppData \cd Roaming\ cd npm
5.CMD:>cordova<Check outodrova installed> 6.Create project(genereic-all platform) customized location CMD:>cordova create <FolderName> <PackageName> <ProjectName> 7.CMD:>cd <projectfolderName> 8. Add platforms suport to work(Necessary) CMD:\ProjetFOLDER\>cordova platform add android In the project\platforms\android\android full poject created. It can be imported to eclipse. 9.Automatically note.js file installed location is stored in System Variable value[PATH].

10. Run any of these from a Mac:
    $ cordova platform add ios
    $ cordova platform add amazon-fireos
    $ cordova platform add android
    $ cordova platform add blackberry10
    $ cordova platform add firefoxos
Run any of these from a Windows machine, where wp refers to different versions of the Windows Phone operating system:
    $ cordova platform add wp7
    $ cordova platform add wp8
    $ cordova platform add windows8
    $ cordova platform add amazon-fireos
    $ cordova platform add android
    $ cordova platform add blackberry10
    $ cordova platform add firefoxos
Run this to check your current set of platforms:
    $ cordova platforms ls
(Note the platform and platforms commands are synonymous.)
Run either of the following synonymous commands to remove a platform:
    $ cordova platform remove blackberry10
    $ cordova platform rm amazon-fireos
    $ cordova platform rm android
Run the following command to iteratively build the project:
    $ cordova build
This generates platform-specific code within the project's platforms subdirectory. You can optionally limit the scope of each build to specific platforms:
    $ cordova build ios
The cordova build command is a shorthand for the following, which in this example is also targeted to a single platform:
    $ cordova prepare ios
    $ cordova compile ios
In this case, once you run prepare, you can use Apple's Xcode SDK as an alternative to modify and compile the platform-specific code that Cordova generates within platforms/ios. You can use the same approach with other platforms' SDKs.

Test the App on an Emulator or Device

SDKs for mobile platforms often come bundled with emulators that execute a device image, so that you can launch the app from the home screen and see how it interacts with many platform features. Run a command such as the following to rebuild the app and view it within a specific platform's emulator:
    $ cordova emulate android

To run this command successfully Android emulator could be run from Eclipse or (external Level)


Here are examples of how you might use the CLI to add features to the app:
  • Basic device information (Device API):
    $ cordova plugin add org.apache.cordova.device
  • Network Connection and Battery Events:
    $ cordova plugin add org.apache.cordova.network-information
    $ cordova plugin add org.apache.cordova.battery-status
  • UPDATE post below
  • To <check out> APIs installed in this project
  •  GOTO project fiolder->platforms -> android-> assets -> www -> plugins -> Here list folder avail those installed in APIs for this project.
  • Here are examples of how you might use the CLI to add features to the app:
    • Basic device information (Device API):
      $ cordova plugin add org.apache.cordova.device
    • Network Connection and Battery Events:
      $ cordova plugin add org.apache.cordova.network-information
      $ cordova plugin add org.apache.cordova.battery-status
    • $ cordova plugin add org.apache.cordova.device-motion
      $ cordova plugin add org.apache.cordova.device-orientation
      $ cordova plugin add org.apache.cordova.geolocation
    • Camera, Media playback and Capture:
      $ cordova plugin add org.apache.cordova.camera
      $ cordova plugin add org.apache.cordova.media-capture
      $ cordova plugin add org.apache.cordova.media
    • Access files on device or network (File API):
      $ cordova plugin add org.apache.cordova.file
      $ cordova plugin add org.apache.cordova.file-transfer
    • Notification via dialog box or vibration:
      $ cordova plugin add org.apache.cordova.dialogs
      $ cordova plugin add org.apache.cordova.vibration
    • $ cordova plugin add org.apache.cordova.contacts
    • $ cordova plugin add org.apache.cordova.globalization
    • $ cordova plugin add org.apache.cordova.splashscreen
    • Open new browser windows (InAppBrowser):
      $ cordova plugin add org.apache.cordova.inappbrowser
    • Debug console:
      $ cordova plugin add org.apache.cordova.console
    Use plugin ls (or plugin list, or plugin by itself) to view currently installed plugins. Each displays by its identifier:
        $ cordova plugin ls    # or 'plugin list'
        [ 'org.apache.cordova.console' ]
    
    To remove a plugin, refer to it by the same identifier that appears in the listing. For example, here is how you would remove support for a debug console from a release version:
        $ cordova plugin rm org.apache.cordova.console
        $ cordova plugin remove org.apache.cordova.console    # same
    
    You can batch-remove or add plugins by specifying more than one argument for each command:
        $ cordova plugin add org.apache.cordova.console org.apache.cordova.device

    Advanced Plugin Options

    When adding a plugin, several options allow you to specify from where to fetch the plugin. The examples above use a well-known registry.phonegap.com registry, and the plugin is specified by the id:
        $ cordova plugin add org.apache.cordova.console
    The id may also include the plugin's version number, appended after an @ character. The latest version is an alias for the most recent version. For example:
        $ cordova plugin add org.apache.cordova.console@latest
        $ cordova plugin add org.apache.cordova.console@0.2.1
    
    If the plugin is not registered at registry.phonegap.com but is located in another git repository, you can specify an alternate URL:
        $ cordova plugin add https://github.com/apache/cordova-plugin-console.git
    
    The git example above fetches the plugin from the end of the master branch, but an alternate git-ref such as a tag or branch can be appended after a # character:
        $ cordova plugin add https://github.com/apache/cordova-plugin-console.git#r0.2.0
    
    If the plugin (and its plugin.xml file) is in a subdirectory within the git repo, you can specify it with a : character. Note that the# character is still needed:
        $ cordova plugin add https://github.com/someone/aplugin.git#:/my/sub/dir
    
    You can also combine both the git-ref and the subdirectory:
        $ cordova plugin add https://github.com/someone/aplugin.git#r0.0.1:/my/sub/dir
    
    Alternately, specify a local path to the plugin directory that contains the plugin.xml file:
        $ cordova plugin add ../my_plugin_dir

    Using merges to Customize Each Platform

    While Cordova allows you to easily deploy an app for many different platforms, sometimes you need to add customizations. In that case, you don't want to modify the source files in various www directories within the top-level platforms directory, because they're regularly replaced with the top-level www directory's cross-platform source.
    Instead, the top-level merges directory offers a place to specify assets to deploy on specific platforms. Each platform-specific subdirectory within merges mirrors the directory structure of the www source tree, allowing you to override or add files as needed. For example, here is how you might uses merges to boost the default font size for Android and Amazon Fire OS devices:
    • Edit the www/index.html file, adding a link to an additional CSS file, overrides.css in this case:
      <link rel="stylesheet" type="text/css" href="css/overrides.css" />
      
    • Optionally create an empty www/css/overrides.css file, which would apply for all non-Android builds, preventing a missing-file error.
    • Create a css subdirectory within merges/android, then add a corresponding overrides.css file. Specify CSS that overrides the 12-point default font size specified within www/css/index.css, for example:
      body { font-size:14px; }
      
    When you rebuild the project, the Android version features the custom font size, while others remain unchanged.
    You can also use merges to add files not present in the original www directory. For example, an app can incorporate a back button graphic into the iOS interface, stored in merges/ios/img/back_button.png, while the Android version can instead capture backbutton events from the corresponding hardware button.

    Help Commands

    Cordova features a couple of global commands, which may help you if you get stuck or experience a problem. The helpcommand displays all available Cordova commands and their syntax:
    $ cordova help
    $ cordova        # same
    
    The info command produces a listing of potentially useful details, such as currently installed platforms and plugins, SDK versions for each platform, and versions of the CLI and node.js:
    $ cordova info
    It both presents the information to screen and captures the output in a local info.txt file.
    NOTE: Currently, only details on iOS and Android platforms are available.

    Updating Cordova and Your Project

    After installing the cordova utility, you can always update it to the latest version by running the following command:
        $ sudo npm update -g cordova
    Use this syntax to install a specific version:
        $ sudo npm install -g cordova@3.1.0
    
    Run cordova -v to see which version is currently running. Run the npm info command for a longer listing that includes the current version along with other available version numbers:
        $ npm info cordova
    Cordova 3.0 is the first version to support the command-line interface described in this section. If you are updating from a version prior to 3.0, you need to create a new project as described above, then copy the older application's assets into the top-level wwwdirectory. Where applicable, further details about upgrading to 3.0 are available in the Platform Guides. Once you upgrade to the cordova command-line interface and use npm update to stay current, the more time-consuming procedures described there are no longer relevant.
    Cordova 3.0+ may still require various changes to project-level directory structures and other dependencies. After you run the npm command above to update Cordova itself, you may need to ensure your project's resources conform to the latest version's requirements. Run a command such as the following for each platform you're building:
        $ cordova platform update android
        $ cordova platform update ios
        ...etc.

Tuesday, 7 January 2014

FPDF in PHP

FPDF is created from php file
Download fpdf latest version(v1.7 in zip file format)  http://www.fpdf.org/
Extract and paste it in your project folder and name it as "fpdf1.php"
Create the php file as mentioned beolw. Run this php file will get PHP file.
class creation PDF from fpdf is required. --- It's working.....

<?php
/*
codes to save the user input values to db(this works fine)
*/
require('fpdf/fpdf.php');
class PDF extends FPDF
{
//some functions
}
$pdf=new PDF();

$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World to kaspon pdf!');
$pdf->Output();

?>

Thanks for ref links:

FPDF:
===
http://stackoverflow.com/questions/15417506/trying-to-write-to-a-pdf-file-using-fpdf-and-fpdi
http://stackoverflow.com/questions/18732212/php-to-pdf-using-fpdf-failing-to-open-my-pdf-filebroken
http://nick.boldison.com/websites/php/fpdf-creating-pdf-files-using-php/
http://www.phpclasses.org/package/421-PHP-Free-PDF-generation-class-without-PDFlib.html

Monday, 6 January 2014

TAMIL in mysql == Storing and displaying unicode string (हिन्दी) using PHP and MySQL

FileName: tamil.php  Environment:WAMP

Thanks for REF:
http://stackoverflow.com/questions/1198701/storing-and-displaying-unicode-string-using-php-and-mysql

<!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">



<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">


<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');

mysql_select_db('php',$con);

$nith = "CREATE TABLE IF NOT EXISTS `TAMILS` (
  `data` varchar(1000) character set utf8 collate utf8_bin default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1";

if (!mysql_query($nith,$con))
{
  die('Error: ' . mysql_error());
}

$nithi = "INSERT INTO `TAMILS` VALUES ('இந்தியா நாட்டின் பக்கங்கள்5')";

if (!mysql_query($nithi,$con))
{
  die('Error: ' . mysql_error());
}

$result = mysql_query("SET NAMES utf8");//the main trick
$cmd = "select * from TAMILS";
$result = mysql_query($cmd);
while($myrow = mysql_fetch_row($result))
{
    echo ($myrow[0]);
echo '<br>';
}
?>
</body>
</html>

Thursday, 26 December 2013

Detect page Orientation change in phoneGap

Page orientation Change Phonegap:
---------------------------------------

work sometimes in cordova 2.7, Try with lower version will.

<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap</title>
     <script type="text/javascript" charset="utf-8" src="cordova-2.7.0.js"></script>
     <script type="text/javascript" charset="utf-8">
   
     function init() {
       window.addEventListener("orientationchange", orientationChange, true);
    }

    function orientationChange(e) {
       var orientation="portrait";
       if(window.orientation == -90 || window.orientation == 90) orientation = "landscape";
           document.getElementById("status").innerHTML+=orientation+"<br>";
    }
     </script>

</head>
<body onload="init();" >

    <h2>Orientation Test</h2>
    <div id="status"></div>

</body>
</html>

Friday, 20 December 2013

PhoneGap ONLINE / OFFLINE image-alert functionality: Events API

PhoneGap ONLINE / OFFLINE image-alert functionality: Events API
====================================================

<!DOCTYPE html>
<html>
  <head>
<meta charset="utf-8">
<title>H M S on line / off line</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>

<script  type="text/javascript" charset="utf-8" src="cordova-2.7.0.js"></script>

<script>
  $(document).ready(function () {
 // $("p").text("The DOM is now loaded and can be manipulated.");
 
  document.addEventListener("online", onOnline, false);
document.addEventListener("offline", onOffline, false);
});
  /*
     document.addEventListener("deviceready", onDeviceReady, false);

 function onDeviceReady() {

 alert("device ready");  // No Use device ready funtion call. $doc.ready funtion call used before onDeveiceReady() call
  } */

 // Handle the online event
 //
 function onOnline() {
alert("Online ");
$("#neterrmsg").hide();
$(".indicatorimage").attr('src','jquery-mobile/images/online.png'); // green color button

 }
 function onOffline() {
alert("offline");
$("#neterrmsg").show();
$(".indicatorimage").attr('src','jquery-mobile/images/offline.png'); //Red color button
 }
 </script>
</head>
<body >

<div data-role="page">
  <div data-role="header" align="center" data-theme="b">
    <h1 style="display:inline-block;margin:10px auto" align="center">on/off-line</h1>
        <img src="" style="width:30px;float:right;padding-top:5px" class="indicatorimage" class="ui-li-aside"></img>
    </div>
  <div data-role="content">
  <B>ON LINE / OFF LINE DATA</B>
 
  <div id="neterrmsg" class="ex_Alrt1">
            <p data-translate="lbl_netmsg"><b>The application is currently in offline mode. An active network connection is required to continue. Please try again later when an active network connection is available.</b></p>
            </div>
          </div>
  </body>
</html>

Redux vs Redux Toolkit vs React Context

  These are often confused. Feature Redux Redux Toolkit Context API Purpose State management Simplifies Redux Shares values in Rea...