Questions

Pylint, PyChecker or PyFlakes?

I would like to get some feedback on these tools on: - - -

12 Jan at 22:53

How do you get the file size in C#?

I need a way to get the size of a file using C#, and not the size on disk. How is this possible? Currently I have this loop ``` foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { //fi...

31 May at 14:57

What is the difference between #import and #include in Objective-C?

What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated? I was reading the following tutorial: [http://www....

13 Jan at 16:25

What is a good pattern for using a Global Mutex in C#?

The Mutex class is very misunderstood, and Global mutexes even more so. What is good, safe pattern to use when creating Global mutexes? One that will work - - - -

2 Feb at 00:46

Use of var keyword in C#

After discussion with colleagues regarding the use of the 'var' keyword in C# 3 I wondered what people's opinions were on the appropriate uses of type inference via var? For example I rather lazily u...

3 Feb at 03:25

Why should one use Objects.requireNonNull()?

I have noted that many Java 8 methods in Oracle JDK use `Objects.requireNonNull()`, which internally throws `NullPointerException` if the given object (argument) is `null`. ``` public static <T> T re...

29 Mar at 14:25

Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state

After fresh installation of Visual Studio 2017 I tried to run .NET Core Web project and when trying to run it on Chrome I am getting this error: > Unable to start program, An operation is not legal i...

Access to ES6 array element index inside for-of loop

We can access array elements using a for-of loop: ``` for (const j of [1, 2, 3, 4, 5]) { console.log(j); } ``` How can I modify this code to access the current index too? I want to achieve this us...

12 Oct at 04:7

Why is "except: pass" a bad programming practice?

I often see comments on other Stack Overflow questions about how the use of `except: pass` is discouraged. Why is this bad? Sometimes I just don't care what the errors are and I want to just continue ...

How to convert 'binary string' to normal string in Python3?

For example, I have a string like this(return value of `subprocess.check_output`): ``` >>> b'a string' b'a string' ``` Whatever I did to it, it is always printed with the annoying `b'` before the s...

12 Jul at 12:55

What is the difference between README and README.md in GitHub projects?

I've noticed some GitHub projects have not only a `README` file, but also a `README.md` file. What is the difference between these files? I know `README` serves also as introductory text in the proje...

29 Nov at 01:41

PHP code is not being executed, but the code shows in the browser source code

I'm trying to execute some PHP code on a project (using Dreamweaver) but the code isn't being run. When I check the source code, the PHP code appears as HTML tags (I can see it in the source code). A...

12 Jul at 19:37

Is there a built in function for string natural sort?

I have a list of strings for which I would like to perform a [natural alphabetical sort](https://en.wikipedia.org/wiki/Natural_sort_order). For instance, the following list is naturally sorted (what I...

13 Nov at 21:0

How to change value of object which is inside an array using JavaScript or jQuery?

The code below comes from jQuery UI Autocomplete: ``` var projects = [ { value: "jquery", label: "jQuery", desc: "the write less, do more, JavaScript library", ico...

7 Sep at 15:20

Getting attribute using XPath

Given an XML structure like so: ``` <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price> </book> <book> <title lang="eng...

21 May at 03:49

Convert string to integer type in Go?

I'm trying to convert a string returned from `flag.Arg(n)` to an `int`. What is the idiomatic way to do this in Go?

5 Nov at 16:36

Double vs. BigDecimal?

I have to calculate some floating point variables and my colleague suggest me to use `BigDecimal` instead of `double` since it will be more precise. But I want to know what it is and how to make most ...

What is the difference between concurrent programming and parallel programming?

What is the difference between concurrent programming and parallel programing? I asked google but didn't find anything that helped me to understand that difference. Could you give me an example for bo...

How can I get a list of all classes within current module in Python?

I've seen plenty of examples of people extracting all of the classes from a module, usually something like: ``` # foo.py class Foo: pass # test.py import inspect import foo for name, obj in ins...

24 Oct at 18:6

Can I add a custom attribute to an HTML tag?

Can I add a custom attribute to an HTML tag like the following? ``` <tag myAttri="myVal" /> ```

7 Jul at 14:15

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: ``` SELECT COUNT(*) AS total FROM table1 WHERE ... ``` and check to see if the total is non-zer...

4 Nov at 21:9

Can I call a base class's virtual function if I'm overriding it?

Say I have classes `Foo` and `Bar` set up like this: ``` class Foo { public: int x; virtual void printStuff() { std::cout << x << std::endl; } }; class Bar : public Foo { pu...

8 Jul at 17:39

Avoid synchronized(this) in Java?

Whenever a question pops up on SO about Java synchronization, some people are very eager to point out that `synchronized(this)` should be avoided. Instead, they claim, a lock on a private reference is...

How do I select text nodes with jQuery?

I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?

18 Nov at 13:45

Can "list_display" in a Django ModelAdmin display attributes of ForeignKey fields?

I have a `Person` model that has a foreign key relationship to `Book`, which has a number of fields, but I'm most concerned about `author` (a standard CharField). With that being said, in my `PersonA...