Questions

How to clone an InputStream?

I have a InputStream that I pass to a method to do some processing. I will use the same InputStream in other method, but after the first processing, the InputStream appears be closed inside the method...

15 Sep at 17:19

SQL, Postgres OIDs, What are they and why are they useful?

I am looking at some PostgreSQL table creation and I stumbled upon this: ``` CREATE TABLE ( ... ) WITH ( OIDS = FALSE ); ``` I read the documentation provided by postgres and I know the concept of ...

7 Apr at 11:40

Having links relative to root?

Is there a way to have all links on a page be relative to the root directory? For example, on `www.example.com/fruits/apples/apple.html` I could have a link saying: ``` <a href="fruits/index.html">B...

31 Dec at 21:46

How do I read configuration settings from Symfony2 config.yml?

I have added a setting to my config.yml file as such: ``` app.config: contact_email: somebody@gmail.com ... ``` For the life of me, I can't figure out how to read it into a variable. I trie...

5 Aug at 08:33

What is the difference between user variables and system variables?

What is the difference between user variables such as `PATH`, `TMP`, etc. and system variables? I accidentally deleted the user variable `PATH`. What am I supposed to do?

How to increase font size in a plot in R?

I am confused. What is the right way to increase font size of text in the title, labels and other places of a plot? For example ``` x <- rnorm(100) hist(x, xlim=range(x), xlab= "Variable Label", ...

7 Feb at 02:56

What's a "static method" in C#?

What does it mean when you add the static keyword to a method? ``` public static void doSomething(){ //Well, do something! } ``` Can you add the `static` keyword to class? What would it mean the...

2 Apr at 00:7

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I'm hoping someone can enlighten me as to what could possibly be causing this error: > Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I cannot...

PHPUnit: assert two arrays are equal, but order of elements not important

What is a good way to assert that two arrays of objects are equal, when the order of the elements in the array is unimportant, or even subject to change?

16 Nov at 11:3

Why does IE9 switch to compatibility mode on my website?

I have just installed IE9 beta and on a specific site I created (HTML5) IE9 jumps to compatibility mode unless I manually tell it not to. I have tried removing several parts of the website but no chan...

Match multiline text using regular expression

I am trying to match a multi line text using java. When I use the `Pattern` class with the `Pattern.MULTILINE` modifier, I am able to match, but I am not able to do so with `(?m).` The same pattern w...

18 Nov at 09:29

How to resize a custom view programmatically?

I am coding a custom view, extended from RelativeLayout, and I want to resize it programmatically, How can I do? the custom view Class is something like: ``` public ActiveSlideView(Context context, ...

3 Feb at 15:35

What does the PHP error message "Notice: Use of undefined constant" mean?

PHP is writing this error in the logs: "Notice: Use of undefined constant". ``` PHP Notice: Use of undefined constant department - assumed 'department' (line 5) PHP Notice: Use of undefined const...

6 Feb at 14:12

How can I change the color of a Google Maps marker?

I'm using the Google Maps API to build a map full of markers, but I want one marker to stand out from the others. The simplest thing to do, I think, would be to change the color of the marker to blue,...

19 Aug at 22:38

Convert Unicode to ASCII without errors in Python

My code just scrapes a web page, then converts it to Unicode. ``` html = urllib.urlopen(link).read() html.encode("utf8","ignore") self.response.out.write(html) ``` But I get a `UnicodeDecodeError`:...

Error: allowDefinition='MachineToApplication' beyond application level

I have downloaded the online project in ASP.Net. While running application I get an error > It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application l...

15 Oct at 23:29

Rotating a point about another point (2D)

I'm trying to make a card game where the cards fan out. Right now to display it Im using the Allegro API which has a function: ``` al_draw_rotated_bitmap(OBJECT_TO_ROTATE,CENTER_X,CENTER_Y,X ...

13 Feb at 23:15

How can I remove part of a string in PHP?

How can I remove part of a string? Example string: `"REGISTER 11223344 here"` How can I remove `"11223344"` from the above example string?

12 May at 19:45

What is a singleton in C#?

What is a Singleton and when should I use it?

1 Feb at 21:2

Is it better to use Enumerable.Empty<T>() as opposed to new List<T>() to initialize an IEnumerable<T>?

Suppose you have a class Person : ``` public class Person { public string Name { get; set;} public IEnumerable<Role> Roles {get; set;} } ``` I should obviously instantiate the Roles in the c...

8 Feb at 16:55

List files with certain extensions with ls and grep

I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else. So I thought I could just do this: ``` ls | grep \.mp4$ | grep \.mp3$ | grep \.exe$ ``` But no, ...

29 Dec at 19:36

ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged)

Does anyone know why this code doesn't work: ``` public class CollectionViewModel : ViewModelBase { public ObservableCollection<EntityViewModel> ContentList { get { return _contentL...

How to remove all .svn directories from my application directories

One of the missions of an export tool I have in my application, is to clean all `.svn` directories from my application directory tree. I am looking for a recursive command in the Linux shell that will...

3 Jul at 08:40

How to resize the jQuery DatePicker control

I'm using the jQuery DatePicker control for the first time. I've got it working on my form, but it's about twice as big as I would like, and about 1.5 times as big as the demo on the jQuery UI page. I...

18 Mar at 19:40

Rails select helper - Default selected value, how?

Here is a piece of code I'm using now: ``` <%= f.select :project_id, @project_select %> ``` How to modify it to make its default value equal to to `params[:pid]` when page is loaded?

27 Oct at 11:48