download and install Solr from http://lucene.apache.org/solr/.
you can access Solr admin from your browser: http://localhost:8983/solr/
use the port number used in installation.
/* | |
Apollo likes perfect squares of integers (e.g. 1, 4, 9, 25 etc). You are given a hexadecimal string, s (e.g. "1a", "12b9c7"). Find out the minimum number of pieces, i, to split this string such that each of the i pieces is a hexadecimal representation of a perfect square. Note that this may not be possible for every hexadecimal string. | |
Complete the getMin function in your editor, in a language of your choice. It has one parameter: a string, s, a valid representation of a hexadecimal number. It must return an integer denoting the value of i; if there is no such positive integer i, return ?1. | |
Bonus: Performance is a concern. An unoptimized solution will see timeouts in some of the large test cases. | |
Input Format | |
The locked stub code in your editor reads a hexadecimal string, s, from stdin and passes it to your function. The input will conform to the following formats: |
package errors | |
import "github.com/sirupsen/logrus" | |
type Operation string | |
type ErrorType string | |
const ( | |
NotFoundError ErrorType = "NOT_FOUND" |
#!/bin/sh | |
SERVICE_NAME=MyService | |
PATH_TO_JAR=/usr/local/MyProject/MyJar.jar | |
PID_PATH_NAME=/tmp/MyService-pid | |
case $1 in | |
start) | |
echo "Starting $SERVICE_NAME ..." | |
if [ ! -f $PID_PATH_NAME ]; then | |
nohup java -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null & | |
echo $! > $PID_PATH_NAME |
#!/bin/bash | |
service=$@ | |
/bin/systemctl -q is-active "$service.service" | |
status=$? | |
if [ "$status" == 0 ]; then | |
echo "OK" | |
else | |
/bin/systemctl start "$service.service" | |
fi |
download and install Solr from http://lucene.apache.org/solr/.
you can access Solr admin from your browser: http://localhost:8983/solr/
use the port number used in installation.
package pubmatic.matrix.confluent.utils; | |
import org.apache.commons.io.FilenameUtils; | |
import org.apache.hadoop.fs.FileSystem; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.mapreduce.Job; | |
import org.apache.hadoop.mapreduce.JobContext; | |
import org.apache.log4j.Logger; | |
import java.io.*; |
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |