Categories
.NET Continous Integration Docker MS SQL Server Programming Project Management

Automate Testing: Gitlab, Dotnet

I always want to test my .NET based application on my personal Gitlab based repo. But since, my old project is too much a mess to do the effort for. So, when we got to rewrite the whole project, I was happy to get my experience on Unit Testing with automation of CI. I still don’t do much of CD as my development environment is still limited to development only.

So, I read about it and using Gitlab’s YML configuration, I was able to run the xUnit based Unit Test easily. It was simple too, call a MS/dotnet docker as base image, then dotnet build and later dotnet test .

But the problem arise when I have to connect to database and then I cannot get SQLCMD command to work, though I get the MS SQL Server based service to started, but until that command runs which is not present in ms dotnet docker, I cannot reload my database easily. For that I have to write code to bootstrap and create database. So, I try to search for it, and after lot of fail attempt and surprisingly no example of how to use database with YML configuration other than basic example for Mysql or Microsoft’s own docker file example. I found no info on this.

So, I decide to create a new docker image, I want to do it my way. So, I use a Ubuntu Docker image, install dotnet 2.2 on that image with mssql-cmd tools. I didn’t install MS SQL Server as I can use that as service. So using this docker image, I get my Unit testing working. This help me automate my project workflow and help me get best out of me, without need to worry about hidden errors.

My this docker image is available for anyone need it at Docker hub:

https://hub.docker.com/r/archergod/dotnetcoredb

Categories
Continous Integration MySQL PHP Programming Project Management

Experience with BitBucket CI

I have been using bitbucket for quite sometime, and really like their service. Recently, I come to know that they have Beta of CI through pipeline, that can run any docker from Docker hub. I thought to give it a try though I have my own build setup on my local machine and really don’t need it. But why not test something new.

So, my project is regular website, which is coded in Custom PHP (no framework) and using MySQL database. I wrote some Unit Test using PHPUnit test, so all I need is to run those test when I commit to Bitbucket. It seems pretty straight forward as Bitbucket configuration example shows the configuration file for PHPUnit test. I pick it up, change path and run. My test failed, as they never get the MySQL extension for PHP. What? PHPunit test docker doesn’t have database extension installed? So, how we are suppose to test it?

Well, there are few ways, one is you use multiple docker (multi-docker environment) which I recently studied is available and I didn’t yet test it. And other is you create your own docker and use it. Install whatever you need to make it happen. Also, I realize that installing MySQL will not make any good unless I install database on it before test and change it’s certain values for testing. So, I create a new docker that has everything I need for my project, all PHP extension and database server. (You can use it from https://hub.docker.com/r/archergod/phpall/). Then I update configuration file to do following:

  1. Run MySQL service (yes by default docker do not initiate run.d etc, not sure why) and hence no service auto start.
  2. Then run `mysql` to import a Script (SQL) file to create and install database, and users needed. I put everything in that one SQL file and run it as root MySQL user. It is only a docker doing testing.
  3. then Navigate to Directory in respect to my Git folder as my default bitbucket leave your prompt at git folder.
  4. Run your test.

It does a great work, though every time you push to git, it create a CI request and download docker image, set it up based on BitBucket’s script and then run your script. So it take 2 minute extra to set the machine. If you are in habbit to push every 2 hr of work, then you end up running your test every 2 hr on every push.

But basically it is all good and is free too, which I like most. Though I have GitLab at my local machine and it works exceptionally great, but BitBucket’s CI is good and different. And in some cases is better than Gitlab’s CI.

Categories
Management MySQL Project Management Server Configuration

Installing Redmine 2.3.3 on Ubuntu 13

Okay, today I install Redmine on Azure hosted Ubuntu 13.04. The steps are easy once I get it done after 2 days of working and finding what is right to do. So, let us start on installation, but a little history first.

I see that Bitnami has put quite a few Redmine VM Images on VM depot. But unfortunately all are on older version of Ubuntu. But I still thought I can upgrade them for my use, so I use the latest [Ubuntu 12] based image and try to do ‘do-release-upgrade’ it download lot of things, but in end it fail to update the machine. So, I now opt to use core Linux machine to install what I need. So, I create a VM using Ubuntu 13.04. It was easy as usual. Once the machine is up. I once run do-release-upgrade to install all latest package and there are quite a lot of them. It took around 20-30 minute for my Very small instance of VM to install them.

Once the machine is ready, now we need to install: Apache, MySQL [so I can host not just redmine but couple of my other website as well]. And to extract the latest source of Redmine we also need SVN [package name ‘subversion’] on server as well. I usually use svn version only, but you can download zip/tarball as well.

So install is as follow:

# sudo apt-get install subversion
# sudo apt-get install apache2 libapache2-mod-passenger
# sudo apt-get install mysql-server mysql-client
# sudo apt-get install ruby ruby-dev
# sudo apt-get install imagemagick libmagickwand-dev ruby-rmagick

Above statements will install subversion, apache, MySQL, ruby and ruby-dev, imagemagick and ruby-rmagick .. they all are prerequesties and you might already gave those. Once this is done..

Download Redmine 2.3.3 from svn using this Redmine Download link http://www.redmine.org/projects/redmine/wiki/Download

#svn co http://svn.redmine.org/redmine/branches/2.5-stable redmine-2.5

Now, we need GEM Bundler to be installed. so

 # sudo gem install bundler

Now navigate to Redmine folder, oh you can download redmine in any folder, as long as you are ready to use your <redmine folder>/public as your document root. if not you can use symbolic link of public folder as well in apache. Just thought to tell this now. In next step we will create a Gemfile.local to tell the installer to use rack’ version 1.4.5 as by default it install version 1.5.2 and it doesn’t work for me and I see lot of people had problem with it, so just create a Gemfile.local with one line in it and use your bundler install to do it.

# cd redmine-2.3 
# sudo cat > Gemfile.local << "EOF"
gem "rack", "~> 1.4.5"
EOF
# sudo bundle install --without development test mysql
# rake generate_secret_token

Once you did that it install redmine or rather just built it. We now need a database to store redmine data, so create MySQL database, username and password as you want. Obviously you don’t want to use root username. Once you create that user and database. then go to redmine/config folder, you will find database.yml.example file, copy it as database.yml go to production section of MySQL db, enter your login info and change database type t0 mysql2 [it is just new library of MySQL with ruby, you can still use [mysql] but it might give error so better change it.

production:
  adapter: mysql2
  database: redmine_default
  host: localhost
  username: redmine
  password: some-secure-plain-text-password
  encoding: utf8

Now run following commant to Create Database Table, clear unwanted data and session

rake db:migrate RAILS_ENV=production 
rake tmp:cache:clear
rake tmp:sessions:clear

Now, second last step: Creating a virtual Host or defining the DocumentRoot so our apache can use redmine installation. Add following Virtual Host Tag, you can add other information as you like, but keep this as minimum you need. Please change “[” and “]” with “<” and “>” as my editor doesn’t allow me to use them below…

[Virtualhost *:80]
DocumentRoot /usr/local/share/redmine-2.3.0/public
[Directory /usr/local/share/redmine-2.3.0/public]
AllowOverride all
Options -MultiViews
[/Directory]
[/VirtualHost]

Restart Apache

# sudo service apache2 restart

Now, go to your domain, IP address base url whaterver it is, and login using “admin” as username and password. You are most probably ready to rock. If not you should enable error login using /config/environment/production.rb file and then check what error you might get from Redmine.

Categories
Article Joyous Management

Funny Resume

Recently, I was busy hiring new recruit for my company. As always it is the funniest thing to do as well as it make me sad to see how idiotic people are getting. I try to compile those funny moments in this blog article. Take a look on these funny things (Please note that I actually got such resume/information while hunting for talent, hope your known ones are not doing this):

Cover Letters

Case #1: “view my resume sir…” [yes just that]

Case #2: “please find my resume is attached .. ” [My thoughts, okay found your resume, shall I send it back to you?]

Case #3: Cover letter is attached to email with resume as second attachment. [Oh my, they know they should send a cover letter with their resume.]

Case #4: “Hi, I need working at xyz CTC per annum, and expecting abc CTC per annum, my resume is attach for details,” [Oh, Am I like buying a developer?]

Resumes

Case #1: 80% of Resumes has “CV” as their heading !!! Does anyone please tell the difference between CV and Resume ?

Case #2: “Techincal Skills: C/C++, Java, VB, PHP”.. when asked ,” What is C?”, Answer came in, ” It was a subject in my post graduation, but I still have to clear its exam.” [Thanks for truth]

Case #3: 99% of Software developer knows C/C++ with 1% of them actually ever worked in it. But it is the first thing you will find it in resume. Looks like a “Lucky motto” for developers.

Case #4: Web skills Known: HTML, CSS, Javascript, WordPress, Joomla, IIS, Apache. Web Server Known: Windows, Linux. [What is that ?, IIS/Apache is not a web server ?]

Case #5: Reason for Job change [for PHP developer]: Answer:”Want to work on WordPress, Joomla, but previous company ask to work in PHP”. [Oh, I thought you are PHP developer only]

— End of Funny moments —

If you have something similar with your job applications and resumes, then please never wonder why are still searching for job.

Categories
Article Blog: My thoughts Management

How to write Error Free Code?

Recently my staff member asked me, “How can I write a Error Free Code?”. hmm.. interesting question.

I always ask them to write a error free code and I found that I don’t have any answer that fit in all situation and in cases. Even the biggest of programmer has done error in their code. So shall we understand a Code cannot be written Error free? Techincally I would say, we can write a Error free code.

But to answer above question, I first like to define an Error.

  • If your script runs, and procduce a “SCRIPT SYNTAX” error, that is what I call error.
  • If your script runs and halt on some situation that is not properly handle is what I call an error
  • If your script runs for one condition but fails for second is what I call an error

But I don’t see an error, if script doesn’t fulfill a business logic, if it was not mentioned at time of writing script. It is not an error, if your script get hacked but to some newly discovered Method of hacking. It is not an error, if your script fail to run on Upgraded server.

Error, in general can be define as anything that goes wrong from ones prespective. But it can have specific definiation as well. You can write an Error free code only, if you apply your knowledge. If anything that is beyond your imagination cause the error is not an error. However you have to decide what is your level? If you have 3 yrs of experince and your script produce an error in say simple Select Query, then ofcourse your level is not yet reached. So, I would say next time one ask that question, should first answer, What is your Level? Are you coding that level of programming. If yes, then you already are writing an ERROR FREE CODE.

Techincally programming is different from commerical Programming, I will try to define that in future. But you have to decide if programming is your passion or profession.

Categories
Management Other

Why we need to “Logoff” once we are done…

I have often read in FAQ section of websites, that request users to logoff once they are done with their working on website. Have you ever thought why we need that part? Below is the list of thinks I recognize as benefits

User View point:

1) Secure your account, in case your computer is shared or accessed by someone else.

2) Save your personalized settings (well in web world, this statement is not very true, but for desktop application/LAN application it does stand true)

3) Help in Gracefully closing of application.

Developer/Server/Application View point:

1) Allow developer to write a code to free System memory or Resources.

2) On Web allow developer to “kill” the session, so it won’t wait to expire by default timeout, and hence save lot of resources

3) Application gets better life, and usability. Crash little lesser (that I believe no stats available to me though)

4) Web application support more users, as they have more resources.

However, Remember Me feature has little to do with above message, but it do have something to do. Hope to see you incorporate that habit in your websurfing or application usage.

Categories
Management Project Management

Quality assurance

Hi,

One of my friend told me that they have a QA department in their company. I ask him what is QA ? and get this old word in new look “Quanlity Assurance”. At that time I neglect that word and doesn’t bother about it, as i don’t know what it is and why we need it.

Today, I have been asked that why I haven’t check the coding pattern of developers working under me. Hmm , as a project manager and handling 15 projects at one go is it possible for me to check those things ? my answer  was NO. Not sure  if my  boss  like  my answer or not (and ofcourse he doesn’t).

But now  is the  time for us to think on Quality Management. Can  a project manager  get enough time to think even to check the coding?

It is partical problem in Small Software companies, they spend money, but on programmers only. But to make an application click we need more than just programmers. We need to re-read our SDLC Books, and should realize that we need a complete hierarchy to complete a project.

Even a Good programmer cannot do miracles. Software programming is Team work, Senior programmer/team leader/project manager all are good if their complete team is and is commited to do good.