Sunday, August 30, 2015

What Is Refactoring

Refactoring is "the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure," according to Martin Fowler, the "father" of refactoring. The concept of refactoring covers practically any revision or cleaning up of source code, but Fowler consolidated many best practices from across the software development industry into a specific list of "refactorings" and described methods to implement them in his book, Refactoring: Improving the Design of Existing Code. While refactoring can be applied to any programming language, the majority of refactoring current tools have been developed for the Java language.

One approach to refactoring is to improve the structure of source code at one point and then extend the same changes systematically to all applicable references throughout the program. The result is to make the code more efficient, scalable, maintainable or reusable, without actually changing any functions of the program itself. In his book, Fowler describes a methodology for cleaning up code while minimizing the chance of introducing new bugs.

In January 2001, automated refactoring tools began to appear in earnest, including the IntelliJ IDEA Java IDE (Integrated Development Environment), the X-ref plug-in tool for the Emacs editor and the Instantiations jFactor stand-alone refactoring tool. Many basic editing environments support simple refactorings like renaming a function or variable across an entire code base. Most current refactoring-capable tools support Extract Method and Inline Method at minimum, but support for more complex but useful refactorings like Extract Interface and Extract Superclass is still not common, though available.

Eric Raymond, a leading philosopher about program development, maintains that the concept of refactoring is consistent with the idea of get-something-working-now-and-perfect-it-later approach long familiar to Unix and open source programmers and hackers. The idea is also embodied in the approach known as extreme programming.

Saturday, July 4, 2015

Ten Favorite XForms Engines

Ten Favorite XForms Engines

Although XForms is largely described as an update to the decade old classic HTML formstechnology, XForms is also finding a home in many fresh areas where standards are increasingly vital, like content management and workflow systems. As a result, there are a large number of XForms engines currently under development by companies large and small.
According to reports, at the time of publication as Proposed Recommendation, W3C XForms was the most widely implemented W3C specification, ever. This presents a challenge to those thinking about trying out XForms.
This article offers a good starting point for XForms research. For each XForms engine, this article describes the software, system requirements, and other useful information as well as a screenshot. Keep in mind, too, there are even more XForms engines (in various stages of development) than presented here.

Chibacon Chiba

This long-running open source project has made great strides lately in XForms support and is nearing a 1.0 release. It's a server-based implementation, running on any Java 1.2/Servlet 2.2 compatible server. It includes some great documentation.
Screen shot.
Partial screenshot of Chiba, showing a tabbed entry form.

Sidebar: Client vs. Server XForms

Classic HTML and XHTML forms are firmly established as a client-side browser technology, so many are unaccustomed to a server-side forms engine. XForms, in contrast, is designed in a way that separates data definition from user interface definition, and thus lends itself well to more flexible implementation strategies.
The line between client and server XForms implementation can be drawn in any number of places, ranging from a "dumb terminal" client capable of little more than relaying data, to an advanced client with full validation and calculation capabilities.

IBM XML Forms Package

IBM has been a major supporter of the XForms standardization effort since the beginning, supplying two of the editors for work on the specification. In April of 2003, IBM unveiled two separate XForms engines on its alphaWorks Web site. The first is an XForms control that runs inside Internet Explorer, using browser extension techniques to listen for and render incoming XForms documents.
The other IBM engine is a Java XForms compiler, which takes an XForms document as input and produces a mass of JavaScript and HTML that works with Internet Explorer 5.5+, Netscape 7+, and Mozilla 1.0+.
The XML Forms Package includes additional technology, including an API for interacting with the XForms Model
Screen shot.
Screen shot of Internet Explorer showing a repeating set of input controls compiled by the IBM engine.

MobiForm SVGViewPlus

SVGViewPlus is a .NET user control primarily designed for rendering SVG images, but it also shows a key benefit of XForms: it can be used within a variety of XML vocabularies, including SVG.
Screen shot.
Screen shot of MobiForm's browser application, showing XForms and SVG side-by-side.

Mozquito DENG

As this article demonstrates, much of the innovation in this field is currently happening with smaller companies, and Mozquito is no exception. Answering the common question "when will browsers support XForms?" they have implemented, using the widespread Flash platform, not only extensive XForms support, but also SVG, XHTML, and CSS Level 3, all in an incredible footprint of only 60Kb. DENG runs in any Flash-enabled browser.
Screen shot.
Screen shot of DENG inside Mozilla Firebird on OS X, editing XHTML through XForms.

Novell XForms Technology Preview

As part of the Novell exteNd suite (formerly SilverStream software), XForms is playing a major role in their software to interact with web services, relational databases, and other data sources. Their first released XForms engine is a Java application that runs as a browser, one of the three main engines recorded in the XForms Implementation Report used to advance XForms to Proposed Recommendation (see the Related Links section below for more).
Screen shot.
The Novell engine rendering a the scriptless equivalent of a pocket calculator.

Orbeon Open XML Framework

Orbeon describes OXF as a "transformation framework", part of a system to create J2EE applications with minimal additional Java coding required. It uses XForms along with XSLT, XQuery, SQL, and web services interfaces as building blocks that together can compose an entire application.
Screen shot.
Screen shot of a sample OXF document, showing the form controls next to the resulting XML.

Oracle engine

Unlike classic HTML forms, XForms are designed to be supported on a wide variety of devices that might not be able to support a full JavaScript engine, including mobile phones. Oracle has produced an (unreleased) application that renders XForms documents within the confines of a small monochrome display. The following screen show shows the application running in a desktop phone emulator and is reproduced here with permission.
Screen shot.
Screen shot of a phone emulator displaying an XForms trigger control

Ripcord Technology nForms

nForms is a browser-delivered technology that enables XForms processing on the client (currently IE6-only). The site includes a number of illustrative examples that show the system in operation.
Screen shot.
Screen shot of a sample nForms document, showing a simple form next to the resulting XML.

University of Helsinki X-Smiles

X-Smiles, a complete browser written in Java, originated in 1998 as a university project. It has since taken on a life of its own, including support for XForms, XSLT, XSL formatting objects, SMIL, and SVG. The project supports a wide variety of Java versions, including small device and PDA configurations. X-Smiles is one of the three engines referenced in the XForms Implementation Report.
Screen shot.
Screen shot of X-Smiles rendering a document used to create UBL documents.

x-port FormsPlayer

FormsPlayer has its roots in a travel-based application x-port was developing for a client. In due course, the developers realized that what they needed was already provided by the then in-progress XForms specification, so they shifted their efforts to producing a general-purpose XForms plugin for IE6. FormsPlayer has an active mailing list where frequent updates are announced, rapidly converging on the final XForms specification. FormsPlayer is the third engine referred to by the XForms Implementation Report.
Screen shot.
FormsPlayer rendering a form that links together two Web Services.

Honorable Mention: Microsoft InfoPath

Microsoft InfoPath, part of the Office 2003 System, offers similar functionality to many of the applications listed here. Microsoft's application sports a fantastic user interface for end users, despite an insistence on providing layout through nested tables. The internal format InfoPath uses, however, is an XSLT-generated modified version of XHTML, not XForms.
A future article will provide a more in-depth comparison between InfoPath and XForms engines.






Saturday, June 27, 2015

Ant - Setup

Apache Ant Ant is distributed under the Apache Software License, a fully-fledged open source license certified by the open source initiative.
The latest Apache Ant version, including its full-source code, class files, and documentation can be found at http://ant.apache.org.

Installing Apache Ant

It is assumed that you have already downloaded and installed Java Development Kit (JDK) on your computer. If not, please follow the instructions here.
  • Ensure that the JAVA_HOME environment variable is set to the folder where your JDK is installed.
  • Download the binaries from http://ant.apache.org
  • Unzip the zip file to a convenient location c:\folder. using Winzip, winRAR, 7-zip or similar tools.
  • Create a new environment variable called ANT_HOME that points to the Ant installation folder, in this case c:\apache-ant-1.9.5-binfolder.
  • Append the path to the Apache Ant batch file to the PATH environment variable. In our case this would be the c:\apache-ant-1.9.5-bin\bin folder.

Verifying Apache Ant Installation

To verify the successful installation of Apache Ant on your computer, type ant on your command prompt.
You should see an output similar to:
C:\>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
If you do not see the above output, then please verify that you have followed the installation steps properly.

Monday, June 22, 2015

10 Server Security Threats Any Network Administrator Should Know

It is not a mountainous task to set up a server and establish a small task. Anyone with a capable machine can install it in his house do that. Perhaps, even host and publish websites. Today, many companies are offering leased servers and virtual private servers at affordable prices. What all this means is that someone with little or no experience can set up a server, publish websites, or even host other people’s sites. And there are several forums and online resources to help fresh server and/or network/system administrators get started.
Something that can be challenging to server or network administrator, both novice and experienced is the myriads of security threats that seem to evolve with time. All servers connected to a network, and especially the Internet, face some security threats. 
These 10 server threats are common and a must for any system administer to be aware of.

Brute Force Attack
In a brute force attack, the intruder attempts to gain access to a server by guessing a user password (usually the root administrator) through the SSH server, Mail server, or other service running on your system. The attacker will normally use software that will check every possible combination to find the one that works. Brute force detection software will alert you when multiple failed attempts to gain access are in progress and disable access from the offending IP address.

Open Relay
A Mail Transfer Agent (MTA) normally uses an SMTP server to send email from your server’s users to people around the world. With an open relay, anyone can use your SMTP server, including spammers. Not only is it bad to give access to people who send spam, it could very well get your server placed on a DNS blacklist that some ISPs will use to block mail from your IP. It is very easy to close an open relay. Just follow the documentation for your MTA.

Botnet
Attackers use botnets to automatically run and distribute malicious software on “agent” servers. They then use the agent machines to attack or infect others. Because all of this can be done automatically without user intervention, botnets can spread very quickly and be deadly for large networks. They are commonly used in DDoS attacks and spam campaigns.

DoS
DoS stands for Denial of Service, and is a technique attackers will use to effectively shut off access to your site. They accomplish this by increasing traffic on your site so much that the victim’s server becomes unresponsive. While some DoS attacks come from single attackers, others are coordinated and are called Distributed Denial of Service (DDoS) attacks. Often times, the users of computers executing a DDoS do not even know their computers are being used as agents.

Cross-site Scripting
Cross-site scipting or XSS is a technique that makes use of vulnerabilities in web applications. According to UK dedicated hosting server specialists at 34SP.com, the vulnerability allows the attacker to inject code in a server-side script that they will use to execute malicious client-side scripts or gather sensitive data from the user. You can fix most XSS problems by using scanner software to detect vulnerabilities and then fix whatever you find.

SQL Injection
Like XSS, SQL injection requires a vulnerability to be present in the database associated with a web application. The malicious code is inserted into strings that are later passed to the SQL server, parsed, and executed. As with other vulnerability-dependent attacks, you can prevent it by scanning for problem code and fixing it.

Malware
Malware can take many forms, but as the name implies, it is malicious software. It can take the form of viruses, bots, spyware, worms, trojans, rootkits, and any other software intended to cause harm. In most cases, malware is installed without the user’s direct consent. It may attack the user’s computer and/or attack other computers through the user’s own system. Having proper firewall and security software protection can usually prevent malware from spreading.

Unpatched Software
Most threats to a server can be prevented simply by having up-to-date, properly-patched software. All server operating system vendors and distributions publish security updates. By installing them on your system in a timely manner, you prevent attackers from using your server’s own vulnerabilities against it.

Human Weakness
The number one, most prevalent threat to a server’s security is user carelessness. If you or your users have passwords that are easy to guess, poorly written code, unpatched software, or a lack of security measures like anti-virus software, you are just asking for trouble. By enforcing strong security practices and secure authentication, you can lessen or even eliminate most threats.

Wednesday, June 3, 2015

How to Install a Template on Your Blogger Blog

Blogger.com is a publishing service owned by Google that provides blogging tools for free to Google account holders. You can utilize the many free templates and design elements provided by the service, or create or upload your own .XML templates to upload to your blog. This article will teach you step-by-step how to install a template on your blogger blog.
1. Sign in to your Google account


2. Click the "Design" tab for the blog you want to edit from your list of blogs.
Install a Template on Your Blogger Blog Step 3 Version 2.jpg
3. Click on “backup/Restore” button at the top right corner as shown
Install a Template on Your Blogger Blog Step 4 Version 2.jpg

4. Click “Choose File” to upload a template from your hard drive.
Install a Template on Your Blogger Blog Step 5 Version 2.jpg

5. Browse for your compatible .XML template and click open.Install a Template on Your Blogger Blog Step 6 Version 2.jpg

6. Click “Upload”
Install a Template on Your Blogger Blog Step 7 Version 2.jpg

7. After Upload template will be changed

Saturday, May 2, 2015

Clear Default Text using JAVASCRIPT

Many web designers like to add some default text to form inputs like text boxes, to signify what the user should type into the box. When the user clicks the input, this default is removed so they can begin typing. This can be a nice usability improvement when used correctly. Below you’ll find a nice, clean way to approach it, that requires minimal work on your part to get it working.

The HTML

On this page we’re going to work through an example of a single text box that comes with some default text. When the user clicks on the box, the default text is wiped away so that they can begin typing. If they click away from the box, without typing anything in, we will add the default text back so that they don’t forget what was meant to be typed. Check it out below:
Creating this text box is easy, we simply add the default text through the input’s valueattribute, like so:
Enter a date: <input type="text" name="date" value="yy-mm-dd">
This default — known as a “representative value” — suggests that in this case our form is expecting a date in the format “yy-mm-dd” (two numbers for the year, two for the month, and two for the day; for example “05-11-22”). This is very useful for users, since they will all have different preferences for how to enter dates. Coding all of these possibilities into your form-processing code can be a nightmare, so this way you can guide your users to enter the date in the preferred format, and save yourself the trouble.

The JavaScript

The magic part in all of this is accomplished through a sprinkle of JavaScript. You should have some knowledge of event handlers and working with forms to understand what happens next. This script is going to be made » unobtrusive, meaning you can add the JavaScript file to any page and it will just work without having to make big changes to the HTML of the page.
The setup of our JavaScript is as so:
  1. When the page loads, we will save the value of the input as a property of the element, so we can use it later.
  2. When the user clicks (or otherwise focuses) on the element, we check if the current value is the same as this saved default text. If it is, we clear the input. Otherwise we leave it as it is.
  3. When the user clicks away from the element, we check if they’ve filled anything into the text box. If they have, we do nothing. If they’ve left it blank, we’ll fill back in the default text.
This nicely breaks down into three JavaScript functions. First of all, we’re going to need myutil-functions.js file, which provides a slew of general-use functions. (Internet Explorer users, open the .js files with Notepad.) Import that file and this new clear-default-text.jsfile and you’re good to go. Save those two files among your other website files, and add this to the <head> of any pages you need it in:
<script type="text/javascript" src="util-functions.js"></script>
<script type="text/javascript" src="clear-default-text.js"></script>
Finally, and very importantly, for any text inputs that you want this to work on, you need to give them a special class, like this:
<input type="text" name="date" value="yy-mm-dd" class="cleardefault">
Our script checks for the existance of this class in order to work its magic. Those who want to understand how the code works can read on for the full explanation...

Explaining the JavaScript

So, our first function runs when the page loads, and finds all the input elements on the page. If the input has the type “text” (i.e. it’s a one-line text input), and it has the class “cleardefault,” we add event handlers for the focus and blur events.
addEvent(window, 'load', init, false);

function init() {
    var formInputs = document.getElementsByTagName('input');
    for (var i = 0; i < formInputs.length; i++) {
        var theInput = formInputs[i];
        
        if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {  
            /* Add event handlers */          
            addEvent(theInput, 'focus', clearDefaultText, false);
            addEvent(theInput, 'blur', replaceDefaultText, false);
Then we save the input’s current value into a new property that we’re creating, calleddefaultText. This makes use of JavaScript’s handy ability to add arbitrary properties to any element. We simply make up a new one so we can store this information as part of the element.
            /* Save the current value */
            if (theInput.value != '') {
                theInput.defaultText = theInput.value;
            }
        }
    }
}
So, now our inputs are set up, we need the function that run when the focus and blur events occur. They’re pretty simple. First, in both, we have to find the target element that actually fired the event. Once we have this, we check to see if the user has interacted with this input before, and react accordingly.
function clearDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == target.defaultText) {
        target.value = '';
    }
}

function replaceDefaultText(e) {
    var target = window.event ? window.event.srcElement : e ? e.target : null;
    if (!target) return;
    
    if (target.value == '' && target.defaultText) {
        target.value = target.defaultText;
    }
}
And that’s all there is to it. This script can be dropped into any page, and as long as the inputs on the page have been given the right class, it’ll work. Enjoy.

Friday, May 1, 2015

65+ Best Free Javascript Tutorials, PDF & eBooks For Web Developers

Javascript Tutorials
JavaScript has gained a lot of popularity as one of the main programming languages for the development of highly interactive web apps. This language has become an important factor for both web app developers as well as browser vendors. Owing to the increasing browser functionality, in terms of a greater amount of interpreter and compiler technology, JavaScript has become the bloodline of almost every organization. So, if you are looking forward to become a part of this much coveted IT sector, JavaScript is a must learn language for you.

A well used Javascript application will enable your pages to be more dynamic and be highly interactive with the end user with minimal server side interaction. Many recent server side applications and tools have been developed keeping Javascript as the client in mind. At the same time, there are dozens of MVC frameworks that have evolved using only Javascript. This has made web front end development must fast and very interactive. 

You may find a lot of good books on JavaScript and some books are aimed on AJAX, however in this post we have focused on different kinds of free web resources which will help you learn JavaScript online for free are:


Free eBooks And Noteworthy Online Tutorials

If you like to learn by reading, you will find plenty of free e-books which will take you through the various aspects of JavaScript language. Regardless of whether you are a beginner or an expert programmer, you will find an e-book which suits your needs the best.
  1. Eloquent JavaScript A Modern Introduction to Programming
  2. Essential JS Design Patterns eBook
  3. JS eBook by InformIT
  4. It eBooks - A good collection of Free JavaScript eBooks with a lot of other useful programming books as well.
  5. Introduction To JavaScript Unit Testing
  6. Which JavaScript Recipe Is Right For You?
    This is a javascript tutorial for beginners.
  7. Building A Relationship Between CSS & JavaScript. This is a javascript tutorial for web designing using JavaScript.
  8. Writing Fast, Memory-Efficient JavaScript
  9. Make your JavaScript apps smoother
  10. A-Z of JavaScript
  11. Introduction to HTML5 Web Workers
  12. Net Magazine JavaScript Tutorials
  13. Design Patterns in Javascript - by TutsPlus
  14. Principles of Maintainable JavaScript - By TutsPlus

Free Websites

In case, you are beginning to learn JavaScript, there can be nothing better than seeking the help of an online website. These online websites are available free of cost and are easier to access from everywhere, provided you have internet.
  1. Mozilla Developer Network - Developer Mozilla JS Guide
  2. W3cSchool
  3. Ajaxian
  4. Interactive Javascript tutorial
  5. Javascript tutorial by codecademy
  6. Nathans Lessons
  7. JavaScript Tutorial By Knockoutjs
  8. JavaScript info
  9. JavaScript Guide By HTMLDog
  10. JavaScript Bookon WikiBooks
  11. JS Tutorial on Javascript Kit
  12. Echo echo Javascript
  13. Tutorialized - JS Tutorial
  14. Tutorialspoint
  15. Html Goodies
  16. Pagere Source JS
  17. JS Tutorial by Brown University
  18. Web Monkey - Advanced JS Tutorial
  19. HTML.net
  20. Microsoft App using JS- Create your first Windows Store app using JavaScript
  21. Good Tutorials
  22. JS Made Easy
  23. AppendTo
  24. Your HTML Source
  25. Site Point JS Tutorial

Free Video Tutorials

It can be quite difficult for some people to learn JavaScript on their own. However, you can easily watch one of the online video tutorials which teach best practices, right from the beginning. Everything from basic to the advanced concepts is covered in these online tutorials.
  1. YUI Blog - Douglas Crockford is Yahoo!'s JavaScript architect
  2. Some more Video tutorials By Douglas Crockford Yahoo!'s JavaScript architect.
  3. The Good Parts
  4. A JavaScript video tutorial series
  5. JavaScript Tutorialsby newboston
  6. Learn everything there is to know about JavaScript - Document Object Model : Dynamic Styling : AJAX : Form Validation
  7. JS Tutorials Playlist on Youtube by Chris Walker
  8. Introduction to JavaScript and Browser DOMBy GoogleTechTalks
  9. Javascript Tutorials Compilation by FromDev.com For Beginners Playlist - A Playlist of some hidden great javascript tutorials that you can use to learn and expert JS programmer.
  10. Introduction to Javascript Programming
  11. Speed Up Your JavaScript - By Google Tech Talks
  12. Douglas Crockford: Advanced JavaScript
  13. Introduction to JavaScript and HTML5 Canvas
  14. JS Tutorials Playlistby Adam Khoury
  15. Video Tutorials Playlist on Advanced JavaScript programming including various tips & techniques

Best Free Cheat Sheets & PDF For JavaScript

JavaScript cheat sheets will act as your quick reference guide. It is designed in a manner so as to act like a reminder sheet, listing the various functions and methods of JavaScript so that you can never go wrong with its usage.
  1. Added Bytes Cheatsheet on JavaScript
  2. JS Reference Booklet
    This ebook can serve as a really useful cheatsheet and Javascript tutorial PDF for beginners (download free ).
  3. Javascript.su
  4. Javascript Reference
  5. JS FAQs
  6. Cheatsheet for Prototype JS Library. This is a quick javascript reference PDF for web designing using Prototype JS library.


Best Free Web Forums To Ask Questions


Only learning the language on your own isn’t enough. You must become part of one of the JavaScript web forums where constant discussions pertaining to JavaScript and other related technologies take place.
  1. Stackoverflow - I find this to be the best place for Javascript related questions and answers. Make sure to tag your questions appropriately and search for similar questions before posting.
  2. Coding Forums JavaScript
  3. Code Project JavaScript
  4. Web Developer JavaScript
  5. HTML Help Centeral

Some Informative And Useful JavaScript Blogs


There are a lot of other websites and blogs created by JS experts that you may 
  1. Badassjs
  2. Microsoft JS Development Blog
  3. Web Reflection

So, whether you are simply starting out, want to enhance your skills or are quite an experienced JavaScript professional, these resources will help everyone grab something worthwhile.