Here are examples for use of accelerometer.
Acc support and detection.using flash cs5
Ball movement determined by phones horizontal and vertical positioning.
Here are examples for use of accelerometer.
Acc support and detection.using flash cs5
Ball movement determined by phones horizontal and vertical positioning.
Here is an app inspired by my friends at the college, where the user touches, the screen cracks and makes a crunching sound effect. This needs some finishing touches to be released into the app market. I made this in Flash CS5 during class at college.
Here is an attempt to have “data bugs” come out from the cracks. Just a start of an idea, not even close to done.
Here is example of flash cs5 code to put animation of flowers where user touches. This is going to be further developed into an app.
Here is an example to put an animation of a flame where the user has touched. This was made by Donald Denney using flash cs5 on a mac during class at Skagit Valley College.
Here is my click, touch and cursor movement practice. This contains some good code examples for detecting whether the user has touched or clicked with a mouse, including mouseover hover.There is even code that lets the touch user drag the object, but not the mouse user. I created this code during my Flash CS5 course winter 2011 at skagit valley college.
Here is a touch detection example with animation on press.
While making an application you may need to customize the cursor depending on the screen size and other unique situations. Here is a cursor designed for a touch screen applications on devices such as Samsung SmartTv..
The following describes a procedure to determine if a number is divisible by 7. Demonstrate with the number 203.
Remove the units digit from the number, double the units digit and subtract it from the remaining number…
get the rest of this from the book page 220 problem 92.
Any number divided by 0 is undefined. x/0=undefined.
Here is a quick way to display the form elements, best for debugging. While this is a very easy way to get all of the elements displayed, they will not be in the order you might expect.
For each x in Request.Form
Response.Write(“<span class=’highlight’>” & x & “</span> = <span class=’myspan’>” & Request.Form(x) & “</span><br />”)
next
This next way first will check if the form has been submitted, and then preserves the original order of the form elements, and is best for coding the form elements into variables or displaying them
If request.form <> “” Then
for x = 1 to Request.Form.count()
Response.Write(Request.Form.key(x) & ” = “)
Response.Write(Request.Form.item(x) & “<br>”)
next
End If
What if you are getting errors when trying to use a varaible that was submitted. There is a good chance that there is whitespace before or after the var. In classic asp you can just use the Trim()
myvar=” ddenney@hotmail.com ” <– those pesky white spaces at the end will mess up the sendEmail function.
MycleanVar=Trim(myvar) — MyCleanVar should now pass through the send email function with out any problems..(assuming you have validated the address).
What if the user has entered their data in “quotes”. Suppose Dan “the man” Rodriques wants to register for sports. The quotes around the name could mess up the sql server insert statement. We just escape the characters with script.
FUNCTION remChars(inString) tempString = Replace(inString,"""","""""") tempString = Replace(tempString,"'","''") remChars = tempString END FUNCTION
Counting Form Submit Variables and using them if they exist.
Now I need to count how many variables received for additional transcripts. They will be passed to me using the following pattern… Other Transcripts1, Other Transcripts2, Other Transcripts3, Other Transcripts4, etc.
After some pondering, I have decided to use a While loop…
amount = 1
While Request.Form("Other Transcripts" & amount) <> ""
Response.Write("We have other transcripts (" & amount & "), lets put it into the table." & otherSQL)
amount = amount + 1
Wend
This will continue to loop through the variables until it finds them empty.
To protect against vulnerabilities such as script injection and cross-site scripting, user input can be verified and rejected, or an application can simply remove harmful characters and continue processing. This is a summary from the microsoft article
The regular expression, [^A-Za-z0-9_ ], matches any character that is not any of the following:
function RemoveBadCharacters(strTemp) { strTemp = strTemp.replace(/[^A-Za-z0-9_ ]/g,""); return strTemp; }
if (str.indexOf("Yes") >= 0)
This is a powerful tool. The variable str contains the text you want to search. “Yes” is an example of what you could search for. It will be >=0 if the string is found in the search.
Here is a good example for how to see if its a negative number.
var isnegative=number.indexOf("-")>=0? true : false ;
If string passed in is like number= 10 will return true
If number = -10 then will return false.
While enjoying some reading of the Mozilla Developer Network docs, I have stumbled on to a bit of “best practice” techniques:
Note that ‘0’ doesn’t evaluate to true and ‘-1’ doesn’t evaluate to false. Therefore, when checking if a specific string exists within another string the correct way to check would be:
"Blue Whale".indexOf("Blue") != -1; // true
"Blue Whale".indexOf("Bloe") != -1; // false
So my final snippet for checking if a string is in another string is as follows.
var mystring - "Yes I want to respond."; If (mystring.indexOf("Yes") != -1){console.log("They want to respond");)}
The standard vbscript array is created as so…
Dim degrees(4)
degrees(0) = “Associate in Applied Science Transfer”
degrees(1) = “Associate in Arts, University and College Transfer”
degrees(2) = “Associate in Arts, General Studies”
degrees(3) = “Associate in Science”
degrees(4) = “Associate in Technical Arts”
These arrays are not dynamic and need some work to add data to them. You can also create arrays by splitting strings as seen in my post about asp string manipulation techniques.
count = 23 ‘ set from database pull
Dim myarray()
ReDim Preserve myarray(count)
For x = 1 to count
myarray(x) = mydynamicitemhere
Next
Dump the contents of an array to the screen for debug:
For Each item In myFixedArray Response.Write(item & "<br />") Next
A two dimensional array would be achieved as so…
Dim listofslides()
ReDim preserve listofslides(4,4) ‘ sequence, filename, description, enabled
listofslides(0,0)=1
listofslides(0,1)=”image1.jpg”
listofslides(0,2)=”Description of image 1″
listofslides(0,3)=1
But if you are getting the array from an information storage system, then its super easy.
sub grabdata
SQL_query = "SELECT * FROM MSAccess_table"
Set rsData = conn.Execute(SQL_query)
If Not rsData.EOF Then aData = rsData.GetRows()
end sub
and you use the array like this
If IsArray(aData) Then
For x = lBound(aData,2) to uBound(aData,2) 'loops through the rows
Col1 = aData(0,x)
Col2 = aData(1,x)
Col3 = aData(2,x)
Response.Write "Row #" & x+1 & "
"
Response.Write "This is the data in Column1: " & Col1 & "
"
Response.Write "This is the data in Column2: " & Col2 & "
"
Response.Write "This is the data in Column3: " & Col3 & "
"
Next
End If