Posts

In python, sorting on date field, field may sometimes be null -

Coming to me in a real way to deal with this way. The data is back from reading the database I have. Although I want to sort on accoutingdate, sometimes it can be fake. I am currently working the following: result = sorted (result, key = operator.atmeter ('accountingdate'), reverse = true) But, because some details are empty, "this bomb with typeError: can not compare datetime.date for any type". What is the "most accurate" or "most powerful" way to handle this? It's definitely okay to use the key = function, you have to decide how do you want to treat any values ​​- a Select Date Time Values ​​that you want to be considered equivalent to none for sorting purposes. Eg: import routine brain = datetime.date (datetime.MINYEAR, 1, 1) def getaccountingdate (x): return x ['accountingdate'] or brain result = sort (result, key = Getaccountingdate, reverse = true) Just see how simple it is by defining a cmp function -...

rest - URL encoded route to Rails controller -

I have URL encoded resources such as: This is for A harsh webservice problem that uses user login in path is that the controller in the rail does not decode% 20 I get the following error: ActionController :: routing error ({: No route matched with method = & gt;: post} "/Joe%20Bloggs/index.xml"): What exactly am I trying to do 2 options Get one of (As my registration handler using authlogic): Either (preferably) users to register the user name with the spaces in them, and these are my controllers Has been properly received for. Authlogic default spaces & amp; @ /. Characters - which are ok with me if I can work it ... Or I can restrict authlogic so that the free space can be destroyed. I know that I can do this with: .merge_validates_format_of_login_field_options ... But I have given the correct syntax to provide a new sentence Not fully convinced Regex and the message to return to failure ... Any suggestions greatly appreciated! Usu...

iphone - Online MySQL database in Objective-C -

I am writing a game for the iPhone, and I want an online leaderboard using my SSL, which I I'm familiar. How do I apply this to my app? I think I need to get a frame / library? You should summarize from DB technology, wrap your MySQL db with a simple web service and Runs on a web server, you can use standard HTTP requests from your app to interact with your database. My suggestions (not the only way to do this in any way) ... Django (or some other simple web framework) to wrap your database model Use, you can ever make the Django code from your existing DB schema. / Li> Write a few basic ideas to modify your DB by using your basic POST calls and send username and score data in POST data Write a few simple pages, which will allow the data you want Returns an XML format that you can parse and display the app, but these are essentially just very simple web pages generated. You now have a publicly accessible leaderboard server, which your app can interface with, ...

css - Minimum height on vertically expandable div -

Is there a way to determine the minimum height for a single device, but is it still allowed to make it expandable? For example, I want a div to get an accurate height of 300px when my page loads. However, if more content has been added to the device with Javascript, then I want to extend it after that. If I specify the height and extends before the content div, then it adds the clip or the value of the scrollbar overflow. If I do not specify the height, it only spreads to the content. Thank you The solution given here is that to fix it 6, courtesy selector {min-height: 300px; Height: Auto! Important; Height: 300px; } CSS property minimum height does this. Note that it does not work properly in IE6, although IE considers the 6 code to be height as the low-height , so that you have height To be used, the property in a style sheet that is loaded by IE6 only.

Algorithm to find a number and its square in an array -

I have an array of integers, and I need an O algorithm to know that array Has a number and its square; A pair is enough. I tried to do it myself, but I only managed to find a solution in O (n 2 ). I thought of using counting sort, but memory usage is too big. Create an array twice the heap of the input array (2n) o (n) Copy all the numbers in - O (N) Copy sections of numbers in radix sort (we can do this because they are all intents) o (n) to see it once again After the other O (N) profits two numbers are the same! O (1)

Not able to Style my WPF Controls -

I'm getting mad here! What is missing me and why is not she styling anything: style x: key = "textbox type" targettype = "{x: type textbox}" & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "IFococled" Value = "True" & gt; & Lt; Setter property = "background" value = "red" /> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; Width of text box = "100" style = "{static resource text box style}" height = "20" background = "yellow" & gt; & Lt; / Textbox & gt; The above code does not do anything. This text box does not reveal control! This is because local values ​​override style values. (The properties set directly on an element are of very high priority.) You are setting the background directly on the text box, so going WPF, "OK, it would generally like that the text box ...

Zend Framework - adding a custom field to the session handler? -

Hey all I am using the Zend_SessionHeadler_DbTable session handler and I was curious if someone knows how to add a custom area to the best that the table in which he stores the session data? For example, I want to be able to log the person's username in the session table. Anyone know what is possible with Zend_Session_SaveHandler_DbTable? Now my set up code is $ config = array ('name' = & gt; 'session', 'primary' = & gt; 'id', 'Modified column' = & gt; 'Modified', 'Data columns' = & gt; 'data', 'lifetime column' = & gt; 'lifetime' ); Zend_Session :: setSaveHandler (New Zend_Session_SaveHandler_DbTable ($ config)); Zend_Session :: start (); I think this is possible, I'm searching for the same thing, but if you see that I do not have anything I can see, I think the way to do this is to create another table, as a session ID, in a column and in any other column