Howsthe.com Blog

Avatar for vbabiy@howsthe.com

MongoDB and V8

Published Feb. 22, 2010 by Vitaly Babiy

If you haven't heard of mongoDB, its a fast schema free document store. MongoDB uses Javascript as its query langauge, and uses a derivative of JSON called BSON for storing data. Currently the JavaScript engine used is spider monkey (Developed by Mozilla). If you checkout the lastest version of mongoDB you will be able to build it with Google's V8 JavaScript engine support. The V8 engine powers Google's new chrome browser, using this engine with mongoDB should give an amazing speed boost. This article will walk you thourgh building both V8 and mongoDB with V8 support on Ubuntu 9.10 32bit (64bit should be very similar).

First you will need to checkout the V8 engine source code. More information can be found at http://code.google.com/p/v8/. Before we checkout the code you will need a few tools and libraries.

sudo apt-get install subversion git-core tcsh git-core scons g++ libpcre++-dev
sudo apt-get install libboost-dev libreadline-dev xulrunner-1.9.1-dev
Tags
  • Databases
  • Javascript
  • MongoDB
  • V8
Avatar for vbabiy@howsthe.com

Datetime mocking with pyxmox

Published Feb. 11, 2010 by Vitaly Babiy

This is a reference on how to mock out the datetime.now() call in python using mox. Since datetime is a built-in it makes things a little more tricky.

def test_datetime(self):
    now = datetime.datetime.now() # Store it for later use
    m.StubOutWithMock(datetime, 'datetime')

    datetime.datetime.now().AndReturn(now)

    m.ReplayAll()

    datetime.datetime.now()

    m.VerifyAll()
    m.UnsetStubs()

First we will store the current datetime, this has to be done before mocking takes place. Next we use StubOutWitMock to mock out the datetime class, we then record the call to now and have it return our stored now. If you have any question leave them in the comments.

Links:

Tags
  • datetime
  • Mocking
  • Mox
  • Python
Avatar for vbabiy@howsthe.com

The Myth of the Genius Programmer

Published Jan. 17, 2010 by Vitaly Babiy

This is a great video from google IO 2009:

Tags
  • genius
  • myth
  • Programmer
Avatar for vbabiy@howsthe.com

Why does Google want your bookmarks?

Published Jan. 11, 2010 by Vitaly Babiy

Google chrome is a great and fast browser that has many cool features, bookmark syncing is one of them. This feature syncs your bookmarks to all your computers that use chrome. Also to Google's severs giving them the ability to promote your bookmark results within your Google searches using SearchWiki . This makes complete sense since if you bookmarked the page that you thought was important. This feature alone makes bookmarking useful again.

Here is an image of the results:

Google Results

Here I have bookmarked djangos homepage in chrome, now when I search for django the first result is my bookmark.

Tags
  • Bookmarking
  • Google
  • SearchWiki
Avatar for vbabiy@howsthe.com

Python mocking with mox

Published Jan. 10, 2010 by Vitaly Babiy

When building an application it's hard not to depend on some outside resource, that you have no control over. When writing unit tests for this type of application it gets tricky, but thanks to mocking you are able to do so. Mocking comes in two forms, manual (a.k.a monkey patching) or using a mocking framework, we will be using the latter. A mocking framework creates objects that add expectations, define their methods, and return values for each method call in a simple way.

There are a few mocking frameworks available for python:

Tags
  • Django
  • Mocking
  • Mox
  • Python
Avatar for vbabiy@howsthe.com

Django Testing

Published Jan. 4, 2010 by Vitaly Babiy

Test driven development will help in a few aspects when developing an application. One aspect is you get to eat your own dog food even before you make it. You are able to use your API's before they are implemented, this will display any short comings in the design. Also by forcing yourself to think through a problem and get a better understanding, which in turn helps make better design decisions. We all make mistakes, without testing our code base there is no way to be sure that everything is still working, otherwise you are crossing your fingers and knocking on wood.

Django and Python Test Tools

If you've been using Django for some time you have heard the phrase "Django is just Python" and this holds true in the realm of testing your Django Application. You can use other testing frameworks with Django like nose. Django comes with a good testing framework that is built off the Python unittest module. The default Django testcase is a subclass of unittest.TestCase this class provides with some additional assertions and also a client that will helps you test your views ( more details to come ).

Tags
  • Django
  • Functional
  • Python
  • Testing
  • Unit
Avatar for vbabiy@howsthe.com

Why is website monitoring important?

Published Oct. 5, 2009 by Vitaly Babiy

Many people ask us "why it's important to monitor your website for downtime". Here are few scenarios to explain why, and the reason we created this product.

These days many people own more then one website, if you run a business you probably run a business website, a business blog, and maybe even a personal blog. All of these websites bring in leads and help build the business brand. This makes it really important for these sites to be running, for any size business its important to get as many leads as possible to stay afloat.

Website monitoring is really important is for e-commerce sites. All e-commerce sites make their money by selling products or services through their website, well it makes it really hard to do this if the site is down. Being able to know of an issue almost instantly is a amazing benefit, because most issues can be resolved in a matter of minutes or less ( unless it's a hardware issue ). The longer the down time the more sales lost.

How many of you have launched a new website and then kept checking it every few minutes to make sure everything is running perfectly? In this scenario having a website monitoirng tool, would save you allot of time and worries, because if there are issues you will be notified by text message or email. Your website may be digged, slashdotted, or run in to an issue at any time and it's not humanly possible to manually check your website 365/24/7, for this reason you need a service like howsthe.com to monitor your websites for you.

If you have any stories of how website monitoring has helped you or other reason why you use a website monitoring service, please let us know in the comments.

Tags
  • monitoring
  • Uptime
  • web
  • website
Avatar for vbabiy@howsthe.com

Django with nginx, mod_wsgi, and SSL

Published Sept. 20, 2009 by Vitaly Babiy

Howsthe.com has made an architectural change in our deployment stack. We were using mod_wsgi and Apache to serve the static content, which was not working as well as planned. We moved to using nginx as a front end proxy and a static content server. It also acts as a gateway for the SSL connection so we don't have to run different mod_wsgi instances for HTTP connections and for HTTPS connections. Below we explain how we configured this setup.

Prerequisites:

We'll be using Ubuntu 9.04 server, the following packages need to be installed:

  • apache2
  • libapache2-mod-wsgi
  • nginx
  • subversion ( Only if you are going to install Django from SVN )

This doesn't include database installation, for this example we will not be using a database. If your application uses a database, install the correct python drivers and make sure your settings.py file is configured correctly.

Once these packages are installed, then install Django. We will not be going over this here due to expediency. You can find the directions at http://docs.djangoproject.com/en/dev/intro/install/.

Tags
  • Django
  • mod_wsgi
  • nginx
  • SSL
Avatar for vbabiy@howsthe.com

12 Tips to Better SEO

Published Sept. 15, 2009 by Vitaly Babiy

Advertising is very expensive, studies have shown that it is not as effective as being on the first page of search results. These SEO tips will help you rank higher on the search engines results, and who doesn't like free referrals.

  1. Content is King
    Search engines want something to index. If your website doesn't have much content the search engine will not rank you as higher authority for these keywords. Also it gives other websites the opportunity to link to you. For instance if you have a blog, this can generate many links to your website. These links will allow the page rank to flow, the more links to your website the sooner it will be indexed and more often.

  2. SEO Friendly URLs
    URLs that use query parameters to get a website like http://www.howsthe.com/blog?id=100, have nothing in the URL that describes what the website is about. On the other hand a URL similar to http://www.howsthe.com/blog/12-seo-tips-for-beginners/ gives a brief description of the content on the page.
    It's important to optimize your website for keywords that match what your user base is searching for. Using URLs with less query parameters allows these keywords to be placed within the URL.

Tags
  • Django
  • Google Webmaster Tool
  • SEO
Avatar for vbabiy@howsthe.com

15-Day Free Trial

Published Sept. 4, 2009 by Vitaly Babiy

We recently updated our subscriptions to offer new users a 15 day free trial. This allows users to try our service with no upfront charge. During this trial period you will be using your full account not limited in any way. Your credit card or Paypal account will not be charged until your trial period has expired.

If the service is not right for you, you can cancel your account at any time. If you cancel your account before the trial period expires your credit card or Paypal account will not be charged.

Like always, feedback and suggestion are always welcome.

Tags
  • subscriptions
  • trial
  • users

A blog about development, marketing, and design.