mcottondesign
Antisocial Feed Guesstimate
Blog GitHub RSS
  • JavaScript: quick debugging tip
    2013-01-16

    I have been doing a lot of in-browser testing. Because of this I want an insight to what the browser is doing. console.log('DEBUG: ' + data) But this gets unmanageable very quickly. The next evolution is to place a flag for what should be logged. It also helps to prefix all the logs with a category (DEBUG, INFO, ERROR, etc) debug = true if (debug) console.log('DEBUG: ' + data) This is a little better but still isn't that much better. The next jump is to make debug into an object and get mor

  • JavaScript Journal - Updating an image without flickering
    2013-01-12

    This is how I'm approaching the problem of trying to simulate live video from a series of preview images. After initial page setup, we start the polling service After each polling response we look for new preview images ('pre') For each preview response, we ask each camera to update its image As an optimization we only update the cameras that are currently on screen When the new image has loaded, we swap it with the one being displayed (this eliminates flickering) If the image has taken longer t

  • JavaScript Journal - looping
    2012-12-24

    Depending on when you started learning JavaScript (and when you stopped keeping up) you might find a lot of this inside your code for(var i=0;i<arr.length;i++) { html = "<li>" + arr[i] + "</li>" } or if you started with jQuery you will have copy and pasted something like this from stackoverflow $.getJSON(url, function(data) { $.each(data, function(item) { $('#thing').append('<li>' + item + '</li>') } } or you could be doing something like this and use a client-side templete,

  • JavaScript Journal - Making a Single Page App
    2012-12-05

    Right now I am in the process of creating a large, complex single page app. Some of the challenges I am running through right now are rendering, user management and API proxying. client-side vs server-side rendering Traditionally the page would be rendered on the server. When a page changes the server renders it again and can always return the latest data. You can then progressively enhance some of the data client-side to make it nicer. Everything is just a refresh away. There is very litt

  • JavaScript Choices
    2012-12-03

    On my current project, I would really like to move away from YUI and towards Backbone.js. I am a believer in using a hybrid approach of the best components instead of using a single monolithic library. YUI is a large, heavy framework that enforces their way of development. While their way isn't wrong, it does makes us beholden to Yahoo and their choices. YUI has incorporated much of Backbone.js into their later releases but it is significantly behind where Backbone.js is. It is also forced

  • What I learned interviewing
    2012-11-10

    October has been a very strange month and thankfully I came out of it better than I expected. I had the chance to meet some great people. The Good Swift software had a great idea for the technical phone interview, the team reviewed a project of mine on github and then had me answer questions about it for an hour. They prepared a follow-up assignment adding features to that project. OKCupid Labs and CrowdFlower both had me pair-program with a team member and work a real bug on their actual code

  • Single Page App
    2012-10-04

    Want to test your server code but you inherited a code base without tests? Can't justify spending weeks writing test? Want to prove that your API is working? Need to debug the iPhone client but don't want to open XCode. HTML5 to the rescue! Need the app to be location based? Use geoLocation . Need to store data localy? Use localStorage . Not a designer, having trouble laying out your css? Use twitter bootstrap . Want to use a design pattern like the cool kids? How about pub/sub with ampli

  • Making Python and Django more social with awe.sm
    2012-09-20

    Our users like to share the deal they just received with their friends on Facebook. We would like to know how well those links do and what kind of traffic they receive. awe.sm is a company that does exactly that. This blog post is about showing how easy it is to integrate into python and Django. def facebook_share_checkin(checkin, points): try: # I removed the code for getting the user token graph = facebook.GraphAPI(token) # The facebook API specifies what they wa

  • Local datastore for Google App Engine
    2012-09-14

    You can make life extra nice by specifying a datastore. Save it or add it .gitignore, it's all cool with me. --datastore_path=/tmp/myapp_datastore

  • Making a 3rd-party JavaScript widget
    2012-09-03

    At QliqUp, we had the idea of making a widget that merchants could place into their existing webpage that would let them show the current deals they offer. This was mostly straight forward but I wanted to explain some of the sharp edges that slowed us down. You can see the final product at: http://qliqup.com/widgets/ First we had to make a public endpoint inside of our API. I left out some the docstrings because it only cluttered this example. class PublicDealsHandler(BaseHandler): def re

  • My new TestRunner
    2012-08-16

    I am trying to get some test for our code base that doesn't have any. None at all. There isn't even a documented test plan. Because the API server is the core of our porduct, and because testing RESTful things is easier, we'll start by making a JavaScript tester. And because a webpage is friendlier that a command-line, it'll report in the browser. https://github.com/mcotton/TestRunner And because a working webapp is even better documentation than a simple test suite. https://github.com/mcotto

  • Making profile pages more sane
    2012-08-10

    We encourage our merchants to include a facebook page with their profiles so that users can share that page when they check-in, check-out, unlock a deal, or redeem a deal. But some people didn't understand what that means and we had all sorts of crazy input. Instead of explaining the steps they'll need to get us the correct URL, we'll just take whatever they mashed out on their keyboard and fix it. Django has some weird points, but it mostly has awesome ones. I needed to clean up our database

  • Making user logins more forgiving
    2012-08-07

    We are currently working on making our login system more forgiving. We started by creating usernames, and then people forgot their usernames so we now we are wanting to use e-mail addresses as usernames. This is great except for the users who remember their username. We decided to try logging in assuming they gave us a username, if that fails, try it again matching against their email. While we are at it we also smush everything down to lowercase so that we can eliminate some typos. We are d

  • How to reset Django admin password
    2012-08-02

    Sometimes you just can't remember what you set it to, or like me, you restore from an SQL file that you never knew the password for. Anyway, python to the rescue. > python manage.py shell from django.contrib.auth.models import User u = User.objects.all() u=User.objects.get(username__exact=’admin’) u.set_password(‘whatever’); u.save() thanks to http://coderseye.com/2007/howto-reset-the-admin-password-in-django.html and the first comment

  • New Job at a Startup
    2012-07-28

    I have a new job as a backend developer at http://Qliqup.com It is a young venture backed tech start-up and I am very excited. Look forward to future posts about what I am doing there.

  • Keeping a secure password list
    2012-06-08

    Keeping a secure password list should be an easy task but it isn't. This is the solution I am trying out. Download keepass and install on your laptop. Create a master password. Create entries, for existing passwords you'll need to edit the generated password Save it to a file and place in your Dropbox folder Install and login into Dropbox on your iPhone Install MiniKeePass on your iPhone Open the encrypted keepass database on your phone from Dropbox. It won't be able to display anything, but th

  • Got a problem, python is usually the answer
    2012-04-27

    We had an emergency where our EMR provider isn't output the needed government reports. This wouldn't be such a big deal if they weren't due on Monday. The problem seems to be with the XML records and some information needed to be striped out and manually looked at. Thankfully python has easy installers for Windows and the standard lib includes xml parsing and csv output. ########################################## ### Get info from xml and make a csv ### #######################################

  • HP N40L and Power Failure
    2012-04-16

    Problem When I restart my HP N40L it does not always recognize both drives. ESXi is on a thumbdrive and has not problem booting. Because the two physical drives are seperate datastores hosting different VMs it leaves my system in a in consistent place on restart. Solution Don't have one yet. I am going to investigate a UPS that triggers a shutdown script.

  • How to replicate ubuntu vm on ESXi
    2012-03-30

    I wanted to deploy multiple copies of a base ubuntu server, easy right? Well it is now, but it took me a while to get it right. The whole problem comes from not having 'sysprep' for linux. (They probably have a much better way and I just don't know it). Because ESXi makes up a fake MAC address for the network interface, it is smart enough to make up a new MAC for the new machine. Your old VM is still expecting the old network settings and needs a minor change. I'm not changing the hostname,

  • Finally got it working
    2012-03-06

    I finally got my HP Proliant N40L doing something useful. Except for trying something new, it only runs a single instance of windows 7. I have it configured as two logical drives residing on a single 2TB disk. In my testing I had better performance keeping both logical drives on the same disk. Weird, it shouldn't work like that but it does. I wasn't able to stream movies from iTunes until I tried a million things, the last being adding a new ethernet card as a VMXNET3 instead of E1000. It is

← Newer Older →
© 2026