Django — How to filter models by a field on the model

I had read this functionality in the docs, but couldn’t find it with my googlefu.

Update: I couldn’t find my own post via my googlefu when I needed it again so I will insert some useful keywords here: Django Self Reference Field

For future reference, it’s the F object from django.db.models

Syntax:

Model.objects.filter(some_field=F('other_field'))

This would filter for models where some_field is equal to other_field in the same instance.

British told how to treat visitors for London 2012 Olympics

Hilarious article on how the british are being told to handle visitors of various foreign cultures.


Daniel gets quoted on some Argentine specific gotchas nobody was aware of.

“Don’t pour wine (for an Argentinean). The whole process has a number of social taboos and unless you understand them you could insult someone. For example, pouring wine backwards into a glass indicates hostility.”

More fun stuff…

He may be smiling. Don’t be fooled. If he’s Japanese that doesn’t mean he’s happy.

Stop snapping your fingers (Belgians).

Don’t wink (Hong Kong again).

Don’t say thank you (Chinese).

Quite a funny read..

http://www.thestar.com/news/world/article/846560–british-told-how-to-treat-visitors-including-canadians-to-the-2012-olympics

Mac — Adding Hex Color Picker to Color Picker

I’ve actually been launching Photoshop here and there to get my color picker (ridiculous, I know), or if I manage to remember, preview + color picker.

It’s time to set up a real hex color picker.

First, let’s make the color picker an executable app.

Push CMD + Space, and run AppleScript Editor

In the window that appears, type in “choose color”.

Save it as an app in the “file format” field, and name it what you’d like.

Now I’d go ahead and give it the icon of the Digital Color Meter and throw it on the dock:


Install HexColorPicker

Download file at http://wafflesoftware.net/hexpicker/

and move the HexColorPicker.colorPicker to your ~/Library/ColorPickers

You’re done — start the app and look at your shiny new tab on the right.

Mac — Remove Touchpad Drag Delay with BetterTouchTool (free)

The mac has a drag release delay on the touchpad.

Say you start to drag a file via tap+tap hold drag: pretty standard.

As soon as you release though, you notice the window is still attached to the pointer. No, you don’t have drag lock enabled (er, you might), you have some built in “feature” to keep the window attached even when your hand goes off the touchpad.

This can be useful but for me just messes with my workflow since it’s hard to predict.

Luckily, BetterTouchTool takes care of this, along with MANY other awesome features missing from the OS, including windows 7 window resizing, custom gestures (I have my 4 finger swipe moving spaces).

More on BetterTouchTool here:

https://yuji.wordpress.com/2010/07/25/mac-osx-multitouch-spaces-custom-multitouch-windows-7-like-windows/

To remove the drag release delay…

Install BetterTouchTool and navigate to its preference panel.

Go to the touchpad settings, and in the general tab, click the experimental drag button.

Let me know if it helped!

Mac OSX — Multitouch Spaces / Custom Multitouch / Windows 7 Like Snapping & Resizing

I found an extremely versatile tool called MultiTouchTool here: http://mac.softpedia.com/progDownload/BetterTouchTool-Download-66288.html

It seems extremely well made in general, especially for a .5 alpha?

Anyways, it lets you remap gestures (and adds tons of new ones too). The program comes with another awesome perk: maximizing windows like in windows 7: drag a window to the top edge and it will maximize.


Setting my four finger swipes to navigate spaces:

I’ve set my four finger swipe left / swipe right to move spaces left /right.

I have my spaces set up in 1 row, so that’s all I need. Super useful! Looks like it’s robust enough to handle any keyboard shortcut!

Remember to disable the default multitouch swipe you’re replacing, or you’ll get buggy results.

Troubleshooting: Note that when you launch it, it may open a warning dialog saying you need to turn on the accessibility API. I couldn’t find it (was in space 1) and thought it was broken.

Windows 7 like maximize:

Awesome windows 7 like window snapping features.

My favorite is being able to drag towards the top to maximize, but have the window REVERT to the original size when moved.

Install the app and the settings are under “Action Settings” in its preference panel.

What a find.

Supporting Middle Mouse Click + Drag on the Touchpad:

Found a great little extra here – I didn’t even ask for it!

Increase Trackpad Speed Beyond Max

I bought the 17″ Macbook Pro, and the screen is too big to comfortably navigate with even the max track speed in the preferences.

Luckily, this same program fixes nearly everything I dislike about the default mac settings. And I didn’t even ask for it.

iPhone iTunes — How to Sync Apps from iPhone to iTunes

I had to google for an hour to figure this one out. Damn you apple!

Yes, I’ve right clicked and click transfer purchases. Yes, I’ve synced. No, I do not want all my apps/songs deleted from my iPhone.

I found in an obscure forum reference that  the computer needs to be Authorized by itunes. It looks like you have 6 computers per account.

How to do it right:

Open iTunes, click on the Store menu, and click Authorize this computer. Done.

Now, right click your iphone and click Transfer Purchases, or go to the file menu for the same thing.

Oh my effing god, that was 150x harder than needed. Documentation would help. It was confusing when right clicking transfer purchases before authorization shows a split second of one of my apps in the status bar that disappears with no warning. It would be a good place to throw out an error message saying: “Hi, no apps have been synced for 1 of 2 reasons: you have no apps. your computer is not authorized.”

I really hope this helps somebody else out there.