How to get file_get_contents() to work with HTTPS?

How to get file_get_contents() to work with HTTPS?

I'm working on setting up credit card processing and needed to use a workaround for CURL. The following code worked fine when I was using the test server (which wasn't calling an SSL URL), but now when I am testing it on the working server

Why do we need virtual functions in C++?

Why do we need virtual functions in C++?

I'm learning C++ and I'm just getting into virtual functions.From what I've read (in the book and online), virtual functions are functions in the base class that you can override in derived classes.But earlier in the book, when learning abo

Strangest language feature

Strangest language feature

What is, in your opinion, the most surprising, weird, strange or really "WTF" language feature you have encountered?Please only one feature per answer. 1:In C, arrays can be indexed like so:a[10]which is very common.However, the lesser k

How to split a string, but also keep the delimiters?

How to split a string, but also keep the delimiters?

I have a multiline string which is delimited by a set of different delimiters:(Text1)(DelimiterA)(Text2)(DelimiterC)(Text3)(DelimiterB)(Text4)I can split this string into its parts, using String.split, but it seems that I can't get the actu

Why is lock(this) {…} bad?

Why is lock(this) {…} bad?

The MSDN documentation says thatpublic class SomeObject{ public void SomeOperation() { lock(this) { //Access instance variables } }}is "a problem if the instance can be accessed publicly". I'm wondering why? Is it because t

How to read a local text file?

How to read a local text file?

I’m trying to write a simple text file reader by creating a function that takes in the file’s path and converts each line of text into a char array, but it’s not working.function readTextFile() { var rawFile = new XMLHttpRequest(); rawFil

Immutability of Strings in Java

Immutability of Strings in Java

Consider the following example.String str = new String();str = "Hello";System.out.println(str); //Prints Hellostr = "Help!";System.out.println(str); //Prints Help!Now, in Java, String objects are immutable. Then how come the object str c

How to parse a string to an int in C++?

How to parse a string to an int in C++?

What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of returning zero). 1:In the new C++11 there are functions for that: stoi, stol, stoll, stoul and so on.int myNr = s

StreamCorruptedException: invalid type code: AC

StreamCorruptedException: invalid type code: AC

My problem is when it tries to read the object the second time, it throws the exception: java.io.StreamCorruptedException: invalid type code: AC at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectIn

Hide scroll bar, but while still being able to scroll

Hide scroll bar, but while still being able to scroll

I want to be able to scroll through the whole page, but without the scrollbar being shown.In Google Chrome it's:::-webkit-scrollbar { display: none; }But Mozilla Firefox and Internet Explorer don't seem to work like that.I also tried th

What do 'lazy' and 'greedy' mean in the context of regular expressions?

What do 'lazy' and 'greedy' mean in the context of regular expressions?

Could someone explain these two terms in an understandable way? 1:Greedy will consume as much as possible. From http://www.regular-expressions.info/repeat.html we see the example of trying to match HTML tags with <.+>. Suppose you have t

How can I parse a JSON file with PHP?

How can I parse a JSON file with PHP?

I tried to parse a JSON file using PHP. But I am stuck now.This is the content of my JSON file:{ "John": { "status":"Wait" }, "Jennifer": { "status":"Active" }, "James": { "status":"Active", "a

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

What is the difference between client-side and server-side programming?

What is the difference between client-side and server-side programming?

I have this code:Why does this not write "bar" into my text file, b

Strings don't seem to be equal in Java on Android, even though they print the same

Strings don't seem to be equal in Java on Android, even though they print the same

I've got a problem that I'm rather confused about. I have the following lines of code in my android application:System.out.println(CurrentNode.getNodeName().toString());if (CurrentNode.getNodeName().toString() == "start") { System.out.pr

How to log an installation made from a WiX bundle

How to log an installation made from a WiX bundle

When creating a Windows installer using the WiX (Windows Installer for XML) toolset, how do you make the install process write logging information to a log file?Is there a command-line switch which triggers the output of the log file? 1:

Empirical data on the effects of immutability?

Empirical data on the effects of immutability?

In class today, my professor was discussing how to structure a class. The course primarily uses Java and I have more Java experience than the teacher (he comes from a C++ background), so I mentioned that in Java one should favor immutabili

Change a make variable, and call another rule, from a recipe in same Makefile?

Change a make variable, and call another rule, from a recipe in same Makefile?

I have already seen How to manually call another target from a make target?, but my question is a bit different; consider this example (note, stackoverflow.com changes the tabs to spaces in display; but tabs are preserved in source, if you

passing arguments to jq filter

passing arguments to jq filter

Here is my config.json:{ "env": "dev", "dev": { "projects" : { "prj1": { "dependencies": {}, "description": "" } } }}Here are my bash commands:PRJNAME='prj1'echo

How to determine if an output of a function-call is unused (MATLAB)

How to determine if an output of a function-call is unused (MATLAB)

Say I have a function foo that can return three values given an input:function [a,b,c] = foo(input)The calculations of variables b and c take a long time, so sometimes I may wish to ignore their calculation within foo. If I want to ignore b

iOS Push Notification custom format

iOS Push Notification custom format

I'm new to all iOS push notification domain. I have tried a basic push notification using the following code and it works perfectly. I'm using "using JdSoft.Apple.Apns.Notifications;" to accomplish this. Here's the code:Notification alertNo

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

What is the optional argument in C# interpolated string for?

What is the optional argument in C# interpolated string for?

Interpolated strings is one of the new features of C# 6.0. According to MSDN, the syntax of the embedded C# expressions can contain an optional, comma-separated value, deemed as in the documentation.Unfortunately I didn't find what this fi

Verbose Output From rake assets:precompile

Verbose Output From rake assets:precompile

I've just started using the asset_sync gem and my assets seem to be being compiled out of order, with Sass files unabled to access variables defined in other Sass files. What would really help me narrow down the issue is being able to see e

Change a string of integers separated by spaces to a list of int

Change a string of integers separated by spaces to a list of int

How do i make something likex = '1 2 3 45 87 65 6 8'>>> foo(x)[1,2,3,45,87,65,6,8]I'm completely stuck, if i do it by index, then the numbers with more than 1 digit will be broken down. Help please. 1:You can use a list comprehension in