I need to split a list into halves such that if it has an odd length the middle element is ignored entirely, I have a function for this, but it's quite slow for what I'm trying to do.  My function (variables renamed because they make no sense out of context):  def splitList(array):     half = len(array)/2     if len(array)%2==0:         return array[:half], array[half:]     else:         return array[:half], array[half+1:]   This function has to be called about 17 million times if my estimations are correct, so it has to be rather faster. Since I'm new to this though, if you could explain why your answer works faster, that would be perfect :)  last-minute thingy: it's for a small part of a projectEuler challenge if you were wondering, you're supposed to be able to get an answer in under a minute is why it has to be so fast.
I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:
Better HTTPS support for Stack Exchange sites So it looks like Stack Exchange now supports HTTPS (to some extent). Which is awesome! But there are a few problems, the main one being that some content is delivered over the CDN, which is plain HTTP. This causes browsers to complain about "unsecured content": Add bst file with LaTeX / MiKTeX I'm trying to use elsarticle-num-ident.bst, an exact copy of  C:\Program Files (x86)\MiKTeX 2.9\bibtex\bst\elsarticle\elsarticle-num.bst    but every time I run LyX, I get the bibtex error  I couldn't open style file elsarticle-num-ident.bst   This is despite reconfiguring LyX and restarting, and despite running MixTex's Settings/Options' "Refresh FNDB" as Administrator.  It also doesn't work if I put the .bst file in the same folder as the .lyx file.  How should I help lyx/bibtex/Mixtex find the .bst file?  Once I get the identical copy to work, I plan to edit it to not print URLs, as suggested .  Related questions: Is there any SCP program available for Ubuntu that does not require SFTP on a remote host? I need a program that can manage files on a remote device running Linux using SCP. The remote device runs OpenWrt. On Windows there is a perfect one WinSCP. it is weird that there is no native program that can be used. The program should be able to:  list files copy and move files to/from the device and within the device. delete files on the device view and edit files change file permissions  I have found only one alternative, except using CLI and installing WinSCP with wine. It is Midnight Commander with fish. It works really poor. The problems are:  It mixes up ~ on a remote device and on the computer. It can't edit files. I can open and edit, but they are saved to a wrong place.  There is a lot of other annoying problems that makes it almost unusable. I gave up using mc and now I am using pure shell on the remote device. Please do not tell me that Nautilus, etc support these features. They don't!!! Linux native file managers require SFTP that is not available on the remote device. Maybe it is possible to get nautilus use SCP, but I did not find a way of doing it without changing sources. THIS IS NOT A DUPLICATE !!! I have a specific requirement that is not covered in the duplicate question. If it is not possible on Ubuntu, then this could be an answer. A key doubt about the resultant of two polynomials and their common zero locus Where to download Chrome 32bit? Google has  so on a 32bit Debian machine it's not possible anymore to update the APT repository:  W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release  Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)   Also has the .deb file removed from Google servers as it seems.  Is there any alternative .deb download of the last release (46?) available somewhere?  Reason: For an automated Debian build system (debootstrap-based) I urgently need a way to install Google Chrome 32bit v46 (or similar). Switching to another browser (including Chromium) is not a quick enough option for me at the moment.. $n$ choose $k$ where $n$ is less than $k$ Extra blue line appearing in the top bar (Firefox only) Whenever we click on the Inbox or the Achievements in the top bar, an extra blue line appears near by them. This is reproducible on Stack Overflow and Anime &amp; Manga(as I use only those) but not on Meta Stack Overflow. Here is a snapshot of that.    I'm using Firefox 25.0.1 on Win7 Pro.  Edit: Just to be double sure, I restarted the FF and still I'm able to see it. Here is another snapshot, with the 2 distinct sites. Work out the type of c# application a class contained in a DLL is being used by Is there any way to know in C# the type of application that is running.  Windows Service ASP.NET Windows Form Console  I would like to react to the application type but cannot find a way to determine it. I want to add  on my blog hosted on Blogger. The only solution I found is , but it requires a hosting server. Any other option? It is a general concept that horizontal forces can only influence physical quantities along horizontal direction; similarly vertical force can produce acceleration etc. only along vertical direction. This is the same concept that helps us study projectile motion as a combination of two independent motions. If this relation is universally true, how come, then friction depend on a force which normal to it? Use template_include with custom post types I want to check for an appropriate template in the theme folder before falling back to the file in my plugin directory. Here’s my code:  add_filter('template_include', 'sermon_template_include'); function sermon_template_include($template) {     if(get_query_var('post_type') == 'wpfc_sermon') {         if ( is_archive() || is_search() ) :            if(file_exists(TEMPLATEDIR . '/archive-wpfc_sermon.php'))               return TEMPLATEDIR . '/archive-wpfc_sermon.php';            return dirname(__FILE__) . '/views/archive-wpfc_sermon.php';         else :            if(file_exists(TEMPLATEDIR . '/single-wpfc_sermon.php'))               return TEMPLATEDIR . '/single-wpfc_sermon.php';            return dirname(__FILE__) . '/views/single-wpfc_sermon.php';         endif;     }     return $template; }   Problem is, it doesn’t work! :-) It always picks the file in my plugin folder. Any idea what to do? I’ve tried alot of variations but I can’t seem to get anything to work! Thanks in advance! Jack  EDIT  I'm expecting the archive-wpfc_sermon.php to be returned from the theme folder if it exists. However, the file from my plugin always gets returned. Thanks for your help! This is from my Sermon Manager plugin available in the repository. Degree of minimum polynomial at most $n$ without Cayley-Hamilton? Gameplay programmers write game code, but so do game designers and developers. Where is the line drawn? What skills do gameplay programmers use that game designers or developers do not? How long is it safe to marinate meat? I am aware of the die() command in PHP which exits a script early.  How can I do this in Python? If $G$ is a finite $p$-group with a nontrivial normal subgroup $H$, then the intersection of $H$ and the center of $G$ is not trivial. Is there a word to describe someone who tends to disagree with others only to upset them? How do I pack textures for sending off to a render farm Whenever i try to send a project off to a render farm such as sheepit, it says it needs the textures packing with the file in order to render correctly.  How would I do this? I have a Dell Inspiron 1525 laptop and I am planning on purchasing a mac mini, new version , I am tight on money for a while and want to use my current laptop screen as monitor for mac mini, I just want to know if it is at all possible to do, I have windows 7 and ubuntu 11.04 installed in my laptop, and I don't really care if need to wipe them out, or purchasing a monitos is the only option left, also I am planning to use it for coding and stuff, so VNC is probably not a good choice. Calculate the limit of two interrelated sequences?