Convert binary data to image in ColdFusion

Jun 20

Converting binary data to any image format has been made pretty easy in ColdFusion

<cfset myImage = ImageReadBase64("data:image/jpg;base64,#toBase64(binaryPhoto)#")>

As above, binary data first has to be converted to base 64 using method tobase64, which can be further converted to required format using ColdFusion supported method ImageReadBase64.

How to resolve fatal: remote origin already exists

Jun 17

The error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don’t need it.

First of all Github has a good documentation on renaming a remote to help with this issue.

Check your remote repositories that you’re connected to

git remote -v

This should return a list in following format

origin (fetch)
origin (push)

That might help you figure out what the original ‘origin’ pointed to.

At this moment you could follow either of the below methods to resolve this error based on your requirements.

as in:

git remote rename origin oldreponame

Once done, you should be able to change origin to new repository with

git remote add origin newrepo-url

Remember though, everywhere now onwards you’d be using github as your remote name. For example git push origin master should now be git push github master.

Get image info in ColdFusion

Jun 9

The following example shows how you can get an image’s information (width, height, alpha, etc) using the <CFIMAGE> tag in ColdFusion,

Be Batman

<cfimage action="info" source="../images/BeBatman.jpg" structName="getImageInfo" />
<cfdump var="#getImageInfo#" />

or by using the imageInfo() as

<cfdump var="#ImageInfo(myImage)#">

Both of which should you image information in a nice cfdump format.

Be Batman cfdump

How to kill process and free port

May 31

While setting up this blog for once I got into error where it was erroring when I tried to start the server using middleman server command.

The error was -

Port 4567 is unavailable. Either close the instance of Middleman already running on 4567 or start this Middleman on a new port with: --port=4568

This error meant I messed up in one of my earlier session and may have closed my terminal while server was running.

This is easy to resolve, by first finding the PID of the process.

$ lsof -wni tcp:4567

Then use the number in the PID column to kill the process (in my case it was 44995)

$ kill -9 44995

Hope this helps anyone having issues freeing port.

Learning Ruby

May 18

Finally I’ve taken my first paid plunge into learning Ruby language. For the next 7 weeks I’ll be totally immersed in coding Ruby under the guidance of Satish Talim.

Even thought I’m using Ruby professionally, I’m far away from even being called an intermediate developer in it. It all started as helping out testers once in a while and soon I fell in love with the language. In order to be more able, I’ve been through Codecademy Ruby track which gave me nice jumpstart to what I was doing at work. I languished at various other sites and tutorials before I decided it’s better to take some professional help and shell out some moolah.

I had been reading Ruby Learning blog for some time now and was waiting for their next batch to start. I was still in dilemma between above and Pragmatic Studio. Eventually, it all boiled down to cost of course and since I could afford this without reiterating my monthly budget, it was a clear winner.

Along with this, I’m planning to do some code katas at Code Wars and also learn some more stuff at Ruby Monk.

I see myself as a better Ruby Developer and a step closer to get that Rails Developer job after this course. Lets hope for the best.

30 Days of JavaScript

May 4

I was first introduced to Javascript back in 2007 for one of my Web Development class. By any standards that was late and even then I wasn’t much interested in learning it.

Things changed when I chanced upon JQuery. For me it was that easy way out which I was always searching for. Even though I could write JS code, it was bad and many a times I would resort to JQuery.

I could say things have changed for better now and these days I could write far better JS code. And in order to make myself a better programmer, I have decided to finally take a plunge and dedicate this whole month in learning pure JavaScript.

I’ll be going along the following route -

I know a month is long time to devote to JS, but my plan is to devote enough time to not miss on any concepts and I’d be trying to cram in JQuery and probably Node.js

If all goes well next month it is Meteor.js

Hello World

May 2

My first post using Middleman and me being so called dev, what better way to introduce yourself than to write a ‘Hello World’.

My plans at least for this blog is to continue writing regularly and make it more technical oriented.