Finding the number of days between two dates

Finding the number of days between two dates

How to find number of days between two dates using PHP? 1:$now = time(); // or your date as well$your_date = strtotime(2010-01-01);$datediff = $now - $your_date;echo round($datediff / (60 * 60 * 24)); 2:If you're using PHP 5.3

Simple insecure two-way “obfuscation” for C#

Simple insecure two-way “obfuscation” for C#

I'm looking for very simple obfuscation (like encrypt and decrypt but not necessarily secure) functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than ROT13

Convert date format yyyy-mm-dd => dd-mm-yyyy [duplicate]

Convert date format yyyy-mm-dd => dd-mm-yyyy [duplicate]

This question already has an answer here: Convert one date format into another in PHP 14 answers I am trying to convert a date from yyyy-mm-dd to dd-mm

How do you get a timestamp in JavaScript?

How do you get a timestamp in JavaScript?

How can I get a timestamp in JavaScript?Something similar to Unix's timestamp, that is, a single number that represents the current time and date. Either as a number or a string. 1:var timeStampInMs = window.performance && window.perform

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

Question Mark in JavaScript

Question Mark in JavaScript

I came across the following linehsb.s = max != 0 ? 255 * delta / max : 0;What do the ? and : mean in this context? 1:It is called the Conditional Operator (which is a ternary operator).It has the form of: condition ? value-if-true : valu

jQuery UI DatePicker - Change Date Format

jQuery UI DatePicker - Change Date Format

I am using the UI DatePicker from jQuery UI as the stand alone picker. I have this code:

And the following JS:$('#datepicker').datepicker();When I try to return the value with this code:var date = $('#datepicker').

java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has

java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has

This method throws java.lang.IllegalStateException: Cannot forward after response has been committedand I am unable to spot the problem. Any help? int noOfRows = Integer.parseInt(request.getParameter("noOfRows")); String chkboxVal =

JavaScript OR (||) variable assignment explanation

JavaScript OR (||) variable assignment explanation

Given this snippet of JavaScript...var a;var b = null;var c = undefined;var d = 4;var e = 'five';var f = a || b || c || d || e;alert(f); // 4Can someone please explain to me what this technique is called (my best guess is in the title of th

What is the most efficient method to groupby on a JavaScript array of objects?

What is the most efficient method to groupby on a JavaScript array of objects?

What is the most efficient way to groupby objects in an array?For example, given this array of objects:[ { Phase: "Phase 1", Step: "Step 1", Task: "Task 1", Value: "5" }, { Phase: "Phase 1", Step: "Step 1", Task: "Task 2", Value: "10

How do I check if an object has a property in JavaScript?

How do I check if an object has a property in JavaScript?

How do I check if an object has a property in JavaScript?Consider:x = {'key': 1};if ( x.hasOwnProperty('key') ) { //Do this}Is that the best way to do it? 1:I'm really confused by the answers that have been given - most of them are ju

How do I download a file over HTTP using Python?

How do I download a file over HTTP using Python?

I have a small utility that I use to download a MP3 from a website on a schedule and then builds/updates a podcast XML file which I've obviously added to iTunes.The text processing that creates/updates the XML file is written in Python. I u

Get escaped URL parameter

Get escaped URL parameter

I'm looking for a jQuery plugin that can get URL parameters, and support this search string without outputting the JavaScript error: "malformed URI sequence". If there isn't a jQuery plugin that supports this, I need to know how to modify i

Static way to get 'Context' in Android?

Static way to get 'Context' in Android?

Is there a way to get the current Context instance inside a static method? I'm looking for that way because I hate saving the 'Context' instance each time it changes. 1:Do this:In the Android Manifest file, declare the following.

WPF Programming Methodology

WPF Programming Methodology

After 3 months programming my APP on WPF, I've second thought about the way I'm programming my app (I know it's maybe too late). On my APP I'm using an API of a software that my tool is managing. I've DAL that contain 16 classes, 3 of them

How to initialize properties that depend on each other

How to initialize properties that depend on each other

I want a picture to move to the bottom. If I press a button the pic should move down by 1. I added the picture and a button:var corX = 0var corY = 0var runter: UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButtonvar image = U

How do you merge two Git repositories?

How do you merge two Git repositories?

Consider the following scenario:I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirector

Communicate between two windows forms in C#

Communicate between two windows forms in C#

I have two forms, one is the main form and the other is an options form. So say for example that the user clicks on my menu on the main form: Tools -> Options, this would cause my options form to be shown.My question is how can I send data

In JavaScript can I make a “click” event fire programmatically for a file input element?

In JavaScript can I make a “click” event fire programmatically for a file input element?

I'd like to make a click event fire on an tag programmatically.Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.I've been experimenting with capturing events using li

Android Studio: Add jar as library?

Android Studio: Add jar as library?

I'm trying to use the new Android Studio but I can't seem to get it working correctly.I'm using the Gson library to serialize/deserialize JSON-objects. But the library somehow isn't included in the build.I had created a new project with jus

How to get full path of selected file on change of  using javascript, jquery-ajax?

How to get full path of selected file on change of using javascript, jquery-ajax?

How to get full path of file while selecting file using

Split comma-separated column into separate rows

Split comma-separated column into separate rows

I have a data frame, like so:data.frame(director = c("Aaron Blaise,Bob Walker", "Akira Kurosawa", "Alan J. Pakula", "Alan Parker", "Alejandro Amenabar", "Alejandro Gonzalez Inarritu", "Alejand

What methods of ‘clearfix’ can I use?

What methods of ‘clearfix’ can I use?

I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar.

There seem to b