Saturday, January 31, 2015

Unix - Find Command Argument List Too Long

When I was trying to use the following script to find all files under a directory and perform some task, I got arg list too long error.
for i in `find $WORKDIR/*Alarm* -mtime 1 -type f`
do
some task
done
After I changed to use below script, it worked as expected.
for i in `find $WORKDIR -name ‘*Alarm*’ -mtime 1 -type f`
do
some task
done


Create a Successful Online Store at Bigcommerce! Try it Free Now!

Friday, January 30, 2015

Oracle - Function Based Index

A function-based index computes the value of an expression that involves one or more columns and stores it in the index. The index expression can be an arithmetic expression or an expression that contains a SQL function, PL/SQL function, package function, or C callout.[1]
Oracle generates a column name of the format "SYS_NC?????$" in all_ind_columns table.

If you want to find the corresponding expression for the index, you can like this.

Execute:

SELECT a.index_name, a.column_name, b.column_expression FROM all_ind_columns a LEFT JOIN all_ind_expressions b ON A.index_name = b.index_name AND A.column_position = b.column_position WHERE a.index_name='table_name$unique_index_name';



Result:

table_name$unique_index_name  SYS_NC00031$   TRUNC("UPDATE_DATE")


References


  1. https://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_indexes.htm#ADFNS00505


Create a Successful Online Store at Bigcommerce! Try it Free Now!

Telerik Winforms 2010 SP1 - RadGridView - Populate ComboBoxColumn Data Source at Runtime

Assume you have a grid view radGridView1 and you have a combobox column in it. The column's header text is "Status".
You could use the following code to populate its data source at runtime.
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
  if (e.Column.HeaderText == "Status")
  {
    RadComboBoxEditor editor = this.radGridView1.ActiveEditor as RadComboBoxEditor;
    RadComboBoxEditorElement element = editor.EditorElement as RadComboBoxEditorElement;

    element.DataSource = new string[] { "UP", "DOWN" };    

    element.SelectedValue = null;
    element.SelectedValue = this.radGridView1.CurrentCell.Value;
  }
}


Create a Successful Online Store at Bigcommerce! Try it Free Now!

Spark2.5.8 JID Nick Name | Spark 2.5.8 - Use JID Instead of Nick Name in Chat UI

Customize Spark: Use JID instead Nick Name

By default, Spark uses nick name (e.g. admin) in its private/group chat windows. If you want to use JID (e.g. admin@server/Spark) instead, consider the following two ways:
1.
private String getJidFromPresencePacket(Presence p)
{
  Collection<PacketExtension> extensions = p.getExtensions();      
  
  if (extensions instanceof List && !extensions.isEmpty())
  {
    Object obj = ((List<?>)extensions).get(0);
    
    if (obj instanceof MUCUser)
    {
      MUCUser.Item item = ((MUCUser)obj).getItem();
      
      if (item != null)
      {
        return item.getJid();
      }
    }
  }
  
  return p.getFrom();
}
2. a simpler way
private String getJidFromPresencePacket(Presence p)
{
  MUCUser mucUser = (MUCUser)p.getExtension("x", "http://jabber.org/protocol/muc#user");
  
  if (mucUser != null)
  {
    MUCUser.Item item = mucUser.getItem();
    
    if (item != null)
    {
      return item.getJid();
    }
  }      
  
  return p.getFrom();
}

XMPP JID

A JID consists of three main parts:
  1. The node identifier (optional)
  2. The domain identifier (required)
  3. The resource identifier (optional)

If you want to use only the node id and the domain id in your UI, you can use the method below to extract them from a JID:
StringUtils.parseBareAddress(JID)



Create a Successful Online Store at Bigcommerce! Try it Free Now!

Thursday, January 29, 2015

Revenue Hits Ad Preview 1 - Banners

Quickly find out all ads from RevenueHits.

Leader Board (728 * 90)


Full Banner (468 * 60)



Layer Ad (800 * 440)



Mid Layer Ad (600 * 330)



Medium Rectangle (300 * 250)



Wide Skyscraper (160 * 600)



Skyscraper (120 * 600)





Create a Successful Online Store at Bigcommerce! Try it Free Now!