Questions

jquery loop on Json data using $.each

I have the following JSON returned in a variable called data. ``` [ {"Id": 10004, "PageName": "club"}, {"Id": 10040, "PageName": "qaz"}, {"Id": 10059, "PageName": "jjjjjjj"} ] ``` and I am try...

26 Mar at 04:19

How can I view a git log of just one user's commits?

When using `git log`, how can I filter by user so that I see only commits from that user?

27 Oct at 13:51

How to check the exit status using an 'if' statement

What would be the best way to check the in an `if` statement in order to echo a specific output? I'm thinking of it being: ``` if [ $? -eq 1 ] then echo "blah blah blah" fi ``` The issue I am a...

Reading a .txt file using Scanner class in Java

I am working on a Java program that reads a text file line-by-line, each with a number, takes each number throws it into an array, then tries and use insertion sort to sort the array. I need help with...

14 Oct at 07:53

How to use SharedPreferences in Android to store, fetch and edit values

I want to store a time value and need to retrieve and edit it. How can I use `SharedPreferences` to do this?

14 Dec at 02:23

initialize a numpy array

Is there way to initialize a numpy array of a shape and add to it? I will explain what I need with a list example. If I want to create a list of objects generated in a loop, I can do: ``` a = [] for ...

18 Dec at 11:29

Best way to replace multiple characters in a string?

I need to replace some characters as follows: `&` ➔ `\&`, `#` ➔ `\#`, ... I coded as follows, but I guess there should be some better way. Any hints? ``` strs = strs.replace('&', '\&') strs = strs.r...

4 Sep at 15:7

Could not open input file: artisan

When trying to create a new laravel project, The following error appears on the CLI: > Could not open input file: artisanScript php artisan clear-compiled handling the post-install-cmd event returned ...

20 Jun at 09:12

"for loop" with two variables?

How can I include two variables in the same `for` loop? ``` t1 = [a list of integers, strings and lists] t2 = [another list of integers, strings and lists] def f(t): #a function that will read list...

19 Jan at 02:16

How to compare two dates?

How would I compare two dates to see which is later, using Python? For example, I want to check if the current date is past the last date in this list I am creating, of holiday dates, so that it will...

3 Jun at 21:52

TypeScript getting error TS2304: cannot find name ' require'

I am trying to get my first TypeScript and DefinitelyTyped Node.js application up and running, and running into some errors. I am getting the error "TS2304: Cannot find name 'require' " when I attemp...

21 Oct at 23:31

How to break/exit from a each() function in JQuery?

I have some code: ``` $(xml).find("strengths").each(function() { //Code //How can i escape from this block based on a condition. }); ``` How can i escape from the "each" code block based on a...

31 Dec at 00:40

How to set the subplot axis range

How can I set the y axis range of the second subplot to e.g. [0,1000] ? The FFT plot of my data (a column in a text file) results in a (inf.?) spike so that the actual data is not visible. ``` pylab....

15 Sep at 04:44

How to set commands output as a variable in a batch file

Is it possible to set a statement's output of a batch file to a variable, for example: ``` findstr testing > %VARIABLE% echo %VARIABLE% ```

2 Feb at 09:12

How can I undo git reset --hard HEAD~1?

Is it possible to undo the changes caused by the following command? If so, how? ``` git reset --hard HEAD~1 ```

20 Dec at 15:41

How do I use Assert to verify that an exception has been thrown with MSTest?

How do I use `Assert` (or other Test class) to verify that an exception has been thrown when using MSTest/Microsoft.VisualStudio.TestTools.UnitTesting?

Insert a string at a specific index

How can I insert a string at a specific index of another string? ``` var txt1 = "foo baz" ``` Suppose I want to insert "bar " after the "foo" how can I achieve that? I thought of `substring()`, b...

26 Oct at 19:49

How to pass arguments to addEventListener listener function?

The situation is somewhat like- ``` var someVar = some_other_function(); someObj.addEventListener("click", function(){ some_function(someVar); }, false); ``` The problem is that the value of `s...

30 Jan at 12:37

How to install and use "make" in Windows?

I'm following the instructions of someone whose repository I cloned to my machine. I want to use the `make` command as part of setting up the code environment, but I'm using Windows. I searched online...

5 Mar at 23:9

How to see query history in SQL Server Management Studio

Is the query history stored in some log files? If yes, can you tell me how to find their location? If not, can you give me any advice on how to see it?

23 Aug at 06:31

Java - get the current class name?

All I am trying to do is to get the current class name, and java appends a useless non-sense to the end of my class name. How can I get rid of it and only return the actual class name? ``` String cl...

7 Jun at 20:52

Connect Java to a MySQL database

How do you connect to a MySQL database in Java? When I try, I get ``` java.sql.SQLException: No suitable driver found for jdbc:mysql://database/table at java.sql.DriverManager.getConnection(Dri...

23 Sep at 07:23

Multidimensional Array [][] vs [,]

``` double[][] ServicePoint = new double[10][9]; // <-- gives an error (1) double[,] ServicePoint = new double[10,9]; // <-- ok (2) ``` What's their difference? yields an error, what's the reason? ...

11 Mar at 19:30

Limit file format when using <input type="file">?

I'd like to restrict the type of file that can be chosen from the native OS file chooser when the user clicks the Browse button in the `<input type="file">` element in HTML. I have a feeling it's impo...

27 Feb at 12:45

How to read AppSettings values from a .json file in ASP.NET Core

I have set up my AppSettings data in file appsettings/Config .json like this: ``` { "AppSettings": { "token": "1234" } } ``` I have searched online on how to read AppSettings values f...