Questions

Dealing with "java.lang.OutOfMemoryError: PermGen space" error

Recently I ran into this error in my web application: > java.lang.OutOfMemoryError: PermGen space It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6. Apparently ...

Count the number of occurrences of a character in a string

How do I count the number of occurrences of a character in a string? e.g. `'a'` appears in `'Mary had a little lamb'` 4 times.

9 Apr at 10:3

Extract file name from path, no matter what the os/path format

Which Python library can I use to extract filenames from paths, no matter what the operating system or path format could be? For example, I'd like all of these paths to return me `c`: ``` a/b/c/ a/b...

28 Nov at 13:46

When should you use a class vs a struct in C++?

In what scenarios is it better to use a `struct` vs a `class` in C++?

28 Aug at 15:34

Listing only directories using ls in Bash?

This command lists directories in the current path: ``` ls -d */ ``` What exactly does the pattern `*/` do? And how can we give the absolute path in the above command (e.g. `ls -d /home/alice/Documen...

1 Sep at 14:33

Create a git patch from the uncommitted changes in the current working directory

Say I have uncommitted changes in my working directory. How can I make a patch from those without having to create a commit?

22 Aug at 09:32

Android SDK installation doesn't find JDK

I'm trying to install the Android SDK on my Windows 7 x64 System. `jdk-6u23-windows-x64.exe` is installed, but the setup refuses to proceed because it doesn't find the installation. Is this a kn...

19 Apr at 11:18

How do you get the index of the current iteration of a foreach loop?

Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For...

23 Mar at 08:51

How to mark a method as obsolete or deprecated?

How do I mark a method as obsolete or deprecated using C#?

16 Jul at 22:38

Serializing to JSON in jQuery

I need to [serialize](https://en.wikipedia.org/wiki/Serialization) an object to [JSON](https://www.json.org/). I'm using [jQuery](https://api.jquery.com/). Is there a "standard" way to do this? My sp...

How do I return dictionary keys as a list in Python?

With Python 2.7, I can get dictionary , , or as a `list`: ``` >>> newdict = {1:0, 2:0, 3:0} >>> newdict.keys() [1, 2, 3] ``` With Python >= 3.3, I get: ``` >>> newdict.keys() dict_keys([1, 2, 3]) ``...

27 Feb at 21:29

Could not find a part of the path ... bin\roslyn\csc.exe

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added all assembly references and I am able to build and compile su...

1 Jul at 14:15

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do

I really want to know more about the update, export and the values that could be given to `hibernate.hbm2ddl.auto` I need to know when to use the update and when not? And what is the alternative? The...

15 Apr at 15:24

Convert a string to an enum in C#

What's the best way to convert a string to an enumeration value in C#? I have an HTML select tag containing the values of an enumeration. When the page is posted, I want to pick up the value (which wi...

11 Jan at 03:20

How can I tell if a DOM element is visible in the current viewport?

Is there an efficient way to tell if a DOM element (in an HTML document) is currently visible (appears in the )? (The question refers to Firefox.)

15 Dec at 04:44

What is event bubbling and capturing?

What is the difference between event bubbling and capturing? When should one use bubbling vs capturing?

21 Aug at 21:48

What does <![CDATA[]]> in XML mean?

I often find this strange `CDATA` tag in `XML` files: ``` <![CDATA[some stuff]]> ``` I have observed that this `CDATA` tag always comes at the beginning, and then followed by some stuff. But somet...

28 Aug at 00:43

Center a column using Twitter Bootstrap 3

How do I center a div of one column size within the container (12 columns) in [Twitter Bootstrap 3](https://en.wikipedia.org/wiki/Bootstrap_%28front-end_framework%29)? ``` .centered { background-col...

How do I get ASP.NET Web API to return JSON instead of XML using Chrome?

Using the newer , in I am seeing XML - how can I change it to request so I can view it in the browser? I do believe it is just part of the request headers, am I correct in that?

30 Sep at 08:17

How do you remove all the options of a select box and then add one option and select it with jQuery?

Using core jQuery, how do you remove all the options of a select box, then add one option and select it? My select box is the following. ``` <Select id="mySelect" size="9"> </Select> ``` EDIT: The...

Does Django scale?

I'm building a web application with Django. The reasons I chose Django were: - - - - - Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The onl...

How can I pipe stderr, and not stdout?

I have a program that writes information to `stdout` and `stderr`, and I need to process the `stderr` with `grep`, leaving `stdout` aside. Using a temporary file, one could do it in two steps: ``` com...

10 Nov at 12:19

Alternatives for returning multiple values from a Python function

The canonical way to return multiple values in languages that support it is often [tupling](https://stackoverflow.com/questions/38508/whats-the-best-way-to-return-multiple-values-from-a-function-in-py...

Convert ArrayList<String> to String[] array

I'm working in the android environment and have tried the following code, but it doesn't seem to be working. ``` String [] stockArr = (String[]) stock_list.toArray(); ``` If I define as follows: `...

30 Jul at 18:32

How do I "select Android SDK" in Android Studio?

After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error ``` "Please select Android SDK" ``` when I click on the button to run the application in the simulat...