LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Macbook System Setup

Macbook System Setup

Lesson 1

Pure Sass Setup

google sublimetext package control, https://packagecontrol.io/installation#st3 copy some code into the sublimetext console. Make sure intenet is stable and fast. 
          
Then command + p on mac or ctrl + shift + P and type install or remove package, you will see the list of package name you can install. 

Install sass, scss, sass build, emmet packages

Now install SASS - Sass comes as ruby gem, so need to install ruby. 
Once you have ruby, you run gem install sass. sass -v is to see the version 3.4.21 (Selective Steve)

ctrl + B or Tools -> build and choose SASS

ctrl + O to open

Setup folder project strucutre css/here put css file  scss/here put scss file,  html files. Notice if you write scss code and do ctrl = + B, it will build to css and put under the same folder. 
To build it into a different folder, Tools => new build system 

copy and paste this code:
// IMPORTANT: The file extension for this file must be .sublime-build 
// but Udemy does not allow uploading files with that extension.
// Make sure you use the correct extension.

{

  "cmd": ["sass", "--update", "$file:${file_path}/../css/${file_base_name}.css", "--stop-on-error", "--no-cache"],

  "osx":
  {
      "path": "/usr/local/bin:$PATH"
  },

  "windows":
  {
      "shell": "true"
  }

}
Name it to build to css or whatevery ou want

Make sure that new build system is selected in tool, now if you say ctrl + B, it will be built in the right folder. You can even build on save, just install a new package called sublimeonsavebuild

On Mac, command + k + B is to open or close the left file strucutre viewer section

ctrl + N to create new file
for partials, the buildonsave still builds the _file.scss to css, this is not right, we don't want that. How to avoid that? GO to prefence -> Package Setup -> SublimeOnSaveBuild -> setting user 
{
    "filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(css|js|sass|less|scss)$",
    "build_on_save": 1
}

Cloud Coding Platform Setup

If you don't want to mess up your computer's console while going through the examples in this book, you can set up a server using one of many online cloud services or set up your own virtual machine. The following are some of the available options:

  1. Sign up for a service that provides a full, in-browser development environment, such asNitrous or Cloud 9. Once you've set up one of these accounts, you can ignore everything except the terminal or console. We recommend this option if you're new to the command line, as it takes the least amount of effort to set up.
  2. Use Rackspace or Digital Ocean to set up a managed server that provides console access. For this option, you'll need a little bit of experience with servers.
  3. Set up a virtual machine on your computer. You can use Virtualbox, VMWare, Vagrant,Docker, or a combination of these. Setting up a virtual machine is out of the scope of this book, but a quick Google search should be enough to get you going. You should have a lot of hands-on experience with configuring software and in-depth knowledge of computers before taking this option.

Set Your Editor Indentation

While Ruby is an expressive language, one of the most stringent style rules all Rubyists observe is using 2 spaces for code indentation. Not tabs, not 3 spaces, not 4 spaces - strictly 2 spaces.

Take time now to set your editor to turn all tabs into 2 spaces.

For example, in Sublime Text 3, Go to Preferences -> Settings - User. This should open a settings window named Preferences.sublime-settings , and you can put this at the bottom of the file:

"tab_size": 2,
"translate_tabs_to_spaces": true

The first line sets all tabs to 2 spaces wide. The second line turns tab into spaces. It's very important to set this. Note that the settings are comma delimited, so if you put the above two lines in the middle of the file, you'll need to end the last line with a comma.

If you're not using Sublime Text, below are instructions on how to update your tab settings in various editors:

  • Vim:

In ~/.vimrc

set tabstop=2
set shiftwidth=2
set expandtab
  • Nano:

In ~/.nanorc

set tabsize 2
set tabstospaces
  • Textmate:

http://superuser.com/questions/416004/how-to-adjust-indentation-in-textmate

  • Emacs:

In ~/.emacs

(setq default-tab-width 2)
(setq-default indent-tabs-mode nil)

Note that sometimes it's not possible to visually see whether a tab is a tab character or spaces. You have to turn on "show whitespace characters" in your editor to visually see if it's a space character or some other whitespace character.

Make sure that when you hit the "tab" key, your editor generates 2 space characters. (not a tab character that's 2 spaces wide, not 3 spaces, etc).



----------------------------------------------------------------------------------------

https://gorails.com/setup/osx/10.11-el-capitan

http://installrails.com/

How to install rails using InstallRails.com (internally it leads to railsinstaller.com)

We've created InstallRails.com so that you can get up and running with Rails. Head over there and choose the steps that best match your operating system settings.

We recommend either Mac (at least above 10.6) or Windows. And we recommend that you are using the Google Chrome Browser - as it will make debugging easier for you along down the line.

Come back here once you have Rails successfully installed!

Ready to install Ruby on Rails like a BOSS? Click the button below to start.

--------------------------------------------------

You just factory reinstall MacOS X Mountion Lion 10.8.5

You need to developer Rails app. What to do?

-1: learn how to right click

how to command + m and command + tab

learn how to install dmg file

three finger drag

command + c and command + v

http://osxdaily.com/2013/03/22/5-simple-window-management-keyboard-shortcuts-to-improve-workflow-in-mac-os-x/

how to open your terminal right from your folder?

system preferece -> keyboard -> Keyborad shotcuts -> service -> check "new terminal at foler"

Now you can right click your destination folder and say new terminal at folder

0. fix some trackpad issues in system -> preference and trackpad. Some options are disabled also need to fix the 3 finger dragging -> Preference -> Accessibility -> enable draiing as 3 finger dragging

1 install CCClearner

2 intall Chrome

3. Why need Xcode for rails?

http://superuser.com/questions/449965/why-does-xcode-have-anything-to-do-with-installing-rails

The native extension is some C code that's included inside the Ruby gem that calls the external component's API, converting the parameters and return values between the format the external library needs and what the Ruby interpreter expects.

The Xcode installer package contains all the developer tools for OS X. Without Xcode installed, you don't have a C/C++/Objective-C compiler installed. When you install Xcode, it installs GCC and Clang-LLVM, and many other developer tools, including most of the GNU toolchain, make, etc.

If you got simulator cannot be opened message, check two things
1) some app cannot be opened, meaning some app not identitied by app, app only allows appstore app to run. 
https://www.youtube.com/watch?v=52gnXsFc3yc
in terminal 
sudo spctl --master-disable
then go to system preferece and make sure allow everywhere is chosen

2) https://stackoverflow.com/questions/39169111/xcodes-ios-simulator-cannot-be-opened
 
I got the same error message on macOS 
10.12.6 with Xcode 9.0 when trying to 
run the Simulator directly without 
opening Xcode, i.e, clicking on a 
Simulator icon that was dragged to 
the dock. simulator dock icon

The solution was to open Xcode from 
the launchpad. It then presented a 
dialog announcing that additional 
components need to be installed. Once 
the install finished the Simulator 
app could be run without errors 
again.
        
try launching simulator from xcode app -> right click open app content, go to developer -> application -> simulator

4. how to remove guest login (may have to do with find mac on cloud)

http://apple.stackexchange.com/questions/85046/how-to-remove-guest-option-from-login-screen

5. setup rails env on mac (railsinstaller has only older version for MacOS)

http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/

http://www.createdbypete.com/articles/ruby-on-rails-development-setup-for-mac-osx/

A. you install brew

in terminal, type ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"

the above is for MacOs, for linux, you have something like this:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

then you run

brew doctor

it says:

brew doctor

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry and just ignore them. Thanks!

Warning: Git could not be found in your PATH.

Homebrew uses Git for several internal functions, and some formulae use Git

checkouts instead of stable tarballs. You may want to install Git:

brew install git

Warning: No developer tools installed.

You should install the Command Line Tools.

The standalone package can be obtained from

https://developer.apple.com/downloads

or it can be installed via Xcode's preferences.

B. it means you need to install xcode

in appstore find the command line tool (xcode) for OS X Mountain Lion

now if you run brew doctor again, it says your system is ready to go

Daweis-MacBook-Pro:~ daweidai$ brew doctor

Your system is ready to brew.

C. install git

Daweis-MacBook-Pro:~ daweidai$ brew update (not needed, but good habit)

Initialized empty Git repository in /usr/local/.git/

remote: Counting objects: 243531, done.

remote: Total 243531 (delta 0), reused 0 (delta 0), pack-reused 243531

Receiving objects: 100% (243531/243531), 35.20 MiB | 1.89 MiB/s, done.

Resolving deltas: 100% (181169/181169), done.

From https://github.com/Homebrew/homebrew

* [new branch] gh-pages -> origin/gh-pages

* [new branch] go -> origin/go

* [new branch] master -> origin/master

HEAD is now at 5fe5107 mu: remove unrecognized configure switch

Already up-to-date.

Daweis-MacBook-Pro:~ daweidai$ brew install git

==> Downloading https://homebrew.bintray.com/bottles/git-2.3.5.mountain_lion.bot

######################################################################## 100.0%

==> Pouring git-2.3.5.mountain_lion.bottle.tar.gz

==> Caveats

The OS X keychain credential helper has been installed to:

/usr/local/bin/git-credential-osxkeychain

The "contrib" directory has been installed to:

/usr/local/share/git-core/contrib

Bash completion has been installed to:

/usr/local/etc/bash_completion.d

zsh completion has been installed to:

/usr/local/share/zsh/site-functions

==> Summary

/usr/local/Cellar/git/2.3.5: 1363 files, 32M

Daweis-MacBook-Pro:~ daweidai$

to verify, run:

git --version

shows a very old version like 1.8

brew doctor

Daweis-MacBook-Pro:~ daweidai$ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/bin occurs before /usr/local/bin

This means that system-provided programs will be used instead of those

provided by Homebrew. The following tools exist at both paths:

git

git-cvsserver

git-receive-pack

git-shell

git-upload-archive

git-upload-pack

Consider setting your PATH so that /usr/local/bin

occurs before /usr/bin. Here is a one-liner:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

Daweis-MacBook-Pro:~ daweidai$

git from homebrew is installed under /usr/local/bin/git. it needs to be BEFORE /usr/bin which is for the system softwares (test by which git)

close the terminal

restart the terminal

brew doctor -> your system is ready to brea

git --version shows the latest 2.3.5

D.configure for github

git config --global user.name "Dawei Dai"

git config --global user.email "shachopin@gmail.com"

Daweis-MacBook-Pro:~ daweidai$ which git

/usr/local/bin/git

Daweis-MacBook-Pro:~ daweidai$ git --version

git version 2.3.5

Daweis-MacBook-Pro:~ daweidai$ echo $PATH

/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Daweis-MacBook-Pro:~ daweidai$

vi ~/.gitconfig you will see your entry

now you can do git status, git add and git commit

Daweis-MacBook-Pro:FirstApp daweidai$ cd ~

Daweis-MacBook-Pro:~ daweidai$ pwd

/Users/daweidai

Daweis-MacBook-Pro:~ daweidai$ cd .ssh

-bash: cd: .ssh: No such file or directory

Daweis-MacBook-Pro:~ daweidai$ mkdir .ssh

Daweis-MacBook-Pro:~ daweidai$ cd .ssh

Daweis-MacBook-Pro:.ssh daweidai$ ssh-keygen -t rsa -C "shachopin@gmail.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/daweidai/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /Users/daweidai/.ssh/id_rsa.

Your public key has been saved in /Users/daweidai/.ssh/id_rsa.pub.

The key fingerprint is:

1e:6b:72:e3:eb:3f:52:c8:83:12:3d:8d:27:49:6f:c9 shachopin@gmail.com

The key's randomart image is:

+--[ RSA 2048]----+

| |

| . |

| o * . |

| . * E |

| . BS. |

| . ..+o. |

| .. *o |

| =... |

| .++.. |

+-----------------+

Daweis-MacBook-Pro:.ssh daweidai$

vi to that pub file

your public key is:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHAqd3tiOQf7Aaeyccf47tVv9qjll05J0C9VjOqFGvuTcOFOolTvIKy+SEE/nd7+3FfgFXYxs6epNqDZaS1FCm9cmBO1m9tsCBvf2J5wtShqAksOpuH5H4dZeld/6Hm44STEnxBuZK64x/SrdsfXXaAy1+9KLWAdH44KTOrRedm54N1vSox5swadGyCl0V3b/CJZdlPwGp5AJ4DKCeTXmJMwu5trGEa7toTzTD7Y6iB7ezQ8TWBRHWXF4rOCg/zEJwEvrPbJ2AhwTu+b/Elf1M5BIe6eOZEitxW56/fnd+9L6T2Jy8o7u5IuebMBlTF1gldZj9y578vYOIh09OGzyN shachopin@gmail.com

submit it to your github account

ssh -T git@github.com

to test

login successfully. Github recognizes you!

E. install sublime text

You install sublime text 3 Build 3083

http://olivierlacan.com/posts/launch-sublime-text-3-from-the-command-line/

Sublime Text 3 ships with a CLI called subl. By default you can't use this command line utility unless you do some fiddling.

A word about the load $PATH

The Sublime Text documentation on this tool does explain where it's located (/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl) but it assumes you have~/bin (or /Users/username/) in your load path ($PATH) which is downright silly. There's a better way.

The /usr/local/bin is in the load path by default on OS X, so it's a much better place to symlink (create a symbolic link - or shortcut) that will allow you to run the subl utility from your Terminal app.

First up, check your own $PATH by running: echo $PATH. This is what mine returns:

1

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

As you can see the /usr/local/bin path is included by default on OS X.

Installation

Note: These instructions assume you're using the Terminal app out of the box, without ZSH or any fancy prompts like that. I trust you will be able to adapt these instructions yourself if you do.

1

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

Yes, I name the symlink sublime instead of subl because I believe you should always be explicit. You should never have to type the full word anyway. Typing sub + Tab should auto-complete the full name of the symlink.

Testing

Open a Terminal window and run:

1

sublime ~/Documents

or

1

2

cd

sublime Documents/

or even

1

2

# to open the entire current directory

sublime .

Conclusion

Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your .bash_profile which the official instructions given by the Sublime team seems to recommend.

Have fun, Sublime is a great editor. Check out the most recent beta release of Sublime Text 3.

F install RVM

RVM has come a long way since I originally published this tutorial. As of March 30, 2013, you can now install the latest RVM, Ruby, and Rails in one step. However, because RVM installs documentation for every gem that Rails depends on, which takes forever, I recommend disabling documentation first:

1

echo "gem: --no-document" >> ~/.gemrc

Now you can install everything with one command. If you're not interested in Rails, just replace --rails with --ruby in the command below:

1

curl -L https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=enable --rails

Read the RVM installation documentation to see all the different options you can use.

This will take a few minutes, and once it's done, quit and relaunch Terminal, then run this command:

type rvm | head -1 <- this is one, not L

If you get rvm is a function, that means RVM was successfully installed.

That's what I got

Rvm -v shows 1.26.11

Ruby -v shows 2.2.1p85

Rails -v shows 4.2.1

Basic set up is done

Ruby Version Manager

By now, you're probably used to issuing this command in terminal to run your Ruby programs: ruby my_program.rb. This command executes the ruby program, and feeds it the my_program.rb file. You can further type ruby -v to see what version of Ruby you're running. It may be 1.9.3, or 2.1.2 or 2.2.0 or some other version. The types of programs you've been writing thus far will likely run correctly on any version.

But what if you had a program that only ran on, say, version 2.1.2? And what if you had a different program that only ran on version 1.9.3? You could uninstall and reinstall the appropriate Ruby version every time you're working with that program, but that would be a prohibitively expensive waste of time. You could also modify the $PATH variable manually every time to include the right Ruby, but that's also quite a hassle.

The solution is to use a Ruby version manager. The one that's easiest to use is rvm, and is what we recommend to beginners.

RVM overrides your system's default Ruby, and you'll have to re-install all the gems you had previously. Once you're in the world of RVM, you can install different Rubies, switch between them, and install gems for a specific Ruby. If you're ever confused about which Ruby you're using, just type which ruby from the command line. If the returned path contains a .rvm directory, then you're already using RVM. If it doesn't, then you haven't activated RVM yet.

Take time to study the RVM documentation and how to get started. Installing RVM now will make your Ruby journey smooth sailing going forward.

Note: if you're using a cloud-based development environment, like Nitrous or Cloud 9, it likely already comes with a Ruby version manager. Check their documentation to see which it comes with.

Alternatives

There are some alternatives to RVM. The most popular are:

  • rbenv : came after rvm and claims to be less intrusive, yet still functionally equivalent. Its setup and syntax is a little bit more complicated than RVM, but once you get used to it, it's very easy to use.
  • chruby : doesn't do much, but does its simple job.

We don't recommend either one of those to beginners, but if you're inclined, you can try these options as well. Note that you can only have one or the other -- they are mutually exclusive.

You marked this topic or exercise as complete

G install Heroku

http://sourabhbajaj.com/mac-setup/Heroku/README.html (good resource for installin other components on macos too. Like mysql, vagrant. This guy is awesome)

https://devcenter.heroku.com/articles/heroku-command (talking about how to uninstall if installed through brew)

brew install heroku-toolbelt

The formula might not have the latest version of the Heroku Client, which is updated pretty often. Let's update it now:

$ heroku update
Heroku --version shows 3.31.3, auto updated to 3.33.0 when doing heroku create

Login to your Heroku account using your email and password:

$ heroku login
 

Since you have already generated the key when setting up github

heroku keys:add

It says find a public key on your system, would you like to update it

Say 'Y'

Everything set up for heroku now. Now you can use the rest as normal

H. install Sqlite3 DB browser

It's very easy, just a file on your desktop

I.install ImageMagick

 brew install ImageMagick

ImageMagick ® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX , EXR , WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves

The BELOW IS NOT NEEDED ANYMORE:


29down voteaccepted

Do you have the RMagick gem included in your app on Heroku? It's necessary for interfacing between your Ruby code and ImageMagick.

ImageMagick is part of the Heroku platform by default, but you have to specify that you need the RMagick gem for your app. I'm guessing you have this installed locally so it works there, but it's missing from your Gemfile or gems manifest (depending on Heroku stack version).

Next Steps

Once you start hacking away on your computer, you will most likely need to install more tools with Homebrew. Before you do, remember to always runbrew update and brew doctor to make sure your system is still ready to brew. To upgrade your existing packages, run brew upgrade.

If you installed the full Xcode package, remember that when you update it via the Mac App Store, you might also need to update the Command Line Tools via Xcode's Preferences. If you installed the standalone CLT, I recommend checking for a new version once a month or so.

If you followed this tutorial because you're interested in Rails development, I recommend visiting Daniel Kehoe's excellent RailsApps Project.

If you want to install another version of Ruby besides 2.2.0, follow the instructions below.

6.

Installing other versions of Ruby, such as 2.0.0 and rails 4.0.0

Before you install a version of Ruby with RVM, you should make sure you have the latest version of RVM:

1

rvm get stable --autolibs=enable --auto-dotfiles

Then run:

1

rvm install 2.0.0 (it will install ruby-2.0.0-p643)

To see all the versions of Ruby installed via RVM:

1

rvm list rubies

This output also lets you know which version is the default and which one is the current one in use.

To use a specific version (2.2.0 in the example below) and also set it as the default version for new shell sessions:

1

rvm use 2.0.0 --default

To verify:

1

ruby -v

The version should match that of the current Ruby in use.

Install Rails 4.0.0

gem install rails -v 4.0.0

Note:

Homebrew

In many cases, Homebrew will provide helpful instructions for dealing with warnings and errors, and I usually follow those instructions. I've tried to cover the most common sources of warnings and errors. If you run into an issue I haven't mentioned, try looking it up in the Homebrew GitHub Issues, or Google the error message. If that doesn't help, contact me and I'll do my best to help you.

After you fix each issue, run brew doctor until you get Your system is ready to brew. Then go to Step 3.

If you get Warning: /usr/bin occurs before /usr/local/bin, run the command below (as recommended by Homebrew), and quit and relaunch Terminal:

1
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

This command takes everything between the single quotes and adds it (>>) to a file called .bash_profile in your user's root directory (~/). Every time you open a new Terminal window or tab, .bash_profile is called. The export PATH line tells your system to look in /usr/local/bin first, since that's where Homebrew installs tools.

Now that .bash_profile has been modified, it needs to be reloaded. For initial RVM installations, the preferred way to do this is to quit and relaunch Terminal. Otherwise, you can use the following command:

1

source ~/.bash_profile

More about rvm gemset concept:

https://rvm.io/gemsets/basics

Named Gem Sets

RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other.

You may even have separate named gemsets.

Let's say, for example, that you are testing two versions of a gem, with ruby 2.1.1. You can install one to the default 2.1.1, then create a named gemset for the other version, and switch between them easily.

Example: testing gems

$ rvm 2.1.1@testing

will use a '2.1.1@testing' GEM_HOME (be sure to create it first), whereas:

$ rvm 2.1.1

will use the default 2.1.1 GEM_HOME

Example: Rails versions & upgrading apps

To illustrate the point, let's talk about a common use case. Assume you are testing out a rails application against a new Rails release. RVM makes such testing very easy, by letting you quickly switch between multiple Rails versions. First, let's set up the environments:

$ rvm 2.1.1
$ gem install rails -v 4.1.0

	
$ rvm gemset create rails410 rails320
Gemset 'rails410' created.
Gemset 'rails320' created.

	
$ rvm 2.1.1@rails410
$ gem install rails -v 4.1.0

	
$ rvm 2.1.1@rails320
$ gem install rails -v 3.2.0

Note that, for each of the ruby installs above, you can have completely separate versions!

Now that your environments are set up, you can simply switch between Rails versions and Ruby versions as follows.

$ rvm 2.1.1@rails410 ; rails --version

	
Rails 4.1.0

	
$ rvm 2.1.1@rails320 ; rails --version

	
Rails 3.2.0

If you are deploying to a server, or you do not want to wait around for rdoc and ri to install for each gem, you can disable them for gem installs and updates. Just add the following line to your ~/.gemrc or /etc/gemrc:

gem: --no-rdoc --no-ri

And also this:

http://stackoverflow.com/questions/15231798/how-do-you-install-rails-4-0-in-an-rvm-gemset

This command:

rvm gemset create rails-4.0

is creating basically a directory structure to hold the gems. You could have just as easily called it something other than "rails-4.0" like "foo" and it would be the same behavior.

This command:

rvm 2.0.0@rails-4.0

Switches to Ruby 2.0.0 and tells it to use the new gemset named rails-4.0. Again, that could be "foo" or whatever you called it.

Now, to get Rails 4.0.x, you'd do:

gem install rails --version=4.0

As Barrett pointed out earlier, to get a pre/beta/rc release, you can specify the whole version string, e.g. gem install rails --version=4.0.0.rc2.

Don't sudo, because you shouldn't sudo with rvm, even though it tells you to. With the "system ruby" (ruby not installed by rvm), it may be installed as root, so you need superuser (su) access (superuser do or "sudo") to do that. But, rvm has you install things as the current user, therefore you don't need to sudo.

7. Install exercism and the platform setup for java, ruby and NodeJS (following the exercism website)

Installing Node.js
There are at least two common options to run JavaScript code: the browsers and Node.js. Here we are going to use Node.js to run our JavaScript code. Let's see how to install Node.js locally:

Windows users: find official installers on Node.js downloads. Choose the LTS (long term support) version. It will install Node.js on your machine as well as npm (that stands for Node Package Manager), a tool that helps installing applications that run on top of Node.js.

Mac OS X users: same as Windows users, you will find official installers on Node.js downloads. Choose the LTS version. It will install Node.js and npm on your machine.

Alternatives

Using Homebrew:

brew install node
Using MacPorts:

port install nodejs


Linux users: there are binaries for node and npm tools on the Node.js downloads page, but the recommended way to install them on a Linux machine is via a package manager. As of writing this, the recommended version of Node.js to install is 4.x. To install it on a Debian or Ubuntu Linux distribuion just execute these commands:

1
2
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
If you are using a different distribution or package manager, you can find a complete list of supported ones on the official documentation page: Installing Node.js via package manager.

Installing additional tools
The next step is to install jasmine-node globally so that you can run JavaScript tests:

1
npm install jasmine-node -g
Depending on your setup, you may need super user privileges to install an npm module globally. This is the case if you've used the official installer linked to above. If npm gives you an error saying you don't have access, add sudo to the command above:

1
sudo npm install jasmine-node -g
If you've used the official installer, your PATH should have been automatically configured, but if your shell has trouble locating your globally installed modules—or if you build Node.js from source—update your PATH to include the npm binaries by adding the following to either ~/.bash_profile or ~/.zshrc:

1
export PATH=/usr/local/share/npm/bin:$PATH
Help us explain this better! File a GitHub issue at https://github.com/exercism/xjavascript/issues if you have suggestions, or submit a patch with improvements to the https://github.com/exercism/xjavascript/blob/master/docs/INSTALLATION.md file.


Execute the tests with:

1
jasmine-node bob_test.spec.js
Making Your First Node Module
To create a module that can be loaded with var Bob = require('./bob.js');, put this code in bob.js:

1
2
3
4
5
6
7
8
9
var Bob = function() {};

Bob.prototype.hey = function(what) {
  //
  // Your solution to the exercise goes here
  //
};

module.exports = Bob;
You can find more information about modules in the node documentation. To make it easier to get started, there's a "skeleton" bob.js file in the directory for the first exercise.
Installation
Use the installation guide at Jumpstart Lab for instructions on installing Ruby.
http://tutorials.jumpstartlab.com/topics/environment/environment.html
===========================================
Environment Setup
Setting up your environment can be difficult when you’re first starting with Ruby. We want to get the following installed:

Git
Ruby 2.2
A text editor
The setup instructions are broken down by platform: Mac, Linux, and Windows.

Text Editor

If you don’t already have a favorite text editor, we recommend using Atom.

However, if you’re a student at Turing, please download and install RubyMine.

Mac OS

Mac OS is the most popular platform for Ruby and Rails developers. These instructions assume you’re on the latest version of MacOS, 10.10. If you’re using an older version, refer to these additional notes.

Terminal

The terminal is a textual interface to your computer. You can move around folders (called directories) and run programs within it. For example, when you run pry or ruby, you are running that program from the terminal.

If this is all new for you, see Terminal and Editor

To launch the terminal, open Spotlight using Command-Spacebar, type "terminal", then enter.

XCode & Command Line Tools

XCode is a huge suite of development tools published by Apple. You’ll want to install it before attempting to install anything else.

Install XCode from the Apple App Store
Open the application after installing and agree to the SLA terms
Open terminal and run xcode-select --install, enter your user password
Now you should have the underlying tools we need to move forward.

Homebrew

Homebrew is a package management system that makes it easy to install hundreds of open source projects and compile them from source for maximum performance on your machine.

Open the Terminal then run the homebrew installation script:

close  minimize  deactivate
Terminal
$

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It will ask you for your password. This is the password to log in to your account on the computer. It needs this because it installs its packages in a place that all users of this computer can access.

Verifying Homebrew

When it has completed the installation run brew doctor and it should tell you that everything is fine:

close  minimize  deactivate
Terminal
$
 
brew doctor
Your system is ready to brew.
Modifying your PATH

If you got a warning from Homebrew about your path, do the following:

close  minimize  deactivate
Terminal
$
$
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Now run brew doctor again and the warning should be gone.

Git

Git is the version control system of choice in the Ruby community. XCode installed an older version of Git for you, but let’s update it.

close  minimize  deactivate
Terminal
$
 
 
brew install git
==> Downloading https://git-core.googlecode.com/files/git-1.8.3.4.tar.gz
########################################################### 100.0%
RVM

RVM allows you to install and maintain multiple versions of Ruby. More information about Ruby Version Mananger (RVM) can be found at http://rvm.io.

Installation

Similar to Homebrew, RVM provides a script to get everything installed. Run this in your Terminal:

close  minimize  deactivate
Terminal
$
curl -L https://get.rvm.io | bash -s stable
Loading / Post-Install

Look for the line in the output from the RVM installation that starts with

close  minimize  deactivate
Terminal
 
To start using RVM you need to run `source ...`
Copy the command inside of the backticks (don’t include the backticks), paste it into your terminal window, and hit enter.

Check if it got installed correctly by checking the version.

close  minimize  deactivate
Terminal
 
rvm --version
It should give you a version number rather than an error message.

Ruby

We’re going to install Ruby 2.2. If you need another version it’ll be same procedure, just replace "2.2" in the instructions with whichever version you want.

Install it with:

close  minimize  deactivate
Terminal
$
rvm install 2.2
Setting the Default Version

You can tell rvm which Ruby version you want to use by default:

close  minimize  deactivate
Terminal
$
rvm use 2.2 --default
Requirements

There are several additional libraries that gems will often rely on. RVM makes installing those easy, too. Run this command:

close  minimize  deactivate
Terminal
$
rvm requirements
It’ll figure out what needs to be installed and install it. If prompted for your password, use your computer login password.

PostgreSQL

Postgres is the database of choice for most Rails projects.

Installation

Homebrew has Postgres for you. From your terminal:

close  minimize  deactivate
Terminal
$
brew install postgresql
Linux

If Mac OS isn’t a possibility, then your next best bet is Linux. Among distributions, Ubuntu has the best support for Ruby and Rails development.

Check out our tutorial for setting up a Vagrant/Linux virtual machine. Just skip the bits about Vagrant, all the other Linux-centric setup is the same.

Windows

Getting started on the Windows platform is actually very easy. Engine Yard (http://engineyard.com) has put together the RailsInstaller (http://railsinstaller.org/), a single package installer with all the tools you need to get working. Make sure that, during the setup, you check the box to configure your environment variables. You can stop after step 2, once you’ve entered your email and name in the DOS prompt.

Beyond initial setup, though, there is going to be pain. As you add in more Gems and other dependencies you’ll find that many of them utilize native extensions, code written in C for better performance. Unless the authors have put energy into being cross-platform, you’ll run into issues.

Instead, we recommend using VirtualBox and Vagrant to run a Linux virtual machine within your Windows host operating system.



You will need to install the Minitest gem:

$ gem install minitest

From Oracle website
Mac OS X
If you are new-ish to programming in Java on Mac OS X, these instructions are for you. This is a step-by-step opinionated guide to getting from zero to submitting your first exercise.

Step 1 — Install Java Development Kit 1.8
First, determine if the JDK 1.8 is installed:

1
$ java -version

Step 2 — Install IntelliJ IDEA Community Edition
Download, install and configure IntelliJ with the JDK you have installed:

Download IntelliJ IDEA Community Edition and run the installer; accept all the defaults.

Run IntelliJ (/Applications/IntelliJ IDEA 14 CE.app)

The first time you do, IntelliJ walks you through some initial setup. We recommend selecting a UI Theme and then just clicking "Skip All and Set Defaults".
In the "Welcome to IntelliJ IDEA" window, open the "Configure" pull-down and select "Project Defaults", then "Project Structure".

In the "Default Project Structure" dialog, find the "Project SDK:" section in the right panel. Click the "New..." button and select "JDK".

In the "Select Home Directory for JDK" file open dialog, navigate to /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home. Click "OK".

Back in the "Default Project Structure" dialog, in the "Project language level:" section, select "8 - Lambdas, type annotations etc.". Click "OK".


Mac OS X
Get started with the first exercise
In the terminal window, get the first exercise...

1
2
3
4
5
6
7
8
9
$ exercism fetch java

Not Submitted:       1 problem
Java (Etl) /Users/johndoe/exercism/java/etl

New:                 1 problem
Java (Etl) /Users/johndoe/exercism/java/etl

unchanged: 0, updated: 0, new: 1
In the "Welcome to IntelliJ IDEA" window, click the "Open" option.

Navigate to the /Users/johndoe/exercism/java/etl folder. Make sure you've selected the "etl" folder. Click "OK".

In the "Import Project from Gradle" dialog, check the "auto-import" and "create directories" checkboxes and select "Use customizable gradle wrapper".

IntelliJ 14 CE -- Gradle import dialog

Click "OK". IntelliJ will automatically create its project artifacts based on the Gradle project file.

After the project has loaded and you've dismissed the "Tip of the Day" dialog, you may see a notice (in the top-right-hand corner), saying, "Unindex remote maven repositories found." you can safely dismiss this notice.
Open the README.md file and carefully read the background for the assignment.

Start by running the test suite: In the "Project" view, right-click on the test file (etl\src\test\java\EtlTest), select "Run", then pick the "EtlTest" that has a JUnit icon to the left of it (red and green arrows), NOT the Gradle icon (circular green). Run tests through IDEA JUnit Runner, NOT Gradle

If these menu options don't appear at first, wait for a few seconds and try again; IntelliJ is still configuring the project with a Java nature.

When you first start an exercise, you should expect compilation errors because the test is setting expectations on a class that you need to write. By trying to run the tests, you get a nice list of what needs to be fixed in the "Messages Make" view.

... and away you go!!!

Windows Setup for Responsys Work

Cygwin
https://www.youtube.com/watch?v=TjxEH_tr7e0
C:\cygwin64\home\dawdai this is the starting home directoy for cygwin
C:\Users\dawdai.ORADEV\Downloads is hosting all the cygwin packages
Setting the HOME Environment Variable on Windows (this is when you wanna change your home dir)
Right click on Computer in Windows Explorer
Select Properties
Select Advanced System Settings and click on the Advanced tab
Click on Environment Variables.. button.
In the System Variables section, click on the New... button.
Enter "HOME" as Variable Name and C:\Users\<your user name>\
Click OK.
=================================================
Go to Oracle website to download latest jdk, then set in system variables:
JAVA_HOME (point to the new JDK install directory)
PATH (in windows, add/modify the %JAVA_HOME%\bin in path to reflect the new folder)
C:\ProgramData\Oracle\Java\javapath -> old
C:\Program Files\Java\jdk1.8.0_151\ -> current
===========================================
Go to eclipse website to download eclipse:
C:\Users\dawdai.ORADEV\eclipse\java-oxygen
C:\Users\dawdai.ORADEV\eclipse-workspace is the workspace dir
eclipse JRE pointing to C:\Program Files\Java\jre1.8.0_151
============================================
Installation
1. go to http://archive.apache.org/dist/ant/binaries/
2. select apache-ant-1.9.1-bin.zip, download it.
3. unzip this file. For example, D:\TrainingDoc_5\responsys\software\apache-ant-1.10.1-bin\apache-ant-1.10.1
4. set your Windows environment variables. Computer -> Right Click, Properties -> Advanced System Settings -> Environment Variables.
ANT_HOME=D:\TrainingDoc_5\responsys\software\apache-ant-1.10.1-bin\apache-ant-1.10.1
ANT_OPTS=-Xms256m -Xmx1536m -XX:PermSize=1024m -XX:MaxPermSize=2048m
Add %ANT_HOME%\bin to PATH variable.
5. Type ant -version on your command line window and/or cygwin window to confirm it shows Ant 1.9.1.
6. On your Eclipse, go to Window -> Preferences -> Ant -> Runtime -> Classpath - > Ant Home Entries, press "Ant Home" button to point to your new ANT_HOME.
=====================================================
You can download apache-tomcat-8.5.14-windows-x64.zip from https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.14/bin/
unzip it
set CATALINA_HOME to D:\TrainingDoc_5\responsys\software\apache-tomcat-8.5.14-windows-x64\apache-tomcat-8.5.14
Go to your Tomcat installation, and edit your server.xml, for example D:\TrainingDoc_5\responsys\software\apache-tomcat-8.5.14-windows-x64\apache-tomcat-8.5.14\conf\server.xml. 

Search for port number 8080 and change to 80. If the Tomcat port is not 80, there are some URLs in interact that will not work because they are hardcoded to port 80. This is an 

Interact issue and not a Tomcat issue.

You should have entries like this after the change:

<Connector port="80" protocol="HTTP/1.1"
  connectionTimeout="20000" 
  redirectPort="8443" />

tomcat-users.xml
In the same directory, edit tomcat-users.xml and add the following roles before the end line </tomcat-users>:
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="jmxconsole"/>
<user username="tomcat" password="tomcat" roles="manager-gui, manager-script, manager-jmx, manager-status, jmxconsole, repositoryviewer"/>
</tomcat-users>

catalina.properties
Edit this line:
common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${interact.local.dir}/commonlib/*.jar"

(Note: in some cases of tomcat hornetq server error, append ',${interact.local.dir}/syslib/*.jar' will make it work.)
Add this line:
org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE=true
 
In case that you are running tomcat on eclipse, the ${interact.local.dir} variables will not be set. In that case, use the actual paths. Using ${interact.local.dir} will not 

actually show an error. Class paths will be missing.

Class Loader Info
https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html

When starting up Tomcat server with "ant tomcat-start" or "ant tomcat-debug", this is how it works:

Ant "tomcat-start/debug" target is defined in build/build-tomcat.xml in Git repository. Here,
interact.local.dir variable will be set from ${deploy.localfiles.dir}, which is defined in your own .build.properties file.
java.ext.dirs variable will be set to ${java.home}/lib/ext;${deploy.localfiles.dir}/syslib (== Bootstrap in the howto)
catalina.properties will read common.loader, which includes ${interact.local.dir}/commonlib/*.jar. (== common in the howto)
If you start up the tomcat from Eclipse directly, it might not have these setups. So you need to do these manually.

Tomcat can be started by executing one of the following commands:
  On Windows:
      %CATALINA_HOME%\bin\startup.bat

REFER TO RUNNING.TXT inside the unzipped folder

================================================
Here is the ZIP file that I had downloaded: mysql-5.7.20-winx64.zip

Here are the steps to start MYSQL Server (mysql-5.7.20-winx64.zip) for the first time on Windows:

Create a new folder named "data" in MYSQL 
installation directory (i.e. in the same location as 
where "bin" directory is located. For me it is: 
D:\TrainingDoc_5\responsys\software\mysql-5.7.20-
winx64\mysql-5.7.20-winx64. This location will vary 
as per the location where you have extracted the 
MYSQL zip file)

From here I will use my MYSQL folder location as 
reference. Go to: 
D:\TrainingDoc_5\responsys\software\mysql-5.7.20-
winx64\mysql-5.7.20-winx64\bin and execute the 
command: 

mysqld --initialize-insecure or  mysqld --initialize 
depending on whether you want the server to generate 
a random initial password for the 'root'@'localhost' 
account.
To start the DB, go to: 
D:\TrainingDoc_5\responsys\software\mysql-5.7.20-
winx64\mysql-5.7.20-winx64\bin and execute mysqld --
console You can see the start-up logs being printed.

To connect to DB, go to: 
D:\TrainingDoc_5\responsys\software\mysql-5.7.20-
winx64\mysql-5.7.20-winx64\bin and execute mysql -u 
root -p. When prompted, Enter password if it has 

been set or else just hit "Enter" button to connect

If:
mysqld: Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
check -> https://stackoverflow.com/questions/33691038/issue-when-running-mysqld

Use basedir = C:/myfolder/mysql-5.7.11-winx64 then find cmd.exe for the path: C:\Windows\System32\cmd.exe.
In order to do this, right click the Command Prompt startup icon and then select "Run As Admininistrator".
================================================
Install Oracle DB
Downloading Oracle DB Installation Package
Please follow this instruction to download the package. The current recommended version (as of 10/16/2015) is 11.2.0.4.0.

(Mac users need to install VirtualBox and start a VM that contains Oracle DB image in it. Following is the links that contains VMs with Oracle DB image: 

http://www.oracle.com/technetwork/community/developer-vm/index.html, 
http://stackoverflow.com/questions/23824115/oracle-developer-vm-with-oracle-11g)
VM Network setting in virtual box: Virtualbox Network setting for the Oracle DB VM

Refeference: https://updates.oracle.com/Orion/Services/download?type=readme&aru=16908159

Oracle Database 11g Release 2 (11.2.0.4) is available in the latest media pack. You can also download the software from My Oracle Support website:

https://support.oracle.com
To download the software from My Oracle Support:

Log on to My Oracle Support.

Click Patches & Updates.

In the Patch Search section, click the Search tab.

Enter 13390677 in the Patch Name or Number field.

Select a platform to download from the drop-down list.

Click Search.

In the Patch Search Results page, under Patch Name, click the patch number to display the patch details.

Click Download.

From the File Download window, click each file name to download the selected software. (Only the first two files are needed for the installation).

If you are using Windows 7, install Oracle 11gR2 using the oracle zip files downloaded.

  unzip p13390677_112040_MSWIN_1of7.zip and p13390677_112040_MSWIN_2of7.zip into one temporary directory.
  cd to database subdir of the temproray directory and run setup.exe
  

During the installation process, choose the following:

create and configure a database
choose Desktop Class
change Oracle base directory


Oracle base: D:\app\dawdai
Software Location: D:\app\dawdai\product\11.2.0\dbhome_1
Database file location: D:\app\dawdai\oradata

choose Enterprise Edition
choose Unicode
optionally change the Global Database Name orcl to orclxxxx. Here I set it to orcl
choose a password that can be shared. (for example, "admin". The security alert would be shown, but this is local database so you can just ignore it.) Here I set it to admin
Please Note: You might want to install Oracle under C:\Dev\oracle, because C:\Dev directory has less security restrictions.
Use sqlplus to check the installation.
If you've forgotten the password for any user then you can reset by logging in as SYS:
(https://stackoverflow.com/questions/8722302/what-username-password-should-be-entered-when-connecting-to-sqlplus-after-ins)
sqlplus / as sysdba
And then:

alter user username identified by password;
If you've forgotten which users you have then you can run:

select username from all_users;
If you have only recently created the database it would be worthwhile restricting on CREATED, as the default database install comes with dozens of its own schemas. For instance, to find users added in the last week run this:

select * from all_users
where created > trunc(sysdate)-7;

Configuring Oracle for Manual Startup
By default, Oracle installs as a service that will startup when you log in to your Windows system.  This will make your laptop much slower to boot and also slower during normal 

usage. 
You can change this.  Disable the automatic startup of the service, and build a .bat file to start the services manually.
1. Go to Control Panel -> System and Security -> Administrative Tools then Click "Services".
2. In the window, find the Oracle services, and right click on the Oracle service, then choose Startup type to "Manual". When done, it will look like this.
this stops them from automatically starting.

3. Note the names of the services for the next step. 

4. Create an oracle.bat file to start the services.  Using your favorite text editor, write an oracle.bat file with the following contents, changing thexxxxxxx sections to match 

your own service names.  These are the five services you may need. Depending on your installation, you may not have all five that may be enabled in the .bat file.

@echo
net start OracleDBConsolexxxxxxxxx
net start OracleMTSRecoveryService
net start OracleOraDb11g_home1TNSListener
net start OracleServiceXXXXXXXXXX
@echo

CSS
body{
  margin-top:60px
}
Term
Wed, 12/27/2017 - 06:59

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv