2009年11月5日

          世界十大最糟糕網站設計(中文翻譯)

               摘要: 你曾經打開過真正設計糟糕的網站,糟到你都覺得是自己手太賤么?我就非常“幸運”能看到一坨這種震撼人心的網站。下面這些是這些糟糕網站中最糟糕的。
          如果你是一個網頁設計師,趕快行動起來吧,趕緊給他們發(fā)郵件提供服務。
          如果你的網站不幸在這個名單中,也別覺得窩心,不過您最好還是考慮考慮重新設計一下網站比較好。。。  閱讀全文

          posted @ 2009-11-21 03:04 甜菜侯爵 閱讀(2218) | 評論 (3)編輯 收藏

          世界十大最糟糕網頁設計

          鏈接如下:

          先放這里,現在沒有時間,等有空了把原文翻譯了貼過來。
          寫得還是蠻有意思的。http://www.blogstorm.co.uk/blog/top-10-worst-websites/

          posted @ 2009-11-17 01:18 甜菜侯爵 閱讀(267) | 評論 (0)編輯 收藏

          用正則表達式取出去除html頁面中的tags

          這個就比較簡單了,正則式是 “<[^>]*>”,其表意為“以<開頭的,后續(xù)任意個不為>的字符,并以>結尾的字符串”
          這樣做的目的是為了獲得所謂plain的文本,方便下一步的處理。

          代碼如下:

          1    /**
          2     * Remove all "<>" tags in the text
          3     * @param tagText
          4     * @return the clean text without tags
          5     */

          6    public String removeTags( String tagText )
          7    {
          8        return tagText.replaceAll("<[^>]*>""");
          9    }

          posted @ 2009-11-06 22:19 甜菜侯爵 閱讀(201) | 評論 (0)編輯 收藏

          用正則表達式提取網頁中的鏈接

          個人感覺效率肯定還能進一步提高。。。。
          不過實在是對正則不是太熟悉,只好暫時這樣了。

          代碼如下:

           1    /** The regex for search link with the tag "a" */
           2    private final String A_REGEX = "<a.*?/a>";
           3    /** The regex for search url with the tag "href" */
           4    private final String HREF_REGEX = "href=\".*?\"";
           5    /** The pattern for linke with the tag "a" */
           6    private final Pattern A_PATTERN = Pattern.compile(A_REGEX);
           7    /** The pattern for url with the tag "href" */
           8    private final Pattern HREF_PATTERN = Pattern.compile(HREF_REGEX);
           9    /**
          10     * Get url address from the url and the content of the url
          11     * @param url the url need to be get links
          12     * @param content the content of the given url
          13     * @return a list with the url address of the links
          14     */

          15    public List<String> getLinkList( URL url, String content )
          16    {
          17        List<String> linkList = new LinkedList<String>();
          18        final Matcher a_matcher = A_PATTERN.matcher(content);
          19        while (a_matcher.find()) 
          20        {
          21            //JUST FOR TEST!
          22//            System.out.println(a_matcher.group());
          23            //get url address
          24            final Matcher myurl = HREF_PATTERN.matcher(a_matcher.group());
          25            while (myurl.find())
          26            {
          27                String urlAddress = myurl.group().replaceAll("href=|>|\"|\"""");
          28                if( urlAddress.startsWith("http") )
          29                {
          30                    linkList.add(urlAddress);
          31                }

          32                else if( urlAddress.startsWith("/"|| urlAddress.startsWith("\\") )
          33                {
          34                    linkList.add(url.getPath()+urlAddress);
          35                }

          36                else
          37                {
          38                    String fullUrl = url.toString();
          39                    //the length of the url without the current page
          40                    int lastSlash = fullUrl.lastIndexOf("/"+ 1;
          41                    linkList.add(fullUrl.substring(0,lastSlash) + urlAddress);
          42                }

          43            }

          44        }

          45        return linkList;
          46    }

          posted @ 2009-11-05 03:00 甜菜侯爵 閱讀(455) | 評論 (0)編輯 收藏

          <2009年11月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 泰兴市| 湖北省| 遵义市| 土默特左旗| 勃利县| 南江县| 南开区| 肇州县| 乃东县| 息烽县| 临城县| 乡宁县| 扬中市| 全南县| 盐城市| 无极县| 特克斯县| 宁强县| 江川县| 随州市| 丹东市| 沁阳市| 珲春市| 奉贤区| 江川县| 七台河市| 喀喇| 增城市| 元江| 湖南省| 怀宁县| 和静县| 永州市| 中西区| 隆林| 迭部县| 巴马| 高陵县| 叙永县| 酒泉市| 吉木乃县|