|
I need to search a variable for a string, but do not know how. can someone help me.
oh, and does anyone know a good reference site of asp functions?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "What goes up must come down. Ask any system administrator"
|
|
|
|
|
Try the InStr function.
A good reference site is the MSDN site(http://msdn.microsoft.com). For ASP/VBScript check out the Scripting section of MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp) or the Active Server Pages.
/WW
|
|
|
|
|
|
strReverse() should do it:
a = strReverse("ABC")
/WW
|
|
|
|
|
just one more question, how to remove any characters from the string that are not normal characters (e.g. a-z)
if you are wondering why I am asking all these Q's, is because I made some code in PHP, i converted it to Javascript for codeproject, and was gonna convert it to asp for codeproject, only problem is, I dont know any asp.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "What goes up must come down. Ask any system administrator"
|
|
|
|
|
|
I have copied the following code off phpbuilder.com but cannot find anything similar for stripping HTML comments...
I'm assuming the posix regex is the same across the board and was hoping someone out there in CP land (seeing how I don't seem to be getting answered at PHP sites) could possibly help me...
$buffer = eregi_replace("<script[^>]*>.*</script>","",$buffer);
Where is my regex going wrong in the comments stripping...?
Anyone help...thanx...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
Where is my regex going wrong in the comments stripping...?
I don't see anything wrong with it off the top of my head, but try escaping the exclamation mark just to be safe. And, of course, I'd like to know what you find out so I'll know for future reference.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Um, after looking at it again I did notice the regex for the comments is commented out! Maybe that's why it's not being pulled?
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Thats just a typo...sorry...I forgot about that...
The comments don't exist in the actual source code...
The regex to strip JScript works great, so I figured i'd try and use the same syntax for comments...however what actually happens...i think is it finds the first comment
...Some Body HTML
<!-- comment -->
I'm very very new to regex, so I know nothing about whats going on...basically I just understand the concept...
Is there a repeat or counter character that shouldn't be there...???
Any ideas...?
Thanx in advance..
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
removes anything in between
OIC, try these expressions then...
$buffer = eregi_replace("(<script[^>]*</script>)", "", $buffer);
$buffer = eregi_replace("(<!--[^>]*-->)", "", $buffer); Brackets will match a sequence of characters, parenthesis will group characters, and nothing will match explicitly and can be considered as one big ol' group. I made the change to the script tag one too, because after realizing the issue I noticed it also had the same problem.
Hockey wrote:
I'm very very new to regex, so I know nothing about whats going on...
I'm not new to regex, and the complicated ones can still look like Chinese to me.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
AFAIK the script removal code I used works fine...although I only tested it with ONE script tag present...I dunno if it works with 2 or more so it's a good thing you made me think about it...I'd better test it...
I'll definetly have to try yer version of the regex for stripping comments though...cuz i'm starting to loose my mind here...
Thanx alot...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I am having problems finding out how to convert a time from a client's local time zone to GMT/UTC.
It seems the classes I should use would be in the .NET SDK for either System.TimeZone or System.Datetime. However, the .NET Framework SDK's System.TimeZone object does not have a public constructor (and is abstract) and the System.DateTime only creates its CurrentLocalTime according to the server the code is running on.
So, how do I create and specify another timezone? Most of the examples I have found either use JavaScript to display the value in the client's system time or use the standard offset for the client's timezone (which usually does not take into account Daylight Standard Time and the varying dates that the timezone switches to Daylight Time).
Any help is greatly appreciated. Thanks!
Chris
|
|
|
|
|
|
Chris,
Thank you very much for your response. The section doesn't really tell me how to solve my problem, but actually re-enforces it.
A clip from section 2:
"Methods and properties in the DateTime structure always use the local time zone for calculations and comparisons... You can also choose to format a DateTime for a specific culture."
To elaborate, these classes only allow me to create a DateTime or TimeZone class based on the local time (of the system executing the code, i.e. webserver). Instead, I need to create a DateTime or TimeZone based on a parameter, representing the timezone of the site user's system.
Any other ideas?
Thanks again,
Chris
|
|
|
|
|
I found this code at msdn site explaining how to make a master/detail view:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/webteam02052002.asp
The code is listed below.
musicLibrary.xml
<Artists>
<Artist name="The Chipmunks">
<CD id="4550" name="Eponymous" image="Eponymous.jpg" />
<CD id="4557" name="Hibernation" image="Hibernation.jpg" />
<CD id="4577" name="Going Nuts" image="GoingNuts.jpg" />
</Artist>
<Artist name="The Dogs">
<CD id="4640" name="Full Moon" image="FullMoon.jpg" />
<CD id="4637" name="Old Shoes" image="OldShoes.jpg" />
<CD id="4664" name="My House" image="MyHouse.jpg" />
</Artist>
</Artists>
music.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<html>
<script language="VB" runat="server">
Dim DS As Dataset = New DataSet
Sub Page_Load(Src As Object, E As EventArgs)
DS.ReadXml(Server.MapPath("musicLibrary.xml"))
Dim CSource As DataView
CSource = DS.Tables("Artist").defaultView
MusicList.DataSource = CSource
'a little code to help display what table relations exist
RelationsGrid.DataSource=DS.Relations
DataBind()
End Sub
</script>
<body>
<ASP:Repeater id="MusicList" runat="server">
<ItemTemplate name="ArtistTemplate">
<br /><br /><b><%# Container.DataItem("name") %></b><br />
<ASP:Repeater id="CDList" runat=server
datasource='<%# Container.DataItem.CreateChildView("Artist_CD")%>'>
<ItemTemplate name="CDTemplate">
<img src="<%# Container.DataItem("image") %>"align="absmiddle"/>
<%# Container.DataItem("name") %><br />
</ItemTemplate>
</ASP:Repeater>
</ItemTemplate>
</ASP:Repeater>
<br /><br />
<ASP:DataGrid id="RelationsGrid" runat="server"
Width="300"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
MaintainState="false"
/>
</body>
</html>
My problem is that it uses an xml file as a datasource.
Where i want to use two related tables from a database, but i can't seem to figure out how to do that.
I have created a dataset containing the two tables, I have also created a datarelation between the two tables.
I am able to write out the master table if i remove the nested repeater control.
If anyone is able to solve this problem i think a lot of people would be grateful. as i've seen questions
about this master detail thing around the net.
Venlig hilsen / Regards
Steffen Otto Jensen
(Denmark)
|
|
|
|
|
New (relatively) to .Net , and I've got a quick question:
Is it possible (and if so, a hint would be appreciated...) to have separate config files or separate config file sections for a number or custom user controls?
for example, say I've got a page with a "Latest News Display" control as well as a "User Poll" control. I'm looking to store things like the db connection strings in a "web.config" file.
Barking up the wrong tree or just a bit slow?
TIA.
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
|
Beauty! Thanks much..
(So does that prove that I was just "SLOW"?)
Mike Stanbrook
mstanbrook@yahoo.com
|
|
|
|
|
Nah it just proves MS loves to hide stuff in their vast ocean of documentation..
|
|
|
|
|
Is there anyway to display an ActiveX in Netscape browser? Usual OBJECT tags doesn't seem to be working there (using NS 6.2)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
ActiveX isn't supported in Netscape. I'm certain of this in 4.x, and I'm willing to bet this is also the case in 6.x. ActiveX is a Microsoft technology and is not an industry standard.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Hmm... kinda strange, OBJECT tag is in HTML 4 specification and it has "classid" attribute. From my point of view of Windows programmer, class id means GUID of the COM/ActiveX object.. But Netscape says it support HTML 4 in NS6 (incl. OBJECT tag), but looks like I can't use ActiveX GUID in it. So I can think about 2 ways - Netscape lies and it doesn't support HTML4, or "classid" is something else and not what I'm thinking. Then what is "classid" in Object tag?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Philip Patrick wrote:
or "classid" is something else and not what I'm thinking. Then what is "classid" in Object tag?
A class id generally is a GUID but doesn't have to be in theory. This is not related to ActiveX other than the controls use them. Support for the object tag doesn't mean ActiveX support. Other instances of using the object tag would be for RealAudio/Video, Flash, etc. It's still up to the user agent (e.g.; Netscape) to interpret the object data. Ever notice you have to install plug-ins for Real and Flash? It's processed by the browser. The HTML specification doesn't cover this.
Hope that helps.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Is there a way to set the focus to a particular control, like an edit box, on a server page when it loads?
Thanks,
Marc
|
|
|
|