Archive for the ‘Found’ Category

Importing large databases on Wamp5 PHPmyAdmin, how?

Tuesday, August 24th, 2010

Have a database bigger than 2MB? want to import them somewhere else? but you cant and PHPmyAdmin just gave you the dead end message below?

No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

Have no fear, there’s a solution:

Look for the php.ini file -> c:/wamp/www/apache2/bin/php.ini

Then change the following lines:

post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M

To these new values:

post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 100M

Then restart wamp5 and retry importing…

Happy coding :P

How to set Webserver Directory Index via .htaccess

Thursday, August 19th, 2010

What’s a webserver directory index anyway?

When an HTTP client (generally a Web browser) requests a URL that points to a directory structure instead of an actual Web page within the directory, the Web server will generally serve a general page, which is often referred to as a main or “index” page.

Most often index.html or index.php are used by developers, but we can set it to any file we want to with the help of .htaccess

on your .htaccess file write:

DirectoryIndex home.html

Above code is just telling that I want the file home.html be by default index page.

but you can also do this:

DirectoryIndex home.html index.html index.php

Above is telling the server that to use home.html as my default index page and if not use index.html else use index.php and so on…

So that’s it, fairly easy…

:)

How to customize Magento’s currency symbol?

Tuesday, June 22nd, 2010

Editing Magento’s default currency symbol is relatively easy and can be done via admin.

But what if you wanted to display “USD” instead of “$”?

This too is easy enough for most of us-if you know where to look at! :)

Ok ok, to edit or customize default currency symbol look into;

MAGENTO_ROOT/lib/Zend/Locale/Data/

Look for you locale, in most cases en.xml (which is english), download and open it in your favorite editor, replace below code

<currency type="USD">
    <displayName>US Dollar</displayName>
    <displayName count="one">US dollar</displayName>
    <displayName count="other">US dollars</displayName>
    <symbol>$</symbol>
</currency>

With this code:

<currency type="USD">
    <displayName>US Dollar</displayName>
    <displayName count="one">US dollar</displayName>
    <displayName count="other">US dollars</displayName>
    <symbol>USD</symbol>
</currency>

I think you already noticed what we omit and replace on the code :) , easy enough, saved it and upload it to your server.

To make your life even more easier here’s a tip: you can find this line of code around line 3800 in en.xml

GOGOGO :)

Getting image’s height and width via JavaScript

Thursday, May 6th, 2010

How to get image’s height and width via JavaScript

<img src="PathToYourImages/image.jpg" id="image">
 
<script language="Javascript">
var Height = document.getElementById(image).clientHeight;
var Width = document.getElementById(image).clientWidth;
/*write value*/
document.writeln("Height is: "+Height+" and width is: "+Width);
</script>

Easy? yes…