[HOW TO] Convert tabs to spaces in Eclipse and File (in Linux)


Tux, the Linux penguin

This is a quick tip that helped me save a lot of time – this is the reason why I love LINUX because of it’s simplicity.

I was working on a legacy code (referred as old-age code – a simple procedural coding style) for a client. In general, coding standard suggests you to have spaces instead of tabs to make it look better in all kinds of IDE, we (generally every developer) uses tab key a lot (to make our life easier) thinking it gives us the space but it inserts an actual tab (which usually jobs off from one end to the other). This legacy code was filled with tabs which looked pretty ugly in our code-review tool, though it looks perfect in the IDE, when you try to open it in Linux the favorite VI editor it looks ugly YUCK it is.

HUH, initially when my folks reported me I was like yeah go ahead and change it – what’s a big deal. But then when I came to know it not just one file but a lot (yes a lot) – it was almost more than 100 files, which had tabs instead of spaces (not GOOD – yeah I know).

Continue reading “[HOW TO] Convert tabs to spaces in Eclipse and File (in Linux)”

Advertisements
[HOW TO] Convert tabs to spaces in Eclipse and File (in Linux)

ECHO or PRINT or ANYTHING – Can you tell me which is FASTER in PHP?


The PHP logo displaying the Handel Gothic font.
Image via Wikipedia

ECHO or PRINT which is faster? – You can see this kind of questions a lot in every PHP blog-space and most of the interview questions ;-). Most of us must be known the answer, Google it, you will ;-).

Yes you can say “ECHO” but how sure are you? We blindly believe on our experts, I agree I do a lot. But it feels something different when you see it on your naked eyes, don’t you? I do.

Recently while surfing (reading obviously) over the internet on various topics, I came across a nice tool which will exactly tell us WHO (language construct or pre-defined function) is GOOD in PHP.

Continue reading “ECHO or PRINT or ANYTHING – Can you tell me which is FASTER in PHP?”

ECHO or PRINT or ANYTHING – Can you tell me which is FASTER in PHP?

[TIPS] – Upload BIG (very large) file in PHP using HTACCESS


 

Logo of the Apache Software Foundation
Image via Wikipedia

 

This blog should have been the first one, but somehow slipped through :-). In my early days of coding I found a nice tip to upload a large (really big) files to server with the help of .HTACCESS.

By default, PHP.INI configuration is configured to upload a max size of 2MB (security concern?), I know you can say it just mater of modifying the value in PHP.INI file and restart the server. Yes I agree, but you can do this when you own the server machine, think of a shared hosting server. Continue reading “[TIPS] – Upload BIG (very large) file in PHP using HTACCESS”

[TIPS] – Upload BIG (very large) file in PHP using HTACCESS

Route a domain by Zend-Router-Route-Hostname in Zend Framework


Zend Framework logo.
Image via Wikipedia

In my company most of our projects we have been using custom-zend framework and I love their routing concepts. It gives you various options of handling many different routes to get the data based on your needs – just amazing.

Let me get straight with the topic. With Zend Framework, it is easy to route your URL in a nice way without having an head-ache of working with .HTACCESS file. Thanks a bunch.

Most of us know how to route an URL with routes.ini, for example:

routes.contact.route                           = “contact-us”
routes.contact.defaults.module      = “contact”
routes.contact.defaults.controller = “contact”
routes.contact.defaults.action        = “index”
– this will route a URL http://example.com/contact-us into “contact” module >> “ContactController.php” controller >> “indexAction()”  action.

What’s the big deal? We know this, yes I agree, have you tried routing a domain?.. 😉 Most of us may not, definitely I have not it does not stop there yet, Zend Framework also gives you an option to route an URL based on host/domain name and that is cool!.

Continue reading “Route a domain by Zend-Router-Route-Hostname in Zend Framework”

Route a domain by Zend-Router-Route-Hostname in Zend Framework

INSTALL (SETUP) DEBIAN Linux OS for Development/Production – A Day with SETUP


Debian OpenLogo
Image via Wikipedia

Today I am going to talk about only installation of tools/apps required for LINUX Server. I have chosen DEBIAN, since it makes you intelligent ;-).

Okay, cool, now? First thing you have to buy a hosting space, there are quite a good people who provide this service – do a quick Google.

OKAY – Now let’s say you have got the hosting space and you have selected the DEBIAN (LENNY) OS and logged into the machine – remember DEBIAN is for intelligent & its not for human-beings means most of the tools/apps will require a separate installation. You have to dive deeper to figure out the tools you want and install them – this is interesting because it let’s you know things :-).

P.S:
This blog post is recommended for those users who knows about LINUX SERVER & shouldn’t find the meaning of Debian in the dictionary.

Let’s get the server ready……

Continue reading “INSTALL (SETUP) DEBIAN Linux OS for Development/Production – A Day with SETUP”

INSTALL (SETUP) DEBIAN Linux OS for Development/Production – A Day with SETUP

PHP MAIL Header – REPLY-TO and RETURN-PATH


how does mail works
Image via Wikipedia

Most of us very well know about mail() provided by PHP which will help us send an email.Okay? Whats the point? Why is this blog? What’s new? Yeah, yeah, I will get to it straight. I am not going to say anything new here, but a little bit of information about how to avoid return-path problem in sending an email.

Recently I was working on a bug which took almost 4 hour for me crack and fix it. It was like this bug was telling:- can you fix me dude? Do you really think you can? I was like going mad and said yes you dirty-bug I am gonna fix you soon.

The problem was mail() function was delivering the email to all of the TO, CC, & BCC to all the people in the list except the client people’s address – this is blocker, the people who suppose to receive this email were not getting it. Wow isn’t.

I was like going mad, I could receive my email to my official ID, gmail ID, yahoo ID, etc and I also checked the IP of the email server is not in any of the blacklisted softwares.

Continue reading “PHP MAIL Header – REPLY-TO and RETURN-PATH”

PHP MAIL Header – REPLY-TO and RETURN-PATH

Installing ImageMagick in Linux CentOS with YUM


Logo for ImageMagick
Image via Wikipedia

It may look simple when you read the label, but it has a capability to ruin your life. Yeah man!, try to install the latest version of ImageMagick-6.5 in your Linux (remember it’s not windows) OS which will throw a big list of dependency (packages) failures.

As is always the case with RedHat, Fedora and CentOS (may be more), a number of packages in the usual yum repositories lack heavily behind the advancements made by their authors and teams. One such package is ImageMagick, which has the version of 6.2.8 in repositories whereas the latest version is 6.5.

Recently we had to upgrade this package to the latest for one of our image manipulation project, since the latest version had several improvements with the image processing. Most of the time I just go and upgrade the existing repositories, search for the new repositories, then see if anything helps me out, naaaa, none of these procedure will helped me.

Finally, I wanted to give a chance to ImageMagick’s source, I download the latest version, uncompressed then compiled it, which thrown me a big list of errors, which is obvious 🙂 . I started looking at errors and came up with the list of dependencies it lacks (which is normal for any Linux OS), most of them are devel libraries (see below).

Continue reading “Installing ImageMagick in Linux CentOS with YUM”

Installing ImageMagick in Linux CentOS with YUM