Running ASP.NET MVC via DNX on Ubuntu 15.10

My steps I did to get my ASP.NET MVC application I created on my Windows 10 box running on a Ubuntu 15.10 server.

Setup ASP.NET 5 on Ubuntu following this:
http://docs.asp.net/en/latest/publishing/linuxproduction.html
http://docs.asp.net/en/latest/getting-started/installing-on-linux.html

Update dnvm on windows:

dnvm updateself
dnvm upgrade -r coreclr

Fix the libicu for Ubuntu 15.10:

wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-8ubuntu0.2_amd64.deb
dpkg -i libicu52_52.1-8ubuntu0.2_amd64.deb

Say the web project is “WebApplication1” then console into that folder:

dnu publish
dnx web

Hit localhost and make sure the page load.

Copy the entire “WebApplication1” folder to linux box.
Restore the packages from the “WebApplication1” folder copied to the linux box:

dnu restore
dnx web

Enjoy!

Creating a full MariaDB backup

For some reason I have had a time finding succinct information on creating a simple full (and by full I mean a file you can use to bare metal recover a database) backup with MariaDB.

1. Make a ~/.my.conf file:

[mysqldump]
user=<your_database>
password=<your_password>

2. Run this:

mysqldump --add-drop-table -h server_ip database_name  | pv | gzip -9 > /tmp/backup.sql.tar.gz

3. Copy your newly created backup file to a secondary storage point.

4. Enjoy!

Splitting CUE/Log Flac Files

I ran across some old FLAC files I ripped and for some unknown reason I decided at the time that a the FLAC LOG/CUE format was the way to go. I dunno perhaps I was intoxicated at the time.

At any rate is what I used to split the single FLAC out into files.

Install the necessary tools (this is Pacman which I use on my Manjaro box):

# pacman -S cuetools shntool flac mutagen

Split out the giant FLAC file into smaller track FLAC files:

$ shnsplit -f cue_file.cue -t "%n %t" -o "flac flac -s -8 -o %f -" flac_file.flac

Then this populates the id3 tags in the newly split out FLAC files from the CUE file:

$ cuetag.sh cue_file.cue *.flac

Enjoy!

Error With Pip and flask-bcrypt

I am playing around with Flask and I wanted to use the Bcrypt tool to encrypt my users passwords. So like all the other packages I attempted:

pip install flask-bcrypt

That however resulted in this rather unpleasant error:

  error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).

  ----------------------------------------
  Failed building wheel for python-bcrypt

That of course sent me on a dizzying hunt for resolution. I got it working by editing the “msvc9_support.py” file to not use the registry and use just the path where I found vcvarsall.bat on my computer:

   productdir = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC" # Reg.get_value(key, "installdir")

Elegant? Eh probably not, Utility? perhaps. But it does work and after that I was able to install flask-bcrypt.

VSLive San Francisco 2015

I was able to attend VSLive in San Francisco this year including the Pre-Conference (yes nifty indeed) hosted at the historical Fairmont.

Here are some of my notes/observations/snotty comments:

  • Open source licenses are complicated and if you have deliverables in the enterprise you should NOT use copyleft licenses as you are legally bound to re-release under that same license your additions on top or using the original copyleft material. Focus on more Permissive licenses (like Apache, BSD, MIT) to avoid potential hassles.
  • Microsoft really, REALLY loves Azure and wants you to 100% do everything in it. It was communicated that their reasoning for Open sourcing .NET was to promote “Any Developer, Any App on Any Device” – of course all using Azure offerings.
  • PowerShell was a reoccurring theme across sessions from deployments to testing.
  • San Francisco is a wickedly expensive place to visit. When the locals say “oh its only four blocks” be warned those four blocks are likely at 45° inclines and are meant to weed out the weak.
  • It appears to me that most of the attendees don’t keep up during the year and use these conferences to catch up. My personal reason was to re-enforce that what I have learned and practiced on the technologies covered are correct and optimal. I can honestly say that about 80% of the material covered was review.
  • I think its interesting how most developer types are very anti-social and these conferences continually try to “socialize” these sorts together. What winds up happening more often than not is groups of geeks sitting at a lunch table not a single person saying anything; absolute awkward silence. I attempt start up conversations and they usually end with a single “yep” or “nope” type response.

Notable Quotes from Sessions:

  • “Trading velocity for quality will lead to technical debt” – Hundhausen
  • “Routinely have a HARD Conversation with shareholders – Honest, Appropriate, Respectful and Direct” – Hundhausen
  • “Always follow the Boy Scout Rule; leave your code better than you found it” – Hundhausen

List of the sessions I attended:

  • Pre-Conference: ALM and DevOps with the Microsoft Stack – Brain Randell
  • Keynote: The Future of Application Development – Visual Studio 2015 and .NET 2015 – Jay Schmelzer
  • UX Design Principle Fundamentals for Non-Designers – Billy Hollis
  • Cloud or Not, 10 Reasons Why You Must Know “Web Apps” – Vishwas Lele
  • Mobile Apps for the Javascript Developer with Apache Cordova – Subhag Oak
  • Build Data-Centric HTML5 Single Page Applications with Breeze – Brian Noyes
  • To Git or Not To Git for Enterprise Development – Benjamin Day
  • What’s new in C# 6.0 – Jason Bock
  • Microsoft’s .NET is Now Open Source and Cross-Platform. Why it matters – Mark Rosenberg

 

San Francisco Google Awesome-ness

I was in San Francisco and I took these from the Crown room on the 24th floor of the Fairmont hotel. I have all my phone pictures backed up via Google and Google Awesome, was well pretty awesome and made these panoramic views from several pictures I took next to each other. Sure they are a bit grainy (they are from my Samsung G4 be nice) but you can see Alcatraz, Fisherman’s Wharf and Golden Gate bridge.

20150616_163112-PANO

This is the other side I dunno what is noteworthy over here but I thought the shipping container ships were interesting to see out in the water.

20150616_163303-PANO

Enjoy!

Setting up WordPress FavIcon

I wanted something a bit more custom looking than the stock WordPress Icon so I decided to take my avatar and make a favIcon from that.

I went to Favicon-Generator it does a nice job of resizing and making the “ico” file, which is pain to create, and gives you several varying sizes of your uploaded image:

favicon_generated_set

It also does a nice job of creating the html to include in your header. I only used a subset from the generated html:

<link rel="icon" type="image/png" sizes="192x192"  href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">

I created a child theme in Word Press then edited the header to include the above in the <head> block.

Enjoy!

ASP.NET MVC 5 Preview

Managed to get ASP.NET 5 preview up and working via Visual Studio 2015 RC in a Docker container hosted on my local Ubuntu server (read; not an Azure hosted server). All in Oracle VirtualBox Virtual Machines.

ASP.NET 5 Preview Running on a Local Docker Ubuntu VM
ASP.NET 5 Preview

My VirtualBox host is a Windows 8.1 box and I used two VMs: a Windows 7 Development Box (I tried Windows 8.1 in a VM and the performance was terrible) and a Ubuntu Server 14.04.2.

For the most part it was pretty much documented here. My only hiccup was that I had to do a “Restore Packages” to get Grunt to install its packages, this didn’t happen with a “Rebuild” as I would expect. I set my “Custom Docker Host” settings like this:

Custom Docker Settings For Publishing To Docker Server
Custom Docker Settings

After publishing from Visual Studio I was able to get a list of the images on the Docker server and it now included the new published app:

{
    Created: 1432561734,
    Id: "0ad5302ad774376604042790713f79ffa98fceca9826159bcd93b1e20dfce552",
    Labels: {},
    ParentId: "becb4b73fe255ab7284cfdcf3f5768520736317cd5f0456bf169bb9f441763d3",
    RepoDigests: [],
    RepoTags: [
        "helloworldweb1:latest"
    ],
    Size: 0,
    VirtualSize: 756665995
},

So the next challange is to get MongoDB setup running in a Dockerized instance on my Ubuntu server then create a ASP.NET MVC application consuming that server and publish that via Docker and see how performance and maintenance plays out.

 

ASP.NET 5 on Ubuntu on VirtualBox

I figured out the magic sauce for getting ASP.NET 5 running on Ubuntu 14.04 in a VirtualBox VM.

asp_6_on_ubuntu_vm

I followed this mostly for the setup but your Dockerfile should look like this:

FROM microsoft/aspnet

COPY project.json /app/

WORKDIR /app

RUN ["dnu", "restore"]

COPY . /app

EXPOSE 5004

ENTRYPOINT ["dnx", "project.json", "kestrel"]

Be sure and set your VirtualBox setting to “Bridged” so you can hit the IP from your workstation.

Enjoy!

Blog Setup

Hopefully this will be a start of something new and exciting – or another thing for me to procrastinate about. I have tried several times before to blog consistently I just get, well, sidetracked.

My intention is to blog stuff that I don’t want to forget or stuff that I want to share. Most things I would expect to be of a technical nature but I suspect that sometimes I will want to post something for the ages to remember my wit and wisdom (read; me ranting about something inconsequential).

Enjoy!

Ramblings of an often confused opinionated yak shaver.