Why do I see a double variable initialized to some value like 21.4 as 21.399999618530273?

Why do I see a double variable initialized to some value like 21.4 as 21.399999618530273?

double r = 11.631;double theta = 21.4;In the debugger, these are shown as 11.631000000000000 and 21.399999618530273.How can I avoid this? 1:These accuracy problems are due to the internal representation of floating point numbers and ther

Calculating the difference between two Java date instances

Calculating the difference between two Java date instances

I'm using Java's java.util.Date class in Scala and want to compare a Date object and the current time. I know I can calculate the delta by using getTime():(new java.util.Date()).getTime() - oldDate.getTime()However, this just leaves me with

What is the best algorithm for an overridden System.Object.GetHashCode?

What is the best algorithm for an overridden System.Object.GetHashCode?

In .NET System.Object.GetHashCode method is used in a lot of places, throughout the .NET base class libraries. Especially when finding items in a collection fast or to determine equality. Is there a standard algorithm/ best practice on how

.NET Rest Client Frameworks

.NET Rest Client Frameworks

I'm looking for the best .NET C# framework for building a REST Http client. My requirements are as follows:Unit testable (mockable)Supports multi-part form and file uploadsI have looked at Hammock, but it is lacking in documentation and see

Which wizard control can I use in a WinForms application?

Which wizard control can I use in a WinForms application?

I was looking for scenario-like wizard (with Next/Back buttons) that I can use in a Windows application under .NET 3.5. Is there any wizard control provided by Microsoft in .NET Framework 3.5? 1:No, Microsoft does not provide a ready-mad

Console.log IE9 issue

Console.log IE9 issue

I made a simple Task Manager using local.storage and I'm using console.log to set some variables but with that, the entire task app doesn't work in IE.Is there any alternative method of doing this? Here is the fiddle of the working Task Man

MALICIOUS_CODE EI_EXPOSE_REP Medium

MALICIOUS_CODE EI_EXPOSE_REP Medium

I run findbugs against all of my code and only tackle the top stuff. I finally got the top stuff resolved and now am looking at the details. I have a simple entity, say a user:public class User implements Serializable{ protected Date bir

Need to handle git-submodules in git-archive

Need to handle git-submodules in git-archive

I need to pack git submodules inside of tarball which I create with git-archive.I see that in 1.6.5 git-archive does not support git submodules.I see several scripts to handle this case in the net, but I'm not sure which one to pick.What is

using nth-child in tables tr td

using nth-child in tables tr td

$ $ $ $ $ Here is my code, I want s with "$" with a background of #CCC in all the s.Can any one help me how to do this using nth-child, pseudo classes? 1:table tr td:nth-ch

Can I generate script of a migration with EF code first and .net core

Can I generate script of a migration with EF code first and .net core

I'm building a MVC application with .Net Core and I need to generate the script of a migration.With EF6 I did run the command update-database -scriptbut when I try to do the same with .net Core is throwing the next exception: Update-Databa

Vertically centering button using css

Vertically centering button using css

I am trying to make a simple input button center-align within a table cell.My markup is: XXXXXXXXX YYYYYYYY And may be viewed here:http://jsfiddle.net/tP4sD/I have done a table version showing you the la

PHP NumberFormatter and Currency, can't set precision

PHP NumberFormatter and Currency, can't set precision

I want to set a precision of 0 when using the NumberFormatter PHP class (from Intl extension) with currency. However I've got some strange result. Here:$numberFormatter = new NumberFormatter('en-US', NumberFormatter::CURRENCY);$numberFormat

ASP.NET vNext - compile code dynamically not working for me

ASP.NET vNext - compile code dynamically not working for me

I've run through the tutorial on this here:http://www.asp.net/vnext/overview/aspnet-vnext/getting-started-with-aspnet-vnext-and-visual-studioI am following step 7 in section 2 - "With the browser still open, open Class1.cs and change the me

Call a Javascript Function after UpdatePanel Postback Issue

Call a Javascript Function after UpdatePanel Postback Issue

I basically have in my UpdatePanel a literal that generates a javascript array based on a method in my codebehind.I don't have an issue when it comes to loading my content on page load. But if I try and carry out a search to update my javas

KnockoutJS bind event after template render

KnockoutJS bind event after template render

I've been searching for a while, and I'm pretty confident this is a new question, and not a repeat like the title suggests. :)Basically, I'm trying to find out if there is a subscribe-able event that KnockoutJS creates after a template rend

Why is there a questionmark on the private variable definition?

Why is there a questionmark on the private variable definition?

I am reading an article about the MVVP Pattern and how to implement it with WPF. In the source code there are multiple lines where I cannot figure out what the question marks in it stand for.private DateTime? _value;What does the ? mean in

Finding out if an enum has the “Flags” attribute set

Finding out if an enum has the “Flags” attribute set

Using reflection, how do I determine whether an enum has the Flags attribute or notso for MyColor return true[Flags]public enum MyColor{ Yellow = 1, Green = 2, Red = 4, Blue = 8}and for MyTrade return falsepublic enum MyTrade{

Routing to the actions with same names but different parameters

Routing to the actions with same names but different parameters

I have this set of routes: routes.MapRoute( "IssueType", "issue/{type}", new { controller = "Issue", action = "Index" } ); routes.MapRoute( "Default", // Route name

Error handling on request piping

Error handling on request piping

I wrote simple proxy on nodejs and it looks likevar request = require( 'request' );app.all( '/proxy/*', function( req, res ){ req.pipe( request({ url: config.backendUrl + req.params[0], qs: req.query, method: req.met

Keyboard Shortcut for Moving Between Words in Camel Case in Notepad++

Keyboard Shortcut for Moving Between Words in Camel Case in Notepad++

In Notepad++, is there a keyboard shortcut for moving between the compound words in a camelCase word? When I use the shortcut Control + Right/Left, the caret moves to the next "real" word, not the next compound word. 1:Right : Ctrl\Left

Difference between TCP Listener and Socket

Difference between TCP Listener and Socket

As far as I know I can create a server using both TCPListener and Socket, so what is the difference between the two of them?Socketprivate Socket MainSock;MainSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

Get attribute of child element

Get attribute of child element

If I have the following markup: Hours How can I target the tag within the anchor tag? There are five other similar tag entries, each with a different value for sortcat= 1:$(".sort").click(function(){ var cat = $(this).

Is there a way to add an onclick event to an ASP.NET Label server control?

Is there a way to add an onclick event to an ASP.NET Label server control?

I wanted to do something like this:My LabelI know that in Javascript I can do:My LabelSo I'm wondering why I can't do that with a Label object. 1:You can use Attributes to add onclick client side callback.I didn't know you can do this on

Why are all my log4net levels false?

Why are all my log4net levels false?

I'm using log4net in my ASP.NET MVC3 project, but all logging properties such as IsDebugEnabled == falseIn my AssemblyInfo I have:[assembly: XmlConfigurator(Watch = true)]In my log class I havepublic Log4NetLogger(){ log4net.Config.XmlCo

Animating max-height with CSS transitions

Animating max-height with CSS transitions

I want to create an expand/collapse animation that's powered only by classnames (javascript is used to toggle the classnames).I'm giving one class max-height: 4em; overflow: hidden; and the other max-height: 255em; (I also tried the value n