anybody knows of one that does this?
I need to calculate the length a roll of tape
without unwinding the tape. I know the diameter and thickness of the
tape. The tape is wound on a core. I know the diameter of the core.
Given that information, how do I calculate the length of the tape
thank you
Why on earth do you need to know such info?!!
use a loop in a script or something.
Do Until OutDia =< InDia
TempLength = OutDia * 3.14
OutDia = OutDia - Thick - Thick
Length = Length + TempLength
TempLength = 0
Response.Write "" & Length & "
"
Response.Write "" & OutDia & "
"
Response.Write "" & inDia & "
"
Loop
Response.Write "Total length is " & Length
havent tested this though
Man that is neat.
you guys are great
i got the math formula to do it but using excell is a bit slow
yo dont know any prog that simple does that
to saldous
imagine you have a tape if you cant unwrape it how can you tell its lenght?
maths is the answer lol
nice one bosjo thanks
i hoped some day they port mathematica to pocket pc :-DDD never lol
Don't know of any prog. that will calc. it for you
Use the code
Dim Length, OutDia, InDia, Thick, TempLength
Length = Your Input
OutDia = Your Input
InDia = Your Input
Thick = Your Input
Do Until OutDia =< InDia
TempLength = OutDia * 3.14
OutDia = OutDia - Thick - Thick
Length = Length + TempLength
TempLength = 0
Response.Write "" & Length & "
"
Response.Write "" & OutDia & "
"
Response.Write "" & inDia & "
"
Loop
Response.Write "Total length is " & Length
and youll get your result, just notice that this is not 100% accurate since it dossent calculate the center line off the material, thus using thick material will give an inaccurate result
Heyyy just came across this little proggi.
You can try and fool around with it, maybee you can get it to calc. it for you
bosjo said:
Don't know of any prog. that will calc. it for you
Use the code
Dim Length, OutDia, InDia, Thick, TempLength
Length = Your Input
OutDia = Your Input
InDia = Your Input
Thick = Your Input
Do Until OutDia =< InDia
TempLength = OutDia * 3.14
OutDia = OutDia - Thick - Thick
Length = Length + TempLength
TempLength = 0
Response.Write "" & Length & "
"
Response.Write "" & OutDia & "
"
Response.Write "" & inDia & "
"
Loop
Response.Write "Total length is " & Length
and youll get your result, just notice that this is not 100% accurate since it dossent calculate the center line off the material, thus using thick material will give an inaccurate result
Click to expand...
Click to collapse
WOW!
i would never figure it out... cool!!
...was never good at mathematics... ))
buzz
Related
hello,
I'm writing a Android App (java) - but I guess this question is pretty general, and isn't java-specific:
so I have an Array of Elements
and I let a random-number-generator pick one array-element randomly and hand it to me.
now I've also built in a "score"-field into each array Element
so what I want to do now, is that the random-number-generator takes the array's "score" in consideration, and gives me the array-elements with the higher/lower scores with a higher/lower probability
I dont want it to ALWAYS/NEVER give me the elements with the highest/lowest score - just with a higher/lower probability
I hope I could describe my problem in a proper way....
does anybody know how to achieve this?
(as I said, i use java, but i guess code in any language - or even pseudo-code would help me out)
*bump*
anybody?
Try this, it's in C# but it's pretty close to Java.
You cannot directly weight the random function so you have to use a different method.
By applying a weight to each item in the array, then using a random function to select using the weighting values, the results of the selection can be swayed.
The weighting values are relative to each other.
Using the values in the code, 'B' should turn up about three times more often than 'A'
The only object that may need some explanation is Random:
http://msdn.microsoft.com/en-us/library/system.random(v=VS.80).aspx
Code:
using System;
namespace RandomWeighting
{
class Program
{
static void Main(string[] args)
{
char[] Select = new char[10] {'A','B','C','D','E','F','G','H','I','J'};
int[] Weight = new int[10] {10,30,25,60,20,70,10,80,20,30};
int[] WeightSum = new int[10];
int i,j,k;
Random Rnd = new Random();
WeightSum[0]=Weight[0];
for (i = 1; i < 10; i++)
WeightSum[i] = WeightSum[i - 1] + Weight[i];
for (j = 0; j < 70; j++)
{
k = Rnd.Next(WeightSum[9]);
for (i = 0; k > WeightSum[i]; i++) ;
Console.Write(Select[i]);
}
Console.WriteLine();
}
}
}
Output:
Code:
HEFIBHHCCFBCAEFFDHACHBEJHHFDFIDFEDFFCHHDJBIDJEHHFHCJJJBHJGBDDGFDDFHHHB
Note the low density of A and G as opposed to H
It is just a sample at random, but 2 'A's and 7 'B's roughly matches the conjecture above, but over a million selections, the distribution is as follows:
Code:
A 30664
B 84187
C 70648
D 168481
E 56529
F 197311
G 28145
H 225764
I 56613
J 81658
If your code changes values in the Weight array then the WeightSum array must be recalculated.
wow, thats a lot!
The only thing I dont understand about the code is this line:
k = Rnd.Next(WeightSum[9]);
for (i = 0; k > WeightSum; i++) ;
what exactly happens here?
what kind of a for-loop is this?
why is there no body?
and strangely, while debugging this line, i noticed that the value of i jumps to some random number in this line - and I have no idea why and how
------
by the way: I've already tried it out, it works pretty good.
although I noticed that the first element always gets picked ALOT, no matter how low the weight.
I think thats a flaw in the algorithm
After the following code:
Code:
for (i = 1; i < 10; i++)
WeightSum[i] = WeightSum[i - 1] + Weight[i];
The WeightSum array contains the following values:
Code:
[0] 10
[1] 40
[2] 65
[3] 125
[4] 145
[5] 215
[6] 225
[7] 305
[8] 325
[9] 355
The Random.Next() function that takes a single integer as an argument is defined as:
-------- Courtesy of MS VS .NET Help ------
public virtual int Next(int maxValue)
Parameters maxValue Type: System.Int32
The exclusive upper bound of the random number to be generated. maxValue must be greater than or equal to zero.
Return Value Type: System.Int32
A 32-bit signed integer greater than or equal to zero, and less than maxValue; that is, the range of return values ordinarily includes zero but not maxValue. However, if maxValue equals zero, maxValue is returned.
-------------- End of Help ----------------
So, we are asking for a random value between 0 and 354,(element WeightSum[9] above). The following code then finds which is the lowest element of WeightSum which holds a value greater than the one we have been given. When this happens 'i' contains the index to use for the selection.
Code:
for (i = 0; k > WeightSum[i]; i++);
The standard construction of a for loop in C is
for(One or more initialisation statements; Do_While_True Condition; One or more iteration statements)
{
loop processing code;
}
If there is nothing to do in the loop body, you don't need it, and you can replace it with the ';' at the end of the for statement. In effect, it is identical to the following code:-
Code:
i=0;
while(k > WeightSum[i])
{
i++;
}
As regards the first element being picked more than the others, have a look at the distribution table in post #3. It is what you would expect for the values given. I assume the difference is either the Random function in Java or some different implementation between C# and Java.
You may have to change some of the code slightly, i.e. change the for() loop to the while() loop above and step though it in the Java debugger to get to the root of the problem.
You can't debug a for loop followed by an immediate ';' The entire for loop is executed to completion when you use debug and try and step through it. To debug it place a dummy statement in the for loop. A breakpoint may now be set on this line.
Code:
int i,z;
for (i = 0; k > WeightSum[i]; i++)
{
z=0;
}
ActionScript and Javascript versions ...
Thanks for the great write-up! In case anyone is interested, I've adapted this into a javascript and ActionScript class. If anyone is interested, I've attached the code. For a more in-depth post, check out blog.teamthinklabs.com.
Cheers!
Kipp Ashford
Art Director
Seven2 Interactive
Hello,
If anyone has the dslreports.com script for:
Saving a random setting on Pbxes.org when there's a trunk outage notification (free account) ,
I would highly appreciate it.
The above website is unavailable currently and am in need of the script so I can use my GV + Callback + Sipdroid. For reference, it was a simple (either JS or VB) script which saved a random setting whenever there was a trunk outage.
Or if there are any other suggestions for someone to route calls pretty much the same way for android 1.6 I would highly appreciate it as well.
Thank you
Also, a new question,
would anyone happen to know if at this date 4/23/12, Verizon charges or back charges people for using Google voice + callback for free calls as well?
thank you for any help
edited in question
..
I created this vbscript a few years ago for the same reason. Works well. I have it set up as a Rule in Outlook, so whenever I get a trunk outage email from PBXes, it runs this script automatically.
dslreports.com/forum/r24908015-PBXes-free-acount-trunk-outtage-quick-fix
I've pasted the script here just in case the dsl reports post gets removed:
Code:
'###########################################
'## PBXes Trunk Outtage Recovery
'## for Free Users
'##
'## Author: atomicrabbit ([email protected])
'## Date: 2010.10.08
'###########################################
'Edit the following variables appropriately
'------- START EDITING HERE ... DO NOT TOUCH ANYTHING BELOW -------
'Setting Page
' Set this to one of the settigs pages of PBXes
pbxes_settingPage = "https://www4.pbxes.com/config.php?display=extensions&extdisplay=100"
'Form Name
' Set this to the form name on the settings page specified above.
' It MUST be relative to the form on the page specified above
pbxes_formName = "addNew"
'PBXes Login Info
pbxes_username = "your_username" 'Your PBXes.com username
pbxes_password = "your_password" 'Your PBXes.com passowrd
'IE Window Visibility
' True - IE window will be visible while processing the code
' False - IE window will be hidden and run the code in the background
pbxes_windowVisible = False
'Browser Timeout
' Set max timeout for browser responsiveness (in seconds)
' Default: 7
pbxes_timeout = 7
'------- STOP EDITING HERE ... DO NOT TOUCH ANYTHING BELOW -------
pbxes_applySettings = pbxes_settingPage + "&clk_reload=true"
pbxes_timeout = pbxes_timeout * 5 'because the iterations are 200ms
pbxes_tCount = 1
'Create IE object
Set objIE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
'Go to PBXes.com Extensions page
objIE.Navigate pbxes_settingPage
objIE.Visible = pbxes_windowVisible
Wscript.Sleep 1000
'Check if not logged in
if not objIE.Document.Forms("login") is nothing then
' Login to PBXes if you're not already
objIE.Document.All.Item("username").Value = pbxes_username
objIE.Document.All.Item("password").Value = pbxes_password
objIE.Document.All.Item("remember").checked = "false"
objIE.Document.All.Item("btnSubmit").click
Wscript.Sleep 2000
'Go to settings page
objIE.Navigate pbxes_settingPage
'Wait for page to load
Do
Wscript.Sleep 200
pbxes_tCount = pbxes_tCount + 1
Loop While objIE.Document.Forms(pbxes_formName) is nothing AND pbxes_tCount < pbxes_timeout
end if
if pbxes_tCount >= pbxes_timeout AND objIE.Document.Forms(pbxes_formName) is nothing Then
MsgBox "Browser timeout. Try running thescript again.", vbOkOnly, "PBXes Trunk Outtage"
'exit script
Elseif not objIE.Document.Forms(pbxes_formName) is nothing Then
'Submit form
call objIE.Document.Forms(pbxes_formName).elements("Submit").click
Wscript.Sleep 2000
'Apply the changes (red bar at top)
objIE.Navigate pbxes_applySettings
Wscript.Sleep 2000
'Close IE
objIE.Quit
MsgBox "Recovered from trunk outtage!", vbOkOnly, "PBXes Trunk Outtage"
Else
MsgBox "Could not find '" & pbxes_formName & "' form on '" & pbxes_settingPage & "'.", vbOkOnly, "PBXes Trunk Outtage"
'exit script
End if
'Clear variables
Set objIE = Nothing
Set pbxes_settingPage = Nothing
Set pbxes_applySettings = Nothing
Set pbxes_username = Nothing
Set pbxes_password = Nothing
Set pbxes_windowVisible = Nothing
Set pbxes_timeout= Nothing
Set pbxes_tCount= Nothing
Wscript.quit
I actually found the script before this but still Thank You for the script as it's been helpful, although I don't know why I seem to receive "false outtage" e-mails in the sense that calls still seem to be routed with not much interruption if any, what's with that?
Thank you!!
Can anyone help why this PYTHON program will not work
import random
def is_same(target, number):
if target == number:
result= "Win"
elif target > number:
result = "Low"
else:
result="High"
return result
level = input("What level do you want to play? Easy (e), Medium (m) or Hard (h)")
computer_number = random.randint(1,level)
if level== "e":
level=10
elif level== "m":
level= 20
elif level== "h":
level= 30
while level != "e" and level != "m" and level != "h":
level= input("Sorry. You must type in one of the letters 'e','m' or 'h'\ne/m/h:")
print("Hello. \nI Have thought of a number between 1 and 100.")
guess = int(input("Can you guess it?\n"))
correct_guess = is_same(computer_number, guess)
while correct_guess != "Win":
if correct_guess == "Low":
guess = int(input("Sorry you are too low. Try Again.\n"))
else:
guess = int(input("Sorry you are too high. Try again.\n"))
correct_guess = is_same(computer_number, guess)
input("Correct!\nWelldone\n\nPress RETURN to exit")
Hi,
I've been looking for a tool or script to replace hex sequence in binary file in Windows. Indeed, i found this script :
Code:
Imports System.Runtime.CompilerServices
Imports System.IO
Public Class FinduReplaceHex
Private Shared ReadOnly FindHex As Byte() = {&H75, &HF6, &HF3}
Private Shared ReadOnly ReplaceHex As Byte() = {&HA2, &HE3, &H4B}
<MethodImpl(MethodImplOptions.NoInlining)> Private Shared Function DP(sequence As Byte(), position As Integer) As Boolean
If position + FindHex.Length > sequence.Length Then
Return False
End If
For i As Integer = 0 To FindHex.Length - 1
If FindHex(i) <> sequence(position + i) Then
Return False
End If
Next
Return True
End Function
Private Sub Patch_Click(sender As Object, e As EventArgs) Handles Patch.Click
Dim DT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim FD As Byte() = File.ReadAllBytes(DT & "\App.dll")
For F As Integer = 0 To FD.Length - 1
If Not DP(FD, F) Then
Continue For
End If
For R As Integer = 0 To FindHex.Length - 1
FD(F + R) = ReplaceHex®
Next
Next
If System.IO.File.Exists(DT & "\App.dll") Then
System.IO.File.Move(DT & "\App.dll", DT & "\App.dll.backup")
File.WriteAllBytes(DT & "\App Method 3.dll", FD)
Else
'Write Other Codes
End If
End Sub
End Class
The only problem is that I want to be able to use wildcards like this :
Search for F4 B3 ?? 12 and replace F4 BE 65 EA
Thanks in advance
This threads will contains extensions for the navigation system based on NNG iGO PRIMO NextGen
Extend the functionality of regular buttons VIApoi remove from the route.
Standard button appears, if you have to route waypoints (VIApoi).
So it stays ... but when you click on it (click) menu appears, listing all VIApoi and
you are free to either tapnut elsewhere and remove the first in the queue
either by the victim ... long tapom remove everything to her ... and her too
Conveniently this is the case when you route with intermediate points and you for some reason "spilled" from it.
Re-start will lead to the fact that the navigator will lead to the first point ... but you have somewhere Intermedia ... here come in handy.
Plant ... in all weather conditions))
debugger
Debugger - debugging tool due to lack of log. You can view the result in ONLINE. You can "ON THE FLY" ... take snapshots directly from the cab.
Debugger You can use one or all of three ways at once.
*#
Call in the right place at the right time ... and save the data
If the variable Global - transferred to the "name", or simply herself. The number of input parameters is not limited.
Example
var1 = "hello"
local var2 = 8
t = {2,5, { "Bonnie Parker", "Clyde Barrow"}}
VW_Debugger ( "-------------------------------",
"Hex (var1)", - var1 must be GLOBAL
var1, var2, "t", "-------------------------------")
The result in the ... / lm_DebugToList.txt:
Variable # 1 = -------------------------------
Variable # 2 = 68 | 65 | 6C | 6C | 6F |
Variable # 2 = h | e | l | l | o |
Variable # 3 = hello
Variable # 4 = 8
t = {
[1] = 2,
[2] = 5,
Table # 3 = {
[1] = Bonnie Parker,
[2] = Clyde Barrow,
}
.
}
Variable # 6 = -------------------------------
*#
Enter code snippet ONLINE
Enter the line of code as you write in the body of the program.
Example
return hex (Help)
The results are on the screen and a file.
*#
Complex. But requires some setup allows to get a snapshot at any time
For this purpose has already been declared a global table VW_Debugger_Table and the following structure is used:
Example:
hook_DebugSnapshot: register (function ()
****UX_Name = "<name of your utilities>" --osoboe attention. Utility field
****VW_Debugger_Table.v_integer = v_integer - your variable
****VW_Debugger_Table.v_char = v_char --Your variable
****VW_Debugger_Table.v_table = v_table --Your variable
end)
It is desirable to place at the end of your utility body.
In other words - you need to put in your section (lua chunk) here such fragments, which will ensure the filling of the table
you desired variables. The process you manage yourself using SnapShot keys
I note that the third method does not require cleaning after the source code debugging. This tool can be left in the body of the program.
It can be activated at any time by pressing the button or VW_Debugger_Get_Snapshot () of the body of the program and does not interfere with the functionality of standard code.
All results are displayed on the screen and are available in /save/profile/01/userlist/lm_DebugToList.txt ... unless of course you do not erase.
CommonRouteWarnings.zip
Utility - informer. The name speaks for itself: CommonRouteWarnings.zip
All sounds and warning match again utverdennomu standard: SetAudioSignal.
Long press - access to the configurator.
Informer as a button in the cockpit. Informs about 12 developments on the route of choice.
They will be "PROKRUCHIVATYA" at one location in the cabin, but with different icons of different information and ... according to the chosen event he or events.
Upper information - the distance to the event, the bottom - time in the scene.
Now click on the icon will get a third of the current screen with an overview of the place, the relevant event, well, or automatically.
On the TMC. Upper infa - distance sobyliya, lower - latency, which makes this event (not to be confused with the overall delay)
Full set here
Hi there. working igo 8 would be interested. samsung s8 phone. I would like a link. Thanks