How to set up Travis-CI on a Android Project

Hello everyone, I’m super excited to help you out with installing Travis-CI. You might have some questions before we start!

What in the World is Travis-CI?
Don’t worry! Travis-CI is simply a CI (continuous integration) service to help you build/compile and test your projects. (mainly on github).

Is it hard to set up?
Absolutely not. It’s just a single yml (a data serialization language for configurations) file and some clicking here and there. You only need to set up .travis.yml so travis-ci knows how exactly to test your code, and in what conditions! Although it took me several tries to get my .travis.yml working.. here are some things to note!

Things to take note:
Travis may not work on every sort of android project (you really have to customize the configuration file accordingly… it might take you several tries to set it up as well. The simpliest thing like an image with a different signature type might totally just fail the test.

The travis.yml file that is at the end of this blog post may not be the same as your final intented one, so do make sure to make the appropriate changes to yours!

Let’s get started!
To get started, you’ll need a Travis-CI account, or you can log in via Github. I’ll skip this section and move on to the more important ones!

Next up, make sure you select the repository you want to put this on. I believe it has to be public, but i’m sure you can set it up for members within github organisations only.

Placing your (.travis.yml) file into your root directory of your project (in this case if it’s an android project –> where your build.gradle is (here is a picture of where mine is..)

Now, all you need to do is  add a travis.yml file to trigger an inital build and see if it passes, if it doesn’t just check the logs.. It looks like this at the end, (PS, if you can’t trigger the build make sure you enable auto-build for push in your travis-ci project settings!)

or like this…

Although, you can see that Travis tells you the error and you can fix it. If you are working in a team, it helps to be able to self-test every last bit of code in a different environment so that you know your teammate will be getting a working copy, or not…  Don’t worry if you get this problem though… just look up and see what’s going on!

Once you’re done, whenever a teammate commits and pushes the code… travis automatically picks up your latest repository version and tests (by reading how from your .travis.yml file!).. and you can see if it succeds or not! (PS: Travis also knows to cancel your tests whenever you update a readme.md file!)

You’re done! Congratulations on setting up your travis-ci project! If you require any help at all please feel free to email me @ brian(at)bchewy.com

My .travis.yml file! : https://raw.githubusercontent.com/bchewy/Project-Fosterships/master/.travis.yml

Useful documentation to customize your .travis.yml file :  https://docs.travis-ci.com/user/languages/android/

How to start, stop and connect to your Microsoft SQL Server with HeidiSQL

Hello everyone, after trying for numerous hours to connect to my MSSQL Server installed via the Visual Studio Installer on my Windows VM with HeidiSQL. I just couldn’t help but post a quick and detailed guide on how you can do the same. I have credited the information that helped me below!

Step 1 : Look for your MSSQL Server’s name (If you’ve installed it with Visual Studio like me… (Open up > SQL Server Object Explorer)

In my case, the MSSQL’s server name is “MSSQLLocalDB”

Step 2: Start MSSQL Server

Command 1 : "C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe" start MSSQLLocalDB
OUTPUT:
LocalDB instance "MSSQLLocalDB" started.

The above command helps you start your MSSQL Server and allows you to check information (like pipe information)

Step 3: Check for your pipe information with the following command

Command 2 : "C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe" info MSSQLLocalDB
OUTPUT : 
Name: MSSQLLocalDB
Version: 13.1.4001.0
Shared name:
Owner: DESKTOP-UT2AN59\Brian Chew
Auto-create: Yes
State: Running
Last start time: 11/27/2018 8:40:16 PM
Instance pipe name: np:\\.\pipe\LOCALDB#D42B8DEB\tsql\query

As you can see above, my instance pipe name is “np:\\.\pipe\LOCALDB#D42B8DEB\tsql\query

Step 4: You’re done, so stop the MSSQL Server and navigate to HeidiSQL and use the following settings! (remove np:)

To stop the server: use the following command! (PS: You won’t be able to connect to your server if it’s down… so just remember!)

Command 3: "C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe" stop MSSQLLocalDB
OUTPUT:
LocalDB instance "MSSQLLocalDB" stopped.

You’re set! Now you’ve successfully connected to your MSSQL Server with HeidiSQL and can make full use of HeidiSQL for any MSSQL stuff! Credits: here

 

 

Ruby on Rails 5

Hello everyone! I am currently learning ruby on rails for my project, and this is to help me learn better. I will explain each command below after listing it out!

rails g/generate

to generate something in rails

rails generate migration AddXtoY

to generate a migration to add email to user table (strict convention of naming the migration … Read more)

rake db:migrate         OR        rails db:migrate

to migrate the database after modification (from migration files > db/migrations/* )

rake db:reset

to reset the database and work on all migrations again (delete all then create)

Some Ruby On Rails 5 Conventions

  1. Migrations have to have the proper name (AddXtoY, etc)
  2. Partials have to be _name.html.erb (named in this order)

3.     Found https://gist.github.com/iangreenleaf/b206d09c587e8fc6399e

As of right now, this commands help me to see and do the basic stuff. I will edit this post and add on most stuff as time goes by. I’ll always be learning more!

Last updated 1 December

The Docker Guide!

Docker is an awesome tool! and this is my guide on how I use it for development, and or other fun things you can do with docker!

Docker is a containerisation tool as explained in the previous post. Here are some of the Docker Commands that I’ve used to help start, etc!

docker ps - shows all active docker containers
docker ps a - shows all active/inactive docker containers
docker start *name* - starts the docker container with the *name* eg: docker start mussql - starts the docker container with sql
docker pull *name* - pulls docker *name* from dockrehub, etc...
docker build -t testapp:v1 - builds your docker image based on your Dockerfile. (look at: https://docs.docker.com/engine/reference/commandline/build/#options) there are other flags like --no-cache etc!

What’s a dockerfile? : A docker file is simply just a set of instructions for docker to build images automatically.

I hope the above commands have helped you understand docker a little better.  You can download it for windows, or Mac-os and try it out yourself here : https://www.docker.com/get-started 

Thanks for taking your time to read!
Brian

DOCKER!

Hey guys, I’ve recently been up to trying to learn docker. It’s simply great.

This is simply a draft post to instruct new system administrators or developers like myself how docker works, and how I interpret it. It’s also really good for my future self (just in case i forget how docker might work. I can just refer back to this!)

Image from https://blog.docker.com

Docker is just a containerization tool to help you work easily with multiple operating systems. Say you had a two different servers you were intending to deploy your application on:  A staging server, and a production server. Docker helps you cut down on redundant mess and configuration. All you need to do is to run a docker container with a docker image. You’re set. (It’s practically github for docker-images, so they work on docker containers!)

I’m still in the middle of learning how docker works, and trying to deploy/ship out a demo-web app on the mac-os platform (on apache). I’ll write another blog-post in a few days time on the commands and things you should take note of.

Git and the command line (Cmder!)

The command line is fast. Really fast. These posts are some reminders i made to help inform myself about git commands that are important. Some terms before we start

Commit – To commit your changes (literally means to commit)
Staged – To prepare for a commit, but is NOT a commit(this is one step before commits)

Cloning existing git repos

$ git clone https://yourgitrepurlhere

Checking your git status (modified,unmodified etc) – more regarding changes here (https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository)

$ git status (include -s for a short status)

Ignoring files (put them into a .gitignore file eg:)

# ignore all .a files
*.a

# but do track lib.a, even though you're ignoring .a files above
!lib.a

# only ignore the TODO file in the current directory, not subdir/TODO
/TODO

# ignore all files in the build/ directory
build/

# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt

# ignore all .pdf files in the doc/ directory and any of its subdirectories
doc/**/*.pdf

Commit changes

$ git commit -m "Commit name here!"

The above command commits the changes mentioned in git status, furthermore… you need to push to update remote copy (if on github, or any other remote repository)

Push to remote repository

$ git push

Git move

$ git mv file_from file_to

Everything else can be found on the git-scm website. Of course, making use of software like Github Desktop or SourceTree can be very useful. However I still think that learning a little git on the command line can help in the near future.

Why am i learning this?
Why am i indeed you may ask? I am merely curious and intend to explore how to make use of git (the cmd version) and attempt to make my very first web-application on a MVC layer (not ASP.NET core) with the Symfony framework. I should also note this PHP command down… (i keep on forgetting how to run the application..)

 $ php bin/console server:run

Updated 10/08/2018 9:15PM – updated if any important things are missed out!

References
Source: https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository

RESTful!

RESTful has been something on my mind for a very long time. Ever since i was young, i had stumbled upon something called RESTful… well back when i was still a young developer working on simple html pages for absolute joy.

Today, i will be posting some of the resources I feel that have been of great use  to me when learning how RESTful works. If you’re interested to know more… you should definitely read every last word these articles have to offer.

The below shows how in relation the HTTP methods are with the normal CRUD operations and SQL operations. Picture is taken from scotch.io

There are four main parts to a simple HTTP request

  1. Endpoint (this is basically the url eg: github’s root-endpoint is api-github.com, root-endpoint basically means the starting point hence “root”)
  2. HTTP Method (covered above in the picture)
  3. Headers (just additional information about the request/response more information : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers)
  4. Content (data/body)

We’ve already covered what methods are.. and on to headers (Headers are simply property-value pairs– to me, this is really just a way of providing information to the client/server -eg so the server may know what this request/response is for… etc!)

As for Content… it’s just the information to be sent to the server. HTTP Status codes & error messages are just as important because they tell you what has happened to your request/response!


Picture is taken from smashingmagazine.com

Finally, i’ve really learnt a lot of what RESTful is due to my knowledge in applying it. I’ve made a simple web-application on C# with the help of what i’ve learnt in school. You’ll be able to download the demo (which helped me to learn here!!: https://github.com/bchewy/CSharp-HTTP-Methods-API-)

References (i do not any of the pictures posted above)
Scotch: https://scotch.io/bar-talk/a-quick-understanding-of-rest
Smashingmagazine : https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/

 

The essence of a back-end web application

Before coming into Laravel, Laragon & VueJS and all that cool stuff… I quickly learnt myself after a day of lessons (just today!) that they have a huge potential and a literal whole new world to explore!

I’ve basically learnt what a MVC is, M stands for Model, V stands for View, and C stands for Controller. They are the real basic aspects of a web application, and I’ve finally come to the understanding that they’re very important when developing a new application!

The true understanding of how APIs really work out there! First, you’ll start by working on the different APIs to do the different functions, then you go around to working on the routes, to direct different routes to views. Then, you’ll start working on the front-end, with AJAX to make use of your API and get the appropriate data!

Cool isn’t it! That’s what i didn’t know, when i started, and my my how amazed I was. You can learn more from Laracast

 

via GIPHY

 

How to deploy ASP.NET applications on Ubuntu 16.04

Hi all, I’ve decided to write a simple tutorial on how you can deploy your very own ASP.Net applications. I couldn’t find a single tutorial online.

1. Check with what HTTP server you are running, can you run ASP.Net applications? (For Apache, you need the mod_mono mod enabled)

2. Mod_mono –> http://www.mono-project.com/ . You must have xsp4 (You need to see if mono supports your application – http://www.mono-project.com/docs/about-mono/compatibility/) Thankfully, i was making use of the .NET 4.6

3. Check for any potential errors on your site when you deploy (you might have errors, i had several (compilation parse errors, – this may take a while… and remember to add the bold line!

<configuration>
<system.web>
<compilation debug=”true” targetFramework=”4.6.1″/>
<httpRuntime targetFramework=”4.6.1″/>
<customErrors mode=”Off”/>
</system.web>

That will allow you to view errors on your site in the first place.

4. Once you’ve resolved that.. your application should run like it would on your Visual Studio! I hope i saved you a bunch of time! 🙂

via GIPHY