Posts

Showing posts from June, 2013

Tutorial 9: Node.js common Error 2 : Unknown system errno 114

If you have used sockets in your node.js project,  you might have seen a error Unknown system errno 114 This error occurs because you are trying to use a socket which is already busy with another connection. What caused it? You might have defined the socket globally and calling the functions that use the socket simultaneously. something like var socket1 = new net.Socket(); ... .. exports.func1=function(){ socket1.connect (PORT, HOST, function() {             socket1.end('some command');         }); }; exports.func2=function(){ socket1.connect (PORT, HOST, function() {             socket1.end('some command');         }); }; When you call func1 and func2 simultaneously func2 try to use socket1 which is already busy in func1. Solution: define socket in new function so that if both function gets called simultaneously two socket will be create or you can create something like generic pool to address this issue https://github.com/coopernurse/nod

Tutorial 8: Some Selectors for css + jquery

X + Y ul + p {       color :  red ;   }   It will select only the element that is immediately preceded by the former element. X > Y div #contai ner > ul {      border :  1px   solid   black ;   }  will only select direct children. X ~ Y ul ~ p {       color :  red ;   }  Any child with given tag X[href="foo"] a[href= "http://net.tutsplus.com" ] {      color :  #1f6053 ;  /* nettuts green */    }  a[href^= "http" ] {  //start with http a[href$= ".jpg" ] {   //end with jpg X:checked input[type=radio]:checked {       border :  1px   solid   black ;   } target a user interface element that has been checked - like a radio button, or checkbox. X:not(selector)   div:not( #contai ner) {       color :  blue ;   }  select all divs, except for the one which has an id of container . p::first-letter { p::first-line { li:nth-child(3) { li:nth-last-child(2) { ul li:first-child 

Tutorial 7: Javascript: So you want to know attr ids in your page or no. of duplicate ids

open console (F12) It will require jquery. paste var ids = []; $('div[id]').each(function(){ ids.push( this.id ); }); it contains all the ids in your page. To find unique ids just perform following function on result from previous step $.unique(ids)  So now you know how many duplicate ids you have left in your page