http://tecnoesis.files.wordpress.com/
http://reloadjava.wordpress.com/
http://tecnoesis.files.wordpress.com/
http://reloadjava.wordpress.com/
//parse from html web page and set into list
Source webpageContent = WebConnections.connectToURL(WilliaHillsParameters.getUrl3()); //html url path
List<WilliamHillFormulaBeanDTO> formulaBeanDtoList = parseWilliamHillsPage(webpageContent);
———————————-
static private List<WilliamHillFormulaBeanDTO> formulaBeanDtoList = null;
private static WilliamHillFormulaBeanDTO dtoObj = null;
public static List<WilliamHillFormulaBeanDTO> parseWilliamHillsPage(Source webpageCode) {
formulaBeanDtoList = new ArrayList<WilliamHillFormulaBeanDTO>(); //list object
List<Element> tablesLList = webpageCode.findAllElements(“table”); //finding the no. of tables tags
Element e = webpageCode.getElementById(“eventDetailsHeader”); //get the div id ‘eventDetailsHeader’ data
String gameDate = dateElement.get(1).getContent().toString().trim();
Element element = tablesLList.get(0);//read/get the first table
List trsList = element.findAllElements(“tr”);// //finding the no. of tables tags
List<String> subOddsList = null;
List<String> subOddsList = null;
int trsListSize = trsList.size();
//*****read the makrt name from span tag*******
for (int j1 = 0; j1 < trsListSize; j1++) {
if(j1==1){
continue;
}
Element tr = (Element) trsList.get(j1);
if(j1==0){
List<Element> thsList = tr.findAllElements(“th”);
for(int m=0;m<thsList.size();m++){
Element thElement = thsList.get(m);
List<Element> spanList = thElement.findAllElements(“span”);
makt_name = spanList.get(0).getContent().toString().trim();
//logger.info(“makt name—->”+makt_name);
}
}
//read the td datafrom td tag and chield element
List<Element> tdsList = tr.findAllElements(“td”);
int tdsListSize = tdsList.size();
for (int j = 0; j < tdsListSize; j++) {
Element tdElement = tdsList.get(j);
List<Element> divsList = tdElement.findAllElements(“div”);
Element divElement = divsList.get(0);
List<Element> innerDivList = divElement.getChildElements();
int innerDivsListSize = innerDivList.size();
dtoObj = new WilliamHillFormulaBeanDTO(); //bean object
String oddsPrice = null;
int odd1=0;
int odd2=0;
String teamName = null;
if (innerDivsListSize > 0) {
for (int l = 0; l < innerDivsListSize; l++) {
oddsPrice = innerDivList.get(l).getContent()
.toString().trim();
String[] odds=oddsPrice.split(“/”);
odd1=Integer.parseInt(odds[0]);
odd2=Integer.parseInt(odds[1]);
//System.out.println(“Odds Price——->” + odd1+”,”+odd2);
l = l + 1;
}
for (int ln = 1; ln < innerDivsListSize; ln++) {
teamName = innerDivList.get(ln).getContent()
.toString().trim();
//System.out.println(“Odds Name ——->” + teamName);
ln = ln + 1;
}
dtoObj.setGameDate(formattedDate);
dtoObj.setTeamName(teamName);
dtoObj.setOdd1(odd1);
dtoObj.setOdd2(odd2);
dtoObj.setMakt_name(makt_name);
formulaBeanDtoList.add(dtoObj);
}
}
}
NameVirtualHost 172.31.8.37
<VirtualHost earnreal.org>
DocumentRoot /var/www/html/earnreal
ServerName 172.31.8.37
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
Options Indexes +FollowSymLinks
ProxyPreserveHost On
ProxyPass /affiliates http://localhost:9006/affiliates
ProxyPassReverse /affiliates http://localhost:9006/affiliates
ProxyPass /affiliateadmin http://localhost:9006/affiliateadmin
ProxyPassReverse /affiliateadmin http://localhost:9006/affiliateadmin
ProxyPass /tools http://localhost:9006/tools
ProxyPassReverse /tools http://localhost:9006/tools
ProxyPass /imgreq http://localhost:9006/imgreq
ProxyPassReverse /imgreq http://localhost:9006/imgreq
</VirtualHost>
<VirtualHost admin.earnreal.org>
DocumentRoot /var/www/html/admin
ServerName admin.earnreal.org
<Directory /var/www/html/admin>
</Directory>
</VirtualHost>
<VirtualHost tools.earnreal.org>
DocumentRoot /servers/jboss4/server/alea/deploy/tools.war/
ServerName tools.earnreal.org
</VirtualHost>
<VirtualHost pct.earnreal.org>
DocumentRoot /servers/jboss4/server/alea/deploy/tools.war/
ServerName pct.earnreal.org
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*pct.earnreal\.org\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://earnreal.org/imgreq/$1 [R=301,L]
</VirtualHost>
<VirtualHost tracking.earnreal.org>
DocumentRoot /var/www/html/tracking
ServerName tracking.earnreal.org
RewriteEngine On
RewriteRule ^/*.* /var/www/html/tracking/tracking.html
<Directory /var/www/html/tracking>
</Directory>
</VirtualHost>
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* This is a utility class designed to deal directly with the com/sportsbetting/affiliate/web/messages/messages.properties resource bundle.
* More work is expected to introduce internationalization handling.
* @author Affiliates
*
*/
public abstract class Messages {
public static final String BUNDLE_NAME = “com.sportsbetting.affiliateadmin.web.messages.messages”; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
/**
* @param key
* @return key-value
*/
public static String getString(String key) {
// TODO Auto-generated method stub
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return ‘!’ + key + ‘!’;
}
}
———-
//using this get the value from messages.properties file
Messages.getString(MSGK_SUCC_FEED_UPDATED)
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
public class Mail1 {
public static void main(String[] args) {
String[] TO = {“mail1@gmail.com”,”mail2@gmail.com”};
String JAVAMAIL_TEXT = “Test Mail bulk!.”;
SimpleMailSender sender1 = new JavaMailSimpleMailSender();
sender1.sendMessage(TO, JAVAMAIL_TEXT);
}
}
abstract class SimpleMailSender {
protected abstract MailSender getMailSender();
public void sendMessage(String[] to, String text) {
SimpleMailMessage msg = new SimpleMailMessage();
msg.setTo(to);
msg.setSubject(“Spring Java Test Message”);
msg.setFrom(“frommail@gmail.com”);
msg.setText(text);
MailSender sender = getMailSender();
try {
sender.send(msg);
} catch (MailException e) {
e.printStackTrace();
}
}
}
class JavaMailSimpleMailSender extends SimpleMailSender {
protected MailSender getMailSender() {
JavaMailSenderImpl sender = new JavaMailSenderImpl();
sender.setHost(“mail.spsoftglobal.com”);
return sender;
}
}
back disable
———
<script type=”text/javascript” language=”JavaScript”>
function noBack(){
window.history.forward();
}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){
try{
if(event.persisted)
noBack();
}
catch(e){
}
}
window.onunload=function(){void(0)}
</script>
When Refresh the page on banner,getting the ip address before the clicking or impression
————————-
Object reIp= remoteAddress(request);
String remoteIPAddress = reIp.toString();
public static InetAddress remoteAddress(HttpServletRequest request)throws UnknownHostException {
if (request.getHeader(“x-forwarded-for”) != null) {
return InetAddress.getByName(request.getHeader(“x-forwarded-for”));
}
return InetAddress.getByName(request.getRemoteAddr());
}
=======
Including Static html and js pages,
Getting the host name in static html and js file
Getting the static html and js file in jsp pages
*****************************************************************************
//adding the js code in html.this is html file
<script src=”*.js” language=”javascript”> </script>
<script src=”*.css” language=”javascript”> </script>
<script language=”javascript”>
var hostName=window.location.hostname;
</script>
//using below code to write the html code in js file
var hostName=window.location.hostname;
document.write(‘<link href=”‘+hostName+’/styles/default.css” rel=”stylesheet” type=”text/css” />’);
document.write(‘<div><a href=”http://’+hostName+’/about-us.html” title=”About Us” >About Us</a></div>’);
//Dynamically getting the code server side then we have add it in html page
<script>document.write(“<a class=’links’ href=http://”+hostName+”/affiliates/affiliate.xgi?method=loadJoinNow> <img src=’http://”+hostName+”/images/laydef_03.gif’ alt=” width=’124′ height=’88′ border=’0′></a>”);</script>
<script>document.write(“<a class=’links’ href=http://”+hostName+”/affiliates/affiliate.xgi?method=loadJoinNow> <img src=’http://”+hostName+”/images/laydef_03.gif’ alt=” width=’124′ height=’88′ border=’0′></a>”);</script>
//Reading static html file from apache server in js page
<script type=’text/javascript’ src=”<c:out value=’${staticUrl}’/>/header.js”></script> //staticUrl is apache server ip ex:http://192.168.10.217:80
//Reading static html file from apache server in jsp page
<%
String linksName=(String)session.getAttribute(“staticHtmlPath”); //staticHtmlPath is apache server path ex:C:\\Apache2.2\\htdocs\\earnreal\\
File filelinks = new File(linksName+”index.html”);
FileInputStream fislinks = null;
BufferedInputStream bislinks = null;
DataInputStream dislinks = null;
try {
fislinks = new FileInputStream(filelinks);
bislinks = new BufferedInputStream(fislinks);
dislinks = new DataInputStream(bislinks);
while (dislinks.available() != 0) {
out.println(dislinks.readLine());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
%>
function gowait() {
//alert(“hiiiiiii”);
document.getElementById(“main”).style.display=”none”;
document.getElementById(“main1″).style.visibility=”visible”;
document.getElementById(“wait”).style.visibility=”visible”;
}
function callwait(){
window.setTimeout(‘gowait()’, 23000);
}
<input name=”sendBtn” value=”Send Message” id=”main” type=”submit” /><input name=”sendBtn1″ value=”Send Message” id=”main1″ type=”button” style=”visibility:hidden;”/></div>
<div id=”wait” style=”visibility:hidden;”>
<b><font color=”#007792″>Loading.</font></b></div>
<script type=”text/javascript”>
function checkDate(fromDate, toDate){
var fromDateBeyondTodate = “From Date should not be a succeeding date of To date.”;
var todateBeyondFutureDate = “To Date should not be future date.”;
var froDateBeyondFutureDate = “From Date should not be future date.”;
if(document.getElementById(“summary_reports”))
{
document.getElementById(“summary_reports”).value=”datareports”;
}
//current date
var currentDate = document.getElementById(‘curdate’).value;
var currentDateArrar = currentDate.split(“-”);
var currentMonthString = currentDateArrar[1];
var currentMonth;
var currentDay = currentDateArrar[0];
var currentYear = currentDateArrar[2];
//currentMonth value
if(currentMonthString == “Jan”){
currentMonth = 1;
}
else if(currentMonthString == “Feb”){
currentMonth = 2;
}
else if(currentMonthString == “Mar”){
currentMonth = 3;
}
else if(currentMonthString == “Apr”){
currentMonth = 4;
}
else if(currentMonthString == “May”){
currentMonth = 5;
}
else if(currentMonthString == “Jun”){
currentMonth = 6;
}
else if(currentMonthString == “Jul”){
currentMonth = 7;
}
else if(currentMonthString == “Aug”){
currentMonth = 8;
}
else if(currentMonthString == “Sep”){
currentMonth =9;
}
else if(currentMonthString == “Oct”){
currentMonth = 10;
}
else if(currentMonthString == “Nov”){
currentMonth = 11;
}
else if(currentMonthString == “Dec”){
currentMonth = 12;
}
// from date
var fromDate = document.getElementById(fromDate).value;
var fromDateArrar = fromDate.split(“-”);
var fromMonthString = fromDateArrar[1];
var fromMonth;
var fromDay = fromDateArrar[0];
var fromYear = fromDateArrar[2];
//fromMonth value
if(fromMonthString == “Jan”){
fromMonth = 1;
}
else if(fromMonthString == “Feb”){
fromMonth = 2;
}
else if(fromMonthString == “Mar”){
fromMonth = 3;
}
else if(fromMonthString == “Apr”){
fromMonth = 4;
}
else if(fromMonthString == “May”){
fromMonth = 5;
}
else if(fromMonthString == “Jun”){
fromMonth = 6;
}
else if(fromMonthString == “Jul”){
fromMonth = 7;
}
else if(fromMonthString == “Aug”){
fromMonth = 8;
}
else if(fromMonthString == “Sep”){
fromMonth =9;
}
else if(fromMonthString == “Oct”){
fromMonth = 10;
}
else if(fromMonthString == “Nov”){
fromMonth = 11;
}
else if(fromMonthString == “Dec”){
fromMonth = 12;
}
// to date
var toDate = document.getElementById(toDate).value;
var toDateArrar = toDate.split(“-”);
var toMonthString = toDateArrar[1];
var toMonth;
var toDay = toDateArrar[0];
var toYear = toDateArrar[2];
//toMonth value
if(toMonthString == “Jan”){
toMonth = 1;
}
else if(toMonthString == “Feb”){
toMonth = 2;
}
else if(toMonthString == “Mar”){
toMonth = 3;
}
else if(toMonthString == “Apr”){
toMonth = 4;
}
else if(toMonthString == “May”){
toMonth = 5;
}
else if(toMonthString == “Jun”){
toMonth = 6;
}
else if(toMonthString == “Jul”){
toMonth = 7;
}
else if(toMonthString == “Aug”){
toMonth = 8;
}
else if(toMonthString == “Sep”){
toMonth =9;
}
else if(toMonthString == “Oct”){
toMonth = 10;
}
else if(toMonthString == “Nov”){
toMonth = 11;
}
else if(toMonthString == “Dec”){
toMonth = 12;
}
// fromDate validation
if(fromYear > currentYear){
alert(froDateBeyondFutureDate);
return false;
}
else if(fromYear == currentYear){
if(fromMonth > currentMonth){
alert(froDateBeyondFutureDate);
return false;
}
else if(fromMonth == currentMonth){
if(fromDay >currentDay)
{
alert(froDateBeyondFutureDate);
return false;
}
}
}
//fromDate validation
// fromDate validation with todate
if(fromYear > toYear){
alert(fromDateBeyondTodate);
return false;
}
else if(fromYear == toYear){
if(fromMonth > toMonth){
alert(fromDateBeyondTodate);
return false;
}
else if(fromMonth == toMonth){
if(fromDay >toDay)
{
alert(fromDateBeyondTodate);
return false;
}
}
}
//fromDate validation with todate
// todate validation
if(toYear > currentYear){
alert(todateBeyondFutureDate);
return false;
}
else if(toYear == currentYear){
if(toMonth > currentMonth){
alert(todateBeyondFutureDate);
return false;
}
else if(toMonth == currentMonth){
if(toDay >currentDay)
{
alert(todateBeyondFutureDate);
return false;
}
}
}
//todate validation
//to date
return true;
}