Windows 7 Releases October 22nd 2009

This morning was the first time I heard an official release date for Windows 7. I've been running Windows 7 betas for the past 3 months and it has been far more stable and responsive than Vista was for me. I will definitely be upgrading this one on release day! I have just put in my pre-order at Amazon. I'll be going with the Ultimate version ($219) since I have a media center PC and I want all the bells and whistles. Really, this is the first time EVER I've been excited for a Microsoft launch. Crazy.

June 26, 2009  Tags:   Posted in: Products, Technology  5 Comments

Comcast is My Friend Today

So this is something I have known about and have done in the past, and I kept meaning to do it, but today I finally did it. I lowered my cable/internet bill.

Truthfully I was considering cancelling cable anyway. I'm paying about $117 per month for high speed internet and basic digital cable. I should note that I am paying $10 extra for higher speed internet and getting a $10 discount for bundling cable and internet so that is pretty much a wash.

Since I don't watch a lot of TV I wasn't too concerned with cancelling it altogether. I know my wife enjoys watching Fox News in the mornings and watching TLC and HGTV during the day as she is folding clothes and stuff. For the kids we have a few shows we DVR for them like Tom & Jerry and Martha Speaks. So when they want to watch TV we generally have something available.

Since I have built my own media center pc, we have the benefit of watching shows online. I recently discovered hulu desktop which makes it even easier. So that being said I was totally ready to just cancel cable altogether. I guess the biggest sacrifice would be from my wife who, like I said, enjoys Fox News and TLC. One other downside that I would miss is being able to see the 500 or so movies that will be playing soon on all our channels and recording the ones I want to see. I think this is one of the coolest features of Windows Media Center.

So I determined to call and cancel and figured that Comcast would offer me a deal to get me to stay. If the deal was good enough I would take it. Before calling I read some great tips from Matt Jabs that helped me stay upbeat and friendly with the customer support person.

I was connected with "April" and the conversation went something like this:

Me: Hi, I currently have cable and internet and I would like to cancel my cable TV service only.

April: [Gets my name and retrieves account] OK, do you mind if I ask why you want to cancel?

Me: I just want to lower my bill.

April: OK, well, how about I see if I can lower you bill. It appears you are currently paying $117… per month, is that right?

Me: Yeah, that sounds right.

April: It looks like you are paying $10 extra for an 8 megabit connection. I can remove that $10 charge for a year. For your cable service, I can reduce the price to $29 per month for a year. Would that work for you?

Me: So what would be my total bill?

April: It would be $71 per month, saving you $46 dollars per month.

Me: Wow, for a year huh? Yes, let's do that.

April: OK, you're all set.

Me: Really, that's all I have to do?

April: Yep.

Me: Great! Thank you very much.

April: No problem. Thank you for being a Comcast customer.

So I spent a total of 3 minutes and 45 seconds on the phone and saved myself $552 over the course of the year. I would say that was worth my time and I don't mind keeping cable TV around either. Especially now that I have a big screen to watch BYU & Utah football games this fall! Oh, did I forget to mention that?

June 24, 2009  Tags: , , , ,   Posted in: Finance  One Comment

Django: Filter Model on Date Range

I'm sure this is in the documentation *somewhere* but it wasn't totally obvious to me and I knew there had to be an easy way to filter a model based on a date range. I'm in the process of filtering transactions for Inzolo and giving the user options for the following date filters:

  • Month to date
  • Last month
  • Past week
  • Past 2 weeks
  • Last 30 days
  • Last 60 days
  • Last 90 days
  • All transactions

There really is easy ways to do all of these, but they are slightly different. What I got hung up on was the range. My assumption would be to do something like .filter(date >= begin_date, date <= today) but that obviously won't work. I finally found what I needed with the range function.

So to get each of the filters to work, I created a filter function that looks like this (I'll let you read between the lines to figure out what it is doing):

def filter_trans(request, trans):
	today = date.today()
	if 'filter' in request.POST:
		fltr = request.POST['filter']
		if fltr == 'this_month':
			trans = trans.filter(date__year=today.year, date__month=today.month)
		elif fltr == 'last_month':
			year = today.year
			month = today.month - 1
			if month == 0:
				month = 12
				year = year - 1
			trans = trans.filter(date__year=year, date__month=month)
		elif fltr[:4] == 'last':
			days = int(fltr[4:])
			trans = filter_trans_days(trans, today, days)
		elif fltr == 'all':
			return trans
	else:
		trans = trans.filter(date__year=today.year, date__month=today.month)
	return trans

def filter_trans_days(trans, today, days):
	days = timedelta(days=days)
	begin = today - days
	return trans.filter(date__range=(begin, today))

June 22, 2009  Tags: , ,   Posted in: Programming & Internet  No Comments

Pidgin Crashing on Windows 7 64-bit – Fixed

Ever since installing Windows 7 RC, I have not been able to run Pidgin. It would put an icon in the tray, then disappear. Finally after searching the net high and low and found this comment on an open pidgin ticket that seemed to resolve the problem.

I have XAMPP installed and the PHP subdirectory is in the path. I renamed the aspell-15.dll in this directory and the crash went away. Renaming the file back caused the crash. Seems to be a conflict between these two files.

I also had the same issue with XAMPP installed. Thanks Chowarmaan, whoever you are!

June 17, 2009  Tags: , ,   Posted in: Technology  One Comment

XHTML Strict Anchor Target Fix with jQuery

Since switching from HTML to XHTML, one of the things that kills my HTML Validator most is when I get lazy and put a target="_new" or target="_blank" in an anchor tag. So then I have to go back and fix them and find the old sitepoint article that describes how to fix the problem with a little javascript snippet. I was about about to do than when the thought occurred to me, why not just use jquery? I'm including the jquery library on every page anyway. It turns out to be rather simple.

I replace any target="_blank" with class="external", so my link would look something like this:

<a class="external" href="http://inzolo.com">Inzolo</a>

Then I write a little jquery snippet like so:

$(document).ready(function(){
    $('a.external').attr('target', '_blank');
});

That's it!

June 5, 2009  Tags: ,   Posted in: Programming & Internet  3 Comments

Finally, a New HDTV

SCEPTRE 46 1080p LCD HDTV X46BV-1080p

I've wanted an HDTV for a long time. We've had the same 25" TV since we got married 9 years ago. I've been waiting for a big deal. Well, I think I've finally found one! Saturday I was in Wal-Mart and saw that they had a 46" Visio 1080p for $795. That was the best deal I've seen on a 46" 1080p. I was tempted to buy it, but I generally don't make impulse buys. It tends to get me in trouble. So when I got home I checked the internet and the best deal I could find for a similar model was $900. Well, I just happened to check again and that same model was now $749 on Newegg! It's a one day only Memorial day sale. It's got great reviews from what I've seen on Newegg and Amazon. Better yet, I don't have to pay sales tax or shipping! Thanks, yet again, Newegg!

If you're reading this on 5/25/2009 you can score the same deal by clicking here.

May 25, 2009  Tags: , ,   Posted in: Products, Satellite Television  11 Comments

Django & Djson… er, JSON

I must admin this is my first attempt at even using JSON. I wanted to produce some data that I could consume with jQuery and I figured JSON was the best format for the job.

I found Django has a method for serializing Model query sets easily and it seemed to work just fine.

The problem I was having was that I needed information from two different models. I have Envelopes that Belong to EnvelopeCategories. I wanted to return each category with all the envelopes that belonged in that category.

I kept running into errors when I would try to serialize with Django's serializer function. Basically, if I created a dictionary with what I needed, it was serialized. If I used a query set it wouldn't add the parent fields, or any additional fields I wanted to add. But finally, after browsing around the net and piecing things together I cam up with a solution:

from django.utils import simplejson
from django.http import HttpResponse
from mysite.myapp.models import EnvelopeCategory, Envelope
 
def json_envelopes(request):
    categories = EnvelopeCategory.objects.filter(user=request.user)
    # Create dict with information to create JSON feed
    catenvs = []
    for cat in categories:
        cat.envelopes = Envelope.objects.filter(category=cat)
        envs = []
        for env in cat.envelopes:
            envs.append({'id': env.id, 'name': env.title, 'order': env.order})
        catenvs.append({'id': cat.id, 'name': cat.title, 'envelopes': envs, 'order': cat.order})
    # Use simplejson to serialize dict
    data = simplejson.dumps(catenvs, indent=4)
    return HttpResponse(data, mimetype='application/javascript')

Now, on to figuring out how to consume it for me needs… :D

May 21, 2009  Tags: , , , ,   Posted in: Programming & Internet  5 Comments

One Click Django Project Publishing

I was reading The Joel Test and I got to number #2 which says "Can you make a build in one step?" My initial thought was that there aren't really builds per se in web applications (unless you use ASP.NET). But then I thought, I wonder if I could make publishing my Django application a one step process. So that's what I set out to do.

Here are the manual steps I go through to publish my Django App:

  1. Commit my code changes to Subversion (I use TortoiseSVN – Yes, I'm running Windows)
  2. Log in to my Webfaction account via SSH using PuTTy.
  3. Run a subversion update on media folder
  4. Back up my settings.py file for good measure
  5. Run a subversion update on my Django application folder
  6. If there were model additions, run manage.py syncdb
  7. Restart apache for good measure

Ok, so maybe the title of this post is a bit misleading because I did not automate step one. Let me explain why though. When I commit code, I sometimes leave debug code in where I don't want to. I live to verify that I'm not committing changes that shouldn't be there so I often look at diff files in TortoiseSVN before I commit. That's just one step that I prefer to keep my eyes on. I suppose you could say that it's not really part of the publishing process and we assume that publishing comes after committing code changes then yeah, it's still one step.

My solution is actually a combination of two scripts. I found this app called Plink that is basically PuTTy for your command line. Inside my Django project folder I've created a batch script called publish.bat which contains the following:

@echo off
plink -ssh MYDOMAIN.com -l MYLOGIN -pw MYPASSWORD ./update.sh
pause

This essentially logs in to my server via SSH and runs a shell script. Here are the contents of that shell script:

cd webapps/media
svn update
cd ../myapp/myapp
cp settings.py settings.backup.py
svn update
python2.5 manage.py syncdb
../apache2/bin/restart

That's basically it. Now I just commit my code and when I want to publish I just double-click on publish.bat and I'm done.

May 15, 2009  Tags: , , , , , ,   Posted in: Programming & Internet  8 Comments

Webfaction Review

I was looking at my web stats and noticed I was getting a lot of traffic to my limited review of Webfaction. To recap, I tried out there account then decided to cancel, and they were prompt and friendly at delivering a refund.

Since that time, I have set up two Webfaction accounts. When I started developing Inzolo.com, I wanted to set it up faster and keep it separated from my VPS accounts mainly so I could keep cost separate with this business as I was going to be working on it with friends. Setting up Django was ridiculously simple compared to the steps I had to go through with cPanel. I was able to set up the latest version of Django and the latest version of Python with a few clicks of a button. As far as access goes, I still had SSH to go in and work directly on the server, just as I can with my VPS account.

Webfaction has a method of breaking things down by domains, applications, and websites. Once you understand how it works, you will fall in love with the simplicity of the system! You can set up multiple domains. Then you can create various applications, such as:

  • Django on WSGI
  • Django on mod_python
  • Static/CGI/PHP
  • Subversion (What?! I just saw this, I'll have to check it out!)
  • Ruby on Rails
  • Symbolic links (perfect for Django's admin media)
  • Wordpress
  • AWStats
  • Drupal
  • Joomla
  • … and a number of others

Once you have a domain and an application, you specify how you want to access that application on your domain.

Let me give you an example with my latest project – Mini Site Tracker. I originally set this up on my inzolo account, but again, I wanted to keep expenses separate so I ordered another Webfaction account. I set up a domain – minisitetracker.com. I then added two subdomains:

  • www – points to minisitetracker.com
  • * – wildcard subdomain so I can use any subdomain for accounts in my web application

I then set up the following applications:

  • admin_media – points to Django's admin media for the built in admin control panel
  • minisitetracker – Django 1.0.2 running on mod_wsgi 2.0 and Python 2.5
  • mst_media – Static/CGI/PHP for storing all my media files associated with my Django application (images, javascript, css)
  • osticket – Static/CGI/PHP for installing osTicket on
  • wordpress – Wordpress 2.7.1

image

I then map my application to my website like so:

image

It's really that simple. Databases are equally easy to set up – you can set up MySQL or PostgreSQL. I haven't found that anything missing with Webfaction that I used in cPanel or DirectAdmin VPS accounts.

That about sums it up really. I love Webfaction. Webfaction rocks! Really, for what they do, I don't think they have any real competitors that I know of.

If you find this review helpful, please sign up using my referral link.

May 15, 2009  Tags: , , , , ,   Posted in: Programming & Internet, Web Sites  10 Comments

One Liner to Decompress tar.gz Files

For some reason I can never seem to remember this one liner so I generally have to look it up, or decompress the gzip files, then untar. So I'm documenting it here for my own future reference. (Yeah, Linux experts, keep laughing at me!)

tar xzvf my_dir.tar.gz my_dir

May 14, 2009  Tags: , ,   Posted in: Programming & Internet  One Comment