Math Functions...
Didn't remember if anybody had started started like this, but I decided it would be cool to start it again. If you have a math function request ask it below, or if you have made one then add it:
I have a few cretegean plane (think thats how you spell it), calculations. One request I have is, does anybody have a short function for square root?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Math Functions In Forms
I have several forms written in asp and I would like to make a couple of the fields autocaculate, but I have no clue how to go about this. I only need addition and division.
Math Question
i need to print the x value of a circle (center is 0 and max = 1) depending on the angle entered i know it is possible with functions but i dont remember wich one example : user enter 0 : returned value is 0 user enter 45 : returned value is 0.5 user enter 90: returned value is 1 user enter 135 the returned value is 0.5 user enter 180 the returned value is 0 user enter 225 the returned value is -0.5 ... and so on
Simple Math
I am trying to add my numeric fields together to produce a total. Does the following make sense to anyone? Code:
Doing A Math Problem With ASP
I want to enter a math formula to caculate how many pages are there for each thread. At this point, I set the page break to 15 posts for each thread. In other words, one page contains 15 replies to one thread. If there are more than 15 and less than 30 replies, then page number is equal to 2. If more than 30, the page number is equal to 3. If I translate this to a math formula, it would be like total replies divided by 15 = the number of page (this number should round up like 0.x=1) if total replies is 3, so 3 divided by 15 = 0.2 (round it up to 1) if total replies is 18, so 18 divided by 15 = 1.2 (round it up to 2) How can I do this?
Math Working
<% Dim BeforeTax Dim A Dim B Dim C A = OrderSummary.Fields.Item("Order_Total").Value B = OrderSummary.Fields.Item("Tax").Value C = OrderSummary.Fields.Item("Shipping").Value BeforeTax = A-(B+C) %> I tried this after I tried to have just one line with BeforeTax = OrderSummary.Fields.Item("Order_Total").Value-.... Any idea why I get an error?
Math Equation
normally if i want to do a simple math equation and user only key in A and B but the C will be auto generate. and i wanna store all these three variables in the system. can anyone write a simple program for me? i declare inside head tag rite?
Math Behind The Sessionid
how unique the sessionid is in ASP. What is the math behind it's creation, and what are the probobolities of it being reproduced, i.e. 1/10000? or 1 in twenty million? Can someone give me some guidance on this? I'm trying to create some unique numbers for data assignement, and would like a way that does not replicate.
Using Functions
I have a file i created it contains several functions, and some other code to build a string based on diffrent vars.If i run this file standalone, it works absolutly fine. However the problem comes when i include it half way in another script. I get the following.. VBScript Error 800a03ea test4.asp, line 2 function encr.. This is line 2 Function Encrypt(Message, EncryptionKey)
Functions
I am searching for a function that can separate a string var to some string vars and devide the string by "," marks, os this possible? example: str1 = "2,34,1,54" and I want "2","34","1" and "54" be devided and inserted into new vars, or an array var, is their a VBscript function for this? I have made a function myself that does this using ths Instr and the Mid functions, but its quit messy and I don't wan't to have to insert it in every page I make, Any Ideas? Another small thing, I want to learn how to use Classes in ASP, I don't know what to look for exactly, (vlince, I could use a link now...)
Functions
<%= functionName(value1, value2) %> Trying to call a function which returns the modulo of two numbers, can l simply whack the function name in and the value will be returned ?
Functions In Asp
I've written the following function but somehow the output is not what I want it to be. Can someone explain to me what i'm doing wrong? function fn_piping(inputWaarde) outputwaarde = inputwaarde Response.Write outputwaarde & "<BR>" if i = 1 then i = 2 call fn_piping("thisshouldbethefinaloutput") else fn_piping = outputwaarde end if end function i = 1 figure = fn_piping("bla") Response.Write "<BR>" & figure So 'thisshouldbethefinaloutput' should be the final output, but it doesn't output anything?!
Sub/Functions With FOR
I need a current record in the database for it to work but I have another page that uses this same code and it works fine on that and the only thing different in the coding is where the information is being pulled from in the database and when i first copied & edited the page it worked fine but now it doesn't and i've worked on it .....
Calling Functions...
Where's the best place for me to include all my functions that I want to call throughout different pages? Should I just put them all in one ASP file and include that page on every page? Or use global.asa somehow (how??)? Anyways, I was just wondering because I didn't want to slow things down if I could help it (I didn't know if having another big file attached to every page when I'm just using a small portion of it was very effective or not)
Date Functions
i am wondering how to actually get the month in letters..... i have used a strMonth = Month(Date) but it is returning a number of the month... i would like to make this the actual month such as January, August, etc.... how would i go abt doing this in ASP.....
ASP Apps And Functions
Over my years developing ASP applications and writing asp code in general I have created a library of nice little apps and functions that I use over and over again. I was "thinking" about maybey setting up a site with all my useful functions, subroutines, and possibly applications for people to download and hopefully donate some money if they use them. Perhaps even have some apps for sale only. The apps will mainly be my useful plugin developments such as guestbook, gallery, login system etc. My question however is do you think it would be worth the time and effort? Do you find yourself using plugins a lot? I defo think the functions could be handy but again how many of you search for functions to help you out or indeed how many of you currently use functions you have gotten from other people? Would you donate something if you used them? Mayby some of you have already done something like this and can let me know how you got on?
Multiple Functions
I have some code I am working on. One function reads a file using fso, then I have multiple functions using the string read from the file. Each function splits the lines up and will return one value. Is there a better way? Is handling this many array which are basically the same going to cause some server distress
Lack Of Functions
I know there is the function IsNumeric() in ASP and we have a SUM function in SQL, but why don't we have the following functions in ASP: Code: Sum() IsAlphabetic()
Reusing Functions
I have been developping a webpage in ASP for about 4 weeks now and I have noticed that I am rewriting similar functions in pretty much every page i make. So I was wondering if there is a way to make some particular functions global so that you can use them in any page. The functions will depend on the session id, but I don't know if i can declare session functions or not.
Functions Question
In this function i pass variables to it to find out if a record exists, what i want to do next is call this function and if a record does not exist pass a variable out like Statement = False and then pick up that value on the page that i call the function. Can this be done? I was thinking perhaps using a Session? Code:
NOW() And DATE() Functions
So i am inserting Now() or Date() (Either one will work for what i want), into one of my fields. But it is returning the Server time, which is about 17 Hours behind of what i want. Is there anyway to insert Australian time, as in where i am situated?
VBScript Functions
I'm a PHP programmer. That said, I recently began a job where a good third to half of the applications are written in ASP.NET. VBScript, to be precise. As I've done programming for years (C/C++, PHP, JavaScript, BASIC... the list goes on and on), picking this up hasn't been too difficult, but I now find myself facing a question that I simply cannot find an answer to anywhere: Can one define a function that has optional parameters in VBScipt? If not, can it be done in C#, and can C# code be easily integrated into pages written in VBScript?
Best Way To Call Functions?
I have written a very complex web app for intranet use. It allows users to search a large database and then returns formatted results. I am currently employing a method as below: Code:
Date Functions
if there was a function in ASP that checks a date to see if it is valid or not. I am aware of the IsDate function, but I think its not what I'm looking for. I want to run the following date through a function and have the function tell me that it is invalid: 31-Feb-2003 (cos there is not 31 days in Feb). Or a good way to make my own function?
Functions Pass By
I have a function called GetRS which takes in a SQL string and returns a recordset object. Does this mean that a copy of the recordset is returned or is it passed by reference?Obviously this could have a large impact on performance for large recordsets.
SUBROUTINES Vs FUNCTIONS In Asp
There is a chapter on SUBROUTINES, FUNCTIONS AND INCLUDES.what is the difference between SUBROUTINES and FUNCTIONS. If not mistaken, in VB, the SUBROUTINES return no value, but FUNCTIONS do have return value.Variable in ASP: global versus local.variable not in betweeb function is Global (what about subrountine, is it the same) and variable in between function is local, am I right?
Date Functions
I have a column in my SQL server database table by name request_generated_date of datetime datattype and the default value set to it the server date by using the function getdate(). I am querying this table wherein I want to check that when a user submits a form then it should check the following: the submit date (column:request_generated_date in the tabel)should be less than the server date + 24 hours (or one day). When I am writing the query as where request_generated_date ='"&dateadd('d',1,date())&"'" but the result set is empty.Can I use the date() function in ASP or not. or should I try to remove the time factor from the server date and then query the column.
Javascript Functions
I've got a page displayin a CV and want to have two buttons, one to display the page in printable format and show the print dialog box and the other as a Save As button to show the save as dialog box. does anyone know the two javascript functions.
Replace Functions
I have a form that collects the following article information: title (input type TEXT) publication date (input type TEXT) source (input type TEXT) article text (TEXTAREA) When I put something like the following sentence into the text area, it's screwy): The dog's were the perfect "matched" perfectly. I'm using SQL Server 2000. how I would use replace functions to: 1. insert that into the db without errors 2. extract the information with single quotes and double quotes like it should be read.
Left And Instr Functions
I am having a problem with the following code: <% If Len(TestRS.Fields.Item("Testimonial").value) > 150 Then Response.Write(Left(TestRS.Fields.Item("Testimonial").Value,150)&""... <br><font size=1><a href=""/Testimonials.asp"">Read More</a></font>") Else Response.Write(TestRS.Fields.Item("Testimonial").Value) End If %> I am getting a null response from TestRS.Fields.Item("Tesimonial").Value after it is processed by the Len function. I am getting the following result: Quote: "... Read More This tells me that the len function is analysing the string to be greater than 150 charachters yet the string is not being expressed.
Perform Functions On Recordset?
Is it possible to perform functions on a recordset (rather than on the source database), e.g. COUNT, MAX etc The reason I would like to do this is because I have a hugely complex view which produces results with over 60 columns of data. I would like to display all data but also highlight individual "cells" in the table which have the highest (i.e. MAX) data for each column. I would also like totals at the bottom of each column. Obviously I could get the MAX value for each column by performing it on the SQL data but that would effectively mean running the query twice and would take twice as long.
Variable Scope And Functions
Basically, I have an asp application that uses a database connection, and I want to declare (create) that connection in an include and use it throughout the application in various functions. I've tried making the connection object a public variable, a constant, making the functions public, passing the connection object in byRef, byVal, etc... I just can't get it to work. Is this not possible in classic ASP? Code:
Functions Like ChrB In Vbscript
Is there any functions like chrB in vbscript that returns the byte associated with the ASCII code in jscript. If not how we return a byte. The code in vbscript is ChrB(Asc(Mid(a charcter))). Please tell me how we convert this code to vbscript....
Simple Mssql Functions
what are some simple fuctions, like how do i get the date using mssql. also wheres a good tutorial on mssql
SQL One-to-Many Query With Aggregate Functions
I am attempting to select some details from an accounts table and the SUM() of a field from an orders table. I am using the SUM, GROUP BY, and HAVING clauses, which work great to return the ID and TotalSum from the order table, but I cannot select any of the other fields in the accounts table without getting the error below. Code:
Using Functions With Parenthesis And Calling Them?
ok i have this function if blah blah then runcode(in) end if if blah blah then runcode(out) end if function runcode(variable) sql = select * from tblitem where id=" & variable & ";" I assumed that would work but it doesnt work properly as the variable seems to be empty. Any ideas what im doing wrong maybe in ouw i call it?
Calling Functions Within A Web Service
My first problem is: I am having an issue when using a web service. The web service is written by another department and say its running fine but when I call it, I sometimes I get a system.net.webexception return instead of the correct return. Would anyone have any advice or suggest any extra debugging I could do to find out where this problem might occur? The second problem I am having is: I also called some functions within the web service over GPRS and sometimes the function just hangs. The only way I have found to get the function call to work again is to disconnect the GPRS connection and reconnect it. However other functions and other programs are still using the GPRS connection quite happily.
Trouble Calling Functions
I'm having a little bit of trouble.I have created a form where I accept peoples information.at the bottom of the form I have a submit button that I want to have execute a function or procedure that I created in VB script.the problem I have is that it execute the function even before the client has clicked on Submit.
Date Interval Functions
On a form I have Date_Start Date_End I have a new Date_Start1 Date_End1 which the use inputs. I need to validate that Date_Start1 and Date_End1 are a date range entirely separate from Date_Start and Date_End i.e. no overlapping whatsoever. In effect checking a date interval.Are there any functions out there already written that can do this? It seems to basic to start comparing and contracting dates! Would like to do it in Javascript, but happy in vbscript also.
Type Mismatch - Using Arrays And Functions
Getting Type mismatch error on the noted line. I'm trying to send an array (aryNewD) with 4 columns and x rows to a function to save all the array info into a SQL Server table via a stored procedure. Keep getting this error. Any suggestions? Code:
Excel Export-embed Some Functions
I am populating a schedule using access db, then export that to an excel file using "content-disposition".... I need to add some excel formula while populating the data, how will i do that? any sample??
Multiple Split Functions And Looping Through Them
I have the following code: that requests both products, quantity and price from the previous page and sends to the next. Now i would want to be able to iterate through them all and run some code based on the values. Now it works well only for the first items, then throws an error ...
Block Print, Save And Source Functions
Is there any way to block the print, save and source functions on a image? I already used the anti-right click but people are still able to take the image because in the left hand corner of the pic the option menu pops up.
Changing This Code To A Function? (how Do You Make Functions?)
I have a menu system that has nodes that can be opened or closed. In an effort to make my code more manageable, I programmed a little widget tonight that keeps track of the open/active item and automatically builds querystrings for my redirect URLS. The code for this follows. It defines an ASP Dictionary object, and key/value pairs for each, and builds appropriate querystrings based on comparison with a status variable. The way it works for now is I manually declare and re-declare a variable ("CurrentContentClass") in places throughout the code where there is a new menu item. I embed this same block of code repeatedly through my application, one for each menu node. This is a really stupid approach, and I'm sure there's a better way. Better would be to create a single function into which you could feed parameters and get output. I've used lots of functions in my auspicious career in ASP, but I've never created one myself. Can anyone suggest tutorials or approaches such that I can learn how to create my own functions? Any guidance based on what's below? Code:
Call Subs, Files, Functions, Etc. From Javascript
is it possible to call ASP subs, files, functions, etc. from Javascript commands? I want to have a setup of various buttons where clicking on a button would call an ASP sub to grab info from a db.
String Functions Run On Empty String
I have a form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
|