Questions

Android Studio does not show layout preview

I'm using Android Studio 1.4 It has passed some time since the last time I've created a new project in android studio and today when I did it the android studio does not show anything from the layout...

Random String Generator Returning Same String

I've developed a random string generator but it's not behaving quite as I'm hoping. My goal is to be able to run this twice and generate two distinct four character random strings. However, it just ...

28 Mar at 16:16

How can I time a code segment for testing performance with Pythons timeit?

I've a python script which works just as it should, but I need to write the execution time. I've googled that I should use [timeit](https://docs.python.org/2/library/timeit.html) but I can't seem to g...

12 Mar at 21:46

Can an Option in a Select tag carry multiple values?

I got a select tag with some options in a HTML form: (the data will be collected and processed using PHP) Testing: ``` <select name="Testing"> <option value="1"> One <option value="2"> Two ...

16 Jul at 18:5

Vagrant stuck connection timeout retrying

My vagrant was working perfectly fine last night. I've just turned the PC on, hit `vagrant up`, and this is what I get: ``` ==> default: Clearing any previously set network interfaces... ==> default:...

27 Aug at 14:57

TypeScript function overloading

Section 6.3 of the TypeScript language spec talks about function overloading and gives concrete examples on how to implement this. However if I try something like this: ``` export class LayerFactory...

3 Nov at 19:22

Make the current commit the only (initial) commit in a Git repository?

I currently have a local Git repository, which I push to a Github repository. The local repository has ~10 commits, and the Github repository is a synchronised duplicate of this. What I'd like to d...

19 Feb at 20:54

Android Recyclerview GridLayoutManager column spacing

How do you set the column spacing with a RecyclerView using a GridLayoutManager? Setting the margin/padding inside my layout has no effect.

time.sleep -- sleeps thread or process?

In Python for *nix, does `time.sleep()` block the thread or the process?

How to run a function in jquery

I'm a programming newbie, and I can't figure out how to store a function in JQuery and run in it multiple places. I have: ``` $(function () { $("div.class").click(function(){ //Doo something ...

1 May at 01:18

What is the fastest way to send 100,000 HTTP requests in Python?

I am opening a file which has 100,000 URL's. I need to send an HTTP request to each URL and print the status code. I am using Python 2.6, and so far looked at the many confusing ways Python implement...

6 Feb at 20:29

How to specify multiple return types using type-hints

I have a function in python that can either return a `bool` or a `list`. Is there a way to specify the return types using type hints? For example, is this the correct way to do it? ``` def foo(id) -> ...

How to create .ipa file using Xcode?

Please tell me the complete procedure to build my app & use it on a real iPhone.

23 Oct at 02:39

numpy max vs amax vs maximum

numpy has three different functions which seem like they can be used for the same things --- except that `numpy.maximum` can be used element-wise, while `numpy.max` and `numpy.amax` can be used on pa...

10 Jan at 21:20

Get mouse wheel events in jQuery?

Is there a way to get the mouse wheel events (not talking about `scroll` events) in jQuery?

25 Jan at 20:52

How do you use script variables in psql?

In MS SQL Server, I create my scripts to use customizable variables: ``` DECLARE @somevariable int SELECT @somevariable = -1 INSERT INTO foo VALUES ( @somevariable ) ``` I'll then change the val...

23 Jul at 22:5

Vector of Vectors to create matrix

I am trying to take in an input for the dimensions of a 2D matrix. And then use user input to fill in this matrix. The way I tried doing this is via vectors (vectors of vectors). But I have encountere...

11 Sep at 18:18

MySQL: Error Code: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB

I want to create a table of column: ``` CREATE TABLE NAMESCHEMA.NAMETABLE ( ROW_ID TEXT NOT NULL , //this is the primary key 324 column of these types: CHAR(1), DATE, ...

17 Oct at 10:24

Constantly print Subprocess output while process is running

To launch programs from my Python-scripts, I'm using the following method: ``` def execute(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOU...

7 Feb at 22:49

Spring Boot Program cannot find main class

I have a program which runs as a Spring boot App in eclipse. The program was running fine. Then i did the following: Right click on project -> Run As -> Maven Test . This was accidental. When i the...

11 Feb at 09:47

How do I run a program with a different working directory from current, from Linux shell?

Using a , how do I start a program with a different working directory from the current working directory? For example, I have a binary file `helloworld` that creates the file `hello-world.txt` in the...

26 Mar at 02:4

Convert String to Type in C#

If I receive a string that contains the name of a class and I want to convert this string to a real type (the one in the string), how can I do this? I tried ``` Type.GetType("System.Int32") ``` fo...

2 Aug at 12:55

How to avoid "StaleElementReferenceException" in Selenium?

I am implementing a lot of Selenium tests using Java - sometimes, my tests fail due to a [StaleElementReferenceException](https://developer.mozilla.org/en-US/docs/Web/WebDriver/Errors/StaleElementRefe...

10 Mar at 04:11

Is there a Wikipedia API?

On my Wikipedia user page, I run a Wikipedia script that displays my statistics (number of pages edited, number of new pages, monthly activity, etc.). I'd like to put this information on my blog. I...

12 Apr at 20:9

Best database field type for a URL

I need to store a url in a MySQL table. What's the best practice for defining a field that will hold a URL with an undetermined length?

29 Jun at 16:21