npm throws error without sudo

npm throws error without sudo

I just installed node and npm through the package on nodejs.org and whenever I try to search or install something with npm it throws the following error, unless I sudo the command. I have a feeling this is a permissions issue? I am alread

Reading a resource file from within jar

Reading a resource file from within jar

I would like to read a resource from within my jar like so:File file;file = new File(getClass().getResource("/file.txt").toURI());BufferredReader reader = new BufferedReader(new FileReader(file));//Read the fileand it works fine when runnin

Can git automatically switch between spaces and tabs?

Can git automatically switch between spaces and tabs?

I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead.Is there a way for git to automatically convert between spaces and tabs (say, 4 spaces = 1 tab) on pushing/fetc

How do I add files in Git to the path of a former submodule?

How do I add files in Git to the path of a former submodule?

I have a project that used to contain a submodule, at path mysubmodule. I installed the latest Git from source (1.8.3-rc2) and ran git submodule deinit mysubmodule. I then deleted the .gitmodules file and committed the change. I also del

How to deal with floating point number precision in JavaScript?

How to deal with floating point number precision in JavaScript?

I have the following dummy test script:function test(){ var x = 0.1 * 0.2; document.write(x);}test();This will print the result 0.020000000000000004 while it should just print 0.02 (if you use your calculator). As far as I understood

C++: Which is the best method of checking for file existence on windows platform [duplicate]

C++: Which is the best method of checking for file existence on windows platform [duplicate]

Possible Duplicate: How can we check if a file Exists or not using Win32 program? Which is the best method for checking for file existence:Option1:GetFileAttributes("C:\\MyFile.txt"); // from winbase.hif(0xffffffff == GetFileAttributes("C

mvc upload file with model - second parameter posted file is null

mvc upload file with model - second parameter posted file is null

I have a simple model with 1 string property which I render on a simple view.the view looks like the following:@using (Html.BeginForm("UploadFile", "Home", FormMethod.Post, new { encType="multipart/form-data" })){ @Html.TextBoxFor(m => m

Gradle build with Java 8

Gradle build with Java 8

I'm trying to build Java 8 project with Gradle 1.6, but I'm stuck on this error:Execution failed for task ':ejb:compileJava'invalid target release: 1.8JAVA_HOME is set as "D:\Program Files\Java\jdk1.8.0", and build.gradle contains these lin

Subfolders in .gitignore

Subfolders in .gitignore

I have many subfolders in my repo, in which there are few build/ directories I'd like to ignore when committing my code. As I understand it, there are two ways to ignore all of the folders:*/build/ (Unix wildcards)build/ (git way of ignorin

How to use enums in Qt signals and slots

How to use enums in Qt signals and slots

I have some trouble with using enum types in signals. Basicly I have two classes, a state machine and a thread handling the state machine. When the state is changed I want to send a signal with the new state. I also want to represent the st

“Starting emulator for AVD” then Panic: could not open…\"

“Starting emulator for AVD” then Panic: could not open…\"

I'm new to android app dev. When I created a new AVD, when I click start on this AVD: I get the following: Starting emulator for AVD 'Nexus_4_16_AVD'PANIC: Could not open: Nexus_4_16_AVD 1:This is a bug in the ADT Plugin. For a workaroun

nhibernate mapping: A collection with cascade=“all-delete-orphan” was no longer referenced

nhibernate mapping: A collection with cascade=“all-delete-orphan” was no longer referenced

I am having some probs with my fluent mappings. I have an entity with a child collection of entities i.e Event and EventItems for example.If I set my cascade mapping of the collection to AllDeleteOrphan I get the following error when saving

Why am I getting error message “URI is not Registered”?

Why am I getting error message “URI is not Registered”?

I just installed Android Studio and everything ran fine but then I opened AS for a second time after my computer had turned off and I am getting the following error:"URI is not Registered"On the following lines of code:This is just the mani

Best way to choose a random file from a directory

Best way to choose a random file from a directory

What is the best way to choose a random file from a directory in Python?Edit: Here is what I am doing:import osimport randomimport dircachedir = 'some/directory'filename = random.choice(dircache.listdir(dir))path = os.path.join(dir, filenam

Why does the ld linker allow multiple class definitions with the same methods?

Why does the ld linker allow multiple class definitions with the same methods?

Consider this file, first.cpp, containing a class definition and use:#include struct Foo{ Foo(){ std::cout and another, second.cpp, containing a conflicting class definition:#include struct Foo{ Foo(); ~Foo();};Foo::~Foo(){ std::co

How to open/run .jar file (double-click not working)?

How to open/run .jar file (double-click not working)?

I can't open or run my .jar file.I just installed java, but I tried to open the .jar with other programs first, so the double-click defaults to something else and I can't change it back.java -jar myfile.jar returns "'java' is not recognized

How do I create a CSV file using Perl?

How do I create a CSV file using Perl?

I want to create a CSV file using Perl and write some data to it. Is there any way to do that? 1:You could use Class:CSV.use Class::CSV;my $csv = Class::CSV->new( fields => [qw/userid username/]);$csv->add_line([2063, 'testuser'

Add the installation prefix of “Qt5Widgets” to CMAKE_PREFIX_PATH

Add the installation prefix of “Qt5Widgets” to CMAKE_PREFIX_PATH

I don't know a lot about cmake, I'm trying to build a client using cmake and Qt. Getting the following error: CMake Error at alethzero/CMakeLists.txt:26 (find_package): By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this p

NetFx40_LegacySecurityPolicy in design-time mode

NetFx40_LegacySecurityPolicy in design-time mode

Is there any way to make legacy design-time code execute with NetFx40_LegacySecurityPolicy switched on?More specificaly, is there any way to make DevExpress 8.2 winforms designer work in VisualStudio 2010?I got errors due to this issue and

How are RDF and RDFS related?

How are RDF and RDFS related?

I've been reading about Semantic Web technologies such as RDF/RDFS and "ontology", but was wondering how each of these are related? At the moment the terms all seem interchangeable, or I'm not understanding a fundamental concept here. 1:

jquery: how to include other .js-files into .js

jquery: how to include other .js-files into .js

Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ?for example:$.include('myscript.js'); ? 1:How about jQuery.getScript()? It's built in to jQuery and works like so:$.getScript('ajax/test

slf4j logging with jdk – how to enable debug?

slf4j logging with jdk – how to enable debug?

By default slf4j, when using with jdk (slf4j-jdk14-1.6.1.jar), does not log debug messages.How do I enable them?I can’t find info neither in the official docs, the web or here on how to enable it.I found some info on (failed though) creatin

How do I debug a WordPress plugin?

How do I debug a WordPress plugin?

I've recently inherited a WordPress plugin that has a few bugs in it. My problem is that I'm also new to WordPress and I don't know how to log debug messages so that I can figure out what's going on. I really just need a way to create a pop

Load package dynamically in golang

Load package dynamically in golang

Is it possible to load a specific package during runtime? I want to have a kind of plugins where each one has the same functions than the others but with different behaviour, and depending on the configuration file, load one or other.Thanks

.jar error - could not find or load main class

.jar error - could not find or load main class

I tried to put HelloWorld in a .jar file and running it, but it doesn't work. I created the java file and typed in the program, and then wrote in cmd:javac HelloWorld.javajava HelloWorldand it worked. Then I enteredecho Main-Class: HelloWor