Warning: SplFileInfo::openFile(/app/tmp/cache/persistent/myapp_cake_core_file_map) [function.SplFileInfo-openFile]: failed to open stream: Success in /lib/Cake/Cache/Engine/FileEngine.php on line 357

Recently, I am working with cakephp projects and its working fine in my local server, when i moved to the production server then its give the error which is as below.

Warning: SplFileInfo::openFile(/app/tmp/cache/persistent/myapp_cake_core_file_map) [function.SplFileInfo-openFile]: failed to open stream: Success in /lib/Cake/Cache/Engine/FileEngine.php on line 357

Warning: SplFileInfo::openFile(/app/tmp/cache/persistent/myapp_cake_core_file_map) [function.SplFileInfo-openFile]: failed to open stream: Success in /lib/Cake/Cache/Engine/FileEngine.php on line 357

Warning: SplFileInfo::openFile(/app/tmp/cache/persistent/myapp_cake_core_cake_dev_en-us) [function.SplFileInfo-openFile]: failed to open stream: No such file or directory in /lib/Cake/Cache/Engine/FileEngine.php on line 357

Warning: _cake_core_ cache was unable to write ‘cake_dev_en-us’ to File cache in /lib/Cake/Cache/Cache.php on line 325

Warning: _cake_core_ cache was unable to write ‘file_map’ to File cache in /lib/Cake/Cache/Cache.php on line 325

Fatal error: Call to undefined function error_get_last() in /lib/Cake/Core/App.php on line 913

Basically, when we look error like this then we think that this is a permission issue, same way i go to tmp folder and set permission and make the folder writable. There is no change at all in the error after i set the permission.

After few research i found that might be this is a issue of owner and group, so i look in that and set the owner and group of the tmp folder to apache, but still no change at all.

Since last two days, i am working on this issue and today suddenly i think that let me check it from starting point and looked in the cakephp requirements which is as below

Requirements

HTTP Server. For example: Apache. mod_rewrite is preferred, but by no means required.
PHP 5.2.8 or greater.

Technically a database engine isn’t required, but we imagine that most applications will utilize one. CakePHP supports a variety of database storage engines:

MySQL (4 or greater)
PostgreSQL
Microsoft SQL Server
SQLite

When i check php version on the production server then its 5.1.6 and cakephp 2 require php 5.2.8 or greater.

This is very silly issue but normally we never look on the version when we move the code from local server to production server, make sure when you stuck then look on version.

samsung galaxy s5 smartphone will launch on february 24 in barcelona event of mobile world congress

Samsung galaxy S5 smartphone will launch on february 24 in barcelona event of mobile world congress

Its really good news for the all smartphone users, apple launch iphone 5S and iphone 5C in the market last years with the new fingerprint identity sensor. but samsung is also in the race with apple and it may launch new samsung galaxy S5 smartphone with the iris scanner on february 24 in barcelona event of mobile world congress.

New Samsung Galaxy S5 probability to comes with the upgraded hardware, new camera (expecting 16-megapixel), may be improved touch screen sensor, with more powerful processor, may be wider screen or high resolution with existing screen size as well as some changes in the battery, so its charging faster then existing one.

iphone 5S and iphone 5C in the market last years with the new fingerprint identity sensor while new samsung galaxy S5 have iris scanner which is scanning your eye-balls.

All the smartphone lovers know more on the features of samsung galaxy S5 on february 24, 2014. but i am sure that samsung will come with many new features which will beat apple iphone 5S and iphone 5C. We all know that Apple will also launch iphone 6 in this year. Many people look on the apple as well that when apple will launch iphone 6, so they can compare samsung galaxy S5 with apple iphone 6 and decide to go with either apple or samsung.

MP4 404 file not found, even the file is already exist on location

 

are you facing MP4 404 file not found issue, even the file is already exist on location?

Recently, I am working with one of my project, where i called one MP4 vedio file in flash. basically its a webpage with the flash movie clips and then flash calling the .MP4 vedio file. when its not loading in flash file then i see that its give a 404 file or directory not found error in the http response. I check the path and its perfact, i mean there is a file on the same location, I thought that might be the file is currupt, so i replaced that file but not any improvement and its show me same 404 File not found error.

As its working fine in my local server but not working on the production server. I think that its a directory permissions issue because we do not want to set the permission in local server. I checked the file and folder permission and its configured correctly. Then i start to look on the server configuration and found that, Same web page is working on local server because it is apache server but its not working on the production server because its IIS server. And IIS threw 404 File not found error even if i open directly in browser. So this issue on an IIS server or we can say that its a IIS specific issue.

Now, i try something specific to .MP4 format and knew that .MP4 extension is not a native MIME Type in all windows server, which will be any version of IIS server. we need to add this extension manually in IIS server. I fixed it after adding this extension in the IIS, you can add any other extension which is not supported using the same way. To add the extension follow the below steps.

1) Open IIS Manager
2) Select your server and from the Features View open MIME Types
3) There is a add option at the right side, click on it
4) There is a File name extension: field, add the extension name which you want to add.
5) Next filed is MIME type: field, this is depends on the extension, so add it as per your extension.

Note : In my case File name extension is .MP4 and MIME Type is video/mp4.

Thats it, you did it.

301 redirect in cakephp (moved permanently in cakephp)

301 redirect in cakephp (moved permanently in cakephp)

How to permanently 301 redirect in cakephp?
Best way for 301 redirect (permanently redirect).
301 redirect without .htaccess file.

Recently, i am working with cakephp project, and my client need to redirect all the old links to new links. As its a ecommerce website, it have the category and products but the old php developer made single page with two parameter in the query string, where one is cid which indicate the category and another one is pid which indicate the product. all the links are not seo friendly and its look like as below

N Numbers of links in the project but i show 3 example where we need to do 301 redirect from old links to new links.

 
 // Old Links
 
  productcategory.php?cid=1&pid=3      // Category and Product Page 
  productcategory.php?cid=5&pid=31     // Category and Product Page
  productcategory.php?cid=22           // Only Category Page
 
 // New Links 
 
  product/1/electronics/3/iphone      // Category and Product Page 
  product/5/games/31/play-station-4    // Category and Product Page
  category/22/beauty/                  // Only Category Page

301 redirecting is not easy and we need to workout with the rewrite rules using .htaccess file but i did it with easily in CakePHP. In cakephp 301 redirect like this is possible without .htaccess file. you need to create the productcategory.php in your webroot folder and place below code in that.

 
 <?php
 
	$siteurl = "http://www.freelancephpdevelopment.com/";
	$cid = isset($_GET['cid']) ? $_GET['cid'] : '';
	$pid = isset($_GET['pid']) ? $_GET['pid'] : '';		
 
	switch($cid)
	{
		case '1':
				$CategoryName = "electronics";
				break;
		case '5':
				$CategoryName = "games";
				break;
		case '22':
				$CategoryName = "beauty";
				break;
	}	
 
	switch($pid)
	{
		case '3':
				$ProductName = "iphone";
				break;
		case '31':
				$ProductName = "play-station-4";
				break;		
	}
 
	if($cid != '' && $pid != '')
	{
		header("HTTP/1.1 301 Moved Permanently"); 
		header("location: ".$siteurl."product/".$cid."/".$CategoryName."/".$pid."/".$ProductName);
		exit;
	}
	else if($cid != ''){
		header("HTTP/1.1 301 Moved Permanently"); 
		header("location: ".$siteurl."category/".$cid."/".$CategoryName);
		exit;
	}
	 else {
		header("HTTP/1.1 301 Moved Permanently"); 
		header("location: ".$siteurl);
		exit;
	}

After reading my article, I hope that you can resolve your 301 redirect cakephp issue. still you are facing any issue then please let me know and i will be happy to help you.

SOLVED Google fonts not working on iphone or old browsers

SOLVED Google fonts not working on iphone or old browsers

Google fonts not working in IE7, IE8, IE9.
Google fonts not working on iphone with old os
Google fonts not display on iphone and old browsers
Google fonts loading issue in old browsers

Google web fonts provide the solution to display the fonts on your web-site without install that fonts at end user’s machine, before few years if we need to apply some fonts on the web-site then that font should be installed in the user’s machine otherwise its not display but now google fonts provide the solution for that and its very simple.

you just need to load google fonts using below lines and just change the font-family in query string, then you easily apply that fonts in your web-page.

 
<link href='http://fonts.googleapis.com/css?family=McLaren' rel='stylesheet' type='text/css'>

Recently, i am working on that and doing testing on the iphone then i knew that this font is not working, Its working perfect in my iphone which is iphone 5 but when i checked in my friend’s iphone then its not working. he is using iphone 4 with OS 4.2.2. Later on i checked in the IE7, IE8 and some other old browser then its not working in those browser as well. I am more frustrating when i see that its working in some apple products and some windows products because its working fine with my Macs as well.

After some research i solved the issue and when you know it that you surprise that its a silly things. Its solve in some apple products and browsers using the !important keyword as shown below.

 
.h1{font-family:'McLaren', cursive !important;}

if you are not able to resolve it using this then go to the http://www.fontsaddict.com/ and download fonts and upload it in your css folder and add below code in your css and then its works in all machines.

 
@font-face {
  font-family: 'McLaren';
  font-style: normal;
  font-weight: 400;
  src: url(McLaren-Regular.ttf);
}

print only content of the webpage or print content div only or just prints the content of a div not the entire window

print only content of the webpage or print content div only or just prints the content of a div not the entire window

Here is the solution of how to print content only of the webpage or how to print only content in html page.

How to print content div only, not the entire window?
Use javascript:window.print() but do not print header and footer.
print specific area of the webpage using window.print() command.
only print content from html page.

Now a days, many web-site offer the “print this page” link in their web-page somewhere in header or footer. Some people never use that link and think that its same as windows print command or ctrl + p command, which is totally wrong, if you want to print some specific area of your webpage or just content area of the webpage then how you print?

if you are a web developer and you need to develop this in your web-site where user use the print link of your web-page and its print only the content of the web-page rather then the full web-page as its print like windows print feature. Normally this links are useful to those who need to print more then 1 pages of your web-site, as they are not interested in the header and footer of your web-page, they need the content only.

Its very simple to develop this feature, you need to place the below link on your web-page

		  <a href="javascript:window.print();">Print this Page </a>

Now, you need to create print.css and include it in your web-page using below link, make sure that the media is “print” not “css”

 

I know there is a question in your mind that what we need to write in the print.css file. below is the sample of the print.css file which is very easy to understand and implement.

			@charset "utf-8";
			/* CSS Document */
 
			#header
			{
				display:none;
			}
 
			#top_topic_button
			{
				display:none;
			}
 
			#right_column
			{
				display:none;
			}
 
			#footer
			{
				display:none;
			}
 
			#bottom_bar
			{
				display:none;
			}
 
			#right_column_menu-topic
			{
				display:none;
			}
 
			#crumbs
			{
				display:none;
			}
 
			#general
			{
				display:none;
			}

Custom Google WebSearch for your own web site

How to search the content in your own website using google services?

If you are the owner of the web-site with very good content and you are thinking to place the search feature in your site then now its very easy using the Custom google websearch API.

Custom Google websearch service API give us the option to display the google search results on our own web-site. Google will give the search result of our own site links only, so you can say that its a search feature of your own site. what you need to do is, You need to create a Custom Search Engine using your google account, then just set the below search form and the below script code on the result page. please replace the ClientID with your cx code.

 
Search Form
 
<form id="form1" name="form1" action="">  
    <input type="hidden" name="cx" value="ClientID" />
    <input type="hidden" name="cof" value="FORID:11;NB:1" />              
    <label for="Search">Search </label><input name="q" type="text" id="Search" value="Search" />
    <input class="sbmt_btn" type="submit" value="Go"/>                        
</form>
 
Script Code
 
<!-- Google Search Result Snippet Begins -->
	<div id="results_ClientID" style="background:transparent; overflow:hidden; align:left; height:1100px;"></div>
		<script type="text/javascript">
			  var googleSearchIframeName = "results_ClientID";
			  var googleSearchFormName = "searchbox_ClientID";
			  var googleSearchFrameWidth = 980;                          
			  var googleSearchFrameborder = 0;
			  var googleSearchDomain = "www.google.com";
			  var googleSearchPath = "/cse";			  
		</script>
	<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
<!-- Google Search Result Snippet Ends -->

Now there are many question in your mind like,

How to change the background on custom google results page?
How to set background color with custom google results?
How to change the font style of custom google search?
Can we change the designing of the custom google search result page?

When you implement the above custom search then there is some limitation on designing part, as its a iframe provide by the google with their own css, you are not able to change any designing part in this iframe. But if you want to create your own design using the XML API where you need to work out with some programming stuff.

If you are a good programmer then its not as difficult as you think, below is the code through which you get the custom google results set in the XML format and then you can process the xml using the xml parser and display the data in your own designing templates.

	$ClientID = 'Set Your Client ID';
	$url = 'https://www.google.com/cse?cx='.$ClientID.'&client=google-csbe&output=xml_no_dtd&q='.$q.'&num=10&start='.$start;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$getxmldata = curl_exec($ch);                
	curl_close($ch);

q is the parameter of your search text(search keywords),
num is the parameter to get how many results you need in the XML, maximum you can set 20 results.
start is the paramenter which indicate from where you need results set as its in the SQL statement.
ClientID is the cx code of your custom search engine

when you run the above code then you get the results set in the $getxmldata variable, Data is in the XML format, so you need to manipulate it and display as you need on your custom template.

Please visit below links for more information on XML version of the Custom Search API.
https://developers.google.com/custom-search/docs/xml_results?hl=en

List of all php Predefined Variables and php Variables

List of all php Predefined Variables and php Variables.

In php all the variables which is starts from ‘$’ sign is known as the php variables, but there is difference between the predefined variables and the user defined variables.

There is two types in the predefined variables, one is the PHP Superglobals variables and second is the Server variables which is start with $_SERVER.

Below is the list of all the Superglobals variables and Server variables in PHP Variables.

Superglobals variables

1) $GLOBALS.
2) $_SERVER.
3) $_GET.
4) $_POST.
5) $_FILES.
6) $_REQUEST.
7) $_COOKIE.
8) $_SESSION.
9) $_PHP_SELF.
10) $php_errormsg.

Server variables

1) $_SERVER[‘PHP_SELF’].
2) $_SERVER[‘argv’].
3) $_SERVER[‘argc’].
4) $_SERVER[‘GATEWAY_INTERFACE’].
5) $_SERVER[‘SERVER_ADDR’].
6) $_SERVER[‘SERVER_NAME’].
7) $_SERVER[‘SERVER_SOFTWARE’].
8) $_SERVER[‘SERVER_PROTOCOL’].
9) $_SERVER[‘REQUEST_METHOD’].
10) $_SERVER[‘REQUEST_TIME’].
11) $_SERVER[‘QUERY_STRING’].
12) $_SERVER[‘DOCUMENT_ROOT’].
13) $_SERVER[‘HTTP_ACCEPT’].
14) $_SERVER[‘HTTP_ACCEPT_CHARSET’].
15) $_SERVER[‘HTTP_ACCEPT_ENCODING’].
16) $_SERVER[‘HTTP_ACCEPT_LANGUAGE’].
17) $_SERVER[‘HTTP_CONNECTION’].
18) $_SERVER[‘HTTP_HOST’].
19) $_SERVER[‘HTTP_REFERER’].
20) $_SERVER[‘HTTP_USER_AGENT’].
21) $_SERVER[‘HTTPS’].
22) $_SERVER[‘REMOTE_ADDR’].
23) $_SERVER[‘REMOTE_HOST’].
24) $_SERVER[‘REMOTE_PORT’].
25) $_SERVER[‘SCRIPT_FILENAME’].
26) $_SERVER[‘SERVER_ADMIN’].
27) $_SERVER[‘SERVER_PORT’].
28) $_SERVER[‘SERVER_SIGNATURE’].
29) $_SERVER[‘PATH_TRANSLATED’].
30) $_SERVER[‘SCRIPT_NAME’].
31) $_SERVER[‘REQUEST_URI’].
32) $_SERVER[‘PHP_AUTH_DIGEST’].
33) $_SERVER[‘PHP_AUTH_USER’].
34) $_SERVER[‘PHP_AUTH_PW’].
35) $_SERVER[‘AUTH_TYPE’].

Both Server Variables and Super Global Variables are also known as PHP Variables.

Coding standards in software development

what is Coding standard in programming languages?

When any new software engineer start working on the coding part then their is always some question in his/her mind, its does’t matter that its a PHP Programming, Java Programming, ASP Programming, Dot Net Programming or any other programming like perl, python, ruby, SAP, VB.Net, C# etc…

What is coding standard?
why we use this coding format while we can do it easily in some other way?
why not i use my own coding style?

Almost each company use and follow some coding standard based on their best practices. we can not say that every company have their own coding standard but we can say that every company follow different coding standard.

What is advantages to follow the coding standard?

– You are not only the programmer who do the code in any company, there are many programmer working on it, so its easier for each programmer to understand what code you wrote for specific module.

– Software Engineers change the job when they get some good offer from other company, so when any new software engineer join then he/she can easily understand the code and continue the project from where you left.

– When you follow some coding standard then you are use to with that which will prevent you from some common mistakes.

– Its easy to maintain the quality of software as well as its achive the industry standards.

– Sometime projects are too big and running upto 2-3 years, during this type of projects its easier to understand the code when you revise it for some time being of further development.

Some common Useful Tips used by all coding standards.

Comments : When you see any controller or function then always write some comments which indicate that this function or controller for what purpose and where its useful in the system.

Tags : Always use full tags rather then short tags, this will be helpful to run the application with out configuration of tags from one server to another server.

Variable Names :
– Always use lower case to define all local variables
– If variable is combination of two word then use ‘_’ (Underscore) to saperate the words.
– Use upper case for all the constant variables.
– use prefix with a ‘g’ for global variables and prefix with a ‘s’ for static variables.

Blocks : All the condition and looping blocks of statements should be aligned properly, so we can easily differntiate it from other code.

Line of Statement : Always use one statement per line, do not write two or more statement in one line.

Functions Name or Method Name : Function name and method name is relevant with the functionality of the function. For Example, you can not give function name ABCD for the function who is wrote to do the maths functions.

There is many other points which is used in the coding standard but all the above is some common points and then you need to follow the company standards. For example some company prefer to write author name on each file or function.

What is Agile Development and Agile Methodology?

What is Agile Development and Agile Methodology?

What is benefits of Agile Development in Software Development?

Agile Development is one of the most popular and useful in all kind of software development, its doesn’t matter that software on LAMP platform, Dot Net Platform or on Java Platform.

When any developer working on the implementation of the software then its not just the coding part, and most of all software engineers are master in their own technical field like java programmer, php programmer, c# programmer, dot-net programer, asp programmer or SAP Developers. But we all know that only technical knowledge is not require to develop any software, lots of inputs is also require and based on that input we need the output from the software. Also software should be very user friendly and within the budget and time frame of client.

When all the requirements are ready and fixed, means it will not changed during the development of the software then its really easy to manage for the software development team but sometime all the requirement are not on hand when we start the development and its keep changing as per development phrases, which is really difficult to work out for the development team. Agile Development is very useful in this situation because of the following key features.

– Customer Satisfaction
– Adapt to Changing Requirements
– Deliver Frequently
– Work Together Frequently
– Build Projects with Motivated Individuals
– Use Face to Face Communication
– Measure Progress with Working Software
– Maintain a Constant Pace
– Pay Attention to Industrial Progress
– Simplicity is Essential
– Self-Organize
– Reflect and Adjust

Sometimes its possible that Agile techniques are not working or not useful, but when there is a situation where the requirement is changing and client or customer communication in software development then its really useful, some time the team members who is involved in the development process do not aware on agile techniques rules, so make sure that all team members know the rules and know why we use agile development.