Sorry if this is the wrong group. I tried to find the one I thought
would be most relevant.
I'm an old PHP guy, who knows little about asp and NOTHING about
asp.net, but need to learn at least enough to convert a favorite PHP
script to work on an ASP.NET site.
I'm experimenting with simple example scripts that will help me learn
how to implement each "piece" of the puzzle.
Doing well so far... one piece of the puzzle at a time.
I need to create a simple funtion that will check the IP Address of a
visitor against an "array variable" of banned IPs.
In asp, it saeems simple enough. Here's the include that contains the
function to be called (in .asp):
############### ###############
<%
Dim sIPAddress
sIPAddress = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ")
if sIPAddress = "" then
sIPAddress = Request.ServerV ariables("REMOT E_ADDR")
End If
%>
<script language="VB" runat=server>
function BannedIP(sIPAdd ress)
Dim sBanned
sBanned =
Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104","2
16.155.200.231" ,"216.155.200.2 32","216.155.20 0.233","216.155 .200.234")
Dim i
For i = 0 to UBound( [sBanned] )
If selCriteria(i,1 ) = cstr(sBanned) Then
BannedIP = TRUE
Else
BannedIP = false
End Function
</script>
############### ############### ##
The function is called from an existing .aspx page thus:
############### ############### ##
if BannedIP(sIPAdd ress) then
' show it the "SORRY" page
Server.Execute( "sorry.aspx ")
' Then STOP! (same as PHP's "exit;" statement ???)
Response.End
' otherwise it's cool, go ahead and display this page below
End If
############### ############### ##
ASP.NET doesn't like this at all!
It tells me: "'Array' is a type and cannot be used as an expression."
:-(
What is the proper syntax in ASP.NET for:
variable = Array("value1", "value2","value 3")
I would simply use the function as is, written in asp, but the pages
are VERY .aspx and choke on it.
ALSO: My next piece of the puzzle will be to tackle this one, using the
same test script:
If I want e to ban a violator with a dynamic IP, how do I deal with
entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains
123.45.6.*)
Many TIA
:-)
Friday
--
############### ############### #######
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
############### ############### ####### 29 4057
> What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
Dim sBanned() As String =
{"69.202.123.15 7","216.239.39. 5","216.239.37. 5","216.239.37. 104","216.155.2 00.231","216.15 5.200.232","216 .155.200.233"," 216.155.200.234 "}
Jody
"Friday" <fr****@nowhere .org> wrote in message
news:0605200513 06302444%fr**** @nowhere.org... Sorry if this is the wrong group. I tried to find the one I thought would be most relevant.
I'm an old PHP guy, who knows little about asp and NOTHING about asp.net, but need to learn at least enough to convert a favorite PHP script to work on an ASP.NET site.
I'm experimenting with simple example scripts that will help me learn how to implement each "piece" of the puzzle.
Doing well so far... one piece of the puzzle at a time. I need to create a simple funtion that will check the IP Address of a visitor against an "array variable" of banned IPs.
In asp, it saeems simple enough. Here's the include that contains the function to be called (in .asp):
############### ############### <% Dim sIPAddress sIPAddress = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ") if sIPAddress = "" then sIPAddress = Request.ServerV ariables("REMOT E_ADDR") End If %>
<script language="VB" runat=server>
function BannedIP(sIPAdd ress) Dim sBanned sBanned = Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104","2 16.155.200.231" ,"216.155.200.2 32","216.155.20 0.233","216.155 .200.234")
Dim i For i = 0 to UBound( [sBanned] ) If selCriteria(i,1 ) = cstr(sBanned) Then BannedIP = TRUE Else BannedIP = false End Function
</script> ############### ############### ##
The function is called from an existing .aspx page thus: ############### ############### ## if BannedIP(sIPAdd ress) then ' show it the "SORRY" page Server.Execute( "sorry.aspx ") ' Then STOP! (same as PHP's "exit;" statement ???) Response.End ' otherwise it's cool, go ahead and display this page below End If ############### ############### ##
ASP.NET doesn't like this at all! It tells me: "'Array' is a type and cannot be used as an expression." :-(
What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
I would simply use the function as is, written in asp, but the pages are VERY .aspx and choke on it.
ALSO: My next piece of the puzzle will be to tackle this one, using the same test script: If I want e to ban a violator with a dynamic IP, how do I deal with entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains 123.45.6.*)
Many TIA :-) Friday
-- ############### ############### ####### "The people cannot be all, & always well informed. The part which is wrong will be discontented in proportion to the importance of the facts they misconceive. If they remain quiet under such misconceptions it is a lethargy, the forerunner of death to the public liberty. What country before ever existed a century & a half without a rebellion? & what country can preserve it's liberties if their rulers are not warned from time to time that their people preserve the spirit of resistance? Let them take arms... The tree of liberty must be refreshed from time to time with the blood of patriots & tyrants" -- Thomas Jefferson ############### ############### #######
In article <OT************ *@TK2MSFTNGP12. phx.gbl>, Jody Gelowitz
<jg************ **@blah.leevall ey.com> wrote: What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
Dim sBanned() As String =
{"69.202.123.15 7","216.239.39. 5","216.239.37. 5","216.239.37. 104","216.155.2 00. 231","216.155.2 00.232","216.15 5.200.233","216 .155.200.234"}
Jody
Many Thanks!
Can't wait to try it.
:-)
"Friday" <fr****@nowhere .org> wrote in message news:0605200513 06302444%fr**** @nowhere.org... Sorry if this is the wrong group. I tried to find the one I thought would be most relevant.
I'm an old PHP guy, who knows little about asp and NOTHING about asp.net, but need to learn at least enough to convert a favorite PHP script to work on an ASP.NET site.
I'm experimenting with simple example scripts that will help me learn how to implement each "piece" of the puzzle.
Doing well so far... one piece of the puzzle at a time. I need to create a simple funtion that will check the IP Address of a visitor against an "array variable" of banned IPs.
In asp, it saeems simple enough. Here's the include that contains the function to be called (in .asp):
############### ############### <% Dim sIPAddress sIPAddress = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ") if sIPAddress = "" then sIPAddress = Request.ServerV ariables("REMOT E_ADDR") End If %>
<script language="VB" runat=server>
function BannedIP(sIPAdd ress) Dim sBanned sBanned = Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104","2 16.155.200.231" ,"216.155.200.2 32","216.155.20 0.233","216.155 .200.234")
Dim i For i = 0 to UBound( [sBanned] ) If selCriteria(i,1 ) = cstr(sBanned) Then BannedIP = TRUE Else BannedIP = false End Function
</script> ############### ############### ##
The function is called from an existing .aspx page thus: ############### ############### ## if BannedIP(sIPAdd ress) then ' show it the "SORRY" page Server.Execute( "sorry.aspx ") ' Then STOP! (same as PHP's "exit;" statement ???) Response.End ' otherwise it's cool, go ahead and display this page below End If ############### ############### ##
ASP.NET doesn't like this at all! It tells me: "'Array' is a type and cannot be used as an expression." :-(
What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
I would simply use the function as is, written in asp, but the pages are VERY .aspx and choke on it.
ALSO: My next piece of the puzzle will be to tackle this one, using the same test script: If I want e to ban a violator with a dynamic IP, how do I deal with entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains 123.45.6.*)
Many TIA :-) Friday
-- ############### ############### ####### "The people cannot be all, & always well informed. The part which is wrong will be discontented in proportion to the importance of the facts they misconceive. If they remain quiet under such misconceptions it is a lethargy, the forerunner of death to the public liberty. What country before ever existed a century & a half without a rebellion? & what country can preserve it's liberties if their rulers are not warned from time to time that their people preserve the spirit of resistance? Let them take arms... The tree of liberty must be refreshed from time to time with the blood of patriots & tyrants" -- Thomas Jefferson ############### ############### #######
--
############### ############### #######
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
############### ############### #######
In article <OT************ *@TK2MSFTNGP12. phx.gbl>, Jody Gelowitz
<jg************ **@blah.leevall ey.com> wrote: What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
Dim sBanned() As String =
{"69.202.123.15 7","216.239.39. 5","216.239.37. 5","216.239.37. 104","216.155.2 00. 231","216.155.2 00.232","216.15 5.200.233","216 .155.200.234"}
Jody
Darn...
Now I'm geting an error: "Expression expected."
at: Dim sBanned() As String =
Something else wrong withmy little fndtion.
Any thoughts?
Now my little test reads:
############### ###############
<%
Dim sIPAddress
sIPAddress = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ")
if sIPAddress = "" then
sIPAddress = Request.ServerV ariables("REMOT E_ADDR")
End If
%>
<script language="VB" runat=server>
function BannedIP(sIPAdd ress)
Dim sBanned() As String =
("69.202.123.15 7","216.239.39. 5","216.239.37. 5","216.239.37. 104","2
16.155.200.231" ,"216.155.200.2 32","216.155.20 0.233","216.155 .200.234")
Dim i
For i = 0 to UBound( [sBanned] )
If selCriteria(i,1 ) = cstr(sBanned) Then
BannedIP = TRUE
Else
BannedIP = false
End Function
</script>
############### ############### ##
The function is called from an existing .aspx page thus:
############### ############### ##
if BannedIP(sIPAdd ress) then
' show it the "SORRY" page
Server.Execute( "sorry.aspx ")
' Then STOP! (same as PHP's "exit;" statement ???)
Response.End
' otherwise it's cool, go ahead and display this page below
End If
############### ############### ##
--
############### ############### #######
"The people cannot be all, & always well informed. The part which is wrong will
be discontented in proportion to the importance of the facts they misconceive.
If they remain quiet under such misconceptions it is a lethargy, the forerunner
of death to the public liberty. What country before ever existed a century & a
half without a rebellion? & what country can preserve it's liberties if their
rulers are not warned from time to time that their people preserve the spirit
of resistance? Let them take arms... The tree of liberty must be refreshed from
time to time with the blood of patriots & tyrants"
-- Thomas Jefferson
############### ############### #######
Friday, Jody's replied on the Array, but the syntac on your VB code needs a
couple of tweeks:
function BannedIP(sIPAdd ress as String) as Boolean
Dim sBanned, i as integar
sBanned = _
Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104", _
"216.155.200.23 1","216.155.200 .232","216.155. 200.233","216.1 55.200.234")
For i = 0 to UBound( [sBanned] )
If sIPAddress = cstr(sBanned(i) ) Then
BannedIP = TRUE
Exit For
Else
BannedIP = false
End If
Next
End Function
I am assuming that you are passing the IPAddress to be checked. Also, if you
want to check through the whole array, you will want to check each element of
the array. Also, you will want to break if it finds a banned address.
Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB
(and then only in MS Office. So you might know more about VB than I.
John H W
"Friday" wrote: Sorry if this is the wrong group. I tried to find the one I thought would be most relevant.
I'm an old PHP guy, who knows little about asp and NOTHING about asp.net, but need to learn at least enough to convert a favorite PHP script to work on an ASP.NET site.
I'm experimenting with simple example scripts that will help me learn how to implement each "piece" of the puzzle.
Doing well so far... one piece of the puzzle at a time. I need to create a simple funtion that will check the IP Address of a visitor against an "array variable" of banned IPs.
In asp, it saeems simple enough. Here's the include that contains the function to be called (in .asp):
############### ############### <% Dim sIPAddress sIPAddress = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ") if sIPAddress = "" then sIPAddress = Request.ServerV ariables("REMOT E_ADDR") End If %>
<script language="VB" runat=server>
function BannedIP(sIPAdd ress) Dim sBanned sBanned = Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104","2 16.155.200.231" ,"216.155.200.2 32","216.155.20 0.233","216.155 .200.234")
Dim i For i = 0 to UBound( [sBanned] ) If selCriteria(i,1 ) = cstr(sBanned) Then BannedIP = TRUE Else BannedIP = false End Function
</script> ############### ############### ##
The function is called from an existing .aspx page thus: ############### ############### ## if BannedIP(sIPAdd ress) then ' show it the "SORRY" page Server.Execute( "sorry.aspx ") ' Then STOP! (same as PHP's "exit;" statement ???) Response.End ' otherwise it's cool, go ahead and display this page below End If ############### ############### ##
ASP.NET doesn't like this at all! It tells me: "'Array' is a type and cannot be used as an expression." :-(
What is the proper syntax in ASP.NET for: variable = Array("value1", "value2","value 3")
I would simply use the function as is, written in asp, but the pages are VERY .aspx and choke on it.
ALSO: My next piece of the puzzle will be to tackle this one, using the same test script: If I want e to ban a violator with a dynamic IP, how do I deal with entire C-blocks (e.g.: BannedIP is TRUE if sIPAdress contains 123.45.6.*)
Many TIA :-) Friday
-- ############### ############### ####### "The people cannot be all, & always well informed. The part which is wrong will be discontented in proportion to the importance of the facts they misconceive. If they remain quiet under such misconceptions it is a lethargy, the forerunner of death to the public liberty. What country before ever existed a century & a half without a rebellion? & what country can preserve it's liberties if their rulers are not warned from time to time that their people preserve the spirit of resistance? Let them take arms... The tree of liberty must be refreshed from time to time with the blood of patriots & tyrants" -- Thomas Jefferson ############### ############### #######
In article <0B************ *************** *******@microso ft.com>, John H
W <Jo****@discuss ions.microsoft. com> wrote: Friday, Jody's replied on the Array, but the syntac on your VB code needs a couple of tweeks: function BannedIP(sIPAdd ress as String) as Boolean Dim sBanned, i as integar
I see. Thank You.
But.... do I use Jody's example for declaring the variable or the
following example [variable=Array( ...)]??? sBanned = _ Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104", _ "216.155.200.23 1","216.155.200 .232","216.155. 200.233","216.1 55.200.234")
For i = 0 to UBound( [sBanned] ) If sIPAddress = cstr(sBanned(i) ) Then BannedIP = TRUE Exit For Else BannedIP = false End If Next End Function
I am assuming that you are passing the IPAddress to be checked.
Yes.
Also, if you want to check through the whole array, you will want to check each element of the array. Also, you will want to break if it finds a banned address.
Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB (and then only in MS Office. So you might know more about VB than I.
Not quite.
Just an old PHP guy.
--
I have not used Array as such. How I do it is:
Dim sIPAddress(8) as String
I would use 8 or some other amount that I would not exceed. I then use
another function to fill it from an XML or other "formated" file, passing the
array, i.e.,
brtn = FillBannedAddre sses(sIPAddress ())
Then declare the other function as
public function FillBannedAddre sses(ByRef sIPAddress() as string) as Boolean
I then return a true if filled (false if a problem)
In this other function, I would open the file, parse it and load the
addresses into the passed array (byref).
I am leaving work now or I would give you some more "pointers."
John H W
"Friday" wrote: In article <0B************ *************** *******@microso ft.com>, John H W <Jo****@discuss ions.microsoft. com> wrote:
Friday, Jody's replied on the Array, but the syntac on your VB code needs a couple of tweeks: function BannedIP(sIPAdd ress as String) as Boolean Dim sBanned, i as integar
I see. Thank You. But.... do I use Jody's example for declaring the variable or the following example [variable=Array( ...)]??? sBanned = _ Array("69.202.1 23.157","216.23 9.39.5","216.23 9.37.5","216.23 9.37.104", _ "216.155.200.23 1","216.155.200 .232","216.155. 200.233","216.1 55.200.234")
For i = 0 to UBound( [sBanned] ) If sIPAddress = cstr(sBanned(i) ) Then BannedIP = TRUE Exit For Else BannedIP = false End If Next End Function
I am assuming that you are passing the IPAddress to be checked.
Yes.
Also, if you want to check through the whole array, you will want to check each element of the array. Also, you will want to break if it finds a banned address.
Just to let you know, I have 25 years of C, C++, C#, and only 1 year of VB (and then only in MS Office. So you might know more about VB than I.
Not quite. Just an old PHP guy.
--
John H W <Jo****@discuss ions.microsoft. com> wrote: I have not used Array as such. How I do it is:
Dim sIPAddress(8) as String I would use 8 or some other amount that I would not exceed. I then use another function to fill it from an XML or other "formated" file, passing the array, i.e.,
brtn = FillBannedAddre sses(sIPAddress ())
Then declare the other function as public function FillBannedAddre sses(ByRef sIPAddress() as string) as Boolean I then return a true if filled (false if a problem)
In this other function, I would open the file, parse it and load the addresses into the passed array (byref).
Yuk. Exceptions are there precisely to indicate problems without you
needing to pass anything by reference or check return values all the
time.
Mind you, if you know how many you're going to parse beforehand, you
wouldn't need to pass the array variable by reference anyway...
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon [C# MVP]:
I use exceptions, but sometimes I like the old, tried and true methods (25
years of writing code, starting with cobal, then C, C++, C# & VB.Net). In
the called funtion, I could use an exception, but opening a file, while
testing whether it is open, saves five or six lines for an exception.
Then while reading in the addresses, I check at each read, again testing in
the same if statement, saving even more lines it would take to "switch" to
another exception.
In thinking about what I wrote below while driving home, instead of using
the boolean, I would return the number of addresses read, so my code would
look like:
nNumberRead = FillBannedAddre sses(sIPAddress ())
if nNumberRead > 0 then
For i = 0 to nNumberRead then
...
Next
end if
Of course, in C#, I would just write:
AddressList *sIPAddress; // where AddressList is a structure for a linked list
if (nNumberRead = FillBannedAddre sses(sIPAddress )) > 0 {
... }
Don't forget, Jon, we are giving pointers to a person who is new to VB, but
has plenty of programming experience. When this is the case, I like to give
small directions or pointers and letting the persons use his own experience.
Introducing expections is too great a leap and can cause problems relating to
expections.
I also like "small" functions. Problems are easier and quicker to find.
Therefore, because of memory scope, you have to pass a reference or the info
he needs will "disappear" when he needs to use it. I am fairly new to VB
myself, but when I did try to return a "string array" from a function
[myarray = FunctionReturnS tring()] contained only the first element - all the
other elements were empty. While it is possible I did not do it correctly,
passing myarray by reference worked [FunctionReturnS tring(myarray) and
FunctionReturnS tring(byref myarray as string)].
But I would like to thank you for all your help in these newsgroups.
John H W
"Jon Skeet [C# MVP]" wrote: John H W <Jo****@discuss ions.microsoft. com> wrote: I have not used Array as such. How I do it is:
Dim sIPAddress(8) as String I would use 8 or some other amount that I would not exceed. I then use another function to fill it from an XML or other "formated" file, passing the array, i.e.,
brtn = FillBannedAddre sses(sIPAddress ())
Then declare the other function as public function FillBannedAddre sses(ByRef sIPAddress() as string) as Boolean I then return a true if filled (false if a problem)
In this other function, I would open the file, parse it and load the addresses into the passed array (byref).
Yuk. Exceptions are there precisely to indicate problems without you needing to pass anything by reference or check return values all the time.
Mind you, if you know how many you're going to parse beforehand, you wouldn't need to pass the array variable by reference anyway...
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
John H W <Jo****@discuss ions.microsoft. com> wrote: I use exceptions, but sometimes I like the old, tried and true methods (25 years of writing code, starting with cobal, then C, C++, C# & VB.Net).
You mean tried and failed - how many bugs have you seen because people
have failed to look at the return value of a function call? I've
certainly seen loads. Heck, just look at the number of people who don't
use the return value of Stream.Read, and that's giving actual
information beyond just success/failure!
In the called funtion, I could use an exception, but opening a file, while testing whether it is open, saves five or six lines for an exception.
Well, you've still got to be able to handle the exception anyway...
even if you test for whether or not it's open, it could be opened
immediately after that.
Then while reading in the addresses, I check at each read, again testing in the same if statement, saving even more lines it would take to "switch" to another exception.
Are you considering handling the exception at each point? I wouldn't -
chances are if the operation fails, that should be an exception going
up to the next stack layer anyway - if you fail to read the list of
banned IPs, do you really want to just asssume that the visitor is
allowed?
In thinking about what I wrote below while driving home, instead of using the boolean, I would return the number of addresses read, so my code would look like:
nNumberRead = FillBannedAddre sses(sIPAddress ()) if nNumberRead > 0 then For i = 0 to nNumberRead then ... Next end if
Why not just return the array in the first place? You could always
return null or an empty array if you absolutely had to.
Of course, in C#, I would just write:
AddressList *sIPAddress; // where AddressList is a structure for a linked list if (nNumberRead = FillBannedAddre sses(sIPAddress )) > 0 { ... }
Do you mean in C/C++? Or are you considering using unsafe code?
Don't forget, Jon, we are giving pointers to a person who is new to VB, but has plenty of programming experience. When this is the case, I like to give small directions or pointers and letting the persons use his own experience. Introducing expections is too great a leap and can cause problems relating to expections.
Whereas not introducing exceptions can cause problems relating to
failing to look at return values, and persists the error-prone error
handling from "the bad old days". Why not show best practice right from
the start? Personally I'd suggest that if exceptions are a problem, the
OP should suspend his ASP.NET work and start learning the basics of
..NET properly, starting with some console apps and working up from
there.
I also like "small" functions. Problems are easier and quicker to find. Therefore, because of memory scope, you have to pass a reference or the info he needs will "disappear" when he needs to use it.
a) There's a difference between passing an array reference and passing
a parameter *by* reference.
b) The information wouldn't disappear - while the caller has a
reference to the array, the array and everything within it won't
be garbage collected.
I am fairly new to VB myself, but when I did try to return a "string array" from a function [myarray = FunctionReturnS tring()] contained only the first element - all the other elements were empty. While it is possible I did not do it correctly, passing myarray by reference worked [FunctionReturnS tring(myarray) and FunctionReturnS tring(byref myarray as string)].
That's certainly a failure in your code. It's hard to say exactly what
the failure was without seeing the code, but passing things by
reference isn't the best solution. Passing by reference should be very
rare.
But I would like to thank you for all your help in these newsgroups.
My pleasure.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JNY |
last post by:
Hello,
Is it possible to declare an array with variable indeces?
i.e.
int x = 4;
int myArray;
for (j = 0;j < 5;j++)
{
|
by: Friday |
last post by:
Sorry if this is the wrong group. I tried to find the one I thought
would be most relevant.
I'm an old PHP guy, who knows little about asp and NOTHING about
asp.net, but need to learn at least enough to convert a favorite PHP
script to work on an ASP.NET site.
I'm experimenting with simple example scripts that will help me learn
how to implement each "piece" of the puzzle.
|
by: Peter Duniho |
last post by:
On Thu, 14 Aug 2008 18:56:00 -0700, Phill
<Phill@discussions.microsoft.comwrote:
For future reference, if you are asking for help with an error (compile or
execution), you really should post the complete text of the error and be
specific about when and where it happens.
That said, in your code it's clear what's wrong:
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |