Wednesday, February 15, 2017

How to change RefineryCMS refinery-cms-logo.svg to custom logo (RoR)

I have been searching around the web for quite a bit to find out how I can change the RefineryCMS logo to a custom one. I have volunteered to build a web page for a non-profit organization, and I am also interested to learn Ruby on Rails, so the best way is to embark on a project. This is so that I can get into the thick of it and pick up the skills.

Once RefineryCMS is running it looks like the following picture, the encircled logo belongs to the rails cms.
I have asked around in the NZ Christchurch ruby slack community, they refereed me to a stack overflow post Adding logo to RefineryCMS nav. I am new to ruby so the answers given in the post do not make sense as I cant find the mentioned file.

But one of the members in NZ Christchurch ruby slack community actually refer to the RefineryCMS documentation about overriding RefineryCms gem pages. Once I get my head around what that means the stack overflow post start to make sense.

This is what I have done with my new understanding.

1) cd into my refineryCMS rails directory

2) execute the following command in the project directory
        rake refinery:override view=refinery/*
once the above command is executed you will see the following output being printed in the console.

3) Now if you refresh your project you will see the following files being created.

4) site_bar.html.erb is the file you will be after. The content of the file looks like the following, we will be changing the image_tag
   
5) Copy your company or organization's logo into the following path, in my example I intend to display the byars-logo.ico


6)  Now modify the previous _site_bar file to the following.
7)  Refresh your refinery page, now you see that the logo has been changed, not looking perfect I agree I will do more modification to it until it looks nice

Thats all for now till next time.



Wednesday, February 8, 2017

About MuleSoft Session Variables

I have attended the MuleSoft training, and in the training it touched on Session Variables, the training touched the topic of different variables, I understand it but I want to internalize the concepts, so I have created lab experiment about it and have written the results of my findings in Code Project blog.
 MuleSoft Variables Exemplified
The MuleSoft documentation is a rich source of information but there is a gap in articulating the behavior of session variables. As developers we understand that session variable is capable of crossing transport but that notion is not true, as per my documented experiment in code project.

In that experiment I found out that session variables only crosses VM transport but not HTTP transport, to understand this I went back to basics, but reading up what session means in the context of computer science. I got an understanding that the Session mechanism can be implemented in any stack of the OSI communications model (show in the diagram below)
 OSI Communication Model

Some communication model supports session variable crossing transports, where as some don't. HTTP protocol sits in Layer 7 of the OSI model

I also got an understanding that in HTTP Sessions, only the server holds session data (which is stored in session variables). 
In my experiment when I create a mule flow1 to call another mule flow2 via HTTP endpoint. Now physically both flow1 and flow2 sit in the same mule application, but logically flow1 and flow 2 are essentially treated as different host servers.

If you create a session variable in flow1 and calls flow2 via HTTP endpoint the logical thing to expect the session variable of flow1 will not be accessible by flow2, because logically they are treated as different servers (during run time).
The illustration above will show what you will see logically in your mind, it is as if there are two hows servers, "Logical Server 1" running flow1 and flow3 and "Logical Server 2" running flow2. The Session Variable you have created in flow1 would be able to traverse through to flow3 but not flow2 because it is hosted in "Logical Server 2".

You will have to play around with my lab experiment to be able to better relate to what I am talking about and yes the diagram is an imaginary view, of course you wont see two servers in your Anypoint studio :P. It is there to help you understand what I see in my mind.