Questions

PowerShell equivalent to grep -f

I'm looking for the PowerShell equivalent to `grep --file=filename`. If you don't know `grep`, filename is a text file where each line has a regular expression pattern you want to match. Maybe I'm mi...

8 Sep at 20:13

Difference between Divide and Conquer Algo and Dynamic Programming

What is the difference between Divide and Conquer Algorithms and Dynamic Programming Algorithms? How are the two terms different? I do not understand the difference between them. Please take a simple...

Correct way to pause a Python program

I've been using the `input` function as a way to pause my scripts: ``` print("something") wait = input("Press Enter to continue.") print("something") ``` Is there a formal way to do this?

8 Nov at 04:15

callback to handle completion of pipe

I am using the following node.js code to download documents from some url and save it in the disk. I want to be informed about when the document is downloaded. i have not seen any callback with pipe.O...

12 Jul at 08:31

Remote Debugging for Chrome iOS (and Safari)

With the recent release of Chrome for iOS, I was wondering how do you enable remote debugging for Chrome iOS? Update: With the release of iOS 6, remote debugging can now be done with .

How to set Java environment path in Ubuntu

I just installed JDK in Ubuntu with `sudo apt-get install openjdk-6-jdk` command, after the installation where's the Java `bin` directory located? And how can I set the environment path for that direc...

29 Oct at 13:45

Select records from NOW() -1 Day

Is there a way in a MySQL statement to order records (through a date stamp) by >= NOW() -1 so all records from the day before today to the future are selected?

2 Aug at 15:20

Convert String to System.IO.Stream

I need to convert a String to System.IO.Stream type to pass to another method. I tried this unsuccessfully. ``` Stream stream = new StringReader(contents); ```

8 Nov at 07:13

Resource interpreted as Document but transferred with MIME type application/zip

With Chrome 12.0.742.112, if I redirect with the following headers: ``` HTTP/1.1 302 Found Location: http://0.0.0.0:3000/files/download.zip Content-Type: text/html; charset=utf-8 Cache-Control: no-c...

24 Feb at 14:27

ModelState.AddModelError - How can I add an error that isn't for a property?

I am checking my database in `Create(FooViewModel fvm){...}` to see if the `fvm.prop1` and `fvm.prop2` already exist in that combination; if so, I want to add an error to the modelstate, then return t...

Mutex example / tutorial?

I was trying to understand how mutexes work. Did a lot of Googling but it still left some doubts of how it works because I created my own program in which locking didn't work. One absolutely non-intui...

How to efficiently remove all null elements from a ArrayList or String Array?

I try with a loop like that ``` // ArrayList tourists for (Tourist t : tourists) { if (t != null) { t.setId(idForm); } } ``` But it isn't nice. Can anyone suggest me a bette...

Rails get index of "each" loop

So I have this loop: ``` <% @images.each do |page| %> <% end %> ``` How would I get the index of "page" inside of the loop?

27 Jan at 00:11

What is console.log and how do I use it?

> [What is console.log?](https://stackoverflow.com/questions/4539253/what-is-console-log) I see this line in a lot of jQuery scripts out there. I assume it's used for debug. Where can I see t...

23 May at 11:46

What are "res" and "req" parameters in Express functions?

In the following Express function: ``` app.get('/user/:id', function(req, res){ res.send('user' + req.params.id); }); ``` What are `req` and `res`? What do they stand for, what do they mean, an...

5 Feb at 19:39

C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what `&&` address operator is supposed to do. Here is a code example from `stl_vector.h`: ``` vector& operator=(vector&& __x) // <-- Note double ampersa...

How do I allow HTTPS for Apache on localhost?

I was asked to set up HTTPS with a self-signed cert on Apache on localhost, but how do I actually do that? I have no idea at all.

1 Aug at 10:5

How to remove new line characters from a string?

I have a string in the following format ``` string s = "This is a Test String.\n This is a next line.\t This is a tab.\n' ``` I want to remove all the occurrences of `\n` and `\r` from the string...

23 Apr at 14:58

Calling startActivity() from outside of an Activity?

I'm using an `AlarmManager` to trigger an intent that broadcasts a signal. The following is my code: ``` AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent i = new Inte...

Recreating a Dictionary from an IEnumerable<KeyValuePair<>>

I have a method that returns an `IEnumerable<KeyValuePair<string, ArrayList>>`, but some of the callers require the result of the method to be a dictionary. How can I convert the `IEnumerable<KeyValue...

How to assign the output of a Bash command to a variable?

I have a problem putting the content of `pwd` command into a shell variable that I'll use later. Here is my shell code (the loop doesn't stop): ``` #!/bin/bash pwd= `pwd` until [ $pwd = "/" ] d...

3 Jul at 17:13

SQL Server: Filter output of sp_who2

Under SQL Server, is there an easy way to filter the output of sp_who2? Say I wanted to just show rows for a certain database, for example.

15 Jun at 02:22

Check if property has attribute

Given a property in a class, with attributes - what is the fastest way to determine if it contains a given attribute? For example: ``` [IsNotNullable] [IsPK] [IsIdentity] [SequenceNameAtt...

12 Jan at 17:44

How to make a <div> always full screen?

No matter how its content is like. Is it possible to do this?

15 Nov at 02:5

SQL Server 2008 can't login with newly created user

I'm using using Windows Vista and I'm having trouble logging in with a newly created user. 1. I open SQL Server Management Studio. 2. I create a new Login by right-clicking on Security->Logins. Chec...

15 Apr at 22:25