Questions

builtins.TypeError: must be str, not bytes

I've converted my scripts from Python 2.7 to 3.2, and I have a bug. ``` # -*- coding: utf-8 -*- import time from datetime import date from lxml import etree from collections import OrderedDict # Cr...

7 Mar at 01:1

Page vs Window in WPF?

What is the difference between a Page and a Window in WPF when you are adding a new file in the Solution Explorer?

27 Mar at 01:1

Change default text in input type="file"?

I want to change default text on button that is "`Choose File`" when we use `input="file"`. ![enter image description here](https://i.stack.imgur.com/rcdgH.png) How can I do this? Also as you can se...

13 Nov at 18:20

Referencing a string in a string array resource with xml

I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items. I have pr...

Difference between Key, Primary Key, Unique Key and Index in MySQL

When should I use `KEY`, `PRIMARY KEY`, `UNIQUE KEY` and `INDEX`?

What does $_ mean in PowerShell?

I've seen the following a lot in PowerShell, but what does it do exactly? ``` $_ ```

1 Feb at 19:54

Pass request headers in a jQuery AJAX GET call

I am trying to pass request headers in an AJAX GET using jQuery. In the following block, "data" automatically passes the values in the querystring. Is there a way to pass that data in the request head...

19 Apr at 04:7

Volatile vs Static in Java

Is it correct to say that `static` means one copy of the value for all objects and `volatile` means one copy of the value for all threads? Anyway a `static` variable value is also going to be one va...

How can I trigger a JavaScript event click

I have a hyperlink in my page. I am trying to automate a number of clicks on the hyperlink for testing purposes. Is there any way you can simulate 50 clicks on the hyperlink using JavaScript? ``` <a ...

20 Feb at 19:42

What are the differences between .so and .dylib on macOS?

.dylib is the dynamic library extension on macOS, but it's never been clear to me when I can't / shouldn't use a traditional unix .so shared object. Some of the questions I have: - - -

10 Mar at 11:39

How to download a branch with git?

I have a project hosted on GitHub. I created a branch on one computer, then pushed my changes to GitHub with: ``` git push origin branch-name ``` Now I am on a different computer, and I want to do...

14 Feb at 16:34

JavaScript: Is there a way to get Chrome to break on all errors?

I am looking for an equivalent in Chrome to the "break on all errors" functionality of Firebug. In the Scripts tab, Chrome has a "pause on all exceptions", but this is not quite the same as breaking o...

How do I reverse an int array in Java?

I am trying to reverse an int array in Java. This method does not reverse the array. ``` for(int i = 0; i < validData.length; i++) { int temp = validData[i]; validData[i] = validData[valid...

8 May at 21:45

How to create module-wide variables in Python?

Is there a way to set up a global variable inside of a module? When I tried to do it the most obvious way as appears below, the Python interpreter said the variable `__DBNAME__` did not exist. ``` .....

Getting the class name from a static method in Java

How can one get the name of the class from a static method in that class. For example ``` public class MyClass { public static String getClassName() { String name = ????; // what goes her...

1 Jun at 20:42

How to parse a string to an int in C++?

What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of [returning zero](http://en.cppreference.com/w/cpp/string/byte/atoi)).

27 Aug at 13:50

How do you loop through each line in a text file using a windows batch file?

I would like to know how to loop through each line in a text file using a Windows batch file and process each line of text in succession.

24 Mar at 14:12

Tree data structure in C#

I was looking for a tree or graph data structure in C#, but I guess there isn't one provided. [An Extensive Examination of Data Structures Using C# 2.0](http://msdn.microsoft.com/en-us/library/ms37957...

5 Dec at 17:22

How to validate an XML file against an XSD file?

I'm generating some xml files that needs to conform to an xsd file that was given to me. How should I verify they conform?

9 Feb at 14:4

Multiple submit buttons in an HTML form

Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the button appears first in the markup when you press , it will use that button to submit the form. E...

14 Jul at 14:18

SwiftUI text-alignment

Among the many properties of the `Text` view, I couldn't find any related to text alignment. I've seen in a demo that it automatically handles RTL, and when placing stuff using View's `body`, it alway...

5 Jun at 10:49

How to show all columns' names on a large pandas dataframe?

I have a dataframe that consist of hundreds of columns, and I need to see all column names. What I did: ``` In[37]: data_all2.columns ``` The output is: ``` Out[37]: Index(['customer_id', 'incomi...

16 Jul at 15:2

NSRange to Range<String.Index>

How can I convert `NSRange` to `Range<String.Index>` in Swift? I want to use the following `UITextFieldDelegate` method: ``` func textField(textField: UITextField!, shouldChangeCharactersIn...

5 Nov at 09:12

Escape double quotes in a string

Double quotes can be escaped like this: ``` string test = @"He said to me, ""Hello World"". How are you?"; ``` But this involves adding character `"` to the string. Is there a C# function or other ...

25 Jun at 12:30

Moving average or running mean

Is there a SciPy function or NumPy function or module for Python that calculates the running mean of a 1D array given a specific window?

23 Feb at 11:17