|
FreshDesk Python APITuesday, December 2 2014 11:54 a.m.
FreshDesk is a great helpdesk system with a fully functional API. Recently a client asked to integrate FreshDesk into their Django based CRM. I created the Python interface to the API. Here's the gist... django, programming, python
Query a Random Row With DjangoTuesday, May 14 2013 5:38 p.m.
Here's a gist for a drop-in Django manager class that allows you to return a random row. Model.objects.random()
It can be used in your models.py like this: class QuoteManager(RandomManager):
def random_filter(self):
return self.filter(is_active=True)
class Quote(models.Model):
quote = models.TextField()
by = models.CharField(max_length=75)
is_active = models.BooleanField(default=True)
objects = QuoteManager()
def __unicode__(self):
return self.by
Advantages over using the order_by('?') is performance. Random sort at the database seems to be extremely slow on most databases even if the table only has a few thousand rows. Note that the count of records is cached for 5 minutes, so if the table changes often you may want to change that. A limitation is that it only returns one row. django, programming, python
Box Office Champs LaunchesThursday, May 2 2013 11:05 a.m. A fantasy movie game built using Django. This is a very easy game where you pick the 15 movies you think will be the highest grossing movies of the season. You can create a group and compete with your friends. You should give the site a try today. Iron Man 3 opens tomorrow and you definitely want to have that movie on your roster. Unlike fantasy sports, you can play this game 4 times a year. The summer season starts tomorrow. Kudos to Rudy Menendez who did principal development and game design and Noah Wenz for design and HTML. The site was with spare time over the last few months. Put together, development time was about 2-3 weeks. If you need a fantasy site done, contact Ed or Rudy Menendez and we can help you out. digitalhaiku, django, fantasy, python
Getting AngularJS Authentication Working with DjangoThursday, March 28 2013 2:24 p.m.
django-angular-auth is a very simple example app or seed to get AngularJS authenticating using Django and Tastypie. Although AngularJS' documentation has gotten much better, it still took me quite a while to figure out what exactly was the best path to take. Also, there are a few gotchas with allowed headers and cross-site security which are already solved in the example. Take a look and let me know what you think. angularJS, django, programming
LittleBrownieBakers.com LaunchesThursday, November 17 2011 8:39 p.m. Little Brownie Bakers are the bakers that make Girl Scout Cookies. They required a custom CMS where they could enter info about cookies, post selling tips for parents, kids and volunteers; and generally update the world on the latest cookie news. And now they have it... digitalhaiku, django, programming, python
BestBuy Fantasy Footaball LaunchesWednesday, September 21 2011 11:59 a.m. Launched back before NFL week 1. But, that was DjangoCon 2011, so the post happens today. Best Buy's site is operating for the third year in a row. Originally it was open to the public, but now it is employee only. You play by selecting a line-up every week and play against your co-workers and against the CEO. Makes for really fun team building. digitalhaiku, django, fantasy, python
US Open CourtConnect Launch!Tuesday, September 6 2011 4:45 p.m. The US Open CourtConnect site allows you to watch in real-time what people are talking about on Twitter and Facebook regarding the US Open. You can see personal photos taken right at the event by the general public, as well as those tweeted by players, experts and celebrities. CourtConnect takes the tweets and status updates and automatically color commentates by attaching facts relevant to the keywords in the message. It also highlights experts, players and celebrity tweets so you know who is who. CourtConnect was built in Python using Django 1.3 and jQuery using Masonry in a very compressed timeline by Rudy Menendez, the team at Blenderbox and myself. We were able to use APIs from Mass Relevence and Pusher to push this site through that timeline. Other cloud services used are Embedly and EC2. digitalhaiku, django, programming, python, realtime
Voxy.com Launch!Friday, May 6 2011 7:30 a.m. Voxy helps you learn a language from life. That means, doing things you would do anyway but learn a language while you do it. Like reading about the NFL lock-out in Spanish. If you're learning English, an English version is also available here. The iPhone app has reached #1 in the AppStore for education apps in 14 countries. Android app is coming any day now too. Both apps support location based learning. Are you near a bank and need to figure how to linguically maneuver through a transaction? Voxy can help! digitalhaiku, django, programming, python
National Geographic Education Site Launch!Monday, April 18 2011 9 a.m. National Geographic creates educational programs, reference material and news used by teachers, students and parents in the United States and across the world to promote geo-literacy. And now this content is available online using a custom CMS built with Django. digitalhaiku, django, programming, python
Search Twitter Public Timeline with PythonThursday, April 15 2010 10:13 p.m.
This Python function takes a search string as a parameter and returns a dictionary representing the JSON returned by Twitter with your search results from the public timeline. Code requires simplejson. It supports all the parameters as defined by Twitter here. def search_public_timeline(q, refresh_url=None, **kwargs):
'''
Searches the public timeline for the q string. There is no sanity checking
of the parameters. It's all passed straight to the API. Spec defined here:
http://apiwiki.twitter.com/Twitter-Search-API-Method:+search
If you send refresh_url then all parameters are ignored. Example usage:
search_public_timeline('menendez')
search_public_timeline('menendez', since='2010-04-15')
Ed Menendez - [email protected]
>>> len(search_public_timeline('the')['results']) > 1
True
'''
if not refresh_url:
parms = {}
parms['q'] = q
parms.update(kwargs)
query_str = '?%s' % urllib.urlencode(parms)
else:
query_str = refresh_url
u = 'http://search.twitter.com/search.json%s' % query_str
#user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
#headers = {'User-Agent' : user_agent}
req = urllib2.Request(u) #, None, headers
return simplejson.load(urllib2.urlopen(req))
programming, python, twitter
Python Syntax HighlightingSunday, April 4 2010 11:30 p.m.
Simple web utility that colors your python code. Useful for putting in blogs, HTML emails, etc. See: Python Color Utility programming, python
Human Resources in the CloudTuesday, March 23 2010 3:34 p.m.
Back in the days when everyone thought a computer virus was science fiction, you would have to travel to a computer to use it. Computers were large, required special environments and special knowledge just to keep them running. You couldn't take this computer with you, or connect to it from very far. With time, technology improved. Many innovators made fortunes with computers that became more portable. As the capabilities of the internet have grown, entrepreneurs have figured out how to make products where the real processing isn't happening anywhere near you, but somewhere else where you don't even see it. This is called, Cloud Computing. You probably already use cloud computing and may not even be aware of it. Gmail is a cloud computing product. As is Facebook and WordPress. The real hard work of running those tools is not done on your tiny phone or in your web browser. The work mostly happens in the cloud. management, politics, programming
Using Django as a Pass Through Image ProxySunday, March 21 2010 8:39 p.m.
An earlier post shows you how to setup Nginx as a pass through image proxy. This post shows you how to do it with just Django and nothing else. The ProblemWe've solving the same problem as the earlier post. However, I will repeat it here for clarity as there's been some confusion. You have a production DB with lots of images uploaded by users. For example, NationalGeographic.com has over 11gb of user uploaded images. When you download a data dump of the production database, it has links to all these images which you don't have. You either have to download and sync all the images locally every time you copy the database, live with broken images or point your static images to the prod server. django, programming, python
Maintain Constants.py through Data MigrationSunday, March 14 2010 7:49 p.m.
This post will show you how to create a local_contants.py file using Django South. If you're not familiar with South, it's a data migration tool. Stated differently, it's a tool that helps keep your database changes current across different sandboxes and server environments. django, programming, python, south
Configuring Nginx as a Pass Through Image ProxySaturday, March 13 2010 8:26 p.m.
This post shows how to setup Nginx has a pass-through image proxy server. This is useful for local sandboxes, UAT and QA servers where you copy production database down to but don't want to copy all the user generated images to the non production environment. django, programming
Happy HolidaysWednesday, December 23 2009 9 a.m.
This is a reminder for you and myself of how fortunate we all are to touch each other's lives. Our circumstances can be defined by fate, but who we are is defined but what we choose to do daily. As we make our impression on people we also leave indents on the clay that makes character. Be sure every interaction and mark we leave on that clay is purposely positive. Not every action will turn out positive, but if we aim for each mark in the clay to be positive, the end result will be wonderful. Choose wisely and purposely even the little things we do daily. Especially those little things, because they add up to more. You might take a big road trip someplace, but it's those daily trips in your car that add up 10,000 miles per year. Why do one big caring thing once a year to help someone? Instead, keep an eye open as you walk through the daily motions of life to see how you can help. I find that surrounding myself with positive, beautiful and caring people, landscape and art is the most important thing in my life. These are all things that can be acquired with little or no money. This is important, because since time is money, this gives me the most time to enjoy these things. I only hope that all my friends, family and everyone reading this blog can prioritize their life in a way that makes them happy. It's within all of us to have a happy holiday and a spiritually prosperous new year. fun, politics
99 Cent Stores and Florida HomelessnessTuesday, August 11 2009 10:15 p.m.
When a manufacturer incorrectly predicts demand for a product, it's left with a giant glut of product. The glut of product is either dumped by the manufacturer at a steep discount to raise cash, or it runs out of cash and its sold to someone to liquidate the excess inventory. Suddently, the product shows up at a 99 cent store. The manufacturer or liquidator gets some cash, the 99 cent store makes some money, and you can afford that Milli Vanili CD you've always wanted. Unfortunately, because of the government, that's not how the housing market works. In the name of protecting american home owners, but really bailing out the well connected banks, we're propping up home prices. There are 300k such homes on property value stilts in Florida alone. politics
Efficiently Test Emails in DjangoSunday, July 19 2009 6:08 p.m.
Testing emails can be an inefficient process. The email needs to leave your machine, arrive at the SMTP server, get forwarded to your test mail server and then downloaded by your email client. Do you want those 30 seconds of your life back? Using an SMTP sink, you can receive the email to your screen instantly. Setup is easy.
If you have a script that loads your sandbox environment automatically, you will want to load smtp_sink.py automatically. It will send a test signal to see if it's already running and not start twice. If you run automated test scripts, the output of the "inbox" can be tested. django, programming, python
You Might Be a Murderer and a Thief If...Thursday, July 2 2009 9:23 a.m.
Outside of a self defence scenario, Would you kill someone? Would you pay someone to kill for you? It's only a semi-rhetorical question. Taking a life is murder. Taking liberty is slavery. Taking property is theft. Would you do these things? Would you have others do these things for you? Probably not. But someone steals, murders and owns slaves in your name every day. The government does all three of these things every single day. When we pay for GM, give money to Isreal or print government welfare checks those are all theft. Your liberty is taken away every day when the governments bans pot, bans guns and prevents you from leaving or entering the country. The government murders people daily through "preemptive" wars. If you voted for the government to do these things, you're stealing, murdering and creating slaves of future generations. If you support the government, congratulations, you are too! No fireworks or BBQ for you on independence day. Here's a clear and concise definition of liberty and how it can never be legally taken away: politics
AvaTint Launched!Tuesday, June 30 2009 11 p.m. The site very simply takes your avatar and turns it into any color you select. The online community is starting to do this to support and protest many things. This is the 2.0 way of making your page background black for a cause. We created this site in 90 minutes using Django on June 19th. django, programming, python
Easily Code Templates for iPhone in DjangoMonday, May 4 2009 9:49 p.m.
Sometimes, you want to create a custom page for an iPhone or other small phone browser but don't want a custom URL or view for it. This can easily be handled by using the mini_render_to_response function. django, programming, python
Hollywood Draft Private League Launch!Thursday, April 23 2009 7:52 a.m. This new game allows you to play in a more traditional fantasy game model where you draft from a pool celebrities. This allows fun things like draft parties, benching players and all the regular things those familiar with fantasy sport already know. digitalhaiku, django, fantasy
MyEmailDraft.com Launched!Wednesday, April 22 2009 10 a.m. The site solves one simple problem. Messy email based fantasy drafts. Our goal was to make something as simple to setup as an email draft but without any of the downside. django, fantasy
Drug Warriors Terrorize FreedomSunday, January 4 2009 8:13 p.m.
America has a very strong tradition of protecting speech. With good reason. Tyrants can never control thoughts, but if they can control speech, then they control your thoughts and indirectly your actions. Ultimately that's what they care about. Since it's prudent to solve the problem in utero, controlling speech is simply an abortion of your actions. Tyrants, however, are clever animals. While Americans are militantly vigilant of the right to speak freely, we're not so vigilant of everything else. Tyrants are happy to let you say whatever you want, as long as you do what they say. politics, privacy
You're Too Little to Not FailTuesday, November 25 2008 10 p.m.
Recently, you may have heard the term "Too Big to Fail" (TBF). TBF is simply a euphemism for well connected. The company or industry being spoken about is too well connected and has too many lobbyists. Notice how the financial sector and auto industry both get bailouts, but the realtors and the builders get nothing. The reason for this is that realtors and the construction industry don't have enough lobbyists making laws for them in congress. Too bad for them. Even worse for the rest of us since we've committed our kids to paying off a few trillion dollars in debt. AIG is too big to fail but your kid is little enough to saddle with hundreds of thousands of dollars in debt. politics
How To Download Your Favorite ShowsWednesday, November 12 2008 9 p.m.
I will show you how to download your favorite shows automatically and convert your PC into a DVR. You don't have to sit there and download it. Just leave your PC on and it will be ready for you within a few hours after the show is published. All you need is a fast internet connection and some software. You do NOT need a cable TV connection, antenna or any of that retro gear. It's nice to have a PC or laptop that you can connect to a TV but that is not required. If you hate your cable company this is a viable cable TV replacement. Of course you will need to be able to obtain a license to view many of these shows, but there are a few out there that are free. It's beyond the scope of this article to encourage you to break imaginary property (IP) laws. fun
Celebrity Fantasy Game in DjangoMonday, August 18 2008 9:53 p.m.
If you've played fantasy football or any fantasy sport you know what I'm takling about. If you're new to the concept, you pick a roster of celebrities and if they show up in the news, you get points. The site was written using Django (trunk as of the 13th!) and Postgres 8.2. We've built a fantasy games package on top of the Django core which we would probably open-source if the community showed some interest in it. This is our 2nd major site in Django and we really love it. To begin with, Python is a great language. When we built our fantasy engine, it was originally coded on MySQL. We encountered quite a few problems porting it over to Postgres. There are lots of little things where MySQL does type conversions for you automatically and Postgres (correctly in my opinion) does not. I definitely feel the conversion was worth it so that now we're on an enterprise level database. django, programming, python
HollywoodDraft.com Launched Today! Got Game?Sunday, August 17 2008 8:43 p.m. The concept is simple, celebrity media meets fantasy sports. You pick a roster of celebrities that will be all over the blogs and magazines and you get points when they appear. Getting the cover of People magazine is like getting a touchdown in fantasy football. Your celebrity got arrested? You lose points. For those of you that think I disappeared... This is what I've been working on the last few months. Check it out! fantasy, fun
Happy Independence Day! Are you Independent?Thursday, July 3 2008 11:01 a.m.
With the country celebrating its independence, it's a perfect time to talk about about freedom and independence. As you may have overheard in school... America declared independence from tyranny over 200 years ago on July 4th. That was the short-term action. However, America wasn't free on July 4th. Just like in weight-loss, it takes time to reach the goal. It took long term commitment and determination to actually make a free society. A society where personal responsibility is of utmost importance and freedoms for everyone are the ideal goal that we hope to never fall short of. It's been over 200 years that that long-term commitment to freedom has been declared. How free and independent are you? There's probably an easy way to measure this. Freedom is directly related to responsibility, just as light is related to visibility. The more light there is the more you can see, and so it is with responsibility. politics
The 5,318 Mile Road TripSunday, December 2 2007 9:15 p.m.
Leaving Minneapolis early on Friday, November 9th watching the sun rise. Weather is a bit cold in town but I don't care very much since weather.com is predicting nice weather in the Black Hills. We drive through I-90 as quickly as we can without getting caught by The Man and exited Minnesota into South Dakota. A flat landscape changes into a few hills here and there then into gently rolling hills and finally into some serious hills. We detour into Badlands National Park. If you ever need to get away and disappear from it all, this is the place to do it. The hills seem to go on forever. After, we visit the wonderful tourist trap known as Wall Drug and eat dinner there. We reach our modest first day goal of getting as far as possible from Minneapolis. We spend the night in Rapid City. travel
|
![]() More Blog Entries
|