The network is disabled after minimal install CentOS. You can use the following command to enable the network. service network start. The network service does not start after rebooting the system. Change the config file to make the network automatic start. The path of configuration file is /etc/sysconfig/network-scripts/ifcfg-eth0. The content of configuration file is like following.
The command alias helps us us short command instead of long command and parameters. The problem is when you next time login the shortcut is disappeared. You need to change the .bashrc file to define your specific aliases. The path of .bashrc is ~/.bashrc. For example, you want us vim instead of vi command. Edit your .bashrc file like following.
This page will show you often-used commands in Linux.
alias can help you make long command as a shortcut. For example, you have to type mysql -h host_address -u user_name -p when you need access mysql remotely. alias can make this efficiently. Create a shortcut for remote accessing by using the command below. Next time when you want to access database just type mysql-remote.
After creating virtual machine I want to install CentOS6 (32bit). I got the error message like following.
When I try to convert net.sf.json.JSONObject to json I got the JsonMappingException. After checking the stack information I know I forget init the value of user. The detail of exception is like following.
Last blog I have showed you how to export data from database. If you don't want to dump all data from database you can add --where parameter. If you want dump user info where age bigger then 27 the command is like following.
We need to convert java beans to another java bean when pass it from one layer to another. For example, you need to convert PO(persistent object) to BO(business object) when pass it from DAO layers to business layers. I recommend you to use Dozer instead of converting them by yourself.
If you want to reduce the relationship between a set of objects mediator pattern is a good choice . In mediator pattern objects don't know each others . All object to send the " event " to the mediator . Mediator knows every object and invoke the method of them if needed. In this page I will show you how "button" and "text" works in mediator pattern.
In this page I will show you how to use zookeeper as a configuration service. I use a standalone zookeeper for the demonstration. If you want to build a high availability configuration service click here for more detail.
Four roles in command pattern are client, invoker, receiver and command. Command invokes a method of Receiver to finish one command. Invoker knows which command will be executed. Invoker and Receiver do not know each other. After packaging the command you can repeat or undo it.
The best example of iterator pattern are source code of util package in JDK. If you want to learn more, I recommend you read the source code of JDK. (Including but not limited to:Iterator, ArrayList and HashMap). In this page I will make an easy example to show how iterator works. The structure of classes is like following.
In this page I will show you how to export and import sql file in command line. I assume you have installed MySQL in your environment, the database name is "user_db", the table is "users_tb", the password of this database is "password" and the username is "root".
You can use proxy pattern in your program, if you don't want use real object for some reason. For example, creating a real object is expensive or real object is in the remote machine. The key of proxy pattern is proxy object and real object implement the same interface and proxy object hold an instance of real object.
Flyweight pattern help you use as less memory as possible in your program. Let's say you want print a word (helloWorld) in your program. You can define 10 characters one by one (h, e, l, l, o, W, o, r, l, d). I think you certainly won't do this. When you define a string in java JVM won't new it directly it will check if this string exists or not. If this string is not defined then create a new one otherwise return the exist one. This is flyweight design pattern.