Start PHP builtin server for a Project without Apache

To PHP developer, setting up new development environment is a repetitive job, it’s boring and take time when you want to test something quick on system that’s not yours. luckily, PHP include a built in server out of box from version 5.6 and today i’m going to show you how to execute it.

first, you will need a php project with index.php file. Then use terminal emulator to go to project root and execute this command :

php -S localhost:8080

You can now  access your project at this address on your browser : localhost:8080 , just simple like that.

Default entry point is index.php, but you can access other file.

 

This is good to see all requests come in or error. Can be used on the fly for quick debugging. hope you find it useful 🙂

Magento – Adding custom variables to Magento Static Blocks

I’ve been asked to customize the front page of a magento store. The client wanted the ability to specify a set of variables that can be used in CMS static blocks so static blocks can be a little more dynamic.

By default, the standard magento CMS static blocks don’t provide access to the custom variables. so I thought I was going to have to build an extension to pass the variables in. However after a little bit of finding, I found that this functionality is available as standard in Magento, you just need to do it properly.

Continue reading

Laravel – Change user password with tinker tool

change password

Today just asked myself if i can change user password in Laravel via command line, so things will be easier for us to work with Laravel products. I bet many of you use default Laravel user model (which is good for us in this case). if you do, this article is for you, i found an interesting tool within Laravel command line interface name ‘tinker’

Continue reading

.gitignore generator for Magento

Git is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. it’s important for many projects and Magento is not an exception. for many beginners or even experienced developers, a good .gitignore file is not always in their mind, this is source of many sins in the future to other developers who get in the line of the same project later.

i created a bash script and have been using it for awhile. You can generate a good .gitignore file from now on and stop worrying about git related issues in the future. you can find the script below

Continue reading

Ruby – Introduce a new great tool for developers : regular expression builder

Today is a great day because i just finished my little tool name ‘RegexiZ’ (AKA : regular expression with invisiblezero.net). this tool will help you to solve your problem with regular expressions – yeah, it’s a big problem when you decided to use regular expressions in your program. every developer know about the magic of regular expression, so let’s get start at http://invisiblezero.net/regexiz 😀

note : this program is implemented base on Rails 4

Some people, when confronted with a problem, think
“I know, I’ll use regular expressions.” Now they have two problems.

Magento – Clean database dump for development purpose

cleaning database

Mangeto Database is huge and complicated, everyone knows about this truth. It’s a big obstacle for many developers who start working on a new project or grab latest changes on production server. The following procedure will help you to reduce size of production database a lot before downloading to you local environment.

Continue reading

Magento – Remove redundant attributes

Delete_Banner

Some time Magento redundant attributes can be very harmful. for example, AheadWork shop by brand will add aw_shopbybrand_brand attribute to catalog_product, it’s ok when you still use AheadWork module but it can be a big trouble like fatal error on server or producing error messages in your log file when you replace it with another extension. This issue happened because you just removed AheadWork module code from your Magento installation, aw_shopbybrand_brand attribute is still stay in your database. in this article, i will show you a setup script that will remove it.
Continue reading

Javascript – continuously, respectively send requests to server

continuous

Sometime you may want to send requests continuously to server with one request each time ( like a foreach in PHP, or for x in array or .each in Ruby …). we have ‘for’ and ‘for .. in’ loop but it’s not smart enough to wait for an Ajax request to be responded. so it doesn’t help us to fulfill our target. what should we do to loop through array, send Ajax request to server with data from array element and wait for response before sending new request ?

Continue reading

Magento – Installing Extensions via Command Line

install-banner

I don’t like the idea of having to change permissions of my magento install to add on new extensions. There’re some services that allow you to download extension in compressed file like http://freegento.com/ddl-magento-extension.php , so you will only need to extract then copy&paste to your Magento installation folder, this is also a pain to me, especially when i’m on a Mac (yes, Mac is bad at merging files) . Thanks to Magento, we have command line for this type of work.

Continue reading