Posts

Showing posts from 2013

Tutorial 21: Debugging REST Services

For debugging you can use tools like restful client addon of firefox When you are not seeing the client to work, here is the list of things that you might need to look for: 1. is client sending a message 2. if client able to receive a message from server 3. If the request message sent by the client is in the correct format, including HTTP headers 4. If the response sent by the server is in the correct format, including the HTTP headers For the debugging purpose you can use wireshark(If the response sent by the server is in the correct format, including the HTTP headers), it captures all the packets on given network interface...and you can do lots of stuff after capturing them. Other tools are apache tcpmon http://ws.apache.org/commons/tcpmon/ and http://ws.apache.org/axis2/c you can filter the data using client port host port and server address For more visit: http://www.packtpub.com/article/debugging-rest-web-services

Tutorial 20: Bookmarks for fixing Backend Technologies

"Imagine that you wake up one morning, reach groggily for your laptop and fire it up. You’ve just finished developing a brand new website and last night you were proudly clicking through the product list. The browser window is still open, the Widget 3000 is still sparkling in its AJAXy newness. You grin like a new parent and expectantly click on “More details”. And nothing happens. You click again, still nothing. You press Refresh and get that annoying swirling icon and then the page goes blank. Help! The Internet is gone!" -  From Smashing magazine article linked below. http://coding.smashingmagazine.com/2013/07/23/how-to-fix-the-web-obscure-back-end-techniques-and-terminal-secrets/ http://coding.smashingmagazine.com/2013/07/30/how-to-fix-the-web-obscure-back-end-techniques-and-terminal-secrets-part-2/                    

Tutorial 19: Javascript tools and resources

JavaScript has become more popular thanks to Projects like Node.Js, AngularJs, BackboneJS etc. Here are the links that will help you in learning javascript as a beginner.  https://developer.mozilla.org/ http://www.learnstreet.com/ http://www.codecademy.com/ http://www.codeschool.com/ http://www.letscodejavascript.com/ https://github.com/rwldrn/idiomatic.js Memory Allocation in JS JavaScript/Memory_Management https://wiki.mozilla.org/Performance:Leak_Tools http://www.ibm.com/developerworks/web/library/wa-memleak/ http://msdn.microsoft.com/en-us/magazine/ff728624.aspx https://developer.mozilla.org/en-US/docs/Venkman https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells?redirectlocale=en-US&redirectslug=JavaScript%2FShells

Tutorial 18: Simple javascript closure example with dc.js charts

working code var group1 = dateDimension.group().reduceSum(function(d) { return d.dd; }); var group2 = dateDimension.group().reduceSum(function(d) { return d.count; }); Not working var groups = {}; var columns = ["dd","count"]; for (var i = 0; i < columns.length; ++i) { var col = columns[i] groups[col] = dateDimension.group().reduceSum(function(d) { return d[col]; }); } Working for (var i = 0; i < columns.length; ++i) { (function( columnName ) { group[ columnName ] = dateDimension.group().reduceSum(function(d) { return d[columnName]; }); })( columns[i] ); }

Tutorial 17: Links for getting started on building custom roms for defy+ [MB526]

Defy might have become obsolete now but the journey it has traveled is noteworthy. To start development of custom ROM, XDA's defy forums will surely come in handy. Here are the links -  http://forum.xda-developers. com/showthread.php?t=2224142 http://forum.xda-developers. com/showthread.php?t=1593117 http://forum.xda-developers. com/showthread.php?p=28529222 http://forum.xda-developers. com/showthread.php?t=2100673

Tutorial 16: Javascript Some selected d3 examples

Given below are some D3 examples which might come in handy for making a site which have lots of visualization to feature. Visit respective links for more details.   Cross-filter examples http://cakey.github.io/infro/nutrients.html http://square.github.io/ crossfilter/ http://nationalpriorities.org/ interactive-data/taxbreaks/ 2013/visualization/   http://www.rjbaxley.com/p/ publications.html http://mbostock.github.io/d3/ tutorial/bar-2.html http://dimplejs.org/advanced_ examples_viewer.html?id= advanced_dynamic_line_color http://www.seaoftweets.com/# http://ramjoshi.com/web/ soccer/ http://www.nytimes.com/ interactive/2013/05/25/sunday- review/corporate-taxes.html http://bl.ocks.org/cpudney/ raw/1233755/ http://www.nytimes.com/ interactive/2011/06/22/world/ asia/american-forces-in- afghanistan-and-iraq.html http://www.nytimes.com/ interactive/2013/02/20/movies/ among-the-oscar-contenders-a- host-of-connections.html http://latentflip.com/d3/ techmeetup/# http://data

Thought ( मनन ) - 30: अनु के पापा

Writer - Manisha Pandey दो दिन पहले पुणे से मेरी दोस्‍त अनु आई थी। हम दोनों अलग-अलग शरीरों में जैसे एक-दूसरे की कार्बन कॉपी हैं। हमारे दिल-दिमाग एक, हमारे सपने एक, यहां तक कि हमारी लड़ाइयां और हमारी गालियां भी एक। लेकिन अभी मैं अनु नहीं, उसके पापा के बारे में कुछ बताना चाहती हूं। वो एक गर्ल्‍स इंटर कॉलेज के प्रिंसिपल हैं और हरियाणा के एक गांव में रहते हैं। पता है, वो अपनी दोनों बेटियों से, अपने स्‍कूल और अपने गांव की लड़कियों से क्‍या कहते हैं -1- अपने बापू से दहेज न मांग। उनसे आधा खेत मांग। आधा खेत भाई का तो आधा तेरा। अब कौन हल चलाना है। अब तो ट्रैक्‍टर से खेत जोतने हैं और लड़की भी ट्रैक्‍टर चला सकती है। अपना खेत खुद जोत और अपनी रोटी खुद कमा। अपना घर खुद बना। 2- भाई को राखी न बांध, न उससे पैसे ले। किसी से अपनी रक्षा करवाने की जरूरत नहीं। तू अपनी रक्षा खुद कर। 3- अपनी मर्जी से प्रेम कर, अपनी मर्जी से शादी कर। तेरा साथी कोई और नहीं ढूंढेगा। तू अपना साथी खुद ढूंढ। 4- तूने ससुराल नहीं जाना। न ही लड़के को घर जमाई बनाना है। दो लोग शादी करके अपना नया घर बनाओ। 5- प्रेम करने में कोई

Tutorial 15: Node.js common Error 3: Connection lost: The server closed the connection.

This error arises when you are trying to listen some other socket. it may be a external TCPSocket or it may be the connection to database server. The connection is closed from other side a you are still trying to read data from it. In most cases it happens when you use halfOpen:true You should be able to pinpoint the location of error with the help of above lines

Thought ( मनन ) - 29

People first try to live their own dream after that they give up their own dream and try to find their meaning of life by producing another life, making him dream of happier life, making him feel he have the same reason as they do in life, making him feel that they need to follow the rule, making him feel that there is something called emotion and you should not hurt their feelings. why do people have emotions? why do people like one person over the another? why do they have to follow the rules? why do people expect from other when they are not able to full fill their own expectations? "लोगो को लोगो को दुखी करने, फिर उन्ही लोगो को खुश करने में जितना आनंद मिलता है, उससे ज्यादा आनद कहीं नहीं मिलता, लोग इसी वजह को उनकी जिंदगी समझ लेते है "

Hindi Poem (हिंदी कविता ) - 19: वो मुस्कान बेचती है

Image
वो मुस्कान बेचती है कुछ मुलाकात के बाद फिर सवाल आया उसके पेशे पर  न कह सकी कि वो मुस्कान बेचती है   This is my shortest poem till now and still it tells me so many things. Given below is a Drawing I drew in 2007 which might be close to these words. For whom this poem is written is up to you to guess.

Tutorial 14: My favorite Node.js - libraries/modules

This is my list of selected node modules which can go in one single page application (Its highly biased list) Note: Only use all of the tools if they are required BASE node.js,npm,nodemon TESTING dependency and package management yeoman,bower,grunt yeoman generator generator-angular,generator-express-angular Live/Realtime Communication Socket.IO For login passport, [passport-basic,passport-local,passport-http] Backend Framework expressjs Frontend MVC AngularJS whatever you like FrontEnd UI Framework Twitter Bootstrap, Angular-ui (to fit with angularJS) Graphics D3.js Documentation yuidocs Database mongodb Date moment.js IDE webstorm,sublimetext,notepad++,brackets,vi FrontEnd Cache angular cachefactory For more: https://github.com/joyent/node/wiki/modules

Idea 11: tagging files with foldernames in file browser

Problem: I have collection of many images or books which can belong to multiple categories like C, algorithms, interview, database, OS, windows, for images icons, website headers, awesome, minimal, abstract, print. For songs new songs, old songs, romantic songs, comedy songs, awesome songs, slow songs, fast songs In current design of file browsers either I have to make multiple folders for each category and make duplicate copies of books or images to place in each folder. [in case i want to view items from a specific category ] Solution: Implement a tagging functionality in file browsers where it is easy to tag multiple files with a foldername or category name like in MS. excel we can copy content of cell to other cells just by dragging it  over other cells

Tutorial 13: Simple snippet C time_t to int

#include <stdio.h> #include <time.h> int main(){ struct tm tm; time_t epoch; if (strptime("2013-09-10 10:10:10", "%Y-%m-%d %H:%M:%S", &tm)) { epoch = mktime(&tm); printf("%d\n",(size_t)epoch); } else printf("error\n"); return 0; }

Tutorial 12: OpenLDAP ACLs (Access control lists)

Simple Rules 1. Allow everyone to read everything  access to * by * read by anonymous auth 2. Allows anonymous user to try authentication and self to change it access to attrs="userPassword" by self =w by anonymous auth 3. When nothing is working try It will allow all dn's to read everything, update self, and authenticate any anonymous user (if credentials are correct he will be successful.) access to * by anonymous auth by self write by users read For More visit: http://www.openldap.org/doc/admin24/access-control.html  http://www.openldap.org/doc/admin24/sasl.html http://wiki.mandriva.com/fr/uploads/3/3a/Mandriva-dit-access-template.conf http://www.egroupware.org/forum#nabble-td3984915 http://www.openldap.org/lists/openldap-technical/201007/msg00287.html http://www.openldap.org/faq/data/cache/1134.html http://www.openldap.org/cgi-bin/wilma_glimpse/openldap-software?query=dit&Search=Search&am

Tutorial 11: Links to Rest API documentor node.js

Swagger https://developers.helloreverb.com/swagger/ https://github.com/wordnik/swagger-node-express http://swagger.wordnik.com RestDoc http://www.restdoc.org/ https://github.com/jupe/restdoc Docrouter https://github.com/RestDoc/node-docrouter

Tutorial 10: OpenSSL 1: A simple connection without any security Using BIO

Following programs are basic implementation of BIO library. BIO is a abstraction library used to handle communication of various kinds, including files and sockets, both secure and not.for both secure and unsecure communication . Note: These programs are only for testing purpose and not optimize for production use. there may be some extra lines on code which are not used and still not removed. You will need openssl installed in your server to compile these programs. You can compile these two programs using gcc server.c -lssl -o server gcc client.c -lssl -o client Server: #include <stdio.h> #include <string .h> //for memset #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/bio.h> #define MAXCHARS 1024 int main(int argc, char *argv[]) { SSL_load_error_strings(); OpenSSL_add_all_algorithms(); char buf[MAXCHARS]; BIO *bio; if((bio = BIO_new_accept("port")) == NU

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

Tutorial 6: Summary of HTTP Protocol - Part 1

Default port for http is 80 and for https is 443 Different part of URL:             Protocol ://host:port/ resource_path ? query There are four popular types of verbs Get, Post, (Put, Delete)  others are  head(same as get but without msg body),  trace(to get the time toandfrom server ),  options (to retrieve server capabilities) STATUS CODES 1XX: Informational messages           100 : Expect, continue sending the data 2XX: Successful            200 : OK             202 : Accepted, but there may be no response           204 : No msg body in response           205 : Telling client to reset the content           206 : Partial content 3XX: Redirection           301 : Moved Permanently           303 : Temporary relocated           304 : Not Modified 4XX: Client Error           400 : Bad Request           401 : Unauthorized request           403 : Forbidden           404 : Wrong Resource url requested            405 : Method Not Allowed 5X

Tutorial 5: Some Useful (sample )join queries (specially for monetdb)

select * from (select 'a' as b,'c' as "c") as t1  left join (select 'b' as b,'d' as "d") as t2 using (b); select * from (select 'a' as b,'c' as "c") as t1  left join (select 'a' as b,'d' as "d") as t2 using (b); select * from (select 'a' as b,'c' as "c") as t1 right join (select 'a' as b,'d' as "d") as t2 using(b); select * from (select 'a' as b,'c' as "c") as t1 right join (select 'b' as b,'d' as "d") as t2 using(b); select * from (select 'a' as b,'c' as c) as t1 full join (select 'a' as b,'d' as d) as t2 using (b); select * from (select 'a' as b,'c' as c) as t1 full join (select 'b' as b,'d' as d) as t2 using (b); select * from (select 'a' as b,'c' as "c") as t1 natural full join (se

Tutorial 4: Node.js - common error 1: contentType and undesired downloading

Image
Many of beginners may face problem where they want to show some content and the file gets downloaded (the browser does not show the content in its window). This problem arises because of not setting the content type of response.  It is advisable to set the content type, If no content type is defined browser try to detect the type of content. If it contain some buffer (or any type that browser is not designed to render)  it tries to download the file. Normally it does not happen as most of the time the file is in html (or other browser/plugin known format like images, videos, text, pdf). A small file demonstrating use and effect of setting content type with node.js: var http = require('http'); /*var server = http.createServer(function (request, response) {   response.writeHead(200, {"Content-Type": "text/plain"});   response.end(" \n"); }); var server = http.createServer(function (request, response) {   response.writeHead(200, {"Cont

Totorial 3: simple Regular expression (regex) find replace in notepad++

Image
Let's suppose I have 100s of lines similar to this  { id: 'First Ack.', type: 'float'}, { id: 'Packets In', type: 'int'}, and I want to convert these lines in some format like : { id:'Packets In',field:'Packets In',type 'int'}, { id:'First Ack.',field:'First Ack.',type 'float'} To this in  notepad++ (also in most editors) search for id: (.*), type: and replace with id:\1,field:\1,type and press replace all and you are done no matter how many rows.

Ideas 10: Data usage monitor in routers

1. Better Internet Data usage manager Some internet connections have upper data limit. If multiple users uses a single connection, most of the software used now don't give the data each user have used till now. Nor it can assign specific limit to each user. (But it may be absolute in future as most of the connection will be unlimited. If I were to do something for country, Making internet fast and free would be one of the idea) 2. Better use of Bookmarks Bookmark are not used in way it should be used. I have more then 1000s of boomark on my computer but I rarely visit them using bookmark list. My use for them is to use them as browsers history. We can use them when some one googles something - we can show bookmarked images and links on search page (In right white space ) we can use them for browser homepage - to show which of your bookmarks are still popular on internet We can extract images and other stuff from them and save in the cloud

Idea 9: Problem with bookmarks and an Idea

Image
Note : You may have already read similar to this as I found out that some time this year mozilla community posted a similar article. We create a bookmark so that we can read it later, but the problem with bookmarks in that we never read them. From my own experience, I have more than 2000 bookmarks and I bookmarked those urls because I wanted to read them later. Now they( at-least some of them) are just used as a replacement of browser history as advanced system care deletes my browser history. IDEA or Solution : 1) What we can do with bookmarks is to first sync them with all browsers. Normally a web developer/designer uses atleast two or three browsers in multiple devices. After opera announced "it will move to webkit" some of the web designers would have felt good. (they would feel heavenly if IE does so but that will not happen). Coming to the point, I use many browsers in many devices if they sync the bookmarks across all devices that would be awesome. Xmarks

Idea 8: Fee structure for educational institute in rural areas

Normally in rural areas people register their children in school but they do not have good motive to send the child daily. To fix up this problem. Fix initial amount that is enough for people to not ignore, it will be returned after one year. (let's say 2000) For each absent of student he have to pay a fine of 50/100 rs. within 5 day, if not the final amount (2000) will not be returned. So institute will earn from absence of student and interest of that initial amount.

Thought ( मनन ) - 28: (Technical) A look at half empty glass of mobile world

Image
Motorola defy a rugged smartphone was announced on 1st of October, 2010. Later an updated version of this, defy+ was announced in 2011.The original defy had eclair and motorola released an froyo update for this phone. Defy+ was lucky enough to get shipped with android  Gingerbread inside. So I would like to compare these two phone models released 2-3 years ago to high end phones currently in market. OS Galaxy S3 was released with android 4.0 and can be updated to 4.1.x Nexus 4 was released with 4.2 most of other high end smartphone are running with android 4.0 or 4.1 With contribution from quarx2k and other developers from xda community both defy and defy+  can be flashed with highly stable android 4.1.2 and work on 4.2.2 is in progress. Camera Most of the high end smartphones are shipped with 8MP which is improved just in current series earlier all high end smartphones used to ship with 5MP. defy series have a camera 5MP Screen I have to accept - current smartp

Ideas 7: Startup Ideas in india (Non profit and profit)

Youtube channels Food channels  Good Places to visit in city Interviews of senior rural people and their lifehacks Wikipedia type - (profiles of people) You can just create profiles of people living in your colony on a blog  Doctors lawyers Architect Freelancer Electrician Teacher/Tutor (and other occupation useful in daily life with their profile and achievement) Social site/network for specific occupation (you can create google/facebook groups easily) there are many more but i tried  find some  things that you can start as a hobby  

Mail from past me(may, 2012) to me

If you ( +Gaurav Meena )have changed plz remember Nobody is wrong Try to understand others Forgive yourself Punish who are wrong but never take revenge Do not get angry +Gaurav Meena