Posted on May 13, 2008 by michaelangela
This makes some interesting things possible. And it makes sense just looking at it. That’s even better.
Announcing django-sphinx 2.0.0 Full-text Search | David Cramer’s Blog
One of my tasks lately has been updating the django-sphinx
library to work with Sphinx 0.98, as it includes GIS components which
we have been wanting to possibly utilize on our new search engine. So
today, the conclusion of.. very few hours of work, I’d like to announce
2.0.0 of the Django integration.
The SphinxSearch manager has been completely
rewritten to rely strictly on the Python Sphinx API (a request from the
author of Sphinx), which means it should have much more compatibility
with newer versions in the future. I have also updated the querysets it
returns to work like normal Django QuerySet instances, to where they
clone themselves so you can fork your queryset into several different
actions.
Filed under: cool, django, orm, search, tool | No Comments »
Posted on May 9, 2008 by michaelangela
Whoa! Well I haven’t purchased any music from MSN music, but it’s… *shudder*. If you did, you have to find some way to get your music converted somehow if possible. Or don’t upgrade your computer, or change computers, of buy another computer and hope to play that music…
Essentially, every time you play the music, it checks if the current system you are own has already been “ok’d” by the MSN music servers. If it has, like your current computer, you can continue to play them after the deadline.
However, if you are on a new system, or a new device, or whatever, and you try to play your music that you purchased, it’ll try to check with the MSN music servers, as normal, but after the deadline those servers won’t be on. There will be no reply for your player, system, Windows Media Player, etc., and it’ll assume you have an illegal copy and that music will no longer be usable.
Is there no recourse?!
The day the music died [dive into mark]
This is a letter I sent to my father to explain what it means that Microsoft is pulling support for MSN Music.
Tech issues like this often bubble up into the media that he reads, but
they are rarely explained well. My father assumes I have an opinion on
such stories, and he is rarely wrong.
Actually, it is still technically in the future tense. The day the music dies will be August 31, 2008.
Filed under: drm, microsoft, msn, playforsure, zune | No Comments »
Posted on May 8, 2008 by michaelangela
that are more or less ready to use. The list is at the following link.
Empty Thoughts: Django Blogging Apps
People ask about blogging apps for the Django platform all the time. I
have not investigated each and every one of these, but so far I still
feel pretty confident that not one of these is fully baked (although
some are getting close) in any sort of manner comparable to something
like WordPress or Typo. That said, there’s a lot of great code here, and if you’re not interested in creating your own, use one of the following.
Filed under: blog, django, tip | No Comments »
Posted on May 8, 2008 by michaelangela
A note… definitely something to come back to.
Talk Funnel » Blog Archive » Django bash shell shortcuts
SmileyChris had a post up recently on setting up bash aliases for Django. He uses the classic alias command which works for one-line shortcuts. I got inspired to put mine up too, but if you want to do something more elaborate, bash gives you this handy scripting language along with ’shell commands’ so you can do something a bit more involved.
What I tried to do with these shortcuts was to create a set of
mini-commands that quickly do what you need to do when developing
Django. It might help someone out and squeeze an extra 2-3.5
microseconds each time you run a Django command. Hey, it all adds up.
Filed under: bash, cool, django, shell, shortcuts, tool | No Comments »
Posted on May 7, 2008 by michaelangela
So you get the dreaded illegal mix of collations:
Pythoneer » Convert MySQL table to utf8
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
What do you do? Not too bad fortunately. And if you’re working with Django, it’s a little bit easier. Launch the shell with python manage.py shell. Then in the shell do something like this:
from django.db import connection
cursor = connection.cursor()
cursor.execute('SHOW TABLES')
results=[]
for row in cursor.fetchall(): results.append(row)
for row in results: cursor.execute('ALTER TABLE %s CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' % (row[0]))
I’m sure this can be optimized a bit but it got the job done simply enough.
Filed under: cool, django, orm, python, snippet, tip, tool | No Comments »
Posted on May 7, 2008 by michaelangela
Posted on May 4, 2008 by michaelangela
Pretty cool. Just making a note of it.
SWFUpload News | SWFUpload
SWFUpload is a small JavaScript/Flash library to get the best of both worlds. It features the great upload capabilities of Flash and the accessibility and ease of HTML/CSS. See it in action….
* Upload multiple files at once by ctrl/shift-selecting in dialog
* Javascript callbacks on all events
* Get file information before upload starts
* Style upload elements with XHTML and css
* Display information while files are uploading using HTML
* No page reloads necessary
* Works on all platforms/browsers that has Flash support.
* Degrades gracefully to normal HTML upload form if Flash or javascript is unavailable
* Control filesize before upload starts
* Only display chosen filetypes in dialog
* Queue uploads, remove/add files before starting upload
Filed under: dev, flash, tip, tool | No Comments »
Posted on May 1, 2008 by michaelangela
Just a tip. I loaded it but haven’t put it through it’s paces. But it’s still cool to have and XCode does syntax hilighting now. I am not sure if it did before.
Xcode actionscript3 code completion
As I really like to work with Xcode as my primary IDE, I created my own code completion for actionscript 2 and actionscript 3 with full code hinting. Get it here .
Filed under: as3, cool, tip, tool, xcode | No Comments »
Posted on April 30, 2008 by michaelangela
A good tip and set of instructions on how to show the date in the menu bar so you don’t have to click, hover, etc.
How To: Display Date in OS X Menu Bar - PaulStamatiou.com
While getting things settled down on my MacBook it became apparent that I did not want to rely on the calendar widget to find out the numeric date. I simply wanted to view the date alongside the time in the menu bar. Unfortunately this is not an option in OS X. However, with a slight of hand, you too can easily display the date in the OS X menu bar without the need of additional applications.
Filed under: cool, osx, tip | No Comments »
Posted on April 25, 2008 by michaelangela
Doesn’t work:
ids=request.GET['ids[]‘]
Does work:
ids=request.GET.getlist('ids[]‘)
A typical Facebook friend invite sends the ids to be invited to your site as an array in 'ids[]‘. Normally, you can pull values out with just request.GET['key']. But since the value of this particular key is an array and not just a string, you can’t (at least I wasn’t able to) just do ids=request.GET['ids[]‘]. That returns the first value of the array as a string. Not very helpful.
But, this is a QueryDict object, not a standard {} dict. As such, Django provides the getlist(key) method.
Django | Request and response objects | Django Documentation
getlist(key) — Returns the data with the requested key, as a Python
list. Returns an empty list if the key doesn’t exist. It’s guaranteed to
return a list of some sort.
Filed under: dev, django, facebook, python, snippet, tip | No Comments »
Posted on April 24, 2008 by michaelangela
Oooooh sweet. According to this article, Yahoo’s search API is still more “developer friendly”. Either way, having them available is quite cool.
Google Search REST API
More than one year after Google discontinued the SOAP Search API, it finally got a proper replacement. The AJAX Search API can now be used from any Web application, not just in JavaScript. The other two Google AJAX APIs for feeds and translations were updated for non-AJAX use, as well.
“For
Flash developers, and those developers that have a need to access the
AJAX Search API from other Non-Javascript environments, the API exposes
a simple RESTful interface. In all cases, the method supported is GET
and the response format is a JSON encoded result set with embedded status codes.”
“Using
the APIs from your Flash or Server Side framework couldn’t be simpler.
If you know how to make an http request, and how to process a JSON
response, you are in business,” says Mark Lucovsky. Here’s a simple example for web search:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Earth%20Day
Filed under: api, dev, flex, google, search, tool, yahoo | No Comments »
Posted on April 24, 2008 by michaelangela
I had heard about passing by reference vs. passing by value. Here is a case of passing by reference.
In [76]: a=[1,2]
In [77]: b=a
In [78]: b.append(3)
In [79]: a
Out[79]: [1, 2, 3]
That’s not what I was looking for. I was hoping to get 'b' to be [1, 2, 3] leaving 'a' unchanged. Oops. It passed 'a' to 'b' by reference so any changes to 'b' affected 'a'. So… need a copy. Simplest way I’ve seen of copying an array in python so far is to use [:].
Learn Python in 10 minutes | Poromenos’ Stuff
A useful use of the array range colon is to copy an array:
newary = oldary[:]
Filed under: cool, dev, one-liner, python, tip, tool | No Comments »
Posted on April 24, 2008 by michaelangela
Posted on April 24, 2008 by michaelangela
Not sure where I saw this, but if you have an OS X Finder box open to, say, upload a pic to Facebook, if you hit Command-shift-G, it’ll give you a box you can paste a path in. You can also type the path in and it should give path completion so I’ve heard.
Nifty.
Filed under: osx, tip | No Comments »
Posted on April 23, 2008 by michaelangela
I think whereivebeen is far, far over 250,000 users. It’s successful. The problem is getting it to at least pay for itself. I haven’t seen an update past what is here though. I know some ads were put in and they aren’t obnoxious or anything so as a user I am fine with them. But does the ad revenue cover it? Just wondering… all the best to Craig though! It’s a great story any way you slice it.
Facebook | I have 250,000 users, what now?
Well my application has become incredibly popular, and I’m very excited about it, don’t get me wrong!
Filed under: business development, facebook, monetize | No Comments »
Posted on April 23, 2008 by michaelangela
Monetize monetize monetize… it’s the big mystery. How to do it? So that it actually works? VideoEgg has done interesting stuff so this is another one to take a look at in the future.
Ad Platform - Publishers | Videoegg
You can integrate the EggnetworkSM AdPlatform in less than a day and begin monetizing your site traffic with quality brand advertising designed to fit into virtually any space.
Filed under: monetize, tool, video | No Comments »
Posted on April 23, 2008 by michaelangela
So says Miro. Interesting. Will have to look into it more later.
Creators: publish your videos the open way.
If just a few companies dominate online video, creativity will be restricted. If the most popular video tools rely on closed, proprietary distribution systems, free speech will suffer.
Miro is specifically designed to give video creators and viewers more freedom. We’ve built Miro to work with as many video hosting sites and video search engines as possible. We believe that the future of media depends on creators being able to choose the publishing services that work best for them, rather than being forced to use a few monopolistic services.
Filed under: tool, video | No Comments »
Posted on April 22, 2008 by michaelangela
I sure wish there was something like this for Eclipse and Aptana! Perhaps this could be a start? Here’s to hoping…!
Facebook Platform Developer Forum / TextMate FBML plugin
Put together a start of a TextMate Bundle for Facebook. Does some cool stuff, like code completion and doc lookup. If anyone wants to contribute, ping me and I’l put you on the project.
http://code.google.com/p/facebooktextmate/
Filed under: cool, dev, facebook, fbml, plugin, textmate, tip, tool | No Comments »
Posted on April 22, 2008 by michaelangela
Django snippets: Referer-checking view decorators
Here are a couple of Django decorators for limiting access to a view based on the request’s HTTP_REFERER. Both raise a Django PermissionDenied exception if the referer test fails (or a referer simply isn’t provided).
The first, referer_matches_hostname, takes a hostname
(and port, if specified) and matches it against the referer’s. If
multiple arguments are supplied a match against any of the hostnames
will be considered valid.
The second, referer_matches_re, takes a regex pattern (like Django’s urlpattern) and tests if it matches the referer. This is obviously more flexible than referer_matches_hostname providing the ability to match not just the hostname, but any part of the referer url.
Finally there’s an simple example decorator, local_referer_only, that limits a view to the current site by using Django’s django.contrib.sites to look up the current hostname.
Filed under: deep-linking, dev, django, snippet, tip | No Comments »
Posted on April 22, 2008 by michaelangela
This might be useful but, buyer beware.
Django snippets: FieldLevelPermissionsAdmin
Have you ever needed to customize permissions, for example, allow only some fields for editing by some group of users, display some fields as read-only, and some to hide completely? FieldLevelPermissionsAdmin class does this for newforms-admin branch. Not tested well yet (>100 LOC!).
Filed under: dev, django, snippet | No Comments »
Posted on April 20, 2008 by michaelangela
I have not been able to find any info about 1and1 and http compression. It’s a shame as it really reduces bandwidth, increases transfer speed, etc. Fortunately this little script does a really nice job of it. It’s in PHP and it works a treat on 1and1. With a bit of rewrite magic I should be able to access the files normally and the gzipped ones will be passed in when needed. Nice.
Julien Lecomte’s Blog » Gzip Your Minified JavaScript Files
If your web hosting company does not offer HTTP compression, but gives
you access to PHP (that’s the case of Yahoo! Web Hosting), I wrote a simple PHP script that will compress files and set the cache control headers so that the requested files actually get cached by the browser.
Filed under: 1and1, gzip, modrewrite, php, snippet, tip, tool | No Comments »
Posted on April 18, 2008 by michaelangela
You can use this to set up a Facebook User within you Django app. This of course uses the middleware which is optional as described here.
Django snippets: Little middleware that create a facebook user
-
Install **PyFacebook** package.
-
After make all steps in tutorial above, put this code in your app’s
models.py module (you maybe prefer split it and put the middleware
class in some other file).
- Put the FacebookUserMiddleware python-path in the
MIDDLEWARE_CLASSES in your settings.py (after
facebook.djangofb.FacebookMiddleware).
Filed under: dev, django, facebook, python, snippet, tip | No Comments »
Posted on April 17, 2008 by michaelangela
So far I haven’t really used Django for “web sites”. It’s really been used as a data backend. Well the time has come for some web stuff. It’s set up to use a dev, staging, and production server. All is well and good. But each has a different media server. In Django, how do you tell it to use different media servers in the template?
A couple points. First, Django templates can extend other templates. So even if you have 1,000 templates (?!) but they all extend one basic template (often named "base.html") then changing the base.html updates them all. Keeps things DRY. Python is big on that and it’s good.
And to keep this process DRY, there is a context processor which can automatically provide data for your templates, i.e. a "media_url" variable. Better still, if you use Django’s generic views, any template context processor defined in your site’s settings will automatically be passed in.
James has a great writeup about this process explaining it. In fact, he even has template util library for just this very thing among others.
The B-List: Django tips: Template context processors
A recent example that came up on the django-users mailing list was a template tag to retrieve the base URL
for your media (typically you want to store “media” like images,
stylesheets and JavaScript in a particular location on your server, or
possibly even have a separate server for them if you’re using Apache
and mod_python — incurring the overhead of mod_python on a request
which will just serve up a file from disk wastes resources). Django
lets you specify where your media files come from via the MEDIA_URL setting.
…snip…
As it turns out, Django provides an extremely easy way to do this.
Every time you render a template, you give it a “context”; this is a
dictionary-like object whose keys are variable names and whose values
are the values of the variables. When you render a template with a
given context, every key in the context dictionary becomes a variable
in the template that you can access and use.
Filed under: dev, django, tip, tool | No Comments »
Posted on April 17, 2008 by michaelangela
This list has many of the plugins I already use, and there are more that I haven’t looked at yet. I’ll give them a shot in due time, but it’s a good reference.
dispatchEvent » Pimp my ‘clipse - a list of must-have Eclipse plug-ins for Flex/Flash Development
FlexBuilder may have its ups and downs but it still remains my pick for best AS3/MXML editor on the market (with TextMate not far behind). Part of the beauty of FlexBuilder is that it’s built on the Eclipse SDK, one of the most versatile and powerful IDEs available, which is not only free and open source, but boasts a wealth of third party plug-ins
for every kind of (mostly Java) development. This article will take a
look at some must-have plug-ins for doing Flex development as well as
some tips for tricking out your development process.
Filed under: cool, eclipse, flex, plugins, tool | No Comments »
Posted on April 17, 2008 by michaelangela
This podcast with Thomas Burleson probably has the best description of MVC with Flex, why to use Cairngorm, challenges of using Cairngorm, why to use the universal mind extensions, the problem of view locators and how to work with those, etc. Good stuff. I wish there was a transcript of this.
UMEvent, UMCommand, Callbacks, and other goodies galore. Cairngorm is really, really good. It’s very lightweight. This just takes it further. Now I just need to understand how to use them.
But that’ll come later.
Another interesting bit is about the centralized error handling… oh good stuff.
Hmm… webservice is far slower than remote objects. And if they fail,
they can fail silently. Ah, that’s WSDL services. Interesting stuff.
Sequences in Cairngorm is quite different than sequences in UM Cairngorm… wow… nice stuff. It’s giving you quite a bit of flexibility: firing sequence of events and commands.
Another bit about refactoring is mentioned, i.e. every use case in Cairngorm has a command/event. It’s definitely workable but it can get tedious. The UM extensions help with that as well.
Download the file and listen to it with Quicktime Player and bump the speed up to like 175% to save some time.
The Flex Show: The Flex Show - Episode 41: Universal Mind Cairngorm Extensions w/ Thomas Burleson
Filed under: cairngorm, cool, dev, education, flex, mvc, tip | No Comments »