기본 콘텐츠로 건너뛰기

2월, 2020의 게시물 표시

git revert : for the first time in forever

https://www.atlassian.com/git/tutorials/undoing-changes/git-revert omg im so tired now typed $git revert HEAD and some scary nano editor popped up and i do not remember how exactly i managed to escape the editor and made revert done, but i ........donno. now it seems reverting didnt put my web app into previous status but totally broken. let me take some rest and take a careful look into it.....later....

How to set base url when deployed in Heroku? : base url and axios

https://stackoverflow.com/questions/47164330/axios-api-calls-in-heroku/47165888 baseUrl = process.env.baseURL || "http://localhost:5000" Even more stable way https://stackoverflow.com/questions/52129849/how-to-get-the-base-url-variable-on-a-deployed-heroku-node-app const production  = 'https://examplePage.com'; const development = 'http://localhost:3000/'; const url = (process.env.NODE_ENV ? production : development); process.env.NODE_ENV will resolve to undefined if you are running on localhost production mode. and return production if you have deployed the app production mode.

What is process.env?

the process.env global variable is injected by the Node at runtime for your application to use and it represents the state of the system environment your application is in when it starts. https://codeburst.io/process-env-what-it-is-and-why-when-how-to-use-it-effectively-505d0b2831e7

Heroku : at=error code=H10 desc="App crashed" method=GET path="/" : GREATEST POST EVER IN THIS MONTH

https://dev.to/lawrenceagles/causes-of-heroku-h10-app-crashed-error-and-how-to-solve-them-3jnl i got into this bug and hadn't find a way to go out, the reason was that i made a typo which my tutorial alerted me to take care already lol.. anyways. guys let's stay awake.... DO NOT MAKE A SPACE WITHOUT ENOUGH CARE Wrong:  web : node index.js Correct  web:node index.js

Heroku : npm ERR! code EEXIST

resource https://stackoverflow.com/questions/46541371/npm-err-refusing-to-delete-code-eexist log messeges npm ERR! Refusing to delete /tmp/build_1d08d29a9c9a463668992db197c02ec0/client/node_modules/.bin/jest: ../jest-cli/bin/jest.js symlink target is not controlled by npm solution : since Heroku could not delete the file which was not supposed to be existing, delete the node_modules and run heroku again andnnndd you maayyy want to delete package-lock json as well.. and heroku will be installing node modules when running.....

Heroku code H10 & H81 : Blank app

this error means NO CODE HAS BEEN PUSHED TO THIS APPLICATION. it means that all those times that I pushed the code by $git push heroku anotherbranchname has not been working as I meant. Besides, when pushing code to heroku, the comment must be looking like this $git push heroku master as the document says, "Note that Heroku only deploys code that you push to the master branch of the heroku remote. PUSHING CODE TO ANOTHER BRANCH OF THE REMOTE HAS NO EFFECT. **Deploying from a branch besides master $git push heroku testbranch:master resources: https://devcenter.heroku.com/articles/error-codes#h81-blank-app https://devcenter.heroku.com/articles/git#deploying-code

Node.js Module : what is node_modules folder?

https://stackoverflow.com/questions/34526844/what-is-node-modules-directory-in-angularjs npm is the node package manager, which installs packages locally into a project, speficifally, into the node-modules folder. from there the package code can be included into a project *official document https://www.tutorialsteacher.com/nodejs/what-is-nodejs Node.js is an open source server side runtime environment built on Chrome engine. Node.js can be used to build different types of applications such as command line application, web application, real-time application, ..etc.. However, it is mainly used to build network programs like web servers, similar to PHP, Java, or ASP.NET *NODE.JS MODULE Module in Node.js is a simple or complex functionality organized in single or multiple JS files which can be reused throughout the Node.js application. *Node.js module types 1.core Modules 2.Local Modules - in order to use Node.js core or NPM modules, YOU FIRST NEED TO IMPORT IT USING REQU

Git undoings : git reset

for this undo strategy we will continue with our working example. git reset is an extensive command with multiple uses and functions. if we invoke get reset --hard "commit code", THE COMMIT HISTORY IS RESET TO THAT SPECIFIED COMMIT. https://www.atlassian.com/git/tutorials/undoing-changes

Git undoings : checkout / viewing an old revision

https://www.atlassian.com/git/tutorials/undoing-changes git log (--oneline) you can view all commits across all branches by executing $git log --branches=* to view specific branch's commits $git log <branch_name> UNDOING A COMMITED SNAPSHOT being in a detached HEAD state $git checkout "commit code" this makes your working directory match the exact state of the specified commit.

Git revert : undoing?

The git revert command can be considered an 'undo' type command, however, it is not a traditional undo operation. instead of removing the commit from the project, it figures out how to invert the changes introduced by the commit and appends a new commit with the resulting inverse content. Reverting should be used when you want to apply the inverse of a commit from your project history. This can be useful, for example, if you are tracking down a bug and find that it was introduced by a single commit. and commiting a new snapshot, you can use git revert to automatically do all of this for you. invert: put upside down or in the opposite position, order, or arrangement inverse: opposite or contrary in position, direction, order, or effect. resource : https://www.atlassian.com/git/tutorials/undoing-changes/git-revert

Tracked and untracked file

Remember that each file in your working directory can be in one of two states : TRACKED OR UNTRACKED. tracked files are files that WERE IN THE LAST SNAPSHOT; they can be unmodified, modified, or staged. in short, tracked files are files that Git knows about. Untracked files are everything else - any files in your working directory THAT WERE NOT IN YOUR LAST SNAPSHOT AND ARE NOT IN YOUR STAGING AREA. When you first clone a repository, all of your files will be tracked and unmodified because Git just checked them out and you haven't edited anything.

Git Branching - Basic Branching and Merging

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging note that if your working directory or staging area has uncommitted changes that conflict with the branch you are checking out, GIT WON'T LET YOU SWITCH BRANCHES. IT'S BEST TO HAVE A CLEAN WORKING STATE WHEN YOU SWITCH BRANCHES. when you switch branches, Git resets your working directory to look like it did the last time you committed on that branch.

npm install and about package

npm install installs a package, and any packages that it depends on. A package is: a) a folder containing a program described by a package.json file b) a gzipped tarball containing (a) c) a url that resolves to (b) d) a <name>@<version> that is published on the registry (see npm-registry) with (c) e) a <name>@<tag> (see npm-dist-tag) that points to (d) f) a <name> that has a “latest” tag satisfying (e) g) a <git remote url> that resolves to (a) npm install (in package directory, no arguments) install the dependencies in the local node_nodules folder By default, npm install will install all modules listed as dependencies in package.json https://docs.npmjs.com/cli/install

What is 'package.json' file? and when is it created?

https://nodejs.org/en/knowledge/getting-started/npm/what-is-the-file-package-json/ All npm packages contain a file, usually in the project root, called package.json this file holds various meta data relevant to the project. this file is used to give information to npm that allows it to identify the project as well as handel the project's dependencies. WHEN AND HOW IS IT CREATED? https://docs.npmjs.com/cli/init npm-init creates 'package.json' file. *ADDITIONAL INFO - NPX * npm init <initializer>  can be used to set up a new or existing npm package. initializer  in this case is an npm package named  create-<initializer> , which will be installed by  npx , and then have its main bin executed – presumably creating or updating  package.json  and running any other initialization-related operations. The init command is transformed to a corresponding  npx  operation as follows: npm init foo  ->  npx create-foo npm init @usr/foo  ->  npx @us

How to commit to anther branch?

I got to have this message when I made commits but have not pushed to remote branch Your branch is ahead of 'origin/master' by 2 commits' However, I did not want to push the commits on master, but to another one called "buildtest" https://stackoverflow.com/questions/13897717/push-commits-to-another-branch/13897766 $ git push origin master:buildtest this line did the work as I wished it to be :)

What is it on index.js file? : ReactDOM.render()

https://reactjs.org/docs/react-dom.html#render ReactDOM.render(element, container[, callback]) Render a React element into the DOM in the supplied container and return a reference to the component(or returns null for stateless components) if the React element was previously rendered into container, this iwll perfomr an update on it and only mutate the DOM as necessary to reflect the latest React element..? ex) ReactDOM.render(<App />, document.getElementbyIdD("potato")); element to render is <App />(App.js), the container is potato. potato is name of the div. it is a container that I wish the blocks of elements to be filled with in index.html.

Select lines and display : sed

sed : stream editor for filtering and transforming text. -n : SUPPRESS automatic PRINTING of pattern space p : print current line n : next line 'n;p' : keep odd ones 'p;n' : keep even ones https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file

Let's be friends with sed

https://stackoverflow.com/questions/7657647/combining-two-sed-commands sed - stream editor for filtering and transforming text Sed is a stream editor. input and output file can be specified as follow sed "s/regexp/replacement/g" inputfile > outputfile flag -i is used to save the stream output in the input file. then specified output file argument is ignored and the change will be saved in the input file g to replace as many times as the pattern is detected more than once per each line without it, sed does the replacement for the first pattern detected by each line. CHAINING SED / COMBINING SED https://stackoverflow.com/questions/7657647/combining-two-sed-commands sed is a scripting language. you can separate commands with semicolon or newline ex $sed -i 's/File//g;s/MINvac\.pdb//g' filessldkjaginadkljef

Veritas vos liberabit : so will Linux, $PATH

https://linuxize.com/post/how-to-add-directory-to-path-in-linux/ at the end of .bashrc file, add  export PATH="$HOME/dirName:$PATH" to permanently save the change, run as followed $ source ~/.bashrc to confirm the change $echo $PATH I remember all those moments that this PATH problems caught on my feet and wasted so many time. Veritas vos liberabit Staying awake frees you from agonies and pains

cut and head to deal with csv files : How to separate specific column and get the data wanted?

https://stackoverflow.com/questions/47638184/can-i-use-grep-to-extract-a-single-column-of-a-csv-file How to separate specific column and get the data wanted? cut : remove sections from each lines of files ALSO CAN USED TO SEPARATE COLUMNS USING ; AS DELIMITER cut -d';' -f3 ;  separate dates by ; => -d';', and select only 3rd group => -f3