Still under solve MSN appears offline but online problem

Having under solving MSN appears offline but I am truly online problem. Searched for this problem around 4 hours still no any good news from there, I only can emailed to MSN customer support. Say I want to find the link to the customer support also have find a long time. I now can invite friends into my group, and I may send files to my friend; however, my friend cannot invite me into their group and cannot also send me any files. It is frustrating and inconvenience.

I saw a lot of solution online but there are no clear solutions. One of it is to reinstall MSN messenger, I have using Window Clean Up Installer also cannot used. Later I follow Jonathan posts on somewhere forum said that to delete MSN contact cache, still cannot. I login to meebo or ebuddy, still failed for me. I remember about several days ago, I try to make me offline (before that I always remain busy), then later I change back to busy status, then the problem started to arise. My friend cannot see me online, only can use guessing, to guess me whether I am online or offline. They cannot directly send me file but hopefully Hotmail works.

My email is fyhao@fymcs.com, and using the latest MSN Messenger now, if who are from Microsoft or familiar with it, can you help me how to solve this problem? Thanks.

Java Version of Discuz! authcode()

Discuz! is a forum software developed by Comsenz. authcode is a function that able to encrypt the string into human unreadable form and also can decrypt it. The beauty inside is how many times you make encryption, the encrypted string is not same at all, but when you make decryption it is able to change back to original string. Comsenz had made great contribution to the PHP world by authcode function, whereas nowadays many of the PHP developers are using authcode function in their project, even me.

Now, I would like to find some way using Java to manipulate authcode function. However my skill is not talentable from getting authcode function works. Therefore, I searched online and found that the post rain.xie posted on Javaeye Forum. I changed a little bit from there to be hosted on Google Appengine along with my project. Notice that the implementation of Base64 Decoder I am using Google Appengine Library API.

Here is the code:

AuthCode.java

package com.fyhao.gift.helper;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Calendar;
import java.util.Random;
import com.google.appengine.repackaged.com.google.common.util.Base64;

public class AuthCode {

    public enum DiscuzAuthcodeMode {
        Encode, Decode
    };

    public static String CutString(String str, int startIndex, int length) {
        if (startIndex >= 0) {
            if (length < 0) {
                length = length * -1;
                if (startIndex – length < 0) {
                    length = startIndex;
                    startIndex = 0;
                } else {
                    startIndex = startIndex – length;
                }
            }

            if (startIndex > str.length()) {
                return "";
            }

        } else {
            if (length < 0) {
                return "";
            } else {
                if (length + startIndex > 0) {
                    length = length + startIndex;
                    startIndex = 0;
                } else {
                    return "";
                }
            }
        }

        if (str.length() – startIndex < length) {

            length = str.length() – startIndex;
        }

        return str.substring(startIndex, startIndex + length);
    }

    public static String CutString(String str, int startIndex) {
        return CutString(str, startIndex, str.length());
    }

    public static String MD5(String pass) {
        byte[] defaultBytes = pass.getBytes();
        try{
             MessageDigest algorithm = MessageDigest.getInstance("MD5");
             algorithm.reset();
             algorithm.update(defaultBytes);
             byte messageDigest[] = algorithm.digest();

             StringBuffer hexString = new StringBuffer();
             for (int i=0;i<messageDigest.length;i++) {
            String hex = Integer.toHexString(0xFF & messageDigest[i]);
            if(hex.length()==1)
            hexString.append(‘0’);

            hexString.append(hex);
             }
             return hexString.toString();
        }
        catch(NoSuchAlgorithmException nsae){
        }

        return "";
    }

    public static boolean StrIsNullOrEmpty(String str) {
        //#if NET1
        if (str == null || str.trim().equals("")) {
            return true;
        }

        return false;
    }

    static private byte[] GetKey(byte[] pass, int kLen) {
        byte[] mBox = new byte[kLen];

        for (int i = 0; i < kLen; i++) {
            mBox[i] = (byte) i;
        }

        int j = 0;
        for (int i = 0; i < kLen; i++) {

            j = (j + (int) ((mBox[i] + 256) % 256) + pass[i % pass.length])
                    % kLen;

            byte temp = mBox[i];
            mBox[i] = mBox[j];
            mBox[j] = temp;
        }

        return mBox;
    }

    public static String RandomString(int lens) {
        char[] CharArray = { ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘j’, ‘k’,
                ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’,
                ‘x’, ‘y’, ‘z’, ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’ };
        int clens = CharArray.length;
        String sCode = "";
        Random random = new Random();
        for (int i = 0; i < lens; i++) {
            sCode += CharArray[Math.abs(random.nextInt(clens))];
        }
        return sCode;
    }

    public static String authcodeEncode(String source, String key, int expiry) {
        return authcode(source, key, DiscuzAuthcodeMode.Encode, expiry);

    }

    public static String authcodeEncode(String source, String key) {
        return authcode(source, key, DiscuzAuthcodeMode.Encode, 0);

    }

    public static String authcodeDecode(String source, String key) {
        return authcode(source, key, DiscuzAuthcodeMode.Decode, 0);

    }

    private static String authcode(String source, String key,
            DiscuzAuthcodeMode operation, int expiry) {
        try {
            if (source == null || key == null) {
                return "";
            }

            int ckey_length = 4;
            String keya, keyb, keyc, cryptkey, result;

            key = MD5(key);

            keya = MD5(CutString(key, 0, 16));

            keyb = MD5(CutString(key, 16, 16));

            keyc = ckey_length > 0 ? (operation == DiscuzAuthcodeMode.Decode ? CutString(
                    source, 0, ckey_length)
                    : RandomString(ckey_length))
                    : "";

            cryptkey = keya + MD5(keya + keyc);

            if (operation == DiscuzAuthcodeMode.Decode) {
                byte[] temp;
                temp = Base64.decode(CutString(source, ckey_length));
                result = new String(RC4(temp, cryptkey));
                if (CutString(result, 10, 16).equals(CutString(MD5(CutString(result, 26) + keyb), 0, 16))) {
                    return CutString(result, 26);
                } else {
                    temp = Base64.decode(CutString(source+"=", ckey_length));
                    result = new String(RC4(temp, cryptkey));
                    if (CutString(result, 10, 16).equals(CutString(MD5(CutString(result, 26) + keyb), 0, 16))) {
                        return CutString(result, 26);
                    } else {
                        temp = Base64.decode(CutString(source+"==", ckey_length));
                        result = new String(RC4(temp, cryptkey));
                        if (CutString(result, 10, 16).equals(CutString(MD5(CutString(result, 26) + keyb), 0, 16))) {
                            return CutString(result, 26);
                        }else{
                            return "2";
                        }
                    }
                }
            } else {
                source = "0000000000" + CutString(MD5(source + keyb), 0, 16)
                        + source;

                byte[] temp = RC4(source.getBytes("GBK"), cryptkey);

                return keyc + Base64.encode(temp);

            }
        } catch (Exception e) {
            return "";
        }

    }

    private static byte[] RC4(byte[] input, String pass) {
        if (input == null || pass == null)
            return null;

        byte[] output = new byte[input.length];
        byte[] mBox = GetKey(pass.getBytes(), 256);

        int i = 0;
        int j = 0;

        for (int offset = 0; offset < input.length; offset++) {
            i = (i + 1) % mBox.length;
            j = (j + (int) ((mBox[i] + 256) % 256)) % mBox.length;

            byte temp = mBox[i];
            mBox[i] = mBox[j];
            mBox[j] = temp;
            byte a = input[offset];

            byte b = mBox[(toInt(mBox[i]) + toInt(mBox[j])) % mBox.length];

            output[offset] = (byte) ((int) a ^ (int) toInt(b));
        }

        return output;
    }

    public static int toInt(byte b) {
        return (int) ((b + 256) % 256);
    }

    public long getUnixTimestamp() {
        Calendar cal = Calendar.getInstance();
        return cal.getTimeInMillis() / 1000;
    }

}

Come back to INTI, Some ideas

Just came back to INTI and I will open school next monday, the next two days. In this semester, it is my begin of third year, and I will have to do the final year project (double module), in order to achieve the honour degree. Next week I think will be busy because need to find lecturer to discuss some ideas. I have a lot of broken ideas, I am unclear what topic to do, so only find lecturer to talk all of my ideas to connect one topic out.

Since holiday, I learnt the Google Appengine and also learnt Business component (EJB), I know the basic servlet and JPA to do the Appengine application. I am learnt using that to develop basic Facebook App. I think if possible develop Facebook App using Java or PHP (my own hosting), to be one of the options.

One year ago, I also think that I can develop a new social networking service. Having a new style, new shape, of the SNS website. Since I learnt the Facebook, Twitter, Google Wave, Plurk; there are different SNS websites with different styles, different specialty, and now to be successful. I think that is it possible to research a new style of SNS that will more suitable to the user. I also think that, from year ago, Web 1.0 emerging into Web 2.0, CMS to SNS, my question is, what is the next step? SNS to WHAT???

After I learnt AI, I also got one ideas, that develop one independent, pluggable components that having mechanisms to translate the user’s mind request, and return the response that the user really want. The result returned by the components is a specific or maybe only one, not like Google give you a lot of options. And this component can be reused by different kinds of website. However, after some months, I found that Baidu.com and some other service already have some development of this kind stuff. Baidu.com of China has one development called Box Computing, heard that it is to be fight with Google Cloud Computing.

I have one friend who working in JB company told me that having one thing that his company is going to develop or research, a distributed commerce using Java. Previously I learnt EJB, but he told me most of the company is not using EJB but using Spring and other lightweight component and using their own custom framework to develop their products. And they want start to change their framework into cluster, he said. He asked me how the Facebook, Google handle the distributed component. Even PHP can use Hadoop like Facebook, when handle distributed photos. What my previous knowledge on distributed components is on EJB, Appengine (Cloud computing), Amazon Web Service. Maybe one of the title is, refine and research a new and better distributed architecture design that can cope the existing problem. Or examine is it CAT is true, this theory said only two of three (CAT) can achieve during development of distributed components.

To be continued….