FreshDesk Python API

Tuesday, 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
Continue reading




Query a Random Row With Django

Tuesday, 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
Comment




Box Office Champs Launches

Thursday, 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
Comment




Getting AngularJS Authentication Working with Django

Thursday, 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
Comment




LittleBrownieBakers.com Launches

Thursday, 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
Continue reading




BestBuy Fantasy Footaball Launches

Wednesday, 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
Continue reading




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
Continue reading




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
Continue reading




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
Continue reading




Search Twitter Public Timeline with Python

Thursday, 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
Comment




Python Syntax Highlighting

Sunday, 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
Comment




Human Resources in the Cloud

Tuesday, March 23 2010 3:34 p.m.

Photo by BamaWester

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
Continue reading




Using Django as a Pass Through Image Proxy

Sunday, 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 Problem

We'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
Continue reading




Maintain Constants.py through Data Migration

Sunday, 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
Continue reading




Configuring Nginx as a Pass Through Image Proxy

Saturday, 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
Continue reading




Happy Holidays

Wednesday, 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
Comment




99 Cent Stores and Florida Homelessness

Tuesday, 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
Continue reading




Efficiently Test Emails in Django

Sunday, 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.

  •  ♦  Download smtp_sink.py
  •  ♦  Put it in whatever your project directory is. You will want to create a "inbox" directory. Besides outputting to the screen, this will automatically copy the email to the inbox directory in case you need to reference it later
  •  ♦  Change your settings.py to have: EMAIL_HOST = '127.0.0.1', EMAIL_HOST_USER = '', EMAIL_PORT = 25

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
Comment




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
Continue reading




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
Continue reading




Bush + Obama Debt = Slavery

Monday, June 29 2009 11 p.m.

You probably recall the term "Taxation without Representation" as being a motto that fueled the American Revolution. The idea is simple. Englishmen in America paid taxes which were spent by a government they did not have a direct representative in.

Bush & Obama have done the same. When a government borrows money, the politicians who spent the money do not have to answer to the people who pay that debt. Instead of being separated by distance from the people paying, these politicians are now separated by time.

When you're forced to pay and not represented, you are a slave of the state. Be sure to send thank you letters to your slave masters from the future. Or, be sure to go to one of the TEA Parties and be a part of the next revolution.

Also, change your avatar color to yellow at AvaTint.com to protest the increased government spending.

politics
Comment




Global Warming and Gay Marriage Don't Matter

Thursday, June 11 2009 11 p.m.

When someone on the left, as socialists are often referred to in America, talks about Global Warming, now called Global Climate Change™, it often has the same ring to it as when someone who seriously believes about supernatural dieties speaks about god. Let's compare.

Besides the believing in god thing, some may sum up the religious right as those people who think you should have no fun. If you have fun, god will smite you.

Some may sum up the religious left as those who believe that you should not focus on producing wealth and industry. If you do, you will be smote.

Of course, both generalizations are inaccurate. Unfortunately for everyone, both sides hold truths in their arguments that get missed because both groups get lost in the trees of their arguments and completely forget about the forest. On the right, the point is to be a moral person. Do unto others as you would have them do unto you. Don't steal, don't lie, don't cheat.

politics
Continue reading




Easily Code Templates for iPhone in Django

Monday, 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
Continue reading




Lawyer Army 1.0

Monday, April 27 2009 11:57 p.m.

Is government better than the people?

As we've been told again and again... capitalism has failed. It's not our fault that we believed property values would go up like a man over dosing on ED drugs. It's not our fault that we lied on our mortgage forms. It's definitely not our fault that no one checked those forms. We wouldn't have lied if we knew someone was going to look at it. It no one's fault. It's the system's fault. If we had a better system, none of this would have happened!

Let's investigate this system we're going to discard.

politics
Continue reading




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
Continue reading




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
Continue reading




Drug Warriors Terrorize Freedom

Sunday, 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
Continue reading




You're Too Little to Not Fail

Tuesday, 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
Continue reading




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
Comment




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
Continue reading




The 5,318 Mile Road Trip

Sunday, 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
Continue reading




Subscribe RSS Feed

More Blog Entries
Ed Menendez' Facebook profile