Jan 28, 2014

[Solved] Error in npm install from a github url

Posted Jan 28, 2014
If you're like me who's used to executing "git clone [github url]" then you may encounter an unusual behavior when using "npm install [github url]" or specifying the git repository inside package.json.

Here's a sample error of using npm install [github path]:

E:\progs\workspace\tmp>npm install https://github.com/mannyvergel/oils-js.git
npm http GET https://github.com/mannyvergel/oils-js.git
npm http 200 https://github.com/mannyvergel/oils-js.git
npm ERR! not a package C:\Users\Manny\AppData\Local\Temp\npm-5216\1390883860006-
0.930888706818223\tmp.tgz
npm ERR! Error: ENOENT, open 'C:\Users\Manny\AppData\Local\Temp\npm-5216\1390883
860006-0.930888706818223\package\package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "E:\\progs\\nodejs0.10.7\\\\node.exe" "E:\\progs\\nodejs0.10.7\
\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/mannyvergel/o
ils-js.git"
npm ERR! cwd E:\progs\workspace\tmp
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.21
npm ERR! path C:\Users\Manny\AppData\Local\Temp\npm-5216\1390883860006-0.9308887
06818223\package\package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\progs\workspace\tmp\npm-debug.log
npm ERR! not ok code 0


The solution is very simple, just prefix your github url with "git+" e.g.
git+https://github.com/mannyvergel/oils-js.git

Use the format in your package.json or npm install, e.g.
npm install git+https://github.com/mannyvergel/oils-js.git



Related Posts Widget For Blogger with ThumbnailsBlogger Templates

Jan 25, 2014

[Solved] NodeUnit does not finish when connected to Mongo DB

Posted Jan 25, 2014
When running NodeUnit tests and your tests are connected to Mongo DB, the tests do not end and it just hangs there. The fix is to close the connection on NodeUnit's tearDown function.

Example below is using Mongoose' disconnect function to close the connection after NodeUnit tests are done:
var mongoose = require('mongoose');
exports.tearDown = function(ok){
    mongoose.disconnect(function(err){
        if(err) {
            console.error(err);
            return;
        }
    });
    ok();
};



Jan 22, 2014

How to create and apply a patch from an SVN Commit

Posted Jan 22, 2014
There are cases that you may want to apply the same commit to another folder. E.g. you have a similar branch of your source code and you have committed the changes in your main branch. For this case, rather than copying your codes manually, you can create a patch from your SVN commit and apply it to another directory using the ff:

Create a patch from your commit, get the difference between two svn commits. Usually it's just your [desired commit #] minus one:
svn diff -r [reference commit]:[desired commit] < [filename]
e.g.
svn diff -r 9714:9715 > 9715.patch


Copy the patch file to the directory you want to apply it and go to that directory in the command line and type:
patch -p0 < [filename]
e.g.
patch -p0 < 9715.patch 

Jan 15, 2014

[Solved] 403 Status Code on Twitter API

Posted Jan 15, 2014
As of January 14, I was surprised to see that my code that uses Twitter API to post tweets does not work anymore. Then I saw the announcement that they now require https for all connections, so my change is quite simple:

From:
http://api.twitter.com/1.1/statuses/update.json

To:
https://api.twitter.com/1.1/statuses/update.json



Dec 27, 2013

Path to iPhone Simulator files in Mac OS X Mavericks, Xcode 5

Posted Dec 27, 2013
You should start looking in:
/Users/[current user]/Library/iPhone Simulator/

If you can't see the Library folder in Finder, click here how to show hidden files and folders in Mac OS X.

To access the applications in the Simulator, pick the iOS version you are using e.g.:
/Users/[current user]/Library/iPhone Simulator/6.1

Go to Applications folder and pick the hashed folder name that contains your application e.g.
/Users/[current user]/Library/iPhone Simulator/6.1/Applications/2ABAAFD5-71B0-478A-BEBD-13BA56AA03D7

For the SQLite Database, it should be inside the "Documents" folder with the extension ".sqlite" e.g.:
/Users/[current user]/Library/iPhone Simulator/6.1/Applications/2ABAAFD5-71B0-478A-BEBD-13BA56AA03D7/Documents/myapp.sqlite

You can use Liya app (it's free) to open the sqlite database.


Show all hidden files and folders Mac OS X Finder

If you can't see the hidden files in Mac OS X's Finder, execute the following in Terminal:


defaults write com.apple.finder AppleShowAllFiles -boolean true


killall Finder



Oct 18, 2013

Why I can't upgrade my Openshift account to a paid one [Updated]

Posted Oct 18, 2013
[Update 19 March 2014] Openshift has just introduced a new plan: Bronze plan! Which costs $0 to maintain and you have options to place add-ons. This is great news!
--

Openshift is a great platform to host your web application. I like the the way it was designed, allowing the community to contribute. I like its performance and up time. Another great thing about Openshift is the free account; you start with 3 small gears, 512MB RAM and 1GB storage and unlimited bandwidth which is good enough for a small start-up website.

What's the problem with Openshift?
I find its pricing plan unusual. If you're on FreeShift, you cannot add resources (like storage, RAM, etc).. not until you upgrade to Silver Plan. So from $0 per month, your next option is already the Silver plan which is $20 per month + resource usage costs.

I find this extremely strange why you're forced to have a minimum of $20 per month before you can add resources.  It's expensive, where as Digital Ocean offers 20GB of storage space 512MB RAM for $5 per month; only downside is the 1TB bandwidth limitation.

There's already a feature request to add a pay-as-you-go storage for FreeShift but no update yet when it will be implemented.