So, I previously blogged about how we hosted CraftCMS on Heroku. When we built the marketing site for Quala the twig templates were built for maximum authoring flexibility at the cost of some TTFB problems. We knew this going into the project. In an ideal world we would use GatsbyJS to build the frontend, but we very limited in time. When we went live, we saw a dramatic improvement to First Contentful paint, but a huge decrease to Time To First Byte, averaging at 1.3 seconds.
So, incase you are unfamiliar, there is a meta tag called
<meta name="theme-color" content="..."> that is used to change the color of the navbar on desktop safari, mobile safari, and mobile chrome. If you don't set a value these browsers tend to find a color that match the site to the best of their ability. However, sometimes even setting the value can cause the site to look ugly.
So I've been using monorepos for some time, and recently I've gotten a lot of questions about how to host them on Heroku. I figured I'd give you the simple guide. There are two basic scenarios. The root of your git repo has your yarn/npm workspace, or you have a folder inside of a gitrepo you wish to use.
Turborepo is a tool that came across my virtual desk recently. Monorepo develoment has been around for a long time. This is a strategy where all of your code remains in one repository regardless of services. A lot of people use monorepo's even for microservices. The huge upside is to keep everything in one place, which allows for development efficiency, such as grepping an entire codebase for specific keywords. A quick example would be a top level directory which has child directories that each contain an npm package, unlike publishing these packages, you access them locally as though they were published.
For many of us a JS workspace is the simplest way to structure code for future growth while providing very quick iterations. Incase you are unfamiliar, several technologies exist such as
npm workspaces, etc. That can seamlessly stitch npm packages on disk as though they were published to a private NPM registry. This allows for fast iteration inside of a single git repo, while allowing a future where these dependencies could be abstracted.
I've been getting back into building scrappy little web apps for my friends. On top of this, I recently joined a startup and getting away from Enterprise class software has made me make a huge mind-shift. In the recent past when I wanted to build apps I was thinking Kubernetes, Helm Charts, etc. However, in small app, and startup land reducing the barriers to ship is very important.
I've been working at CarGurus.com for the last 2 years or so. One of the biggest journeys we've been undertaking is to take accessibility far more seriously. However with an engineering team way into the triple digits it gets harder and harder to scale accessibility knowledge.
I've had a lot of people ask me about my choice of editors, and plugins. A while back I switched to vscode for all my programming work, for both front and back end. In the past I've blogged about the best plugins for visual studio as a backend dev, but I thought I'd give you a more front-end angle
Back in August of this year Microsoft announced static websites for azure blob storage. So this is the same feature AWS' S3 has had for years. Essentially make a blob storage folder public, and redirect
/ paths to
/index.html internally. Also, register 404 pages. Before we had this we use to deploy our files to
App Service or do some weirdness with functions to rewrite urls. For static pages this can really bring costs down in the cloud
In case you haven't notice, this blog has not gotten updates much this summer. Some people have even noticed the overall lack of activity on my GitHub. Emails have gone, several weeks unanswered.
Here we are, its 2017 dotnet core is out, and finally dotnet has a proper cli. In a previous post we explored the new cli. In short you can use the dotnet cli to build, test, package, and publish projects. However sometimes just using the cli is not enough. Sometimes, you land in a place where you have many projects to compile, test, and package.
When Visual studio 2015 launched, I wrote a blog post titled Resharper without Resharper. This was clearly aimed at giving people the ability in 2015 to divorce themselves from the very expensive product. In writing the post however, I didn't realize people would just want a low down on cool vs2015 extensions.
So now that Windows server 2016 is generally avalible for the first time ever windows users can now use containers. Ok, so what exactly are containers? Well more or less they are virtual operating systems that share the same kernel as the host OS. In regular VM's the hardware is shared between machines, but containers go a step further and share the kernel of the OS. Why does this matter? Well because you are sharing an existing kernel that is already running, your startup times are instantanious. To put this in perspective, this is virtualization at the OS level.
On Linux, containers have been a thing for a long time. This technology is called LXC. Docker itself is a layer ontop of various container platforms embedded in operating systems.
For a while now I have been playing with rails, and rack webapps. If you are not familiar with these, they are webservers created in ruby. One of the features I ran into during my journey into ruby land is Turbolinks. Incase you are not familiar, Turbolinks is basically a simplified pjax, with a lot of flexibility. When you click on a link in a page with turbolinks, the link action is hijacked and the target page is loaded via ajax. The result of the ajax call (which is presumed to be html) will replace the document of the body tag. At the end of the day its a technology to load your server side pages via ajax.
Recently I have been working on an application that basically has a github bot (aka user) fork a repo, commit some files, and submit a PR against someone's repo. When it came down to actually making a new git commit through the github API, I had quite a hard time. I figured it out with some help from a ruby tutorial, and now I'm going to show you how to do it.
I spend much of my time at Vistaprint just being a normal developer. In fact its over 75% of what I do. I am a Web Developer, however with my background in ops I have spent more and more time at Vistaprint doing configuration management, and coaching other teams how to approach the subject.
I recently ported my ghost blog to hexo, and it was pretty easy.
Checkout my other hexo blogs:
Getting Started with hexo
To get started with hexo run the following commands:
npm install -g hexo-cli
This will drop many files, and folders. The primary one we are going to talk about is the
_config.yml. You will want to start by filling out the
_config.yml file. Name your blog, give a descripton, etc.
Porting your blogs over
To get your data over you will need to go to this url:
http://yourblog.com/ghost/settings/labs/ and click the export button. Place the json file at the root of your hexo blog, then run.
npm install hexo-migrator-ghost --save
hexo migrate ghost NameOfYourExportFile.json
Your posts should drop in the posts folder, but the tags will need fixing. Open atom (or another editor that can do find replace in a directory) and replace
tags: | with
tags: in all the files.
Now that it is done we need to fix the paths to your images. Download your images (if you are using
azure you can get them via ftp), and place the folder in the source directory.
hexo server, browse to port 4000. Your blogs should appear.
Backward compat. urls
We need to make some modifications to make sure the urls are backward compatible.
Set the tag_dir to tag, in ghost the path to tags is /tag.
if your post urls were just /Title then put
:title/ in the permalink setting. Otherwise adjust the urls for the proper date format.
You will want to have an rss feed. You will want to
npm install hexo-generator-feed --save
You can then add the following to your config.yml
feed: type: rss2 path: rss limit: 0
If you were like me you registered your ghost rss feed to
/rss.xml. I have no perfect answer to fix this, but I used azure's Url redirect to redirect
<configuration> <system.webServer> <rewrite> <rules> <rule name="SpecificRewrite" stopProcessing="true"> <match url="^rss$" /> <action type="Rewrite" url="public/rss.xml" /> </rule> </rules> </system.webServer> </configuration>
If you are using github pages you can use the
If you have read this blog for any length of time, you know I am a fan of Azure. I thought about using github pages with hexo, but github pages only supports 1 doman name. I could start 301 redirecting my other domains, but I really didn't want to do that.
One feature that I think is highly under-documented in the C# MVC framework is custom
By simply making folders in your views folder called
EditorTemplates you can use the
EditFor(a=>a.TypeHere) with any custom types you so choose.
I was exploring around github, and I stumbled upon an interesting project called Miniblog which was a lightweight blog engine written in c#. The thing that immediately stood out to me was the lack of a
As I dug around the code I realized this was not a Web App, which most of us were familiar with, but a websites project. I then suddenly realized that the whole thing only used razor!
I am a huge fan of Nancyfx because its much more lightweight than the MVC framework created at Microsoft. To say the least I am a massive fan of small tools, and micro frameworks. So when I realized this whole thing was powered by razor only I was immediately impressed.
I decided to dig around on the internet to see if anyone else was talking about this. I found out quickly that it has been possible for some time, but I didn't find many references about it.
The one thing that bummed me out about the Miniblog example was that it was not a web app. You can use nuget packages will websites, but you cannot make references to other projects in the solution. This was a problem for me, and unlike websites, web app's are precompiled which reduces application startup time.
I have used Linode for quite a long time now. My blog was hosted on linode, as was my StarBound server. My linode was the CentOS Pet I always wanted. Full of manual Fail2Ban configs, I make sure I fed my VPS every day. I even used cowsay to give me a cool message from my pet every login.
The major reason I moved my things away from Linode, was not the devops story itself. I could have stuck with linode, and used chef or something to manage my former friend. I decided to host everything in Azure Web apps. Now before I give you my long ramblings why I like azure; I must tell you. I put everything in azure, because my MSDN gave me free credits. There was no huge scientific analysis behind this. The simple fact that I got free money in Azure was the only reason why I started using it.
Github has become the defacto online source hosting provider. More projects than ever before use github, and it has become a predominate force in the open source community. I use github quite a bit, and I love it.
In the old days, when programming in .NET you were signing yourself up to a lifetime of windows server, however things have changed.
Ok so to give you all some background. I always write my data access with a repository pattern in c#. Now I often use dapper, however I'd guess this problem would also apply with Entity framework.
Day 2 was full of math based paranoia, math, and puppet(s)....
SquishIt is a content bundler and minification tool. The github documentation contains exaples how to install and use it, and a sample application is provided. However I had some issues getting it to work with razor so I figured I would share these pain points with you.
Interested in Interstital ads, but not banner? Thats ok, but I recommend your read my first post about banner ads. The first steps, installing Google Play Services, altering your permissions, adding to your manifests files, and reviewing my github demo are located in that tutorial.
This will be a brief overview on how to get admob working with Xamarin.
I highly suggest you run this on a real phone. I'm not sure if the virtual phones can load content on the internet. I always develop on a real phone.
Sample code located in a repo at github
The standard way to get/set SharedPreferences in Xamarin is with the following code.
var shared = con.GetSharedPreferences(_preferenceName, FileCreationMode.WorldReadable); var value = shared.All.Where(x => x.Key == key).FirstOrDefault().Value;
var shared = con.GetSharedPreferences("PreferenceName", FileCreationMode.WorldWriteable); var edit = shared.Edit(); edit.PutString(key, val); edit.Commit();
The main issue I have/had with this is you often have to know what will be returned, and what type you need to save as. Usually this isn't difficult, but it adds an un-needed level of complexity.
The other major issues I have with this, is that it is quite verbose, and unnecessary. The code duplication here can be quite high.
To install on CentOS follow these instructions.
Xamarin is a very good platform, but like everything it has parts that are not so great.
One thing that was really hard for me, was to find documentation that was newer than 2012. Android has made great strides with Ice Cream Sandwich, and Jelly Bean. New features such as fragments have breathed life into the platform.
The Xamarin documentation provides examples even with the newest features, but there is something about it that feels lacking. Almost like it was thrown together at the last minute. They have been doing webcasts to improve the knowledge out in the wild, but googling the answer to your problem just won't do. Part of the problem is that most developers write in Java, and only bigger companies can afford the hefty license fees that come with full support.
The user community was helpful at times, but I often found myself wandering though GitHub hoping my answer could be found in some mystical repo; Eventually having to study the full implementation to find the answer I needed.
Although Xamarin has a forum where helpful users help each other, there are not nearly as many people coding on Xamarin than regular Java. Figuring out how to get something complicated working, was a nightmare. I'd look at a Java implementation, and then try to translate it into its Xamarin counterpart, which sometimes was far removed than the Java code. There are some examples of Xamarin for android out there, but nothing that really delves deep into manipulating the inner workings of the phone. I saw this especially when trying to edit contacts programatically. Xamarin support seemed helpful, but far too expensive for most freelance developers. This was a pretty huge put-off. If I went the Java route my questions would be answered with a simple search of stack overflow.
Like most things Java, Android requires a lot of boilerplate. For a developer like myself, whom avoids Java this was a problem. I would have thought that Xamarin would have abstracted out more of the boilerplate than they did. On the one had, having my code look somewhat familiar when I see Java examples was nice, but on the other hand because the API is still different often the Java versions would not be close enough to fully help. My main problem with this, is if I really wanted to write boilerplate I would have used the Java libraries myself. They did make a start for this by generating the manifest file automatically, but I feel it needs to go further to fully mature this platform as a viable alternative to Java.