Monthly Archives: آذر 1392

How to use a different version of python duing NPM install?

Salam (means Hello) :)

I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install)

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make
make altinstall

then I installed node.js from source via these commands:

python2.7 ./configure
make
make install

The problem is, when I use npm install and try to install a node.js package which requires python > 2.4.3 I get this error:

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9

how should I "pass the --python switch to point to Python >= v2.5.0"?

[NasserTorabzade] یه عده چرت‌وپرتای کیهان و فارس رو تکرار میکنن، یه عده‌ام چرت‌وپرتای بی‌بی‌سی و من‌وتو رو. خسته کننده‌س صحبت با کسایی که از خودشون نظری ندارن

ناصر تراب زاده @NasserTorabzade
یه عده چرت‌وپرتای کیهان و فارس رو تکرار میکنن، یه عده‌ام چرت‌وپرتای بی‌بی‌سی و من‌وتو رو. خسته کننده‌س صحبت با کسایی که از خودشون نظری ندارن

[NasserTorabzade] یه عده چرت‌وپرتای کیهان و فارس رو تکرار میکنن، یه عده‌ام چرت‌وپرتای بی‌بی‌سی و من‌وتو رو. خسته کننده‌س صحبت با کسایی که از خودشون نظری ندارن

ناصر تراب زاده @NasserTorabzade
یه عده چرت‌وپرتای کیهان و فارس رو تکرار میکنن، یه عده‌ام چرت‌وپرتای بی‌بی‌سی و من‌وتو رو. خسته کننده‌س صحبت با کسایی که از خودشون نظری ندارن

Trouble with a simple display:table layout

Salam (means hello) :)

I have the following simple layout, the problem is that adding content to right div makes content on left one come down:

JS Fiddle

<!DOCTYPE html>
<html>
<head>
    <style>
        .parent{
            width:800px;
            height:100px;
            display: inline-table;
            border: 1px solid #e8e8e8;
            background: #fcfcfc;
        }
        .parent .right{
            width:90px;
            display:table-cell;
            padding-top: 10px;
            text-align: center;
            background: #f5f5f5;
            color:#666666;
        }
        .parent .left{
            width:710px;
            display:table-cell;
            padding-top: 0px;
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="left">
        This cell has padding-top:0px
    </div>
    <div class="right">
        <img src="images/icon.png">
        <br>some text
    </div>
</div>
</body>
</html>

Trouble with a simple display:table layout

Salam (means hello) :)

I have the following simple layout, the problem is that adding content to right div makes content on left one come down:

JS Fiddle

<!DOCTYPE html>
<html>
<head>
    <style>
        .parent{
            width:800px;
            height:100px;
            display: inline-table;
            border: 1px solid #e8e8e8;
            background: #fcfcfc;
        }
        .parent .right{
            width:90px;
            display:table-cell;
            padding-top: 10px;
            text-align: center;
            background: #f5f5f5;
            color:#666666;
        }
        .parent .left{
            width:710px;
            display:table-cell;
            padding-top: 0px;
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="left">
        This cell has padding-top:0px
    </div>
    <div class="right">
        <img src="images/icon.png">
        <br>some text
    </div>
</div>
</body>
</html>

NPM doesn’t install any modules: network socket hangs up

Salam (means Hello) :)

I have the latest version of node.js installed on ubuntu 12.04, I'm not behind any proxies, and my network settings are correctly configured, and were intact since last time when NPM worked fine. But now NPM hangs up installation of any modules with following error:

nasser@nasser-desktop:~/projects/server v3$ npm install simple-proxy
npm WARN package.json docco@0.6.2 No repository field.
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "simple-proxy"
npm ERR! cwd /home/nasser/projects/serverV3
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/nasser/projects/serverV3/npm-debug.log
npm ERR! not ok code 0

NPM doesn’t install any modules: network socket hangs up

Salam :)

I have the latest version of node.js installed on ubuntu 12.04, I'm not behind any proxies, and my network settings are correctly configured, and were intact since last time when NPM worked fine. But now NPM hangs up installation of any modules with following error:

nasser@nasser-desktop:~/projects/server v3$ npm install simple-proxy
npm WARN package.json docco@0.6.2 No repository field.
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "simple-proxy"
npm ERR! cwd /home/nasser/projects/serverV3
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/nasser/projects/serverV3/npm-debug.log
npm ERR! not ok code 0

On Writing for the Web

SEO, content writing, and other futile endevours For the past six years or so, I have made at least a fraction of my living from writing things for the Internet. And I’d say about 80 percent of that writing was completely unnecessary and contributed nothing new to the sum of human knowledge. In fact, at least half of it was a creative restating of something someone else had already written somewhere else at the request of an employer desperate for additional eyeballs (and willing to pay me for them). The pay, while hardly glamorous, has kept a roof over my head and food (and drink) in my belly, so I can’t exactly complain about that aspect. But the situation itself makes me think: if even half of what freelance writers and journalists such as myself produce is superfluous (and I suspect the real figure is much, much higher), then what is the point of writing for the web? I understand the motivation, because it’s the same reason I do these things: I'd rather get paid to create worthless web content while working an average of four hours a day in my pajamas than the alternative of spending eight hours in an office to do something else that’s probably just as pointless in the end, and far more limiting to my lifestyle. I can also kid myself and say that getting paid to write anything is better than not getting paid to write at all, but over the years I've come to believe that this is a falsehood fed to countless young writers. In fact, writing for the web for the most part has made me a worse writer, as I now have to consciously undo the harm that accommodating keywords and templates has caused. Before I go any further, I should make it clear that I'm speaking exclusively about SEO and web content writing, the sole purpose of which is to increase clicks. This category also applies to some journalism as well, particularly the very common practice of editors commissioning stories on hot topics that have already been covered by other sources, just so they don’t miss out on the pageviews that keep the advertisers coming. This kind of writing rarely produces new information or thoughts; it simply repackages existing ideas. It seems that a vast majority of the writing that appears online belongs to this category, and the percentage is increasing with time, making original journalism and writing that much harder to find (with notable exceptions being a handful of publications that are now known for actual reporting in long-form articles — ahem, Medium). A large share of the blame, if not all, falls on the advertising-supported model of web writing that has led to a severe decrease in quality publications and journalists and has yet to be replaced by something more sustainable. When it’s much cheaper to hire someone to create derivative work rather than dedicating the resources to carry out original research, the model itself incentivizes laziness and repitition. So what exactly is the point of this kind of writing, other than to earn some amount of money for the websites publishing this content, and a significantly smaller amount of money for the writers slaving away to create it? Is there any actual value being produced, or is this just another aspect of our “information economy”, where we no longer make or buy things that have actual use? Is web writing up there with financial derivatives? And is this system so ingrained that it has now become permanent? After all, if Google suddenly changed their algorithms to weed out SEO writing, wouldn’t an entire industry collapse? Or would it find another way to game the system for profit? Or will there be a mass protest online, with readers finally punishing the makers of SEO content and only sharing writing that has value? I'm honestly curious about the answers to these questions, because at this point I'm trying to navigate a world where I get paid ten times as much for fitting keywords into coherent sentences designed to increase pageviews as I am for writing an actual book (or half of one, anyway) that has been printed and sold in shops and may even be of use to its readers. Similarly, at least some of the writing I do on my blog is somewhat original, even if not entirely novel, but if you count at minimum the cost of this blog’s domain and hosting, not to mention my time, I’m actually losing money every time I post. It’s thoughts like this that make me want to abandon writing for a living altogether and earn money designing apps or web pages instead.

On Writing for the Web

SEO, content writing, and other futile endevours For the past six years or so, I have made at least a fraction of my living from writing things for the Internet. And I’d say about 80 percent of that writing was completely unnecessary and contributed nothing new to the sum of human knowledge. In fact, at least half of it was a creative restating of something someone else had already written somewhere else at the request of an employer desperate for additional eyeballs (and willing to pay me for them). The pay, while hardly glamorous, has kept a roof over my head and food (and drink) in my belly, so I can’t exactly complain about that aspect. But the situation itself makes me think: if even half of what freelance writers and journalists such as myself produce is superfluous (and I suspect the real figure is much, much higher), then what is the point of writing for the web? I understand the motivation, because it’s the same reason I do these things: I'd rather get paid to create worthless web content while working an average of four hours a day in my pajamas than the alternative of spending eight hours in an office to do something else that’s probably just as pointless in the end, and far more limiting to my lifestyle. I can also kid myself and say that getting paid to write anything is better than not getting paid to write at all, but over the years I've come to believe that this is a falsehood fed to countless young writers. In fact, writing for the web for the most part has made me a worse writer, as I now have to consciously undo the harm that accommodating keywords and templates has caused. Before I go any further, I should make it clear that I'm speaking exclusively about SEO and web content writing, the sole purpose of which is to increase clicks. This category also applies to some journalism as well, particularly the very common practice of editors commissioning stories on hot topics that have already been covered by other sources, just so they don’t miss out on the pageviews that keep the advertisers coming. This kind of writing rarely produces new information or thoughts; it simply repackages existing ideas. It seems that a vast majority of the writing that appears online belongs to this category, and the percentage is increasing with time, making original journalism and writing that much harder to find (with notable exceptions being a handful of publications that are now known for actual reporting in long-form articles — ahem, Medium). A large share of the blame, if not all, falls on the advertising-supported model of web writing that has led to a severe decrease in quality publications and journalists and has yet to be replaced by something more sustainable. When it’s much cheaper to hire someone to create derivative work rather than dedicating the resources to carry out original research, the model itself incentivizes laziness and repitition. So what exactly is the point of this kind of writing, other than to earn some amount of money for the websites publishing this content, and a significantly smaller amount of money for the writers slaving away to create it? Is there any actual value being produced, or is this just another aspect of our “information economy”, where we no longer make or buy things that have actual use? Is web writing up there with financial derivatives? And is this system so ingrained that it has now become permanent? After all, if Google suddenly changed their algorithms to weed out SEO writing, wouldn’t an entire industry collapse? Or would it find another way to game the system for profit? Or will there be a mass protest online, with readers finally punishing the makers of SEO content and only sharing writing that has value? I'm honestly curious about the answers to these questions, because at this point I'm trying to navigate a world where I get paid ten times as much for fitting keywords into coherent sentences designed to increase pageviews as I am for writing an actual book (or half of one, anyway) that has been printed and sold in shops and may even be of use to its readers. Similarly, at least some of the writing I do on my blog is somewhat original, even if not entirely novel, but if you count at minimum the cost of this blog’s domain and hosting, not to mention my time, I’m actually losing money every time I post. It’s thoughts like this that make me want to abandon writing for a living altogether and earn money designing apps or web pages instead.