Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Out of memory on UCase()
Message
De
29/07/2013 04:11:35
 
 
À
28/07/2013 13:34:11
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01579306
Message ID:
01579329
Vues:
46
>>What are oApp.Occurs() and oApp.At() ? Are you sure it is the UCase() rather than these which is causing the problem?
>
>Same as VFP Occurs() and VFP At().
>
>The last line of the Stack trace gives this:
>
>at Microsoft.VisualBasic.Strings.UCase(String Value)
>
>>IAC, it would be more efficient to create upper case versions of the string for use in those functions rather than repeating the conversion each time.
>
>Will do.
>
>>Does using ToUpper() rather than the VisualBasic namespace UCase() also cause the OOM ?
>
>I never use that as all functions are mainly from the framework. So, if we change environment and do a framework for that, all the client code would remain as is for those functions in case ToUpper() wouldn't exist. But, at this point, it is difficult to try a few changes as it is only in the production that the problem started yesterday. That code as always worked well for a few years and still works well in our test servers.


If this is to extract the images - consider this
	public static class MyClass
	{
		static string htmlSample = @"
		<!DOCTYPE html>

		<html lang=""en-GB"">
		<head>
		  <meta charset=""utf-8"">
		  <title>Example of an inline image</title>
		</head>
		<body>
		<img src=""balconyview.jpg"">
		<Img Src = 'balconyview.jpg' alt='View from my balcony, showing a row of houses, trees and a castle'>
		<img src='http://example.com/brokenlink/sunset.gif' alt='Beautiful Sunset' />

		</body>
		</html>
		";

		public static void Main()
		{
			IEnumerable<String> images = GetImages(htmlSample);
			foreach (string image in images)
				Console.WriteLine(image);
			Console.ReadLine();
		}

		static IEnumerable<String> GetImages(string html)
		{
			List<string> images = new List<string>();
			string pattern = @"\<img\s+src\s*=\s*((?<quote>[""'])(?<image>.*?)\k<quote>)";
			//Console.WriteLine(pattern);
			MatchCollection matches = Regex.Matches(html, pattern, RegexOptions.IgnoreCase  );
			foreach (Match match in matches)
			{
				images.Add(match.Groups["image"].ToString());
			}

			return images;
		}
	}
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform