Using Program Parameters in Java Part-2

Fadıl

Alternatives to the command line

Giving parameters on the command line is not always the best way to enter properties for your program. A typical situation where something else is needed is when your Java program isn’t invoked through a main method. An good example is when you have coded a servlet for a web server. In this situation you may use the web.xml file to specify the parameters you need.

Using Program Parameters in Java Part-1

Fadıl

Introduction

Every programmer will encounter a situation where a choice must be made between various alternative solutions. Should tabular data be sorted in one way or another? What exactly is the graphical layout of your HTML pages? How often should you poll a queue? Most often you’ll know the path to take based on the requirements specifications, a design manual or some other kind of documentation, but now and then you’ll have to choose without help. Instead of just selecting one solution and hoping the customer will like it when he or she starts using your code, you could make it a “program parameter” or “option”.

How to Blacklist Filters on MikroTik RouterOS?

How to Blacklist Filters on MikroTik RouterOS?

Fadıl

To prevent your users from accessing blacklist IP addresses, you need to create the following firewall rules. Thus, we protect our users from unnecessary sites.

In order to use any of the following lists you will want to add a rule to your input or forward chains like the following:

/ip firewall  filter add action=drop chain=input 
comment=" Drop new connectionsfrom blacklisted IP's to this router" 
connection-state=new  in-interface=ether1 src-address-list=blacklist

or

/ip firewall filter
add action=drop chain=forward comment=" Drop new connectionsfrom blacklisted 
IP's to this router"  dst-address-list=blacklist

SpamHaus

“Spamhaus Don’t Route Or Peer List (DROP)”

The DROP list will not include any IP address space under the control of any legitimate network – even if being used by “the spammers from hell”. DROP will only include netblocks allocated directly by an established Regional Internet Registry (RIR) or National Internet Registry (NIR) such as ARIN, RIPE, AFRINIC, APNIC, LACNIC or KRNIC or direct RIR allocations.”

Introduction to Java :Components Part-2

Fadıl

Lists

You will recall that in the SELECT widget in HTML programming, you could select how many choices were visible at any one time using the SIZE attribute. Well, since the Choice widget does not have such an attribute, you need to use a different component if you want that functionality. In the JDK, the List component is used for such circumstances.

import java.awt.*;

public class ListExample
  {
  public static void main(String[] args)
    {
    Frame baseFrame = new Frame();
    baseFrame.reshape(10,10,200,200);
    baseFrame.setTitle("List Example");
    List list = new List(3, true);
    list.addItem("Selena");
    list.addItem("Eric");
    list.addItem("Mark");
    list.addItem("Bob Frog");
    baseFrame.add(list);
    baseFrame.show();
    }
  }

Menus allow you to organize many related functions in your application in one centralized, easy-to-use interface object. Although Menus come in many forms, the most common menu types are “menu bars.”

PHP Function:  Built-in Functions part 8

PHP Function: Built-in Functions part 8

Fadıl

Misc. Functions

The die() and exit functions provide useful control over the execution of your script, offereing an ‘escape route’ for programming errors.

die()
Outputs a given message and terminates the script when a returned value is false. Its syntax is

die(“message”);

for example, you would use the following code to print a message and stop the execution of your script upon failure to connect to your database:

$connection = mysql_connect(“servername”, “username”, “password”)
or die(“Can’t connect to database.”);