Ejemplo n.º 1
0
        protected override bool VisitAllURLsJustOneTime(SWUrlBaseVisitor visitor)
        {
            if (base.VisitAllURLsJustOneTime(visitor))
            {
                return(true);
            }


            if (RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits == 0)
            {
                Report(string.Format("----- No Pagerank found with difference more than [{0}] decimal digits. -----", RankHandler.intMinAllowedDivergedPrecisionDigits));
                //RankHandler.blnFoundURlWithoutRank = false;
                Report("----- Trying to Flush on DB -----");
                int intCountFlush = RankHandler.DBFlush();
                Report(string.Format("----- End of Flushing. Flushed: #{0} records -----", intCountFlush));

                return(true);
            }
            else
            {
                Report(string.Format("----- {0} URLs found with their Pageranks different more than [{1}] decimal digits than their previous values. -----", RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits, RankHandler.intMinAllowedDivergedPrecisionDigits));
            }

            RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits = 0;
            //RankHandler.blnFoundURlWithoutRank = false;
            return(false);
        }
Ejemplo n.º 2
0
        public bool VisitAllURLs(SWUrlBaseVisitor visitor)
        {
            try
            {
                Report(string.Format("----- Trying to perform {0} visits -----", intHowManyLoops));
                TotalUrlsProcessed = 0;
                for (intStepOfVisit = 1; intStepOfVisit <= intHowManyLoops; intStepOfVisit++)
                {
                    intLastUrlAsked = 0;
                    Report(string.Format("----- Start of visit #{0} -----", intStepOfVisit));
                    if (VisitAllURLsJustOneTime(visitor))
                    {
                        Report(string.Format("----- Success & Break at #{0} visit -----", intStepOfVisit));
                        break;
                    }

                    Report(string.Format("----- End of visit #{0} -----", intStepOfVisit));
                }
                Report(string.Format("----- Finished of trying to perform {0} visits. Performed {1} of them. Total URLs visited : {2} -----", intHowManyLoops, intStepOfVisit, TotalUrlsProcessed));
                return(true);
            }
            catch (Exception exc)
            {
                try
                {
                    Report(string.Format("----- ERROR !!!! {0} -----", exc.Message));
                }
                catch (Exception excNew)
                {
                    Report(string.Format("----- INTERNAL ERROR !!!! {0} -----", excNew.Message));
                }
                return(false);
            }
        }
Ejemplo n.º 3
0
        protected virtual bool VisitAllURLsJustOneTime(SWUrlBaseVisitor visitor)
        {
            DataSet dsetURLS = GetNextURLs();

            while ((dsetURLS != null) && (dsetURLS.Tables != null) && (dsetURLS.Tables[0].Rows.Count > 0))
            {
                intRowsCount  = dsetURLS.Tables[0].Rows.Count;
                intCurrentURL = 0;
                Report(string.Format("----- Trying to visit {0} URLs. Searched from URLS with ID {1} to {2} -----", intRowsCount, intLastUrlAsked - intStepUrls, intLastUrlAsked));
                foreach (DataRow dtrwIter in dsetURLS.Tables[0].Rows)
                {
                    visitor.Visit((int)dtrwIter["cwur_url_id"]);
                }

                TotalUrlsProcessed += intRowsCount;
                try
                {
                    dsetURLS.Dispose();
                }
                catch {}

                dsetURLS = GetNextURLs();
            }
            return(false);            //continue if false/ if true then it must stop.
        }
Ejemplo n.º 4
0
        public bool VisitAllURLs(SWUrlBaseVisitor visitor)
        {
            try
            {
                Report(string.Format("----- Trying to perform {0} visits -----",intHowManyLoops));
                TotalUrlsProcessed=0;
                for (intStepOfVisit=1; intStepOfVisit<=intHowManyLoops;intStepOfVisit++)
                {
                    intLastUrlAsked=0;
                    Report(string.Format("----- Start of visit #{0} -----",intStepOfVisit));
                    if (VisitAllURLsJustOneTime(visitor))
                    {
                        Report(string.Format("----- Success & Break at #{0} visit -----",intStepOfVisit));
                        break;
                    }

                    Report(string.Format("----- End of visit #{0} -----",intStepOfVisit));

                }
                Report(string.Format("----- Finished of trying to perform {0} visits. Performed {1} of them. Total URLs visited : {2} -----",intHowManyLoops,intStepOfVisit,TotalUrlsProcessed));
                return true;
            }
            catch (Exception exc)
            {
                try
                {
                    Report(string.Format("----- ERROR !!!! {0} -----",exc.Message));
                }
                catch(Exception excNew)
                {
                    Report(string.Format("----- INTERNAL ERROR !!!! {0} -----",excNew.Message));
                }
                return false;
            }
        }
Ejemplo n.º 5
0
        protected virtual bool VisitAllURLsJustOneTime(SWUrlBaseVisitor visitor)
        {
            DataSet dsetURLS = GetNextURLs();
            while ((dsetURLS!=null) && (dsetURLS.Tables!=null) && (dsetURLS.Tables[0].Rows.Count>0))
            {
                intRowsCount=dsetURLS.Tables[0].Rows.Count;
                intCurrentURL=0;
                Report(string.Format("----- Trying to visit {0} URLs. Searched from URLS with ID {1} to {2} -----",intRowsCount,intLastUrlAsked-intStepUrls,intLastUrlAsked ));
                foreach (DataRow dtrwIter in dsetURLS.Tables[0].Rows)
                {
                    visitor.Visit((int)dtrwIter["cwur_url_id"]);
                }

                TotalUrlsProcessed+=intRowsCount;
                try
                {
                    dsetURLS.Dispose();
                }
                catch {}

                dsetURLS = GetNextURLs();
            }
            return false; //continue if false/ if true then it must stop.
        }
Ejemplo n.º 6
0
        protected override bool VisitAllURLsJustOneTime(SWUrlBaseVisitor visitor)
        {
            if (base.VisitAllURLsJustOneTime(visitor))
            {
                return true;
            }

            if (RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits==0)
            {
                Report(string.Format("----- No Pagerank found with difference more than [{0}] decimal digits. -----",RankHandler.intMinAllowedDivergedPrecisionDigits));
                //RankHandler.blnFoundURlWithoutRank = false;
                Report("----- Trying to Flush on DB -----");
                int intCountFlush =RankHandler.DBFlush();
                Report(string.Format("----- End of Flushing. Flushed: #{0} records -----",intCountFlush));

                return true;
            }
            else
            {
                Report(string.Format("----- {0} URLs found with their Pageranks different more than [{1}] decimal digits than their previous values. -----",RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits, RankHandler.intMinAllowedDivergedPrecisionDigits));
            }

            RankHandler.intNumUrlsThatFoundDifferenceInPrecisionDigits=0;
            //RankHandler.blnFoundURlWithoutRank = false;
            return false;
        }