Testing Series – 1 – Why Should We Write Tests and Test Types?


Hello everyone,
This is the first Software Testing Series article. I am going to explain about why we should write tests for the software and how many types of tests we can write. To add any additional information, you can email me via article[at]cinarr[dot]com. Let’s get started to explain.

Continue reading Testing Series – 1 – Why Should We Write Tests and Test Types?

Software Testing Series Introduction

Hello everyone,

Today, I am going to introduce a new tutorial series about software testing. Software testing is a pretty big topic (with frameworks and scenarios) but I am thinking about writing the following list. Hopefully it might help you to figure something about the topic and they can be useful notes for myself :).

Continue reading Software Testing Series Introduction

Automatic Build From the GitHub Repository via Jenkins

In this post, I am going to create an automatic build trigger via Jenkins Jobs. Basically, after pushing a new piece of code to the target repository/branch, Jenkins will create a new build package from the updated source code. If Jenkins has not been installed yet in your environment, I had explained “How to install Jenkins” in one of the previous articles. If you want to read it, you can access it from here.

Continue reading Automatic Build From the GitHub Repository via Jenkins

Azure Function App IHttpClientFactory Implementation

In this post, I am going to implement IHttpClientFactory to the Azure Function App and inject it to the sample function. To be able to do this, the Azure Function App should have a Startup.cs file. If your app does not have a Startup.cs file, you can use the sample from this article.

Continue reading Azure Function App IHttpClientFactory Implementation

Azure Function App Security Headers | Proxies.json

The aim of this post is to show the proxies.json file usage for the Azure Function Apps. It might be possible to use for different cases. For this case, the proxy will return some extra response headers from the function requests.

Continue reading Azure Function App Security Headers | Proxies.json

Network Calls with Retrofit – Kotlin Tutorial Series – 4

Hello everyone,

In this tutorial, I am going to make network calls from an android application via retrofit in MVVM pattern. End of the article, I am going to share the tutorial’s GitHub link.

Continue reading Network Calls with Retrofit – Kotlin Tutorial Series – 4

MotionLayout- Kotlin Tutorial Series – 2

Hello everyone,

In this post, I am going to try to explain the following topics.

  • What is MotionLayout?
  • Why are we using MotionLayout?
  • MotionLayout sample

MotionLayout is longer than one article but I am going to explain some basics about MotionLayout. Let’s get started.

Continue reading MotionLayout- Kotlin Tutorial Series – 2

How to Install Jenkins on Ubuntu

Hello,

2 months ago, I decided to use ubuntu OS. Windows is easier than ubuntu (for now) but the storage problem started to be an unmanageable problem for me on Windows. For now, I would say everything is perfect. (Expect permission problems.)

After Ubuntu, some installations and configurations might look different or hard. Because of that, I decided to write a blog about those topics. It is like a note for me in the future 🙂 First topic is Ubuntu. This week, I am going to write about the following topics.

  • How to install Jenkins on Ubuntu,
  • How to get build after every GitHub commit,
  • How to publish build to FTP via Jenkins.

If you don’t have Java on your system, you have to install Java before Jenkins installation. For Java installation, you have to run following commands on your Ubuntu terminal.

sudo apt update
sudo apt install openjdk-8-jdk

After installation to check your Java installation, you can run the following command.

javac -version

After completing Java installation, everything is ready for Jenkins installation. Firstly we have to add the Jenkins repository key to Ubuntu. For this, please run the following command.

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

After it, we have to run the following command to add the Jenkins repository.

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

After the repository adding operation, we should run the following command for the update package list.

sudo apt-get update

To complete a Jenkins installation, you have run the following command.

sudo apt install jenkins

Now, Jenkins is installed on Ubuntu. To control the installation, you can run the following command on your terminal screen.

systemctl status jenkins
Ubuntu Jenkins Status
Screenshot 1: Jenkins status check on Ubuntu.

Also you can use the following commands too.

systemctl restart jenkins
systemctl stop jenkins 
systemctl start jenkins

After seeing the Jenkins status on terminal, let’s complete configuration. To access the Jenkins, you can use the following url. It is the default Jenkins url.

http://localhost:8080

On the first visit, you see Unlock Jenkins title on your page. To pass this screen, you have run the following code and proof you are a system administrator.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

This command returns us an alphanumeric password on terminal. This command returns us an alphanumeric password on the terminal. We copy this password and paste it to Jenkins page. After clicking the Continue button on this page, we see Get Started page. In this page you can choose suggested plugins or you can choose your plugins. I chose suggested plugins and continued my installation. After this step, you might wait 1 – 2 mins for installation.

After successful installation on this page, registration screens receive us. On this screen, we are going to create a Jenkins user. We have to fill all the fields on this page and continue to Save and Continue button for this.

Last 2 steps before seeing Dashboard! After registration, we see the instance configuration screen. I am installing Jenkins to my OS. Because of that, I am going to use the default url on my install. (http://localhost:8080) I did not change anything on this screen and clicked Save and Finish button.

Last screen just for information. Jenkins is ready to use. You can click Start using Jenkins and login with your username / password.

Screenshot 2: After installation, Jenkins login page.
Screenshot 2: After installation, Jenkins login page.

In this post we installed Jenkins to Ubuntu. In the next post, we are going to add one item to Jenkins and configure builds via GitHub account.

Thank you,

See you on the next post.

Multiple Language in the .NET MVC Applications

Hello,

I’m going to try how to develop an application which is support more than one language. I’m going to support two language in my example application. English and Turkish. The main language will be English. Its mean, application going to be English on guest’s first visit. Users can update their language from main page in this application. After changed language, I’m going to set a new cookie for selected language. Expired time is going to be 365 days for my example application. Let’s get start to code it!

In the first step, I’m going to create a new folder in project root for my language files. The folder’s name is Resources. After creating folder, I’m going to add two resources file for my languages. First one is Global. It’s for my main (default) language. Second one is Global.tr It’s for Turkish language. The screenshot for this step is as follows.

Screenshot 1: Language Resources.
Screenshot 1: Language Resources.

Now, I’m going to fill out Global and Global.tr files. I should define texts in this files which texts I want to use for multiple language. Name column should be same for all resources file because application will use this column as a key for texts. My example file’s screenshot is as follows.

Screenshot 2: Global resources file detail.
Screenshot 2: Global resources file detail.

Now, I’m going to use defined texts in my project files. For this, I’m going to add my resources’ namespace in my file. After added namespace, I can use texts in my file now. I’m going to use as follows syntax for call my values. This step is the hardest step for this example.

@Global.YourVariableName

The example is as follows.

Screenshot 3: Example html page for definition.
Screenshot 3: Example html page for definition.

Everything is ready after defined all texts in the resources files. Let’s handle this in our application. How is going to application catch the language? How is going to change? I’m going to add as follows code block in the Global.asax file for detect the language.

Screenshot 4: Language catch in the Global.asax file.
Screenshot 4: Language catch in the Global.asax file.

What is going to do this code block? When application start, It’s going to read default language value from the web.config file and then It’s going to check cookie. (I said this at the beginning of the article.) If cookie’s value is not null or empty, It’s going to use user’s language. If It’s null, It’s going to use default language for the current user.

How am I going to change the language on the front end?

I’m going to add two image button for change the language. The screenshot is as follows.

Screenshot 5: Front end example for change the language.
Screenshot 5: Front end example for change the language.

If user click any flag, I’m going to set a value for the selected language in the language cookie. I’m going to use Jquery for this. The example code block is as follows.

Screenshot 6: Jquery code sample.
Screenshot 6: Jquery code sample.

Now, everything is ready for support to multiple languages. (English and Turkish) You can add a third language via same scenario. (Global.culture)

An extra information: I used as follows code for get/set cookie operations. You can use as follows too.

Screenshot 7: Cookie operations part 1.
Screenshot 7: Cookie operations part 1.

Screenshot 8: Cookie operations part 2.
Screenshot 8: Cookie operations part 2.

I added this to my current project. Because of that I can’t share any sample code for this example.

See you in the next post.

Thank you 🙂