Questions

Read .mat files in Python

Is it possible to read binary MATLAB .mat files in Python? I've seen that SciPy has alleged support for reading .mat files, but I'm unsuccessful with it. I installed SciPy version 0.7.0, and I can't ...

24 Jul at 09:26

How can I rename a conda environment?

I have a conda environment named `old_name`, how can I change its name to `new_name` without breaking references?

29 Mar at 07:21

MySQL select 10 random rows from 600K rows fast

How can I best write a query that selects 10 rows randomly from a total of 600k?

16 Jun at 04:35

Rotating videos with FFmpeg

I have been trying to figure out how to rotate videos with FFmpeg. I am working with iPhone videos taken in portrait mode. I know how to determine the current degrees of rotation using [MediaInfo](htt...

1 Sep at 22:55

Convert integer to hexadecimal and back again

How can I convert the following? 2934 (integer) to B76 (hex) Let me explain what I am trying to do. I have User IDs in my database that are stored as integers. Rather than having users reference ...

25 Jun at 17:46

How should I have explained the difference between an Interface and an Abstract class?

In one of my interviews, I have been asked to explain the difference between an and an . Here's my response: > Methods of a Java interface are implicitly abstract and cannot have implementations...

Combating AngularJS executing controller twice

I understand AngularJS runs through some code twice, sometimes even more, like `$watch` events, constantly checking model states etc. However my code: ``` function MyController($scope, User, local) ...

6 Feb at 08:6

CSS Image size, how to fill, but not stretch?

I have an image, and I want to set it a specific width and height (in pixels) But If I set width and height using css (`width:150px; height:100px`), image will be stretched, and It may be ugly. How ...

10 Oct at 21:0

How to replace item in array?

Each item of this array is some number: ``` var items = Array(523,3452,334,31, ...5346); ``` How to replace some item with a new one? For example, we want to replace `3452` with `1010`, how would we ...

12 Jan at 19:42

How to recursively find and list the latest modified files in a directory with subdirectories and times

- Operating system: Linux- Filesystem type: [ext3](https://en.wikipedia.org/wiki/Ext3)- Preferred solution: Bash (script/one-liner), Ruby, or Python I have several directories with several subdirector...

10 Dec at 16:30

Understanding dict.copy() - shallow or deep?

While reading up the documentation for `dict.copy()`, it says that it makes a shallow copy of the dictionary. Same goes for the book I am following (Beazley's Python Reference), which says: > The m....

5 Feb at 13:39

How can I take a screenshot with Selenium WebDriver?

Is it possible to take a screenshot using Selenium WebDriver? (Note: Not [Selenium Remote Control](https://en.wikipedia.org/wiki/Selenium_(software)#Selenium_Remote_Control))

C++ multiline string literal

Is there any way to have multi-line plain-text, constant literals in C++, à la Perl? Maybe some parsing trick with `#include`ing a file? I can't think of one, but boy, that would be nice. I know it'll...

8 Dec at 12:36

What is the difference between JavaScript and ECMAScript?

What's the difference between ECMAScript and JavaScript? From what I've deduced, ECMAScript is the standard and JavaScript is the implementation. Is this correct?

30 Jun at 03:19

Is there a difference between "throw" and "throw ex"?

There are some posts that asks what the difference between those two are already. (why do I have to even mention this...) But my question is different in a way that I am calling "throw ex" in another...

25 Oct at 22:24

How to verify that method was NOT called in Moq?

How do I verify that method was NOT called in [Moq](http://code.google.com/p/moq/)? Does it have something like AssertWasNotCalled? UPDATE: Starting from Version 3.0, a new syntax can be used: ```...

28 Aug at 21:36

What is the difference between "x is null" and "x == null"?

In C# 7, we can use ``` if (x is null) return; ``` instead of ``` if (x == null) return; ``` Are there any advantages to using the new way (former example) over the old way? Are the semantics any di...

21 Oct at 02:28

How to correctly save instance state of Fragments in back stack?

I have found many instances of a similar question on SO but no answer unfortunately meets my requirements. I have different layouts for portrait and landscape and I am using back stack, which both pr...

11 Mar at 17:3

How to install Xcode Command Line Tools

How do I get the command-line build tools installed with the current Xcode/Mac OS X v10.8 (Mountain Lion) or later? Unlike Xcode there is no installer, it's just a bundle. It looks like all the comm...

21 Dec at 21:25

How to take backup of a single table in a MySQL database?

By default, `mysqldump` takes the backup of an entire database. I need to backup a single table in MySQL. Is it possible? How do I restore it?

5 Dec at 21:47

How to revert initial git commit?

I commit to a git repository for the first time; I then regret the commit and want to revert it. I try ``` # git reset --hard HEAD~1 ``` I get this message: ``` fatal: ambiguous argument 'HEAD~1'...

7 Sep at 15:44

Fundamental difference between Hashing and Encryption algorithms

I see a lot of confusion between hashes and encryption algorithms and I would like to hear some more expert advice about: 1. When to use hashes vs encryptions 2. What makes a hash or encryption algo...

23 May at 12:18

How to add multiple font files for the same font?

I'm looking at the [MDC page for the @font-face CSS rule](https://developer.mozilla.org/en/CSS/@font-face), but I don't get one thing. I have separate files for , and . How can I embed all three file...

10 May at 18:6

How would one write object-oriented code in C?

What are some ways to write object-oriented code in C? Especially with regard to polymorphism. --- See also this Stack Overflow question [Object-orientation in C](https://stackoverflow.com/questi...

30 Dec at 23:15

Why is the Java main method static?

The method signature of a Java `main`method is: ``` public static void main(String[] args) { ... } ```

10 Dec at 07:27