一起去看海

2010/11/13

IETester有官网了

Filed under: Web开发 — Tags: — admin @ 10:24

最近做的网站快上线了,要做浏览器的兼容性测试,于是想起了很久以前用的IETester。网上找了一下,IETester居然开了个官网,而且IETester的更新也比较勤快了。记得以前用的时候总是动不动就崩溃,很纠结~~现在最新的0.46版已经比较稳定了,用着感觉很不错。

做前台开发的童鞋可以去看看:http://www.ietester.org/

2010/05/21

struts2中使用jsp:forward命令

Filed under: Web开发 — Tags: — admin @ 20:47

工程中用到了struts2,index.jsp中使用jsp:forward命令跳转来执行action,web.xml中需要做如下配置:

[xml]<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>[/xml]

不明白为什么要这样配置,有时间好好研究一下。如果觉得配置web.xml很麻烦,不如使用jstl的redirect标签来跳转,可以达到一样的效果。

[xml]<c:redirect url="/login.action"></c:redirect>[/xml]

2010/03/28

IE也能用Firebug

Filed under: Web开发 — Tags: — admin @ 16:42

Firebug 是火狐的一个插件,如果你想在IE、Opera和Safari上也使用Firebug调试网页,解决办法就是Firebug Lite。Firebug Lite是一个用JavaScript写的工具,直接在你的页面中导入Firebug Lite就可以使用Firebug插件的功能,而且支持IE、Opera和Safari。

原文:

Firebug is an extension for Firefox, but what happens when you need to test your pages in Internet Explorer, Opera, and Safari?

The solution is Firebug Lite, a JavaScript file you can insert into your pages to simulate some Firebug features in browsers that are not named “Firefox”.

Firebug Lite creates the variable “firebug” and doesn’t affect or interfere with HTML elements that aren’t created by itself.

Screenshots:

Latest Version: 1.2.1 (2008-09 CHANGELOG)

Installing Firebug Lite 1.2

Insert this line of code into any page that you want to contain Firebug lite:

    <script type='text/javascript'
        src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>

Firebug Lite as bookmarklet

Drag the following link to your bookmark toolbar and use Firebug Lite on any page:

Firebug Lite

Configuring Firebug Lite

Height of the firebug lite form is resizeable in latest version;

  <script type="text/javascript">
  firebug.env.height = 500;
  </script>

Also, developers can use their own css file;

  <script type="text/javascript">

  firebug.env.css = "/myown/firebug.css"
  </script>

Using Firebug Lite Offline

Download the source

Import firebug-lite-compressed.js or firebug-lite.js into your site’s directory. Find “firebug-lite.css” URL on the javascript file which you imported and replace this with offline address of firebug-lite.css file.

    <script language="javascript" type="text/javascript"
        src="/path/to/firebug/firebug-lite.js"></script>

Commands

Now FBLite supports all basic commands of Firebug.

firebug.watchXHR: Use this function to watch the status of XmlHttpRequest objects.

    var req = new XmlHttpRequest;
    firebug.watchXHR(req);

firebug.inspect: Now elements can be inspected in javascript code:

 firebug.inspect(document.body.firstChild);

On some browsers, the console object is already declared. If you observe errors in Safari, for instance, use the console commands in this fashion:

    firebug.d.console.cmd.log("test");
    firebug.d.console.cmd.dir([ "test" ]);

Notes

On some browsers, the console object is already declared. If you observe errors in Safari, for instance, use the console commands in this fashion:

    firebug.d.console.cmd.log("test");
    firebug.d.console.cmd.dir([ "test" ]);

Firebug Lite creates the variables “firebug” and doesn’t affect or interfere HTML elements that aren’t create by itself.

网站:http://getfirebug.com/firebuglite

2009/11/29

两个实用的Eclipse小技巧

Filed under: Web开发 — Tags: — admin @ 14:26

JAVA开发经常用到Eclipse,确实能极大的提高效率,特别是熟悉了Eclipse的快捷键操作之后。

Eclipse有很多快捷键,这里就不讲了,网上一搜就很多。那天徐可告诉我两个用提示快捷键的小技巧,觉得很实用,分享一下。

1. 写main函数。JAVA的main确实是够长,记得刚开始学JAVA第一次看到main的时候就有点晕,呵呵。用Eclipse的提示可以很快写好。方法:输入“main”,按提示快捷键(默认是ctrl+空格,不过和输入法冲突,我改成了ctrl+shift+z),选“main – main method” 就可以了。如下图:

Eclipse写main函数

2. 写System.out.println();。JAVA里面还有一个很常用但是又很长的语句就是System.out.println();,其实在Eclipse里面也可以快速输入。方法:输入“syso”,提示,Eclipse自动生成System.out.println();,如下图:

Eclipse小技巧

输入“syso”

Eclipse小技巧按下提示快捷键

2009/10/12

wordpress汉化乱码问题

Filed under: Web开发 — Tags: — admin @ 15:20

在为WordPress汉化时中文在网页浏览时全是乱码,网上搜了一下,答案很好找,只需要将WordPress的源文件另存为utf-8格式就没问题了。还有一点要注意的就是在用notepad++转换格式的时候要选utf-8无DOM格式,不然仍然会有问题。记录备忘。

2009/10/11

wordpress内网与外网同时访问的问题

Filed under: Web开发 — Tags: — admin @ 15:55

在wordpress中的常规设置中有两个关于blog地址的参数:WordPress 安装地址和博客地址。今天在团队的服务器上安装wordpress是就遇到了这两个地址的设置问题。在局域网的服务器安装了wp,这时两个地址都会自动是http://192.168.0.1/wordpress。从内网访问网站没有问题,但是从外网访问的时候就只有文字,样式和图片都没有。查看源代码,全是http://192.168.0.1/wordpress开头,难怪外网访问不了。将那两个地址改成外网的话内网又出同样的问题,真是鱼与熊掌不可兼得。

网上找了一下,关于这个问题的文章很少,而且都没有解决办法,看来不是很多人在内网的服务器上装wp。有篇文章的建议是分别搭建两个WP的环境,一个专用于内网或本机,另一个专用于外网的访问。这不是好的解决办法。

打算直接去改代码,让wp根据IP来源返回不同的博客地址。但刚玩起php,找不到代码在何处。

突然想起来平时写html代码都是以”/image”之类的开头的,并不需要加”http://…”,于是将常规设置中的两个地址都设成了”/wordpress”,果然内网及外网都可以顺利访问了。

还有一点要注意,常规设置中两个地址中的任何一个都不能留空,否则wp又要重装了。

Powered by WordPress