Thursday, 21 November 2013

A Developer’s Fear

I've writing about the effects of fear on a Developer (and a human) over the last couple of weeks, here are some quotes that I've been tweeting on the way:- 

1. When a team recognizes failure without blame or embarrassment the fear of experimentation evaporates and creativity can flourish.                                                                                                          
2.  At sea we felt fear of fire, rocks and drowning but it was no comparison to the fear I felt sat in a cubicle in my first office job.                                                                                                                                           
3. I learnt to love those who repressed my creativity and worked hard to please them by excelling at the routine
                                                                                                                       
4. A preference for elegant code over people’s messy behavior encouraged me to create a protective bubble around myself.       
                                                                                                              
5. My bubble consisted of a pair of headphones and technical language designed to alienate rather than communicate with clarity.                                                                                                                                           
6.  In a team free of fear I listen with an open mind. Ideas emerge and strengthen with each contribution. Creativity bonds us.    
                                                                                                                      
7. need a respectable position in this informal social hierarchy – it stands in the way of treating all people equally and listening openly.       
                                                                                                                     
8. Without fear our minds are free* to find better ways of working. We do it every day, all day. We do “the work” as we discover the methods.       
                                                                                                                  
9. If you Ask me and I’ll tell you about my strong belief in equality, step inside my head and I’m deciding whether to look up to or down on you.      
                                                                                                            
10. Thinking about the way I behaved before working in supportive team. Fear and competition often lead to sarcasm and condescension.    
                                                                                                                           
11. As we grew as a team, dysfunctional behaviors caused by fear started to evaporate and be replaced with supportive and empathetic ones. 
                                                                                                                           
12. Fear can utterly dominate our behavior. It stops us thinking, helping, learning, discovering and sharing; the things we need in abundance.


13. Without the proper guidance, structure, and talent, junior developers can distract and degrade the output of any team.

JAVA : Get html Page Source through Website URL

ok
This code will grab the HTML source from a given URL. Change "website here.com" to a real URL starting with http:// and the program will display the index pages source code in the console. The nice thing about this code is it spoofs the connection to make it look like its a web browser. This enables you to navigate to sites like google that normally block connections from non web browser applications.There are several ways to get the HTML content of a URL from Java. There are even more ways to get the HTML using open source java. For example, url is www.google.com and my servlet needs to read the html source code but for this You don't need servlet to read data from a remote server. You can just use java.net.URL or java.net.URLConnection class to read remote content from HTTP server.Some Web Sites do not allow visitors to view the HTML source of their web pages. They can disable our right mouse button to prevent accessing the "view source" menu option and some other web sites open their pages in a special window which has no menu bar to select the "Source" option from "View" menu.

Apache Commons HttpClient
You can also use the Apache Commons HttpClient for a slightly easier to use library.
HttpClient client = new HttpClient();
HttpMethod method = new GetMethod("http://mohanraghuwanshi.blogspot.in/");
try {
 client.executeMethod(method);
 byte[] responseBody = method.getResponseBody();
 System.out.println(new String(responseBody));
} catch (Exception e) {
 e.printStackTrace();
} finally {
 method.releaseConnection();
}
Java Development Kit (JDK)
In this Class I used  InputStream method.
public class WebsiteSource
{
       public static void main(String[] args) throws IOException{
      
       URL url = new URL("http://www.infostretch.com");
       System.out.println(" portno:" +url.getPort());
       System.out.println("Host:" + url.getHost());
//     System.out.println("file:"+url.getFile());
       URLConnection connection = url.openConnection();
       long date = connection.getDate();
       if (date == 0){
              System.out.println("No Date found");
       }
       else{
              System.out.println("Date is :" + new Date(date));
       }
       if(connection.getExpiration()==0)
       {
              System.out.println("no expiration date found");
       }
       else{
              System.out.println("Exp Date :"+new Date(date));
       }
       if(connection.getLastModified()==0)
       {
              System.out.println("no last modified date found");
       }
      
   else{
       System.out.println("Modified Date :"+new Date(date));
       }
       int len = connection.getContentLength();
       if(len == -1)
              System.out.println("Content length unavailable.");
              else
              System.out.println("Content-Length: " + len);
       if(len != 0) {
              System.out.println("=== Html Contents page ===");
              InputStream input = connection.getInputStream();
              int htmlSrc ;
              while (((htmlSrc = input.read()) != -1)) {
              System.out.print((char)htmlSrc);
              }
              input.close();
              } else {
              System.out.println("No content available.");
              }
       }
}

Getting started with Elasticsearch and Node.js

  In this article we're going to look at using Node to connect to an Elasticsearch deployment, index some documents and perform a simple...