Random color generator

Random color generator

Given this function, I want to replace the color with a random color generator.document.overlay = GPolyline.fromEncoded({color: "#0000FF", weight: 10, points:

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').

Converting JSON data to Java object

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string can look like:{ 'title': 'Computinga

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

Asking the user for input until they give a valid response

Asking the user for input until they give a valid response

I am writing a program that must accept input from the user.#note: Python 2.7 users should use `raw_input`, the equivalent of 3.X's `input`age = int(input("Please enter your age: "))if age >= 18: print("You are able to vote in the Unite

How do I render a partial to a string?

How do I render a partial to a string?

How do I render a partial to a string, so I can include it as part of a JSON response? I have to put it into a JSON response to allow room for a possible error message. The following code gives a 500 server error. If I use just a plain rend

R error in unique.default(x) unique() applies only to vectors

R error in unique.default(x) unique() applies only to vectors

I created a dataset named state from the built-in matrix state.x77 with two continuous variables (Population and Income) and two factor variables (region and area).I computed mean income by region using tapply(), by(), aggregate(), and av

Can docker port forward to a unix file socket on the host container?

Can docker port forward to a unix file socket on the host container?

Running the following command fails:sudo docker run -p unix:///tmp/file.sock:44444 -d image_nameIs something wrong with my port forwarding syntax or is a configuration like this not possible? 1:Docker's -p syntax won't take a unix socket

Why does Debug.WriteLine incorrectly format strings?

Why does Debug.WriteLine incorrectly format strings?

I have the following Debug.WriteLine:Debug.WriteLine("Metadata Version: {0}", version); // update: version is a stringThe output is: 2.0: Metadata Version: {0}Why is the string formatted this way?I didn't see anything in MSDN documentation

How do I read/write binary files?

How do I read/write binary files?

I've written a simple Huffman encoding in Ruby. As output I've got an array, for example:["010", "1111", "10", "10", "110", "1110", "001", "110", "000", "10", "011"]I need to write, and then read, it to and from a file. I tried sev

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 subtract 4 months from today's date?

How to subtract 4 months from today's date?

I need to declare two dates in "Ymd" format: $toDate and $fromDate.$toDate represents today's date and $fromDate needs to be 4 months earlier than today.$toDate = Date('Ymd');$fromDate = ?How do I create $fromDate? 1:Use the magic of str

System.out.printf vs System.out.format

System.out.printf vs System.out.format

Are System.out.printf and System.out.format totally the same or perhaps they differ in somehow? 1:System.out is a PrintStream, and quoting the javadoc for PrintStream.printf An invocation of this method of the form out.printf(l, forma

Set default value on Datetime field in symfony2 form

Set default value on Datetime field in symfony2 form

I have a form containing several fields. One of them is a Datetime field. How to define a default value for that field? I've tried setting a value on the related entity, in controller, in constructor and __construct :$myEntity = new MyEntit

Twitter timezone & created_at (utc time) values to calculate what time zone the user is in

Twitter timezone & created_at (utc time) values to calculate what time zone the user is in

I'm trying to estimate a twitter user's location based on the time_zone or created_at value in a given tweet object. However it seems that all created_at values I've come across are just in a pointless localised time and the time zone they

Download images from website

Download images from website

I want to have a local copy of a gallery on a website. The gallery shows the pictures at domain.com/id/1 (id increases in increments of 1) and then the image is stored at pics.domain.com/pics/original/image.format. The exact line that the i

iOS and decoding MP3/AAC data from memory buffer

iOS and decoding MP3/AAC data from memory buffer

Forgive me, I very new at iOS - and programming at this scale in general.I have been digging through iOS documentation, I know there are some functions like ExtAudiofile... for decoding MP3/AAC files, but are there any that will operate on

Reading .evt/.evtx files directly [closed]

Reading .evt/.evtx files directly [closed]

Hello does anybody know how to read .evt /.evtx which are Windows Event log files to read not using provided api's , I want to read them using FILE I/O apis in C/C++.Or how to convert those files into .txt , I know splunk does this but not

Clientside validation fails for date format dd/mm/yyyy in jQuery Validate

Clientside validation fails for date format dd/mm/yyyy in jQuery Validate

I am using jQuery Validate plugin for clientside validation in an MVC 5 application. For the date fields cilentside validations fails when using dd/mm/yyyy format. Is there a way to change the date format in jQuery Validation? 1:Adding

Using @font-face with an SVG font embedded in the current HTML page

Using @font-face with an SVG font embedded in the current HTML page

I have a standalone HTML document I want to distribute, without any external dependencies. I'm using a non-standard font in this document that only some of my users will have installed.For those users that do not have the font installed, I

Save exact image output from imagesc in matlab

Save exact image output from imagesc in matlab

Hi , I want to save this image produced from imagesc(magic(3)), the exact rainbow representation, is it possible?Thanks.This question might look like a duplicate , but it is not . I looked at the solution to the similar question at this sit

Microsoft Word Macro for highlighting multiple words

Microsoft Word Macro for highlighting multiple words

My intent is to create a very basic macro to find a series of words and highlight them. Unfortunately, I do not know how to do multiple words in one step. For example, the following code works:Sub Macro1()'' Macro1 Macro'' Selection.Find

How can I get the real time in iPhone, not the time set by user in Settings?

How can I get the real time in iPhone, not the time set by user in Settings?

I need to ensure that my app gets the correct time, not the time set by the user in settings.So for instance, once the user starts the app, I'd want to get a timestamp. The user would see the elapsed time on a timer on screen updated every

How to use Google Custom Search for image search in objective c

How to use Google Custom Search for image search in objective c

can any one please tell me how I can use google custom search in my iphone application to search images only. I tried it but it asks for 'cse' or 'cx' parameter. Please help. 1:The Google Custom Search API lets you develop websites and p

Finding out Windows service's running process name .NET 1.1

Finding out Windows service's running process name .NET 1.1

We are using a badly written windows service, which will hang when we are trying to Stop it from code. So we need to find which process is related to that service and kill it. Any suggestions? 1:WMI has this information: the Win32_Servic