Viewing posts by scoopseven
Here's a quick script for creating or updating MySQL accounts via the command line so that you're able to login from any host. It's really easy to replace the '%' with your actual hostname or ip to make this more secure, so if at all possible, you should.
I had a small piece of code I was using to parse a search string in Python for Sphinx. When you pass "verizon | mobile | at&t" to Sphinx (in boolean mode) it happily returns results. However, if you pass "verizon | mobile | at&t | " it throws an "unexpected $end near ''" error. So I needed to not add the extra pipe/or for the last element in my search string. Using split() to turn the string into a list and then using the [-1] index, you're able to determine if you're on the last element and not add the extraneous "or."
In order to get Sphinx to work in boolean mode in Python/Django, you need to pass the "mode" argument as it's plain text value to the SphinxSearch class.
I've finally given up on Dreamweaver. Too many times it's locked up on me and refuses to open. I've had to rename my local source folders, find hidden xml files to delete cache, etc, etc. Too much time wasted to use an editor that isn't that great to begin with. The one thing that's held me to it was the remote capabilities with RDS and FTP. No more.
If you need to render a Django ModelFormField as text, that is, the value of that form field as text, you can do so by referring to the bound instance for the ModelForm, like so: