Sunday, December 7, 2014

LF will be replaced by CRLF warning on Git when committing to Repo


When I commit code to GitHub using my local repository I have these errors below:

warning: LF will be replaced by CRLF in app/assets/javascripts/application.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/models/something.rb.
The file will have its original line endings in your working directory.

"In Unix systems the end of a line is represented with a line feed (LF). In windows a line is represented with a carriage return (CR) and a line feed (LF) thus (CRLF). when you get code from git that was uploaded from a unix system they will only have a LF. It's nothing to worry about."

http://stackoverflow.com/questions/5834014/lf-will-be-replaced-by-crlf-in-git-what-is-that-and-is-it-important

If you want, you can deactivate this in your git core config, just type this command.
"git config core.autocrlf true"

Tuesday, November 11, 2014

npm update -g has broken npm

After install my NodeJS in my app directory on Mac OS X using this link http://nodejs.org

I tried running npm install -g ember-cli but with no luck. Then I search solutions and found a command to fix my problem


curl -L http://npmjs.org/install.sh | sudo sh

npm install npm -g --ca=null

Monday, November 3, 2014

PSLQ could not connect to server: No such file or directory (No PSQL installed from brew and no pg gem)

I encounter an issue when tying to run my Rails App using Postgres and where PSLQ could not connect to server. What I did was just few steps to fix the problem and it solved the issue running in my Rails app on PSQL Database.

> Go To Terminal and follow these few steps (Note: my PSQL latest ver is 9.3.5_1)

$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

$ brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.3.5_1...

$ brew uninstall postgresql
Error: No such keg: /usr/local/Cellar/postgresql

$ psql --version
-bash: /usr/local/bin/psql: No such file or directory

$ brew install postgresql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/postgresql-9.3.5_1.mavericks.bottle.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/postgresql-9.3.5_1.mavericks.bottle.1.tar.gz
==> Pouring postgresql-9.3.5_1.mavericks.bottle.1.tar.gz
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
  https://github.com/Homebrew/homebrew/issues/issue/2510

To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
  http://www.postgresql.org/docs/9.3/static/upgrading.html

When installing the postgres gem, including ARCHFLAGS is recommended:
  ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.

To have launchd start postgresql at login:
    ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
    postgres -D /usr/local/var/postgres
==> Summary
🍺  /usr/local/Cellar/postgresql/9.3.5_1: 2927 files, 38M

$ mkdir -p ~/Library/LaunchAgents

$ cp /usr/local/Cellar/postgresql/9.3.5_1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl: another server might be running; trying to start server anyway
server starting

$ env ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions.  This could take a while...
Successfully installed pg-0.17.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.1
Done installing documentation for pg after 1 seconds
1 gem installed

$ psql --version

psql (PostgreSQL) 9.3.5

$ psql
psql: FATAL:  database "tech3" does not exist

$ sudo mkdir /var/pgsql_socket/
Password:

$ sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

$ rake db:create

$ rake db:migrate

$ rails server



Sunday, November 2, 2014

Dyld issue when setting up new Rails repository

Problem:  I have updated OS X Mavericks and setup new Rails environment with latest gems in the GemFile. When running bundle install I got his issue below:
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib
  Referenced from: /Users/tech3/.rvm/rubies/ruby-2.1.4/bin/ruby
  Reason: image not found

Trace/BPT trap: 5
Solution: brew update && brew install gmp && rvm reinstall 2.1.4

Friday, September 26, 2014

Autostart App on Macintosh, just load PLIST files at LaunchAgents such as (Mysql, Mongod and Redis)

Mysql 


brew info mysql
mkdir -p ~/Library/LaunchAgents
cp `brew --prefix mysql`/*mysql*.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/*mysql*.plist

or 

cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist



Mongod 

Create a file call org.mongo.mongod.plist in /Library/LaunchDaemons/

If you use vim you can do like this:
sudo vim /Library/LaunchDaemons/org.mongo.mongod.plist  

Copy and paste this:
 
 
"1.0">  
 
    Label
    org.mongo.mongod
    RunAtLoad
   
    ProgramArguments
   
        /usr/local/bin/mongod
        --dbpath
        /var/lib/mongodb/
        --logpath
        /var/log/mongodb.log
   
 


Also, you will need to create a file for the log and a directory for the database.
sudo touch /var/log/mongodb.log  
sudo mkdir /var/lib/mongodb  

And run this in your terminal:
sudo chown root:wheel /Library/LaunchDaemons/org.mongo.mongod.plist  
sudo launchctl load /Library/LaunchDaemons/org.mongo.mongod.plist  
sudo launchctl start org.mongo.mongod  


Redis

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

Tuesday, July 15, 2014

Incorrect MySQL client library version!

Recently I upgraded my OS X from Snow Leopard to Mavericks in preparation for Yosimate. A lot of dependencies have changed in the latest OS X that breaks my gems for my previous RVM environment (still ruby-1.9.3-p125)

I had this case whereby my I test and rake script "announcement" like I used to run on my development mode in Ruby on Rails.

bundle exec rake announcement:announce_bcc RAILS_ENV=development

Development mode on Rails. Unfortunately I got an error stating that:

Incorrect MySQL client library version! This gem was compiled for 5.5.14 but the client library is 5.6.19.

What I did to solve the issue was to upgrade my gems such as (bundle and rake).

gem update bundler
gem update rake

What solve the issues was to update my mysql2 gem. So what I saw from an article at
Install the mysql2 for a specific mysql client so I just update the mysql2 using gem prestine command.

gem pristine mysql2

This solves the problems and I was able to run the normal RAKE SCRIPT file in my local development.

Comment in if you have similar issues and wants to share insites for us both. ciao c",)

Thursday, July 3, 2014

Learning Paypal API

Recently I'm learning the API of Paypal because it is important on developing applications when payment made by clients using Paypal. Currently i'm residing in Singapore and this link will help me or you when you want to explore Paypal integration on your web applications.

https://developer.paypal.com/docs/api/

FileMaker Desktop Publishing Database downloading on updater

If you want to download the Updater or FileMaker, here'e the link that you can visit and download.
http://www.filemaker.com/support/downloads/

Rails 4.0 and Devise With Strong Params and Custom Fields


This is a good example of using Strong Parameters on Rails 4.0.1
https://gorails.com/blog/rails-4-0-and-devise-with-strong-params-and-custom-fields

Wednesday, June 11, 2014

Terminal command to get your own IP address

On Terminal:
ifconfig |grep inet | ipconfig getifaddr en1

and on Console:
`ifconfig |grep inet | ipconfig getifaddr en1 `.strip
host = `ifconfig |grep inet | ipconfig getifaddr en1 `.strip

Thursday, April 17, 2014

Having problem on "DYLD_ environment variables" on Mac Mountain Lion OS?

From the console terminal it suddenly shows :  (I'm using Mountain Lion)

dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/login) is setuid or setgid

I found a link where we can fix the problem. Google directs me the fix to my problem and Here is how to fix it. It will show you the link to download the http://asepsis.binaryage.com/ too. So when I download and install the .dmg file, basically its what ASEPSIS will do it get rid of your .DS_Store files and unnecessary files on your terminal. Just run the .dmg file and the annoying text on the terminal (problem) you're having with will be gone after you restart your machine. ciao!

Wednesday, April 16, 2014

If You Have A Mac, Memorize These 13 Keyboard Tricks


1. If your boss walks by while you're reading this article, press… 
COMMAND + W

2. If your boss walks by and basically everything you're reading is incriminating, press… 
COMMAND + H

3. If you're drowning in a sea of windows...
COMMAND + OPTION + M

4. If you need to cut through the clutter, press...
COMMAND + F3

5. To become a tab-scrolling expert, press..
COMMAND + 1 (and so on)

6. If you're kind of picky about your computer volume, press... 
OPTION + SHIFT + F11
and
OPTION + SHIFT + F12

7. If you need to add a little psychedelic flavor to your day, press...
CONTROL + OPTION + COMMAND + 8

8. If you don't want to watch the entire hour-long YouTube video of your niece's dance recital, press...
1, 2, 3 (and so on)

9. If you frequently write words like "antidisestablishmentarianism," press...
OPTION + DELETE

10. If your vocabulary isn't quite as advanced, try...
CONTROL + COMMAND + D

11. If formatting copied text drives you insane, try...
CONTROL + COMMAND+V

12. If you're a fast reader or a little over-caffeinated, try 
COMMAND + UP
and
COMMAND + DOWN

13. If the feeling of the sun on your face has been permanently replaced with the feeling of your retina display on your face, try... 

CONTROL + OPTION + COMMAND + EJECT

Tuesday, February 18, 2014

Execute it on iOS

It's been awhile since I posted something in here. It's just that I'm quite busy working on my Rent App and some Human Resource job portal projects using Ruby and Ruby on Rails. I found an interested link that attracts my eagerness to work with iOS devices then I got this  https://executeios.com.

It's pretty awesome following their podcast from videos to videos which will enhance your skill in Apple iOS application from scatch.  In fact I'm still on the 2nd day and I learnt alot already.  See for your self and get ready to embrance the Objective-C language on iOS app. Pretty cool … See you for the next post ;-)