What is the type of string literals in C and C++?

What is the type of string literals in C and C++?

What is the type of string literal in C? Is it char * or const char * or const char * const?What about C++? 1:In C the type of a string literal is a char[] - it's not const according to the type, but it is undefined behavior to modify th

Unescape HTML entities in Javascript?

Unescape HTML entities in Javascript?

I have some Javascript code that communicates with an XML-RPC backend.The XML-RPC returns strings of the form:However, when I use the Javascript to insert the strings into HTML, they render literally. I don't see an i

Way to go from recursion to iteration

Way to go from recursion to iteration

I've used recursion quite a lot during my many years of programming to solve simple problems, but I'm fully aware that sometimes you need iteration due to memory/speed problems.So, somewhere in the very far past I went to try to find if the

strange output in comparison of float with float literal

strange output in comparison of float with float literal

float f = 0.7;if( f == 0.7 ) printf("equal");else printf("not equal");Why is the output not equal ?Why does this happen? 1:This happens because in your statement if(f == 0.7)the 0.7 is treated as a double. Try 0.7f to ensure the v

Collapse / concatenate / aggregate a column to a single comma separated string within each group

Collapse / concatenate / aggregate a column to a single comma separated string within each group

I want to aggregate one column in a data frame according to two grouping variables, and separate the individual values by a comma.Here is some data:data <- data.frame(A = c(rep(111, 3), rep(222, 3)), B = rep(1:2, 3), C = c(5:10))data# A

How can I convert my Java program to an .exe file? [closed]

How can I convert my Java program to an .exe file? [closed]

If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a .exe file?I also need an installer for my program.Is there an open source program that can do that? 1:Some options: Executable Jar FileSee also Di

convert vector to jobject in C++/JNI?

convert vector to jobject in C++/JNI?

I am using Java native function - public native ArrayList parseXML();In C++ my native function - vector resultList;JNIEXPORT jobject JNICALL Java_Sample1_parseXML(JNIEnv *env, jobject obj){ // logic return resultList; // here getting

SQL datetime format to date only

SQL datetime format to date only

I am trying to select the DeliveryDate from sql database as just date. In the database, i am saving it as datetime format. How is it possible to get just date??SELECT Subject, DeliveryDate from Email_Administration where MerchantId [email protected] Merch

ErrorActionPreference and ErrorAction SilentlyContinue for Get-PSSessionConfiguration

ErrorActionPreference and ErrorAction SilentlyContinue for Get-PSSessionConfiguration

My case:$ErrorActionPreference = "Stop";"1 - $ErrorActionPreference;"Get-ChildItem NoSuchFile.txt -ErrorAction SilentlyContinue;"2 - $ErrorActionPreference;"Get-ChildItem NoSuchFile.txt -ErrorAction Stop;"3 - $ErrorActionPreference;"Output:

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

How to get an element's ID from event.target

How to get an element's ID from event.target

Consider a piece of code that looks like the following:$('body').on('click', function(e){});I know there is a way to get the element type from e.target, i.e. e.target.nodeName, but how can I get the id of that element from that? If that can

Exposing `defaultdict` as a regular `dict`

Exposing `defaultdict` as a regular `dict`

I am using defaultdict(set) to populate an internal mapping in a very large data structure. After it's populated, the whole structure (including the mapping) is exposed to the client code. At that point, I don't want anyone modifying the ma

Is the following move constructor code safe?

Is the following move constructor code safe?

This is the move constructor of class X:X::X(X&& rhs) : base1(std::move(rhs)) , base2(std::move(rhs)) , mbr1(std::move(rhs.mbr1)) , mbr2(std::move(rhs.mbr2)){ }These are the things I'm wary about:We're moving from rhs twice and

Python convert tuple to array [duplicate]

Python convert tuple to array [duplicate]

This question already has an answer here: Making a flat list out of list of lists in Python 33 answers How can I convert at 3-Dimensinal tuple into an

Python: finding lowest integer

Python: finding lowest integer

I have the following code:l = ['-1.2', '0.0', '1']x = 100.0for i in l: if i The code should find the lowest value in my list (-1.2) but instead when i print 'x' it finds the value is still 100.0Where is my code going wrong? 1:To find

set difference for pandas

set difference for pandas

A simple pandas question: Is there a drop_duplicates() functionality to drop every row involved in the duplication? An equivalent question is the following: Does pandas have a set difference for dataframes? For example:In [5]: df1 = pd.Data

C# boolean int conversion issue

C# boolean int conversion issue

I am working on a trading API (activex from interactive brokers)which has a method called:void reqMktDataEx(int tickerId, IContract contract, string generalDetails, int snapshot)The issue is around the last parameter "int snapshot" which ob

How to unbox from object to type it contains, not knowing that type at compile time?

How to unbox from object to type it contains, not knowing that type at compile time?

At the run-time I get boxed instance of some type. How to unbox it to underlying type?Object obj;String variable = "Some text";obj = variable // boxing;// explicit unboxing, because we know the type of variable at compile time.var x = (Stri

How to convert a swift String to CFString

How to convert a swift String to CFString

How can i create a CFString from a native swift String or NSString in swift let path:String = NSBundle.mainBundle().pathForResource(name.stringByDeletingPathExtension, ofType:"pdf") let string:CFString = ??? path let url:CFURLRef =

Cannot convert '0000-00-00 00:00:00' to TIMESTAMP

Cannot convert '0000-00-00 00:00:00' to TIMESTAMP

the field definition /** Date. */ @Column(columnDefinition = "datetime") private Date date;setterpublic void setDate(final Date date) { DateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { this.date = dfmt.parse

Java: “Anonymous” array in for-each-loop

Java: “Anonymous” array in for-each-loop

While I was trying something special in for loop I recognized that Java doesn't seem to like putting an anonymous array right as the source for a for-each-loop:for (String crt : {"a","b","c"} ) { doSomething();}actually doesn't work whil

PHP Library: Calculate a bounding box for a given lat/lng location

PHP Library: Calculate a bounding box for a given lat/lng location

I'm looking for a PHP Library / PHP Script that allows me to calculate an accurate bounding box for a given center point (lat/lon).Using an ellipsoid formula (f.ex. WGS84) would be great. I know, there have to be a library but I'm not able

Convert PowerShell script into non-readable format

Convert PowerShell script into non-readable format

I have a PowerShell script which installs a patch (contains set of files to be added) on a customer machine. For this, I have created a batch file which executes this PowerShell script.For the customer to run this batch file, the PowerShell

Printing HTML5 Canvas in the correct size

Printing HTML5 Canvas in the correct size

Is there a correct way to specify the size of a canvas element in for example millimeters so that if I print it out it will have the correct size?I've tried this simple example:Your browser does not support the HTML5 canvas tag.But on scree

Django JSON Serialization with Mixed Django models and a Dictionary

Django JSON Serialization with Mixed Django models and a Dictionary

I can't seem to find a good way to serialize both Django Models and Python dictionaries together, its pretty common for me to return a json response that looks like{ "modified":updated_object, "success":true ... some additional data...}I