2010년 4월 30일 금요일

linux samba 설치하기



리눅스 페도라를 사용하여 삼바 서버를 설치한다.

1. 설치 확인하기
    - rpm -qa samba
      아무런 결과도 없으면 설치되지 않은 것임

2. 설치하기
    - yum -y install samba samba-swat samba_config_samba samba-client samba-common
    자동적으로 설치해 준다.
    당연히 리눅스에서 인터넷이 연결되어야 한다.
    삼바에 필요한 모듈을 모두 설치 한다.
    시간이 좀 걸리므로 술한잔 하시고 오시면 설치가 완료되어 있을 겁니다.^^
    Complete!가 맨 끝줄에 나오면 성공

3. 환경파일
   - etc/bashrc   : 전체적으로 적용되는 파일
   - etc/profile
   - 설정파일 : /etc/samba/smb.conf
[설명]  workgroup = MYGROUP
           server starting =  Samba Server
           security = share <---------- user, server가 있음.
                                                    share : 개나 소 모두 접근 가능 =>일단 이걸로 합시다.
                                                    user : 삼바에서 제공하는 user,password를 이용

[공유] smb.conf파일을 맨 아래에 다음과 같은 내용을 추가한다.
         [homes]    <----공유이름임
              comment = "test"    <--- windows에서 보여질 폴더이름
              path = /homepage  <--- 실제 공유할 디렉토리

4. 삼바의 실행
   - /etc/init.d/smb -restart

5. 보안의 설정
   - samba 서버의 보안을 해제한다.
     (system-config-securitylevel을 이용)
  
6. 테스트(공유를 걸지 않은 상태임)
    1) windows에서 시작->실행 -> //Linux IP로 공유파일을 확인한다.
        [힌트] windows에서 하다 연결이 안되면 안되는 이유가 많으므로
                  먼저 localhost에서 sambaclient로 리스트를 확인해 본다.
                  smbclient -L //192.168.0.4 -N
6.1 삼바 사용자 비밀번호 추가
     smbpasswd -a fedora    <---- fedora는 이미 linux에 등록되어 있는 user name 이여야 합니다.

7. Linux에서 Windows 공유 접근하기
   1) 리스트 확인하기
        smbclient -L //XP_IP -N
   2) 접근하기
        smbclient //XP_IP/공유폴더명 -U administrator
   3) mount하기
        mount.cifs //XP_IP/공유명  /mnt/xp user=administrator, pass=####
        => 당근으로 /mnt/xp를 만들어야 한다는 것...   뭔말인지 알져?
8. 사용자 제한
   /etc/samba/smb.conf

2010년 4월 29일 목요일

ubuntu 9.10 에서 APM + viewvc + cvsgraph 돌리기

 
 

끄자님이 Google 리더 이메일을 보내셨습니다!

 
 

10. 4. 28 작성자: 구차니의 구차니의 잡동사니 모음

APM (Apache - PHP - Mysql)
apache2
php5
mysql-server
패키지를 설치하면 자동으로 서버로 구동하게 된다.

viewvc / cvsgraph / enscript
viewvc
cvsgraph
enscript

기본적으로 설치되는 경로는
/var/www [htdocs]
/usr/lib/cgi-bin [cgi-bin]

/etc/viewvc/viewvc.conf
/etc/viewvc/cvsgraph.conf
[링크 : http://ubuntuforums.org/showthread.php?t=272022]

cvsgraph.conf는 별다르게 수정할건 없으며
viewvc.conf는 상당부분 수정이 가해진다.

viewvc.conf

#---------------------------------------------------------------------------
#
# Configuration file for ViewVC
#
# Information on ViewVC is located at the following web site:
#     http://viewvc.org/
#
#---------------------------------------------------------------------------

#
# BASIC CONFIGURATION
#
# For correct operation, you will probably need to change the following
# configuration variables:
#
#    cvs_roots (for CVS)
#    svn_roots (for Subversion)
#    root_parents (for CVS or Subversion)
#    default_root
#    rcs_path or cvsnt_exe_path
#    mime_types_file
#
# It is usually desirable to change the following variables:
#
#    address
#    forbidden
#
#    use_enscript
#    use_cvsgraph
#
# For Python source colorization:
#
#    py2html_path
#
# To optimize delivery of ViewVC static files:
#
#    docroot
#
# To customize the display of ViewVC for your site:
#
#    template_dir
#    the [templates] override section
#

#
# FORMAT INFORMATION
#
# This file is delineated by sections, specified in [brackets]. Within each
# section, are a number of configuration settings. These settings take the
# form of: name = value. Values may be continued on the following line by
# indenting the continued line.
#
# WARNING: indentation *always* means continuation. name=value lines should
#          always start in column zero.
#
# Comments should always start in column zero, and are identified with "#".
#
# Certain configuration settings may have multiple values. These should be
# separated by a comma. The settings where this is allowed are noted below.
#
# Any other setting that requires special syntax is noted at that setting.
#

#---------------------------------------------------------------------------
[general]

#
# This setting specifies each of the CVS roots on your system and assigns
# names to them. Each root should be given by a "name: path" value. Multiple
# roots should be separated by commas and can be placed on separate lines.
#
cvs_roots = cvs: /home/cvs

#
# This setting specifies each of the Subversion roots (repositories)
# on your system and assigns names to them. Each root should be given
# by a "name: path" value. Multiple roots should be separated by
# commas and can be placed on separate lines.
#
svn_roots = svn: /home/svn/repository

# The 'root_parents' setting specifies a list of directories in which
# any number of repositories may reside.  Rather than force you to add
# a new entry to 'cvs_roots' or 'svn_roots' each time you create a new
# repository, ViewVC rewards you for organising all your repositories
# under a few parent directories by allowing you to simply specifiy
# just those parent directories.  ViewVC will then notice each
# repository in that directory as a new root whose name is the
# subdirectory of the parent path in which that repository lives.
#
# You can specify multiple parent paths separated by commas or new lines.
#
# Caution: these names can, of course, clash with names you have
# defined in your cvs_roots or svn_roots configuration items.  If this
# occurs, you can either rename the offending repository on disk, or
# grant new names to the clashing item in cvs_roots or svn_roots.
# Each parent path is processed sequentially, so repositories under
# later parent paths may override earlier ones.
#
#root_parents = /home/svn-repositories : svn,
#               /home/cvs-repositories : cvs

# this is the name of the default root
# (ignored when root_as_url_component is turned on)
default_root =

# uncomment if the RCS binaries are not on the standard path
#rcs_path = /usr/bin/

# ViewVC can use CVSNT (www.cvsnt.org) instead of the RCS
# utilities to retrieve information from CVS repositories.
# To enable use of CVSNT, set the "cvsnt_exe_path" value
# to the path of the CVSNT executable. (If CVSNT is on the
# standard path, you can also set it to the name of the
# CVSNT executable). By default "cvsnt_exe_path" is set to
# "cvs" on Windows and is not set on other platforms.
#
#cvsnt_exe_path =
#cvsnt_exe_path = cvs
#cvsnt_exe_path = K:\Program Files\cvsnt\cvs.exe
#cvsnt_exe_path = /usr/bin/cvs

# use rcsparse python module to retrieve cvs repository information instead
# of invoking rcs utilities. this feature is experimental
use_rcsparse = 0

# uncomment if the svn command-line utilities are not on the standard path
#svn_path = /usr/bin/

#
# This is a pathname to a MIME types file to help viewvc to guess the
# correct MIME type on checkout.
#
# If you are having problems with the default guess on the MIME type, then
# uncomment this option and point it at a MIME type file.
#
# For example, you can use the mime.types from apache here:
#mime_types_file = /usr/local/apache/conf/mime.types

# This address is shown in the footer of the generated pages.
# It must be replaced with the address of the local repository maintainer.
address = <a href="mailto:cvs-admin@insert.your.domain.here">No admin address has been configured</a>

#
# This should contain a list of modules (that is, top-level directories within
# repositories) that should not be displayed (by default or by explicit path
# specification).
#
# This configuration can be a simple list of modules, or it can get quite
# complex:
#
#   *) The "!" can be used before a module to explicitly state that it
#      is NOT forbidden. Whenever this form is seen, then all modules will
#      be forbidden unless one of the "!" modules match.
#
#   *) Shell-style "glob" expressions may be used. "*" will match any
#      sequence of zero or more characters, "?" will match any single
#      character, "[seq]" will match any character in seq, and "[!seq]"
#      will match any character not in seq.
#
#   *) Tests are performed in sequence. The first match will terminate the
#      testing. This allows for more complex allow/deny patterns.
#
# Tests are case-sensitive.
#
# NOTE: This is for the hiding of modules within repositories, *not*
# for the hiding of repositories (roots) themselves.
#
# Some examples:
#
# Disallow "example" but allow all others:
#   forbidden = example
#
# Disallow "example1" and "example2" but allow all others:
#   forbidden = example1, example2
#
# Allow *only* "example1" and "example2":
#   forbidden = !example1, !example2
#
# Forbid modules starting with "x":
#   forbidden = x*
#
# Allow modules starting with "x" but no others:
#   forbidden = !x*
#
# Allow "xml", forbid other modules starting with "x", and allow the rest:
#   forbidden = !xml, x*, !*
#
forbidden =

#
# This is similar to 'forbidden', but differs in some key ways:
#
#   *) Rather than shell-style "glob" expressions, the values in this
#      list are regular expressions.  You can still prepend a ! character
#      to each regular expression to invert its meaning, though.
#
#   *) It compares not against modules only, but against paths consisting
#      of the repository (or root) name plus the path of the versioned file
#      or directory to be tested.  For example, to see if the user is
#      authorized to see the path "/trunk/www/index.html" in the repository
#      whose root name is "svnrepos", this authorizer will test the path
#      "svnrepos/trunk/www/index.html" against the list of forbidden regular
#      expressions.  Directory paths will be terminated by a forward slash.
#
# NOTE: Use of this configuration option will *disable* any configuration of
# the 'forbidden' option -- they cannot be used simultaneously.
#
# Some examples:
#
#    Disallow files named "PRIVATE", but allow all others:
#       forbiddenre = /PRIVATE$
#
#    Allow only the "example1" and "example2" roots and the paths inside them,
#    disallowing all others (which can be done in multiple ways):
#       forbiddenre = !^example1(/|$), !^example2(/|$)/
#       forbiddenre = !^example[12](/|$)
#
#    Only allow visibility of HTML files and the directories that hold them:
#       forbiddenre = !^.*(/|\.html)$
#
forbiddenre =

#
# This option provides a mechanism for custom key/value pairs to be
# available to templates. These are stored in key/value files (KV files).
#
# Pathnames to the KV files are listed here, specified as absolute paths
# or relative to this configuration file. The kV files follow the same
# format as this configuration file. It may have multiple, user-defined
# sections, and user-defined options in those sections. These are all
# placed into a structure available to the templates as:
#
#    kv.SECTION.OPTION
#
# Note that an option name can be dotted. For example:
#
#    [my_images]
#    logos.small = /images/small-logo.png
#    logos.big = /images/big-logo.png
#
# Templates can use these with a directive like: [kv.my_images.logos.small]
#
# Note that sections across multiple files will be merged. If two files
# have a [my_images] section, then the options will be merged together.
# If two files have the same option name in a section, then one will
# overwrite the other (it is unspecified regarding which "wins").
#
# To further categorize the KV files, and how the values are provided to
# the templates, a KV file name may be annotated with an additional level
# of dotted naming. For example:
#
#    kv_files = [asf]kv/images.conf
#
# Assuming the same section as above, the template would refer to an image
# using [kv.asf.my_images.logos.small]
#
# Lastly, it is possible to use %lang% in the filenames to specify a
# substitution of the selected language-tag.
#
kv_files =

# example:
# kv_files = kv/file1.conf, kv/file2.conf, [i18n]kv/%lang%_data.conf
#

#
# The languages available to ViewVC. There are several i18n mechanisms
# available:
#
#   1) using key/value extension system and reading KV files based on
#      the selected language
#   2) GNU gettext to substitute text in the templates
#   3) using different templates, based on the selected language
#
# ### NOTE: at the moment, the GNU gettext style is not implemented
#
# This option is a comma-separated list of language-tag values. The first
# language-tag listed is the default language, and will be used if an
# Accept-Language header is not present in the request, or none of the
# user's requested languages are available. If there are ties on the
# selection of a language, then the first to appear in the list is chosen.
#
languages = en-us

# other examples:
#
# languages = en-us, de
# languages = en-us, en-gb, de
# languages = de, fr, en-us
#

#---------------------------------------------------------------------------
[options]

# root_as_url_component: Interpret the first path component in the URL
# after the script location as the root to use.  This is an
# alternative to using the "root=" query key. If ViewVC is configured
# with multiple repositories, this results in more natural looking
# ViewVC URLs.
# Note: Enabling this option will break backwards compatibility with
# any old ViewCVS URL which doesn't have an explicit "root" parameter.
root_as_url_component = 0

# default_file_view: "log" or "co"
# Controls whether the default view for file URLs is a checkout view or
# a log view. "log" is the default for backwards compatibility with old
# ViewCVS URLs, but "co" has the advantage that it allows ViewVC to serve
# static HTML pages directly from a repository with working links
# to other repository files
# Note: Changing this option may cause old ViewCVS URLs that referred
# to log pages to load checkout pages instead.
default_file_view = log

# checkout_magic: Use checkout links with magic /*checkout*/ prefixes so
# checked out HTML pages can have working links to other repository files
# Note: This option is DEPRECATED and should not be used in new ViewVC
# installations. Setting "default_file_view = co" achieves the same effect
checkout_magic = 0

# http_expiration_time: Expiration time (in seconds) for cacheable
# pages served by ViewVC.  Note that in most cases, a cache aware
# client will only revalidate the page after it expires (using the
# If-Modified-Since and/or If-None-Match headers) and that browsers
# will also revalidate the page when the reload button is pressed.
# Set to 0 to disable the transmission of these caching headers.
http_expiration_time = 600

# generate_etags: Generate Etag headers for relevant pages to assist
# in browser caching.
#   1      Generate Etags
#   0      Don't generate Etags
generate_etags = 1

# sort_by: File sort order
#   file   Sort by filename
#   rev    Sort by revision number
#   date   Sort by commit date
#   author Sort by author
#   log    Sort by log message
sort_by = file

# sort_group_dirs: Group directories when sorting
#   1      Group directories together
#   0      No grouping -- sort directories as any other item would be sorted
sort_group_dirs = 1

# hide_attic: Hide or show the contents of the Attic subdirectory
#   1      Hide dead files inside Attic subdir
#   0      Show the files which are inside the Attic subdir
hide_attic = 1

# log_sort: Sort order for log messages
#   date   Sort revisions by date
#   rev    Sort revision by revision number
#   cvs    Don't sort them. Same order as CVS/RCS shows them.
log_sort = date

# diff_format: Default diff format
#   h      Human readable
#   u      Unified diff
#   c      Context diff
#   s      Side by side
#   l      Long human readable (more context)
diff_format = h

# hide_cvsroot: Don't show the CVSROOT directory
#   1      Hide CVSROOT directory
#   0      Show CVSROOT directory
hide_cvsroot = 1

# set to 1 to make lines break at spaces,
# set to 0 to make no-break lines,
# set to a positive integer to make the lines cut at that length
hr_breakable = 1

# give out function names in human readable diffs
# this just makes sense if we have C-files, otherwise
# diff's heuristic doesn't work well ..
# ( '-p' option to diff)
hr_funout = 0

# ignore whitespaces for human readable diffs
# (indendation and stuff ..)
# ( '-w' option to diff)
hr_ignore_white = 1

# ignore diffs which are caused by
# keyword-substitution like $Id - Stuff
# ( '-kk' option to rcsdiff)
hr_ignore_keyword_subst = 1

# Enable highlighting of intraline changes in human readable diffs
# this feature is experimental and currently requires python 2.4
#
hr_intraline = 0

# allow on-the-fly generation of repository tarballs
allow_tar = 0

# allow annotation of files.
allow_annotate = 1

# allow pretty-printed version of files
allow_markup = 1

# allow compression with gzip of output if the Browser accepts it
# (HTTP_ACCEPT_ENCODING=gzip)
# [make sure to have gzip in the path]
allow_compress = 1

# The directory which contains the EZT templates used by ViewVC to
# customize the display of the various output views.  ViewVC looks in
# this directory for files with names that match the name of the view
# ("log", "directory", etc.) plus the ".ezt" extension.  If specified
# as a relative path, it is relative to the ViewVC installation
# directory; absolute paths may be used as well.
#
# If %lang% occurs in the pathname, then the selected language will be
# substituted.
#
template_dir = /etc/viewvc/templates

# Web path to a directory that contains ViewVC static files
# (stylesheets, images, etc.)  If set, static files will get
# downloaded directory from this location.  If unset, static files
# will be served by the ViewVC script (at a likely performance
# penalty, and from the "docroot" subdirectory of the directory
# specified by the "template_dir" option).
#docroot = /docroot

# Show last changelog message for sub directories
# The current implementation makes many assumptions and may show the
# incorrect file at some times. The main assumption is that the last
# modified file has the newest filedate. But some CVS operations
# touches the file without even when a new version is not checked in,
# and TAG based browsing essentially puts this out of order, unless
# the last checkin was on the same tag as you are viewing.
# Enable this if you like the feature, but don't rely on correct results.
show_subdir_lastmod = 0

# show a portion of the most recent log entry in directory listings
show_logs = 1

# Show log when viewing file contents
show_log_in_markup = 1

# Cross filesystem copies when traversing Subversion file revision histories.
cross_copies = 1

# Display dates as UTC or in local time zone
use_localtime = 0
#use_localtime = 1

# == Configuration defaults ==
# Defaults for configuration variables that shouldn't need
# to be configured..

#
# If you want to use Marc-Andrew Lemburg's py2html (and Just van Rossum's
# PyFontify) to colorize Python files, then you may need to change this
# variable to point to their directory location.
#
# This directory AND the standard Python path will be searched.
#
py2html_path = .
#py2html_path = /usr/local/lib/python1.5/site-python

# the length to which the most recent log entry should be truncated when
# shown in the directory view
short_log_len = 80

# should we use 'enscript' for syntax coloring?
use_enscript = 1

#
# if the enscript program is not on the path, set this value
#
enscript_path =
# enscript_path = /usr/bin/

# should we use 'highlight' for syntax coloring?
# NOTE: use_enscript has to be 0 or enscript will be used instead
use_highlight = 0

#
# if the highlight program is not on the path, set this value
#
# highlight_path = /usr/bin

# should we add line numbers?
highlight_line_numbers = 1

# convert tabs to ## spaces (use 0 for no conversion)
highlight_convert_tabs = 2

# use php to colorize .php and .inc files?
use_php = 0

# path to php executable
# (This should be set to the path of a PHP CLI executable, not the path
# to a CGI executable. If you use a CGI executable, you may see "no input file
# specified" or "force-cgi-redirect" errors instead of colorized source. The
# output of "php -v" tells you whether an given executable is CLI or CGI.)
php_exe_path = php
# php_exe_path = /usr/local/bin/php
# php_exe_path = C:\Program Files\php\cli\php.exe

#
# Use CvsGraph. See http://www.akhphd.au.dk/~bertho/cvsgraph/ for
# documentation and download.
#
use_cvsgraph = 0
# use_cvsgraph = 1

#
# if the cvsgraph program is not on the path, set this value
#
#cvsgraph_path =
 cvsgraph_path = /usr/bin/

#
# Location of the customized cvsgraph configuration file. 
# You will need an absolute pathname here:
#
cvsgraph_conf = /etc/viewvc/cvsgraph.conf

#
# Set to enable regular expression search of all files in a directory
#
# WARNING:
#
#   Enabling this option can consume HUGE amounts of server time. A
#   "checkout" must be performed on *each* file in a directory, and
#   the result needs to be searched for a match against the regular
#   expression.
#
#
# SECURITY WARNING:  Denial Of Service
#
#   Since a user can enter the regular expression, it is possible for
#   them to enter an expression with many alternatives and a lot of
#   backtracking. Executing that search over thousands of lines over
#   dozens of files can easily tie up a server for a long period of
#   time.
#
# This option should only be used on sites with trusted users. It is
# highly inadvisable to use this on a public site.
#
use_re_search = 0
# use_re_search = 1

#
# Split directories and logs into pages.
# Allows ViewVC to present discrete pages to the users instead of the
# entire log or directory.
# Set use_pagesize to the number of entries you want displayed on a page.
#
use_pagesize = 0
# use_pagesize = 20

# Limit number of changed paths shown per commit in the Subversion revision
# view and in query results. This is not a hard limit (the UI provides
# options to show all changed paths), but it prevents ViewVC from generating
# enormous and hard to read pages by default when they happen to contain
# import or merge commits affecting hundreds or thousands of files.
# Set to 0 to disable the limit.
limit_changes = 100

#---------------------------------------------------------------------------
[templates]

# You can override the templates used by various ViewVC views in this
# section.  By default, ViewVC will look for templates in the
# directory specified by the "template_dir" configuration option (see
# the documentation for that option for details).  But if you want to
# use a different template for a particular view, simply uncomment the
# appropriate option below and specify the currect location of the EZT
# template file you wish to use for that view.
#
# Templates are specified relative to the installation directory, but
# absolute paths may also be used as well.
#
# If %lang% occurs in the pathname, then the selected language will be
# substituted.
#
# Note: the selected language is defined by the "languages" item in the
#       [general] section, and based on the request's Accept-Language
#       header.
#
#directory = templates/directory.ezt
### an alternative directory view
#directory = templates/dir_new.ezt  
#log = templates/log.ezt
### a table-based alternative log view
#log = templates/log_table.ezt 
#query = templates/query.ezt
#diff = templates/diff.ezt
#graph = templates/graph.ezt
#annotate = templates/annotate.ezt
#markup = templates/markup.ezt
#revision = templates/revision.ezt
#query_form = templates/query_form.ezt
#query_results = templates/query_results.ezt
#error = templates/error.ezt
#roots = templates/roots.ezt

#---------------------------------------------------------------------------
[cvsdb]

enabled = 0
#host = localhost
#port = 3306
#database_name = ViewVC
#user =
#passwd =
#readonly_user =
#readonly_passwd =
#row_limit = 1000

#---------------------------------------------------------------------------
[vhosts]
### DOC

# vhost1 = glob1, glob2
# vhost2 = glob3, glob4

# [vhost1-section]
# option = value
# [vhost1-othersection]
# option = value
# [vhost2-section]
# option = value

#
# Here is an example:
#
# [vhosts]
# lyra = *lyra.org
#
# [lyra-general]
# forbidden = hideme
#
# [lyra-options]
# show_logs = 0
#
# Note that "lyra" is the "canonical" name for all hosts in the lyra.org
# domain. This canonical name is then used within the additional, vhost-
# specific sections to override specific values in the common sections.
#

#---------------------------------------------------------------------------


위와 같이 설정하고, 설치하면 아래와 같은 화면을 볼수 있다.
repository 전부를 보는 화면.
cvs 하위의 모든 프로젝트를 보여준다.

cvs는 파일별로 revision이 붙으므로 상관없지만
svn은 프로젝트별로 repository를 구성하면
viewvc 구성이 꽤나 까다로워질것으로 예상된다.

위에서
버튼을 누르면 아래와 같은 revision tree가 그래프로 나타난다.

그리고 개별 소스를 클릭하면 아래와 같이 syntax highlight 되어 나타난다.

아직 euc-kr로 설정하는법을 찾지 못해, 한글이 ??? 로 깨어져 나온다.
해결방법은 아래 링크를 참조!

나의 경우에는 viewvc 1.0.5 버전이고
/usr/lib/viewvc/sapi.py 파일에서
UTF-8을 검색하여 EUC-KR로 고쳐주었다. (3곳)

[링크 : http://www.pyrasis.com/main/SubversionWithViewVCForWindows]
[링크 : http://kldp.org/node/50455]

2010/04/28 - [프로그램 사용] - [작업중] cvsweb + cvsgraph + xampp


 
 

Google 리더를 사용하면 다음과 같은 일들이 가능해집니다.

 
 

2010년 4월 25일 일요일

[20100417] SharePoint 커뮤니티 발표 자료 - current, future stories about collaborati...

 
 

끄자님이 Google 리더 이메일을 보내셨습니다!

 
 

10. 4. 16 작성자: 백승주(Seung Joo Baek)의 꼬알라의 하얀집...

금주의 마지막 세미나였습니다. SharePoint 커뮤니티 의 정기 세미나에서 Microsoft 협업 플랫폼의 현재와 미래라는 주제로 발표를 했습니다. Office 2010, SharePoint 2010, 그리고 BPOS, Live Services의 이야기를 드렸으며, 몇가지 아직까지 밝힐 수 없는 내용(?)을 데모를 통해서 보여드렸습니다. 관련된 발표 자료 를 포스팅합니다. 주말 오후에 참석해주신 분들께 감사드립니다....(read more)

 
 

Google 리더를 사용하면 다음과 같은 일들이 가능해집니다.

 
 

iconv() 함수 완전정복(?)

리눅스를 한다면 필요한 API

 
 

끄자님이 Google 리더 이메일을 보내셨습니다!

 
 

10. 4. 22 작성자: 구차니의 구차니의 잡동사니 모음

iconv() 함수에서
변환결과로 나와야 하는 방법이 unicode일 경우에는 (일단 다른건 안해봤으니 -ㅁ-?)
(strlen(inbuf) + 2) * 2 가 된다.

size_t iconv(iconv_t cd,
                     char **inbuf, size_t *inbytesleft,
                     char **outbuf, size_t *outbytesleft);

예를 들어 UTF-8을 UNICODE로 변환시에는
UTF-8 문자열 특성상, stelen(utf8str) == 100 일 경우
유니코드(2바이트) 스트링은 최소 25에서 최대 100 까지 변환이 된다.

그리고 iconv 특성상 처음에 2바이트 BOM(Byte Order Mark)을 붙이므로
실질적으로 변환을 위해 필요로 하는 outbuf의 길이는
(strlen(inbuf) + 2) * 2 가 된다.

원래대로라면
(strlen(inbuf) + 1) * 2 + 2 이고
+1 은 '\0'
+2 는 Unicode BOM(0xFEFF in big endian)이다.

[링크 : http://mwultong.blogspot.com/2006/05/qna-unicode-bom-byte-order-mark.html]


덧 : UTF-8로 인코딩된 아랍어의 경우, 조합은 별도로 해주어야 한다.
iconv()가 UNICODE로 변환은 해주지만, 그렇다고 해서 조합까지 해주지는 않는다.

 
 

Google 리더를 사용하면 다음과 같은 일들이 가능해집니다.

 
 

2010년 4월 24일 토요일

MSSQL SP 에서 NOCOUNT 옵션

발췌 : 네이버 카페 ( http://cafe.naver.com/xlsvba/7031 )

MSSQL 에서 SP 사용시 NOCOUNT 옵션

SET NOCOUNT [ON | OFF]



알아두믄 피가되구 살이 되는 설정옵션이다...^^

물론 수시간의 삽질을 동반하구 알아냇다면 뇌속 깊숙이 박히겠지만

이런 기회에 알아두어두 별거 아니므로 기억하는데 어려움이 없으리라 본다.





일단 MSDN을 기초로 설명을 해보자믄



[정의]

: Transact-SQL 문 또는 저장 프로시저의 영향을 받은 행 수를 나타내는 메시지가

결과 집합의 일부로 반환되지 않도록 합니다.





[옵션별 설명]

ON : 실행쿼리에 의해 영향을 받은 ROW의 개수가 반환되지 않음(클라이언트에게 DONE_IN_PROC 메시지를 보내지 안는다.)

실제 데이터를 많이 반환하지 않는 일부 문이 포함된 SP 또는 T-SQL 루프가 포함된 SP의 경우

ON으로 설정하면 네트워크 트래픽이 크게 줄기 때문에 성능 향상에 도움이 된다.

VB에서 SP호출시 해당 SP내 실행쿼리가 존재할 경우(임시 혹은 일반테이블 모두)

레코드셋의 오픈이 아니되는데 이때 살행 쿼리구문에 앞서 ON으로 설정하고

실행쿼리 종료후 OFF로 설정하면 이러한 문제를 극복할 수 있다.

단 @@ROWCOUNT 함수는 정상적으로 업데이트된다. http://cafe.naver.com/xlsvba/3539



OFF : 실행쿼리에 의해 영향을 받은 ROW의 개수가 반환된다.





[예제]



가령 아래와 같은 SP를 만들고 SSMS에서 테스트 해보도록 하자.

정상적인 쿼리라면 결과값도 무리없이 출력될것이다.







CREATE PROC p_test
(
@idt INT
)
AS
BEGIN
SELECT u_id, u_nm, u_job INTO #tmp_test FROM t_test WHERE u_work = '1'
IF @idt = 0
   SELECT * FROM #tmp_test
ELSE IF @idt = 1
   SELECT * FROM #tmp_test WHERE u_cnt > 0
ELSE
   SELECT * FROM #tmp_test WHERE u_cnt < 0
END

일단 정상출력이라고 가정하고
이번엔 이넘을 VB에서 호출해 보자.

'## SQL ADO OLEDB 연결정상이라치구
Call ConnectADO(0)

'## 레코드셋 인스턴스 생성두 정상이라치구...
If oRs Is Nothing Then
   Set oRs = CreateObject("ADODB.Recordset")
End If

Sql = "EXEC [DBO].[p_test] 1"
oCn.Execute Sql
oRs.Open Sql, oCn, 3, 1
If oRs.recordcount <> 0 Then '## ERROR발생--> 개체가닫혀있으면..... 어쩌구저쩌구...~~~
...

SP내에 실행쿼리가 없다면 즉 실행쿼리에 의해 영향을 받은 ROW의 개수가 반환된것이 없다면(DONE_IN_PROC MESSAGE 미발생)

잘 돌아가겠지만 글치 안타믄.... 즉 실행쿼리에 의해 영향을 받은 ROW의 개수가 반환된것이 존재한다믄(DONE_IN_PROC MESSAGE 발생)

위와 같은 에러가 발생한다는 것이다.



그럼 간단하게 해결해 보도록하자..

ODBC어쩌구 저쩌구 하지말구 머리 아프니깐 간단하게 살자...

당연한 얘기이지만 임시이건 일반테이블이건 마찬가지란것에 주의해야한다...

잘못된 정보로 인해서 삽질하지 말자..

SP를 고쳐보도록 하자...



IF OBJECT_ID('p_test') IS NOT NULL
  DROP PROC p_test
GO

CREATE PROC p_test
(
@idt INT
)
AS
BEGIN
SET NOCOUNT ON
SELECT u_id, u_nm, u_job INTO #tmp_test FROM t_test  WHERE u_work = '1'
IF @idt = 0
    SELECT * FROM #tmp_test
ELSE IF @idt = 1
   SELECT * FROM #tmp_test WHERE u_cnt > 0
ELSE
   SELECT * FROM #tmp_test WHERE u_cnt < 0

SET NOCOUNT OFF

END


정상적으로 실행되리라 본다....

개인적으루 먹구살기 바쁘다 보니 양질의 강좌를 올리지 못하는점 미안하게 생각하고 있다.

물론 SQL강좌가 그리 인기가 있지 않은것이 다행이긴 하지만,,,, Good Bye..!!

2010년 4월 21일 수요일

자바를 이용한 암호화 모듈

자바를 이용한 암호화 모듈 정보 입니다..

TripleDES


http://yegam400.tistory.com/73

http://naratalk.com/142



SEED

http://seed.kisa.or.kr/seed/jsp/seed_1020.jsp

2010년 4월 17일 토요일

wget - cookie 관련 옵션

Linux에서 많이 사용하는 명령어

 
 

끄자님이 Google 리더 이메일을 보내셨습니다!

 
 

10. 4. 9 작성자: 구차니의 구차니의 잡동사니 모음

wget은 HTTP나 FTP 등의 프로토콜을 통해 웹페이지나 파일을 다운받는 유틸리티이다.
아무튼 youtube에서 파일로 다운로드 받기위해 주소를 변환해서 시도를 해도
403 Forbidden 에러만 날뿐 다운로드 되지 않는다.

아무튼 쿠키를 저장하고, 이를 다시 불러들여 다운로드를 시도하면 제대로 받아진다.
쿠키를 이용해서 세션이 달라지면, 이전의 내용은 무효화 되서 그런것으로 생각된다.

'--no-cookies'
Disable the use of cookies. Cookies are a mechanism for maintaining server-side state. The server sends the client a cookie using the Set-Cookie header, and the client responds with the same cookie upon further requests. Since cookies allow the server owners to keep track of visitors and for sites to exchange this information, some consider them a breach of privacy. The default is to use cookies; however, storing cookies is not on by default.


'--load-cookies file'
Load cookies from file before the first HTTP retrieval. file is a textual file in the format originally used by Netscape's cookies.txt file.

You will typically use this option when mirroring sites that require that you be logged in to access some or all of their content. The login process typically works by the web server issuing an http cookie upon receiving and verifying your credentials. The cookie is then resent by the browser when accessing that part of the site, and so proves your identity.

Mirroring such a site requires Wget to send the same cookies your browser sends when communicating with the site. This is achieved by '--load-cookies'—simply point Wget to the location of the cookies.txt file, and it will send the same cookies your browser would send in the same situation. Different browsers keep textual cookie files in different locations:

Netscape 4.x.
The cookies are in ~/.netscape/cookies.txt.
Mozilla and Netscape 6.x.
Mozilla's cookie file is also named cookies.txt, located somewhere under ~/.mozilla, in the directory of your profile. The full path usually ends up looking somewhat like ~/.mozilla/default/some-weird-string/cookies.txt.
Internet Explorer.
You can produce a cookie file Wget can use by using the File menu, Import and Export, Export Cookies. This has been tested with Internet Explorer 5; it is not guaranteed to work with earlier versions.
Other browsers.
If you are using a different browser to create your cookies, '--load-cookies' will only work if you can locate or produce a cookie file in the Netscape format that Wget expects.

If you cannot use '--load-cookies', there might still be an alternative. If your browser supports a "cookie manager", you can use it to view the cookies used when accessing the site you're mirroring. Write down the name and value of the cookie, and manually instruct Wget to send those cookies, bypassing the "official" cookie support:

          wget --no-cookies --header "Cookie: name=value"


'--save-cookies file'
Save cookies to file before exiting. This will not save cookies that have expired or that have no expiry time (so-called "session cookies"), but also see '--keep-session-cookies'.


'--keep-session-cookies'
When specified, causes '--save-cookies' to also save session cookies. Session cookies are normally not saved because they are meant to be kept in memory and forgotten when you exit the browser. Saving them is useful on sites that require you to log in or to visit the home page before you can access some pages. With this option, multiple Wget runs are considered a single browser session as far as the site is concerned.

Since the cookie file format does not normally carry session cookies, Wget marks them with an expiry timestamp of 0. Wget's '--load-cookies' recognizes those as session cookies, but it might confuse other browsers. Also note that cookies so loaded will be treated as other session cookies, which means that if you want '--save-cookies' to preserve them again, you must use '--keep-session-cookies' again.


[링크 : http://www.gnu.org/software/wget/manual/html_node/HTTP-Options.html]

--save-cookies 로 저장한 youtube 쿠키이다. 음.. 무슨 의미지 -ㅁ-?
$ cat yt.cookie
# HTTP cookie file.
# Generated by Wget on 2010-04-10 11:57:59.
# Edit at your own risk.

.youtube.com    TRUE    /       FALSE   1586228278      PREF    f1=50000000&f2=8000000
.youtube.com    TRUE    /       FALSE   1291604278      VISITOR_INFO1_LIVE      FNfBrJzTQY

$ wget "http://www.youtube.com/watch?v=mdljV2uEs1A" --save-cookies yt.cookie
$ wget --load-cookies=yt.cookie "http://v22.lscache2.c.youtube.com/videoplayback?ip=211.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Ci
tag%2Calgorithm%2Cburst%2Cfactor&fexp=904405%2C900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350" -O file.mp4
--2010-04-10 12:33:26--  http://v22.lscache2.c.youtube.com/videoplayback?ip=211.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Calgorithm%2Cburst%2Cfactor&fexp=904405%2C900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350
Resolving v22.lscache2.c.youtube.com... 74.125.167.33
접속 v22.lscache2.c.youtube.com|74.125.167.33|:80... 접속됨.
HTTP request sent, awaiting response... 200 OK
Length: 15708973 (15M) [video/x-flv]
Saving to: `file.mp4'

100%[==========================================================================>] 15,708,973   105K/s   in 2m 0s

2010-04-10 12:35:27 (128 KB/s) - `file.mp4' saved [15708973/15708973]

URL이 너무 길어서 별도의 파일이름을 지정해주지 않으면
Cannot write to `videoplayback?ip=211.0.0.0&sparams=id,expire,ip,ipbits,itag,algorithm,burst,factor&fexp=904405,900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350' (File name too long).
주소가 255자를 넘어서는 관계로, 파일 이름으로 하기에는 너무 길다고 에러가 발생한다.
반드시 -O filename 으로 별도의 이름을 지정해 주어야 한다.

2010/04/09 - youtube 동영상 페이지 fmt_map, fmt_url_map, fmt_list, fmt_stream_map
[링크 : http://kldp.org/node/75150]



 
 

Google 리더를 사용하면 다음과 같은 일들이 가능해집니다.