Enabling CI for .net core using TFS Build

October 10, 2016 Leave a comment

At the moment there is no easy way to implement CI for .net core projects. Ideally it should be published and deployed to individual instances of nano servers, but that might be something beyond the capability of TFS Build.

Should you wish to implement CI for .net core projects on TFS 2015, here are the build steps and scripts that you need.

  1. Step 1: Install .net core
    Download https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-install-script and either place it inside TFS or else in a central location. This will install and setup the .net Core CLI Runtime for the service account that is used by the build servers
  2. Step 2: Run dotnet restore and dotnet publish
    Download and modify the powershell script found at http://pastebin.com/yyjbGDW9. It assumes that each folder is an individual .net core project that needs to be published. Modify accordingly to your environment

    It is important to add in the OutputDir argument as that defines where the published project goes

    As this builds all the projects, you may also want to check “Continue on error”

  3. Step 3: Deploy to the servers
    You can find the script I use at http://pastebin.com/8jBHz3Zf. Important thing to note is that you need to first stop IIS on the target server before copying the files over as running net core on IIS locks the dll files

ASP.NET Core–IIS gives 502.5

October 7, 2016 Leave a comment

Running .net core apps on IIS can be a tricky if not done correctly.


In order to be sure you will need to wait up to 6 minutes for IIS to time out to get the true error message.

Here are some quick tips

  1. Make sure the IIS user has access to the folder where the published files are
  2. The application pool serving the asp.net core website should have CLR = no managed code
  3. In your code, ensure that UseUrls comes BEFORE UseIISIntegration 
    While running it in development is straightforward using the UseUrls function, if it appear after UseIISIntegration, it will override the IIS setup and your website will not work, what is worse is that you will have to wait a full 6 minutes before you see the actual error
Categories: Uncategorized

Adobe Photoshop CS2

August 23, 2016 Leave a comment

For those that can no longer find the link to the free download of Adobe Photoshop CS2, the URL to download it is



The free license codes are

Windows Serial number: 1045-1412-5685-1654-6343-1431
Mac OS X Serial number: 1045-0410-5403-3188-5429-0639

Categories: Uncategorized

CentOS 7, VestaCP and the Irritating clamd

July 9, 2016 1 comment

Here is the step by step guide in getting clamav to work in CentOS 7 for a VestaCP setup

Install Updated ClamAV components
yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y

Link scan.conf to the default VestaCP clamd config file
rm -f /etc/clamd.d/scan.conf
ln -s /etc/clamd.conf /etc/clamd.d/scan.conf

Create freshclam service (Running it as a service will automatically update your AV definitions)
vi /usr/lib/systemd/system/clam-freshclam.service

Description = freshclam scanner
After = network.target
Type = forking
ExecStartPre=/usr/bin/mkdir -p /var/lib/clamav/
ExecStartPre=/usr/bin/chown -R clam.clam /var/lib/clamav
ExecStartPre=/usr/bin/chmod 755 /var/lib/clamav
ExecStart = /usr/bin/freshclam -d -c 4
Restart = on-failure
PrivateTmp = true

Register and start freshclam service
systemctl enable clam-freshclam.service
systemctl restart clam-freshclam.service
systemctl status clam-freshclam.service -l

Update clamd@ service to create the neccessary folders
vi /usr/lib/systemd/system/clamd@.service
Description = clamd scanner (%i) daemon
After = syslog.target nss-lookup.target network.target

Type = simple
***ADD these 2 lines below, they must be before ExecStart
ExecStartPre = /usr/bin/mkdir -p /var/log/clamav/
ExecStartPre = /usr/bin/chown -R clam:clam /var/log/clamav/
ExecStart = …

Update startup to use the new clamd service
cd /usr/lib/systemd/system

systemctl disable clamd.service

systemctl enable clamd@scan.service
systemctl restart clamd@scan.service
systemctl status clamd@scan.service

Test scan, make sure it is successful
clamdscan -c /etc/clamd.d/scan.conf –fdpass


Categories: CentOS, Vesta

.net Core RC2–EntityFramework Database First

June 1, 2016 Leave a comment

This is the updated version using RC2 for https://jefferytay.wordpress.com/2016/02/02/asp-net-vnext-entityframework-7-0-database-first-rc1/

You can refer to the full documentation at https://docs.efproject.net/en/latest/miscellaneous/configuring-dbcontext.html

Step by step guide:

  1. Starting with a blank project, add the following dependencies inside project.json

    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",

    If you are upgrading from RC1, I would suggest you create a brand new project and migrate the files rather than attempt to migrate the entire project

  2. Add the following inside tools
    "Microsoft.EntityFrameworkCore.Tools": {
         "version": "1.0.0-preview1-final",
         "imports": [
  3. ef command now no longer exists, you need to use dotnet ef

dotnet ef dbcontext scaffold -c UserDbContext -o Models -f "Data Source=.; Initial Catalog=user;User ID=user;Password=password" Microsoft.EntityFrameworkCore.SqlServer

Usage: dotnet ef dbcontext scaffold [arguments] [options]
  [connection]  The connection string of the database
  [provider]    The provider to use. For example, EntityFramework.MicrosoftSqlServer
  -a|–data-annotations           Use DataAnnotation attributes to configure the model where possible. If omitted, the output code will use only the fluent API.
  -c|–context <name>             Name of the generated DbContext class.
  -f|–force                      Force scaffolding to overwrite existing files. Otherwise, the code will only proceed if no output files would be overwritten.
  -o|–output-dir <path>          Directory of the project where the classes should be output. If omitted, the top-level project directory is used.
  –schema <schema>               Selects a schema for which to generate classes.
  -t|–table <schema.table>       Selects a table for which to generate classes.
  -e|–environment <environment>  The environment to use. If omitted, "Development" is used.
  -h|–help                       Show help information
  -v|–verbose                    Enable verbose output

Universal SMS Archiver

May 13, 2016 Leave a comment

Users who have been using Android devices will swear by SMS Backup and Restore to backup their SMS, while iOS users have iTunes backup. While these works, one issue with such software is that you generally do not want to keep or transfer all of your old SMS into the new device.

Introducing Universal SMS Archiver!

  • It is a desktop app that runs on Windows, and has the ability to automatically import your SMS from iTunes and SMS Backup and Restore files.
  • You can also manage the entire list of SMS into a current as well as archived list.
  • It has the ability to export your current sms list into Excel for further processing


The latest executable can be downloaded at https://onedrive.live.com/redir?resid=895931B65435BB3D!30467&authkey=!AG-VaHLPBh10qLg&ithint=file%2czip

Source code can be found at https://github.com/kwanann/Hobbies/tree/master/Universal%20SMS%20Archiver

InvoicePlane–Enabling Date Parameters

February 25, 2016 Leave a comment

Sometimes it is necessary to include some form of dates in either the item or the item description for InvoicePlane.

In order to do so, you will need to edit 3 files


search for function generate_invoice_pdf

and replace

$data = array(
        ‘invoice’ => $invoice,
        ‘invoice_tax_rates’ => $CI->mdl_invoice_tax_rates->where(‘invoice_id’, $invoice_id)->get()->result(),
          ‘items’ => $CI->mdl_items->get_items_and_replace_vars($invoice_id, $invoice->invoice_date_due),
        ‘payment_method’ => $payment_method,
        ‘output_type’ => ‘pdf’



search for  public function invoice

$data = array(
                ‘invoice’ => $invoice,
                     ‘items’ => $this->mdl_items->get_items_and_replace_vars($invoice->invoice_id, $invoice->invoice_date_due),
                ‘invoice_tax_rates’ => $this->mdl_invoice_tax_rates->where(‘invoice_id’, $invoice->invoice_id)->get()->result(),
                ‘invoice_url_key’ => $invoice_url_key,
                ‘flash_message’ => $this->session->flashdata(‘flash_message’),
                ‘payment_method’ => $payment_method



add the following function to Mdl_Items class

public function get_items_and_replace_vars($invoice_id, $invoice_date_created = ‘now’)
         $items = array();
         $query = $this->where(‘invoice_id’, $invoice_id)->get();

         foreach($query->result() as $item) {
             $item->item_name = $this->parse_item($item->item_name, $invoice_date_created);
             $item->item_description = $this->parse_item($item->item_description, $invoice_date_created);
             $items[] = $item;
         return $items;



Now you can do things like

Support and maintenance for {{{Month}}} {{{Year}}}


which will then appear as


Categories: Invoice Plane