Windows で Python
イシュー
- sails-postgresql のインストールにPythonが必要
参考
- Our Downloads | Python.org
- Python 2.7.8 をインストール
- Windowsへのインストール — Python製ドキュメンテーションビルダー、Sphinxの日本ユーザ会
- http://www.pythonweb.jp/install/
- Python for Windows インストールメモ
build-error
- VCBuild を入れないと、、(完全にローカル環境動作確認用だな、、)
MSBUILD : error MSB3428: Visual C++ コンポーネント "VCBuild.exe" を読み込めませんでした。この問題を解決するには、次のいずれかを行ってください。 1) .NET Framework 2.0 SDK インストールする。 2) Microsoft Visual Studio 2005 をインストールする。 3) その他の場所にインストールされている場合、コンポーネントの場所をシステム パスに追加する。 [C:\Users\magnet88jp\Workspace\sails-sb4\node_modules\sails-postgresql\node_modules\pg\build\binding.sln] gyp ERR! build error gyp ERR! stack Error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
failed with exit code: 1
参考
Blogにテーブルを書く方法
イシュー
- テーブル書きたいけど、htmlもmarkdownもめんどくさい
参考
- Blogger に表 (テーブル) を載せる方法 ~ SAKU-LOG
- コピペかな
- Blogger で表を書く方法 | クリボウの Blogger Tips
- Real_TY: Google Blogger で簡単に表(テーブル)を埋め込むには?
- HTMLテーブルをWeb上GUIで簡単作成「TABLE EDITOR」が便利すぎる - Fluffy white croquis
- ブログに表を組み込みたい!表テーブルなどが作れるHTMLエディタ
どうやら
- コピペになりそう
Salesforce Tips
イシュー
- SalesforceのTipsまとめ
作成可能なカスタム項目数の制限にパッケージ分は含まない
- カウント対象はデフォルト(プリフィックスなし)パッケージってことだと思う。
- いざとなったらパッケージ化してしまえばカスタム項目の制限を超えられそう。
参考
- https://help.salesforce.com/apex/HTViewHelpDoc?id=faq_distribution_installing_why_do_the_custom.htm&language=ja
MD5ハッシュ値を取得する方法
参考
- https://help.salesforce.com/apex/HTViewSolution?id=000003698&language=en_US
- Basic認証とDigest認証のまとめと、Salesforceでの実現方法 - dackdive's blog
- [salesforce]apexでMD5ハッシュ値を取得するには – deferloader
メールアドレス形式
- Salesforceでチェックしているメールアドレスの形式
abcdefg.hijklmnopqrstuvwxyz!#$%&'*/=?^_+-`{|}~0123456789 補足: ドット「.」は、ローカルパートの最初及び最後でなければ利用可能です。
- メールアドレスの最大長は80文字です。
参考
https://help.salesforce.com/HTViewHelpDoc?id=code_email_service_address.htm&language=ja
https://help.salesforce.com/HTViewSolution?id=000001145&language=ja
- https://help.salesforce.com/HTViewHelpDoc?id=custom_field_types.htm&language=ja
行動通知
- 「行動(Event)」を登録した際にメールを送信することができる。
参考
- https://help.salesforce.com/apex/HTViewSolution?id=000193420&language=ja
キャンペーンの新規作成
- キャンペーンの新規作成ボタンを表示するには、プロファイルの権限だけではなく、ユーザの「マーケティングユーザ」チェックボックスにチェックが入っている必要がある。
参考
- SFDC:機能ライセンスについて - tyoshikawa1106のブログ
現在使用中のSalesforceのエディションを確認する方法
- html-titleを見る(タブブラウザだったら、タブのツールチップに表示される)
参考
- How to find out what salesforce edition you have? - Salesforce Developer Community
レコードタイプ
- レコードタイプのメソッドに、現在のユーザが利用可能か判別するメソッドが存在する( isAvailable() )
参考
NameSpaceを取得する方法
参考
Salesforceで zipファイル作成
- ApexだけでSalesforceの添付ファイルをZipしてダウンロード | Xgeek
- Processing Zip file in Apex code (Server side Zip processing) - Salesforce Stack Exchange
- Apex+JSZipでSalesforceの添付ファイルをZipしてダウンロード | Xgeek
- Redirect Page
- SFDC:VisualforceでつくったCSVファイルをダウンロードする処理の話 - tyoshikawa1106のブログ
Apache Apex
参考
Apexでクライアント(アクセス元)のIPアドレスを取得する方法
ipAddress = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');
参考
- HTTP Header Values for client IP Address - Salesforce Developer Community
- [salesforce]apexで自分のIPアドレスを取得するには – deferloader
- Get your Visitor’s IP address via sites – Afzal's Blog
Apexでクラスの一覧を取得
参考
項目レベルで参照のみにする
参考
- ヘルプ | トレーニング | Salesforce
- 「参照のみ項目の編集」権限が ON のプロファイルを割り当てられたユーザには、ページレイアウトで「参照のみ」とされている項目も、編集画面上では編集可能な項目として表示されます。
データインポートウィザードで登録できる項目数は90項目
- 以下のエラーメッセージでたので、インポート可能な項目数を調べてみた。
- 「インポートする項目が多すぎます。一部の項目の対応付けを解除してから、もう一度試してください。必要に応じて、複数のインポートを使用して項目を一括インポートしてください。」
SalesforceのIPレンジ
Salesforceの数式で改行を使う方法
SalesforceにdataloaderでAttachmentをインポートする方法
Salesforce のリード項目で都道府県と州を両方使いたいとき
windowsでnode.js
イシュー
- node.js をwindowsに入れる
参考
- Node.js と npm のインストール方法(Windows編) - Node塾
- node.js
- [node.js]windows環境にnpmをインストール | seiji-k on software
- node.jsとnpmをポータブルで使う(Windows版) | ウェブゴト
- Windows で Node.js を始める時のあれこれ - 弘法にも筆の誤り
- WindowsでNode.js(npm)触るならnodistを使うといいかもしれない
- node.jsをインストールしてみた(Windows) | Tips Note
- Windows に JSHintをインストールしてみた - かわちょでぶろぐ
- Windowsのローカル環境ではじめるnode.js + express – kazano.lab
Windows installer でいれるとnpmも入っている
C:\Users\magnet88jp\Workspace>node -v v0.10.30 C:\Users\magnet88jp\Workspace>npm -v 1.4.21 C:\Users\magnet88jp\Workspace>
Passport.js のお勉強
イシュー
- Passport.js を理解する
参考
- Passport | Overview
- Node.js+Express+Passportで認証情報をセッションに保存する方法 - Qiita
- passport-forcedotcom
- deferloader » [salesforce][heroku]OAuth2.0を利用したデータアクセス
- Jethro Kuan | Using Passport.JS with Sails.JS
- Sails.js + PassportでID/Password認証
- sailsで簡単にTwitterログインする - ┗┐<(՞ਊ՞)>┌┛
- Sample of using passport w/ mult strategies
- node.js+express+PassportでOAuth認証 - Tech-Sketch
- IdM実験室: Bearer Token とは?
- 【Node.js】OAuth認証でPassportが最強に使いやすい | creator note
- Building a Sails Application: Ep14 - User authentication and restricting access through policies. - YouTube
- OpenID 2.0 (Migration) - Google Accounts Authentication and Authorization — Google Developers
- node.jsのpassport-openidconnectを試す | 天上TENGA唯我独尊
- Using Passport for OAuth with Force.com - Developer Relations
- sforce rest api のサンプル
authenticate
Authenticate
Authenticating requests is as simple as calling passport.authenticate() and specifying which strategy to employ. authenticate()'s function signature is standard Connect middleware, which makes it convenient to use as route middleware in Express applications.
リクエストを認証することは passport.authenticate()を呼び出びだすことと、使用するstrategy を指定することであり、簡潔です。 authenticate()の関数シグネチャは、標準の接続ミドルウェアであり、Expressアプリケーションのroute middlewareと同じ様に使えて便利です。
app.post('/login', passport.authenticate('local'), function(req, res) { // If this function gets called, authentication was successful. // `req.user` contains the authenticated user. res.redirect('/users/' + req.user.username); });
By default, if authentication fails, Passport will respond with a 401 Unauthorized status, and any additional route handlers will not be invoked. If authentication succeeds, the next handler will be invoked and the req.user property will be set to the authenticated user.
デフォルトでは、認証に失敗した場合、Passportは401(不正なステータス)で応答し、いくつかの後続ルートハンドラが呼び出されません。認証が成功すると、次のハンドラが呼び出され、req.user プロパティに認証されたユーザ情報が設定されます。
Note: Strategies must be configured prior to using them in a route. Continue reading the chapter on configuration for details.
Note: Strategies(の設定)は、route内でそれらを使用する前に設定する必要があります。詳細については、設定に関する章を読んでください。
Redirects
A redirect is commonly issued after authenticating a request.
リダイレクトは、一般的に要求を認証した後に発行されます。
app.post('/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' }));
In this case, the redirect options override the default behavior. Upon successful authentication, the user will be redirected to the home page. If authentication fails, the user will be redirected back to the login page for another attempt.
この場合、リダイレクトのオプションはデフォルトの動作をオーバーライドします。認証に成功すると、ユーザーはホームページ(/)にリダイレクトされます。 認証に失敗した場合、ユーザーはさらに試みるためにログインページ(/login)へリダイレクトされます。
Flash Messages
Redirects are often combined with flash messages in order to display status information to the user.
リダイレクトは、多くの場合、ユーザにステータス情報を表示するためにフラッシュメッセージと組み合わされます。
app.post('/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login', failureFlash: true }) );
Setting the failureFlash option to true instructs Passport to flash an error message using the message given by the strategy's verify callback, if any. This is often the best approach, because the verify callback can make the most accurate determination of why authentication failed.
failureFlashオプションをtrueに設定すると、Passportは、strategy の検証によるコールバックによって与えられたメッセージを使用してエラーメッセージをフラッシュするように指示します。
検証によるコールバックは、認証が失敗した理由の最も正確な判定を行うことができるので、これは、多くの場合、最良のアプローチです。
Alternatively, the flash message can be set specifically.
もしくは、フラッシュメッセージを明示的に設定することができます。
passport.authenticate('local', { failureFlash: 'Invalid username or password.' });
A successFlash option is available which flashes a success message when authentication succeeds.
successFlashオプションは、認証が成功したときに成功メッセージをフラッシュすることができます。
passport.authenticate('local', { successFlash: 'Welcome!' });
Note: Using flash messages requires a req.flash() function. Express 2.x provided this functionality, however it was removed from Express 3.x. Use of connect-flash middleware is recommended to provide this functionality when using Express 3.x.
注:フラッシュ·メッセージを使用するには、req.flash()関数が必要です。この機能はExpress2.xで提供されていましたが、Express3.xからは削除されました。 Expressの3.xを使用する場合には、connect-flash middleware を使用することをお勧めします
Disable Sessions
After successful authentication, Passport will establish a persistent login session. This is useful for the common scenario of users accessing a web application via a browser. However, in some cases, session support is not necessary. For example, API servers typically require credentials to be supplied with each request. When this is the case, session support can be safely disabled by setting the session option to false.
認証が成功すると、Passport は、永続的なログインセッションを確立します。これは、ユーザがブラウザを経由してWebアプリケーションにアクセスする一般的なシナリオで有効です。 しかし、場合によっては、セッションのサポートは不要となります。例えば、APIサーバーは通常、それぞれのリクエストで認証を必要とします。この場合には、セッションオプションをfalseに設定することにより、セッションサポートを安全に無効化できます。
app.get('/api/users/me', passport.authenticate('basic', { session: false }), function(req, res) { res.json({ id: req.user.id, username: req.user.username }); });
Custom Callback
If the built-in options are not sufficient for handling an authentication request, a custom callback can be provided to allow the application to handle success or failure.
ビルトインのオプションが認証要求を処理するのに十分でない場合、アプリケーションが成功または失敗を処理できるように、カスタムのコールバックを提供できます。
app.get('/login', function(req, res, next) { passport.authenticate('local', function(err, user, info) { if (err) { return next(err); } if (!user) { return res.redirect('/login'); } req.logIn(user, function(err) { if (err) { return next(err); } return res.redirect('/users/' + user.username); }); })(req, res, next); });
In this example, note that authenticate() is called from within the route handler, rather than being used as route middleware. This gives the callback access to the req and res objects through closure.
この例では、authenticate() ルートミドルウェアとして使用されているよりも、むしろルートハンドラ内から認証が呼び出されることに注意してください。これはクロージャを通して req および res オブジェクトへのコールバックのアクセスを提供します。
If authentication failed, user will be set to false. If an exception occurred, err will be set. An optional info argument will be passed, containing additional details provided by the strategy's verify callback.
認証が失敗した場合、user(オブジェクト) はfalseに設定されます。例外が発生した場合は、err が 設定されます。オプションの info 引数が渡されます。それはstrategy の検証するコールバックによって提供される追加の詳細情報を含みます。
The callback can use the arguments supplied to handle the authentication result as desired. Note that when using a custom callback, it becomes the application's responsibility to establish a session (by calling req.login()) and send a response.
コールバックは、必要に応じて認証結果を処理するために指定された引数を使用することができます。カスタムコールバックを使用している場合は、(req.login()メソッドを呼び出して)セッションを確立し、応答を返すのは、アプリケーションの責任範囲になることに注意してください。
Grunt のタスクって何?
イシュー
- Gruntを理解する
参考
- Gruntで始めるWeb開発爆速自動化入門(1):ブラックなWeb開発現場の救世主、Gruntのインストールと使い方 (1/2) - @IT
- 今更だけどやるgrunt入門編・インストールから基本的な使い方|WEB Drawer
- 現場で使えるGrunt入門 - Gruntを試そう | CodeGrid
- 始めのサンプルの実行でなんとなくわかった。
- 現場で使えるGrunt入門 - Gruntを試そう | CodeGrid
- Web制作で面倒な作業を自動化するビルドツール、Grunt v0.4 入門|Web Design KOJIKA17
- Grunt入門 (全12回) - プログラミングならドットインストール
- コーダーさんの為のGrunt入門(前編)〜導入編 – Mach3.laBlog
- Gruntを使ってJSやCSSの面倒なタスクを自動化しよう | kudox.jp
- 自動化ツール「Grunt.js」について
- Gruntの基本的な使い方(grunt-contrib-uglifyで) - Qiita
- ビルドツールまとめ。Gruntとかgulpとか (フロント寄り) - Qiita
- 各種ビルドツールまとめ
- 主流はgulp、ember界隈は、broccoli
grunt のインストール
$ grunt -version -bash: grunt: command not found $ npm install grunt-cli npm WARN prefer global grunt-cli@0.1.13 should be installed with -g grunt-cli@0.1.13 node_modules/grunt-cli ├── resolve@0.3.1 ├── nopt@1.0.10 (abbrev@1.0.5) └── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11) $ npm install -g grunt-cli /Users/magnet/.nodebrew/current/bin/grunt -> /Users/magnet/.nodebrew/current/lib/node_modules/grunt-cli/bin/grunt grunt-cli@0.1.13 /Users/magnet/.nodebrew/current/lib/node_modules/grunt-cli ├── resolve@0.3.1 ├── nopt@1.0.10 (abbrev@1.0.5) └── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11) $ grunt -version grunt-cli v0.1.13 grunt v0.4.1 $
npm install の --save オプション
- --save を指定すると、package.json のdependenciesに追加される。
参考
GruntはJavaでいうAntみたいなもの
- Antでbuild.xml を書くように、Gruntで、Gruntfile.jsを書く
タスクの実行
- defaultって言うタスクを grunt.registerTaskで登録すると、「grunt default」で実行できる
- sails new した時に出来るGruntfile.js で、「grunt watch」コマンドを実行可能
sails grunt関連
gulp で gruntの複雑な部分を解消
- gulp.jsで始めるWeb開発爆速自動化入門:便利なGruntの弱点を補うgulp.jsのインストールと使い方 (1/3) - @IT
- 印象としては、そんな複雑なタスクを実行させるシチュエーションはないので、どっちでもよい
- デフォルトで用意されているタスクを実行する必要はないようにしたい。