Hatena::ブログ(Diary)

YSukeの足跡 このページをアンテナに追加 RSSフィード

2012-02-21 Javascript validation

When scripting a input validation code, there would be two timings

where the validation runs.

  1. On change/blur(or others) event
  2. On submit event

To make the validation work on both the above events,

the following is kept on mind..

Do not use $(this) in the validation code

Give the validation function a argument which is target input.

Example

$('input').change(stringValidation(this));

↑Not fired..

$('input').change(function(){return stringValidation(this);});

$('#submitButton').click(submit);

function submit(){

    if(!stringValidation($('input'))) {

      return false;

    }

}

function stringValidation(target) {

    var str = $(target).val();

    if(str===''){

      error handling;

      retrun false;

    }

}

2012-01-13 Android SDK offline install

Android SDK offline install

Due to the proxy or firewall settings, SDK installment through online was failed.

Hence, I tried to offline installment.

  1. Open the repository xml file on https://dl-ssl.google.com/android/repository/repository-5.xml
  2. Fetch the target SDK file specified in the "<sdk:url>" tag (e.g. <sdk:url>android-2.3.3_r02-linux.zip</sdk:url>: http://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip)
  3. Put the fetched file to the directory "<sdk root>/temp"
  4. Launch SDK Manager to install.
Refferences

[Useful sites]

http://blog.codinghazard.com/2010/09/setting-up-android-sdk-on-windows-offline-install/

http://qdevarena.blogspot.com/2010/05/download-android-sdk-standalone-for.html

[Sample package URL]

http://dl-ssl.google.com/android/repository/

Android SDK Platform 4.0.3 http://dl-ssl.google.com/android/repository/android-15_r01.zip

Android SDK Platform 4.0 http://dl-ssl.google.com/android/repository/android-14_r03.zip

Android SDK Platform 3.2 revision 1 http://dl-ssl.google.com/android/repository/android-3.1_r03-linux.zip

Android SDK Platform 3.1 revision 3 http://dl-ssl.google.com/android/repository/android-3.1_r03-linux.zip

Android SDK Platform 3.0, revision 2 http://dl-ssl.google.com/android/repository/android-3.0_r02-linux.zip

Android SDK Platform 2.3.3_r2 http://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip

Android SDK Platform 2.3.1_r2 http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip

Android SDK Platform 2.2_r3 http://dl-ssl.google.com/android/repository/android-2.2_r03-linux.zip

2011-12-29 CSS min-height for IE6

| 12:46 |

min-height handling for IE6

IE6 does not handle min-height property.

The following hack can handle this issue.

#target {

    min-height: 40px;

    height: auto !important;

    height: 40px;

}

2011-12-17 jQuery IEでlive()を実現

** jQuery plugin livequery

| 10:47 |

jQuery live() does not work on IEs. Here is a good stuff to solve it!!

$('dd').livequery('mouseover', function(){

    $('div.show').show();

}).livequery('mouseout', function(){

    $('div.show').hide();

});

jQuery plugin livequery

2011-11-20 CentOS dependency error

| 03:29 |

Installing ghostscript rpm package

I had the following error in installing ghostscrip rpm package on CentOS 5.7.

[root@xxxx src]# rpm -Uvh ghostscript-8.15.2-9.11.el5.i386.rpm ghostscript-fonts-5.50-13.1.1.noarch.rpm

エラー: 依存性の欠如:

urw-fonts >= 1.1 は ghostscript-8.15.2-9.11.el5.i386 に必要とされています

Then I tried to install urw-fonts, but another error came up..

[root@xxxx src]# rpm -Uvh urw-fonts-2.4-9.fc13.noarch.rpm

警告: urw-fonts-2.4-9.fc13.noarch.rpm: ヘッダ V4 DSA signature: NOKEY, key ID 42d68235

エラー: 依存性の欠如:

rpmlib(FileDigests) <= 4.6.0-1 は urw-fonts-2.4-9.fc13.noarch に必要とされています

rpmlib(PayloadIsXz) <= 5.2-1 は urw-fonts-2.4-9.fc13.noarch に必要とされています

What was that? I did not find "rpmlib" something from anywhere.

I am totally at a loss to solve this..

Finally, I figured out how to get it done!

[root@xxxx src]# yum localinstall ghostscript*.rpm

Loaded plugins: fastestmirror

Setting up Local Package Process

Examining ghostscript-8.15.2-9.11.el5.i386.rpm: ghostscript-8.15.2-9.11.el5.i386

Marking ghostscript-8.15.2-9.11.el5.i386.rpm to be installed

Loading mirror speeds from cached hostfile

* base: ftp.nara.wide.ad.jp

* extras: ftp.nara.wide.ad.jp

* updates: ftp.nara.wide.ad.jp

Examining ghostscript-fonts-5.50-13.1.1.noarch.rpm: ghostscript-fonts-5.50-13.1.1.noarch

Marking ghostscript-fonts-5.50-13.1.1.noarch.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package ghostscript.i386 0:8.15.2-9.11.el5 set to be updated

--> Processing Dependency: urw-fonts >= 1.1 for package: ghostscript

---> Package ghostscript-fonts.noarch 0:5.50-13.1.1 set to be updated

--> Running transaction check

---> Package urw-fonts.noarch 0:2.3-6.1.1 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================

Package Arch Version Repository Size

===================================================================================================

Installing:

ghostscript i386 8.15.2-9.11.el5 /ghostscript-8.15.2-9.11.el5.i386 18 M

ghostscript-fonts noarch 5.50-13.1.1 /ghostscript-fonts-5.50-13.1.1.noarch 1.4 M

Installing for dependencies:

urw-fonts noarch 2.3-6.1.1 base 4.5 M

Transaction Summary

===================================================================================================

Install 3 Package(s)

Upgrade 0 Package(s)

Total size: 24 M

Total download size: 4.5 M

Is this ok [y/N]: y

Downloading Packages:

urw-fonts-2.3-6.1.1.noarch.rpm | 4.5 MB 00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : urw-fonts 1/3

Installing : ghostscript 2/3

Installing : ghostscript-fonts 3/3

Installed:

ghostscript.i386 0:8.15.2-9.11.el5 ghostscript-fonts.noarch 0:5.50-13.1.1

Dependency Installed:

urw-fonts.noarch 0:2.3-6.1.1

Complete!

2011-11-14 jQuery button rollover

| 23:37 |

jQuery button rollover

With regular expressions, it is quite easy to realize the button rollover function.

$(function(){

    $('li img').mouseover(function(){

        $(this).attr('src', $(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1_on.$2'));

    .mouseout(function(){

        $(this).attr('src', $(this).attr('src').replace(/^(.+)_on(\.[a-z]+)$/, '$1$2'));

    });

});

2011-11-13 CentOS 5.7 PHP install

| 22:10 |

PHP install on CentOS5.7

In installing PHP on CentOS5.7, I encountered a configure error.

#configure: error: freetype.h not found.

Installing "freetype" seemed to be required, so I installed it.

yum install freetype freetype-devel

However, the same error occured.. mmm

I figured out that the freetype installed path is not recognized.

So I ended up the following configure line.

./configure \

    • with-apxs2=/usr/local/apache2/bin/apxs \
    • enable-mbstring \
    • enable-mbregex \
    • enable-zend-multibyte \
    • with-gd \
    • enable-gd-native-ttf \
    • with-png-dir=/usr \
    • with-zlib \
    • with-jpeg-dir=/usr \
    • with-mysql=/usr/local/mysql \
    • with-freetype-dir=/usr/include/freetype2

2011-11-12 Apach install

| 17:54 |

Apache install - configure parameters -

# ./configure \

    • prefix=/usr/local/apache2 \
    • enable-module=so \
    • enable-mods-shared=all \
    • enable-ssl=shared \
    • enable-proxy=shared

2011-11-11 Trac Lightning with Eclipse

Trac Lightning with Eclipse

Ticket management

In source commitment, the following prefixes are used to update the ticket status.

[address, references, refs, re, see]

To add comments on the ticket. (e.g. refs #1)

[closes, fixes, fixed]

To close the ticket (e.g. fixes #1)

2011-11-10 Trac Lightning Wiki

Trac Lightning

For displaying your ticket on Wiki, put the following macro commands.

TicketQuery(owner=$USER,status!=close,group=status, table)?

Set values
  • owner=$USER : Ticket owner equals to Trac login user
  • status!=close : Ticket not closed
  • group=status : Tickets by status
  • table : Ticket list in table format