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!

JBoss7.1.1 Logging Runtime Change | JBoss AS 7.1.1 - Logging Configuration and Change at Runtime

Console Handler


Open standalone.xml and search for"<subsystem xmlns="urn:jboss:domain:logging:1.1".
For Console type handler, add the following:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
  <console-handler name="CONSOLE">
    <level name="INFO"/>
    <formatter>
      <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
    </formatter>
  </console-handler>
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Periodic Rotating File Handler


Configure periodic rotating file handler in this way:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
  <periodic-rotating-file-handler name="FILE">
    <formatter>
      <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
    </formatter>
    <file relative-to="jboss.server.log.dir" path="server.log"/>
    <suffix value=".yyyy-MM-dd"/>
    <append value="true"/>
  </periodic-rotating-file-handler>
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Size Rotating File Handler


Configure file rotating file handler in this way:
<subsystem xmlns="urn:jboss:domain:logging:1.1">
  <size-rotating-file-handler name="FILE">
    <formatter>
    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
    </formatter>
    <file relative-to="jboss.server.log.dir" path="server.log"/>
    <append value="true"/>
    <!-- size of a log file -->
    <rotate-size value="20M"/>
    <!-- no of log files to keep -->
    <max-backup-index value="50"/>
  </size-rotating-file-handl
  <logger category="com.arjuna">
    <level name="WARN"/>
  </logger>
  <root-logger>
    <level name="WARN"/>
    <handlers>
      <handler name="CONSOLE"/>
    </handlers>
  </root-logger>
</subsystem>

Change At Runtime


All these can be done at runtime without restarting JBoss. Check out the image below as a reference.






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

Apache Camel Exec - Run Executables

Assume you want to run an executable, you can utilize Camel's Exec component.
Such as:
exec://sh?args=-c+%22./someexec%22
It's pretty easy.

Sometimes you may get error message like "cannot execute binary file". Run the "file" command to check the executable's detail information.

If you get something like the following:
someexec: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
It means that your executable is 64 bits but you're running it on a 32-bit OS.



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

Camel Exec IP Aliasing | Apache Camel Exec - Execute IP Aliasing Commands


IP Aliasing


IP aliasing is associating more than one IP address to a network interface. With this, one node on a network can have multiple connections to a network, each serving a different purpose. [1]

On Linux, if you want to enable IP aliasing for an interface, you can execute a command like:
ifconfig eth0:1.1.4.21 1.1.4.21 netmask 255.255.255.0
On the other hand, if you want to disable IP aliasing, you can execute a command like:
ifconfig eth0:1.1.4.21 down


Apache Exec


The Apache Exec component can be used to execute system commands. [2]

To enable IP aliasing, run exec with URL like:
exec://sh?args=-c+%22ifconfig+eth2%3A1.1.3.21+1.1.3.21+netmask+255.255.255.0%22&timeout=60000
And to disable it, use the following URL:
exec://sh?args=-c+%22ifconfig+eth2%3A1.1.4.21+down%22&timeout=60000
If alias was already set and you want to enable it again, or the alias is disabled and you want to disable it again, you'll get some error message, like
Cannot assign requested address

References


  1. Wikipedia, http://en.wikipedia.org/wiki/IP_aliasing
  2. Apache Camel, http://camel.apache.org/exec.html



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

Winforms - Update Control from Another Thread

Assume you're using a grid view to display status for some network devices, and you have a background thread which receives status update and then update the grid view.

You could do the update safely with the following:
public delegate void UpdateStatusDelegate(StatusData data);

public void UpdateStatus(StatusData data)
{
  if (!this.radGridView1.InvokeRequired)
  {
    UpdateStatus0(data);
  }
  else
  {
    UpdateStatusDelegate del = new UpdateStatusDelegate(UpdateStatusRowStatus);
    this.radGridView1.Invoke(del, new object[] { data });
  }
}

private void UpdateStatus0(StatusData data)
{//do actual update thing
} 

Here 'radGridView1' is the grid view control (which is a control in Telerik's Winform library).

You should NOT simply call UpdateStatus0(). Doing that will give you exception at runtime.



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