Liomblr RSS

Archive

Nov
19th
Thu
permalink
wwwwwwwwwwwwwwwwwwwwwwww

wwwwwwwwwwwwwwwwwwwwwwww

Nov
17th
Tue
permalink
typo 翻訳の誤り 間違い 誤訳http://msdn.microsoft.com/ja-jp/library/default.aspx

typo 翻訳の誤り 間違い 誤訳

http://msdn.microsoft.com/ja-jp/library/default.aspx

Nov
10th
Tue
permalink

[Windows] Snapshot tool using hardlinks

using System;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Rosids
{
    class Program
    {
        static void Main(string[] args)
        {
            // @todo argument processer
            var src = @"C:\Users\LiosK\Documents\Visual Studio 2008";
            var lnk = @"C:\Users\LiosK\Desktop\Visual Studio 2008";
            var dst = @"C:\Users\LiosK\Desktop\RosidsTest";

            try
            {
                new Program(src, lnk, dst).Execute();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }

        readonly DirectoryInfo Source;
        readonly DirectoryInfo LinkSource;
        readonly DirectoryInfo Destination;

        Program(string src, string lnk, string dst)
        {
            Source = new DirectoryInfo(src);
            LinkSource = new DirectoryInfo(lnk);
            Destination = new DirectoryInfo(dst);
        }

        void Execute()
        {
            CheckDirectories();
            Destination.Create();
            Visit(Source, LinkSource, Destination);
        }

        // Checks if Source, LinkSource and Destination satisfy assumptions.
        void CheckDirectories()
        {
            if (!Source.Exists)
            {
                throw new ApplicationException("Source directory does not exist: " + Source.FullName);
            }

            if (!LinkSource.Exists)
            {
                throw new ApplicationException("Link source directory does not exist: " + LinkSource.FullName);
            }

            if (Destination.Exists)
            {
                if (Destination.GetFileSystemInfos().Length > 0)
                {
                    throw new ApplicationException("Destination directory is not empty: " + Destination.FullName);
                }
            }
        }

        void Visit(DirectoryInfo src, DirectoryInfo lnk, DirectoryInfo dst)
        {
            if (!IsExcluded(src))
            {
                dst.Create();

                foreach (var file in src.GetFiles())
                {
                    try
                    {
                        if (!IsExcluded(file))
                        {
                            var lnkFile = Append(lnk, file);
                            if (IsSame(file, lnkFile))
                            {
                                // link
                                CreateHardLink(Append(dst, file).FullName, lnkFile.FullName, null);
                                Console.WriteLine("Linked: " + file.FullName);
                            }
                            else
                            {
                                // copy
                                file.CopyTo(Append(dst, file).FullName);
                                Console.WriteLine("Copied: " + file.FullName);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        // log and skip
                        Console.Error.WriteLine(e.Message + ": " + file.FullName);
                    }
                }

                foreach (var dir in src.GetDirectories())
                {
                    try
                    {
                        Visit(dir, Append(lnk, dir), Append(dst, dir));
                    }
                    catch (Exception e)
                    {
                        // log and skip
                        Console.Error.WriteLine(e.Message + ": " + dir.FullName);
                    }
                }
            }
        }

        bool IsExcluded(DirectoryInfo src)
        {
            return false;
        }

        bool IsExcluded(FileInfo src)
        {
            return false;
        }

        bool IsSame(FileInfo src, FileInfo lnk)
        {
            return src.Exists && lnk.Exists && (src.Name == lnk.Name) && (src.Length == lnk.Length) && (src.LastWriteTimeUtc == lnk.LastWriteTimeUtc);
        }

        // shortcut function
        private DirectoryInfo Append(DirectoryInfo dir, DirectoryInfo subdir)
        {
            return new DirectoryInfo(Path.Combine(dir.FullName, subdir.Name));
        }

        private FileInfo Append(DirectoryInfo dir, FileInfo file)
        {
            return new FileInfo(Path.Combine(dir.FullName, file.Name));
        }

        [DllImport("kernel32.dll")]
        extern static bool CreateHardLink(string file, string existingFile, object secAttr);
    }
}

Sep
28th
Mon
permalink

[Vim] Trials and errors on EscapeXmlSpecialChars()

1. This is not what I want.
function EscapeXmlSpecialChars()
  s/&/\&/eg
  s/</\&lt;/eg
  s/>/\&gt;/eg
  s/'/\&apos;/eg
  s/"/\&quot;/eg
endfunction
2. This does not work properly.
vnoremap <buffer> <LocalLeader>e :call EscapeXmlSpecialChars()<CR>

function EscapeXmlSpecialChars()
  s/\%V&/\&amp;/eg
  s/\%V</\&lt;/eg
  s/\%V>/\&gt;/eg
  s/\%V'/\&apos;/eg
  s/\%V"/\&quot;/eg
endfunction
3. This looks good :)
vnoremap <buffer> <LocalLeader>e "xx:call <SID>EscapeXmlSpecialChars()<CR>"xP

function s:EscapeXmlSpecialChars()
  let @x = substitute(@x, '&', '\&amp;', 'g')
  let @x = substitute(@x, '<', '\&lt;', 'g')
  let @x = substitute(@x, '>', '\&gt;', 'g')
  let @x = substitute(@x, "'", '\&apos;', 'g')
  let @x = substitute(@x, '"', '\&quot;', 'g')
endfunction

Aug
18th
Tue
permalink
碧いうさぎ
http://www.utamap.com/

碧いうさぎ

http://www.utamap.com/

Aug
15th
Sat
permalink

[Windows] Tests if hardlinks are to be cut by move, copy, xcopy, etc.

call :init
echo * link > log.txt
type _src\file.txt _dest\file.txt >> log.txt


call :init
echo * redirect >> log.txt
echo overwritten by redirect > _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * move >> log.txt
echo overwritten by move > _tmp\file.txt
move /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * copy >> log.txt
echo overwritten by copy > _tmp\file.txt
copy /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * xcopy >> log.txt
echo overwritten by xcopy > _tmp\file.txt
xcopy /y _tmp\file.txt _src
type _src\file.txt _dest\file.txt >> log.txt

call :init
echo * robocopy >> log.txt
echo overwritten by robocopy > _tmp\file.txt
robocopy _tmp _src file.txt
type _src\file.txt _dest\file.txt >> log.txt


call :init
del _src\file.txt
echo * del - redirect >> log.txt
echo overwritten by redirect > _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - move >> log.txt
echo overwritten by move > _tmp\file.txt
move /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - copy >> log.txt
echo overwritten by copy > _tmp\file.txt
copy /y _tmp\file.txt _src\file.txt
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - xcopy >> log.txt
echo overwritten by xcopy > _tmp\file.txt
xcopy /y _tmp\file.txt _src
type _src\file.txt _dest\file.txt >> log.txt

call :init
del _src\file.txt
echo * del - robocopy >> log.txt
echo overwritten by robocopy > _tmp\file.txt
robocopy _tmp _src file.txt
type _src\file.txt _dest\file.txt >> log.txt


rmdir _src _dest _tmp /q /s
exit /b

:init
rmdir _src _dest _tmp /q /s
mkdir _src _dest _tmp
echo linked > _src\file.txt
mklink /h _dest\file.txt _src\file.txt

Jul
31st
Fri
permalink

Dell Studio XPS 13 FAQ

Source: http://pc11.2ch.net/test/read.cgi/notepc/1238154140/

7 :[Fn]+[名無しさん]:2009/03/29(日) 00:12:19 ID:v0YeDT/G
【続き】【Dell Studio XPS 13 こと、Dell M1340 の 2009/03/29 時点での 内容無保証 FAQ まとめ】

・BTO で SSD を選択すると搭載されるのは何?
→ 確認できた範囲では、Samsung 製 MMDOE28G5MPP (MLCタイプ)の SSD など、但し、明示がないので他のに変わる可能性十分あり。

・液晶の反射、映りこみはどう?
→ 周りが明るかったり、壁紙が白っぽいと多少映りこむ。気になる人は、ノングレアタイプの液晶保護フィルム貼ったらよいかも。
どの製品がジャストサイズかは、まだ報告無し。推奨製品あればヨロシク。

・WLED液晶にすると、内蔵の Webカメラが 130万画素になる。通常液晶だと 200万画素。

・光学ドライブに、CD や DVD メディアを読み込ませるとバキバキ音がするんだけど?
→ 多少音がするのは、仕様です。あまりひどい時はサポートに相談。

・底面のゴムパットの高さが一律じゃなくて、がたつくんだけど?
→ ハズレの固体の可能性あり。スペーサーかましたり、押したりして矯正して対処している人あり。あまりひどい時はサポートに相談。

・バッテリーを外すと戻しにくい。バッテリーをロックするラッチが戻らない。
→ ほぼ仕様。無理やり力ずくで戻している人が多い模様(w

・どこで製造しているの?
→ デルが日本国内で販売している製品は、中国東南部の福建省・厦門(アモイ)にある CCC (China Customer Center)で生産。
ttp://www1.jp.dell.com/content/topics/segtopic.aspx/publicity/ccc?c=jp&l=jp&s=corp

・どうやって運んでいるの?
→ 中国工場から日本へは通常は船便。国際輸送だけで1週間程度は、かかる模様。ごく稀に航空便の場合あり。さらに日本国内輸送に1-2日。

・生産にはどれくらいかかるの?
→ 通常は2-3日。それ以上かかっている場合は、キャンペーンなどでよほど注文数が多いか、部品の欠品や製造工程上のトラブルと思われ。

・パームレストとか天板に指紋や手の脂の汚れがつきやすい。
→ 仕様です。まぁ、気にするな。拭けばとれる。但しキーボード上部のタッチパネルのあたりを気合入れて拭くと、静電気でセンサー誤作動の可能性あり。

・空冷ファンの音はうるさい?
→ 近くでエアコンとかが稼動していれば気にならないレベル。

・HDD の音はうるさい?
→ 搭載している HDD メーカーによる。HGST社製なら静かな模様。Samsung 製は、たまに「カチッ」とかいうらしい。

・DVD とか CD メディアはどうやって排出するの?
→ キーボード右上にある三角形のマークを押す。

・納期が遅いんだけど?
→ メールやチャット、電話で聞きましょう。
2009/3月下旬現在、部品不足(液晶とかACアダプタとか諸説あり)で納期が伸び気味の模様。
Dell の BTO は、Web でオーダーした後は、ちゃんと決済できたか、工場に製造指示が出たかなどを確認した方がよさげ。

・延長保証には入ったほうが良い?
→ 入ったほうがよさげ。後から延長は高くつく。最初から入っといたほうが無難。

・Windows XP は動く?
→ 公式にはもちろん無サポート。
一応動くけど、デバイスドライバとかは揃わない可能性アリ。
Windows XP で動くこと重視なら、他のモデルの方がよさげ。

Dec
3rd
Wed
permalink
Dec
1st
Mon
permalink

[memo] memory to buy

1024MB DDR2 SO-DIMM (PC4200 / 1024MB×1)

Nov
12th
Wed
permalink