Jump to content

Yahweh

Members
  • Posts

    186
  • Joined

  • Last visited

Posts posted by Yahweh

  1. You could also keep a record of which random sequences you recently generated to avoid repetition.
    Its a lot easier to work with an ArrayList, and a lot more efficient because you only have to loop through the elements of the ArrayList once to generate a random sentence.Here's some code that will do the job:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click		Dim cArray As New Collections.ArrayList		Dim sBuilder As New System.Text.StringBuilder		For Each sItem As String In ListBox1.Items			cArray.Add(sItem)		Next		Dim iCounter As Integer, iIterations As Integer		Dim myRandom As New Random, iRnd As Integer		iIterations = cArray.Count - 1		For iCounter = 0 To iIterations			iRnd = myRandom.Next(0, cArray.Count)			sBuilder.Append(cArray(iRnd)).Append(" ")			cArray.RemoveAt(iRnd)		Next		Label1.Text = sBuilder.ToString	End Sub

    It works like this:- All the elements from the listbox are shoved into an ArrayList.- The program loops through the ArrayList, selects a random item, appends it to a stringBuilder, then removes that item from the ArrayList.-- Because I'm using an ArrayList, the array indexes are automatically "reset" whenever I remove an item, so there aren't any gaps in list when I remove something from the middle of the list.- After looping through everything, the stringBuilder is printed to screen.

  2. HiOPEN "aaa.dat" for RANDOM As #1I have many data file that make and read by this command in VB:and now I want make ASP page and reading this Data.this Data have RANDOM format (binary) as you know.I want using of this without translate this data file, to SQL or Access (MDB).I want reading aaa.dat directly in my ASP(VB) page.is work OPEN and RANDOM command to ASP(VB)?thank for your help.
    VB6 and Classic ASP use different syntax for opening files. To open a file in ASP, use this code:
    <%dim fs,f,xset fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.OpenTextFile(Server.Mappath("aaa.dat"),1,false)x=f.ReadAllf.close Response.Write("The text in the file is: " & x)%>

  3. I have two tables, "Doctor(name, specialization)" and "Patient(name, illness, treatment)". - Each name represents one single person; - A doctor may be a patient;- Also, illness and specialization are the same thing, that means, headache may appear in both tables;- A doctor may be specialized in more than one area;- An illness may have many different kinds of treatment.I want to SELECT the names of the doctors who have all the illnesses in which they are specialized.Please help!
    SELECT d.nameFROM Doctor dLEFT JOIN Patient p ON (d.name = p.name)WHERE d.specialization = p.illness

  4. For this job I have changed roles...In this case i have been asked to find a suitable hosting provider and upload it for them. Im using 1 and 1 hosting they seem ok...For some reason im getting this error message when i try to access the database. Im unsure as to why im getting it simply because the database is not read only. I'd be great full if someone could shed some light on this situation.
    Microsoft JET Database Engine error '80040e09'Cannot update. Database or object is read-only./admin/sessions_inc.asp, line 49

    Either your database, or the folder where your database is located doesn't have write permissions. CHMOD both of those to drwx------ (700).If you can't CHMOD them, go into IIS and set the file permissions for yourself, or ask your host to do it for you.
  5. Thanx..but this query SELECT * FROM tbl_name ORDER BY RAND( ) LIMIT 5 didn't work with me.. the probleam is in syntaxi use MS SQL SERVER 2005 EXPRESSplease help me on this problem :)
    Rand() and Limit 5 are specific to MySQL.The equivalent query in SQL server looks like this:
    SELECT TOP 5 * FROM table ORDER BY NewID()
    That method isn't very efficient if you have 100s of 1000s of records, because it will have to create a NewID() for each record before returning the top 5.To return a single record, there's a little more efficient way:- Get the maximum uniqueID in your table, store that information in a variable called MaximumID- Multiply MaximumID * rnd(), store that information in a variable called RandomID- Select the first record with an ID >= RandomIDIn T-SQL:
    declare @MaximumID int = Select Max(ID) from table1declare @RandomID int = Rand() * MaximumIDSelect Top 1 * From table1 where ID >= MaximumID

    Or, you can always do what Microsoft suggests and create a table with random columns already in the table definition.

  6. I have the code for an email form, but I'm at a loss regarding where on the page to put it.I got the code from w3schools, but, I don't know whether or not to put it above the DOCTYPE and <html> declarations, or in the html code where I want the form to appear on the page.
    Officially, it doesn't really matter where you put the code. It can be above all other HTML, after all other HTML, or at any arbitrary point in between. However, as an unwritten rule of thumb, its best to group all of your ASP code into functions at the top of the page to seperate code logic from presentation and prevent excessive spaghetti code.
    I'm an ASP newbie (only just started learning about a month ago) so I'm still not sure how things work.
    My best advice is this: don't learn Classic ASP. Its a dead language now. Learn ASP.Net because the future of all web development is moving in a .Net direction, .Net is 10000000x more powerful than ASP*, and you'll waste too much time struggling in the future if you don't learn ASP.Net as soon as possible.* Classic ASP is really lacking in many important features, such as being able to generate MD5 hashes, file uploading, and image manipulation; to be able to get any of those functions, you have to write 100s of lines of custom code. ASP.net natively supports all of those functions (and 1000s more) in various namespaces, you can invoke any of those functions in 1 or 2 lines of code. ASP.net also has real datatypes, real page and control events, native support for XML and user memberships, etc.
  7. vit4ek,The error doesn't occur on index.php, because none of the queries on index.php correspond to the error message. The error is located somewhere on one of the include files.I hate to say it, but I don't think anyone is going to be able to help you. Its notoriously difficult to fix problems by copy/pasting an error without seeing the code, its even more difficult to diagnose the error without any line numbers, its even more difficult when 100s of lines of code for an entire page are copy/pasted without formatting or indentation, and its outright impossible to fix errors without seeing the code for right page where the error actually occurs.In spite of all of that, I think I know the cause of the error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'out) as tout from hl_traffic where listing_id = 1 and date + interval 7 day > no' at line 1
    There is a column in the table called "Date", but date() is a reserved word in MySQL. MySQL can't tell the difference between a column called date and the date() function; it presumes that the author wanted to use the date() function, but without the parentheses on "date()", MySQL throws a syntax error.To tell MySQL to assume "date" is a column rather than a function, you have to surround the column name by a pair of "`" marks, or write out the fully-qualified name of the column in [table].[column] format, like this:
    Select * from some_table where `date` + interval 7 day > now();-- alternativelySelect * from some_table t where t.date + interval 7 day > now();

    Its up to you to find all the instances of the "date" column appearing without "`" marks and fixing it.

    oh yeah and if not hard can someone explain what it is wrong as i want to learn how to fix such problems myself in future.
    Start here and here.
  8. Hi all,i need to write the output html source of an ASP file into a div, that i can do using JS.but i first need to get the html output source and save it into a variable...any ideas on how can i pull that off?
    If you need the HTML before processing the ASP, then you can read a text file stored on your server with a FileSystemObject:
    <%Set fs=Server.CreateObject("Scripting.FileSystemObject")Set f=fs.OpenTextFile(Server.MapPath("some_file.asp"), 1)Response.Write(f.ReadAll)f.CloseSet f=NothingSet fs=Nothing%>

    If you need the HTML after processing the ASP (I presume that's what you mean by "output source"), then you can read any web page with a an XMLHTTP object:

    <%  Dim objXMLHTTP, xml  Set xml = Server.CreateObject("Microsoft.XMLHTTP")  xml.Open "GET", "http://www.somewebsite.com/"  xml.Send  Response.Write xml.responseText  Set xml = Nothing%>

    Rather than response.writinging the data to the screen, you can save it in a variable and work with it some more.

  9. how would you make your own serach engine like mumma or lycos or something?
    Step 1: Create a piece of software that crawls pages on the internet.Its probably easiet to create some kind of desktop application to do this. A crawler basically looks at the HTML of a page, indexes the page, extracts all of the URLs, and repeats the process indefinitely. In .Net, you can create a crawler in a few lines of code.Step 2: After creating your crawler, you have to index your data. You can store the data in a database, flat files, or other storage medium. You should choose whether you index the entire page, specific keywords or other information.Step 3: Write server-side backend to execute search queries on your index and display the results.That's the gist of it for a very simple search engine. You can write all of the necessary software for your search engine in less than 400 lines of code (~120 for the crawler and indexer, ~300 for the search page). It won't be any good, but it'll be a genuine search engine.If you don't know how to write desktop software or server-side languages like PHP or ASP.Net, then you won't be able to create a search engine.
  10. ASP Fundamentals:Anything wrapped in the <% ... %> tags is processed server side, that's where all of your form processing takes place. Anything outside is printed to screen, just like a normal HTML document:

    <%' stuff in this block will be processed by the server%><!-- stuff outside of the block is boring old HTML -->

    Conditionals in ASP look like this:

    <% If condition = true then'... do stuffEnd if %>

    To read form data, use:

    Request("someFormData")

    So, putting it all together:

    <%if Request("frm_toemail") <> "" then	' do all of your form processing here%>	Put all of your HTML here.<%else	'abort page%>	Put an error message here.<%end if%>

  11. Hi,Thanks for your help.I try to execute your code and I have an error on this lineMatches = regex.Execute(data)It says "Wrong number of arguments or invalid property assignment "My data contains a long XML string and there is no newline.thx
    Oops, that should have said:
    Set Matches = regex.Execute(data)

    Matches is an object, so you have to use "Set" with it.

  12. I've had strange experiences with ASP as well: in one case, the code was perfectly fine, but it wouldn't retrive values from the database. I fixed the problem by saving the data into a new file, and mysteriously the identical code would work just fine.For your example, I don't see anything out of the ordinary with the code, unless you've misspelled a variable somewhere (I would imagine that you are like me, and use <% Option Explicit %> at the top of every page).

    This is sticking point #1: how is it even possible for a loop like the one above, which simply iterates through the collection and displays everything, have any effect on anything else that happens on the page?
    I think the obvious difference between the loop and your code is scope: the loop uses the recordset in global scope, and the variables are assigned from functions which make a reference to your recordset (I assume fromrs and cb_fromrs are functions). You can check if that's the case by assigning your variables directly from your recordset:
    FORMS_RECORDSET.open("select * from content where cid = '" & fromget("cid") & "'")cid		   = FORMS_RECORDSET("cid")	 'don't need to use fully qualified rs.fields(something).valuetitle		 = FORMS_RECORDSET("title")description   = FORMS_RECORDSET("description")tid		   = FORMS_RECORDSET("tid")'...

    That's just my guess, but if that works correctly, then maybe the error in your code is a variable scope issue.

  13. Hi.I have a main large image on my page and a data list with small kinda thumnail images (simply resized to lower size, their actual size is the same as large image size).And I would like to change that large image to the one the user rolls the cursor on (mouseover in other words) and change back to the original image file on mouseout.Please, see what i mean in the example on ebayer.com (scroll down to Image Gallery)I'm coding on asp .net , using C# as code behind and Visual Studio 2005 as an editor.Please share your ideas.
    I found a nice article on 4Guys which explains how you can create your own custom control for rollover images.
  14. Hi,I have a really big string inside a variable "data".When I did Response.Write(data), I was able to display all the string.But when I did objFile.WriteLine(data) to a file, I was not able to write all the string in the file. It was truncated.Why?What should I do?Thx
    Odds are, there is some kind of buffer limit, probably 64kb, that you can write to a text file at any given time. If that is the case, then the simple solution to your problem is writing your data is smaller chunks, rather than all at once. You can split your data into fixed-sized chunks using a simple regular expression, then you can write your data chunk by chunk as you loop through the matches collection:
    Dim regex, match, matches	'regex variablesdim fs, f	'text file vars'creating a text fileset fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.CreateTextFile(Server.Mappath(someFileName),true)	'create regexp object and set properties	set regex = new regexp	regex.IgnoreCase = True	regex.Global = True	regex.Pattern = "[\s\S]{1,10000}"					'matches *at most* 10000 characters at a time					'I'm using "[\s\S]" rather than "." as a convenient way to match newline characters.	'Create matches collection to parse data into managable 10000-character chunks	Matches = regex.Execute(data)	'Loop through matches collection	for each match in matches		'writing each chunk to the file		f.write(Match.Value)	nextf.close'cleaning upset regexp = nothingset f=nothingset fs=nothing

  15. Hello,I am wondering if someone a bit more experienced than I can offer any suggestions to help improve the performance (speed) of this query.Currently, I am using this SQL select statement from within Visual Foxpro:select * from MyTable where id like '05%'There are a total of 137827 records in MyTable, and this query takes between 3-5 seconds.The number of records that match the Where clause criteria are about 1200.Thanks in advance! :) vfpdev
    Just wondering, but in what context would you ever need to execute a query like that?First, to speed up your query, you probably shouldn't use "Select *" unless you actually need to return all the columns in your table. If your table has 12 columns, but you only need to use 1 or 2 of thsoe columns, then you're just wasting processing time. You should directly specify which columns you intend to use, that way you return the minimal of data.In any case, I think the query could be speed up with some slighly convoluted programming work-arounds. Generally, in order of speed, the % operator is the slowest (especially on integers, because it has to cast integers as a string before they can be compared), followed by the > and < operators, followed by the BETWEEN operators, and finally the = operator. Based on your query, your best bet to improve the speed is creatively using the BETWEEN operator.If you know how many records are in your database, then you know how many digits you have to work with, then you can pad your search string with 0s until it matches the number of digits in your records. For example, because 137827 contains 6 digits, you would pad 05 with 0s until to match 6 digits resulting in 050000. Now, you can run your query in one of two ways:
    -- First method, just find all records with an ID greater than some valueselect * from MyTable where id >= 050000;-- Second method, the BETWEEN operator is slightly faster than the the ">" operator,-- so you can specify finding any records between a minimum value and an-- arbitrarily large value.select * from MyTable where id BETWEEN 050000 AND 99999999;

    Either of those optimizations should be significantly faster than using a "%".

  16. $q2 = mysql_query("SELECT `Site` FROM `checking` WHERE `Site` = '" . strtolower($_POST['site']) ."' LIMIT 1"); 	IF (mysql_num_rows($q2) == 1) :  echo "already in system";//help heredie();ENDIF;

    help here.I want to add an update section that would pick the column Contacted in table checking where column Site = strtolower($_POST['site']);takes the INT value in the Contacted column and make it ++ ( or i guesss +1 wouldbethe same thing)

    I don't know exactly what you're trying to do, but it looks like you're trying to check that your record exists before you update it. You don't need to do that, its a superfluous step. Also, you don't need to use the strtolower function, because MySQL is case-insensitive by default.The entire block of code in your opening post can be replaced by executing this SQL statement:
    UPDATE `Checking` set `Site` = `Site` + 1 WHERE `Site` = $_Post['site']

    If you only want your Site column to equal 0 or 1, then you can alter your query very slightly with MySQL's built-in Sign() function:

    UPDATE `Checking` set `Site` = Sign(`Site` + 1) WHERE `Site` = $_Post['site']

  17. :blush:i wanna some sql editors & asp editors & jscript editors please give me names :):):)
    NotepadOr, if you're a little more adventurous:Notepad++ - I use this one all the time.
  18. Hi all,I'm doing a website and it will contain a survey that will be available for the first 2 weeks of each month. Each time, 30 persons will be picked in random to do the survey. Each time, I need to create 30 new row (30 INSERT) in my table and they will contain the answers (eg: user_id, answer1, answer2, answer3, etc.) . But after, let say, 2 years, I will have a LOT of row! like 2 * 12 * 30 ~= 650.
    That's really a trivially small amount of data. Just for comparison, 800+ records are added to one of my tables on one of my sites everyday, and as of right now it contains 207000+ records. Queries on that table using the primary key execute in a few microseconds, queries using a fulltext index execute in 4 or 5 seconds.
    What should I do with that? Is it "ok" to have that much data in a mysql table? or should I do a backup in a xml file or something else and try to keep as low data in the table as I can?.
    MySQL can handle 650 rows, believe me. Its best to put all of your related data in a single table, rather than creating multiple tables, simply for the sake of being able to run queries and generate reports much more easily.As long as you know how to create your table properly, and make efficient use of indexes, then you shouldn't have any problem with your table even with millions and millions of rows in it.
  19. i would like to show the time of a user last login upon that particular user login again. For example, if i logged in at 2/4 6:30. And when i login again next time, the system will remind me that "Last login: 2nd April, 2007 6:30p.m."i will keep a log for all the login and logout. So you can imagine that it will be a huge table!!And also, i will have a table holding members' information of course.Here comes my question,1) should i add a field "last_login" in the members' table,2) or querying the most recent date for a particular member's ID in the login logout log table for the last login information?Method 2 is better if this query is fast enough and mySQL allows many queries to access the same table at the same time.Otherwise, method 1 will do a lot better in performance but it has data redundancy.
    I recommend method 1, even if it means having redundant data, because if you wanted to display a user and the last login time in the same query, you'd need a really awkward join:
    Select	u.user_id,	u.user_name,	Max(l.last_login)FROM	User_table uLEFT JOIN	Login_table l		ON			(u.user_id = l.user_id)GROUP BY	u.user_id,	u.user_name

    Aggregate functions and joins on huge tables are murder on a database, and your site will begin to slow down over time to the point where it no longer wants to function at all.I have a website that works somewhat like a blog: articles are posted, and people can make comments to the article. Articles are stored in their own table, comments are stored in another. I wanted to include a link to the most recent comment, so I had to use a join somewhat like the one above, but after 20 000+ articles, and 100 000+ comments, queries kept timing out. I eventually added a "last_comment" field on my table, and it *dramatically* increased the speed of my queries.If you just add another field, you gain a lot of performance:

    SELECT	user_id,	user_name,	user_last_loginFROM	user_table;

  20. Hi,Having a problem selecting records from an Access 2003 database. With the below SQL from what I understand it should select all records in the database based on using the wildcard character '%'.
    SELECT * FROM Unsnooped WHERE RegionCode LIKE '%' AND ClinicGroup LIKE '%' AND Snooped LIKE '%' ORDER BY Sitecode ASC 

    The WHERE clause is superfluous increases unnecessary overhead if you're trying to select all records. Do this instead:
    SELECT * From Unsnooped ORDER BY Sitecode ASC

    Example DB records can be found at accessdb.gif. The rightmost field is the one called 'Snooped'. There are 1033 records in the DB but it will only display 496. All the fields that I'm trying to pull out are populated by values so I'm a bit of a loss.
    I don't use Access a lot, but I'm pretty sure your problem traces back to MS Access' handling of nulls. A null is not the same as an empty string, so if one of your RegionCode, ClinicGroup, or Snooped fields contains null data, it won't be returned in your dataset.
  21. I'm quite new to the webbuilding thing, and I have a couple of questions.1. How is a website updated? I understand you upload your webpages to a server wich is (usually) on day and night. The visitors connect to the server to visit your webpage. But when you want to update your webpage, do you upload the new file to the server wich automatically renews the old file on your webpage? Or is there a tool to do this? I don't quite get this.2. Are there any good tools you guys recommend for building/ designing a webpage? (It's just a webpage for some guys I know, nothing commercial)3. What is the best FREE webhost I can get?4. What is the best FREE forum I can get?Please don't think I didn't search myself, I just want to see if you guys agree on questions 2-4. Thanks in advance.
    1. You can't change a page on your computer and hope that the page on your webserver is changed with it, you have to save your new page on top of your old page.Or, if you write database driven websites, such as a blog, then changes to your site occur automatically as you alter your database, so you can make changes to your site without having to upload new pages all the time.2. The best tool is a text editor. Notepad is the canonical tool among web developers (it was the first tool I ever used), but I like Notepad++ which is strictly a text editor with a few widgets like syntax highlighting, auto-indent, and tabbed browsing for editing multiple files at the same time.If you're building a site in .Net, then you must use Visual Web Developer. Otherwise, .Net is going to be really really hard.3. Brinkster is a good free Windows host, although they make their free hosting very difficult to find on their page. I don't know of any good free PHP hosts.You should know ahead of time that virtually all "free" hosts will put ads on your site. You will not find a decent free host that is ad free.If you want good hosting, you have to pay for it. But, until you actually know what you're doing and your website starts getting popular, then Brinkster free hosting will work just fine.Fortunately, the difference between free hosting and pay hosting is extremely cheap. With free hosts, you're lucky to get 100 MB of space and 1 GB of bandwidth, you'll have ads or popups inserted into your pages, and the URL to your page will look something like http://username.somehost.com. For $5 a month, you can get 200 GB of space, 3000 GB of bandwidth, no ads, a domain name, all sorts of add-ons like free support and databases, etc. Free hosts are essentially worthless compared to what you can get for a trivial $5 or $10 a month.4. There isn't one. The best free forum is the one that you can write yourself. I wrote my own software and couldn't be happier with it. Some people suggest PHPbb, but I hate PHPbb with a passion, it embodies everything in shoddy web design.I recommend avoiding forums for now. First, because if you don't even know how to upload pages to a server, and don't know anything about programming server side languages, then you're going to have a helluva time administrating a forum. What would you do when MySQL starts generating inexplicable glitches as it frequently does? What do you do when someone wants you to change some code? Second, because free hosts don't give you the amount of space or bandwidth needed to run a successful forum.
  22. The best way to learn to program is picking up a book and going through examples page by page.I learned Visual Basic 5 a long time ago by flipping through a textbook, I learned the language in less than a month. I didn't learn the language especially well because the book wasn't comprehensive, it didn't cover many important things like API calls and it didn't make things object abstraction seem very important.I learned HTML the same way, by picking up a book and going through it page by page. I picked up the language in a couple days, mastered it in a week or so.I learned ASP and SQL by trial and error, by reading tutorials on the internet. That was a bad idea. I was very fortunate to already know the VB language, but it literally took me years to become proficient at ASP. I learned ASP by setting my goals too high: I downloaded an ASP messageboard and modified the contents, and I picked up A LOT of bad programming habits because the board I modified was very poorly written. I know ASP as well as any professional, but it took me MUCH longer to learn the language than if I'd picked up a book.I learned VB.Net/C#t in the process of getting my degree in Computer Science. I learned next to nothing in my classes, it was a review of Visual Basic. I learned trivial things like connecting I learned the String.Format method, but I learned those from other students. I've been learning ASP.Net, which is distinct enough from application programming that its rightfully considered its own language, but I've not been able to find any comprehensive books on the subject, so I'm learning by trial and error, and although I'm very good at it, I think it will be a long time before I'm proficient.I learned Java and C++ from college, and my experience in college was invaluable because I would have never learned the languages by guess-and-test.More than anything I recommend borrowing a book from the library and learning how to program on your own. Books of those sorts gently guide you into a subject in and organized way than most internet tutorials. Additionally, when you have to type code from a book to your computer, you're actually internalizing the language rather than being a copy/paste script kiddy. Its possible learn things from the internet and become very good, but unless you're already a seasoned pro and just looking up a new technique for building tree data with SQL or dumping the results of a query into an array, then you're only going to slow yourself down by trying to learn a language from the internet.

  23. First, I do not know what forum to post this topic. So, I will post it both here and in the PHP forum. I am wanting to learn either or both PHP and ASP.NET for fun and for jobs. Do you know which one is better ? which one is more marketable ?Well, I want to learn to get a job, but in the mean time at home, I want to put the extra time to speed up my skill in the same technology. So, should I rather focus on only PHP or ASP.NET or both ? Thanks
    I programmed in PHP a long time ago, back in the early days of PHP3 and PHP4.PHP is good because its easy to install, its cross-platform compatible, and its free.It lets newbies connect to a database in a single line of code with its mysql_* family of functions, but as a consequence it lacks a data abstraction layer such as ADODB or <asp:sqlsource> found in other languages (I don't consider that good programming practice). It has some nuances that encourage bad programming habits, such as not requiring variable declaration before using them, lacking datatypes. It has some odd features like magic_quotes and register_globals that reduce code portability and open security holes. It also has some unintuitive typecasting, for instance:
    if ((string)"false" == (int)0) echo "true\n";// returns true for some reason

    To fix that problem, you have to use the triple equality operator, ===, which is just strange syntax.I made the switch from PHP to Classic ASP for a few reasons:- PHP variable don't need to be initialized before use. With ASP, you can force variable declaration by including <% Option Explicit %> at the top of every page. With .Net, you're required to declare variables before use.- PHP arrays are very slow, and software I write tends to be very array dependent. I learned a while ago that PHP arrays are really balanced trees that emulate an associative array, its a very different data structure than a linear array. An array is really a key/value pair, and $array[1] isn't the first element in an array, its a key/value pair where the key is "1". I consider that a disadvantage for two reasons. You get a little flexibility out of PHP's "array" syntax, but you pay a performance penalty. In Big O notation, php "arrays" execute in O(log n) time for any array lookup, whereas arrays in every other program execute in O(1) time (<--- best case performance). ASP and .Net arrays are linear arrays, so lookups occur in O(1) time.- Regex in ASP is easier.PHP has some major advantages over ASP when it comes to important functions like sending mail, uploading, manipulating images. With Classic ASP, you need to use COM objects for those purposes, which means you either have to buy those objects or hope they are included with your host. PHP's has those functions built in.I made the switch from ASP to ASP.Net for lots of reasons:- Code behind rocks. Less spaghetti code.- Compiled code helps to hide your source code from other developers who use your product. Compiled code also runs faster.- I write about 90% less code than I did before. Especially with VS.Net, I can create entire database-driven, AJAX-enabled sites without having to write a single line of code, those functions are encapsulated in the .Net controls.- Regex is EXTREMELY powerful: balanced expressions and named captures are a godsend. If you don't have a lot of experience working with Regex, or you've never tried to parse text with nested code, then you can't appreciate just how powerful the regex engine is.- Good XML support.- Try/Catch blocks are MUCH better than "on error resume next".- Lots and lots of namespaces for handling common functions like MD5 and SHA512 hashing, generic functions (similar to C++ template<t> structure).- Some web controls intrinsically support membership. The most challenging part of programming large websites is handling user accounts, user roles, security; .Net does it for you, and it saves you A LOT of time.- Very good object-oriented language, and the controls respond to events (like "click" events, "state changed" events, etc.).ASP.Net lets you use VB.Net, C#, J#, and a lot of other languages, but I prefer the Visual Basic flavor as my default language because blocks of code are easier to read than curly braces. A "}" can mean "end while", "end if", "end sub", "end function", but but "end if" only means "end if". Also, C#, for whatever reason, doesn't allow programmers to functions with optional / default parameters; that ability is maintained in VB.net. I like being able to declare optional parameters rather than a bunch of overloaded functions, so I stick VB.net for convenience and readability.There are a lot of plusses to ASP.net, and the future of all web development is moving in a .Net direction. So, saying that you know PHP and .Net looks good on a resume, but I generally think .Net is the best choice for developers.

  24. I have an access database
    Ick.
    which is searched through a Frontpage generated asp page SQL query.
    Double ick.Before you do anything else, learn to write HTML and ASP by hand. WYSIWYG editors are notorious for creating ugly, bloated code (and code, mind you, that doesn't format correctly in non-IE browsers). And don't use Access if you plan to have more than 5 users connected to your site at any given time, and don't use Frontpage if you plan to do any kind of serious web development.
    The problem is that it translates a web address hyperlink with a %2E instead of the period, even though the link itself is displayed on the browser page correctly.Does anybody have any ideas how this can be prevented or modified?This is the asp fragment that takes the access field (called www) containing the url:[snip]I wouldn't know where to start trying to work out what the asp fragment is doing.
    Apart from the 90% of useless junk generated by frontpage, nothing is wrong with the fragment you've posted.Two things come to mind:1) Check your database. If the data in your database is URLEncoded, then you have a problem with record input, not record output.2) Check your code. According to your code, you're displaying fields like this:
    <a href="http://<%=FP_FieldURL(fp_rs,"www")%>">

    The function FP_FieldURL is outputting your data, its the piece of code that's formatting your data incorrectly. Find that function and comment out any line of code that says "someVariable = Response.URLEncode(someVariable)". That will format everything correctly, but just be aware that doing so is a security issue, it leaves you open to XSS attacks.If you don't want to edit your function, then here is a possible solution:The variable fp_rs is most likely a recordset. In that case, you can access your field directly. Try modifying your code to look something like this:

    <a href="http://<%=fp_rs("www")%>">

    If that doesn't work, you have to edit your functions. If you're still having problems, post the code for function FP_FieldURL, and any other functions called from it.

×
×
  • Create New...