Why does flowing off the end of a non-void function without returning a value not produce a compiler

Why does flowing off the end of a non-void function without returning a value not produce a compiler

Ever since I realized many years ago, that this doesn't produce an error by default, (in gcc at least) I've always wondered why?I understand that you can issue compiler flags to produce a warning, but shouldn't it always be an error? Why do

How to send HTTP request in java? [duplicate]

How to send HTTP request in java? [duplicate]

This question already has an answer here: How to use java.net.URLConnection to fire and handle HTTP requests 12 answers In Java, How to compose a HTTP

What is a daemon thread in Java?

What is a daemon thread in Java?

Can anybody tell me what daemon threads are in Java? 1:A daemon thread is a thread that does not prevent the JVM from exiting when the program finishes but the thread is still running. An example for a daemon thread is the garbage collec

How do I remove repeated elements from ArrayList?

How do I remove repeated elements from ArrayList?

I have an ArrayList of Strings, and I want to remove repeated strings from it. How can I do this? 1:If you don't want duplicates in a Collection, you should consider why you're using a Collection that allows duplicates. The easiest way t

How to solve java.lang.NoClassDefFoundError?

How to solve java.lang.NoClassDefFoundError?

I've tried both the example in Oracle's Java Tutorials. They both compile fine, but at run-time, both come up with this error:Exception in thread "main" java.lang.NoClassDefFoundError: graphics/shapes/Square at Main.main(Main.java:7)Caus

How to download and save a file from Internet using Java?

How to download and save a file from Internet using Java?

There is an online file (such as http://www.example.com/information.asp) I need to grab and save to a directory. I know there are several methods for grabbing and reading online files (URLs) line-by-line, but is there a way to just download

What's wrong with Java Date & Time API? [closed]

What's wrong with Java Date & Time API? [closed]

Very often I come across negative feedback on Java Date and other date-time-related classes. Being a .NET developer, I cannot fully (without having used them) understand, what's actually wrong with them. Can anybody shed some light on this?

What is a StackOverflowError?

What is a StackOverflowError?

What is a StackOverflowError, what causes it, and how should I deal with them? 1:Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a variable references that object). The sta

How do I use reflection to call a generic method?

How do I use reflection to call a generic method?

What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?Consider the following sample code - inside the Example() method, what's the most concise way t

Number of commands in Dockerfile

Number of commands in Dockerfile

I noticed that each line in the Dockerfile creates a separate image. Is there any limit on the number of images that are created? Should we try to do a oneliner of RUN cmd1 && cmd2 && cmd3 instead?How would this differ if we use a service l

Unified static class between HttpContext and SignalR HubCallerContext

Unified static class between HttpContext and SignalR HubCallerContext

I have a lot of code that depends on HttpContext.Current,and I noticed that requests that come from SignalR hubs have HttpContext.Current == null,so my code breaks, for example:HttpContext.Current.Request.IsAuthenticatedSo I came up with fo

The thread '' (0xb24) has exited with code 0 (0x0)

The thread '' (0xb24) has exited with code 0 (0x0)

whenever i try to run program for example,if i have to run "frmphonebook" so in Application.Run(new frmphonebook());I typed but when i run it it run another form, and it happens to each and every form and it is displaying output as The thre

Is there a standard date/time format that can be passed on a URL?

Is there a standard date/time format that can be passed on a URL?

Looking at the DateTimeFormatInfo documentation, it appears that all the standard formats have colons in them, which makes passing them on a url unpleasant/impossible.Is there a standardized format for passing a datetime on a url, preferabl

phantomJS - Pass Argument to the JS File

phantomJS - Pass Argument to the JS File

Right now I'm using the following command to run phantomJSexec('./phantomjs table.js',$op,$er);table.jsvar page = require('webpage').create();page.open('table.php', function () { page.render('table.png'); phantom.exit();});This serves

PyCrypto install error on Windows

PyCrypto install error on Windows

I am trying to install PyCrypto 2.6 Library on my computer. But I keep getting the following errorD:\Software\Python\package\pycrypto-2.6>python setup.py buildrunning buildrunning build_pyrunning build_extwarning: GMP or MPIR library not fo

Initializing List with given number of nulls without loop?

Initializing List with given number of nulls without loop?

Can a List be initialized to contain a given number of nulls, where T is a type parameter of the class of which the list is a member? I sure can do it with a loop, but like to know whether it is possible without.List myList = new ArrayList(

How do I launch an application on system startup? (Mac OSX, Cocoa)

How do I launch an application on system startup? (Mac OSX, Cocoa)

I have a program that runs only in the toolbar (w/ time/date, spotlight, etc.) and I want to put an item in the preferences to allow the user to select whether to start my application on the system startup or not. I'm currently lost on wher

How to Use -confirm in PowerShell

How to Use -confirm in PowerShell

I'm trying to take user input and before proceeding I would like get a message on screen and than a confirmation, whether user wants to proceed or not. I'm using the following code but its not working:write-host "Are you Sure You Want To Pr

How can I use powershell's read-host function to accept a password for an external service?

How can I use powershell's read-host function to accept a password for an external service?

I have a script I'm writing that makes a connection to a SOAP service. After the connection is made, I need to pass in a the username/pass with every command I send. The problem I have is that when I use read-host to do this, my password is

Split button in .NET Winforms [closed]

Split button in .NET Winforms [closed]

I'm looking for a Split Button in .NET WinForms. The kind where one side is a button and the other side has a dropdown button. I see them used all over in windows, like in the Visual Studio Save As window, so I figured they've got to have

Converting byte array to string and back again in C#

Converting byte array to string and back again in C#

So here's the deal: I'm trying to open a file (from bytes), convert it to a string so I can mess with some metadata in the header, convert it back to bytes, and save it. The problem I'm running into right now is with this code. When I compa

R writing style - require vs. ::

R writing style - require vs. ::

OK, we're all familiar with double colon operator in R. Whenever I'm about to write some function, I use require(), but I was always thinking about using :: instead. Using require in custom functions is better practice than library, since r

TDD FIRST principle

TDD FIRST principle

I am not understanding how the TDD FIRST principle isn't being adhered to in the following code.These are my notes about the FIRST principle: Fast: run (subset of) tests quickly (since you'll be running them all the time) Independent: n

Redirect perror output to fprintf(stderr, “ ”)

Redirect perror output to fprintf(stderr, “ ”)

In case a system call function fails, we normally use perror to output the error message. I want to use fprintf to output the perror string. How can I do something like this: fprintf(stderr, perror output string here); 1:#include fprintf

Query MongoDB Using 'ObjectId'

Query MongoDB Using 'ObjectId'

I have inserted documents into MongoDB without an id. And I want to retrieve them by searching through their MongoDB ObjectId, that has been assigned in default.Here is my attempt-var query_id = Query.EQ("_id", "50ed4e7d5baffd13a44d0153");v