ServiceStack Request Filter to Require Secure Connection

This code snippet provides a Request Filter to make sure your ServiceStack services are being called via HTTPS.  If not, it returns a 403 code.

public class SecureRequestFilterAttribute : Attribute, IHasRequestFilter{    public IHasRequestFilter Copy()    {        return this;    }    public int Priority    {        // https://github.com/ServiceStack/ServiceStack/issues/119        // By setting priority to -100, this filter will be applied first.        get { return -100; }    }    public void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)    {        // https://groups.google.com/d/msg/servicestack/7JnQ8eLf36M/JFx2g7xEeEkJ        if (!req.IsSecureConnection)        {            res.StatusCode = (int)HttpStatusCode.Forbidden;            res.Close();        }    }}

Comcast remote not working with the cable box

Today we went to exchange our Comcast remote controller.  The new one was supposed to “just work” with the Comcast cable box.  But it didn’t.  We followed the instructions on the Comcast web site (removing the batteries and putting them back in, etc), but that didn’t work either.

After searching the web, I found this post (http://www.remotecentral.com/cgi-bin/mboard/whichremote/thread.cgi?398) which worked like a charm. 

This is the list of steps that I took to make the remote work:

  1. Unlock the remote
    1. Press “CABLE” button
    2. Press and hold “SETUP” button until “CABLE” blinks twice
    3. Type 982
    4. The “CABLE” button should now blink four times.
    5. “If it blinks twice, that means it was unlocked and now is locked, and you need to do the step above again to unlock it again”
  2. Program the remote to work with the cable box
    1. Press “CABLE” button
    2. Press and hold “SETUP” button until “CABLE” blinks twice
    3. Type 01376
    4. The “CABLE” button should now blink twice
    5. The remote should now work

Thanks to Kupakai and superhooper!

Ubuntu libjpeg.(a|so) not found

I recently installed Ubuntu 11.04 32 bit  on my old laptop.  I wanted to get PHP + nginx going, so I was following this page: http://bestsiteinthemultiverse.com/2011/01/installing-nginx-with-php-fpm-on-u…

After installing nginx, I tried to install PHP but ran into these errors:

configure: error: libjpeg.(a|so) not found.
configure: error: libpng.(a|so) not found.

I was able to fix the first one by installing libjpeg8-dev via

sudo apt-get install libjpeg8-dev

But I couldn’t fix the PNG issue.  After searching around the web I found this post: http://www.nigeldunn.com/2011/05/14/ubuntu-11-04-libjpeg-so-libpng-so-php-ins… which was very helpful.  Since my server is 32 bit, all I had to do was switch the path.

ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/libjpeg.so
ln -s /usr/lib/i386-linux-gnu/libpng.so /usr/lib/libpng.so

Voila!

Hamachi

Recently my friends and I bought a copy of Age of Empires III: Complete Collection for $0.10.  That’s right: 10 cents!  (Thanks SlickDeals!)

But we ran into problems trying to connect to each other.  We each could log onto the EOS network and join other people’s games.  But for some reason we could not join each other’s games (either us hosting or third party hosting).  The LAN mode did not work at all.

Hamachi to the rescue!

“LogMeIn Hamachi² is a hosted VPN service that securely connects devices and networks, extending LAN-like network connectivity to mobile users, distributed teams and business applications. You can easily create secure virtual networks on demand, across public and private networks.”

Hamachi was simple to set up.  The downloading time was actually the lengthiest part (which was not that long).  We downloaded the software.  I set up our network, and gave my friends the name and password.  And within minutes we were playing the game in LAN mode.  w00t!

How to turn off Ubuntu Server laptop screen

I set my old Dell Inspiron 8100 laptop* to run on Ubuntu Server.  Everything was running fine except one problem.  The OS would go into screen saver mode, but the screen would never turn off.  After some searching I found this [http://ubuntuforums.org/showthread.php?t=1097503] posted by 2buntu:

(run while SSH’ing into the server)
1. sudo apt-get install vbetool
2. sudo vbetool dpms off
3. sudo vbetool dpms on
4. sudo vbetool dpms off

voila! The screen is off.

VirtualBox – WiFi Limited Access

Yesterday I tried connecting to a new WiFi network. ??I entered the password and connected to the router fine. ??But I got this message:

Limited Access
IPv4 Connectivity: No network access
IPv6 Connectivity: No network access
Media State: Enabled

This is because the wireless connection doesn't have a valid IP configuration. ??Luckily this was on my new laptop (HP dm4t) and I hadn't done much to it, which allowed me to easily narrow the possible culprits down to VirtualBox. ??It turned out that the VirtualBox Host-Only Network had priority, not allowing my WiFi connection to get the correct IP. ??

The solution:??
  • disable the VirtualBox Host-Only Network
  • restart
  • connect to the WiFi network
  • reenable the VirtualBox Host-Only Network
  • restart
Voila! ??Everything's back to normal.

SSH to VirtualBox Guest OS

My host OS is Windows 7 Home Premium.  I’m running Ubuntu Server 10.04 on VirtualBox.  This is how I set it up so I can SSH into the guest OS.

The main thing is to modify VirtualBox to forward packets from the host to the guest.  On a Windows machine, the path to VBoxManage might not be set.  If not, you can find it in your VirtualBox installation folder.  My default is: C:Program FilesOracleVirtualBox.

# add new values [1]
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort” 10022
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort” 22
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol” TCP

VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/nginx/HostPort” 10080
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/nginx/GuestPort” 80
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/nginx/Protocol” TCP

# delete by not specifying the value
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort”
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort”
VBoxManage setextradata “Ubuntu Server 64-bit” “VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol”

# see existing values
VBoxManage getextradata “Ubuntu Server 64-bit” enumerate

– “Ubuntu Server 64-bit” is your guest OS name in VirtualBox.
– “e1000” name of virtual network adapter: pcnet for PCnet-FAST III, e1000 for Intel PRO/1000 MT Desktop, and so on [2]
– “ssh” is arbitrary name you can use
– “10022” is the host OS’s port being forwarded.  Should be 1024 or higher.
– “22” is the port that the guest OS’s SSH is listening on
– “TCP” is the protocol
Once this has been added, restart the guest machine (close it and restart, not simply reboot) so it can load the new settings.  Voila!  you can now SSH into your guest OS.

sources:

name.com got back to me

I read a few stories on the internet where somebody got some bad experience with some company and blogged about it.  Then said company responded.  I never thought it would happen to me.  I was wrong.  

In my previous post, I wrote about my experience with name.com‘s support (or lack thereof).  Today the post received a comment from Lesley Yarbrough, a name.com‘s Community Manager.  I also got a call from Scott from name.com.

After talking for a bit, Scott said that name.com did not offer subdomain forwarding.  He also apologized for the issue regarding my earlier post.  I offered to forward him the emails; maybe they can figure out where those emails went.  Since I didn’t receive any failed delivery notices, those emails must have gone some where.

The original complaint was not about the subdomain forwarding, but rather the lack of response from name.com‘s support.  It looks like they never received the emails from me.  If that’s the case, then it’s understandable that they didn’t reply.  But the question they still need to figure out is why they didn’t get the emails that I sent (to support@name.com).

So… I got my original question answered.  I am impressed with their effort of finding my blog and getting back to me.  

All in all I am back to being a satisfied customer.

name.com no response

Last time I wrote about my switch from GoDaddy to name.com.  The process wasn’t as smooth as I wanted it to be.  Though it wasn’t so bad.  The issue was on name.com‘s side, but GoDaddy’s support was actually pretty good and helped me out.

Recently I wanted to forward some sub domains.  I couldn’t find the instruction any where on their website.  So I decided to email their support@name.com.

Hi, how do I forward subdomains?  e.g. say I own example.com, I would like 

After three days of response I sent them another email.

No response?

It’s been over two weeks and still no response from their support.  The issue I wanted help with was a minor one (I even forgot about it for two weeks).  But the main problem I have now is their lack of response to their paying customer.  
This is strike one for name.com in my book.

Transfering Domain Names

I've been using Go Daddy for some time now. ??For the most part, their pricing was the only thing keeping me there. ??I really disliked their UI. ??Every time I tried to change something, I had to double and triple check to make sure nothing was added/changed by accident.

Recently Alex registered his site (http://www.thegilfamily.com/) with name.com. ??Their UI was much cleaner and simpler. ??Everything was straight forward. ??The pricing wasn't the cheapest, but it was competitive.

Today I decided to transfer three domains from Go Daddy to name.com. ??Two names transfered without a hitch. ??But unfortunately one ran into a few problems. ??First off the authorization code from Go Daddy for this problem name contained two percent signs (%). ??Name.com didn't like it and said the code was invalid [1].

I called up Go Daddy customer service and talked to Lisa. ??She spoke fluent English and was very understanding. ??She changed the code and resent it to me. ??The new code contained two ampersands (&) (in the exact same places as the %s). ??I gave it a try. ??Still, Name.com rejected it. ??Lisa changed the code and resent it to me again. ??This time the code contained two open parenthesis ((). ??Fortunately Name.com decided that the code was valid. ??(Note: I give thumbs-up for Go Daddy's customer service.)

The next step in the transfer was also problematic. ??For one of the domain names, I had set the admin email to myemail+godaddy@gmail.com to take advantage of gmail's filtering system. ??But name.com didn't like that either and stripped the address down to godaddy@gmail.com. ??So it sent the transfer notice there. ??Naturally I didn't receive it. ??I had to change the email in Go Daddy, then get name.com to reacquire the data (which apparently you can only do every 4 hours).

The transfer process wasn't as simple as I had hoped. ??But now that everything's moved over, things should be good for a while.

[1]??
These are the format of the authorization code for the problem domain name (1st, 2nd, and 3rd tries). ??Makes you think…

11111111%1111%11
22222222&2222&22
33333333(3333(33