<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Tao

    Tao obeys its own inherent Nature

    2007年8月30日

    搬到了: http://theantway.com
    posted @ 2011-11-08 13:43 wade 閱讀(208) | 評論 (0)編輯 收藏
    Ubuntu 11.04
    libxml2-2.7.8

    網上找了一些辦法都不能用,最后直接打開configure 文件,找到$RM "$cfgfile", 替換為 $RM -f "$cfgfile", 說白了就是出錯了也不要停,繼續執行。再運行configure, 成功
    posted @ 2011-06-02 10:15 wade 閱讀(1322) | 評論 (0)編輯 收藏

    When I try to use URLConnection to check if a url is accessible using the following code:

    try {
        URL url = new URL("http://169.254.169.254/latest");
    
        URLConnection connection = url.openConnection();
        connection.setConnectTimeout(5000);
        connection.connect();
        System.out.println("Connected successfully using url");
    } catch (IOException e) {
            e.printStackTrace();
    }
    

    I expected the behavior is: connect should be success if the host is reachable, else throw exception. It works fine without the anti-virus application, but always print “connected successfully” even the host is not reachable.

    Then I tried to use Socket to connect:

    Socket socket = new Socket();
    socket.connect(new InetSocketAddress("169.254.169.254", 80));
    if (socket.isConnected()) {
        System.out.println("Connected successfully using socket");
    } else {
        System.out.println("Connected failed using socket");
    }
    
    

    But Still got the same problem.

    The solution for it:

    Disable http check in anti-virus, for example, in ESET NOD32, the settings is Web access protection -> Http, Https -> Http scanner

    ESET_http_connection_always_success

    posted @ 2009-07-15 13:30 wade 閱讀(464) | 評論 (0)編輯 收藏

    Preview support edit images, but the menu item is disabled by default when I open an image file. I thought it was because the Preview does not support this kind of file type. Recently, when I try to find a simple image editor only for add some text, oval or rectangle, I found that the Preview support it perfectly.

    After customized the toolbar, the buttons enabled, and it’s very easy to add comments, but the menu item still disabled.

    The following is what I found about how to customize the toolbar from the Preview Help.

     

    Adding text to an image

    You can add text to an image to describe what’s in it or when the image was created.

    After you save the image, you can’t edit, move, or delete any text you added to it. If you think you’ll need to edit the text, convert the image to a PDF document, and then add notes to the PDF document. Notes added to a PDF document can be edited after they’re saved.

    To add text to an image:

    1. If the Annotate pop-up menu isn’t in the toolbar, choose View > Customize Toolbar and drag the Annotate pop-up menu to the toolbar.
    2. Choose Note from the Annotate pop-up menu in the toolbar.
    3. Drag over the area where you want the text to appear.
    4. Enter your text.

    Before you save the image, you can move, resize, edit, or delete the text. First choose Text Annotation from the Annotation pop-up menu in the toolbar. Then to edit the text, double-click it. To delete the text, click it so resize handles appear, and then press Delete.

    posted @ 2009-07-14 10:49 wade 閱讀(557) | 評論 (0)編輯 收藏
         摘要: 快速生成程序代碼, 比如Struts, Spring, Jdbc/Hibernate所有前后臺的代碼.
    支持Mysql, 以及支持Ado連接的數據庫.
    支持批量生成部分/全部模板, 保存選中的模板到Working Set
    使用Javascript作為模板腳本語言  閱讀全文
    posted @ 2008-03-05 13:28 wade 閱讀(4579) | 評論 (18)編輯 收藏
         摘要: Generate code, e.g. all files for Struts, Spring, Jdbc/Hibernate.
    Support Mysql, and database which support Ado connection
    Support generate file/project files and batch generate, and you can save you selection to a named working set in batch generate mode.
    Using Javascript as the template engine  閱讀全文
    posted @ 2008-03-04 22:48 wade 閱讀(897) | 評論 (0)編輯 收藏
    diff -r -q -X exclude.list . testing
    posted @ 2008-02-29 16:52 wade 閱讀(853) | 評論 (0)編輯 收藏
         摘要: 集成Acegi到自己的項目中, 并且將用戶信息和權限放到數據庫, 提供方法允許權限動態變化,變化后自動加載最新的權限
    增加Junit 測試, 這樣可以在改變權限后, 方便地檢查是否設置正確.
    Acegi 提供的Tag不能判斷當前用戶對某一個URL有沒有權限, 由于很多時候需要根據當前用戶的權限來控制某些功能是否顯示, 所以增加相應的Tag
    如果當前用戶沒有指定url的權限,顯示本部分內容
    如果當前用戶有指定url的權限,顯示本部分內容

      閱讀全文
    posted @ 2008-01-30 17:28 wade 閱讀(4293) | 評論 (7)編輯 收藏

    1. simple join two tables

    purpose:
    generate sql like:   

    select * from photo p
        left join artist a on p.artist_id = a.artist_id
          where a.genre = 'something' and p.genre = 'something'
    

    code:           

    if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
        $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
    }
    $criteria->add(ArtistPeer::GENRE, $genre);    
    $criteria->add(PhotoPeer::GENRE, $genre);

    2. join two tables, add AND OR between conditions
    purpose:
    generate sql like:    

    select * from photo p
        left join artist a on p.artist_id = a.artist_id
          where (a.genre = 'some' or p.genre='something')
            and a.name = 'something'

    code:   

    if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
       $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
    }
    $criteria->add(ArtistPeer::GENRE, $genre);
    $c = $criteria->getCriterion(ArtistPeer::GENRE);
    if($c != null){
       $c->addOr($criteria->getNewCriterion(PhotoPeer::GENRE, $genre));
    }
    $criteria->add(ArtistPeer::NAME, $name);

     

    Note:
    It's a good habit to check if we have joined the table already. to check this, you can use the following util class, it get all the joined tables, and check if the table exists in them.

    class CriteriaUtil{
        public static function hasJoin($c, $table_name){
            $joins = $c->getJoins();
            if($joins != null){
                foreach($joins as $join){
                    if($join->getRightTableName() == $table_name){
                        return true;
                    }
                    if($join->getLeftTableName() == $table_name){
                        return true;
                    }
                }
            }
            return false;
        }
    }
    
    posted @ 2007-12-05 17:26 wade 閱讀(533) | 評論 (0)編輯 收藏

    It maybe popup an error message to say that "QI for IEnumVARIANT failed on the unmanaged server" when open the Windows Live Writer.

    After search on google, I found the resolution is import some settings into registry.

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00020404-0000-0000-C000-000000000046}]
    @="IEnumVARIANT"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00020404-0000-0000-C000-000000000046}\NumMethods]
    @="7"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00020404-0000-0000-C000-000000000046}\ProxyStubClsid]
    @="{00020421-0000-0000-C000-000000000046}"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00020404-0000-0000-C000-000000000046}\ProxyStubClsid32]
    @="{00020421-0000-0000-C000-000000000046}"

     

    You can also download the file here, unzip and import it to your registry.

    posted @ 2007-12-05 17:08 wade 閱讀(878) | 評論 (0)編輯 收藏

    Original article: http://www.symfony-project.com/book/1_0/18-Performance

    Clearing Selective Parts of the Cache

    During application development, you have to clear the cache in various situations:

    • When you create a new class: Adding a class to an autoloading directory (one of the project's lib/ folders) is not enough to have symfony find it automatically. You must clear the autoloading configuration cache so that symfony browses again all the directories of the autoload.yml file and references the location of autoloadable classes--including the new ones.
    • When you change the configuration in production: The configuration is parsed only during the first request in production. Further requests use the cached version instead. So a change in the configuration in the production environment (or any environment where SF_DEBUG is turned off) doesn't take effect until you clear the cached version of the file.
    • When you modify a template in an environment where the template cache is enabled: The valid cached templates are always used instead of existing templates in production, so a template change is ignored until the template cache is cleared or outdated.
    • When you update an application with the sync command: This case usually covers the three previous modifications.

    The problem with clearing the whole cache is that the next request will take quite long to process, because the configuration cache needs to be regenerated. Besides, the templates that were not modified will be cleared from the cache as well, losing the benefit of previous requests.

    That means it's a good idea to clear only the cache files that really need to be regenerated. Use the options of the clear-cache task to define a subset of cache files to clear, as demonstrated in Listing 18-14.

    Listing 18-14 - Clearing Only Selective Parts of the Cache

    // Clear only the cache of the myapp application
    > symfony clear-cache myapp

    // Clear only the HTML cache of the myapp application
    > symfony clear-cache myapp template

    // Clear only the configuration cache of the myapp application
    > symfony clear-cache myapp config

    You can also remove files by hand in the cache/ directory, or clear template cache files selectively from the action with the $cacheManager->remove() method, as described inChapter 12

     

    Note:

    1. We can use $cacheManager->remove() to clear cache after we deployed a new version product.

    2. write code to generate models from database, and then call $cacheManager->remove() to clear cache.


     
    posted @ 2007-11-13 17:23 wade 閱讀(622) | 評論 (0)編輯 收藏
    Create a file backup_db.sh, and paste the following contents:
    #get the first parameter as the database name
    DATABASE=$1
    #if no database specified, then you can set the default one
    if [ -z $DATABASE ]; then
    DATABASE=default_database_name_here
    fi

    #mysql user and password to backup the database. MYSQLUSER=mysql_user MYSQLPWD=mysql_password #path to backup ARCHIVEPATH=~/backup/db_backup DATE=`date +%Y%m%d` YEAR=`date +%Y` MONTH=`date +%m` FOLDER_MONTH=$ARCHIVEPATH/$YEAR$MONTH if [ ! -d $FOLDER_MONTH ]; then
    echo "mkdir $FOLDER_MONTH" mkdir $FOLDER_MONTH fi # Backup echo "mysqldump -u$MYSQLUSER -p$MYSQLPWD $DATABASE | gzip > $FOLDER_MONTH/$DATABASE-$DATE.sql.gz" mysqldump -u$MYSQLUSER -p$MYSQLPWD $DATABASE | gzip > $FOLDER_MONTH/$DATABASE-$DATE.sql.gz

     

    and you can add the script to cron job under *nix and schedule under windows:

    *nix:

    Save the following text in file: db_backup.at

    10 * * * * ~/backup/backup_db.sh databasename

    and call

    crontab db_backup.at

    You need to change the period to run the script for your business, e.g. each day, each week etc.


     
    posted @ 2007-11-13 15:49 wade 閱讀(267) | 評論 (0)編輯 收藏
    #server-id       = 1
    log-bin         = /var/log/mysql/mysql-bin.log
    #if you set the expire_logs_days = x var in the [mysqld] section of your my.cnf it will automatically rotate your bin logs after x days.
    expire_logs_days = 30
    #it will create a new log file when the current file reach the specified size.
    max_binlog_size = 100M
    

     
    posted @ 2007-11-13 15:49 wade 閱讀(454) | 評論 (0)編輯 收藏

    edit file: /etc/network/interfaces

    the original content should be something like:

    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.0.5
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.0.1 

    add the following settings in the file:

    auto eth0:1
    iface eth0:1 inet static
    address 192.168.0.6
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1

    # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.0.1

     

    run command in root mode:

    /etc/init.d/networking restart

    that's all. you can run ifconfig to check if it works.

    I tested it in ubuntu 6.10.


     
    posted @ 2007-09-25 14:37 wade 閱讀(473) | 評論 (0)編輯 收藏

    Correct Implementation of #import
    It is important to invoke ADO correctly in your program, or you can have compiler errors. The following code demonstrates the correct way to use #import with Msado10.dll the MSADO15.dll:

    #import <msado15.dll>            \
    no_namespace \
    rename( "EOF", "adoEOF" )

    error C2011: 'EditModeEnum' : 'enum' type redefinition
    error C2011: 'LockTypeEnum' : 'enum' type redefinition
    error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
    error C2011: 'DataTypeEnum' : 'enum' type redefinition
    error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
    error C2011: 'RecordStatusEnum' : 'enum' type redefinition

    Here's the original solution in MSDN:
    http://support.microsoft.com/kb/169496/EN-US/


     
    posted @ 2007-08-30 18:39 wade 閱讀(751) | 評論 (0)編輯 收藏

     

    Show how to add script to the client in aspx file.

    /// <param name="rbl">RadioButtonList to apply script to</param>
    /// <param name="page">The Page the script is going to be appended to</param>
    /// <param name="script">The script to append</param>
    public static void SetRadioButtonListItemScript(RadioButtonList rbl, Page page, string script)
    {
    for (int idx = 0; idx < rbl.Items.Count; idx++)
    {
    RegisterClientObjectFunction(page, rbl, idx, script);
    }
    }

    /// <param name="page">The Page the script is going to be appended to</param> /// <param name="rbl">RadioButtonList to apply script to</param> /// <param name="idx">the index of the radio button</param> /// <param name="script">The script to append</param> static private void RegisterClientObjectFunction(Page page, RadioButtonList rbl, int idx, string script)
    {
    StringBuilder sw = new StringBuilder();
    if (!page.IsStartupScriptRegistered(rbl.ClientID + "_" + idx.ToString() + "script"))
    {
    sw.Append(@"<SCRIPT>");
    sw.Append(@"document.getElementById('" + rbl.ClientID + "_" + idx.ToString() + "').onclick=function() {" + script + "return true;}");
    sw.Append(@"</SCRIPT>");
    page.RegisterStartupScript(rbl.ClientID + "_" + idx.ToString() + "script", sw.ToString());
    }
    }

    static private void RegisterClientObjectFunction(Page page, CheckBox chk, string script)
    {
    StringBuilder sw = new StringBuilder();
    if (!page.IsStartupScriptRegistered(chk + "script"))
    {
    sw.Append(@"<SCRIPT>");
    sw.Append(@"document.getElementById('"+chk.ClientID + "').onclick=function() {" + script + "return true;}");
    sw.Append(@"</SCRIPT>");
    page.RegisterStartupScript(chk.ClientID + "script", sw.ToString());
    }
    }

     
    posted @ 2007-08-30 18:34 wade 閱讀(212) | 評論 (0)編輯 收藏

    Add Command here to right button click in explore (Windows XP)

    http://m.tkk7.com/Files/programmer/CMDHere.zip

    1. Download the file and unzip the file CMDHere.reg.
    2. Double click it to import into registry,
    3. Right click on any folder, you'll see there's a menu which is "Command here",
    4. Click it, you'll get into the cmd window with the current path is which you selected.


    Or you can import the settings manually.

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt]
    @="Command Prompt"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt\command]
    @="Cmd.exe /k pushd %L"
    
    


    posted @ 2007-08-30 18:15 wade 閱讀(344) | 評論 (0)編輯 收藏

    Set readonly for input text

    document.getElementById("ctrl_id").readOnly  = true; //pay attention to the readOnly, it's case sensitive.

     

    Set option to unable to select for select control:

     

    <option value="Genre" disabled="disabled">Genre</option>

     

    Set select control to disabled (it has no readonly property):

     

    <select disabled="disabled"></select>

     

    Add a new option to a select control, it works under firefox 2.x and IE 5.x:

    function addOption(select_ctrl, option_value, option_text){
    var ctrl = document.getElementById(selectctl);

    if(ctrl == null)
    return;

    var doc = ctrl.ownerDocument;
    if (!doc)
    doc = ctrl.document;

    var opt = doc.createElement('OPTION');
    opt.value = option_value;
    opt.text = option_text;

    ctrl.options.add(opt, ctrl.options.length);
    }

     

    Delete an option from select control:

    selectctl.options[selectctl.selectedIndex] = null;

    Delete all options from select control:

    selectctrl.options.length = 0;

    Change the css for an object:

    document.getElementById("ctrl_id").className="SHOWN";

     
    posted @ 2007-08-30 14:31 wade 閱讀(261) | 評論 (0)編輯 收藏

    導航

    <2007年8月>
    2930311234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

    統計

    常用鏈接

    留言簿(7)

    隨筆分類

    隨筆檔案

    相冊

    Photo

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 久久精品成人免费观看| 好男人视频在线观看免费看片 | 亚洲日本国产乱码va在线观看| 亚洲人成免费网站| 亚洲av乱码中文一区二区三区| 亚洲综合色区在线观看| 精品无码AV无码免费专区| 亚洲变态另类一区二区三区| 在线播放亚洲第一字幕| 91情侣在线精品国产免费| EEUSS影院WWW在线观看免费| 亚洲国产精品综合久久网各| 亚洲AⅤ无码一区二区三区在线| 久久免费国产视频| 粉色视频成年免费人15次| 久久久无码精品亚洲日韩蜜臀浪潮| 日韩午夜免费视频| 最近免费2019中文字幕大全| 美美女高清毛片视频黄的一免费| 亚洲视频免费播放| 超清首页国产亚洲丝袜| 天天看免费高清影视| 37pao成人国产永久免费视频| 老外毛片免费视频播放| 亚洲av极品无码专区在线观看| 亚洲一区精品无码| 国产免费无遮挡精品视频| 222www在线观看免费| 高清永久免费观看| 久久亚洲精品11p| 亚洲国产成人久久| 久久亚洲高清观看| 亚洲第一区精品观看| 国产三级在线观看免费| 在线免费观看你懂的| GOGOGO免费观看国语| 免费看美女午夜大片| 亚洲av中文无码字幕色不卡| 亚洲视频免费在线看| 久久久无码精品亚洲日韩按摩| 亚洲精品无码mv在线观看网站|