Windows must be installed to a partition formatted as NTFS

Windows cannot be installed to this hard disk space. Windows must be installed to a partition formatted as NTFS

If you have the error like the one above while installing Windows 7, here is a fix for the problem.

1. After you have agreed to the license, you should get to a menu that includes deleting and creating partitions.

2. Delete the largest existing partitions on the hard drive.

3. Now you should get the option to create a new partition

4. Click on create, and now you have one with NTFS format.

No Comments

Moving to highub.com

From now on, most of the new articles will be posted on highub.com instead of here. :)

No Comments

XAMPP PHP cURL

cURL (Client for URLs) is in the XAMPP bundle. But you must enable it first before you can use it in your PHP code.

To enable curl library with XAMPP we need to modify the php.ini files in our xampp folder.

1. Locate some or all of the following files:
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini

2. Uncomment the following line on your php.ini file by removing the semicolon.

;extension=php_curl.dll

3. Restart your apache server.

4. Check your phpinfo if curl was properly enabled.

,

1 Comment

Magento – check if user logged in

Many times, you may want to check if a user is logged in while using Magento, to do so, you could use one of the many helper function to do so. The top class for it is Class Mage_Customer_Helper_Data, the method we are going to use is isLoggedIn(), let’s write a simple script to check if a user is logged in:

<?php
if ($this->helper('customer')->isLoggedIn() ) {
    echo "Welcome!";
} else {
    echo "Please log in.";
}
?>

2 Comments

Magento Display Product SKU

If you happen to use Magento to develop your e-commerce site, and want to display SKU number on your product page, here is how you can use the magic method getSku to do it. On your app/design/frontend/default/default/template/catalog/product/view.phtml page, add in the line below:

<?php echo 'RN #'.nl2br($_product->getSku()) ?>

1 Comment

Preload iFrame using JavaScript

To preload iFrame in JavaScript is possible. Sometimes it takes a while for a iFrame page to be loaded, this causes ‘a moment of blankness’ which is not what we want the user to see. To fix this bad user experience, we could make a preloader to preload the iFrame, only when the iFrame is loaded, then we display the content.

To do so, we could use the existing JavaScript library – jQuery. The script below is an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <iframe src ="http://www.yahoo.com" width="100%" height="300"></iframe>
  <img src="http://www.ezeego1.co.in/hotels/india/athirapally/page/webroot/images/preloader.gif" id="preload-img" />
  <script>
  $('iframe').css('display', 'none');
  $('iframe').load(function()
  {
    $('iframe').css('display', 'block');
    $('#preload-img').css('display', 'none');
  });
  </script>
</body>
</html>

,

3 Comments

jQuery disable an element

If you use jQuery, you can disable an HTML element by setting the ‘disabled’ attribute to ‘disabled’ (to disable it). The result of which looks something like this:

// Disable #x
 $("#x").attr("disabled","disabled");

Here is a demo you can copy and paste into a HTML file and try it out yourself:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <select id="x" style="width:200px;">
   <option>one</option>
   <option>two</option>
  </select>
  <input type="button" value="Disable" onclick="$('#x').attr('disabled','disabled')"/>
</body>
</html>

No Comments

Compress jQuery

You may have written a jQuery plugin, and want to make a minimum version.

Generally the best way to do it is to use the YUI compressor. YUI stands for Yahoo! User Interface, YUI compressor is released by Yahoo! for free. So anyone can use it for commercial or non-commercial usage.

An alternative is to use Douglas Crockford’s JSMin. This doesn’t compress JavaScript code as small, but generally how you write your code matters less. Douglas Crockford is the web architect at Yahoo! Sunnyvale, a very experienced programmer that created the JSON language. Before YUI compressor came out, I used JSMin for JavaScript compression.

Packing javascript using Dean Edwards’ Packer (specifically using the base64 encode) is not recommended, I don’t wannna provide the link to it here, as the client-side decoding has significant overhead that outweighs the file-size benefits.

If compressing your JavaScript breaks it, try running the code through JSLint. This will detect minor errors that can cause packed JavaScript to fail where the unpacked version works fine.

No Comments

Google Gadgets in Joomla Custom HTML module

To include syndicated Google Gadgets in a Joomla! site using the Custom HTML module (mod_custom) is very easy. This page lists all openly syndicated Gadgets:

Just find a Gadget and select “Add to your webpage”. Then set any parameters and click “Get the code”. Copy and paste the code into the source of a Custom HTML module in your Joomla! admin, and you have a Google Gadget on your site!

By the way, remember to turn off any code cleanup options you may have on in your Editor or the SCRIPT tags will get stripped out by the filter when you save.

Of course, except for width and height, you don’t have much control over the look of most Gadgets. But this easily can be corrected by viewing the code on a particular Gadget’s “about” page, tweaking it, and submitting it as a new syndicated Gadget that looks the way you want.

So, if you can’t find the Joomla! module you’re looking for, you might consider looking for a Google Gadget that does what you want instead.

No Comments

jQuery get value of selected option

To access the value of the selected option from the the select dropdown list is easy, in jQuery, you can use the val() function to get the value, here is an example of how to use it:

<select id="myselect">
   <option value="1">Mr</option>
   <option value="2">Mrs</option>
   <option value="3">Ms</option>
   <option value="4">Dr</option>
   <option value="5">haseeb</option>
 </select>
$("select#myselect").change( function() {
    alert($("select#myselect").val());
});

No Comments