Convert string "Jun 1 2005 1:33PM" into datetime
I have a huge list of datetime strings like the following ["Jun 1 2005 1:33PM", "Aug 28 1999 12:00AM"] How do I convert them into datetime objects?
Join the discussion →I have a huge list of datetime strings like the following ["Jun 1 2005 1:33PM", "Aug 28 1999 12:00AM"] How do I convert them into datetime objects?
Join the discussion →I'm trying to find out where I can find documentation on POSIX functions, but coming up short. Any recommendations?
Join the discussion →I've been learning C#, and I'm trying to understand lambdas. In this sample below, it prints out 10 ten times. class Program { delegate void Action(); static void Main(string[] args) { List<Action> actions = new List<Action>(); for (int i = 0; i < 10; ++i ) actions.Add(()=>Console.WriteLine(i)); foreach (Action a in actions) a(); } } Obviously, the generated class behind the lambda is storing a reference or pointer to the int i variable, and is assigning a new value to the same reference every time the loop iterates. Is there a way to force the lamda to grab a copy instead, like the C++0x synt
Join the discussion →I'm trying to use this code to replace spaces with _, it works for the first space in the string but all the other instances of spaces remain unchanged. Anybody know why? function updateKey() { var key=$("#title").val(); key=key.replace(" ","_"); $("#url_key").val(key); }
Join the discussion →I've models for Books, Chapters and Pages. They are all written by a User: from django.db import models class Book(models.Model) author = models.ForeignKey('auth.User') class Chapter(models.Model) author = models.ForeignKey('auth.User') book = models.ForeignKey(Book) class Page(models.Model) author = models.ForeignKey('auth.User') book = models.ForeignKey(Book) chapter = models.ForeignKey(Chapter) What I'd like to do is duplicate an existing Book and update it's User to someone else. The wrinkle is I would also like to duplicate all related model instances to the Book - all it's Chapters and P
Join the discussion →I am searching for a proof that all AVL trees can be colored like a red-black tree? Can anyone give the proof?
Join the discussion →By default Eclipse indents with a hard tab character. How do I change it to spaces?
Join the discussion →I've been using Oslo for MSchema. Works great. I can write an M Schema for a database design and it generates T-SQL to build the entire db with PKs, FKs, checks for integrity etc. I've set up a .bat file to compile the .m into .mx then load it into the db, then run SqlMetal into my project and in 30 seconds I'm moving on with my changes. I love it. OK so now I'm moving on into mGrammar. I'm not quite sure how I'll incorporate it into my app but I'll figure that out. What I need first is to set up Intellipad to give me the Input/Grammar/Output triptych. I'm stumped. I can't figure out any way t
Join the discussion →I currently use RCS' merge command to do 3-way merges, but one thing has always annoyed me about it. If I use the -A option, the same change made in both files shows up as a conflict: <<<<<<< file1 file1 line 1 ||||||| orig orig line 1 ======= file2 line 1 >>>>>>> file2 orig line 2 <<<<<<< orig ======= line added in both changes >>>>>>> file2 orig line 3 If I use the default (-E) then those identical changes are not shown, but then the output only shows the two contributors, not the ancestor, something like this: <<<<<<< file1 file1 line 1 ======= file2 line 1 >>>>>>> file2 orig line 2 line ad
Join the discussion →This is a follow-up to my question yesterday: CMS kindly provided this example of using bitwise operators to add two numbers in C: #include<stdio.h> int add(int x, int y) { int a, b; do { a = x & y; b = x ^ y; x = a << 1; y = b; } while (a); return b; } int main( void ){ printf( "6 + 3 = %d", add(6,3)); printf( "6 - 3 = %d", add(6,-3)); return 0; } It works great and I then ported it to Python as follows: def add(x, y): while True: a = x & y b = x ^ y x = a << 1 y = b if a == 0: break return b print "6 + 3 = %d" % add(6,3) print "6 - 3 = %d" % add(6,-3) They both work for addition and the C pr
Join the discussion →I know M is a new language from Microsoft that's targeted as a modeling solution but I'm still a bit fuzzy on usage / rationale / advantages. That's why I'm looking for interesting things that people have done with M, so I can understand it better.
Join the discussion →I want to create a custom web part that has more than 1 filter web part and that can be connected to Report Viewer Web Part (Integrated Mode) at runtime/design time. I searched a lot for this, but could not find a way to have single web part that is a provider to more than 1 filters. Say for example - My Report accepts 2 parameter Department and Region. I want to connect both parameters with single web part having two drop down (one for Department and one for Region) Values from both the drop down should be passed to Department and Region Report should be rendered in Report Viewer Web Part Sol
Join the discussion →What's better for DSL: TCL or Lisp? What can you say about Java(C#)-TCL binding versus Lisp(Scheme)? What DSL tool is applicable for .Net development? (excepting Microsoft DSL tools)
Join the discussion →After attending a talk on Oslo/M I am struggling a bit to see the advantages of using it over existing methods and in what situation it would be useful. I know its quite new and not all details have been released etc but can some one give me some advantages and when you might use it?
Join the discussion →This is mostly a theoretical question I'm just very curious about. (I'm not trying to do this by coding it myself or anything, I'm not reinventing wheels.) My question is how the uppercase/lowercase table of equivalence works for Unicode. For example, if I had to do this in ASCII, I'd take a character, and if it falls withing the [a-z] range, I'd sum the difference between A and a. If it doesn't fall on that range, I'd have a small equivalence table for the 10 or so accented characters plus ñ. (Or, I could just have a full equivalence array with 256 entries, most of which would be the same as
Join the discussion →Given a class instance, is it possible to determine if it implements a particular interface? As far as I know, there isn't a built-in function to do this directly. What options do I have (if any)?
Join the discussion →Let's make a list of answers where you post your excellent and favorite extension methods. The requirement is that the full code must be posted and a example and an explanation on how to use it. Based on the high interest in this topic I have setup an Open Source Project called extensionoverflow on Codeplex. Please mark your answers with an acceptance to put the code in the Codeplex project. Please post the full sourcecode and not a link. Codeplex News: 24.08.2010 The Codeplex page is now here: http://extensionoverflow.codeplex.com/ 11.11.2008 XmlSerialize / XmlDeserialize is now Implemented a
Join the discussion →On the MSVC++ compiler, one can use the __int8, __int16, __int32 and similar types for integers with specific sizes. This is extremely useful for applications which need to work with low-level data structures like custom file formats, hardware control data structures and the like. Is there a similar equivalent I can use on the GCC compiler?
Join the discussion →I have a very standard Gridview, with Edit and Delete buttons auto-generated. It is bound to a tableadapter which is linked to my RelationshipTypes table. dbo.RelationshipTypes: ID, Name, OriginConfigTypeID, DestinationConfigTypeID I wish to use a label that will pull the name from the ConfigTypes table, using the OriginConfigTypeID and DestinationTypeID as the link. dbo.ConfigTypes: ID, Name My problem is, I can't automatically generate Edit and Delete buttons using an Inner Join in my dataset. Or can I? Here is my code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Join the discussion →In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine: module T { type A { Id : Integer32 = AutoNumber(); } where identity Id; As : A*; type B { Id : Integer32 = AutoNumber(); // A : A; // } where A in As && identity Id; } where identity Id; Bs : B*; type C { Id : Integer32 = AutoNumber(); B : B; } where B in Bs && identity Id; Cs : C*; } and results in the following Reach SQL output: set xact_abort on; go begin transaction; go set ansi_nulls on; go create schema [T]; go create table [T].[As] ( [Id] int not null identity, constraint [PK_As] primary key clustered ([
Join the discussion →In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine: module M { type T { Text : Text; } } while compiling the below code leads to the error "M0197: 'Text' cannot be used in a Type context" module M { type T { Text : Text; Value : Text; // error } } I do not see the difference between the examples, as in the first case Text is also used in a Type context. To add to the confusion, consider the following example, which also compiles fine: module M { type X; type T { X : X; Y : X; } } The Oslo M Language Specification states that: Field declarations override lexical
Join the discussion →I have an EXE file that I should like to sign so that Windows will not warn the end user about an application from an "unknown publisher". I am not a Windows developer. The application in question is a screensaver generated from an application that generates screensaver applications. As such I have no influence on how the file is generated. I've already found out that I will need a code signing certificate from a CA like Verisign or instantssl.com. What I don't understand is what I need to do (if at all possible) to sign my EXE file. What is a simple explanation? Mel Green's answer took me fur
Join the discussion →I've been assigned the task of buying a digital certificate for my company to sign our code. We develop applications in the Microsoft space, mostly WPF or Web-based. I've investigated options and found Comodo to be well priced and responsive, and we're ready to go ahead and purchase a certificate through them... However, in the signup form there are various private key options that I'm not too sure about, namely: CSP Microsoft Base Cryptographic Provider Microsoft Base Smart Card Crypto Provider Microsoft Enhanced Cryptographic Provider v1.0 Microsoft Software Cryptographic Provider Key Size 1
Join the discussion →How can you programmatically tell an HTML select to drop down (for example, due to mouseover)?
Join the discussion →What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5? This question is primarily to aid those who are searching for an answer using an incorrect version number, e.g. C# 3.5. The hope is that anyone failing to find an answer with the wrong version number will find this question and then search again with the right version number.
Join the discussion →When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a progress bar is needed. For example, copying a big file, opening a big tar file. What ways do you recommend to add progress bars to shell scripts?
Join the discussion →We (apparently) had poorly executed of our Solaris MySQL database engine last night. At least some of the InnoDB tables are corrupted, with timestamp out of order errors in the transaction log, and a specific error about the index being corrupted. We know about the tools available for MyISAM table repairs, but cannot find anything for InnoDB. Side note: attempting a table optimize (in my attempt to rebuild the corrupted index) causes the database server to crash.
Join the discussion →I have an existing Perl program that uses Getopt package and Getopt::Long::Configure with permute as one of the options. However, now I need to keep the order of the options entered by the user. There is an option $RETURN_IN_ORDER mentioned in the Long.pm file, however it doesn't seem to be used anywhere at all. When I pass return_in_order, I am getting the following error. Getopt::Long: unknown config parameter "return_in_order" at C:/Program Files/IBM/RationalSDLC/common/lib/perl5/5.8.6/Getopt/Long.pm line 1199. Can someone please tell me if this is supported at all and if so, the right way
Join the discussion →What is the correct (most efficient) way to define the main() function in C and C++ — int main() or void main() — and why? And how about the arguments? If int main() then return 1 or return 0?
Join the discussion →Anyone know a simple method to swap the background color of a webpage using JavaScript?
Join the discussion →