Categories
Personal Programming Web Development

Seamless frontend and backend integration

It has been a while since I wrote my last post. So, before going to bed I just want to write things that is bothering me this time.

I’ve been busy working on things and try to learn something new as much as possible without compromising my time with my wife.

Early this morning, I was thinking again about if there is a way to integrate frontend to backend without huge blockages. Think about it as frontend will create their pages and interactions without worrying about backend. And then backend will do the business logics without thinking about frontend. And once we put them together with a middleware program/service then it will just work with less coding and configuration. I know this sounds crazy but for some developers who always in this situation would agree.

On top of my head, maybe there is way to do less logic coding and instead leverage more on declaring things. This idea falls to a declarative programming. As you practice this style, you know what will be your expected result but you don’t know how to do it yet. It will be ideal that you know things will end this way without exerting too much effort on building the logic first.

There might be tools out there (that I still need to find) that have already implemented this. I’ll dig more and hopefully I can find anything. Or if not, then I’ll try to create one. Hopefully! 😀 Please do drop some comments if you have any idea about this. Thanks!

Categories
Personal Programming Web Development

Who comes first? Testing or Development

While riding the train today, I stumbled with this programming article. I always think about how to become a better programmer at the same time write less and effective codes.

I still remember during my college days, one of my professor friend thought me of how to be a better programmer. He told me that I should write my code first while in my mind I assume that things will work. This will help me speed up and write quality codes. It became my principle since then.

This principle is still effective. I am able to see things without even writing a single code because I trained myself to see it. But things have changed already in programming nowadays.

Today, I appreciate how important the practice test-driven development (TDD). I can’t believe that I’ve just discovered it although it exists a long time ago. By this we can catch possible known problems that we’ll encounter in our system or API.

We all have different practices and it solves our problems. But adapting other practices makes you better and effective. I am excited to change my practice now and be more efficient on my next coding.

Categories
Server Web Development

CodeIgniter Cron In Different Environment

Here are few ways on how to run CodeIgniter cron through your command line interface (CLI).

Default way

This way is to just run the cron regardless of the environment. But by default it will use “development”.

* * * * * php path/to/your/codeigniter/index.php controller method "parameters"

With Environment

The setup below helps you once you are working on different environment. If you are using version before 3, you need to use ENVIRONMENT as your server variable.

# Version 2.2 and below
* * * * * export ENVIRONMENT="testing"; php path/to/your/codeigniter/index.php controller method "parameters"
# Version 3+
* * * * * export CI_ENV="testing"; php path/to/your/codeigniter/index.php controller method "parameters"

I hope those simple snippets above will help you. Drop some comments if you have some or any suggestions. Thanks.

Categories
AEM Java Programming Web Development

AEM Sightly’s nightmare

I’ve been working on Sightly templates which they are calling HTL (HTML Template Language). I’ve discovered some hacks/techniques on how to manipulate variables. So, I thought I’m already used to it.

I have worked on one component which I duplicated from my working component. I know it is going to work but actually something happened. I didn’t know why it is happening that frustrates me.

The data-sly-list is showing my the list keys instead of values. I kept changing my Java Use-API to think that something is wrong with my collection.

Actually nothing is wrong with my implementation. It was actually because of the double quotes (“”) that my editor is doing. Every time I write double quote it closes it with another one. If you are rushing, you will not be able to notice this in your HTML codes.

<!-- The double quote below will give you problem -->
<div class="class-name"">
    <p>Some text here</p>
</div>

<!--/* This code will always print your list keys */-->
<!--/* Instead of giving you the list and loop it as normal */-->
<sly data-sly-list="${javaUseAPI.listItems}">
    ${itemList.index}
</sly>

I’m using Visual Studio Code as my editor. They have added auto-completion for quotes on their latest updates. To disable it, you need to do the settings below.

{
     "editor.autoClosingBrackets": false
}

I know auto-completion in your code helps developer a lot. It just happened that it caused me some trouble and frustrate me a little bit. It is a good thing to remember that not all auto-completion are helpful. Sometimes it has some disadvantages and we need to take note of it.

Categories
Web Development

Flat CMS vs WordPress

For the past few days, while just browsing the internet I have stumbled with this new flat CMS called Grav. I immediately played with it and discovered that they have a very good features.

I really loved it and amazed with how they built this CMS. At first, you’ll adjust on how they do things especially when you are used to a database-driven CMS such as WordPress. Try not to use this to your current project as it is still on development. Although they’ve already released their first version a few months ago.

Now, the question is why am I comparing this 2 different CMS knowing that they are different? There are few things that we can compare with this two. Just a disclaimer that I’ll just try to compare them based on my experience while using them to my projects and not the thorough comparison.

Below are the things that I want to compare:

  1. Setting up the CMS

    Installing Grav is easy but not as easy as WordPress. There are few ways to install it as shown in their documentation. As long as you know how to use your command line for Composer command. Or do a manual installation by downloading their zip file. For Grav, you just need web server (Apache, Nginx, IIS, etc) and PHP unlike WordPress that requires you to have database (MySQL, etc).
    Overall verdict, both of them were easy to setup.

  2. Setting up templates
    Both of them have templates that you can download. But of course WordPress has a lot of free templates that you can choose from different sites.

    Anyway, I’ve chosen this item as my second comparison because for me it means a lot to most of the developer if you are able to integrate any sliced HTML to any CMS templating. Doing templates on Grav is a bit difficult as you need to adjust from their templating engine. But learning their engine is really easy by the help of their awesome documentation as you don’t need to go to any sites to get other ways to do things. WordPress on the other hand, has the simplest steps of doing your theme. Just add few files and line of codes and your good to go.

    Overall verdict, I think WordPress got my vote on this one. I still appreciate how Grav arrange their templating but you need to be patience to do it.

  3. Availability of useful add-ons or plugins
    There is no doubt that in terms of how many numbers of useful plugins or add-ons WordPress has a lot of it. WordPress has been there for a long time and it is still the most used CMS out there and there is no question about that. However, things are changing and people try to invent new things to make their development easier. Many developers now are adopting it and starting to contribute useful plugins to it.

    Overall verdict, still WordPress win on this one.

I know there are a lot of flat CMS out there that I haven’t tried yet and hopefully I can get my hands on them soon.

If you have any comments or additional information just drop some below. Thanks!