- Is the template engine in that framework support the template re-use?
- How about the database access layer? Is there more flexible SQL script inline supporting and has many popular database server can be connected?
- Is there any weird or some kind of unreadable code special?
- Does it support Apache integrated?
Monday, April 02, 2007
How to choose a web framework for python?
I am comparing the web framework in python. It's a little bit complex.
mssql and python on *nix
I can not find a good implement for the connection to the MSSQL on *nix.
unixODBC and iODBC and pymssql are not working correctly. And the pymssql can not support the query parameters with "?" or named parameters. It's not safe for the internet usage.
unixODBC and iODBC and pymssql are not working correctly. And the pymssql can not support the query parameters with "?" or named parameters. It's not safe for the internet usage.
Sunday, March 25, 2007
HTTP_X_FORWARDED_FOR the real variable name in the http header
The HTTP_X_FORWARDED_FOR http header name is 'X-Forwarded-For', so we should use
<%=request.getHeader("X-Forwarded-For")%> to get the real i want.
<%=request.getHeader("X-Forwarded-For")%> to get the real i want.
Saturday, March 17, 2007
Python or Ruby
Everything is about the web development for the rapid speed.
So the FastCGI is revived by the Ruby Rails. I still prefer the Python and the plenty of function library. I tried the django and TurboGear, but the TurboGear 1.0.1 can not work with the Python 2.5 now. The django can work with the new version.
So the FastCGI is revived by the Ruby Rails. I still prefer the Python and the plenty of function library. I tried the django and TurboGear, but the TurboGear 1.0.1 can not work with the Python 2.5 now. The django can work with the new version.
Friday, February 23, 2007
When Spring talk about configuration file
It's so funny that the Spring framework talk about how to reduce the configuration file's quantity. ;-/
Thursday, January 11, 2007
The HttpSessionBindingEvent
The listener of HttpSessionBindingEvent used for collecting the site user session event. When i wish to count the users online of a web application.
The interface HttpSessionAttributeListener and attributeReplaced method is always called and then i can event.getSession() is return the current session object. So, i can getAttribute to get the current value, and the event.getValue() is the old attribute value returned.
The interface HttpSessionAttributeListener and attributeReplaced method is always called and then i can event.getSession() is return the current session object. So, i can getAttribute to get the current value, and the event.getValue() is the old attribute value returned.
Tuesday, December 12, 2006
IE 7.0 dll conflict result the IE does not start
Oh, i have installed IE7 on my home PC, Windows XP SP2 simplified Chinese version, unfortunately, the IE7 can NOT be started! I clicked the icon and nothing happened!
I followed the KB926449, but nothing listed on that KB works.
I found if the psapi.dll in the Internet Explorer directory will make my IE 7 start failed without any messages!
My psapi.dll in the Internet Explorer directory is 14848 bytes, 4.0.1371.1, Process Status Helper. I guess this dll file is too old and I found the same psapi.dll in system32 directory and the version is 5.1.2600.2180. I guess this is a dll conflict but the IE 7 installer does not detect.
I remove this old psapi.dll IE 7 starts fine.
I followed the KB926449, but nothing listed on that KB works.
I found if the psapi.dll in the Internet Explorer directory will make my IE 7 start failed without any messages!
My psapi.dll in the Internet Explorer directory is 14848 bytes, 4.0.1371.1, Process Status Helper. I guess this dll file is too old and I found the same psapi.dll in system32 directory and the version is 5.1.2600.2180. I guess this is a dll conflict but the IE 7 installer does not detect.
I remove this old psapi.dll IE 7 starts fine.
Sunday, December 10, 2006
Friday, December 08, 2006
I found the dojo document
I found it, http://manual.dojotoolkit.org/WikiHome/DojoDotBook
The wiki is good thing ;-)
The wiki is good thing ;-)
Thursday, December 07, 2006
the dojo
dojo.require("dojo.event.*");
dojo.event.connect(dojo, "loaded", "init");
function init() {
dojo.event.connect(["userName", "nickyName", "email1", "btnRegister" ], "onfocus", infocus);
dojo.event.connect(["userName", "nickyName", "email1", "btnRegister" ], "onblur", outfocus);
dojo.byId("userName").focus();
dojo.byId("userName_tips").className = "tipSpan";
}
function infocus(evt) {
evt = dojo.event.browser.fixEvent(evt);
dojo.byId(evt.target.id + "_tips").className = "tipSpan";
}
function outfocus(evt) {
evt = dojo.event.browser.fixEvent(evt);
dojo.byId(evt.target.id + "_tips").className = "tipSpan1";
}
Sunday, December 03, 2006
play with the image
I had made the verification code image with random string draw into the image. The image had some disturbing lines and must be used with session together.
Friday, December 01, 2006
The roadyo.com
I should make 2 points for this project.
One is the verfication code image generated from the server side. I can use the java awt code to do this, and I need some test. I have referred some .net C# code example :)
Two is the uploaded photo should be resized and fit a fixed size for web showing. Need more test.
One is the verfication code image generated from the server side. I can use the java awt code to do this, and I need some test. I have referred some .net C# code example :)
Two is the uploaded photo should be resized and fit a fixed size for web showing. Need more test.
Thursday, November 30, 2006
To find the "feeling" about web 2.0
I am looking for the special feeling for the web 2.0. I compared the flickr from yahoo and picasaweb.google.com. The picasaweb should use the ActiveX and this is not comfort for me, but, i found the basic uploader that is a normal web file uploader page. Actually the flickr is more complex for the images dealing, like resize and more functions.
java image shrink code example
import java.io.File;
import java.awt.image.BufferedImage;
import java.awt.Image;
import java.awt.image.AffineTransformOp;
import javax.imageio.ImageIO;
import java.awt.geom.AffineTransform;
public class UploadImg{
/*** @param fromdir 图片的原始目录
* @param todir 处理后的图片存放目录
* @param imgfile 原始图片
* @param sysimgfile 处理后的图片文件名前缀
**/
public boolean CreateThumbnail() throws Exception{
//ext是图片的格式 gif JPG 或png
String ext="";
double Ratio=0.0;
File F = new File(fromdir,imgfile);
if (!F.isFile())
throw new Exception(F+" is not image file error in CreateThumbnail!");
//首先判断上传的图片是gif还是JPG ImageIO只能将gif转换为png
if (isJpg(imgfile))
{ext="jpg";}
else
{ext="png"; }
File ThF = new File(todir,sysimgfile+"."+ext);
BufferedImage Bi = ImageIO.read(F);
//假设图片宽 高 最大为120 120
Image Itemp = Bi.getScaledInstance (120,120,Bi.SCALE_SMOOTH);
if ((Bi.getHeight()>120) (Bi.getWidth()>120)){
if (Bi.getHeight()>Bi.getWidth())
Ratio = 120.0/Bi.getHeight();
else
Ratio = 120.0/Bi.getWidth();
}
AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(Ratio, Ratio), null);
Itemp = op.filter(Bi, null);
try {
ImageIO.write((BufferedImage)Itemp, ext, ThF);
}catch (Exception ex) {
throw new Exception(" ImageIo.write error in CreatThum.: "+ex.getMessage());
}
return (true);
}
}
该程序使用了Java 的AWT,在linux下运行可能报错,有两种解决方式:
(1) jdk1.4以前版本:需要安装 XFree86和XFree86-Xvfb ,加入 export DISPLAY=hostdomain:0.0
(2) jdk 1.4以后版本,在执行命令java 加入参数-Djava.awt.headless=true,表示这是一个没有键盘 没有显示器的无头服务器,意称机房托管的服务器。
关于服务器端图形支持,有很多开源包:PJA VNC 或ACME Laboratories 。
================================================
实际上以上的代码在工作中会抛出异常,实际还是使用了drawImage方法
Subscribe to:
Posts (Atom)