CURL response is empty; API server running on Docker container

My API endpoint (for example http://localhost:3000) server running on Docker container. Initiated curl session in PHP (vagrant box) and the response was empty. Here is the code sample without proxy.

I then read docker networking docs and solved my problem setting docker ip as curl proxy. Here are the steps:

Step 1: Find your docker ip
1. Find your container ID:

2. Grab your docker ip by container ID:

Here is the final PHP code example:

(AngularUI) UI-grid auto height and remove scrollbar

Angular-UI-grid is a powerful data grid library. But it’s scrollbar and fixed height is really annoying. Here is the quick fix:

Set 100% width and height:

Remove scrollbar:

ImageMagick delegate failed error – Fix

ImageMagick is a great tool to create, edit, compose, or convert images. I was working on converting DNG files into JPG using ImageMagick and convert command was throwing following errors.

After spending several hours I found ImageMagick uses other programs to read some image formats including DNG. One of such program is Unidentified Flying Raw (UFRaw) which is a utility to read and manipulate raw images from digital cameras.

When you can not sort out errors listed above while converting your DNG images then install UFRaw and see the magic of ImageMagick again.. 🙂

(WordPress) How to handle multiple instance of “send_to_editor” js function

WordPress built-in media uploader is a great library for uploading media. We can create a upload popup instance for upload media or select media from media library by following way:

After upload done we can get the media URL clicking on “Insert into..” button which actually calls “send_to_editor” function that receives media link as argument. So we can write following code to set image URL in a textbox.

It normally works when you have only one instance like bellow:

send_to_editor_screenshot_1

But what will happen for following scenario where we have two or more custom field area that needs to upload media and insert it into the texfield or container specified?

send_to_editor_screenshot_2
Read More

(AngularJS) why ngInclude directive not fetching external html fragment?

There may be many reason of not fetching external html fragment. If you followed rules that ngInclude required, the source path is correct and it is not fetching fragment then one of the reason can be the the source path is not quoted correctly.

For example, this does not work

And this works because the path has been single quoted inside of double quotation.