-
JavaScript Journal - looping
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-
What do you do with a home server?
A home server seems like such a good idea, until you get one and wonder, what the hell am I going to do with this? RIght now I have an instance of Windows 7 running iTunes to sync with the AppleTVs. This was harder than it should be because I couldn't add anything to the library without the system thinking it had a sound card. I found something to fake it and now it works. Amahi is a really light Linux implementation of WHS2011. It is the network share that I am storing my iTunes library. Th
-
HP Proliant Microserver N40L
My wife bought me a new toy yesterday. A HP Proliant Microserver N40L. I upgraded the RAM (8GB) and after some fighting, installed ESXi from a USB drive. The fighting was because of installing from a USB drive, ESXi recognized all the hardware just fine. I intend on running it headless, so I am using a tv as a monitor. My little sharp LCD only had dvi. My Samsung plasma has vga, but I can't turn off the power saving mode and it goes to sleep whenever it loses video signal. This means that d