Questions

Read file from line 2 or skip header row

How can I skip the header row and start reading a file from line2?

25 Jan at 17:28

Output grep results to text file, need cleaner output

When using the Grep command to find a search string in a set of files, how do I dump the results to a text file? Also is there a switch for the Grep command that provides cleaner results for better r...

19 Mar at 19:10

How to use JavaScript variables in jQuery selectors?

How do I use JavaScript variables as a parameter in a jQuery selector? ``` <script type="text/javascript"> $(function(){ $("input").click(function(){ var x = $(this).attr("name"); $("i...

17 Aug at 18:47

Append lines to a file using a StreamWriter

I want to append lines to my file. I am using a StreamWriter: ``` StreamWriter file2 = new StreamWriter(@"c:\file.txt"); file2.WriteLine(someString); file2.Close(); ``` The output of my file should...

22 Jul at 11:47

Center a button in a Linear layout

I am using a linear layout to display a pretty light initial screen. It has 1 button that is supposed to centre in the screen both horizontally and vertically. However no matter what I try to do the...

13 Mar at 02:43

How can I save an image with PIL?

I have just done some image processing using the Python image library (PIL) using a post I found earlier to perform fourier transforms of images and I can't get the save function to work. The whole co...

30 Dec at 16:9

One line if-condition-assignment

I have the following code ``` num1 = 10 someBoolValue = True ``` I need to set the value of `num1` to `20` if `someBoolValue` is `True`; and do nothing otherwise. So, here is my code for that ``` ...

4 Dec at 12:15

How can I pair socks from a pile efficiently?

Yesterday I was pairing the socks from the clean laundry and figured out the way I was doing it is not very efficient. I was doing a naive search — picking one sock and "iterating" the pile in order t...

How to call a method in another class in Java?

Currently I have two classes. a classroom class and a School class. I would like to write a method in the School class to call public void setTeacherName(String newTeacherName) from the classroom clas...

11 Jul at 06:59

Excel "External table is not in the expected format."

I'm trying to read an Excel (xlsx) file using the code shown below. I get an "External table is not in the expected format." error unless I have the file already open in Excel. In other words, I have ...

25 Feb at 04:16

Expression ___ has changed after it was checked

Why is the component in this simple [plunk](http://plnkr.co/edit/VhEGJXE439dohJXNRbPc?p=preview) ``` @Component({ selector: 'my-app', template: `<div>I'm {{message}} </div>`, }) export class App...

7 Feb at 21:38

How do I change selected value of select2 dropdown with JqGrid?

I'm using Oleg's [select2 demo](http://www.ok-soft-gmbh.com/jqGrid/UsageFormetterSelect2.htm), but I am wondering whether it would be possible to change the currently selected value in the dropdown me...

28 Oct at 16:20

How do I calculate percentiles with python/numpy?

Is there a convenient way to calculate percentiles for a sequence or single-dimensional numpy array? I am looking for something similar to Excel's percentile function. I looked in NumPy's statistics...

How to write URLs in Latex?

How do you write a URL in Latex? The subscripts and everything else make the font look very strange when it compiles.

3 May at 18:31

Could not connect to Redis at 127.0.0.1:6379: Connection refused with homebrew

Using homebrew to install Redis but when I try to ping Redis it shows this error: ``` Could not connect to Redis at 127.0.0.1:6379: Connection refused ``` I tried to turn off firewall and edit co...

15 Jan at 02:41

How to get only time from date-time C#

Suppose I have the value 6/22/2009 10:00:00 AM. How do I get only 10:00 Am from this date time.

12 Jun at 20:23

How to declare a local variable in Razor?

I am developing a web application in asp.net mvc 3. I am very new to it. In a view using razor, I'd like to declare some local variables and use it across the entire page. How can this be done? It se...

How do you convert an entire directory with ffmpeg?

How do you convert an entire directory/folder with ffmpeg via command line or with a batch script?

8 Sep at 09:48

How to include a PHP variable inside a MySQL statement

I'm trying to insert values in the contents table. It works fine if I do not have a PHP variable inside VALUES. When I put the variable `$type` inside `VALUES` then this doesn't work. What am I doing ...

11 Nov at 00:34

Running a CMD or BAT in silent mode

How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user.

4 Jan at 16:45

Reading a List from properties file and load with spring annotation @Value

I want to have a list of values in a .properties file, ie: ``` my.list.of.strings=ABC,CDE,EFG ``` And to load it in my class directly, ie: ``` @Value("${my.list.of.strings}") private List<String> ...

18 Apr at 03:35

Extracting specific columns in numpy array

This is an easy question but say I have an MxN matrix. All I want to do is extract specific columns and store them in another numpy array but I get invalid syntax errors. Here is the code: ``` extrac...

5 Dec at 14:24

Replace and overwrite instead of appending

I have the following code: ``` import re #open the xml file for reading: file = open('path/test.xml','r+') #convert to string: data = file.read() file.write(re.sub(r"<string>ABC</string>(\s+)<string>...

16 Feb at 19:44

How to vertically center <div> inside the parent element with CSS?

I'm trying to make a small username and password input box. I would like to ask, how do you vertically align a div? What I have is: ``` <div id="Login" class="BlackStrip floatright"> <div id="Us...

2 Oct at 13:15

Post request in Laravel - Error - 419 Sorry, your session/ 419 your page has expired

I installed Laravel 5.7 Added a form to the file `\resources\views\welcome.blade.php` ``` <form method="POST" action="/foo" > @csrf <input type="text" name="name"/><br/> <input type="sub...

23 Jul at 16:50