DNS and authoritative answers

Written on 13 November 2013, 05:37pm

Tagged with: , , ,

A simple trick about nslookup that I learned while reading the Smashing Magazine’s free preview of their Book #4

To start, the full syntax of nslookup is:
nslookup [-option] [hostname] [server]

When you run nslookup [hostname], it’s your local DNS server that answers the query. This answer is non-authoritative.
With an additional step, you can get the local name servers of the hostname: nslookup -type=ns [hostname]
Using one of these local DNS servers, you can query again: nslookup [hostname] [local_name_server]. This answer is authoritative.


$ nslookup www.smashingmagazine.com
Server: 194.168.4.100
Address: 194.168.4.100#53
Non-authoritative answer:
Name: www.smashingmagazine.com
Address: 80.72.139.101

$ nslookup -type=ns www.smashingmagazine.com
Server: 194.168.4.100
Address: 194.168.4.100#53
Authoritative answers can be found from:
smashingmagazine.com
origin = a.regfish-ns.net
mail addr = postmaster.regfish.com...

$ nslookup www.smashingmagazine.com a.regfish-ns.net
Server: a.regfish-ns.net
Address: 79.140.49.11#53
Name: www.smashingmagazine.com
Address: 80.72.139.101

To clean the DNS cache, use ipconfig /flushdns.

Paul Tero – How To Fix The Web: Obscure Back-End Techniques And Terminal Secrets
From the same author – Introduction to DNS: Explaining The Dreaded DNS Delay
smashing-book-4-cover

Update 12/feb/2017:

Use cases and requirements

Written on 7 November 2013, 11:38am

Tagged with: , ,

Functional vs non-functional requirements

Functional: describes the behavior of the system, its functionality; what the system should do
Non-functional: describes the performance characteristics of the system; how the system should be

Functional: the system must present the user an interface with the number of records in the db.
Non functional: the number of records must update in real-time.
—
Functional: the system must send an email when a new order is placed.
Non-functional: the emails should be sent with a latency of no greater than 10 minutes from such an activity.

Use cases

Use cases represent a practice for capturing functional requirements.

Use cases > scenarios:

A use case defines a goal-oriented set of interactions between external actors and the system under consideration.
A scenario is an instance of a use case, and represents a single path through the use case.
Use cases capture who (actor) does what (interaction) with the system, for what purpose (goal), without dealing with system internals.
– http://www.bredemeyer.com/pdf_files/functreq.pdf

Scenarios > use cases:

A scenario is a sequence of steps describing an interaction between a user and a system.
A use case is a set of scenarios tied together by a common user goal.
– Martin Fowler – UML distilled

In order to engage all the stakeholders, the use cases should be:
– written in an easy to understand language
– kept short (1-2 pages max)
– have a narrative language (user stories)
– have a clear structure (Title, Goal, Actors, Assumptions, Steps, Variations, Non-functional requirements, Issues)

Galtur

OO concepts refresher

Written on 5 November 2013, 12:19pm

Tagged with: ,

Going back to square one 🙂
http://docs.oracle.com/javase/tutorial/java/index.html

Class: the blueprint from which individual objects are created.
Object: the instance of a class. The objects have state (fields) and behavior (methods).
Encapsulation: Hiding internal state and requiring all interaction to be performed through an object’s methods (getters and setters). Note: this requires that the class fields are private (“In the spirit of encapsulation, it is common to make fields private. […] Use private unless you have a good reason not to.“)
concepts-object
Inheritance: Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. Subclass extends Superclass

This keyword: can be used either for a field (this.radius=radius) or for a constructor – this(0,0)

Class variables (static fields): they are common to all objects. There is only a copy of this variable, no matter how many times the class is instantiated.
Instance variables (non-static fields): they are distinct for each object. Each object has its own copy.
Example: Bicycle class, numberOfGears static field, speed non-static field. Each Bicycle object has its own speed (instance variable), but all of them have the same number of gears (class variable).

Instance methods: they need an instance of a class. instanceName.methodName(args)
Class methods: they can be used without an instance of the class. ClassName.methodName(args)
Class vs instance methods: Instance methods can access instance variables, instance methods, class variables and class methods directly.
Class methods can access class variables and class methods directly. But they cannot access instance variables or instance variables directly (they must use an object). They also cannot use the ‘this‘ keyword

Constants: static + final modifiers. Final indicates that the value cannot change:
static final double PI = 3.141592653589793;

Method overloading: Methods within a class can have the same name if they have different parameter lists. Warning: The compiler does not consider return type when differentiating methods, so you cannot declare two methods with the same signature even if they have a different return type.
Example:
public void draw (int i);
public void draw (double d); //ok
//--
public int draw (int i);
public void draw (int i); //compiler error

Method overriding: An instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and return type as an instance method in the superclass overrides the superclass’s method.
Method hiding: If a subclass defines a class method with the same signature as a class method in the superclass, the method in the subclass hides the one in the superclass.
Note: You will get a compile-time error if you attempt to change an instance method in the superclass to a class method in the subclass, and vice versa.

Super: If your method overrides one of its superclass’s methods, you can invoke the overridden method through the use of the keyword super: super.printDescription()

Polimorphism: Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class.
public void printDescription() {
super.printDescription();
System.out.println("The MountainBike has a" + getSuspension() + " suspension.");
}

Interface: a group of related methods with empty bodies. A class implements an interface
Package: a namespace that organizes a set of related classes and interfaces.

Abstract classes: cannot be instantiated, but they can be subclassed.
Abstract method: is declared without an implementation:
abstract void moveTo(double deltaX, double deltaY);
Abstract classes vs interfaces: Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain implemented methods. Such abstract classes are similar to interfaces, except that they provide a partial implementation, leaving it to subclasses to complete the implementation.

colors
Photo: instagram