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

PhantomJS; click an element

PhantomJS; click an element

How do I click an element in PhantomJS?page.evaluate(function() { document.getElementById('idButtonSpan').click(); });This gives me an error "undefined is not a function..."If I instead return document.getElementById('idButtonSpan');an

jQuery AJAX file upload PHP

jQuery AJAX file upload PHP

I want to implement a simple file upload in my intranet-page, with the smallest setup possible.This is my HTML part:and this is my JS jquery script:$("#

Local variables in Python nested functions

Local variables in Python nested functions

Okay, bear with me on this, I know it's going to look horribly convoluted, but please help me understand what's happening.from functools import partialclass Cage(object): def __init__(self, animal): self.animal = animaldef gotimes

How do I remove a property from a JavaScript object?

How do I remove a property from a JavaScript object?

Say I create an object as follows:var myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"};What is the best way to remove the property regex to end up with new myObject as follows?var myObject = { "ircE

How do I use shell variables in an awk script?

How do I use shell variables in an awk script?

I found some ways to pass external shell variables to an awk script, but I'm confused about ' and ".First, I tried with a shell script:$ v=123test$ echo $v123test$ echo "$v"123testThen tried awk:$ awk 'BEGIN{print "'$v'"}'$ 123test$ awk 'BE

Are PHP short tags acceptable to use?

Are PHP short tags acceptable to use?

Here's the information according to the official documentation: There are four different pairs of opening and closing tags which can be used in PHP. Two of those, <?php ?> and <script language="php"> </script>, are always available. Th

remote debugger over internet

remote debugger over internet

my setup is as flows: Local development PC: x86 vista with visual studioClient server: x64 server 2008 r2 with static ip and internet.Currently I connect with it using Remote desktop. Can i configure remote debugger to this setup? if so, ho

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

What is the equivalent to 'play stop' for Play Framework 2.1?

What is the equivalent to 'play stop' for Play Framework 2.1?

What is the equivalent of play stop for Play 2.1?If I did play start, how do I cleanly terminate the process? 1:As stated in the doc: When you run the start command, Play forks a new JVM and runs the default Netty HTTP server. The stand

How does Hive choose the number of reducers for a job?

How does Hive choose the number of reducers for a job?

Several places say the default # of reducers in a Hadoop job is 1. You can use the mapred.reduce.tasks symbol to manually set the number of reducers.When I run a Hive job (on Amazon EMR, AMI 2.3.3), it has some number of reducers greater t

Best Way to send message to thread

Best Way to send message to thread

What is the most efficient and fastest way to send message to a thread (not process) that run in while(1) loop in c#/.net:Using a synchronized queue (such in Blocking Queues & Thread’s Communication in C#)Running a message loop Using Applic

Ant scp task not working, even with jsch on ant/lib

Ant scp task not working, even with jsch on ant/lib

I need to copy a war file via scp. I have added the jsch-0.1.42.jar to $ANT_HOME/lib but I'm still getting this error: Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found. This looks like one of Ant's o

How to save a model without running callbacks in Rails

How to save a model without running callbacks in Rails

I need to calculate values when saving a model in Rails. So I call calculate_averages as a callback for a Survey class:before_save :calculate_averagesHowever, occasionally (and initially I have 10k records that need this operation) I need t

Scope of R.id values

Scope of R.id values

I'm looking for ways to reduce what I would call "id pollution" in my apps. From what I can tell, R.id is global to the application, so in every Activity I usually create unique resource id values for elements, even if I have many of the s

Programmatically swap last two commits

Programmatically swap last two commits

I know how to swap the last two commits using git rebase interactively (git rebase -i HEAD~2, ddjp:x in Vim), but I'd like to do it programmatically with a wrapper script since it's something I end up doing relatively often.To be more concr

Customising the font/background colour of index/section bar in UITableView

Customising the font/background colour of index/section bar in UITableView

I've read in another thread on SO that you can adjust the font or background colour of the index bar (that is the A-Z # scrollbar) in a UITableView adding a CALayer. My app will be running on iOS 5 and above and since I haven't seen anythin

Ubuntu equivalent of Yum's WhatProvides, to find which package provides a file

Ubuntu equivalent of Yum's WhatProvides, to find which package provides a file

Fedora's yum package management tool has a nice option called whatprovides, which lets you find what package has installed a specific binary or file. What is the equivalent command on Ubuntu?For example, say I'd like to find what package pr

Is Perl's taint mode useful?

Is Perl's taint mode useful?

perl -TDo you use it? Does it help you finding security holes in your Perl scripts? 1:More than that :) it stops your security issues before they become one. It is not a security silver bullet of course... we used to use it (a few years

Angular, limitTo and track by $index

Angular, limitTo and track by $index

I am trying to limit an object coming in by filtering (because there will be an option to show all eventually), however I am running into issues when trying to limitTo and track by index. Here is the code : In the controller: $scope.filte

Where is the bluetooth/bluetooth.h located in Linux?

Where is the bluetooth/bluetooth.h located in Linux?

I want to build a c file based on BlueZ but seems no bluetooth.h file in my system.fatal error: bluetooth/bluetooth.h: No such file or directoryI am sure the bluetooth dongle is running correctly and I have built Bluez successfully.UpdateFo

Laravel Homestead: 403 forbidden on nginx

Laravel Homestead: 403 forbidden on nginx

I just installed Laravel Homestead according to their instructions. When I open http://homestead.app:8000 I get the nginx 403 forbidden HTTP Response.I have tried setting app/storage permissions to 755, but that didn't work, so I reloaded V

navigator.geolocation.getCurrentPosition doesn't work on android google chrome

navigator.geolocation.getCurrentPosition doesn't work on android google chrome

This code:navigator.geolocation.getCurrentPosition( function(position) { alert(position.coords.latitude, position.coords.longitude); }, function(error){

Library not loaded: /usr/local/lib/libpq.5.4.dylib while running rake db:create

Library not loaded: /usr/local/lib/libpq.5.4.dylib while running rake db:create

I am working on a rails app.Installed Postgresql using postgresql-9.1.2-1-osx.dmgInstalled pg gem.Then when I executed rake db:creategetting the following error - dlopen(/Users/sathishvc/.rvm/gems/[email protected]/gems/pg-0.

How to assign Application Icon that will display in Task bar?

How to assign Application Icon that will display in Task bar?

I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with