magic

How does django convert string to modules

Hi, I am trying to understand an other magic thing about django: it can convert strings to modules. In settings.py, INSTALLED_APPS is declared like that: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', ) All it contains is strings. But django will convert those strings to...

Adding magic global methods to modules

I'm starting to get into the Python logging module, but unless I want all messages to say "root" I have to create a logger for each module, and it's kind of a pain to do that over and over again. I was thinking it would be handy if there were a magic __logger__() method that would return a logger for the current module, creating it if n...

Magic $-prefixed variables in Ruby; is there a complete reference somewhere?

I've seen magic variables like this used in Ruby. $_ $' $0 Is there a complete reference for what all of them mean and how they are set? ...

nil values magic

I have faced the plain simple situation, that i can't figure out. I have to deside, whether to show the "more" link, depending of the articles count The code is plain simple @no_more = offset + length >= Article.count @no_more variable equals to nil sometimes. I see in debugger, that offset=0, length=10 and Article.count=12 But the...

PHP warning magic method set() class.XMLHttpRequest.php

i have a php script that runs perfectly but i get 2 errors: Warning: The magic method __set() must have public visibility and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 63 Warning: The magic method __get() must have public visibility and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 89...

PHP Symfony - Form processing questions

I am trying to build my own user authentication system (simply because the ones out there are too convoluted and big). I have trouble getting to grasps with the symfony form processing though. Am looking at sfDoctrineGuardPlugin, but for the life of me, can't figure out, when the inputted password is converted to a sha1 hash before bein...

Python magical main() signature like Perl 6

Does python have any way to easily and quickly make CLI utilities without lots of argument parsing boilerplate? In perl6, the signature for the MAIN sub automagically parses command line arguments. Is there any way to do something similar in python without lots of boilerplate? If there is not, what would be the best way to do it? I'm t...

doctrine findby magic null value

Hey fellow programmers, I'm wondering if there is anyway to use doctrine's magic method to look for null values. For instance: Doctrine::getTable('myClass')->findByDeletedAt(null); Essentially, i want to return all records that are not deleted. I've tried the above, but it doesn't seem to work. Any ideas? ...

I'm having problems using dates in Android

I am trying to compare dates and I have found where my code goes wrong, but I don't know why. I am trying to compare a date with todays date (using Gregorian Calendars only). I have printed out todays date where ever it is mentioned in the code and in one place it magically changes from year 2010 to year 3910 (todays year + 1900). Doe...

Confusion why a magic 1.6 user cannot find app on market

Hi all, I've published an app today mainly for my forum users to use, just a very simple app that displays wallpapers derived from the forum. Problem I'm having is one guy says it doesn't appear in the market, and I've even sent him the APK to install manually but it fails. My minimum SDK version is 4, I created it with the 1.6 SDK sp...