Posted: May 13th, 2011 | Author: Matt | Tags: .net, development, regex, snippet | No Comments »
string output = Regex.Replace("String 2 Parse 4 Non Numerics", "[^0-9]", string.Empty)
In this case the variable “output” will hold the value “24″
Posted: October 19th, 2010 | Author: Matt | Tags: development, dreamhost, svn | No Comments »
I’ve recently started working on some mobile web development ideas and decided it would be easiest for testing to have a continuously integrated public development site which I can hit directly from my Android smartphone for testing without the hassle of an emulator. The chrome-to-phone browser/device extensions out there make switching back and forth between testing locally in full-scale chrome as well as on my device a breeze.
Plan established, the only real unsolved angle of this for me was finding a way to get a public copy of my source online that would be updated instantly when I commit to my repository. I have been using Dreamhost for some time because of their awesome rates and unlimited SVN hosting that comes with my web-hosting package. As I have now discovered, setting up post-commit scripts on Dreamhost’s servers to perform CI tasks is not very difficult and can really maximize productivity once established.
Installed on my local dev environemnt
- OSX
- MacVim
- Chrome
- use chrome-to-phone plugin for easy android based testing
- or for iphone try http://tomlerendu.com/chrometoiphone/
- SCPlugin
- Pretty basic but free SVN client for mac
- EasyFind
- One shortfall of VIM is the lack of global project searches. This great little app takes care of that quite well.
Remote hosting, source control & build server
- Dreamhost is the way to go
- unlimited SVN hosting
- unlimited domains and subdomains
- SSH access
Setting up continuous integration w/ Dreamhost
- create your SVN repository from the http://panel.dreamhost.com admin site.
- usually somthing like… svn.mydomain.com
- create a domain or subdomain on which to host the dev version of your web project
- usually somthing like… dev.mydomain.com
- checkout the trunk of your svn repo locally on your mac using SCPlugin
- ssh into your dreamhost account via mac terminal
- checkout the trunk of your svn repository into you new dev project sub-domain
cd /home/dreamhost_user/dev.mydomain.com
svn co --username your_svn_user --password your_svn_pass http://svn.mydomain.com/trunk ./
- create a cgi-bin folder under your new CI dev domain
mkdir /home/dreamhost_user/dev.mydomain.com/cgi-bin
- add the following .htaccess file to your new cgi-bin
AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /home/dreamhost_user/dev.mydomain.com/cgi-bin/.htpasswd
Require valid-user
- create a htpasswd file
cd /home/dreamhost_user/dev.mydomain.com/cgi-bin
htpasswd -bc .htpasswd username password
- add the following file called “do_update.cgi” to your cgi-bin folder
note: this is where all your other fun CI stuff can go. For example maybe you want to rake db:migrate if you are working in rails. In this example we’re simply doing an svn update.
#!/bin/sh
set -f
echo "Content-type: text/plain; charset=iso-8859-1"
echo
svn update /home/dreamhost_user/dev.mydomain.com
- set permissions on your shiny new cgi-bin setup
chmod 755 -R /home/dreamhost_user/dev.mydomain.com/cgi-bin
- create a file called “post-commit” at the location /home/dreamhost_user/svn/repo_id/hooks/post-commit
- add the folowing to the “post-commit” file
note: you’ll be using the username and password you setup in step # 8
#!/bin/sh
wget --http-user=user --http-passwd=pass -qO - http://dev.mydomain.com/cgi-bin/do_update.cgi
- make post-commit file executable
Posted: January 31st, 2010 | Author: Matt | Tags: android, development, mobile | 2 Comments »
Shortly after purchasing my Droid I noticed an under-served niche in the Android Market after my app search for “Democracy Now” turned up empty. Some quick google searching took me to forums where others were also bummed with the lack of easy access to Democracy Now video casts from their Android devices.
More recently, I stumbled across some interesting technologies this past week and things just kind of fell in place for the development of an Android app that will stream daily Democracy Now newscasts via the native Android media streaming capabilities. I was able get the initial beta of this application developed, tested, and up on the Android Market in just over 8 hours. After less than 48 hours on the market I have almost 100 users who have installed the app.
I must say, Android development has left a good taste in my mouth thus far. Thanks Google, for allowing a guy who had an app, that people apparently wanted, to get everything developed and available on the public Android Market with such ease and quick turn around. This level of openness and quick time to market will allow the Android Market to grow rapidly and hopefully eventually outshine it’s more restrictive competitor in Apple’s App Store.
How do I get the app?
If you have an Android device, just search for “Democracy Now” on the Android Market. The app is lightweight, simple, and free, so download and enjoy with moderation (if you are like me, one to two Democracy Now! broadcasts per week is depressing enough – yet necessary).
Technologies Used
Big ups to the amazing platform that the folks over at phonegap.com have put together. Phonegap has an android project template that allowed me to write my native android app with HTML, CSS and Javascript, essentially a web app that can still take advantage of native application niceties like cross-domain AJAX requests, and device specific APIs (i.e. Accelerometer, Geo Location, ect).
I was also able to make use the the very nice jqTouch library to throw together a quick UI for this app.