2026年3月12日星期四

Fortigate Fortiswitch offline but works

execute switch-controller diagnose-connection yoursn

 

If not ntp issue, it's DHCP issue.

 

How to fix:

Go to Wifi & Switch Controller -> Fortilink Interface -> enable DHCP and save 

2021年11月22日星期一

Ngx-admin echarts is not defined

In angluar.json, please add the following line. 

{ 

..., 

"scripts": 

[ "node_modules/echarts/dist/echarts.min.js", 

... 

], 

... 

}

2020年1月24日星期五

FWD: Handle showModalDialog event

Handle showModalDialog in a WebBrowser control host 时间 2006-09-18 标签 webbrowser documentation object function windows behavior 原文 http://blog.csdn.net/jiangsheng/article/details/1234930 It is not officially possible prior to Windows XP SP2 and Windows 2003 SP1. see NWMF_HTMLDIALOG in MSDN documentation for more information. However, you may "set" the "showModalDialog" property of the window object to a custom function in order to override the default behavior after the Document Object Modal (DOM) is available. The DOM is available between the DocumentComplete event and the BeforeNavigate2 event of the top level browser object. window.showModalDialog = functionName here the signature of functionName is function functionName(sURL, vArguments, sFeatures) for more information about Dynamic Object Composition , see http://www.microsoft.com/mind/1099/dynamicobject/dynamicobject.asp

2018年3月6日星期二

Google Map cid to placeid or get address detail by cid

I searched many posts and couldn't find a way to do it. But I found a hidden api in google map get place detail api. From Google Map Place API document: https://developers.google.com/places/web-service/details The API https://maps.googleapis.com/maps/api/place/details/json?... needs placeid as required parameter. But I found it can use cid to get place detail and place_id. Usage: https://maps.googleapis.com/maps/api/place/details/json?cid=YOUR_CID&key=YOUR_KEY That's it. It returns a result contains formatted address, place_id, name of the address and GPS coordinater. Hope it could help you!:) Happy coding. TAG: Google Map cid to placeid or get address detail by cid

2016年12月1日星期四

WD my book live transmission 2.92

I compiled a transmission 2.92 for WD my book live. Please see: https://github.com/soyoeml/transmission-2.92 There is a instructions for how to compile. Enjoy! TAG: WD my book live transmission 2.92 compile

2016年11月23日星期三

error while loading shared libraries: .so : cannot open shared object file: No such file or directory

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory Fix: If you have the lib, just make a symbol link. ln -s your_path/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

error: Package requirements (libcurl >= 7.15.4) were not met

When I compile transmission 2.92 for my WD my book live, I got this error when running ./configure. error: Package requirements (libcurl >= 7.15.4) were not met But my libcurl version is 7.24 already. Fix buy this: ----------------------------------------------------- ./configure --disable-mac --disable-nls OPENSSL_CFLAGS=-I/opt/include OPENSSL_LIBS="-L/opt/lib -lssl -lcrypto -ldl" LIBEVENT_CFLAGS=-I/opt/include LIBEVENT_LIBS="-L/opt/lib -levent" ZLIB_CFLAGS=-I/opt/include ZLIB_LIBS="-L/opt/lib -lz" LIBCURL_CFLAGS=-I/opt/include LIBCURL_LIBS="-L/opt/lib -lcurl" -----------------------------------------------------

2016年3月21日星期一

cannot print tornado http headers





tornado.httputil.HTTPHeaders object at XXXXX

That's because of tornado version problem. Please install these version >=3.1 and <= 4.2.

tornado <=4.2, >=3.1



Tag: cannot print tornado http headers tornado.httputil.HTTPHeaders object at

2015年9月29日星期二

tomcat ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY

Please add the following content in tomcat/conf/server.xml   443 section:


ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,
TLS_RSA_WITH_AES_256_CBC_SHA,SSL_RSA_WITH_RC4_128_SHA"

2015年8月28日星期五

openfire 3.8.2 mysql high CPU 100%

I check the database statistics by(mysql > show full processlist;)

This query cosumed a lot CPU:

SELECT username FROM ofUser WHERE username LIKE ?


I read source code of openfire and found it has been used in following locations:

----------------------------------------
searching 'username like' in 'C:\openfire_src_3_8_2\openfire_src\src\java\org\jivesoftware\openfire\user\DefaultUserProvider.java' :
C:\openfire_src_3_8_2\openfire_src\src\java\org\jivesoftware\openfire\user\DefaultUserProvider.java(427):                 sql.append(" username LIKE ?");
found 'username like' 1 times。
----------------------------------------
searching  'username like' in 'C:\openfire_src_3_8_2\openfire_src\src\java\org\jivesoftware\openfire\user\JDBCUserProvider.java' :
C:\openfire_src_3_8_2\openfire_src\src\java\org\jivesoftware\openfire\user\JDBCUserProvider.java(326):                 sql.append(" username LIKE ?");
found  'username like' 1 times。


I changed like to =. 

SELECT username FROM ofUser WHERE username = ?

Then rebuild and replace openfire.jar of production.


Now mysql only cosume 4% CPU. :)



TAG: openfire 3.8.2 mysql high CPU 100%

2015年8月4日星期二

Notes: SSL received a weak ephemeral Diffie-Hellman key in Server Key Exchange handshake message. (Error code: ssl_error_weak_server_ephemeral_dh_key)

SSL received a weak ephemeral Diffie-Hellman key in Server Key Exchange handshake message. (Error code: ssl_error_weak_server_ephemeral_dh_key)

resolution:
----------------------------------------------------------------------------------------
1) In FireFox, enter "about:config" in the URL field and press enter.
2) Accept the "This might void your warranty!" warning :)
3) In the search field at the top, enter "security.ssl3.dhe_rsa_aes"
4) Double click each result (128 and 256) to toggle the Value to "false"


From:https://support.mozilla.org/en-US/questions/1066238

2013年9月26日星期四

2013年8月27日星期二

ejabberd spark cannot login

{hosts, ["domain.com"]}

Please change the hosts to outside domain name in ejabberd.cfg.

2013年8月23日星期五

java json parse

a. add flexjson-2.1.jar
b. create class

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;
public class Users {
 private String username;
 private String password;
 public String getUsername() {
  return username;
 }
 public void setUsername(String username) {
  this.username = username;
 }
 public String getPassword() {
  return password;
 }
 public void setPassword(String password) {
  this.password = password;
 }
 public static Users fromJsonToPostUser(String json) {
        return new JSONDeserializer<Users>().use(null, Users.class).deserialize(json);
    }

}


c. in main function

public class test {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stu
  String json = "{username:\"test1\",password:\"testp\"}";
  Users user = Users.fromJsonToPostUser(json);
  System.out.println(user.getUsername());
 }
}


URL ref: http://flexjson.sourceforge.net/javadoc/flexjson/JSONDeserializer.html

2013年8月13日星期二

windows 7 windows xp command show proxy settings

windows xp:
netsh -> diag -> show ieproxy

windows 7:
netsh -> winhttp -> show proxy

mysql hibernate duplicated entry duplicated id

Understanding Hibernate <generator> element

     

In this lesson you will learn about hibernate< generator> method in detail. Hibernate generator element generates the primary key for new record. There are many options provided by the generator method to be used in different situations.
The <generator> element
This is the optional element under <id> element. The <generator> element is used to specify the class name to be used to generate the primary key for new record while saving a new record. The <param> element is used to pass the parameter (s) to the  class. Here is the example of generator element from our first application:<generator class="assigned"/>
In this case <generator> element do not generate the primary key and it is required to set the primary key value before calling save() method.
Here are the list of some commonly used generators in hibernate:
GeneratorDescription
incrementIt generates identifiers of type long, short or int that are unique only when no other process is inserting data into the same table. It should not the used in the clustered environment.
identityIt supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int.
sequenceThe sequence generator uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int
hiloThe hilo generator uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a table and column (by default hibernate_unique_key and next_hi respectively) as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database. Do not use this generator with connections enlisted with JTA or with a user-supplied connection.
seqhiloThe seqhilo generator uses a hi/lo algorithm to efficiently generate identifiers of type long, short or int, given a named database sequence.
uuidThe uuid generator uses a 128-bit UUID algorithm to generate identifiers of type string, unique within a network (the IP address is used). The UUID is encoded as a string of hexadecimal digits of length 32.
guidIt uses a database-generated GUID string on MS SQL Server and MySQL.
nativeIt picks identity, sequence or hilo depending upon the capabilities of the underlying database.
assignedlets the application to assign an identifier to the object before save() is called. This is the default strategy if no <generator> element is specified.
selectretrieves a primary key assigned by a database trigger by selecting the row by some unique key and retrieving the primary key value.
foreignuses the identifier of another associated object. Usually used in conjunction with a <one-to-one> primary key association.

2013年7月26日星期五

FW: openfire cluster

Openfire + Hazelcast on Amazon EC2

I have been searching high and low for something, somwhere, to guide me on this beast that is clustering. After shedding a few liters of blood sweat and tears, I finally was able to get my cluster up.
This post should prove useful for my future self. You’re welcome, future self.
The end result: One DB server, a cluster of Openfire servers and a load balancer to distribute traffic. Sweet!

Launch an Instance

  1. Launch an EC2 Instance, in my case I used a micro instance for testing. Just follow the Request Instance Wizard and you’ll be fine.
  2. Take note of your key-pair. Download it, keept it and savor it’s essence.
  3. When setting up your firewall, free dem ports:
    • 22 (SSH)
    • 3478
    • 3479
    • 5222
    • 5701
    • 7070
    • 7443
    • 7777
    • 9090
    • 9091
  4. SSH to your server by doing ssh -i your_pem_file.pem ubuntu@your-instance-public-dns

Launch a DB Server on RDS

  1. I’m using MySQL, so I’m just gonna go ahead and choose that.
  2. Name your database appropriately.
  3. Remember your Master Username and Password. You’re gonna need it.
  4. Update your RDS security groups. Head on to the RDS console and select DB Security Groups. Add your EC2 instance to the list as an EC2 Security Group.

Setup Openfire

  1. Install Java with:
     sudo add-apt-repository ppa:webupd8team/java
     sudo apt-get update
    
     sudo apt-get remove --purge openjdk*
     sudo apt-get install oracle-java-7-installer
    
     java -version
    
  2. Install Openfire with:
     wget -O openfire.tar.gz http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_3_8_1.tar.gz
    
    Change the version to the latest stable available. Then untar and move like so:
     tar -xzvf openfire.tar.gz
     mv openfire/ /opt
    
  3. Edit your hosts file in /etc/hosts and add a line to let the server know what’s its name is. Hosts file should look like:
     127.0.0.1 localhost
     127.0.1.1 ubuntu
     127.0.0.1 chat.yourdomain.com
    
  4. Run Openfire by going to /your_openfire_directory/bin and running ./openfire start
  5. Visit http://your-instance-public-dns:9090 and it should give you the first step for the Openfire setup wizard. Plow through the wizard like a champ. Just remember the following important points:
    • The host should be the one you set in your /etc/hosts file a while ago.
    • The database host should be the host on the RDS DB server from the setup above.
    • The database username and password is your MASTER username and password from RDS.
  6. Install Hazelcast! On your Openfire Admin Panel, Go to Plugins > Available Plugins > Install. If you don’t see any plugins on the Available Plugins page, you can find an update link on the page.
  7. Go back to the terminal and we’ll change a few settings for the cluster to work. Edit the file in /your_openfire_directory/plugins/hazelcast/classes/hazelcast-cache-config.xml. Find the <network> tag and we should configure it like so:
    ...
    <port auto-increment="true">5701</port>
    <join>
      <multicast enabled="false" />
      <tcp-ip enabled="true">
        <hostname>private-ip-address-of-this-machine:5701</hostname>
      </tcp-ip>
      <aws enabled="false"/>
    </join>
    <interfaces enabled="true">
      <interface>private-ip-address-of-this-machine</interface>
    </interfaces>
    ...
    
    The private IP address of your machine can be found on your Amazon EC2 Console on the instance details under Private IPs.
  8. Restart your Openfire server by going to /your_openfire_dir/bin and doing ./openfire stop and ./openfire start Visit your Openfire Admin Console and enable clustering. You should be able to join a cluster with one node running. Neat.

Growing your Openfire army

  1. On the EC2 Console, create an AMI of the Openfire instance. Launch a new instance using the AMI.
  2. On the wizard, use the same settings as we had with the other instance.
  3. SSH to the new server and edit /your_openfire_directory/plugins/hazelcast/classes/hazelcast-cache-config.xml. The config should now look like:
    ...
    <port auto-increment="true">5701</port>
    <join>
      <multicast enabled="false" />
      <tcp-ip enabled="true">
        <hostname>private-ip-of-the-other-machine:5701</hostname>
        <hostname>private-ip-address-of-this-machine:5701</hostname>
      </tcp-ip>
      <aws enabled="false"/>
    </join>
    <interfaces enabled="true">
      <interface>private-ip-address-of-this-machine</interface>
    </interfaces>
    ...
    
    Make sure the IP addresses for the machine is correct.
  4. Restart Openfire.
  5. Go to the Openfire Admin Console and enable clustering.
  6. SSH to the server that we first set up and edit the hazelcast config file. Add a new <hostname> line on the file with the IP address of the new instance we just created.
  7. Restart Openfire for that
  8. Just repeat the process should you want to add more instances to the cluster.

Setup Load Balancing

  1. On the EC2 Console under Load Balancers, create a new load balancer.
  2. Open up these ports under Load Balancers > Listeners:
    • HTTP 80
    • TCP 3478
    • TCP 3479
    • TCP 5222
    • TCP 5262
    • HTTP 9090
    • HTTP 7070
    If you need SSL, you need to upload them and attach them to a listener.

Final Steps

On your DNS manager, make a CNAME record that points to the load balancer, and that’s it!
If you’re stuck or can’t get this to work and you think I might be of help, drop me an email vincent.paca@gmail.com.

WHost '*' is not allowed to connect to this MySQL serverConnection closed by foreign host.

grant all privileges on *.* to 'root'@'your ip' identified by 'your password';

FW: Change mysql folder

MySQL is a widely used and fast SQL database server. It is a client/server implementation that consists of a server daemon (mysqld) and many different client programs/libraries.

If you want to install Mysql database server in Ubuntu check this tutorial.

What is Mysql Data Directory?
Mysql data directory is important part where all the mysql databases storage location.By default MySQL data default directory located in /var/lib/mysql.If you are running out of space in /var partition you need to move this to some other location.
Note:- This is only for advanced users and before moving default directory make a backup of your mysal databases.
Procedure to follow
Open the terminal
First you need to Stop MySQL using the following command
sudo /etc/init.d/mysql stop
Now Copy the existing data directory (default located in /var/lib/mysql) using the following command
sudo cp -R -p /var/lib/mysql /path/to/new/datadir
All you need are the data files, so delete the others with the command
sudo rm /path/to/new/datadir
Note:- You will get a message about not being able to delete some directories, but that's what you want.
Now edit the MySQL configuration file with the following command
gksu gedit /etc/mysql/my.cnf
Look for the entry for "datadir", and change the path (which should be "/var/lib/mysql") to the new data directory.
Important Note:-From Ubuntu 7.10 (Gutsy Gibbon) forward, Ubuntu uses some security software called AppArmor that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you'll never be able to restart MySQL with the new datadir location.
In the terminal, enter the command
sudo gedit /etc/apparmor.d/usr.sbin.mysqld
Copy the lines beginning with "/var/lib/mysql", comment out the originals with hash marks ("#"), and paste the lines below the originals.
Now change "/var/lib/mysql" in the two new lines with "/path/to/new/datadir". Save and close the file.
Restart the AppArmor profiles with the command
sudo /etc/init.d/apparmor reload
Restart MySQL with the command
sudo /etc/init.d/mysql restart
Now MySQL should start with no errors, and your data will be stored in the new data directory location.