Printf width specifier to maintain precision of floating-point value

Printf width specifier to maintain precision of floating-point value

Is there a printf width specifier which can be applied to a floating point specifier that would automatically format the output to the necessary number of significant digits such that when scanning the string back in, the original floating

@selector() in Swift?

@selector() in Swift?

I'm trying to create an NSTimer in Swift but I'm having some trouble.NSTimer(timeInterval: 1, target: self, selector: test(), userInfo: nil, repeats: true)test() is a function in the same class.I get an error in the editor: Could not find

What's the difference between next() and nextLine() methods from Scanner class?

What's the difference between next() and nextLine() methods from Scanner class?

What is the main difference between next() and nextLine()?My main goal is to read the all text using a Scanner which may be "connected" to any source (file for example).Which one should I choose and why? 1:I always prefer to read input u

How do the post increment (i++) and pre increment (++i) operators work in Java?

How do the post increment (i++) and pre increment (++i) operators work in Java?

Can you explain to me the output of this Java code?int a=5,i;i=++a + ++a + a++;i=a++ + ++a + ++a;a=++a + ++a + a++;System.out.println(a);System.out.println(i);The output is 20 in both cases 1:Does this help?a = 5;i=++a + ++a + a++; =>i=6

Formatting a number with exactly two decimals in JavaScript

Formatting a number with exactly two decimals in JavaScript

I have this line of code which rounds my numbers to two decimal places. But I get numbers like this: 10.8, 2.4, etc. These are not my idea of two decimal places so how I can improve the following?Math.round(price*Math.pow(10,2))/Math.pow(10

Unsupported major.minor version 52.0 [duplicate]

Unsupported major.minor version 52.0 [duplicate]

This question already has an answer here: How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version 42 answers Pictures:Comman

yylval and union

yylval and union

What is the purpose of union in the yacc file? Is it directly related to yylval in the flex file? If you don't use yylval, then you don't need to use union? 1:The purpose of the union is to allow storing different kind of objects into

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

GIT: Do I need to commit my branch before checking out another branch, what about stashing?

GIT: Do I need to commit my branch before checking out another branch, what about stashing?

I'm new to Git and a bit confused. I have a Master branch and have created a second feature branch. If I make changes in my feature branch and then switch to Master, will my changes be lost if I don't commit? Where does stash come into p

Is there any documented free R-Tree implementation for .NET?

Is there any documented free R-Tree implementation for .NET?

I found some open source R-Tree implementations in C#, but none with documentation nor signs of being used by someone else than the developer. 1:The NetTopologySuite is a JTS port to C# and it contains a STRtree class which is a read-onl

How to copy a “Dictionary” in Swift?

How to copy a “Dictionary” in Swift?

How to copy a "Dictionary" in Swift?That is, get another object with same keys/values but different memory address.Furthermore, how to copy an object in Swift?Thanks, 1:A 'Dictionary' is actually a Struct in swift, which is a value type.

Faster 16bit multiplication algorithm for 8-bit MCU

Faster 16bit multiplication algorithm for 8-bit MCU

I'm searching for an algorithm to multiply two integer numbers that is better than the one below. Do you have a good idea about that? (The MCU - AT Tiny 84/85 or similar - where this code runs has no mul/div operator)uint16_t umul16_(uint16

how to overwrite data in a txt file? [duplicate]

how to overwrite data in a txt file? [duplicate]

Possible Duplicate: Can any one tell why the previous data is still displayed while saving data using StreamWriter I have WPF C# application, that reads and writes to a .txt file, i know how to write line but line, but how do I overwrite

MySQL Nested Select Query?

MySQL Nested Select Query?

Ok, so I have the following query:SELECT MIN(`date`), `player_name`FROM `player_playtime`GROUP BY `player_name`I then need to use this result inside the following query:SELECT DATE(`date`) , COUNT(DISTINCT `player_name`)FROM `player_playt

Array declaration and initialization in Java. Arrays behave differently, when the position of their

Array declaration and initialization in Java. Arrays behave differently, when the position of their

The following is the obvious and usual array declaration and initialization in Java.int r[], s[]; //A very similar case behaves differently, when the position of [] is changed in the declaration statement like as shown below.int []p,

How to make pagination in XSLT

How to make pagination in XSLT

I have the following XSLT:

Minimum Window for the given numbers in an array

Minimum Window for the given numbers in an array

Saw this question recently: Given 2 arrays, the 2nd array containing some of the elements of the 1st array, return the minimum window in the 1st array which contains all the elements of the 2nd array.Eg : Given A={1,3,5,2,3,1} and B={1,3,2}

Only question marks in backtrace reported by gdb on ARM

Only question marks in backtrace reported by gdb on ARM

I'm trying to debug a software with gdbserver on ARM to get a backtrace of a crash. Unfortunately I get only question marks. Everywhere, I read this problem is simply related to the lack of symbols, but symbols are not stripped from my libr

How to calculate the running total using aggregate

How to calculate the running total using aggregate

I'm developing a simple financial app for keeping track of incomes and outcomes.For the sake of simplicity, let's suppose these are some of my documents:{ "_id" : ObjectId("54adc0659413535e02fba115"), "description" : "test1", "amount" : 100

Getting pixel color in C++

Getting pixel color in C++

I would like to get the RGB values of a pixel at different x, y coordinates on the screen.How would I go about this in C++? I'm trying to create my own gaussian blur effect. This would be in Windows 7.EditWhat libraries need to be included

Disable antialiasing for a specific GDI device context

Disable antialiasing for a specific GDI device context

I'm using a third party library to render an image to a GDI DC and I need to ensure that any text is rendered without any smoothing/antialiasing so that I can convert the image to a predefined palette with indexed colors.The third party lib

Difference between VsDevCmd.bat & vcvarsall.bat in VS2012

Difference between VsDevCmd.bat & vcvarsall.bat in VS2012

What's the difference between:VsDevCmd.bat (Developer Command Prompt for VS2012)vcvarsall.bat (VS2012 x86\x64\ARM Native\Cross Tools Command Prompt)I have a pretty good understanding of vcvarsall.bat as it's been part of Visual Studio for m

Play full spotify track inside my own website using spotify web api

Play full spotify track inside my own website using spotify web api

So I was taking a look at the spotify web api and it apparently allows you to play a preview of the song, but I was wondering if there is any way to play the full spotify song without having to open up the official spotify web player or des

In vim, how do I paste a column of text to the end of irregular length lines?

In vim, how do I paste a column of text to the end of irregular length lines?

I would like to paste a column of text at the end of irregular-length lines.For example, I would like to paste the following:SRR447882.fastq.gzSRR447883.fastq.gzSRR447944.fastq.gzat the end of these lines:TIL01_TIL01_TIL04-TIP285_Many times

Swift 3: Set Finder label color

Swift 3: Set Finder label color

I'm trying to set the colored labels shown by the finder. The only function I know is setResourceValue. But this needs localized names!I could image my mother language and english as well, but all others I don't know. I can't believe, that