bundleに外部アクセス時にはproxyサーバーを使用する設定します。
コマンドプロンプト画面よりhttp,httpsのproxyサーバーを設定します。
http_proxy="http://192.168.1.1:8080" https_proxy="http://192.168.1.1:8080"
これで同じように
bundle install
bundleコマンドが使用できます。現在proxy環境下で開発しているので、これができると便利です。
http_proxy="http://192.168.1.1:8080" https_proxy="http://192.168.1.1:8080"
bundle install
<div id="top"></div> <button class="btn" ng-click="jumpTo('top')" type="button">先頭へ</button>
$scope.jumpTo = function (id) { $location.hash(id); $anchorScroll(); }
$ bundle install --local Could not find mysql2-0.3.11 in any of the sources Run `bundle install` to install missing gems.
$ gem install mysql2 -v 0.3.11 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/xxxx/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes ...
$ brew update
$ cd /usr/local
$ brew versions mysql
5.6.12 git checkout ba37612 Library/Formula/mysql.rb
5.6.10 git checkout 48f7e86 Library/Formula/mysql.rb
5.5.29 git checkout 336c976 Library/Formula/mysql.rb
5.5.28 git checkout 5825f62 Library/Formula/mysql.rb
5.5.27 git checkout 93aecfa Library/Formula/mysql.rb
...
$ git checkout 336c976 Library/Formula/mysql.rb
$ brew install mysql
==> Downloading http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.29.tar.gz/from/http://cdn.mysql.com/
curl: (7) couldn't connect to host
Error: Download failed: http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.29.tar.gz/from/http://cdn.mysql.com/
$ brew install mysql55 ==> Downloading http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.30.tar.gz ######################################################################## 100.0% ==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql55/5.5.30 -DMYSQL_DATADIR=/usr/local/var/mysql55 -DINSTALL_MAN ==> make ==> make install ==> /usr/local/Cellar/mysql55/5.5.30/bin/mysql_install_db --verbose --user=xxxx --basedir=/usr/local/Cellar/mysql If you are using a binary release, you must either be at the top level of the extracted archive, or pass the --basedir option pointing to that location. READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
# Allow you to route based on whether a scope is *not* authenticated. # You can optionally specify which scope. # # unauthenticated do # as :user do # root :to => 'devise/registrations#new' # end # end #
brew install libevent --universal
$brew install redis dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid ==> Downloading http://redis.googlecode.com/files/redis-2.6.14.tar.gz ######################################################################## 100.0% ==> make -C /private/tmp/redis-t51l/redis-2.6.14/src CC=cc ==> Caveats To have launchd start redis at login: ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents Then to load redis now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist Or, if you don't want/need launchctl, you can just run: redis-server /usr/local/etc/redis.conf ==> Summary /usr/local/Cellar/redis/2.6.14: 9 files, 760K, built in 10 seconds
$redis-server /usr/local/etc/redis.conf [80525] 03 Jul 16:45:20.844 * Max number of open files set to 10032 _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.6.14 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 80525 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [80525] 03 Jul 16:45:20.846 # Server started, Redis version 2.6.14 [80525] 03 Jul 16:45:20.846 * The server is now ready to accept connections on port 6379
$ redis-cli redis 127.0.0.1:6379>
var marker = new OpenLayers.Marker(lonLat, icon); marker.id = uid; //ここで設定 marker.events.register('mousedown', marker, showMessages);
showMessages = function(evt) { if (this.id == "uid") { } OpenLayers.Event.stop(evt); };
angular.module('myApp.controllers', []). controller('mainCtrl', ['$rootScope', '$scope', function($rootScope, $scope) { var date = {"id": 1, "text": "メッセージです"} $rootScope.$broadcast('messageBroadcast',data); }]). controller('subCtrl', ['$scope', function($scope) { $scope.$on('messageBroadcast', function(event,data) { $scope.message = data; }); }]);
var marker = new OpenLayers.Marker(lonLat, icon); marker.events.register('mousedown', marker, $scope.showDialog);
$scope.showDialog = function(evt) { $scope.openDialog(); $rootScope.$apply(); //これ大切!!! OpenLayers.Event.stop(evt); };
$(document).ready( function() { $("#inputText").focus() });
<input type="text" id="inputText" nc-init-focus>
angular.module('myApp.directives', []). directive('ncInitFocus', [function() { var timer; return function(scope, elm, attr) { if (timer) clearTimeout(timer); timer = setTimeout(function() { elm.focus(); elm.select(); }, 0); }; }]);
<%load_javascript %>
module ApplicationHelper def load_javascript if Rails.env.production? javascript_include_tag 'application' else javascript_include_tag 'application', 'devVars' end end end
<input class="inputSellName" type="text" name="inputSellNameForm" placeholder="営業" autocomplete="off" ng-model="project.sell.name" ng-change="changeId()" required typeahead="sell.name for sell in sells | filter:$viewValue " typeahead-editable="false">
public class Model { public int number = 0; public string message = ""; public EventHandler toChange; public void addOne() { number = number + 1; message = "number has changed to " + number.ToString(); toChange(this, null); } }
public partial class Form1 : Form { public Model model; public Controller controller; public Form1() { InitializeComponent(); } public void render(object sender, EventArgs e) { this.label1.Text = model.number.ToString(); this.label2.Text = model.message; } private void button1_Click(object sender, EventArgs e) { controller.addOne(); } }
public class Controller { public Model mode; public Form1 view; public void addOne() { mode.addOne(); } }
[STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 view = new Form1(); Controller controller = new Controller(); Model model = new Model(); view.controller = controller; view.model = model; controller.view = view; controller.mode = model; model.toChange += new System.EventHandler(view.render); Application.Run(view); }
gem "therubyracer" gem "less-rails" gem "twitter-bootstrap-rails"3つのパッケージを使用するように記述。gem "twitter-bootstrap-rails"だけだとエラーが発生する。
cannot load such file -- less (in ~/app/assets/stylesheets/bootstrap_and_overrides.css.less)
{{ '2012-04-01' | date:'d MMM yyyy' }} convert -> 31 Mar 2012
var date = new Date($scope.transDate); date.setHours(date.getHours() + 9); $scope.transDate = date;
bundle install Fetching source index from https://rubygems.org/ Resolving dependencies... Network error while fetching https://rubygems.org/quick/Marshal.4.8/rails-4.0.0.beta1.gemspec.rz
bundle install --local Resolving dependencies... Could not find gem 'rails (= 4.0.0.beta1) x86-mingw32' in the gems available on this machine.
rails new foo --skip-bundle
public class LocalDatastoreTest { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } }
@Before public void setUp() { helper.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo")); helper.setUp(); } }
//親クラス @PersistenceCapable public class Parent { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName="datanucleus", key="gae.pk-id", value="true") private Long keyId; @Persistent(mappedBy = "parent") private Listchildren; public Parent() { } } //子クラス @PersistenceCapable public class Child { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private Parent parent; public Child() { } }
Gson gson = new Gson(); gson.toJson(parent);
@you_and_i
さんによるスクラムワークショップに参加した。//BaseController function BaseController($scope) { //ベースコントローラー } //Controller1 function Controller1($scope,$injector) { //継承されたコントローラー $injector.invoke(BaseController, this, {$scope: $scope}); } BaseController.prototype = Object.create(Controller1.prototype);
app/ --> all of the files to be used in production css/ --> css files app.css --> default stylesheet img/ --> image files index.html --> app layout file (the main html template file of the app) index-async.html --> just like index.html, but loads js files asynchronously js/ --> javascript files app.js --> application controllers.js --> application controllers directives.js --> application directives filters.js --> custom angular filters services.js --> custom angular services lib/ --> angular and 3rd party javascript libraries angular/ angular.js --> the latest angular js angular.min.js --> the latest minified angular js angular-*.js --> angular add-on modules version.txt --> version number partials/ --> angular view partials (partial html templates) partial1.html partial2.html config/testacular.conf.js --> config file for running unit tests with Testacular config/testacular-e2e.conf.js --> config file for running e2e tests with Testacular scripts/ --> handy shell/js/ruby scripts e2e-test.sh --> runs end-to-end tests with Testacular (*nix) e2e-test.bat --> runs end-to-end tests with Testacular (windows) test.bat --> autotests unit tests with Testacular (windows) test.sh --> autotests unit tests with Testacular (*nix) web-server.js --> simple development webserver based on node.js test/ --> test source files and libraries e2e/ --> runner.html --> end-to-end test runner (open in your browser to run) scenarios.js --> end-to-end specs lib/ angular/ --> angular testing libraries angular-mocks.js --> mocks that replace certain angular services in tests angular-scenario.js --> angular's scenario (end-to-end) test runner library version.txt --> version file unit/ --> unit level specs/tests controllersSpec.js --> specs for controllers directivessSpec.js --> specs for directives filtersSpec.js --> specs for filters servicesSpec.js --> specs for services
'use strict'; /* jasmine specs for controllers go here */ describe('MyCtrl1', function(){ var myCtrl1; beforeEach(function(){ myCtrl1 = new MyCtrl1(); }); it('should ....', function() { //spec body }); }); describe('MyCtrl2', function(){ var myCtrl2; beforeEach(function(){ myCtrl2 = new MyCtrl2(); }); it('should ....', function() { //spec body }); });
npm config set https-proxy http://10.10.40.99:8080 ./scripts/test.sh
Starting Testacular Server (http://vojtajina.github.com/testacular) ------------------------------------------------------------------- INFO [testacular]: Testacular server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome INFO [Chrome 25.0 (Mac)]: Connected on socket id kOH8yR-070Vtb5m8pwXt Chrome 25.0 (Mac): Executed 5 of 5 SUCCESS (0.13 secs / 0.022 secs)
$.ajax( { url: "https://api.mongolab.com/api/1/databases/my-db/collections/my-coll/4e7315a65e4ce91f885b7dde?apiKey=myAPIKey", data: JSON.stringify( { "x" : 2 } ), type: "PUT", contentType: "application/json" } );
var url = 'https://api.mongolab.com/api/1/databases/my-db/collections/my-coll/'; var key = '?apiKey=myAPIKey'; var updateId = $scope.obj._id.$oid; delete $scope.obj._id; //これが必要? $http.put(url + updateId + key,$scope.obj).success(function(data) { });
function AppCtrl($scope, $filter) { var date = Date.now(); date = $filter('date')(date, "yyyy/MM/dd"); }
function listCtrl($scope) { $scope.data = [ {"date": "2013/12/31","no": "1","checked":"YES"}, {"date": "2013/12/31","no": "2","checked":"NO"} ]; }
<input type="checkbox" ng-model="journal.checked">
<input ng-false-value="NO" ng-model="journal.checked" ng-true-value="YES" type="checkbox" />
npm config set https-proxy http://10.10.40.99:8080これでホーム直下の.npmrcに設定される。
ruby -v ruby 2.0.0p0 (2013-02-24) [i386-mingw32]
gem update --system Latest version currently installed. Aborting.
http_proxy: http://hostname:port
gem update --system Updating rubygems-update Fetching: rubygems-update-2.0.3.gem (100%) Successfully installed rubygems-update-2.0.
gem update rake Updating installed gems Updating rake Fetching: rake-10.0.4.gem (100%) rake's executable "rake" conflicts with C:/Ruby200-x64/bin/rake Overwrite the executable? [yN] y Successfully installed rake-10.0.4 Parsing documentation for rake-10.0.4 Installing ri documentation for rake-10.0.4 Installing darkfish documentation for rake-10.0.4 Gems updated: rake
C:\DevKitとする。
\Devkit\devkitvars.bat Adding the DevKit to PATH...
gem install json --no-ri --no-rdoc Fetching: json-1.7.7.gem (100%) Building native extensions. This could take a while... Successfully installed json-1.7.7 Done installing documentation for json (0 sec). 1 gem installed
gem install rails --no-ri --no-rdoc Fetching: i18n-0.6.4.gem (100%) Successfully installed i18n-0.6.4 Fetching: multi_json-1.6.1.gem (100%) Successfully installed multi_json-1.6.1 Fetching: activesupport-3.2.12.gem (100%) Successfully installed activesupport-3.2.12 ・ ・
・
Fetching: rails-3.2.12.gem (100%) Successfully installed rails-3.2.12
29 gems installed
rails -v Rails 3.2.12でインストールしたバージョンが確認できる。
git config --global https.proxy 10.10.40.99:8080 git config --global http.proxy 10.10.40.99:8080こんな感じでターミナルから登録するとプロキシサーバーが指定できる。
Stardust:Node user$ node index.js Server has started. Request for /start received. Request received. About to route a request for /start Request for /favicon.ico received. Request received. About to route a request for /favicon.ico
var handle = {} handle["/"] = requestHandlers.start; function route(handle) { if (typeof handle[0] === 'function') { handle[0](); ---> ここのこと! } else { console.log("No request handler); } }
Stardust:Node user$ node index.js Server has started. Request for /start received. Request received. About to route a request for /start Request handler 'start' was called. Request for /favicon.ico received. Request received. About to route a request for /favicon.ico No request handler found for /favicon.ico
Request for / received. Request received. About to route a request for / Request handler 'start' was called. Request for /favicon.ico received. Request received. About to route a request for /favicon.ico No request handler found for /favicon.ico
function start(route, handle) { function onRequest(request, response) { var pathname = url.parse(request.url).pathname; console.log("Request for " + pathname + " received."); console.log("Request received."); route(handle,pathname,response); response.end(); ---> これだ!これがダメだった。 } http.createServer(onRequest).listen(8888); console.log("Server has started."); }
Stardust:~ user$ node -v v0.8.22
Stardust:Node user$ node helloworld.js Hello World
ERROR The requested URL could not be retrieved
Stardust:~ user$ netstat -a -p tcp -L Current listen queue sizes (qlen/incqlen/maxqlen) Listen Local Address 0/0/128 *.ddi-tcp-1 0/0/50 *.cslistener 0/0/50 *.ndmp 0/0/50 *.9980 0/0/50 localhost.intu-ec-svcd 0/0/100 *.61307 0/0/128 *.49181 0/0/128 *.49181 0/0/128 localhost.ipp 0/0/128 localhost.ipp
ddi-tcp-1 8888/tcp # NewsEDGE server TCP (TCP 1)
/Users/user/Documents/Aptana Studio 3 Workspace/Node/index.js:3 server.start(); ^ ReferenceError: server is not defined at Object.(/Users/user/Documents/Aptana Studio 3 Workspace/Node/index.js:3:1) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:245:9)