Questions

Remove portion of a string after a certain character

I'm just wondering how I could remove everything after a certain substring in PHP ex: ``` Posted On April 6th By Some Dude ``` I'd like to have it so that it removes all the text including, and af...

23 Dec at 14:25

How to convert a string or integer to binary in Ruby?

How do you create integers 0..9 and math operators + - * / in to binary strings. For example: ``` 0 = 0000, 1 = 0001, ... 9 = 1001 ``` Is there a way to do this with Ruby 1.8.6 without using a...

3 Jul at 16:33

How are booleans formatted in Strings in Python?

I see I can't do: ``` "%b %b" % (True, False) ``` in Python. I guessed `%b` for b(oolean). Is there something like this?

8 Jun at 01:16

Git: Pull from other remote

I have created a fork from a project on GitHub. How can I now pull changes from the project that I forked from?

2 Mar at 23:37

What is lazy loading in Hibernate?

What is lazy loading in Java? I don't understand the process. Can anybody help me to understand the process of lazy loading?

1 May at 00:42

Eclipse and Windows newlines

I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlines have polluted many files...

16 Aug at 13:18

How can I open Windows Explorer to a certain directory from within a WPF app?

In a WPF application, when a user clicks on a button I want to open the Windows explorer to a certain directory, how do I do that? I would expect something like this: ``` Windows.OpenExplorer("c:\te...

17 Nov at 01:44

Xcode source automatic formatting

As a C# developer, I have become highly dependent on the automatic formatting in Visual Studio 2008. Specifically, I will use the + , keyboard shortcut to force things back into shape after my slo...

15 Jul at 03:35

How to copy text to the client's clipboard using jQuery?

The workflow is simple: 1. You click inside a textarea. 2. The text is copied to the client's clipboard. 3. Display notice to the user. How do you do it?

What is the GAC in .NET?

Just looking for a short overview of GAC for a layman, not a link please.

12 Aug at 19:51

C# string reference type?

I know that "string" in C# is a reference type. This is on MSDN. However, this code doesn't work as it should then: ``` class Test { public static void Main() { string test = "befor...

8 Jul at 06:44

Linux c++ error: undefined reference to 'dlopen'

I work in Linux with C++ (Eclipse), and want to use a library. Eclipse shows me an error: ``` undefined reference to 'dlopen' ``` Do you know a solution? Here is my code: ``` #include <stdlib.h...

7 Apr at 17:33

How to convert a String to its equivalent LINQ Expression Tree?

This is a simplified version of the original problem. I have a class called Person: ``` public class Person { public string Name { get; set; } public int Age { get; set; } public int Weight { ...

8 Apr at 22:55

Listing all permutations of a string/integer

A common task in programming interviews (not from my experience of interviews though) is to take a string or an integer and list every possible permutation. Is there an example of how this is done an...

26 Dec at 16:38

"Items collection must be empty before using ItemsSource."

I'm trying to get images to display in a WPF ListView styled like a WrapPanel as described in this old ATC Avalon Team article: [How to Create a Custom View](http://blogs.msdn.com/atc_avalon_team/arch...

Fastest way(s) to move the cursor on a terminal command line?

What is the best way to move around on a given very long command line in the terminal? Say I used the arrow key or - to get this long command line: ``` ./cmd --option1 --option2 --option3 --option4 ...

26 Aug at 09:40

How do I suspend painting for a control and its children?

I have a control which I have to make large modifications to. I'd like to completely prevent it from redrawing while I do that - SuspendLayout and ResumeLayout aren't enough. How do I suspend painti...

28 Jan at 13:46

Generic List - moving an item within the list

So I have a generic list, and an `oldIndex` and a `newIndex` value. I want to move the item at `oldIndex`, to `newIndex`...as simply as possible. Any suggestions? ## Note The item should be end...

25 Jun at 16:12

Format numbers in django templates

I'm trying to format numbers. Examples: ``` 1 => 1 12 => 12 123 => 123 1234 => 1,234 12345 => 12,345 ``` It strikes as a fairly common thing to do but I can't figure out which filter I'm ...

6 Nov at 19:43

How to change an input button image using CSS

So, I can create an input button with an image using ``` <INPUT type="image" src="/images/Btn.PNG" value=""> ``` But, I can't get the same behavior using CSS. For instance, I've tried ``` <INPUT type...

12 May at 19:4

Are static class instances unique to a request or a server in ASP.NET?

On an ASP.NET website, are static classes unique to each web request, or are they instantiated whenever needed and GCed whenever the GC decides to disposed of them? The reason I ask is because I've w...

12 Oct at 15:52

How do you round a floating point number in Perl?

How can I round a decimal number (floating point) to the nearest integer? e.g. ``` 1.2 = 1 1.7 = 2 ```

8 Oct at 06:27

When should one use final for method parameters and local variables?

I've found a couple of references ([for example](http://www.javapractices.com/topic/TopicAction.do?Id=23)) that suggest using `final` as much as possible and I'm wondering how important that is. This ...

21 Mar at 00:10

What is declarative programming?

I keep hearing this term tossed around in several different contexts. What is it?

What is a deadlock?

When writing multi-threaded applications, one of the most common problems experienced are deadlocks. My questions to the community are: 1. What is a deadlock? 2. How do you detect them? 3. Do you...