Wednesday, February 15, 2012

html2text

function html2text(){
var o={};
o.txt='';
o.t = document.getElementsByTagName('*');
for(o.i in o.t){
if(o.t[o.i].childElementCount > 0){
console.log(o.t[o.i].childElementCount, o.t[o.i].tagName);
}else{
console.log(o.t[o.i].innerHTML);
}
}
}

The World’s 50 Most Innovative Companies 2012 | Fast Company

Tuesday, December 13, 2011

Code: logout Api for Linkedin

Hmmm!
It's not an API, simple tric...!
Just JS dynamic image tag solves our problem....

open script tag
new Image().src='https://www.linkedin.com/secure/login?session_full_logout=&trk=hb_signout'
close script tag

njoy...

Friday, November 4, 2011

Various Social n/w And Various Mind Sets...




What ever it may be, Finally audience are defining various roots for various social network portals.

Thursday, November 3, 2011

Web site for what?

Seems to be very confusing to find a simple and professional web site. What  I did?

Easy to say words, but very hard to put efforts. Every one known.

 1. I took peace of paper and writing on it, What ever my mid says.
Like: AIM of web site, Profile of web site (business,personal...), Images (kind of [funny, kids, documentary,... ]), Logo, how many colors, how many pages ....etc

2. Content (based on web site profile)
3. I draw on paper as my wish.
4. And i shared with my friends.
5. I received many suggestion, based on that i re designed my web site.

Tuesday, November 1, 2011

Create your own CDN

Assuming, User known about Google appengine, and for awareness up to 1Gb this service is free (every 24 hr it will reset). If you need more bandwidth feel free to enable billing based on you usage.

No need get Surprise, Now a days! find next street awesome girl pic @ google.com. i.,e because of google front gate.

So, one day i thought! how may i use google front gate? and search for google api's which is very easy to reach google front  gate.
Finally i come to know one easy solution using google appengine, we can easy reach google front gate.
Yup, Yup....!
Then i started reading and completed with in couple of hours.

** CDN work for static data.
Are you ready with your CDN requirements?

For awareness before start CDN code, you have to know some more tech stuff, like how it works?
1. Source data
2. Cache
3. DataStore
4. Cache invalidator
5. URL fetch


Friday, October 28, 2011

Easy way to read cookie and with out loop..

Assuming, reader know about what is cookie.
As of you know, document.cookie is java script key word and most of the times i use to write on OOP's.
let us code:

  1. var obj={};
  2. obj.c=document.cookie;
  3. //Define read cookie name:
    obj.cName = '__utmz';
  4. //split obj.c, this way:
    obj.c1 =obj.c.split(obj.cName+'=');
    // here am adding "=" to cookie name, because browser stores cookie and values as in format of string
    Ex: "TL=te:0; __utma=150635877.1168279805.1319048317.1319048317.1319822141.2; __utmb=150635877.3.10.1319822141; __utmc=150635877; __utmz=150635877.1319048317.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
  5. simple check an condition if obj.c1 > 1 then expected cookie exist other wise, dose not exist.
  6. if Exists:
    obj.data = obj.c1[1].split(';')[0]
  7. Finally obj.data is your cookie data.
In single line of code for reading cookie value is
function readcookie(cookiename){
var val = '';
try{
//if cookie present on the doc
              val = document.cookie.split(cookiename)[1].split('; ')[0].split('=')[1]
 }catch(e){
//cookie dose not present on the doc.
val = '';
}
return val;
}

var cookieVal = readcookie('cookiename');

Thank you.