Showing posts from June, 2013

How to show browser info(name,version) and OS name using java in client side.

step1 - use this google api for user agent string parsing.


package com.demo;

public class UserAgentDetails {

    private String browserName;
    private String browserVersion;
    private String browserComments;

      UserAgentDetails(String browserName, String browserVersion, String browserComments) {
        this.browserName = browserName;
        this.browserVersion = browserVersion;
        this.browserComments = browserComments;

    public String getBrowserComments() {
        return browserComments;

    public String getBrowserName() {
        return browserName;

    public String getBrowserVersion() {
        return browserVersion;


package com.demo;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UserAgentParser
    private String userAgentString;
    private String browserName;
    private String browserV…

How to check FileReader support this browser on not.(Drag,Drop);.

Drag drop file uploading doesn't  support all browser.
Please find this post  here

it's not working IE 9,8,7 and IE 10 compatibility view.

for this issue i have created this post how to check current browser support on not.
find this javascript code bellow.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script type="text/javascript">
  function check(){
    if (typeof window.FileReader === 'undefined') {
} else {


 </head >

 <body onload="…

How to print selected area in zk

Step 1.
 add <zk xmlns:w="client">  tag.

Step 2.

    <button label="Print">
        <attribute w:name="onClick">
Parameter group box.
1. "group" id of groupbox.
2. 500 windows height.
3. 800 windows width.
4. true for style if true style will apply otherwise style not apply.

Full Page

Print listbox with style
    print Listbox with style:
    <button label="Print">
        <attribute w:name="onClick">
    <listbox id="box1" multiple="true" checkmark="true">

Print Groupbox.

Print Box Area:
    <button label="Print">
        <attribute w:name="onClick">

How to Drop your file using dropupload in zk


<?page title="Auto Generated index.zul"?>
<window title="Drop here" border="normal" width="100%" height="100%"
    viewModel="@id('vm') @init('com.demo.DropFileViewModel')">

    <dropupload maxsize="5120" detection="none"

    <button label="Download" onClick="@command('doDownload')"></button>


package com.demo;

import org.zkoss.bind.BindContext;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.zhtml.Filedownload;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zul.Messagebox;

public class DropFileViewModel {

how to create menu in android

<?xmlversion="1.0"encoding="utf-8"?> <menuxmlns:android=""> <!-- Single menu item Set id, icon and Title for each menu item --> <itemandroid:id="@+id/menu_bookmark" android:icon="@drawable/icon_bookmark" android:title="Bookmark"/> <itemandroid:id="@+id/menu_save" android:icon="@drawable/icon_save" android:title="Save"/> <itemandroid:id="@+id/menu_search" android:icon="@drawable/icon_search" android:title="Search"/> <itemandroid:id="@+id/menu_share" android:icon="@drawable/icon_share" android:title="Share"/> <itemandroid:id="@+id/menu_delete" android:icon="@drawable/icon_delete" android:title="Delete"/>  <itemandroid:id="@+id/menu_preferences" android:icon="@drawable/icon_preferences" android:title="Prefe…

how to set alt tag in zk

<zk xmlns:ca="client/attribute">

<image src="abc" ca:alt="image not found" ca:title="image title" />


how to get after 5 days date

Calendar currentDate = Calendar.getInstance();
        Calendar prevDay = (Calendar) currentDate.clone();
        prevDay.add (Calendar.DAY_OF_YEAR, 5);
        System.out.println ("After 5 Day: " + prevDay.getTime());

How to get previous 7 day Date

Calendar currentDate = Calendar.getInstance();
        Calendar prevDay = (Calendar) currentDate.clone();
        prevDay.add (Calendar.DAY_OF_YEAR, -7);
        System.out.println ("Previous 7 Day: " + prevDay.getTime());