Mike Plate

Freelance web and mobile developer

Extract regular expression group match using grep or sed

I've been looking for a GNU/Linux command that matches lines in a text file using a regular expression and extracts a group match for that expression (a sub-match within parenthesis). It would be really handy if the grep command supported this as an output option, but unfortunately it does not. However there are at least two ways to approach this problem. I'll show you one with grep and one with sed. Read more...

2012-05-09

If you want to retrieve a single file from a specific repository without cloning or checking out anything, you can do this:

git archive --remote git@bitbucket.org:myusername/myrepo.git HEAD file-to-retrieve.rb | tar -x

2012-05-04

Rewind master if you forgot to create new branch in Git

My situation in Git was this: I'd continued to work in the master branch and made a few commits when I realized that I should do this new stuff in a separate branch and keep the master where it was several commits ago. Turns out this is very simple to do, but I thought that it was worth a blog post anyway. Read more...

2012-04-21

Work in progress. Bash scripts for automating downloading and building of Nginx with Passenger and more on Ubuntu servers. https://github.com/mikeplate/ubuntu-admin

2012-04-13

Discovered two things about css today: you can turn off table spacing with "border-spacing: 0px" and the default box-sizing for tables differs between browsers, it is "box-sizing: content-box" on WebKit and "box-sizing: border-box" on all other browsers. Note though that box-sizing is not relevant until you set "display: block" for the table.

2012-04-11

Creating a closure in JavaScript

I thought that I knew how closures worked in JavaScript, but then I was bitten by a bug that made me realize I had some more learning to do. This article is the result of that learning. It describes one particular situation where you need to explicitly create a closure  in JavaScript, but I also think it illustrates closures in general. Read more...

2011-11-24

Linux file permissions to only delete owned files

Coming from a Windows background, I was surprised to find out that when it comes to Linux file permissions, a user can delete a file that they don't own and have no write permissions to. Well, that is the default behavior if you don't set up your ownership and permissions exactly correct. Find out how here. Read more...

2011-11-18

Making web site certificate work for Android

I installed a web site certificate called GeoTrust QuickSSL from http://cheapssls.com on a site of mine. That wasn't too hard I think. Everything looked fine when I tested it on my desktop browsers. However inside of the Android emulator (version 2.1 and others) and also on my newest Android device (running 2.3.5) I got a warning that the certificate wasn't trusted. Read more...

2011-11-16

Change virtual console resolution on Ubuntu

When installing Ubuntu Server 11.10 on my Windows-hosted VirtualBox the default console resolution is very small (640x480 I think). But changing it is very easy. Read more...

2011-11-08

Stop http.sys from listening on port 80 in Windows

On Windows 7 there is a system service called http.sys that listens on port 80. That makes it impossible to run applications and services that haven't been integrated with this feature to also listen on port 80, like Apache HTTP Server or Nginx. Here is one way to solve that problem. Read more...

2011-11-06

Nginx configuration for making sure no directories or files starting with an underscore (_) in root can be downloaded from the web server: location ~ ^/_ { return 404; }

2011-10-20

Nginx configuration setting to automatically map subdomains to subdirectories: server_name ~^(.*)\.mysite\.com$; root /srv/www/$1;

2011-10-18

Reorganizing commits in Git branches

It may take some time digging around the Git commands to do exactly what you want. I had a situation where I've gone too far in a version branch and needed some reorganization. This is a short description of what commands I ended up running. Read more...

2011-04-13

Beauty of Vim key combinations

I can't yet say that I prefer Vim for editing text files in all situations. But I can say that I like it enough this far to continue on improving my Vim skills. One of the beautiful aspects of Vim is how keyboard shortcuts can be combined and this article describes some of those combinations. Read more...

2011-01-23

Bash script to copy permissions

This is a bash script that I've used on Ubuntu in order to copy the permissions from a file or directory, onto the whole structure of another directory. I've found that this is something I like to do quite often and wanted some automation for this operation. Read more...

2010-12-04

Install Android development environment on Windows 7

About a year ago I wrote a blog post about how to get started with Android development on Windows. At lot of new versions has been released since then, even though the basic packages needed are the same. This is a recap of what to download and how to set it up in order to develop Android applications on Windows 7 (64-bit). Read more...

2010-11-01

CSS3 Playground

The CSS3 Playground is a web application for experimenting with some new css3 capabilities. Primarily those than conform to the progressive enhancement philosophy, which means that the styles can be used on all sites without severely changing/limiting the experience on browsers that does not support them (=Internet Explorer 8.0 and older). But there are also styles that may need better replacements on Internet Explorer such as rotation, and I hope I will have the time to add more in the future. Read more...

2010-07-28

Scandinavian Web Developers Conference Day 2

This is a short summary of the talks during the second day of Scandinavian Web Developers Conference in Stockholm, June 3, 2010. Please note that it is a very short summary with abbreviations and contexts that might only make sense to me (if even that). Read more...

2010-06-07

Scandinavian Web Developers Conference Day 1

This is a short summary of the talks during the first day of Scandinavian Web Developers Conference in Stockholm, June 2 2010. Please note that it is a very short summary with abbreviations and contexts that might only make sense to me (if even that). Read more...

2010-06-02

Show a context menu for long-clicks in an Android ListView

Coming from a Windows and .NET background, I had some trouble understanding how to interact with the ListView control and context menu creation in Android. Context menus are supposed to be shown on your mobile device when you touch/click the screen and hold on for a longer time. So here is how to determine which item is long-clicked and how to show a context menu for it. Read more...

2010-01-21
Older
Twitter: @mikeplate