Tumgik
tecmori-blog · 10 years
Quote
SELECT id WHERE tables WHERE id IN (4, 1, 2) ORDER BY FIELD(id, 4, 1, 2);
mysqlでWHERE IN句で指定した順にORDER BYする方法 | ueblog IN句で指定した順番で、並び替えをするクエリ FIELD関数をORDERBYに使う
0 notes
tecmori-blog · 10 years
Quote
PowerShellを使ってのWindows 形式の改行コード (CRLF) とUNIX形式の改行コード (LF) の相互変換の方法です。 Windows形式→UNIX形式 [string]::Join("`n",(Get-Content .\winText.txt)) | Set-Content .\unixText.txt UNIX形式→Windows形式 [string]::Join("`r`n",(Get-Content .\unixText.txt)) | Set-Content .\winText.txt
PowerShell Windows形式⇔UNIX形式でのテキスト出力(改行コード調整) - YOMON8.NET PowerShellで作成してたLinux用のShellファイルで改行コードで詰んでた。 これで回避した
0 notes
tecmori-blog · 10 years
Text
SeleniumIDEでBasic認証のIDパスワードを自動入力
FireFoxのSeleniumIDEにて
コマンド
open
対象
http://b_id:[email protected]/
※b_idにはBasic認証のIDを記述
※b_passにはBasic認証のパスワードを記述
http://ベーシック認証部(IDとPassはコロンで区切る)実URLへは@マークでセパレートする
0 notes
tecmori-blog · 10 years
Quote
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions") $json = "{a:1,b:2,c:{nested:true}}" $ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer $obj = $ser.DeserializeObject($json)
Read Json Object in Powershell 2.0 - Stack Overflow PowerShellでJSON
0 notes
tecmori-blog · 10 years
Link
正直、PowerShellの演算子系はゴミだとおもう。 ゴミとレッテル貼ってはいけないのだが、演算子は多くの言語と体裁を合わせるべきだろう。と文句を言っても仕方ないので、このページは良き、チートシートとして活用させていただく
0 notes
tecmori-blog · 10 years
Quote
I had same problem and found a solution: click on link that opens the new tab add command waitForPopUp set focus to new tab via command selectPopUp make your verifications or other commands regarding to your content in new tab use command close to close tab use command selectWindow to set focus to the old window Screenshot of my Selenium IDE commands: That works for me.
firefox - Close a newly opened tab or window in Selenium IDE - Stack Overflow IDEでPopUpにフォーカスを移す方法
0 notes
tecmori-blog · 10 years
Quote
Homebrewをアンインストールする デフォルト設定で使っている場合は、下記を実行してHomebrewをアンインストールする。 $ brew doctor $ brew update $ git clone https://gist.github.com/1173223.git $ cd 1173223/ $ chmod u+x uninstall_homebrew.sh $ sh ./uninstall_homebrew.sh 必要に応じて、さらに下記を実行する。 $ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup [参考URL] How do I uninstall Homebrew?
いつか見た惑星: Homebrewをアンインストールする
0 notes
tecmori-blog · 10 years
Link
PowerShellでプロトタイプベースのOOPするためのサンプル
0 notes
tecmori-blog · 10 years
Link
PowerShellでCSVデータをグルーピングとサマリーするコード
0 notes
tecmori-blog · 10 years
Quote
バッチファイルに次のように書いちゃえばいいんです。 powershell -executionPolicy RemoteSigned -F .\◯◯.sl ◯◯.slは実際に実行するスクリプトファイル名。
powershellスクリプトを管理者権限なしで実行 - その時々 権限がないってのはふべんだなぁ… バッチファイルから関節呼び出しさせるか…
0 notes
tecmori-blog · 10 years
Quote
 スクリプト・ファイルが保存されている場所(もしくはスクリプト・ファイルを入手した経路)によって、ローカル・スクリプトと非ローカル・スクリプト(インターネット経由で入手したスクリプト)という2種類がある。  ローカルのスクリプトとは、ローカルの(物理的な)ハードディスク上に保存されているスクリプトを指す。例えばC:がローカルのHDDの場合、これらの上に保存されている「C:\MyScript\testps.ps1」というファイルはローカルのスクリプトとみなされる。ただしネットワーク・ドライブをローカルにマップしている場合、そのドライブもローカルとみなされる。また「\\server1\user1\MyScript\testps.ps1」のように、単一ラベルのコンピュータ名(ドメイン名を持たない、単一のコンピュータ名)から始まるUNCパスのファイルも、ローカルとして扱われる。
PowerShellスクリプトの実行セキュリティ・ポリシーを変更する - @IT RemoteSigned  権限がイントラ内で運用目的ならRemoteSignedがベストである ということになりますな
0 notes
tecmori-blog · 10 years
Quote
うーん、スクリプトが実行されるのではなく、メモ帳で開かれました。これは興味深いですが、思い描いていた動作とは異なりますね。ちょっと待ってください。皆さんは、「そうか、わかっ���ぞ。きっと、Windows PowerShell を実行しないと Windows PowerShell スクリプトを実行できないのだろう。なるほど、それなら納得がいく。」とお考えですね。これを踏まえて、Windows PowerShell を起動し、コマンド プロンプトで .PS1 ファイルのパスを入力し、Enter キーを押して、魔法が起こるのを待つのですね。しかし、残念ながら、結果は次のようになります。 スクリプトの実行がシステムで無効になっているため、ファイル C:\scripts\test.ps1 を読み込めません。詳細については、「get- help about_signing」と入力してヘルプを参照してください。 発生場所 行:1 文字:19 + c:\scripts\test.ps1 
Windows PowerShell スクリプトを実行する Fuck!
0 notes
tecmori-blog · 10 years
Quote
※ファイル:FileConvert.ps1     # スクリプト・ファイルのパラメータを宣言(先頭から「変換対象のフォルダ」     # 「変換後のファイルの保存先」「変換前の文字コード」「変換後の文字コード」) param(   [String]$in = "c:\tmp\convert",   [String]$out = "c:\tmp\converted",   [String]$from = "Shift-JIS",   [String]$to = "EUC-JP" )     # 引数$from、$toから、文字コードを表すEncodingオブジェクトを生成 $enc_f = [Text.Encoding]::GetEncoding($from) $enc_t = [Text.Encoding]::GetEncoding($to)     # 与えられたパス(c:\tmp\convert)から合致するファイルリストを再帰的に取得   Get-ChildItem $in -recurse |     # 取得したファイルを順番に処理     ForEach-Object {     # 取得したオブジェクトがファイルの場合のみ処理(フォルダの場合はスキップ)       if($_.GetType().Name -eq "FileInfo"){     # 変換元ファイルをStreamReaderオブジェクトで読み込み         $reader = New-Object IO.StreamReader($_.FullName, $enc_f)     # 保存先のパス、保存先の親フォルダのパスを生成         $o_path = $_.FullName.ToLower().Replace($in.ToLower(), $out)         $o_folder = Split-Path $o_path -parent     # 保存先のフォルダが存在しない場合にフォルダを自動生成         if(!(Test-Path $o_folder)){           [Void][IO.Directory]::CreateDirectory($o_folder)         }     # 保存先ファイルをStreamWriterオブジェクトでオープン         $writer = New-Object IO.StreamWriter($o_path, $false, $enc_t)     # 変換元ファイルを順に読み込み、保存先ファイルに書き込み         while(!$reader.EndOfStream){$writer.WriteLine($reader.ReadLine())}     # ファイルをすべてクローズ         $reader.Close()         $writer.Close()       }     }
PowerShellで複数のファイルの文字コードを一括変換する - @IT 文字コード変換ソースコード(実務の参考にする)
0 notes
tecmori-blog · 10 years
Quote
def setup @ff_profile = Selenium::WebDriver::Firefox::Profile.new # ダウンロードするファイルの保存先フォルダが指定してあればそれを使う @ff_profile['browser.download.useDownloadDir'] = true # ダウンロードするファイルの保存先フォルダを指定 # 0:デスクトップ # 1:ダウンロードフォルダ # 2:ダウンロードに指定された最後のフォルダ @ff_profile['browser.download.folderList'] = 2 # ダウンロードダイアログを見せないようにする @ff_profile['browser.download.manager.showWhenStarting'] = false # ダウンロードフォルダ @ff_profile['browser.download.dir'] = '/home/footprint/' # 指定したmimeタイプは有無を言わさずダウンロードする @ff_profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/plain, application/vnd.ms-excel, text/csv, application/zip, text/comma-separated-values, application/octet-stream' @driver = Selenium::WebDriver.for :firefox, :profile => @ff_profile @base_url = "http://d.hatena.ne.jp" @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @verification_errors = [] end
 Selenium IDEで生成したテストケースでファイルをダウンロードする - FOOTPRINTの日記 ダウンロードダイアログのやり方がわからんかった
0 notes
tecmori-blog · 10 years
Link
0 notes
tecmori-blog · 10 years
Link
結局何がどうで、何が今使えるの?ってところを解説してくれているのがありがたい。
0 notes
tecmori-blog · 10 years
Quote
WEB 標準の考え方から言うと、これはセマンティック的に好ましい DIV 要素の使い方ではありません。通常、単に視覚効果の目的のために空の div を使うべきではない、とされているからです。ただし例外もあります。たとえば、チュートリアル教材として使う場合です(笑)
D3 入門 : DIV要素の描画 - スコット・マレイ - alignedleft 視覚効果目的のために空divは使わないこと
0 notes