How to check if a String contains another String in a case insensitive manner in Java?
Say I have two strings, ``` String s1 = "AbBaCca"; String s2 = "bac"; ``` I want to perform a check returning that `s2` is contained within `s1`. I can do this with: ``` return s1.contains(s2); ``...
How do I check if PyTorch is using the GPU?
How do I check if PyTorch is using the GPU? The `nvidia-smi` command can detect GPU activity, but I want to check it directly from inside a Python script.
- Modified
- 24 Jul at 02:38
"CAUTION: provisional headers are shown" in Chrome debugger
I noticed a strange caution message when looking at downloaded resources using Google chrome inspector (): > Caution provisional headers are shown ![enter image description here](https://i.stack.img...
- Modified
- 13 Mar at 11:33
Is it possible to declare a variable in Gradle usable in Java?
Is it possible to declare a variable in Gradle usable in Java ? Basically I would like to declare some vars in the build.gradle and then getting it (obviously) at build time. Just like a pre-processor...
- Modified
- 12 Feb at 20:36
Loading local JSON file
I'm trying to load a local JSON file but it won't work. Here is my JavaScript code (using jQuery): ``` var json = $.getJSON("test.json"); var data = eval("(" +json.responseText + ")"); document.write(...
- Modified
- 3 Oct at 00:27
Warn user before leaving web page with unsaved changes
I have some pages with forms in my application. How can I secure the form in such a way that if someone navigates away or closes the browser tab, they should be prompted to to confirm they really wa...
- Modified
- 8 Jan at 20:56
In Ruby on Rails, what's the difference between DateTime, Timestamp, Time and Date?
In my experience, getting dates/times right when programming is always fraught with danger and difficulity. Ruby and Rails have always eluded me on this one, if only due to the overwhelming number o...
- Modified
- 17 Aug at 08:31
What is the difference between Tomcat, JBoss and Glassfish?
I am starting to look into Enterprise Java and the book I am following mentions that it will use JBoss. Netbeans ships with Glassfish. I have used Tomcat in the past. What are the differences between...
- Modified
- 7 Feb at 15:59
Download File Using JavaScript/jQuery
I have a very similar requirement specified [here](https://stackoverflow.com/questions/1296085/download-file-using-jquery). I need to have the user's browser start a download manually when `$('a#some...
- Modified
- 24 Jun at 23:8
Is there a JavaScript / jQuery DOM change listener?
Essentially I want to have a script execute when the contents of a `DIV` change. Since the scripts are separate (content script in the Chrome extension & webpage script), I need a way simply observe c...
- Modified
- 6 Mar at 18:23
What is the difference between unit tests and functional tests?
What is the difference between unit tests and functional tests? Can a unit test also test a function?
- Modified
- 26 Oct at 12:37
How do I get the last day of a month?
How can I find the last day of the month in C#? For example, if I have the date 03/08/1980, how do I get the last day of month 8 (in this case 31)?
What should I set JAVA_HOME environment variable on macOS X 10.6?
Many Java applications that use shell scripts to configure their environment use the `JAVA_HOME` environment variable to start the correct version of Java, locate JRE JARs, and so on. In macOS X 10.6...
- Modified
- 14 Apr at 09:49
What is the purpose of the dollar sign in JavaScript?
The code in question is here: ``` var $item = $(this).parent().parent().find('input'); ``` What is the purpose of the dollar sign in the variable name, why not just exclude it?
- Modified
- 29 Mar at 02:39
How to log PostgreSQL queries?
How to enable logging of all SQL executed by PostgreSQL 8.3? I changed these lines : ``` log_directory = 'pg_log' log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' log_statement = '...
- Modified
- 6 Jan at 13:9
How do I convert all strings in a list of lists to integers?
I have a tuple of tuples containing strings: ``` T1 = (('13', '17', '18', '21', '32'), ('07', '11', '13', '14', '28'), ('01', '05', '06', '08', '15', '16')) ``` I want to convert all the ...
How to download a file from a URL in C#?
What is a simple way of downloading a file from a URL path?
Get list of databases from SQL Server
How can I get the list of available databases on a SQL Server instance? I'm planning to make a list of them in a combo box in VB.NET.
- Modified
- 8 Jul at 15:17
CORS: Cannot use wildcard in Access-Control-Allow-Origin when credentials flag is true
I have a setup involving Frontend server (Node.js, domain: localhost:3000) <---> Backend (Django, Ajax, domain: localhost:8000) Browser <-- webapp <-- Node.js (Serve the app) Browser (webapp) --> A...
- Modified
- 1 Oct at 12:12
@import vs #import - iOS 7
I am playing around with some of the new iOS 7 features and working with some of the Image Effects as discussed in the WWDC video "Implementing Engaging UI on iOS". For producing a blur effect within ...
- Modified
- 30 Jul at 10:14
How to increase timeout for a single test case in mocha
I'm submitting a network request in a test case, but this sometimes takes longer than 2 seconds (the default timeout). How do I increase the timeout for a single test case?
- Modified
- 26 Nov at 18:15
How do I install the yaml package for Python?
I have a Python program that uses YAML. I attempted to install it on a new server using `pip install yaml` and it returns the following: ``` $ sudo pip install yaml Downloading/unpacking yaml Coul...
- Modified
- 18 Jan at 21:3
How can I add or update a query string parameter?
With javascript how can I add a query string parameter to the url if not present or if it present, update the current value? I am using jquery for my client side development.
- Modified
- 5 Sep at 07:35
JavaScript: Object Rename Key
Is there a clever (i.e. optimized) way to rename a key in a javascript object? A non-optimized way would be: ``` o[ new_key ] = o[ old_key ]; delete o[ old_key ]; ```
- Modified
- 28 Jul at 16:23
What are the practical factors to consider when choosing between Depth-First Search (DFS) and Breadth-First Search (BFS)?
I understand the differences between DFS and BFS, but I'm interested to know what factors to consider when choosing DFS vs BFS. Things like avoiding DFS for very deep trees, etc.
- Modified
- 29 Aug at 11:13