Anyone Can Code

Not everyone is a coder, but a coder can come from anywhere

Magento Installation Troubleshooting

Posted by jhalak on May 6, 2009

In fedora Core 9 the during installing Magento I faced some problems. This can be solved by many ways b googling. But I did everything after googling. That didn’t work for me. Then I do the following thing and that worked:

Problem: There was two extension of PHP were missing — mcrypt and dom.

Solution:

At first I updated yum:
$ yum update

Then I removed the php-mcrypt rpm:
# rpm -e php-mcrypt

Then I again installed mcrypt with yum:
#yum  install php-mcrypt

And also installed php-dom:
#yum  install php-dom

Then after restarting the apache I could proceed to the istallation step of magento where I stucked.

Problem: After installation of Magento in localhost I could not logged in to its admin panel.

Solution: After googling I found that you have to use the IP addressof your locall server instead of localhost. I mman you have to browse:
http://192.168.0.1/magento instead of http://localhost/magento

Posted in Magento | 2 Comments »

Image doesn’t show after cutting from PSD / JPEG in IE6

Posted by jhalak on April 28, 2009

Problem: In most cased you are delivered a PSD file to convert it to HTML. After slicing you find that the images that you cut is working in all browsers but not in IE6.

Cause: The image is in CMYK mode.

Solution: Change the mode to RGB. To do it go to: image > mode and then select RGB Color.

Posted in Photoshop | Leave a Comment »

Opacity doesn’t work in IE

Posted by jhalak on October 8, 2008

opacity attribute of CSS doesn’t work for IE. if there is a class difined as:

.myclass{
opacity: 0.5;
}

then it will work all browser other than IE. To make this class functional in IE also you have to add:

.myclass{
opacity: 0.5;
filter: Alpha(opacity='50')
}

Posted in CSS | Leave a Comment »

Transperant png doesn’t show in IE.

Posted by jhalak on September 19, 2008

In many cases we need to use transparent png image as background. But in IE, png files don’t show as transparent. To fix this problem follow the following procedure:

1) Say, the div in which u want ti use transparent image has a class named “trans_bg_class”. The class is defined as:

.trans_bg_class{
height:50px;
width:100px
background:url(images/transparent_image.png) repeat;
}

2) Now add another class named “trans_bg_class_IE”

.trans_bg_class_IE{
height:50px;
width:100px
filter: progid : DXImageTransform.Microsoft.AlphaImageLoader(src=’../images/transparency_page.png’, sizingMethod=’scale’);
}
3) Create a javascript file named “transbgIEfix.js” and write the following code in it:

var arVersion = navigator.appVersion.split(“MSIE”)
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)){
var x = document.getElementsByTagName(‘div’);
for (var i=0;i<x.length;i++)
{
if (x[i].className == ‘trans_bg_class’){
x[i].setAttribute(‘className’, ‘trans_bg_class_IE’);
}
}
}

4)  Now add the javascript file in the head section of your HTML page as below:

<!–[if lt IE 7.]>
<script defer type=”text/javascript” src=”transbgIEfix.js”></script>
<![endif]–>

That is all. Now browse the page with IE and you will see the div with transperent image.

Posted in CSS | Tagged: , | 1 Comment »

HTML mail doesn’t show in Microsoft Outlook

Posted by jhalak on July 25, 2008

I have sent HTML mail with PHP but it shows in evolution / thunderbird in Linux but not in Outlook Express in Windows. To solve the problem use the following code:

$boundary = “_e5YKJHKJHKH098090871893712893″;
$message = “–$boundary\n”;
$message .= “Content-disposition: inline\n”;
$message .= “Content-type: text/html\n\n”;
$message .= “<html>\n”;
$message .= “<head>\n”;
$message .= “<title>Your title</title>\n”;
$message .= “</head>\n”;
$message .= “<body>\n”;
$message .= “\n”;
$message .= “<TABLE width=600 border=0 cellpadding=4 cellspacing=1 bgcolor=#878676>\n”;
$message .= “    <TR>\n”;
$message .= “        <TD bgcolor=white nowrap>Your text</TD>\n”;
$message .= “    </tr>\n”;
$message .= “</TABLE>\n”;
$message .= “</body>\n”;
$message .= “</html>\n”;
$message .= “\n–$boundary–\n”;
$headers = ‘From:’ .$author. “\r\n” . ‘Reply-To:’ .$author;
$headers .= “\nContent-type: multipart/alternative; boundary=\”$boundary\”\nMime-Version: 1.0″;

if (mail($mailto, $subject , $message, $headers)) echo “Mail sent successfully”;

else echo “Something problem !!!!!!!!!!!!!!!!”;

Posted in PHP | 2 Comments »

Writing / Building widget: a simple approach

Posted by jhalak on May 21, 2008

1) There will be three files for this widget
1) style.css
2) script.js
3) widget.php

style.css : This file contains your all styles regurding to view the page. Below is a sample of this page code:
#someId{
border:1px solid #000000;
}
.someclass{
background-color: #cccccc;
}

script.js : this file contains your all javascript codes. Below is a sample of this page code:
function someFunction(){
// do something
}

widget.php: This is the main file that contains all of your html as well as php codes for the widget. Below is a sample of this page code:

document.write(‘ <link rel=”stylesheet” href=”http://www.yourdomain.com/style.css” type=”text/css” /> ‘);
document.write(‘ <script language=”javascript” src=”http://www.yourdomain.com/script.js”></script>’);
document.write(‘ <div id=”someid0″ class=”someclass”> ‘);
document.write(‘ <div id=”tab”> ‘);
document.write(‘ <ul> ‘);
document.write(‘ <li><span id=”someid1″ style=”padding-left:3px;” onClick=”return someFunction1();”>ABCD</span></li> ‘);
document.write(‘ </ul> ‘);
document.write(‘ </div>’);
document.write(‘ <div class=”someclass2″>’);
document.write(‘ <div id=”someId4″ style=”display:block” class=”someclass”> ‘);
document.write(‘ <?php
$db_host = “yourhostname”;
$db_user = “yourdbusername”;
$db_pass = “yourdbpassword”;
$db_name = “yourdbname”;
$db_table_prifix = “yourdbtableprefix”;
if (($conn = mysql_connect($db_host, $db_user, $db_pass)) != NULL){
if (mysql_select_db($db_name,$conn)){
$get_post_sql = “YOUR QUERY “;
$get_post_res = mysql_query($get_post_sql);
while ($row = mysql_fetch_array($get_post_res, MYSQL_ASSOC)){
?> ‘);
document.write(‘ <div class = “dataDiv”> ‘);
document.write(‘ <div class = “topdata”> ‘);
document.write(‘ <a href=”http://anydomain/index.php?Id=<?php echo $row["col1"]; ?>” target=”_blank”> ‘);
document.write(‘ <?php
echo $row["col2"].”…”;
echo “</a>”;
echo “</div>”;
?> ‘);
document.write(‘ <?php
echo “</div>”;
}
mysql_close($conn);
}
}
else echo “No database connection”;
?> ‘);
document.write(‘ </div>’);
document.write(‘ </div>’);
document.write(‘ </div> ‘);
document.write(‘</div> ‘);

Now in any HTML file inside the body tag add the following line:
<script type=”text/javascript” src = “http://www.yourdomain.com/widget.php”> </script>

Thats all. Open this HTML file with any web browser. You will see the widget.

Posted in PHP | Leave a Comment »

How to upload large files in PHP

Posted by jhalak on May 15, 2008

Problem: File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)

Solution:

1) To update the php.ini file set

upload_max_filesize = 20M (your desired size)

post_max_size = 20M (your desired size)

max_execution_time = 3000 (your desired time)

2) Add the following lines in the .htaccess file in the root directory of the server:

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

3) In the php file including the following codes:

<?php ini_set(“memory_limit”,”64M”); ?>
<?php ini_set(“post_max_size”,”20M”); ?>
<?php ini_set(“upload_max_filesize”,”20M”); ?>

In HTML file from where the file will be uploaded:

<form ……………………….>

<input type=”hidden” name=”MAX_FILE_SIZE” value=”200000000″>

<input type=”file” …………………>

</form>
The choice depends upon the situation.

Posted in PHP | 2 Comments »

uncaught exception: Permission denied to call method XMLHttpRequest.open

Posted by jhalak on May 12, 2008

Problem: I was trying to view some info that are coming from a site which embaded in another site and viewing in a third site. (sth like widget). In IE and safary it is showing but in Mozilla and Opera it is not.

Solution: It is a security issue of browser. Latest browser will not allow to do this job. If it is a cross domain issue then the only solution is to avoid the approach you are going on and change it as the way as the request and response occurs in the same domain.

Posted in Miscellaneous | Leave a Comment »

Cake php console command

Posted by jhalak on May 12, 2008

path/to/php/php5.2.5>php -q path/to/cake/application/cake/console/cake.php bake

Posted in Cakephp | 2 Comments »

overflow doesn’t work on opera

Posted by jhalak on May 12, 2008

If in CSS “overflow-x” or “overflow-y” is defined then it will work on all
browsers except opera. So the solution is to declare “overflow” only and
the width and height of the container should be actual width and height at
yiur desire so that the overflow works according to your demand.

Posted in CSS | Leave a Comment »