Tuesday, May 21, 2013

Add AM PM to time using SimpleDateFormat

/*
  Add AM/PM to time using SimpleDateFormat
  This example shows how to format time to have a AM/PM text using Java
  SimpleDateFormat class. 
*/

import java.text.SimpleDateFormat;
import java.util.Date;

public class AddAMPMToFormattedDate {

  public static void main(String[] args) {

    //create Date object
    Date date = new Date();
  
     //formatting time to have AM/PM text using 'a' format
     String strDateFormat = "hh:mm:ss a";
     SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
    
     System.out.println("Time with AM/PM field : " + sdf.format(date));

  }
}



/*
Typical output would be
Time with AM/PM field : 01:39:42 AM
*/

How to access amazon server remotely from windows?

Download putty and pagent for windows.
 

Open pagent and add key as ".ppk" format
 

Open putty and put the host name as "bitnami@ece.compute-  1.amazonaws.com" and port number "22".

By default phpMyAdmin and phpPgAdmin are not accessible from outside for security reasons.
 

In order to access them, you can create an SSH tunnel to Apache, sending your requests to your webserver from 127.0.0.1 (localhost).

    You should follow these steps to create the tunnel:
    

1. Create the tunnel.
    - If you are in Linux or Mac you can run the following in a console in your local machine (using your Public DNS instead of xyz.bitnamiapp.com):
    $ ssh -N -L 8888:127.0.0.1:80 bitnami@ece.compute-1.amazonaws.com
    - If you are using Windows, you can use Putty:
    Follow the steps described here
    Before opening the connection. Go to Connection -> SSH -> Tunnels, enter the values below and click "Add" button:
    Source port: "8888"
    Destination: "localhost:80"
 

    Click Open

    2. While the tunnel is active you can connect to the web application at http://127.0.0.1:8888/phpmyadmin or http://127.0.0.1:8888/phppgadmin in your browser. The default login is:
    username: root for MySQL or postgres for PostgreSQL database.
    password: bitnami (for BitNami).


Wednesday, May 15, 2013

How to get IMEI number of android device?


IMEI number is another way of uniquely identifying cellular devices.
 

Each cellular device has a unique IMEI number which can never clash with another device’s IMEI number.
 

Android devices [phones only] also have International Mobile Station Equipment Identity or IMEI number.

And you should add the following permission into your Manifest.xml file:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

TelephonyManager tm = (TelephonyManager).getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId();

List of Top Proxy Sites

List Of Top Proxy Sites
 
http://aniscartujo.com/webproxy
http://www.badboysproxy.com
http://www.surfscreened.com
http://www.hagiomusic.info
http://www.greenpips.info
http://urlbrowse.com
http://www.hideipaddress.net
http://www.sneakfilter.com
http://www.browsestealth.com
http://www.sneak1.info
http://proxiesrus.com
http://www.surfindark.com
http://www.navydog.com
http://falsario.com
http://www.proxypit.com
http://www.proxypan.com
http://myspacewebproxy.org/
http://www.allfreehere.info
http://www.takefreely.info
http://autobypass.com
http://www.proxcity.info
http://www.proxyzip.org
http://www.cheekyproxy.com
http://www.eggproxy.com
http://www.theschoolcloak.com
http://www.hidemefast.com
http://browseanywhere.info
http://www.404surf.com
http://www.cloakip.net
http://www.browsedark.com
http://www.dartprox.com
http://www.proxish.com
http://www.surfsneak.com
http://www.surfsneaky.com
http://www.browsehidden.com
http://www.filterhide.com
http://www.browsesneak.com
http://myspaceproxyy.com
http://www.browsesneaky.com
http://www.proxyz.us
http://www.sneakschool.com
http://www.iphide.com
http://www.proogle.info
http://greatproxy.info
http://www.playnsurf.info
http://www.realproxy.info
http://aplusproxy.com
http://www.ecoproxy.com
http://freedom.webtuo.com
http://www.slyuser.com/
http://tenpass.com
http://pawxy.com
http://pawxy.org
http://logu.in
 

Use Proxy and cheers...!!!

Web Browsers As Text Editor

Web Browsers As Text Editor:

 1. Copy below code in browser Url Section
        data:text/html, <html contenteditable>

 Now Press Enter.


   3. Now you can type anything as what ever do on any other text editor like Notepad.
   4. To save your text file Press Ctrl + S and save it as anything.txt (.txt Is Must).







Cheers...!!!

How To Disable Right Click On Your Blog

How To Disable Right Click On Your Blog ?

If you own a blog or a website then you always want to prevent other malicious bloggers from copying the content from your blog. 


You might have written an article with great efforts and lots of research and other just copy/paste it on their blog.

To prevent such users from copying content from your blog i will show you Javascript Trick to disable right click on your blog. So lets get started.





1. Go your blogger Layout dashboard.

2. Add gadget and select HTML/JavaScript.


3. Copy & paste below code.


<script language='JavaScript'>


function disableselect(e){
     return false
}
function reEnable(){
    return true
}
document.onselectstart=new Function ("return false")
   if (window.sidebar){
        document.onmousedown=disableselect
        document.onclick=reEnable
   }
</script>


4. Save and test your blog.

Cheers...!!!

Tuesday, May 14, 2013

Related List in vTiger CRM



Creating or Deleting a Related List in vTiger CRM:-

“More Information” tab in the Detail View of record associates one particular module with multiple records of any other module.

How to create a New Related ListView:-
<?php
include_once('vtlib/Vtiger/Module.php');
//Where you want to add the realted module.
//Source Module Name
$moduleInstance = Vtiger_Module::getInstance('Products');
//Target Module Name
$targetModule = Vtiger_Module::getInstance('Vendors');
//Target Module Relationship Label.
$relationLabel  = 'Vendors';
//call back function name.
$function_name = 'get_vendors';
//Create a relation ship.
$moduleInstance->setRelatedList($targetModule, $relationLabel, Array('ADD','SELECT'),$function_name);
?>

(Note: Take the code above to any text editor and name it to ‘Related_moduleName.php’ while saving and save it under root directory of vtigerCRM. After saving run this file on server (either localhost or your own server) which will add UI under source module. ModuleName referred above is the name of module.)

This function stated above is to be defined in <SOURCE MODULE> class and will generate the entries of listview to be displayed. In addition to this an entry in ‘vtiger_crmentityrel’ table will be made which will track the relation between all the modules and their corresponding records. All primary modules in vTigerCRM handles relation in tables separately and undergo JOIN which fetching the data specific to every module.

Delete the Related ListView:-

<?php
include_once('vtlib/Vtiger/Module.php');
//Where you want to add the realted module.
//Source Module Name
$moduleInstance = Vtiger_Module::getInstance('Products');
//Target Module Name
$targetModule = Vtiger_Module::getInstance('Vendors');
//Target Module Relationship Label.
$relationLabel  = 'Vendors';
//call back function name.
$function_name = 'get_vendors';
//Delete a relation ship.
$moduleInstance->unsetRelatedList($targetModule,$relationLabel,$function_name);?>


Create a New UItype in VtigerCRM


Creating a New Popup UItype in VtigerCRM5.1.0 for a Newly Created Module.

Here things are explained using Locations Module. Locations is a new module that we have already created and is functioning well.

I assume that the newly created UItype is 1001 for Locations popup selector.

1. First  I added a method to: include/utils/CommonUtils.php

function getLocationName($location_id)
{
global $log;
$log->debug("Entering getLocationName(".$location_id.") method ...");
$log->info("in getlocationname ".$location_id);

global $adb;
$sql = "select locationname from vtiger_locations where locationsid=?";
    $result = $adb->pquery($sql, array($location_id));
$locationname = $adb->query_result($result,0,"locationname");
$log->debug("Exiting getLocationName method ...");
return $locationname;
}

2.Added an elseif condition in else if ladder of file:  include/utils/EditViewUtils.php

elseif($uitype == 1001)
{
if($value != '')
{
$location_name = getLocationName($value);
}
elseif(isset($_REQUEST['location_id']) && $_REQUEST['location_id'] != '')
{
$value = $_REQUEST['location_id'];
$location_name = getLocationName($value);
}
$pop_type = 'specific';
$editview_label[]=getTranslatedString($fieldlabel, $module_name);
$fieldvalue[] = $location_name;
$fieldvalue[] = $value;
}

3.Added an elseif condition in else if ladder of file::  include/utils/EditViewUtils.php
elseif($uitype == 1001)
   {
$label_fld[] =getTranslatedString($fieldlabel, $module);
           $location_id = $col_fields[$fieldname];
           if($location_id != '')
           {
                  $location_name = getLocationName($location_id);
           }
          $label_fld[] = $location_name;
$label_fld["secid"] = $location_id;
$label_fld["link"] = "index.php?module=Locations&action=DetailView&record=".$location_id;
   }
Edited Smarty (.tpl) files.
1.Smarty/templates/DetailViewFields.tpl
Replaced following else if
{elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51' || $keyid eq '57' || $keyid eq '59' || $keyid eq '75' || $keyid eq '81' || $keyid eq '76' || $keyid eq '78' || $keyid eq '80'}

with
{elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51' || $keyid eq '57' || $keyid eq '59' || $keyid eq '75' || $keyid eq '1001' || $keyid eq '81' || $keyid eq '76' || $keyid eq '78' || $keyid eq '80'}
2.Smarty/templates/EditViewUI.tpl
Added the following in {elseif} ladder
{elseif $uitype eq 1001}
<td width="20%" class="dvtCellLabel" align=right>
{assign var="pop_type" value="specific"}
<font color="red">{$mandatory_field}</font>{$usefldlabel} {if $MASS_EDIT eq '1'}
<input type="checkbox" name="{$fldname}_mass_edit_check" id="{$fldname}_mass_edit_check" class="small" >{/if}
</td>
<td width="30%" align=left class="dvtCellInfo">
<input name="location_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{'select.gif'|@vtiger_imageurl:$THEME}" alt="{$APP.LBL_SELECT}" title="{$APP.LBL_SELECT}" LANGUAGE=javascript onclick='return window.open("index.php?module=Locations&action=Popup&html=Popup_picker&popuptype={$pop_typ e}&form=EditView&fromlink={$fromlink}","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
<input type="image" tabindex="{$vt_tab}" src="{'clear_field.gif'|@vtiger_imageurl:$THEME}" alt="{$APP.LBL_CLEAR}" title="{$APP.LBL_CLEAR}" LANGUAGE=javascript onClick="this.form.location_id.value='';this.form.location_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
</td>

3.Smarty/templates/DetailViewUI.tpl
Added the following in {elseif} ladder
{elseif $keyid eq '1001'} <!--LocationPopup-->
<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a> </td>    
And Finally:
Added the following in {elseif} ladder : include/js/dtlviewajax.js
else if(uitype == '1001') {
getObj(dtlView).innerHTML = "<a href=\"index.php?module=Locations&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbs p;</a>";
}
Added a method to: modules/Locations/Locations.js
document.write("<script type='text/javascript' src='include/js/Mail.js'></"+"script>");
document.write("<script type='text/javascript' src='include/js/Merge.js'></"+"script>");

function set_return_specific(location_id, location_name)
{
       //getOpenerObj used for DetailView
       var fldName = getOpenerObj("location_name");
       var fldId = getOpenerObj("location_id");
       fldName.value = location_name;
       fldId.value = location_id;
}