Questions

Closing database connections in Java

I am getting a little confused. I was reading the below from [Java Database Connectivity](http://en.wikipedia.org/wiki/Java_Database_Connectivity): ``` Connection conn = DriverManager.getConnection( ...

6 Feb at 12:2

How to quickly clear a JavaScript Object?

With a JavaScript Array, I can reset it to an empty state with a single assignment: ``` array.length = 0; ``` This makes the Array "appear" empty and ready to reuse, and as far as I understand is a...

30 Jan at 17:24

How to safely call an async method in C# without await

I have an `async` method which returns no data: ``` public async Task MyAsyncMethod() { // do some stuff async, don't return any data } ``` I'm calling this from another method which returns some...

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

onchange equivalent in angular2

i'm using onchange to save the value of my input range into firebase , but i have an error who say that my function is not defined. this is my function ``` saverange(){ this.Platform.ready().then(...

1 Apr at 21:48

In MVC, how do I return a string result?

In my AJAX call, I want to return a string value back to the calling page. Should I use `ActionResult` or just return a string?

3 Oct at 21:57

How to loop through files matching wildcard in batch file

I have a set of base filenames, for each name 'f' there are exactly two files, 'f.in' and 'f.out'. I want to write a batch file (in Windows XP) which goes through all the filenames, for each one it s...

29 Nov at 15:5

Proper use cases for Android UserManager.isUserAGoat()?

I was looking at the new APIs introduced in [Android 4.2](http://en.wikipedia.org/wiki/Android_version_history#Android_4.1.2F4.2_Jelly_Bean). While looking at the [UserManager](http://developer.androi...

7 Sep at 08:21

Are Git forks actually Git clones?

I keep hearing people say they're forking code in Git. Git "fork" sounds suspiciously like Git "clone" plus some (meaningless) psychological willingness to forgo future merges. There is no fork comma...

31 Jan at 14:24

How to solve COM Exception Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))?

When I try to create a instance of a COM class it throws an exception as Please suggest how could i solve it?

6 Oct at 06:48

notifyDataSetChanged example

I'm trying to use in my `Android Application` the `notifyDataSetChanged()` method for an `ArrayAdapter` but it doesn't work for me. I found [as answer here](https://stackoverflow.com/questions/23458...

How do Python's any and all functions work?

I'm trying to understand how the `any()` and `all()` Python built-in functions work. I'm trying to compare the tuples so that if any value is different then it will return `True` and if they are all t...

15 Aug at 05:52

htmlentities() vs. htmlspecialchars()

What are the differences between `htmlspecialchars()` and `htmlentities()`. When should I use one or the other?

8 Sep at 11:2

How can I get name of element with jQuery?

How can I get name property of HTML element with jQuery?

13 Jan at 21:40

Permanently adding a file path to sys.path in Python

I had a file called `example_file.py`, which I wanted to use from various other files, so I decided to add `example_file.py` to `sys.path` and import this file in another file to use the file. To do s...

20 Jun at 03:13

converting a base 64 string to an image and saving it

Here is my code: ``` protected void SaveMyImage_Click(object sender, EventArgs e) { string imageUrl = Hidden1.Value; string saveLocation = Server.MapPath("~/PictureUpl...

23 Mar at 23:7

Converting from byte to int in Java

I have generated a secure random number, and put its value into a byte. Here is my code. ``` SecureRandom ranGen = new SecureRandom(); byte[] rno = new byte[4]; ranGen.nextBytes(rno); int i = rno[0]...

19 Dec at 11:27

"error: assignment to expression with array type error" when I assign a struct field (C)

I'm a beginner C programmer, yesterday I learned the use of C structs and the possible application of these ones about the resolution of specific problems. However when I was experimenting with my C I...

4 Jan at 06:48

Email Address Validation in Android on EditText

How can we perform `Email Validation` on `edittext` in `android` ? I have gone through google & SO but I didn't find out a simple way to validate it.

Better way to check if a Path is a File or a Directory?

I am processing a `TreeView` of directories and files. A user can select either a file or a directory and then do something with it. This requires me to have a method which performs different actions ...

7 Sep at 12:39

Copying files to a container with Docker Compose

I have a `Dockerfile` where I copy an existing directory (with content) to the container which works fine: ``` FROM php:7.0-apache COPY Frontend/ /var/www/html/aw3somevideo/ COPY Frontend/ /var/www...

8 Nov at 18:34

How would I get a cron job to run every 30 minutes?

I'm looking to add a `crontab` entry to execute a script every 30 minutes, on the hour and 30 minutes past the hour or something close. I have the following, but it doesn't seem to run on 0. ``` */30...

26 May at 16:45

How to set JFrame to appear centered, regardless of monitor resolution?

While working with Java, I find it hard to position my main window in the center of the screen when I start the application. Is there any way I can do that? It doesn't have to be vertically centered,...

31 Aug at 13:49

Reading from text file until EOF repeats last line

The following code uses a object to read integers from a text file (which has one number per line) until it hits . Why does it read the integer on the last line twice? How to fix this? ``` #inclu...

9 Jul at 22:22

Git: Remove committed file after push

Is there a possibility to revert a committed file in Git? I've pushed a commit to GitHub and then I realized that there's a file which I didn't want to be pushed (I haven't finished the changes).

30 Apr at 09:11