Password Protected Site Without Using .htacces

Using .htaccess you can password protect a site easily. What if your host server doesn’t allow .htaccess for security reasons? No wonder, some hosting doesn’t allow .htaccess .  Here is a quick solution for that. Thanks Tapos for this reference.

 if (!isset($_SERVER['PHP_AUTH_USER'])) {
      header('WWW-Authenticate: Basic realm="Temporary Authentication"');
      header('HTTP/1.0 401 Unauthorized');
      echo 'General message for all...';
      exit;
} else {
    if ($_SERVER['PHP_AUTH_USER'] == 'temp_username' && $_SERVER['PHP_AUTH_PW'] == 'temp_password') {
       //restricted area
   }
   else {
       echo 'Try again, or press cancel';
   }
}

You can do this on the root file such as index.php. It’s simple, but there is a disadvantage for this as well, hosting that doesn’t allow .htaccess, most like they won’t allow $_SERVER array in the script. In that case there must be a server software to handle this kind of situations, so you have to contact with your host and ask them to provide support.

Posted in Apache, PHP, Web | Tagged , | Leave a comment

CakePHP: Checkbox And Radio Button Problem On Firefox

If you are using CakePHP latest version 1.3, you might have noticed these issues that checkbox doesn’t show up on latest Firefox 3.6 and both radio button and checkbox return empty value on form submit. If these weird things happened to you then you can try the following solutions.

CSS:

input[type="checkbox"] {
     float: none;
}

Checkbox:

/*By default hiddenField is true, you have to make it false to get the value on form submit. 
  And do the SAME for radio button.
*/
  echo $form->checkbox('something', array('hiddenField' => false));

Just to confirm, these issues only happen on Firefox. And these fixes doesn’t affect any other browsers.

Hope it helps someone.

Update: If you need both 0/1 value for checkbox then you can’t use $hiddenField=>false; In that case using TABLE and keeping checkbox in column works well (for firefox issue)

Posted in CakePHP, CSS, Firefox, PHP | Tagged , | Leave a comment

We Don’t Need Managers And QAs Anymore (?)

Developer, Developer, Developer, Developer, Developer, Developer!!!

Developer, Developer, Developer, Developer!!

Why is Facebook so popular? It’s not because it has cool ideas to engage users, but also engineers behind the scenes to make a solid platform for both users and developers. I was always curious about the internal management of Facebook. I used to wonder about the engineers of Facebook, QAs, managers, and hierarchy.

It came to me as a shock when I read “Managers are kind of useless here, we don’t have real QAs here (Facebook)”.

Wait…what? How does a software company like Facebook not have real QAs? Or how are managers not useful there? Well, rules were made to break. Most Facebook engineers are young, so if they don’t break the rules then who will break them?

I can remember a comment from my current boss: “Junal, I don’t do micro management”. This comment gave me the opportunity to learn self-management. And since then I’ve noticed that I depend on others less. It helped me to do things my own way. And if it didn’t work, at least it helped me learn.

In my opinion, if I knew I had QA to test and find bugs from my work, I wouldn’t test it myself as if I knew I was my own tester.  I would be less responsible for my tasks if I knew I had a manager to push me. Sometimes managers are a headache for developers because they don’t understand developers and they keep forcing them to do what they don’t want to do. As a result it leads to a big waste of time. If a developer says, “I’m going to manage it” then there is nothing more productive than a self-managed developer.

Take Mark Zuckerberg for example. He is a young guy with no management experience. If he didn’t learn self-management and apply it, he wouldn’t have created Facebook. Facebook is an example that proves that managers and QAs are not an important (or necessary) part of a software firm.

But,

Don’t forget, Facebook hires very intelligent developers who have a combination of qualities. We can certainly say that we don’t need QAs or managers when we have smart developers who aren’t just front-end or back-end developers, but also managers and QAs.  When we have multi-taskers like that, then we can say that a new era has come and now we can break the traditions.

Posted in Facebook, Job Experience | Tagged , , | 1 Comment