Python Proficiency

I’ve been on and off in using Python as my go-to programming language.  In the past 6 of months, I have started researching more about its internals and why they work the way they do.  I have read numerous online/offline publications and spent my daily commute listening to Pluralsight‘s Python videos.   I’m about an hour to an hour and half away from work so that’s a pretty good time for me to either listen to podcasts or learn. I mostly choose the latter.

Pluralsight has started providing Paths recently.  Paths allows a subscriber to pick a topic of interest and Pluralsight provides the list of courses related to the topic. I think this really helps their subscribers streamline their training.  One way to measure you are learning is by taking skill assessments and certification practice exams.

And last month, after taking quite a few courses in the Python Path, I decided to take the skill assessment and received a Proficient rating.  3 more points and I could have been an expert.  Oh well, the importance is I’ve learned more about the language.

python-proficiency

By the way, I am not affiliated with Pluralsight but a happy subscriber.

 

SQL Server Post Installation Checklist

I have been managing all of the Microsoft SQL server instances in our organization.  Part of our SQL server process is to review the standard settings and tweaks after installation.  If you don’t already have a post-installation checklist, I highly encourage you to create one for your team.

Having a post-installation checklist helps to make sure all of your SQL instances are following your standards.   Today, I will start with the server properties checklist.

  1. In your SQL server inventory list, add the new instance you have just deployed.
  2. Record information relating to hostname of the box, the version of SQL you have deployed, operating system, allocated CPU and memory and disk layout.  You can get this information in the General page of the server properties window.
  3. In the Memory page of the server properties window, review the minimum and maximum server memory settings.  In our case, we also manage the SAP SQL servers.
  4. In the Processors page of the server properties window, make sure both checkboxes under Enable processors are checked.  We do not change any of the Threads setting and leave them as default.
  5. In the Security page, we choose the SQL Server and Windows Authentication mode.
  6. In the Database Settings page, we make sure the Compress backup is checked.  Make sure to adjust the Database default locations unless you have already defined this correctly during installation.
  7. In the Advanced page, we set the value for Optimize for Ad hoc Workloads to True.  We also set the Cost Threshold for Parallelism to 50.  If you are hosting SharePoint or SAP databases in this instance, both vendors recommend to set the Max Degree of Parallelism  (MaxDOP) to 1.

The goal is to have consistency in your SQL server deployments and that can only be achieved if you have a post-installation checklist.  Normally, another person conducts the review of the post-installation.

In the next blog entry, I will talk about the different Trace flags we use and the different database settings we set for both the Model and TempDB databases.

I hope you learned something new today.  Share your comments on what you do with in your organization or feel free to share.  See you on the next blog post.

 

10 Steps to Install Redis in Windows

Overview:

Redis does not officially support Windows, but there are multiple ways to get you started in working with this great product. The redis.io website talks about cloning the source from the Microsoft Open Technologies Github site and building it yourself.

In the next section, I’ll show you in 10 steps how to have a working Redis installation.

Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets,sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster

Reference: http://redis.io

These recommendations are for development purposes only.  There are tons of information for deploying Redis in production.

Requirements:

  1. Windows OS (Can be Server or Desktop – I’ve tried this using Windows 10)
  2. Visual Studio (I’ve tried this using Visual Studio 2015)
  3. A bit of knowledge on Nuget

Steps:

  1. Open up Visual Studio
  2. Create a Console Application (or any project which will allow you to install a Nuget package)
  3. Once your solution has fully loaded, click on the Tools menu, drill in to the Nuget Package Manager and click on the Package Manager Console.
    2016-01-06_13-10-03
  4. Inside the Package Manager Console, type the command Install-Package Redis-64 in the PM> prompt and hit the Enter key.
    2016-01-06_12-39-47
  5. Once the installation is complete, right-click on your Solution and click on the Open Folder in File Explorer.
    2016-01-06_13-15-49
  6. Inside the file explorer you will see the packages folder. Drill in until you see the tools folder.
    2016-01-06_12-43-00
  7. Copy the tools folder and paste it to the top most folder of your system drive. If you have more than one drive or volume, use the additional volume instead.
  8. Rename the tools folder to redis.
  9. Drill in the redis folder you just renamed to and you will see all of the binaries you will need to start redis.
  10. Install redis-server as a service. The instructions are in the Windows Service Documentation Word document.

RIP Ian Murdock #Debian Founder

Today is a sad day not only for the Open Source Community but for the whole humanity as well. Ian Murdock is the founder of Debian, the greatest Linux distribution ever.

I still recall the very first time I slide in my Debian Hamm cd  to install Linux back in the late 90’s. Dpkg was the package manager back then and I remember struggling with it.

From that point on, my view of the operating system has changed and my Linux education started.

Python virtualenv

During my first few weeks of learning Python, I ran into the concept of virtualenv which most experts school of thought suggest is the best way of developing with Python.

Virtualenv provides you with a sandbox which keeps your global Python installation pristine. The step is real simple. You just need to have virtualenv installed in your system and you’re good to go.

This command will create a venv directory in your current path. Inside you will find 3 sub-directories: bin, include and lib. The bin folder will have your Python executable.

The first thing you have to do is to activate that executable. You can do this in 2 ways:

If you wanted to use Python 3 instead, you can use the –python option and supply with the Python3 value or you can provide the actual Python3 executable, depending on the version which you have:

That’s all she wrote.

Git, big boss.

When I was starting my career in web development, the source code control we were using was Visual Source Safe. Partly because it was the easiest to use that we could find.

Shortly after finding out the limitations of Visual Source Safe, we switched to Visual SVN. The developers were happy making the switch. We were happy campers like the minions but something was still missing.

That’s when TFS took our attention. Our team was growing and so was the cost of licensing our developers with SVN. I was also learning new developers we bring on board are not keen with SVN but guess what? TFS.

So we were happy again, but something was still missing. We got caught up with the creating branches crossroad with TFS. It was more painful than standing on one leg and watching the Chicago Bears loose against the Packers.

Then Gru came along. And with that I meant Git. We found Big Boss!

Git just felt so natural for everyone in our team. We were using it like there’s no tomorrow. We have our senior developers playing the role of masters committing those critical changes to the master branch.

Creating branches was so fast developers were committing to them before the ink dry. Merging changes were also trivial. The features I love the most are cherry picking and switching branches.

In the production servers, our team moved away from creating backup files for rolling back. Staging changes before applying to production paved the way for stable environments.

I think development shops should have a solid source code control management process. Git should be part of the tools you should be evaluating if you don’t have one yet.

In the next post, I’ll share with you some best practices we use in-house to avoid some of the pitfalls of using Git.

If you made it this far, I’d like to share with you the .gitconfig we use heavily in our shop to improve productivity.

Here’s what I love the most:

This code compares the current branch log with the remote origin master branch. Great for comparing differences in the commits.

Enjoy. Hit me up with your comments.

Dig now Curl

You’re a developer yeah or an engineer maybe?  If you answer yes to any of this, you’ve probably used dig or it’s web equivalent Digwebinterface.com.  And if you are into examining HTTP headers, you’ve probably used curl as well.

Wouldn’t it be nice if there’s also a web interface to help you examine headers of your web applications? Let me be the first to tell you that there’s a new site called curlwebinterface.com which actually allows you to do that.

I hope you find this tidbit of information helpful. Enjoy.

Nginx.conf reverse proxy sample configuration

Here’s an example of the nginx configuration I normally use. It includes HTTP headers which are pretty helpful when deploying web servers.

Get Docker and WordPress up in minutes

So almost everyone I know of is working on getting their solution onto Docker. I will not be talking about Docker in here today; there are tons of blogs and published content around that subject.

What I will be talking about is how to fire-up a WordPress website in minutes using Docker.

Steps:

  1. You will need a linux server – I use nothing but Ubuntu 14.04 LTS
  2. You will need to have docker-compose installed in your system. If you don’t have it, you can install it using pip:
  3. You will need to have a docker-compose file. I’ve included mine in here for your reference:
    wordpress:
    image: wordpress
    container_name: wordpress
    hostname: wordpress
    links:
    - mysql:mysql
    ports:
    - "8080:80"
    mysql:
    image: mariadb
    environment:
    MYSQL_ROOT_PASSWORD: a_sophisticated_password_here
    nginx:
    image: nginx
    container_name: nginx
    hostname: nginx
    volumes:
    - ./nginx:/etc/nginx
    ports:
    - "80:80"
    links:
    - wordpress:wordpress
    
  4. If you notice, in my nginx section I’ve added a volumes line. What this does is I’m telling the container to map my nginx directory relative to the current path in the host to the container’s /etc/nginx directory. What my nginx directory contains is just the default files/directories of the nginx image. I just copied them to the host so I can modify it directly. You don’t really have to do this it’s just my preference.
  5. You should modify your nginx configuration related to your new wordpress website.
  6. Once you have everything setup, just run the following command:
    $ docker-compose up
    
  7. This will start up the process of pulling all of the images you have defined in your docker configuration file. Once all images are up, the containers will be started.
  8. Once you validated that everything is working, it’s time to start the docker containers in the background. Exit your current session by hitting Ctrl-C.
  9. Start docker-compose again in background mode:
    $ docker-compose up -d
    
  10. And that’s all she wrote.

I hope you learn something from this and try spinning some docker images on your own. My recommendation, try to spin up a MediaWiki website.

Hit me up with your comments.