Questions

MySQL - force not to use cache for testing speed of query

I'm testing the speed of some queries in MySQL. The database is caching these queries making it difficult for me to get reliable results when testing how fast these queries are. Is there a way to dis...

8 Oct at 09:5

PreparedStatement IN clause alternatives?

What are the best workarounds for using a SQL `IN` clause with instances of `java.sql.PreparedStatement`, which is not supported for multiple values due to SQL injection attack security issues: One `?...

How can I view the Git history in Visual Studio Code?

I can execute various Git commands from Visual Studio Code, however I couldn't find a way to visualize the history.

How to add conditional attribute in Angular 2?

How can I conditionally add an element attribute e.g. the `checked` of a checkbox? Previous versions of Angular had `NgAttr` and I think `NgChecked` which all seem to provide the functionality that ...

17 May at 15:6

HttpClient won't import in Android Studio

I have a simple class written in Android Studio: ``` package com.mysite.myapp; import org.apache.http.client.HttpClient; public class Whatever { public void headBangingAgainstTheWallExample () ...

How to initialize an array in Kotlin with values?

In Java an array can be initialized such as: ``` int numbers[] = new int[] {10, 20, 30, 40, 50} ``` How does Kotlin's array initialization look like?

4 Mar at 21:9

php create object without class

In JavaScript, you can easiliy create an object without a class by: ``` myObj = {}; myObj.abc = "aaaa"; ``` For PHP I've found this one, but it is nearly 4 years old: [http://www.subclosure.com/php-...

17 Aug at 21:33

How to portably print a int64_t type in C

C99 standard has integer types with bytes size like int64_t. I am using Windows's `%I64d` format currently (or unsigned `%I64u`), like: ``` #include <stdio.h> #include <stdint.h> int64_t my_int = 9999...

18 Oct at 16:16

How to pip install a package with min and max version range?

I'm wondering if there's any way to tell pip, specifically in a requirements file, to install a package with both a minimum version (`pip install package>=0.2`) and a maximum version which should neve...

16 Oct at 08:14

Entity Framework Timeouts

I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue: I added ...

Combining C++ and C - how does #ifdef __cplusplus work?

I'm working on a project that has a lot of legacy code. We've started writing in C++, with the intent to eventually convert the legacy code, as well. I'm a little confused about how the and C++ in...

30 May at 06:8

How can I return an empty IEnumerable?

Given the following code and the suggestions given [in this question](https://stackoverflow.com/questions/3225760/i-seem-to-have-fallen-into-some-massive-massive-trouble-with-nullreferenceexcept), I'v...

21 Apr at 18:6

How to delete files/subfolders in a specific directory at the command prompt in Windows

Say, there is a variable called `%pathtofolder%`, as it makes it clear it is a full path of a folder. I want to delete every single file and subfolder in this directory, but not the directory itself....

Is it possible only to declare a variable without assigning any value in Python?

Is it possible to declare a variable in Python, like so?: ``` var ``` so that it initialized to None? It seems like Python allows this, but as soon as you access it, it crashes. Is this possible? If ...

Viewing all defined variables

I'm currently working on a computation in python shell. What I want to have is Matlab style listout where you can see all the variables that have been defined up to a point (so I know which names I've...

10 Aug at 14:4

How can I override the OnBeforeUnload dialog and replace it with my own?

I need to warn users about unsaved changes before they leave a page (a pretty common problem). ``` window.onbeforeunload = handler ``` This works but it raises a default dialog with an irritating sta...

18 Feb at 07:15

Is there a `valueof` similar to `keyof` in TypeScript?

I want to be able to assign an object property to a value given a key and value as inputs yet still be able to determine the type of the value. It's a bit hard to explain so this code should reveal th...

16 Mar at 01:40

How to find which version of TensorFlow is installed in my system?

I need to find which version of TensorFlow I have installed. I'm using Ubuntu 16.04 Long Term Support.

Telegram Bot - how to get a group chat id?

I've been using [telegram_bot](https://github.com/eljojo/telegram_bot), and trying to get groupChat id to send notifications to group chat, but don't know which methods I have to use for it. For gett...

21 Oct at 13:37

How to match a String against string literals?

I'm trying to figure out how to match a `String` in Rust. I initially tried matching like this, but I figured out Rust cannot implicitly cast from `std::string::String` to `&str`. ``` fn main() { ...

7 Jan at 15:17

Python "raise from" usage

What's the difference between `raise` and `raise from` in Python? ``` try: raise ValueError except Exception as e: raise IndexError ``` which yields ``` Traceback (most recent call last): ...

19 Sep at 12:29

Peak signal detection in realtime timeseries data

--- The best performing algorithm [is this one](https://stackoverflow.com/questions/22583391/peak-recognition-in-realtime-timeseries-data/22640362#22640362). --- Consider the following exampl...

Different return values the first and second time with Moq

I have a test like this: ``` [TestCase("~/page/myaction")] public void Page_With_Custom_Action(string path) { // Arrange var pathData = new Mock<IPathData>(); var pageModel...

22 Jun at 09:43

Check if a file exists with a wildcard in a shell script

I'm trying to check if a file exists, but with a wildcard. Here is my example: ``` if [ -f "xorg-x11-fonts*" ]; then printf "BLAH" fi ``` I have also tried it without the double quotes.

7 Oct at 10:3

What's the difference between deadlock and livelock?

Can somebody please explain with examples (of code) what is the difference between and ?