Questions

Failed to load ApplicationContext from Unit Test: FileNotFound

I am creating a Maven Spring project, which includes MVC, Data and Security. My Spring applicationContext-*.xml files are located at \src\main\resources\spring\ My TestCase is placed at \src\test\jav...

16 Jul at 10:26

How to get second-highest salary employees in a table

It's a question I got this afternoon: There a table contains ID, Name, and Salary of Employees, get names of the second-highest salary employees, in SQL Server Here's my answer, I just wrote it in p...

30 Jul at 12:17

Python: Ignore 'Incorrect padding' error when base64 decoding

I have some data that is base64 encoded that I want to convert back to binary even if there is a padding error in it. If I use ``` base64.decodestring(b64_string) ``` it raises an 'Incorrect paddi...

31 May at 13:53

Private properties in JavaScript ES6 classes

Is it possible to create private properties in ES6 classes? Here's an example. How can I prevent access to `instance.property`? ``` class Something { constructor(){ this.property = "test"; }...

How to change the Content of a <textarea> with JavaScript

How would I change the content of a `<textarea>` element with JavaScript? I want to make it empty.

4 Dec at 05:22

Changing all files' extensions in a folder with one command on Windows

How can I use the Windows command line to change the extensions of thousands of files to `*****.jpg`?

29 Sep at 03:54

Choosing a file in Python with simple Dialog

I would like to get file path as input in my Python console application. Currently I can only ask for full path as an input in the console. Is there a way to trigger a simple user interface where us...

Change color of bootstrap navbar on hover link?

I want to know how to change the color of the links when you hover over them in the nav bar, as currently they are an ugly color. Thanks for any suggestions? HTML: ``` <div class="container"> <...

Deleting a pointer in C++

Context: I'm trying to wrap my head around pointers, we just saw them a couple of weeks ago in school and while practicing today I ran into a silly? issue, it can be super straightforward to you but I...

24 Aug at 14:22

Change Schema Name Of Table In SQL

I want to change schema name of table `Employees` in Database. In the current table `Employees` database schema name is `dbo` I want to change it to `exe`. How can I do it ? Example: FROM ``` dbo...

20 Aug at 15:29

How to read first N lines of a file?

We have a large raw data file that we would like to trim to a specified size. How would I go about getting the first N lines of a text file in python? Will the OS being used have any effect on the imp...

15 May at 14:31

Difference between single and double quotes in Bash

In Bash, what are the differences between single quotes (`''`) and double quotes (`""`)?

Django - iterate number in for loop of a template

I have the following for loop in my django template displaying days. I wonder, whether it's possible to iterate a number (in the below case i) in a loop. Or do I have to store it in the database and t...

14 Jul at 06:8

Which is the fastest algorithm to find prime numbers?

Which is the fastest algorithm to find out prime numbers using C++? I have used sieve's algorithm but I still want it to be faster!

15 Sep at 13:56

Format Float to n decimal places

I need to format a float to "n"decimal places. was trying to BigDecimal, but the return value is not correct... ``` public static float Redondear(float pNumero, int pCantidadDecimales) { // the ...

How to pass parameters using ui-sref in ui-router to the controller

I need to pass and receive two parameters to the state I want to transit to using `ui-sref` of ui-router. Something like using the link below for transitioning the state to `home` with `foo` and `bar`...

Find the similarity metric between two strings

How do I get the probability of a string being similar to another string in Python? I want to get a decimal value like 0.9 (meaning 90%) etc. Preferably with standard Python and library. e.g. ``` s...

26 Apr at 00:59

How to add leading zeros?

I have a set of data which looks something like this: ``` anim <- c(25499,25500,25501,25502,25503,25504) sex <- c(1,2,2,1,2,1) wt <- c(0.8,1.2,1.0,2.0,1.8,1.4) data <- data.frame(anim,sex,wt) dat...

17 Oct at 06:8

Mongoimport of JSON file

I have a JSON file consisting of about 2000 records. Each record which will correspond to a document in the mongo database is formatted as follows: ``` {jobID:"2597401", account:"XXXXX", user:"YYYYY"...

1 Apr at 16:27

What's the difference between an argument and a parameter?

When verbally talking about methods, I'm never sure whether to use the word or or something else. Either way the other people know what I mean, but what's correct, and what's the history of the term...

how to insert date and time in oracle?

Im having trouble inserting a row in my table. Here is the insert statement and table creation. This is part of a uni assignment hence the simplicity, what am i doing wrong? Im using oracle SQL develo...

24 Sep at 08:10

JDBC connection failed, error: TCP/IP connection to host failed

I want to connect Java class file with SQL server 2012. I have logged in with SQL server authentication, but I am receiving an error when connecting. Error: > The TCP/IP connection to the host 127.0.0...

5 Nov at 18:52

Convert a positive number to negative in C#

You can convert a negative number to positive like this: ``` int myInt = System.Math.Abs(-5); ``` Is there an equivalent method to make a positive number negative?

4 Feb at 14:36

How to get the Display Name Attribute of an Enum member via MVC Razor code?

I've got a property in my model called `Promotion` that its type is a flag enum called `UserPromotion`. Members of my enum have display attributes set as follows: ``` [Flags] public enum UserPromotion...

19 Feb at 00:40

Meaning of "[: too many arguments" error from if [] (square brackets)

I couldn't find any one simple straightforward resource spelling out the meaning of and fix for the following BASH shell error, so I'm posting what I found after researching it. ``` -bash: [: too m...

8 May at 23:26