Are you using it for a WSGI script? If so:
The SetEnv directive will not work as it only sets per request variables in WSGI environ dictionary and not process global os.environ.
Source
Well, this took me way too long to figure out. I was trying to use multiple environments for Trac and I was using its WSGI script. I just switched to the fcgi version and everything's fine now.
I'm off to bed. I'm so gonna hate my day tomorrow...
Thursday, October 17, 2013
Thursday, September 5, 2013
Apache: couldn't perform authentication. authtype not set
I had this error in my /var/log/apache2/error.log file:
configuration error: couldn't perform authentication. AuthType not set!: /~baldho/owncloud
Since the problematic path is a user directory, I added a Satisfy Any option to my Directory directive in my /etc/apache2/mods-enabled/userdir.conf file, like so:
<Directory /home/*/public_html>
[...]
Satisfy Any
[...]
</Directory>
And the problem went away.
configuration error: couldn't perform authentication. AuthType not set!: /~baldho/owncloud
Since the problematic path is a user directory, I added a Satisfy Any option to my Directory directive in my /etc/apache2/mods-enabled/userdir.conf file, like so:
<Directory /home/*/public_html>
[...]
Satisfy Any
[...]
</Directory>
Apache: (403 Forbidden) in response to PROPFIND request
This error would be found in /var/log/apache2/error.log
<Limit GET POST OPTIONS PROPFIND MKCOL PUT>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND MKCOL PUT>
Order deny,allow
Deny from all
</LimitExcept>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND MKCOL PUT>
Order deny,allow
Deny from all
</LimitExcept>
The same Limit tag could be found or added in your /etc/apache2/sites-enabled/default file for a general effect.
This did the trick for me on my Debian system.
Wednesday, August 21, 2013
DevExpress MVC GridView - The inline edit form is not closed when the Update button is pressed
Various conditions can lead to this behavior. I found an interesting ticket about this on DevExpress website:
But that's not all: when the create/update callbacks are called onto the controller, if the method leaves with an invalid ModelState, the same thing occurs. In my case, this was be design and to fix it, I simply cleared the ModelState using ModelState.Clear().
One could also iterate through the ModelState to remove errors only. The goal here is to make the ModelState valid.
More info on this Stack Overflow question:
C# Get Localized Display Annotation without object instance
If you use an annotation on a model property like this:
Elsewhere you can access the localized display string of the model class without instantiating it using the following method. I put it in a static helper class named ModelAnnotationsUtils for easy access:
Usage:
[Display(ResourceType = typeof(MyLocalization.CommonModelsStrings), Name = "User_LastName")]
public string LastName { get; set; }
Elsewhere you can access the localized display string of the model class without instantiating it using the following method. I put it in a static helper class named ModelAnnotationsUtils for easy access:
public static string GetLocalizedDisplay<TModel>(string pPropertyName) { DisplayAttribute attribute = ((DisplayAttribute)(typeof(TModel).GetProperty(pPropertyName).GetCustomAttributes(typeof(DisplayAttribute), true)[0])); ResourceManager rm = new ResourceManager(attribute.ResourceType); return rm.GetString(attribute.Name); }
Usage:
string lastName = ModelAnnotationsUtils.GetLocalizedDisplay<Model.User>("LastName");
Thursday, August 15, 2013
DevExpress MVC GridView: Allow empty string for empty textbox cell
I've been struggling for too long on this. I hope this helps a few.
Instead of writing the usual:
use this:
Not pretty, but does work.
Instead of writing the usual:
settings.Columns.Add("Name");
use this:
settings.Columns.Add(col => { col.FieldName = "Name"; var tbxProperties = col.PropertiesEdit as TextBoxProperties; tbxProperties.ConvertEmptyStringToNull = false; });
Not pretty, but does work.
Friday, August 9, 2013
ASP.Net MVC Html.ValidationMessageFor Static Layout
By default, the resulting field will not display if the validation is ok, and it'll appear when it's not. There might be a case where with such behavior, you end up with dynamically changing dimensions in your layout when editing the field under dynamic validation (jquery.validate.unobtrusive.js). The trick here is to make the hidden validation message occupy space. You can do this by adding this to your style sheet:
You may change "display: block" to "display: inline-block" if you don't want the message to appear under the preceding element.
As of this writing, this is the only way I've been able to achieve this, as the ValidationMessageFor() method doesn't have any setting to play with. Suggestions are welcome!
.field-validation-valid, span.field-validation-error { height: 13px; display: block; }
You may change "display: block" to "display: inline-block" if you don't want the message to appear under the preceding element.
As of this writing, this is the only way I've been able to achieve this, as the ValidationMessageFor() method doesn't have any setting to play with. Suggestions are welcome!
Subscribe to:
Posts (Atom)