Questions

How to alter a column and change the default value?

I got the following error while trying to alter a column's data type and setting a new default value: ``` ALTER TABLE foobar_data ALTER COLUMN col VARCHAR(255) NOT NULL SET DEFAULT '{}'; ``` > ERRO...

3 Jul at 13:53

What is the cleanest way to disable CSS transition effects temporarily?

I have a DOM element with this effect applied: ``` #elem { transition: height 0.4s ease; } ``` I am writing a jQuery plugin that is resizing this element, I need to disable these effects temporaril...

13 Jan at 20:26

Returning http status code from Web Api controller

I'm trying to return a status code of 304 not modified for a GET method in a web api controller. The only way I succeeded was something like this: ``` public class TryController : ApiController { ...

e.printStackTrace equivalent in python

I know that `print(e)` (where e is an Exception) prints the occurred exception but, I was trying to find the python equivalent of Java's `e.printStackTrace()` that exactly traces the exception to what...

21 Oct at 13:45

What is the difference between AF_INET and PF_INET in socket programming?

What is the difference between AF_INET and PF_INET in socket programming? I'm confused between using AF_INET and PF_INET in `socket()` and `bind()`. Also, how to give ip-address in `sin_addr` field?...

4 Jun at 16:46

Compute list difference

In Python, what is the best way to compute the difference between two lists? example ``` A = [1,2,3,4] B = [2,5] A - B = [1,3,4] B - A = [5] ```

23 Jun at 00:20

C# short/long/int literal format?

In C/C#/etc. you can tell the compiler that a literal number is not what it appears to be (ie., `float` instead of `double`, `unsigned long` instead of `int`): ``` var d = 1.0; // double var f = 1.0f...

27 May at 16:50

How to capture the "virtual keyboard show/hide" event in Android?

I would like to alter the layout based on whether the virtual keyboard is shown or not. I've searched the API and various blogs but can't seem to find anything useful. Is it possible? Thanks!

18 Jul at 12:44

How do I see if Wi-Fi is connected on Android?

I don't want my user to even try downloading something unless they have Wi-Fi connected. However, I can only seem to be able to tell if Wi-Fi is enabled, but they could still have a 3G connection. ``...

25 Sep at 08:59

Pinging servers in Python

In Python, is there a way to ping a server through ICMP and return TRUE if the server responds, or FALSE if there is no response?

1 Jun at 21:27

How do I loop through a date range?

I'm not even sure how to do this without using some horrible for loop/counter type solution. Here's the problem: I'm given two dates, a start date and an end date and on a specified interval I need ...

4 Dec at 15:13

#define macro for debug printing in C?

Trying to create a macro which can be used for print debug messages when DEBUG is defined, like the following pseudo code: ``` #define DEBUG 1 #define debug_print(args ...) if (DEBUG) fprintf(stderr,...

25 Feb at 05:17

How is the java memory pool divided?

I’m currently monitoring a Java application with jconsole. The memory tab lets you choose between: ``` Heap Memory Usage Non-Heap Memory Usage Memory Pool “Eden Space” Memory Pool “Survivor Space” Me...

25 May at 11:5

How can I convert a dictionary into a list of tuples?

If I have a dictionary like: ``` {'a': 1, 'b': 2, 'c': 3} ``` How can I convert it to this? ``` [('a', 1), ('b', 2), ('c', 3)] ``` And how can I convert it to this? ``` [(1, 'a'), (2, 'b'), (3, 'c')...

18 Sep at 01:18

How to show "Done" button on iOS number pad keyboard?

There is no "Done" button on the `.numberPad` Keyboard Type. When a user finishes entering numeric information in a text field, how can I make the number pad disappear? I could get a "Done" button by ...

7 Sep at 20:10

Why can a function modify some arguments as perceived by the caller, but not others?

I'm trying to understand Python's approach to variable scope. In this example, why is `f()` able to alter the value of `x`, as perceived within `main()`, but not the value of `n`? ``` def f(n, x): ...

13 Jan at 00:55

OOP vs Functional Programming vs Procedural

What are the differences between these programming paradigms, and are they better suited to particular problems or do any use-cases favour one over the others? Architecture examples appreciated!

How to check if a string in Python is in ASCII?

I want to I check whether a string is in ASCII or not. I am aware of `ord()`, however when I try `ord('é')`, I have `TypeError: ord() expected a character, but string of length 2 found`. I understood...

1 Dec at 21:36

Class method differences in Python: bound, unbound and static

What is the difference between the following class methods? Is it that one is static and the other is not? ``` class Test(object): def method_one(self): print "Called method_one" def method...

21 Oct at 13:37

Performing a Stress Test on Web Application?

In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a f...

Enabling CORS in Cloud Functions for Firebase

I'm currently learning how to use new Cloud Functions for Firebase and the problem I'm having is that I can't access the function I wrote through an AJAX request. I get the "No 'Access-Control-Allow-O...

forEach is not a function error with JavaScript array

I'm trying to make a simple loop: ``` const parent = this.el.parentElement console.log(parent.children) parent.children.forEach(child => { console.log(child) }) ``` But I get the following error:...

13 Mar at 12:21

How to omit methods from Swagger documentation on WebAPI using Swashbuckle

I have a C# ASP.NET WebAPI application with API documentation being automatically generated using [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle). I want to be able to from the documen...

11 Aug at 23:28

Change color of Back button in navigation bar

I am trying to change the color of the Settings button to white, but can't get it to change. I've tried both of these: ``` navigationItem.leftBarButtonItem?.tintColor = UIColor.whiteColor() navigati...

Disable Scrolling on Body

I would like to disable scrolling on the HTML `body` completely. I have tried the following options: - `overflow: hidden;` (not working, did not disable scrolling, it just hid the scrollbar)- `positi...

7 Jan at 13:4