Question: I am creating an ASP.NET web application in C#, and have to localize the application into English and French. I have created two resources files: App\_GlobalResources\Resources.resx and App\_GlobalResources\Resources.fr.resx containing the english and french content.

When I run the application with my browser set to French (fr\_FR), the french content is correctly displayed in the markup.

Within the code-behind, when I access values from the resources, it returns the default english values only. e.g.

> 
> this.CompanyName.Text = string.Format(App\_GlobalResources.Resources.CompanyLocationsFormat, companyName);
> 
> 
> 

Debugging the app shows that the CurrentCulture and CurrentUICulture are both correctly set to fr\_FR.

Can anyone explain how I can get the code-behind to use the culturally-appropriate resource file?

Many thanks

(C#, ASP.NET 3.5 SP1, Visual Studio 2008, IE 8.0.7600)

Answer: 
A rough idea of how you might be able to do this:  

You could use `java.awt.image.PixelGrabber` to grab a 2D array of RGB ints from the image, pixel by pixel. 

When you have this array populated, you can go through and sort however you want (sounds like it would be memory-intensive), and perform simple functions to order them, count them, etc. 

Then you could look at `java.awt.Color` and, using the `Color(int, int, int)` constructor, create boxes with those colors (as visual placeholders) with the number of occurrences appearing below it. 

To get the hex values for the color, you can use a String like so:

```
    String rgb = Integer.toHexString(color.getRGB());
    rgb = rgb.substring(2, rgb.length());

```

(substring is necessary, otherwise you'd get 8 characters)

Hopefully this gets you on the right track!

Resources: [Color Class](http://leepoint.net/notes-java/GUI-lowlevel/graphics/20color.html), [Image Class](http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/awt/Image.html)
Consider a "color cube" with RGB instead of XYZ. Split the cube into subcubes, but make them all overlap. Ensure they are all the same size. An easy to remember/calculate cube-pattern would be one that goes from 0-127, 64-191, 128-255 in all directions, making for a total of 27 cubes. For each cube, find what colors in the image fall into them.

As you make the cubes smaller and smaller, the results will change less and less and begin to converge on the most popular color ranges. Once you have that convergence, take the average of the range to get the "actual color".

That's about as much detail as I can go into with my boss hovering around the cubefarm :-)