Finding the max/min value in an array of primitives using Java

It’s trivial to write a function to determine the min/max value in an array, such as:

/**
 * 
 * @param chars
 * @return the max value in the array of chars
 */
private static int maxValue(char[] chars) {
    int max = chars[0];
    for (int ktr = 0; ktr < chars.length; ktr++) {
        if (chars[ktr] > max) {
            max = chars[ktr];
        }
    }
    return max;
}

but isn’t this already done somewhere?

Finding the max/min value in an array of primitives using Java

What’s the opposite of ‘make install’, i.e. how do you uninstall a library in Linux?

While running

./configure --prefix=/mingw 

on a MinGW/MSYS system for a library I had previously run

'./configure --prefix=/mingw && make && make install' 

I came across this message:

WARNING: A version of the Vamp plugin SDK is already installed. Expect worries and sorrows if you install a new version without removing the old one first. (Continuing)

This had me worried. What’s the opposite of ‘make install’, i.e. how is a library uninstalled in Linux? Will ‘make clean’ do the job, or are there other steps involved?

read more

C# – Serializing and deserializing static member

I have a static dictionary in my class which holds 12000 values. When I try to save my class I need to refresh and add some data in static dictionary at server side.

The problem is that after adding the values into static dicitionary, it still retains 12000 values, not 12001 (the last one doesn’t get added). It’s not able to serialize and deserialize the static member.

I think, as static member are not part of the object, so it doesn’t get seralized. I can implement ISerializable interface and add the last member. But I think it’s not a good idea.

read more