关于思维方式的思考

我们每个人都是数目众多的群体的一部分,与众多群体相应的是众多细分的人类传统。在每个传统中,某一特定的个体可能会比群体里的其他成员优秀,也可能低劣,或其中之一,或两者兼有,这取决于定义方法和环境因素。

正因为如此,“优秀”和“低劣”没有什么实际意义。客观地讲,真正存在的是“不同”,我们每个人都是不同的,我不同,你不同,还有他、她、他们……

正是这种不同,才是人类的光荣,也才最有可能拯救人类,因为某人不能做的事,别人能做;在某人不能兴旺发达的地方,别人利用广泛的条件却能够兴旺发达。我认为,我们应该从整个人类物种的角度出发,把这些“不同”视为人类的主要财富。千万不要从个人的角度出发,试图用它们把我们的生活搞糟。

艾萨克・阿西莫夫

  • Share/Bookmark
Posted in Uncategorized | Leave a comment

两个Java MD5实现类,和利用Java MD5生成File checksum。

第一个:

pass “String” return MD5 “String”

import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
 
public class MD5 {
    public static String getMD5(String input) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] messageDigest = md.digest(input.getBytes());
            BigInteger number = new BigInteger(1, messageDigest);
            String hashtext = number.toString(16);
            // Now we need to zero pad it if you actually want the full 32 chars.
            while (hashtext.length() < 32) {
                hashtext = "0" + hashtext;
            }
            return hashtext;
        }
        catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
 
    public static void main(String[] args) throws NoSuchAlgorithmException {
        System.out.println(getMD5("Javarmi.com"));
    }
}

第二个,同样效果,算法稍有不同:

import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
 
public class MD5 {
    public static String getMD5(String input) {
        byte[] source;
        try {
            //Get byte according by specified coding.
            source = input.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            source = input.getBytes();
        }
        String result = null;
        char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(source);
            //The result should be one 128 integer
            byte temp[] = md.digest();
            char str[] = new char[16 * 2];
            int k = 0;
            for (int i = 0; i < 16; i++) {
                byte byte0 = temp[i];
                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
                str[k++] = hexDigits[byte0 & 0xf];
            }
            result = new String(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
 
    public static void main(String[] args) throws NoSuchAlgorithmException {
        System.out.println(getMD5("Javarmi.com"));
    }
}

最后是一个用MD5生成File checksum的例子:

public static void main(String[] args) throws Exception {
    MessageDigest md = MessageDigest.getInstance("MD5");
    FileInputStream fis = new FileInputStream("c:\\apache\\cxf.jar");
 
    byte[] dataBytes = new byte[1024];
 
    int nread = 0;
    while ((nread = fis.read(dataBytes)) != -1) {
        md.update(dataBytes, 0, nread);
    };
    byte[] mdbytes = md.digest();
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < mdbytes.length; i++) {
        sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16).substring(1));
    }
    System.out.println("Digest(in hex format):: " + sb.toString());
}
  • Share/Bookmark
Posted in 网络开发 [Web-based Development] | Tagged , , | Leave a comment

JSF中与POPUP(弹出)窗口交换数据的两种方式。

27-08-2010-6-01-58-pm 很多人都知道,用:popup = window.open(url, name, features);
popup.focus();可以弹出一个新的浏览器的窗口,这是一个十分方便常用的功能。但是如何在JSF中与弹出窗口交换数据?是很多人关心的问题。这里基于Core JSF书中的例子,谈到两个方法,列举到这里,希望对有需求的人有所帮助。

第一种方法较为简单,和所有其他的基于网络编程语言一样,使用URL链接来提交你所需要的变量和变量值。比如我们的例子中,使用:

Continue reading

  • Share/Bookmark
Posted in 网络开发 [Web-based Development] | Tagged , , , , , , , | Leave a comment

JSF中为DataTable增加翻页功能

初学JSF的大概都会遇到这么个问题,从Bean中将数据读取出来以后,用DataTable在页面上显示。是很常用的数据内容输出的方法,但是DataTable本身没有翻页的功能。如何给DataTable增加翻页呢?这里分享一下CoreJSF 3rd Edition中的pager demo来完成这个数据分页。其思路可以扩展到各种大量数据需要翻页的情况。

不想自己实现这个翻页的朋友,可以使用各种UI Framework中自带的翻页组件。比如Apache Tomahawk 中的 dataScroller 具体实现方法其实和这里要谈到的类似。

Continue reading

  • Share/Bookmark
Posted in 网络开发 [Web-based Development] | Tagged , , , , , , | Leave a comment

Five tips to convert more customers

By Netregistry

If you’ve opened your ecommerce store and are ready to sell online, one of the biggest
challenges is trying to convince site visitors to become customers. The internet is a browsing
medium, allowing potential customers to flit from online store to online store, looking for the
cheapest price or best bargain, until they decide to make a purchase. Therefore, it is important
to provide an online store that recognises this.
Unlike the real world, where the presence of a helpful sales assistant can sometimes close a
sale on a wavering store visitor, the internet has a back button that makes it far easier for your
visitors to leave your store quickly and anonymously. So how do you close those sales?

Keep it simple

Most people shop online for convenience, so it is imperative that your online store has an
easy purchasing process. Don’t overcomplicate your online store by using forms, requiring
registration or using complex navigation if you don’t have to. Always ensure a customer can
click a button at any time to go straight to a purchase.

Secure and easy payments

One of the biggest worries to internet shoppers is the security of their credit card details when
buying their online bargains.
By ordering a dedicated or shared SSL certificate from Netregistry, you can show your
customers their payment transactions are safely encrypted to protect their valuable information.
  • Share/Bookmark
Posted in 商业金融 | Leave a comment

How to make your customers love you

In a bricks-and-mortar store, customers can be served with a smile and a helping hand.

However, in the online world, there are many other factors to consider, such as dealing with postage and delivery issues and handling online queries. Luke Telford talks with two people from online stores about the challenges they face and how they use their service strategies to ensure their customers are taken care of online, all the time.

Monsterthreads: tailoring your style

“Effective communication is essential in business, and the internet is essential for connecting with the public, especially gen X and Y,” says Mark Mamrot, CEO and owner of online t-shirt retailer Monsterthreads.

“Online and face-to-face customers have strong service expectations, and your ability to meet those expectations shapes their perception of you. In a physical shop, customers can judge the quality of your business by many elements but online, the interaction is often limited to a relatively static website. Your responsiveness, therefore, is crucial to the customer’s experience.

“When dealing with customers online, responsiveness is definitely an important factor. However, manner is also crucial. It will vary from business to business – for a company such as ours, customers need to be treated with a personal touch. We treat our customers as we would treat our friends, and often go beyond our obligations to keep them satisfied and maintain the personality of the Monsterthreads brand.

“Of course, we do accommodate customer feedback. We have a ‘comments and feedback’ field integrated into our order process, and we use mailing list software with a return address. We also perform periodic satisfaction surveys. Most importantly, we act on what we learn from those surveys.

  • Share/Bookmark
Posted in 商业金融 | Leave a comment

2010 CWE/SANS Top 25 Most Dangerous Software Errors

http://cwe.mitre.org/top25/#Listing

  • Share/Bookmark
Posted in Uncategorized | Leave a comment

让Alfresco Explorer中表单提交后不回到页面顶端

无论新的surf怎么好,起码现在还仍然不太成熟,老的Alfresco Explorer虽然技术较为落后,但是功能和各方面仍然比新的UI成熟很多。

如果你经常使用alfresco explorer来进行文档和记录管理和编辑,你会发现当你在同一个页面中有多个form的时候,每次form提交该页面都会自动回到首页,如果你的页面很长,这个问题很是烦人。(其实在使用ajax list or space or whatever picker等UI的时候都会有同样的问题,增加和删除项后form提交会导致页面回到顶端)

在alfresco.war的web.xml中有一个项可以修复该问题。编辑web.xml,找到:

<context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
        <description>
            If true, a javascript function will be rendered that is able to restore the
            former vertical scroll on every request. Convenient feature if you have pages
            with long lists and you do not want the browser page to always jump to the top
            if you trigger a link or button action that stays on the same page.
            Default: "false"
        </description>
    </context-param>

3.2r2中没编辑过的话在56-66行,将其中的param-value 由 false改为ture就可以了。

修改后使用myface auto scrolling功能记录你上次的位置,方便了许多。

  • Share/Bookmark
Posted in 网络开发 [Web-based Development] | Tagged , , , | Leave a comment

5 easy ways to keep your customers

r3350-acerin David Binning

3 August 2010

The more useful information you know about your customers, the better you can understand and address their needs.

Chosen carefully and implemented intelligently, a customer relationship management (CRM) system can help you gain powerful insights into what makes your customers tick.

The key to getting customer relationship management right is in deciding the best questions to ask and then figuring out what to do with the answers. Before you begin asking your customers questions though, ask yourself some:

* Who are your customers?
* What are the main subgroups?
* How do you currently interact with them, and how would you like to interact with them?
* What do they currently buy from you, and what do you think they might buy in the future?
* How long have they been customers, and what do you know about why they chose to do business with you?

CRM systems provide a framework to collect and process all of the information about the people who buy, or should be buying from you, so that you can develop smarter and more effective strategies for targeting them, while tracking your success beyond the mere fact of a sale. Continue reading

  • Share/Bookmark
Posted in 商业金融 | Tagged | Leave a comment

买了个多功能电子相框,好像叫做iPad啊? 还不错。

18th-Aug-2010: 新的3.2.2出来了,暂时不能越狱,大家注意如果你越狱了,iTune叫你升级新版注意点“否”,在iTunes的功能设置选项中有禁止自动更新的选项,注意调整。

10th-Aug-2010: 这年头的电子相框还能“越狱”,昨晚上越狱成功,中途出现白苹果,不过现已修复。还有这个相框是基于Unix操作系统的,怪不得还挺贵 lolz

越狱后装了IPA补丁,很可能会白苹果,不过可以重新刷回来,
步骤如下: 1。进入刷机模式:按HOME+电源 10秒,然后放开电源继续按HOME,直到ITUNES连接界面出现
2。打开ITUNES会有显示一个IPAD需要恢复。
3。按提示确认恢复。
4。下载恢复固件后,自己手动关机
5。把ITUNES的帐号换成美国帐号,不然下面就进不去恢复的服务器。
6。再重复1~3,之后会出现连接服务器,连上后恢复,成功。

一般下载是30分钟(400M)恢复是15分钟。
以上是昨天恢复出厂设置的经过,请大家参考。

1,下载iPad 3.2固件;http:/ /appldnld.apple.com.edgesuite.net/content.info.apple.com/iPad/061-7987.20100403.mjiTr/iPad1,1_3.2_7B367_Restore.ipsw 文件大小:456.8mb
2,将开机就只能显示一个大白苹果的IPAD用数据线链接到安装有iTunes的电脑,这时候的显示还是卡在一个白苹果的界面。
3,同时按住圆点+开/关机键直到IPAD黑屏,松开开/关机键大约7秒左右直到Itunes检测到连接为止即进入DFU模式,
4,此时看到iTunes会显示有一个等待恢复的ipad。
5,按住键盘shift后点击iTunes恢复按钮,会出现一个对话框,此时请选择之前下载的固件文件进行恢复。
6,恢复进程约5分钟。耐心等待。。。您心爱的ipad马上就要回到您身边了。

9th-Aug-2010: 买了个多功能电子相框,好像叫做iPad啊? 还不错。

  • Share/Bookmark
Posted in 科技小东东 [Tech Gadget] | Tagged , | Leave a comment