Passing arguments django signals – post_save/pre_save

You can define additional arguments in custom save method of model like this: class MyModel(models.Model): …. def save(self, *args, **kwargs): super(MyModel, self).save(*args, **kwargs) self.my_extra_param = ‘hello world’ And access this additional argument through instance in post_save signal receiver: @receiver(post_save, sender=MyModel) def process_my_param(sender, instance, *args, **kwargs): my_extra_param = instance.my_extra_param

Postgres integer arrays as parameters?

See: http://www.postgresql.org/docs/9.1/static/arrays.html If your non-native driver still does not allow you to pass arrays, then you can: pass a string representation of an array (which your stored procedure can then parse into an array — see string_to_array) CREATE FUNCTION my_method(TEXT) RETURNS VOID AS $$ DECLARE ids INT[]; BEGIN ids = string_to_array($1,’,’); … END $$ LANGUAGE … Read more

Is there a difference between main(String args[]) and main(String[] args)?

Semantically, they are identical. However, I’d recommend using the latter syntax (String[] args) when declaring arrays. The former syntax is there mainly for compatibility with C syntax. Since String[], as a whole, is the type of the object in Java, it’s more consistent and clear not to split it up. A similar question addresses the … Read more

Argument passing strategy – environment variables vs. command line

1) I would recommend avoiding environmental variables as much as possible. Pros of environmental variables easy to use because they’re visible from anywhere. If lots of independent programs need a piece of information, this approach is a whole lot more convenient. Cons of environmental variables hard to use correctly because they’re visible (delete-able, set-able) from … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)