Skip to main content


Showing posts from June, 2016


Before You Leave On Vacation Back up your files so that you have a copy in case your device is stolen or infected with a virus.Update your devices with the latest security software.Use strong passcodes. A strong password should be at least eight characters long, include a combination of upper and lower case letters and at least one number, and include at least one character that is not a number or letter. Protect Yourself While Travelling Wi-Fi hotspots sure are convenient but they are also often unsecure networks and available to anyone. Don't shop or bank online using a Wi-Fi hotspot, and be very careful about what you send and receive.Don't leave devices unsecured in your hotel room. If there's a hotel room safe, use it.Avoid charging your phone at public charging kiosks or using USB ports on devices you don't own. These are untrusted devices and could leave you open to malicious software.If flying to your destination, do not pack your devices into luggage you're g…

The Java Advanced Management Console

The Java Advanced Management Console 1.0.1 (AMC) is available in the Oracle Java SE Advanced products. AMC employs the Deployment Rule Set (DRS) security feature, along with other functionality, to give system administrators greater and easier control in managing Java version compatibility and security updates for desktops within their enterprise and for ISVs with Java-based applications and solutions.

The principal benefits of the AMC:
Gathering and Presenting Data for Analysis: The AMC tool harvests an extensive set of data from the Java Usage Tracker (JUT) about Java Web Start and Java Applets web applications along with the JREs upon which they run. Gathered from a highly scalable number of clients in an enterprise network, the data is stored in the AMC database. The data can then be viewed by system administrators in the AMC User Interface (UI) for analysis.Taking Action: The AMC uses the Deployment Rule Set (DRS) security feature and provides system administrators the ability to c…

Happy numbers

A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. Display an example of your output here.

For instances, here's why 7 is a happy number: 7->49->97->130->10->1. Here's why 22 is NOT a happy number: 22->8->64->52->29->85->89->145->42->20->4->16->37->58->89 ...

Example of outputing first 8 happy numbers:

JPA MapKeyColumn Annotation Example

email_map table:

CREATETABLE`email_map` (
`id`int(10) unsigned NOTNULL AUTO_INCREMENT,
`emailid`bigint(20) NOTNULL,
`key`varchar(48) DEFAULTNULL,
`value`varchar(128) DEFAULTNULL,
UNIQUEKEY`emailid` (`emailid`,`key`),
KEY`fk_email_map_email` (`emailid`),

Inside email entity:

@CollectionTable(name ="email_map", joinColumns =
@JoinColumn(name ="emailid"))
@MapKeyColumn(name ="key")
@Column(name ="value")
private Map<String, String> values;

public Map<String, String> getValues(){
return values;

publicvoidsetValues(Map<String, String> values){
this.values= values;

MySQL date time example

mysql> SELECT DATE_ADD('2100-12-31 23:59:59',
-> '2101-01-01 00:01:00'
mysql> SELECT DATE_SUB('2005-01-01 00:00:00',
-> INTERVAL '1 1:1:1' DAY_SECOND);
-> '2004-12-30 22:58:59'
mysql> SELECT DATE_ADD('1900-01-01 00:00:00',
-> INTERVAL '-1 10' DAY_HOUR);
-> '1899-12-30 14:00:00'
mysql> SELECT DATE_ADD('1992-12-31 23:59:59.000002',
-> '1993-01-01 00:00:01.000001'
The following table shows the expected form of the expr argument for each unit value.

How to fix: Google App Engine: admin.JspCompilationException: Failed to compile jsp files

While deploying to Google App Engine, if you get exception similar to the following:

Caused by: Failed to compile jsp files.

You need to check your "javac" command.

$ javac

Make sure javac is OK in your system, most of time it is because of PATH problem.

How to increase screen resolution in Fedora

For unknown monitor type in fedora, if I know my screen can have the resolution of  1680x1050, but the setting doesn't have the option for me to choose, then to switch to the resolution:
# xrandr -q
# gtf 1680 1050 60
Modeline "1680x1050_60.00"147.1416801784196822561050105110541087 -HSync +Vsynccopy the green part after Modeline, and append it as the following:
# xrandr --newmode "1680x1050_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync
# xrandr --addmode VGA1 1680x1050_60.00Now you can go to the display setting and choose this mode.Or
# xrandr --output VGA1 --mode 1680x1050_60.00)For me, above only worked for current session. After I logged out, it didn't work again. I have 2 monitors. I later actually solved this problem by switching the cable. The problem may be because of the cable didn't connect correctly.

TypedQuery in JPA

Query query = em.createQuery('select p from Person p where name = :name', Person.class);
query.setParameter('name', name);
return (Person) query.getSingleResult();
A better type safe version is to use TypedQuery:

TypedQuery<Person> query = em.createQuery("select p from Person p where name = :name", Person.class);
query.setParameter("name", name);
return query.getSingleResult();
Or simply:

Person person=em.createQuery("select p from Person p where name = :name", Person.class).setParameter("name", name).getSingleResult();

Jmeter Assertions

Assertions allow you to include some validation test on the response of your request made using a Sampler. Using assertions you can prove that your application is returning the correct data. JMeter highlights when an assertion fails. The following list consists of all the assertions JMeter provides − Beanshell AssertionBSF AssertionCompare AssertionJSR223 AssertionResponse AssertionDuration AssertionSize AssertionXML AssertionBeanShell AssertionMD5Hex AssertionHTML AssertionXPath AssertionXML Schema Assertion

Jmeter Timers

By default, a JMeter thread sends requests without pausing between each sampler. This may not be what you want. You can add a timer element which allows you to define a period to wait between each request. The following list shows all the timers that JMeter provides − Constant TimerGaussian Random TimerUniform Random TimerConstant Throughput TimerSynchronizing TimerJSR223 TimeBeanShell TimeBSF TimePoisson Random Time

Jmeter Listeners

ListenersListeners let you view the results of Samplers in the form of tables, graphs, trees, or simple text in some log files. They provide visual access to the data gathered by JMeter about the test cases as a Sampler component of JMeter is executed. Listeners can be added anywhere in the test, including directly under the test plan. They will collect data only from elements at or below their level. The following list consists of all the Listeners JMeter provides − Sample Result Save ConfigurationGraph Full ResultsGraph ResultsSpline VisualizerAssertion ResultsView Results TreeAggregate ReportView Results in TableSimple Data WriterMonitor ResultsDistribution Graph (alpha)Aggregate GraphMailer VisualizerBeanShell ListenerSummary Report

JMeter Controllers

JMeter has two types of Controllers − Samplers and Logic Controllers. SamplersSamplers allow JMeter to send specific types of requests to a server. They simulate a user request for a page from the target server. For example, you can add a HTTP Request sampler if you need to perform a POST, GET, or DELETE on a HTTP service. Some useful samplers are − HTTP RequestFTP RequestJDBC RequestJava RequestSOAP/XML RequestRPC RequestsLogic Controllers Logic Controllers let you control the order of processing of Samplers in a Thread. Logic controllers can change the order of a request coming from any of their child elements. Some examples are − ForEach Controller, While Controller, Loop Controller, IF Controller, Run Time Controller, Interleave Controller, Throughput Controller, and Run Once Controller. The following list consists of all the Logic Controllers JMeter provides − Simple ControllerLoop ControllerOnce Only ControllerInterleave ControllerRandom ControllerRandom Order ControllerThroughput Con…

The Grinder - a free Java-based load testing framework

The Grinder is a free Java-based load testing framework available under a BSD-style open source license. It was developed by Paco Gomez and is maintained by Philip Aston. Over the year, the community has also contributed with many improvements, fixes and translations.
The Grinder consists of two main parts:
The Grinder Console - This is GUI application which controls various Grinder agents and monitors results in real time. The console can be used as a basic IDE for editing or developing test suites. Grinder Agents - These are headless load generators; each can have a number of workers to create the load
Key Features of the Grinder:
TCP proxy - records network activity into the Grinder test scriptDistributed testing - can scale with the increasing number of agent instancesPower of Python or Closure combined with any Java API for test script creation or modificationFlexible parameterization which includes creating test data on-the-fly and the capability to use external data sources like fil…

How to configure Thread Properties in JMeter

Any element in the Test Plan can be configured using the controls present in JMeter's right-hand side frame. These controls allow you to configure the behavior of that particular test element. For example, the Thread Group can be configured for a number of users, ramp up periods, etc., as shown below −

Thread Group elements are the beginning points of your test plan. As the name suggests, the thread group elements control the number of threads JMeter will use during the test. We can also control the following via the Thread Group −
Setting the number of threadsSetting the ramp-up timeSetting the number of test iterations

Test Plan node and Workbench node in JMeter

Test Plan node − is where the real test plan is kept.Workbench node − It simply provides a place to temporarily store test elements while not in use, for copy/paste purposes. When you save your test plan, Workbench items are not saved with it.

JMeter Features

Following are some of the features of JMeter − Being an open source software, it is freely available. It has a simple and intuitive GUI. JMeter can conduct load and performance test for many different server types − Web - HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail - POP3, etc. It is a platform-independent tool. On Linux/Unix, JMeter can be invoked by clicking on JMeter shell script. On Windows, it can be invoked by starting the jmeter.bat file. It has full Swing and lightweight component support (precompiled JAR uses packages javax.swing.* ). JMeter store its test plans in XML format. This means you can generate a test plan using a text editor. Its full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups. It is highly extensible. It can also be used to perform automated and functional testing of the applications.

Protocols supported by JMeter

The protocols supported by JMeter are − Web − HTTP, HTTPS sites 'web 1.0' web 2.0 (ajax, flex and flex-ws-amf)Web Services − SOAP / XML-RPCDatabase via JDBC driversDirectory − LDAPMessaging Oriented service via JMSService − POP3, IMAP, SMTPFTP Service

Quick start: HTTP Load testing with JMeter

First start Jmeter, go to your Jmeter folder:

$ bin/jmeter &

Now add a thread group (users):

Next you need to add sampler (HTTP request) to this group:

Last  go to test plan and add one listener for reporting:

Now you can run the test plan and see the result.

See also:

Open Source Load Testing Tools job trends

How to show updates as default in buddypress activity stream



<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?>

<?php if ( bp_has_activities(  'action=activity_update' ) ) : ?>
refer to

for other filtering options.

How to boost your website performance using advice from Google experts

Understanding your site’s performance can help you identify opportunities to improve results and meet your goals. Receive targeted account tips, detailed traffic insights and fresh ideas to promote your business from our team of Analytics specialists.

Share your information with our experts by adjusting your data sharing settings:
1.Log in to your Google Analytics account.2.Click the Home icon in the top left of your account.3.Click the Admin tab in the top right of your account.4.Select the relevant account.5.Click the Account Settings tab.6.Select the Account specialists checkbox and click Apply.If you have more than one profile click on Account list in the top left of your screen and repeat steps 3-5.

Get details on each of your data sharing options in this Help Center article, or learn more about how Google Analytics collects and safeguards your data.