PHP and WP_MAX_MEMORY_LIMIT (script tried to increase memory_limit)

Note: for a php problem I recently encountered this message:

ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'aa.bb.cc.dd', file '/home/user/www/wordpress/wp-admin/admin.php', line 109)

 

After some google I found: http://wordpress.org/support/topic/adminphp-tries-to-increase-memory_limit

 

A solution is given, but the post is rather old (solution is not in admin.php anymore) so search for the locations of the WP_MAX_MEMORY_LIMIT setting in your WordPress directory: find . -exec grep -H WP_MAX_MEMORY_LIMIT {} \;

Or check directly: vi .....www/weblog/wp-includes/default-constants.php

 

Change this limit to whatever it’s set to in the php settings. To find out what they are, use the following info.php script in a location you can use from the web:

<?php
phpinfo();
?>

 

Connect to Oracle from JVM inside database using a grid or RAC

Was:
ods.setDriverType("thin");
ods.setServerName("ocwgrid01.nbd.local");
ods.setDatabaseName("SCXD2");
ods.setPortNumber(1521);
ods.setUser("system");
ods.setPassword("ali120");

Is:
OracleDataSource ods = new OracleDataSource();
ods.setUser("system");
ods.setPassword("ali120");
ods.setConnectionCachingEnabled(true);
ods.setConnectionCacheName("MyCache");
ods.setFastConnectionFailoverEnabled(true);
ods.setONSConfiguration("nodes=ser1:4200,ser2:4200");
ods.setURL("jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=owlndb260)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=owlndb260)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=SCXD2)))");
Connection conn = ods.getConnection();

Different tooltip for each word in JTextField

It is possible to set a tooltip for a JTextField no doubt. It’s also possible to set a tooltip based on what you have typed directly, like:
private JTextField searchTxt = new JTextField(20);
private final Document searchTxtDoc;
..
searchTxtDoc = searchTxt.getDocument();
searchTxtDoc.addDocumentListener(new searchTxtListener());
..
private class searchTxtListener implements DocumentListener {
  public void changedUpdate(DocumentEvent de) { checkTxtContent(); }
  public void insertUpdate(DocumentEvent de) { checkTxtContent(); }
  public void removeUpdate(DocumentEvent de) { checkTxtContent(); }
};

In checkTxtContent(); it’s possible to do what’s necessary with the JTextField content and set a tooltip. In fact, I use this listener often to present more information.

But what if it’s required to set tooltips on the JTextField based on every single word typed. Maybe the mouse position is useful to show a tooltip along the word the mouse is hoovering. Is it possible to gather the mouse information in checkTxtContent(); but it’s not the proper event to catch from the DocumentListener since it is fired on a document event.

In a GUI everything is event driven, so a good way to catch the mouse is using a MouseAdapter and add a MouseListener to the JTextField: searchTxt.addMouseListener(new searchMouseListener());
and:
private class searchMouseListener() extends MouseAdapter {
  public void mouseClicked(MouseEvent me) {
    // e.g. if right mouse button clicked (or me.isPopupTrigger())
    if(SwingUtilities.isRightMouseButton(me)) {
      
    }
    // e.g. show popup
    menuItem.show(JComponent, me.getX(), me.getY());
  }
}

With this MouseEvent it is possible to use me.getPoint(); or me.getX(); and me.getY();

But… The methods available are: mouseClicked, mouseEntered, mouseExited, mousePressed and mouseReleased. mouseEntered and mouseExited only deliver coordinates at one moment (their name says it all), not continuously.

So… not sufficient, best way to catch the mouse position is to use the MouseMotionListener. This class provides the following two methods: mouseDragged and mouseMoved. The latter is just what we needed:
searchTxt.addMouseMotionListener(new searchMouseMotionListener());

and

private class searchMouseMotionListener implements MouseMotionListener {
  public void mouseDragged(MouseEvent mouseEvent) {}
  public void mouseMoved(MouseEvent me) {
    String wrd = "";
    String txt = searchTxt.getText();
    int end = txt.length();
    if(end>0) {
      int pos = searchTxt.viewToModel(me.getPoint());
      if(pos>=0) {
        StringTokenizer st = new StringTokenizer(txt);
        int cur_pos = 1;
        while(st.hasMoreTokens()) {
          wrd = st.nextToken();
          cur_pos = cur_pos + wrd.length() + 1;
          if(cur_pos>=(pos+2)) {
            // wrd contains the word we're looking for,
            // so create a tooltip based on this catch
            break;
          }
        }
      }
    } // implement other stuff in else branches
  }
}

Hope it works for you.