Maven: add a dependency to a jar by relative path

Maven: add a dependency to a jar by relative path

I have a proprietary jar that I want to add to my pom as a dependency.But I don't want to add it to a repository. The reason is that I want my usual maven commands such as mvn compile, etc, to work out of the box. (Without demanding from th

Replicate each row of data.frame and specify the number of replications for each row

Replicate each row of data.frame and specify the number of replications for each row

df <- data.frame(var1=c('a', 'b', 'c'), var2=c('d', 'e', 'f'), freq=1:3)What is the simplest way to expand the first two columns of the data.frame above, so thateach row appears the number of times specified in the column 'freq'?In other wo

Font scaling based on width of container

Font scaling based on width of container

I'm having a hard time getting my head around font scaling.I currently have this site with a body font-size of 100%. 100% of what though? This seems to compute out at 16px. I was under the impression that 100% would somehow refer to the siz

Is there a function to extract a 'column' from an array in PHP?

Is there a function to extract a 'column' from an array in PHP?

I have an array of arrays, with the following structure :array(array('page' => 'page1', 'name' => 'pagename1') array('page' => 'page2', 'name' => 'pagename2') array('page' => 'page3', 'name' => 'pagename3'))Is there a bui

Segmentation fault on large array sizes

Segmentation fault on large array sizes

The following code gives me a segmentation fault when run on a 2Gb machine, but works on a 4GB machine.int main(){ int c[1000000]; cout << "done\n"; return 0;}The size of the array is just 4Mb. Is there a limit on the size of an array

Invalid argument supplied for foreach()

Invalid argument supplied for foreach()

It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data.$values = get_values();foreach ($values as $value){ ...}When you feed a foreach with data that are not an array,

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:$("#

Including all the jars in a directory within the Java classpath

Including all the jars in a directory within the Java classpath

Is there a way to include all the jar files within a directory in the classpath?I'm trying java -classpath lib/*.jar:. my.package.Program and it is not able to find class files that are certainly in those jars. Do I need to add each jar fi

NullPointerException accessing views in onCreate()

NullPointerException accessing views in onCreate()

This is a canonical question for a problem frequently posted on StackOverflow.I'm following a tutorial. I've created a new activity using a wizard. I get NullPointerException when attempting to call a method on Views obtained with findViewB

Most vexing parse: why doesn't A a(()); work?

Most vexing parse: why doesn't A a(()); work?

Among the many things Stack Overflow has taught me is what is known as the "most vexing parse", which is classically demonstrated with a line such asA a(B()); //declares a functionWhile this, for most, intuitively appears to be the declarat

Non-static variable cannot be referenced from a static context

Non-static variable cannot be referenced from a static context

I've written this test code:class MyProgram{ int count = 0; public static void main(String[] args) { System.out.println(count); }}But it gives the following error:Main.java:6: error: non-static variable count cannot be re

How do I check if an array includes an object in JavaScript?

How do I check if an array includes an object in JavaScript?

What is the most concise and efficient way to find out if a JavaScript array contains an object?This is the only way I know to do it:function contains(a, obj) { for (var i = 0; i < a.length; i++) { if (a[i] === obj) { r

Best way to load a 64-bit integer to a double precision SSE2 register?

Best way to load a 64-bit integer to a double precision SSE2 register?

What is the best/fastest way to load a 64-bit integer value in an xmm SSE2 register in 32-bit mode?In 64-bit mode, cvtsi2sd can be used, but in 32-bit mode, it supports only 32-bit integers.So far I haven't found much beyond:use fild, fstp

How do you use JSHint and Browserify together?

How do you use JSHint and Browserify together?

I'm attempting to build a project using Angular and Browserify. My controllers.js file looks like this...'use strict';module.exports.testController = function($scope){ $scope.message = 'Controller 1'; console.log( 'hello' );};As you m

Get rid of leading zeros for date strings in Python? [duplicate]

Get rid of leading zeros for date strings in Python? [duplicate]

This question already has an answer here: Python strftime - date without leading 0? 16 answers Is there a nimble way to get rid of leading zeros for da

Using std::unique_ptr for Windows HANDLEs

Using std::unique_ptr for Windows HANDLEs

I am attempting to use std::unique_ptrs to manage Windows HANDLEs in an exception-safe manner.First I tried:struct HandleDeleter{ void operator()( HANDLE handle ) { if( handle ) { FindVolumeClose( handle )

How can I use an SD card for logging 16-bit data at 48 ksamples/s?

How can I use an SD card for logging 16-bit data at 48 ksamples/s?

BackgroundMy board incorporates an STM32 microcontroller with an SD/MMC card on SPI and samples analogue data at 48ksamples/s. I am using the Keil Real-time Library RTX kernel, and ELM FatFs.I have a high priority task that captures analogu

Prevent saving files with certain names in Vim

Prevent saving files with certain names in Vim

I type really fast and realize that sometimes I accidentally save a file with the name of ; or : (I type :wq and sometimes a typo is introduced).Is there any way to write a macro that rejects saving files matching certain names? 1:A sim

Where do you store your secret key in a Java Web Application? [closed]

Where do you store your secret key in a Java Web Application? [closed]

Cryptography is a widely adopted techonlogy to ensure confidentiality. Not considering implementation flaws, it has a single critical point: the secret key storage. If the secret key is stolen, the whole system will be compromised.EDIT :let

How can I disable a view behind my SlidingDrawer in Android?

How can I disable a view behind my SlidingDrawer in Android?

I have a SlidingDrawer that pops up from the bottom of the screen and fills the screen about 80%. Even though the SlidingDrawer view is in focus, it is still possible to click on items, buttons and other elements in the view that is behind

Initializing List with given number of nulls without loop?

Initializing List with given number of nulls without loop?

Can a List be initialized to contain a given number of nulls, where T is a type parameter of the class of which the list is a member? I sure can do it with a loop, but like to know whether it is possible without.List myList = new ArrayList(

How can I ensure no code uses an API?

How can I ensure no code uses an API?

I want to ban use of iostreams in a code base I have (for various reasons). Is there a way I can inspect symbol files or force the compiler to emit an error when that API is used? 1:A simple approach is provide a dummy iostream implement

ErrorActionPreference and ErrorAction SilentlyContinue for Get-PSSessionConfiguration

ErrorActionPreference and ErrorAction SilentlyContinue for Get-PSSessionConfiguration

My case:$ErrorActionPreference = "Stop";"1 - $ErrorActionPreference;"Get-ChildItem NoSuchFile.txt -ErrorAction SilentlyContinue;"2 - $ErrorActionPreference;"Get-ChildItem NoSuchFile.txt -ErrorAction Stop;"3 - $ErrorActionPreference;"Output:

ggplot2 and gridExtra: completely remove strip in facet_grid - not just invisible

ggplot2 and gridExtra: completely remove strip in facet_grid - not just invisible

I have two graphs that I'm placing one above the other, in the following way:library(ggplot2)library(gridExtra)p1 For this I need the x axes of the top and bottom graphs to line up, however because of the strip to the left, the faceted grap

CSS using negative relative positioning issue

CSS using negative relative positioning issue

I have a header, mainbody and footer. Header and mainbody are properly styled. Now for footer I want to make it appear behind mainbody, so I used:z-index: -1;position: relative;top: -60px;This gives the desired result, but I get an extra sp