Convert NumPy array to Python list
How do I convert a NumPy array into a Python list?
Join the discussion →How do I convert a NumPy array into a Python list?
Join the discussion →Possible Duplicate: JS delete operator and garbage collection I have a JS object having a large number of properties. If I want to force the browser to garbage collect this object, do I need to set each of these properties as null or do I need to use the delete operator? What's the difference between the two?
Join the discussion →I have VBA code to select a range of cells on the same row and then merge & left justify that selection. I would like to enhance it to allow me to select a range or block of rows and perform the same action on each row in the range.
Join the discussion →I know I can get the size of the primary screen by using System.Windows.SystemParameters.PrimaryScreenWidth; System.Windows.SystemParameters.PrimaryScreenHeight; But how do I get the size of the current screen? (Multi-Screen users do not always use the primary screen and not all screens are using the same resolution, right?) It would be nice to be able to acces the size from XAML, but doing so from code (C#) would suffice.
Join the discussion →mov al, 10 add al, 15 How do I print the value of al?
Join the discussion →Does anyone know of some CRC test vectors for CRC16-CCITT? I do not have a CRC implementation I can trust and either need to test someone's implementation or my own. (For CRC32, I use the PNG code as the gold standard, as it's a reputable reference implementation.) (this site's CRC calculator looks useful but I need to verify correctness somehow) UPDATE: The above CRC calculator looks useful but it takes only ascii, no way to enter hex. --- it's very awkward to enter hex input, though. (ASCII 12 in hex can be entered as %31%32, so you can't just copy+paste a long string of hexadecimal bytes; a
Join the discussion →Many file storage systems use hashes to avoid duplication of the same file content data (among other reasons), e.g., Git and Dropbox both use SHA256. The file names and dates can be different, but as long as the content gets the same hash generated, it never gets stored more than once. It seems this would be a sensible thing to do in a OS file system in order to save space. Are there any file systems for Windows or *nix that do this, or is there a good reason why none of them do? This would, for the most part, eliminate the need for duplicate file finder utilities, because at that point the on
Join the discussion →I am using Python 2.5 in Windows and I am trying import curses.ascii.* to a django project. Code: from curses.ascii import * Error: No module named _curses. Any suggestion? By the way, the only function I need to use is isalpha()...
Join the discussion →I am trying to vocab list for a Greek text we are translating in class. I want to replace every space or tab character with a paragraph mark so that every word appears on its own line. Can anyone give me the sed command, and explain what it is that I'm doing? I’m still trying to figure sed out.
Join the discussion →This question goes out to the C gurus out there: In C, it is possible to declare a pointer as follows: char (* p)[10]; .. which basically states that this pointer points to an array of 10 chars. The neat thing about declaring a pointer like this is that you will get a compile time error if you try to assign a pointer of an array of different size to p. It will also give you a compile time error if you try to assign the value of a simple char pointer to p. I tried this with gcc and it seems to work with ANSI, C89 and C99. It looks to me like declaring a pointer like this would be very useful -
Join the discussion →Consider the following: me@mine:~$ cat a.sh #!/bin/bash echo "Lines: " $LINES echo "Columns: " $COLUMNS me@mine:~$ ./a.sh Lines: Columns: me@mine:~$ echo "Lines: " $LINES Lines: 52 me@mine:~$ echo "Columns: " $COLUMNS Columns: 157 me@mine:~$ The variables $LINES and $COLUMNS are shell variables, not environmental variables, and thus are not exported to the child process (but they are automatically updated when I resize the xterm window, even when logged in via ssh from a remote location). Is there a way in which I can let my script know the current terminal size? I need this as a workaround to
Join the discussion →Is there a high level language with an interpreter, dynamic compiler and static compiler(e.g. like the c++ compiler) along with a multimedia library? The interpreter and dynamic compiler would be for testing/prototyping and when im done testing i use the static compiler.
Join the discussion →when retrieving data from a URL using curl, I sometimes (in 80% of the cases) get error 18: transfer closed with outstanding read data remaining Part of the returned data is then missing. The weird thing is that this does never occur when the CURLOPT_RETURNTRANSFER is set to false, that is the curl_exec function doesn't return the data but displays the content directly. What could be the problem? Can I set some of the options to avoid such behaviour?
Join the discussion →I have a data file where I need to read a datum from each line and store it. And then depending on the value of one of those datums store that data in an array so that I can then calculate the median value of all of these data. The line of data is demographic information and depending on the geographic location, address of a person. I need to capture their age and then find the median of the people that live on a particular street for example. So the data set is 150,000 records and each record has 26 fields, a lot of those fields are segments of an address and then the other fields are just nu
Join the discussion →I have a data file where I need to read a datum from each line and store it. And then depending on the value of one of those datums store that data in an array so that I can then calculate the median value of all of these data. The line of data is demographic information and depending on the geographic location, address of a person. I need to capture their age and then find the median of the people that live on a particular street for example. So the data set is 150,000 records and each record has 26 fields, a lot of those fields are segments of an address and then the other fields are just nu
Join the discussion →Why is the expression specified inside a comma operator (such as the example below) not considered a constant expression? For example, int a = (10,20) ; when given in global scope yields an error "initializer is not a constant", though both the expressions separated by a comma operator are constants (constant expressions). Why is the entire expression is not treated as a constant expression? For clarification I have read What does the ‘,’ operator do in C? and Uses of C comma operator. They have not dealt this aspect of comma operator.
Join the discussion →I've been looking on golang.org for a Windows compiler, but I can't seem to find it. I can only see Linux and OS X compilers. Does anyone know if Go programming can be done on Windows, or is it something that Google hasn't implemented yet? Update: appears that as of now (Nov. 2012) golang.org has official binary releases for windows 32/x86_64.
Join the discussion →I am trying to do it, but all I can get is some source code that I don't know how to do deal with I downloaded from http://pkgconfig.freedesktop.org/releases/.
Join the discussion →I am programming in Flash for a long-time. It is interesting that most of the things, including open source libraries, are very high-level in the Flash world. It is great because we can build things up quickly. But Flash is too slow (I want to do CV stuff, visual effect, generative art etc). I have tried glut, Processing, OpenFrameworks and I found them too different from Flash. So, I want to know if there is any high-level (like PaperVision3D), fast (better hardware-accelerated) 3D engine? It can be in any language, but better in C++/Java/Python etc.
Join the discussion →I want to migrate schema from Oracle to MySQl, so are there any free tools that would be useful for this task? I have "Create table" statements in Oracle SQL Script, but it contains unique constraints and a foreign key. MySQL has MyISAM storage engine, and so foreign key is not supported. How to solve this issue? Sample Oracle create statements: CREATE TABLE channels ( obt_id NUMBER(19) PRIMARY KEY, discriminator VARCHAR2(64) NOT NULL CONSTRAINT check_channel_discriminator CHECK (discriminator IN ('CHANNEL','SALES_CHANNEL')), chan_id VARCHAR2(255), description VARCHAR2(255), name VARCHAR2(255)
Join the discussion →Is it possible to let your user download a file with an arbitrary name? For example, there is a file called "4324ffsd34.jpg". I want people to download it via download.php, with a different name (like "filetodownload.jpg"), without renaming the original file. Or, if I'm sending data from a variable to the user as a download, how can I name it?
Join the discussion →I'm trying to time some code. First I used a timing decorator: #!/usr/bin/env python import time from itertools import izip from random import shuffle def timing_val(func): def wrapper(*arg, **kw): '''source: http://www.daniweb.com/code/snippet368.html''' t1 = time.time() res = func(*arg, **kw) t2 = time.time() return (t2 - t1), res, func.__name__ return wrapper @timing_val def time_izip(alist, n): i = iter(alist) return [x for x in izip(*[i] * n)] @timing_val def time_indexing(alist, n): return [alist[i:i + n] for i in range(0, len(alist), n)] func_list = [locals()[key] for key in locals().ke
Join the discussion →I have the following error while I connect to SQL Server 2008 Management Studio with Windows Authentication. The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details. Why am I getting this error, when my SQL Server is running under network service built in a/c?
Join the discussion →When running a command-line script, is it possible to get the name of the current user?
Join the discussion →How do I, reliably, check in SQLite, whether a particular user table exists? I am not asking for unreliable ways like checking if a "select *" on the table returned an error or not (is this even a good idea?). The reason is like this: In my program, I need to create and then populate some tables if they do not exist already. If they do already exist, I need to update some tables. Should I take some other path instead to signal that the tables in question have already been created - say for example, by creating/putting/setting a certain flag in my program initialization/settings file on disk or
Join the discussion →I am looking for a library that does advanced math, statistics, statistical distribution, etc.. Currently I am looking for something that does binomial and poisson distribution.
Join the discussion →Is there any way in Java to guess the date format when it is not explicitly defined? For example a user types in 11Mar09 or 11-09-2009 or 11/09/2009 or 11-09 what is the best way of parsing this to a Date object without either a bunch of try catch or raising an error?
Join the discussion →Can I apply a CSS style to all headers from H1 to H6?
Join the discussion →When using the "label for" parameter on radio buttons, to be 508 compliant*, is the following correct? <label for="button one"><input type="radio" name="group1" id="r1" value="1" /> button one</label> or is this? <input type="radio" name="group1" id="r1" value="1" /><label for="button one"> button one</label> Reason I ask is that in the second example, "label" is only encompassing the text and not the actual radio button. *Section 508 of the Rehabilitation Act of 1973 requires federal agencies to provide software and website accessibility to people with disabilities.
Join the discussion →I'm trying to concatenate a string in a div with jQuery. Here is my code: var server = 'server name: ' $('#div').load('myservername.aspx'); I'd like to display: server name: myserver How can I best achieve this?
Join the discussion →