How to start JBoss AS 7 from command line linux


To start Jboss apply the following command;

/var/jboss7/bin/standalone.sh

Advertisements

How to import mySQL dumb file into database from command line Windows OS


Type the following command first to connect mySQL DB from command line;

C:\Users\tuna>mysql -u root -p
Enter password: type your db password here
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>
mysql>source C:\file.sql

and after pressing enter, import will be started

How to use FilenameFilter by an example code


By running the following code, only the .log file will be listed by implementing FilenameFilter.

The vital method for this code is public boolean accept used to Filter all files inside a directory.


import java.io.File;
import java.io.FilenameFilter;

public class FileNameFilterExample{

/**
 * @param FilenameFilter example
 */
 public static void main(String[] args) {

 File c = new File ("C:\\");
 FileNameFilterExample mainClass = new FileNameFilterExample();
 FileNameFilterExample.FileNameFiltering filter = mainClass.new FileNameFiltering();

 String [] fileNames = c.list(filter);
 for(String fileName : fileNames) {
 System.out.println(fileName);
 }

 }

public class FileNameFiltering implements FilenameFilter {

@Override
 public boolean accept(File dir, String name) {
 // listing only .log files
 return name.endsWith(".log");
 }

 }

}

Sample output of the code;

a – Copy (2).log
a – Copy (3).log
a – Copy (4).log
a – Copy (5).log
a – Copy.log
a.log