struts就相当于业务层,一般是用来控制跳转,hibernate是提供数据的,也就是数据持久层,与数据库打交道的那一层,spring是对hibernate的更深次包装,他是一个大型的平台既包含struts也包含hibernate更包其他的框架,
1 Struts

虽然不打算过多介绍Struts的原理,但是大概介绍一下还是有必要的。Struts本身就是 MVC 在这里负责将用户数据传人业务层,以及 将业务层处理的结果返回给用户,此系统属于较简单WEB应用,采用了OpenSessionInView模式处理LazyLoad问题,这样我们可以在用户视图中使用 get,set方法来方便地获取关联对象。为了处理庞大的Action和ActionForm问题,在此我门准备使用DynaActionForm (DynaValidatorForm)和DispatchAction以及 动态验证框架 来解决。及使用Tile来解决框架问题 。使用自定义标签处理分页和身份验证问题。

2 Spring

Spring Framework最得以出名的是与Hibernate的无缝链接,虽然Spring 对Hibernate提供了90%以上的封装,使我们不必去关心Session 的建立,关闭,以及事务使我们能够专心的关注业务逻辑。但是一些特殊情况如 有时需要Query以及Criteria 对象,分页等,Spring不能给我们提供支持,总不能每次都在你的DAO上写个HibernateCallBackup()吧?Spring的作用不是把Hibernate再封装一层,而是让你接触不到Hibernate的API,而是帮助你管理好Session和Transaction。

在这里解决方法是:首先 写一个IBase 的接口,和一个BaseDao的实现。在实现中仿照HibernateTemplate,将其功能一一实现,同时考虑到Spring 未能支持的地方,我们不得已只好自己来管理Session,因此加入public Session openSession(),public Query getQuery(String sql),public Criteria getCriteria(Class clazz),以及分页的方法。 然后为每一个Entity 都建立继承于以上类的IEntity,与EntityDao。这里可以根据需求对Entity加入特殊的方法实现,如 在 StudentsDao.java 中加入类似用户身份验证等。以上就是数据访问层。接下来在Service层中通过对dao的引用完成业务逻辑方法。在下面的例子中我们分别为学生模块,教师模块,管理员模块构建Service层,StudentsServiceImpl,TeachersServiceImpl,AdminServiceImpl。



3 Hibernate

有了Spring的封装,我们要对Hibernate做的就是正确实现对象关系的映射。由于此处处于系统的最底层,准确无误的实现对象之间的关联关系映射将起着至关重要的作用。

总之,理解了Struts,Spring,Hibernate地原理以及之间的关系之后,剩下的工作就如同在以Spring为核心的Struts为表现的框架中堆积木。
最后:
框架只是幫助你快速開發的。好的軟件公司更注重你在j2se、數據結構、算法設計、設計模式、操作系統、計算機組成原理、計算機網絡等方面的素質。如果以上這些方面的基礎都穩固了,你就已經比那些只會框架的“軟件民工”值錢了。那個時候,別說學框架了,自己已經能開始寫框架了。

Add Time:(2014-09-15)
兄弟,struct hibernate spring 这三层你们都用上了?
只用 spring

http://www.bsdlover.cn/html/79/n-3779.html

点击在新窗口中浏览此图片
每次都要去chmod -R * ;chown -R nobody.nogroup * 很是麻烦,写一脚本解决,到时候直接调用一下secureCRT的脚本--》运行--》选择脚本即可!
代码如下:

Sub Main
  crt.Screen.Synchronous = True
  crt.Screen.Send "chmod -R 755 *" & vbcr
  crt.Screen.Send "chown -R nobody.nogroup *" & vbcr
  crt.Screen.Send " "
  crt.Screen.Synchronous = False
End Sub


【前言】
SecureCRT是一款非常流行和受欢迎的远程登录和终端仿真软件,支持Telnet,SSH等。
它还可以支持VBScript和JScript,通过Script的支持,SecureCRT能够自动完成我们设定
好的各种任务。阅读全文
dio_open()和dio_stat()函数都不能使用,
提示Fatal error: Call to undefined function dio_stat()这个错误!!!
请各位大侠指教。。。。

注: 本扩展已被移动到 PECL 库中且自以下版本起不再被绑定到 PHP 中:5.1.0.

This extension is only available on Windows Platforms as of PHP 5.0.0
本扩展仅在Windows平台PHP5.0.0时有效

需求
要编译本扩展模块无需外部库文件。

注意一下你的版本!

Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) extension folders as well as the separate PECL DLL download (PHP 5). Be sure to appropriately set the extension_dir directive.
http://pecl.php.net/
http://php.morva.net/manual/zh/install.pecl.windows.php
先去下載再安裝

php.ini中做了如此配置extension=php_dio.dll
并且php_dio.dll这个库文件也在ext目录下,为什么还是不能使用那些函数?????
问题已经解决,需要php和pecl的版本一致。。。



文章来源:http://tw2.php.net/manual/en/ref.dio.php

Direct IO Functions
Table of Contents

    * dio_close — Closes the file descriptor given by fd
    * dio_fcntl — Performs a c library fcntl on fd
    * dio_open — Opens a file (creating it if necessary) at a lower level than the C library input/ouput stream functions allow.
    * dio_read — Reads bytes from a file descriptor
    * dio_seek — Seeks to pos on fd from whence
    * dio_stat — Gets stat information about the file descriptor fd
    * dio_tcsetattr — Sets terminal attributes and baud rate for a serial port
    * dio_truncate — Truncates file descriptor fd to offset bytes
    * dio_write — Writes data to fd with optional truncation at length


(sorry for my English)
http://pecl.php.net/get/dio seems broken at the moment
to get dio extension follow these steps (steps 1.a and 1.b are equivalent):

1.a  get source files using cvs (you may need cvsnt or similar):

     (in shell run)
     cvs -d :pserver:cvsread@cvs.php.net:/repository login
     Password: phpfi
     cvs -d :pserver:cvsread@cvs.php.net:/repository co pecl/dio
     cd pecl/dio/

-- or --

1.b  manually download all files at http://cvs.php.net/cvs.php/pecl/dio clicking on the revision number link
     move to the destination directory

2.   (in shell run)
     phpize (if the system is missing the 'phpize' command see http://php.mirrors.ilisys.com.au/manual/en/install.pecl.phpize.php)
     ./configure --enable-dio --with-php-config=/path/to/php-config (usually /usr/local/php/bin/php-config or /usr/bin/php-config)

     make
     make install (you need root/admin privilegies)
php dot 5 dot gavinostlund at spamgourmet dot com
08-Dec-2007 12:36
You can manually build the dio extension for your version of PHP, or install an older version of PHP that still bundled dio.  It's not that hard to build it yourself, just a bit of a process, and it helps if you're on linux, and have a build environment... which I would assume you have if you are doing some kind of development that requires direct device I/O...  Just get the dio source from the cvs repo, compile it, and then add the extension to your php configuration...
tom at bitworks dot de
03-Nov-2007 01:41
to use mandatory locking on a linux system, the filesystem has to be well prepared.

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>               <dump>  <pass>
/dev/hda1       /               ext3    errors=remount-ro,mand  0       1
/dev/hda2       none            swap    sw                      0       0
proc            /proc           proc    defaults                0       0
/dev/fd0        /floppy         auto    user,noauto             0       0
/dev/cdrom      /cdrom          iso9660 ro,user,noauto          0       0

For example here the ext3 partition has been prepared for mandatory locking. Otherwise no dio_function will work on the system.
richard d_0t cubek a_t example D0_t com
25-Sep-2007 08:13
IMPORTANT:

--enable-dio is NOT recognized as an option. After reporting a bug, i got following answer:

It is not bundled anymore. See http://pecl.php.net/dio to fetch the CVS version (being unmaintained, there is no release in pecl). Not a bug > bogus.

[b]如何编译dio_open 的so文件:[/b]
http://php.mirrors.ilisys.com.au/manual/en/install.pecl.phpize.php
摘录部分:
Compiling shared PECL extensions with phpize

Sometimes, using the pecl installer is not an option. This could be because you're behind a firewall, or it could be because the extension you want to install is not available as a PECL compatible package, such as unreleased extensions from SVN. If you need to build such an extension, you can use the lower-level build tools to perform the build manually.

The phpize command is used to prepare the build environment for a PHP extension. In the following sample, the sources for an extension are in a directory named extname:

$ cd extname
$ phpize
$ ./configure
$ make
# make install

A successful install will have created extname.so and put it into the PHP extensions directory. You'll need to and adjust php.ini and add an extension=extname.so line before you can use the extension.

If the system is missing the phpize command, and precompiled packages (like RPM's) are used, be sure to also install the appropriate devel version of the PHP package as they often include the phpize command along with the appropriate header files to build PHP and its extensions.

Execute phpize --helpto display additional usage information.


http://cvs.php.net/viewvc.cgi/pecl/dio/
SQL Injection with MySQL,安全天使的一篇文章,写得很有深度,值得阅读和借鉴:
http://www.4ngel.net/article/36.htm


①SELECT * FROM article WHERE articleid='$id'
②SELECT * FROM article WHERE articleid=$id

  两种写法在各种程序中都很普遍,但安全性是不同的,第一句由于把变量$id放在一对单引号中,这样使得我们所提交的变量都变成了字符串,即使包含了正确的SQL语句,也不会正常执行,而第二句不同,由于没有把变量放进单引号中,那我们所提交的一切,只要包含空格,那空格后的变量都会作为SQL语句执行,我们针对两个句子分别提交两个成功注入的畸形语句,来看看不同之处。

① 指定变量$id为:
1' and 1=2 union select * from user where userid=1/*
此时整个SQL语句变为:
SELECT * FROM article WHERE articleid='1' and 1=2 union select * from user where userid=1/*'

②指定变量$id为:
1 and 1=2 union select * from user where userid=1
此时整个SQL语句变为:
SELECT * FROM article WHERE articleid=1 and 1=2 union select * from user where userid=1


  看出来了吗?由于第一句有单引号,我们必须先闭合前面的单引号,这样才能使后面的语句作为SQL执行,并要注释掉后面原SQL语句中的后面的单引号,这样才可以成功注入,如果php.ini中magic_quotes_gpc设置为on或者变量前使用了addslashes()函数,我们的攻击就会化为乌有,但第二句没有用引号包含变量,那我们也不用考虑去闭合、注释,直接提交就OK了。
  大家看到一些文章给出的语句中没有包含单引号例如pinkeyes的《php注入实例》中给出的那句SQL语句,是没有包含引号的,大家不要认为真的可以不用引号注入,仔细看看PHPBB的代码,就可以发现,那个$forum_id所在的SQL语句是这样写的:

$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";


  由于没有用单引号包含变量,才给pinkeyes这个家伙有机可乘,所以大家在写PHP程序的时候,记得用单引号把变量包含起来。当然,必要的安全措施是必不可少的。
case语句里面有return了,break还起作用吗?比如:switch(ID){case1:return1;break;//还能执行到break吗?


    switch($gametype)
    {
      case 1:
      {        
        


        if ($gametimes[0]['FSum'] >= 36)
        {
          return "&status=4";
        }
                break;
      }      
      case 2:
      {

        if ($gametimes[0]['FSum'] >= 20)
        {
          return "&status=4";
        }
                break;
      }
      case 3:
      {

        
        if ($gametimes[0]['FSum'] >= 20)
        {
          return "&status=4";
        }
                break;
      }
      case 4:
      {        

        
        if ($gametimes[0]['FSum'] >= 20)
        {
          return "&status=4";
        }
                break;
      }
      case 5:
      {

        
        if ($gametimes[0]['FSum'] >= 20)
        {
          return "&status=4";
        }
                break;
      }
    }
  }


如果仅仅是用return 没法堵住,还得要break来帮忙啊
ALTER TABLE Tbl_ScoreDetail_oneday  ADD FSum INT;
今天看到《程序员》杂志上的《软件中国2009年大势图》,有一点思考,写下来。 阅读全文
我是学软件的 我很喜欢Linux 但是 我发现在Linux 下的程序员不是很多!!
而大部分 都是网管用Linux 我想知道Linux 下Qt编程有没有前途!!!!

我是RHCE和高程(好像不值一提),发表一些个人看法:

1. 个人做程序员7年,平台涉及UNIX, LINUX, WINDOWS,但都没用过QT编程

2. 我对QT的理解是跨平台的窗口技术,这个技术应该是有可替代性,换句话讲是可替代的,如:SWING

3. 选择少人学的技术,意味着难上手、难提高、难找相应的工作;学LINUX不比学VC好找工作

个人建议学习一些平台无关的基础知识(数据结构、UML、设计模式等)后,用VC或ECLIPSE做几个具体的小项目,这样找工作的时候可能比会一点QT更有竞争力。

一家之言,供参考。



越是没有人学的就越走俏,因为没人学就表示上手难。学linux比学VC好找工作。一些大型服务器后台程序都是靠linux编程。而QT更是linux下C++编程的一般环境。好好学,没错的:)


我学过QT,也用过QT.这是个好东西.如果你对Linux感兴趣,很建议你去学习QT,不为别的,只因为QT确实有许多引人入胜的东西.至于QT是否会被替代的讨论实际上没有意义,因为这就像讨论.net是否会一统天下一样根本说不清楚.QT是否会被用上取决于你是否用它,而不是他是否有用,就像许多人也很少用纯C,但它至今依然屹立不倒.
再有,QT是纯正的C++,学起来要比VC容易,跨平台与通用性也高,而且也不会花泥多少时间.
所以是否学习与使用QT纯粹看你的兴趣.

老实说,我觉得没钱途,当做爱好还可以,但如果想靠这个吃饭,我觉得在国内还有很长的路要走

基本没有前途
学习QT貌似不如学习gtk编程
虽然QT目前用的多
但是gnome的前景比qt好多很


QT是C++的优秀扩展,不错,有前途滴,不过她不是开源软件,这一点不太好,万一哪天破产了,呵呵,就不太好了



晚上看了一些关于消息队列和共享内存方面的资料。这部分内容昨天看arm-linux视频教程第17讲的时候接触过了,但视频看完后自己虽有了一些印象,却不是太懂。于是又在网络上找了一些文章来进一步学习,并编写了012号与013号程序,分别是关于消息队列和共享内存的,在机器上也已经调试过了,现在把代码贴在下面:阅读全文
使用jQuery1.3.2的$.post()函数发送一个json格式的请求,返回数据也是json格式。程序在ie和ff中运行一切正常。

但是在ff中使用httpfox插件检查:大部分情况下返回结果为 result=200, type=application/json
偶尔会出现result = Aborted, type=application/json (NS_BINDING_ABORTED)

不影响程序的执行结果。

google也找不到NS_BINDING_ABORTED的具体解释。

谁知道该如何避免这个错误呢?

----------------------------------------------------
我们这儿是用的jquery的dialogue弹出一个页面,在firefox中抓(httpfox),发现出现三个NS_BINDING_ABORTED.
在实际开发中,有时会遇到PHP和C语言结构的互相转化问题,这时候PHP的函数pack和unpack就能帮上大忙了.
pack()将数据打包成二进制串
unpack()从字串中的二进制串转化成指定的格式
Code Description
a NUL-padded string
A SPACE-padded string
h Hex string, low nibble first阅读全文
默认div的属性值都是static,静态。就不用多说了。最关键的是
relative(相对)以及absolute(绝对)。
往往我们如果是COPY别人的代码,会把absolute属性与left、top配合起来制作相关的“悬浮层”效果。然而有时候我们需要针对某一个容器的悬浮效果,而不是针对窗口的。这时候通过高度、宽度的计算不但麻烦,而且几乎无法完美实现效果。我一开始也无能为力,后来发现只要把其上一级的样式属性 position设置为relative就可以了。
也就是说,position的属性值的效果,直接受其容器样式中position属性值影响。
例如如下A-B的嵌套结构




当A的position为relative时,B的position为absolute才有效。这时候left:0、top:0就不再针对窗口文档,而是针对id为A的这个div了。
这样在开发一些基于B/S应用程序的时候,就能很方便的添加一些UI元素,例如某一个活动层的关闭按钮等。


备注:
position:absolute这个是绝对定位;
是相对于浏览器的定位。
比如:position:absolute;left:20px;top:80px; 这个容器始终位于距离浏览器左20px,距离浏览器上80px的这个位置。

position:relative是相对定位,是相对于前面的容器定位的。这个时候不能用top left在定位。应该用margin。

比如:


当1固定了位置。1的样式float:left;width:100px; height:800px;
2的样式为float:left; position:relative;margin-left:20px;width:50px;
2的位置在1的右边,距离120px
   1.  if (typeof window.pageYOffset != ’undefined’) {
   2. bodyTop = window.pageYOffset;
   3. } else if (typeof document.compatMode != ’undefined’ && document.compatMode != ’BackCompat’) {
   4. bodyTop = document.documentElement.scrollTop;
   5. }
   6. else if (typeof document.body != ’undefined’) {
   7. bodyTop = document.body.scrollTop;
   8. }

# if (typeof window.pageYOffset != ‘undefined’) {
#                 bodyTop = window.pageYOffset;
#             } else if (typeof document.compatMode != ‘undefined’ && document.compatMode != ‘BackCompat’) {
#                 bodyTop = document.documentElement.scrollTop;
#             }
#             else if (typeof document.body != ‘undefined’) {
#                 bodyTop = document.body.scrollTop;
#             }

其实这一大串代码在jQuery中有一行代码可以代替,那就是
var bodyTop = $(document).scrollTop();
经测试,如果是写成$(window).scrollTop()的话则在IE系列下是没有值的,万恶的jQuery API竟然没有scrollTop().

bodyTop = document.documentElement.scrollTop + document.body.scrollTop;

就可以了。

因为始终有一个为 0 ; 呵呵。

DIV学习网站

WEB2.0 jackxiang 2009-11-25 22:52
http://blogger.org.cn/blog/more.asp?name=yach&id=20128
http://blog.sina.com.cn/s/blog_61814cd40100e85j.html
控制面板\时钟、语言和区域\区域和语言选项\键盘和语言\更改键盘\语言栏\悬浮于桌面上
分页: 197/272 第一页 上页 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 下页 最后页 [ 显示模式: 摘要 | 列表 ]