Questions

Python decorators in classes

Can one write something like: ``` class Test(object): def _decorator(self, foo): foo() @self._decorator def bar(self): pass ``` This fails: self in @self is unknown I ...

31 Oct at 20:48

How can I remove all my changes in my SVN working directory?

I have an SVN working directory. I made some changes in that directory, and it shows in [svn status](http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.status.html). But is there any way for me to remov...

30 Nov at 13:45

How does @synchronized lock/unlock in Objective-C?

Does @synchronized not use "lock" and "unlock" to achieve mutual exclusion? How does it do lock/unlock then? The output of the following program is only "Hello World". ``` @interface MyLock: NSLock<...

31 Jul at 23:16

Word wrap for a label in Windows Forms

How can one get word wrap functionality for a `Label` for text which goes out of bounds?

15 Jul at 21:52

Get the MD5 hash of big files in Python

I have used [hashlib](https://docs.python.org/3/library/hashlib.html) (which replaces [md5](https://docs.python.org/2/library/md5.html) in Python 2.6/3.0), and it worked fine if I opened a file and pu...

28 Oct at 11:20

How to loop through all but the last item of a list?

I would like to loop through a list checking each item against the one following it. Is there a way I can loop through all but the last item using for x in y? I would prefer to do it without using in...

23 Apr at 22:27

Rollback file to much earlier version using Git

Is there a way in Git to rollback to a much earlier version of a file? I can roll back to the previous version with REVERT, but what if I want to go back to earlier versions?

29 Apr at 12:19

Dynamically creating keys in a JavaScript associative array

All the documentation I've found so far is to update keys that are already created: ``` arr['key'] = val; ``` I have a string like this: `" name = oscar "` And I want to end up with something like th...

21 Jul at 14:21

SQL to LINQ Tool

Is there a tool out there which can convert SQL syntax to LINQ syntax? I just want to rewrite basic queries with join, etc., to [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query). It wou...

18 Nov at 18:41

Is there a max array length limit in C++?

Is there a max length for an array in C++? Is it a C++ limit or does it depend on my machine? Is it tweakable? Does it depend on the type the array is made of? Can I break that limit somehow or do I...

18 Dec at 22:26

When to use IList and when to use List

I know that IList is the interface and List is the concrete type but I still don't know when to use each one. What I'm doing now is if I don't need the Sort or FindAll methods I use the interface. Am ...

19 Aug at 23:9

How to change Node.js version with nvm

I'm using [Yeoman](https://en.wikipedia.org/wiki/Yeoman_(software)) to create a project. When I try to use [Gulp.js](https://en.wikipedia.org/wiki/Gulp.js) I run the command `gulp serve`. An error tel...

9 Aug at 16:59

Entity Framework Core: A second operation started on this context before a previous operation completed

I'm working on a ASP.Net Core 2.0 project using Entity Framework Core ``` <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.1" /> <PackageReference Include="Microsoft.EntityFr...

8 Oct at 12:40

"ssl module in Python is not available" when installing package with pip3

I've install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with `pip3`. When I execute `pip3 install <package>`, I get the following error: ``` pip...

7 Jan at 01:1

Get total of Pandas column

I have a Pandas data frame, as shown below, with multiple columns and would like to get the total of column, `MyColumn`. `print df` ``` X MyColumn Y Z 0 A ...

15 Aug at 16:41

kubectl logs - continuously

``` kubectl logs <pod-id> ``` gets latest logs from my deployment - I am working on a bug and interested to know the logs at runtime - How can I get continuous stream of logs ? edit: corrected ques...

Add property to an array of objects

I have an array of objects as shown below ``` Object {Results:Array[2]} Results:Array[2] [0-1] 0:Object id=1 name: "Rick" 1:Object id=2 name:'david' ``` I...

Add JAR files to a Spark job - spark-submit

True... it has been discussed quite a lot. However, there is a lot of ambiguity and some of the answers provided ... including duplicating JAR references in the jars/executor/driver configuration or o...

How to extend / inherit components?

I would like to create extensions for some components already deployed in Angular 2, without having to rewrite them almost completely, as the base component could undergo changes and wish these change...

How can I convert tabs to spaces and vice versa in an existing file

I cannot figure out how to do this for the life of me apart from doing a find-replace on 4 spaces and converting to tabs (). I can't think of an editor/IDE that doesn't have a specific feature to do t...

31 Dec at 19:43

Postman - How to see request with headers and body data with variables substituted

I am using the [Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en) Chrome plugin to invoke HTTP requests for software testing. I use the [Environments](...

19 Nov at 01:20

'dict' object has no attribute 'has_key'

While traversing a graph in Python, a I'm receiving this error: > 'dict' object has no attribute 'has_key' Here is my code: ``` def find_path(graph, start, end, path=[]): path = path + [start] ...

1 Aug at 16:34

Cannot switch Python with pyenv

I would like to use `pyenv` to switch python2 and python3. I successfully downloaded python2 and python3 and pyenv with following code. ``` brew install pyenv brew install pyenv-virtualenv pyenv ins...

5 Jan at 21:8

What is python's site-packages directory?

The directory `site-packages` is mentioned in various Python related articles. What is it? How to use it?

1 Apr at 21:47

How to compare two files in Notepad++

I want to compare values from two different files. In Notepad++ version 5.0.3 we had shortcut button + but in version 6.6.8 I cannot find any option to compare. Also let me know which version is most...

23 Nov at 18:34