|
I would like to add, to the other comments psted here, that you can also do integer rounding. For example:
(1456+500)/1000=1
(1677+500)/1000=2
As you can see 1456 gets rounded to 1 and 1677 gets rounded to 2. It is just like rounding floating point numbers 1.456 and 1.677. In fact, all values from 500 to 1499 will be rounded to 1, and all values from 1500 to 2499 will be rounded to 2.
Rogério Rilhas
|
|
|
|
|
Hi i'm a maths b student and i need some help with a question on a maths assignment, The question is:
The question asks me to find an equation fo each of the 5 parabolas of a bridge given that:
1. the width of the bridge is 40m
2. The maximum height of the road section at the top is 2m
3. The height of the tallest supporting parabola is 13m
4. The height of the smaller supporting parabolas is 8m.
I know the equation I need to use and it is
y = ax^2 + bx^2 + c
Then the equation goes to
y = a(x-p)^2 + q
Can you please help me out because I don't know how i should start it.
PLEASE HELP, ASAP
Any help would be much appreciated.
|
|
|
|
|
Try expressing height of a given parabola H as a function of its width at the base W (H(W))
|
|
|
|
|
I am hoping somebody can tell me the best method (and possibly links on more info for that method) to use for calculating a line that runs smoothly through a few data points. The points are positions on a fan blade and I am looking at trying to roughly calculate a line that would be the profile of the blade if it was cut along the points. I thought that knowing the the location of the peaks and valleys, and possibly a few extra data points, would allow me to interpolate the other points I need to make a complete profile. I would then do this in several areas to get the surface of the blade by interpolating in the two directions through the points.
My original idea was to use splines, but I am not sure this is the right way to go. More so because I am not sure how you go about calculating the equations to go through the points and how to separate the line into the different regions for the different equations. Since it is a surface, NURBS may be another option. But, if I am having difficulty with splines, what are my chances of figuring out NURBS?
Thanks for any help.
Brad
|
|
|
|
|
I'm not sure if it will be easier or harder than doing a cubic spline, but you may want to also look into Bezier curves to see if they can help you.
--
Marcus Kwok
|
|
|
|
|
I'm not sure if it would be easier or harder either.
I am still looking up information and have come across Bezier splines (which I found out use Bernstein polynomials, whatever those are? but are verified using de Casteljau's algorithm), Bezier curves, B-splines, and cubic splines. I am assuming they are all a different way to do the same thing.
I've been out of school for a little while and this is making my head hurt. I am finding a lot of theory and examples of plotting splines, but not many examples of getting the equations from the points.
Thanks.
Brad
|
|
|
|
|
Take a look at the source code to Graph[^]. This has C++ code for calculating curves through points using Logs, Polynomials etc.
It worked very well for me, I did do a conversion to C# a while ago.
BTW, you didn't say if you wanted source code or just advice since you can do this in Excel given enough time and patience. The Graph source code as most (or all, I can't remember) of the methods which Excel uses when curve fitting.
Sig cops got me...
|
|
|
|
|
BRShroyer wrote: I am hoping somebody can tell me the best method (and possibly links on more info for that method) to use for calculating a line that runs smoothly through a few data points.
if you have evenly spaced measurements you can use Catmull-Rom splines[^].
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Art of Problem Solving[^]
"A real programmer wishes there was a command-line version for every application and then proceeds to write a GUI to wrap around it." - Bassam Abdul-Baki
|
|
|
|
|
Hi guys
I would like to copy a process's module. This is how the scenario looks:
Lets say that there is a process called "Main.exe" and it loads plenty of modules and 2 of the modules that it loads are:
1. "Copyer"
2. "Checker"
Now i want to somehow modify something in the module called "Copyer" but if i do that then Checker(which scans this module once in a while) will find out that i have changed something and then exit. So what i have come up with is that i have to somehow copy the Copyer module and then inject it in Main.exe then make this Checker to somehow scan that copyed/injected module instead of the original Copyer module.
Could someone please help me to figure out a way to copy a module and make this Checker scan the copied one instead of the original one?
Thanks
|
|
|
|
|
What I used was a string buffer array. Because an original C buffer is continuous memory blocks, it makes it easy to partition it off. Or you can use a structure which does the same thing.
struct {<br />
char findstring[64];<br />
char licensename[64];<br />
time_t licensedate;<br />
time_t licenselen;<br />
unsigned long crc32a;<br />
unsigned long licensedfeatures;<br />
char licensekey[64];<br />
} lincenseinfo;
this does not take into account someone adjusting the clock unless you write the last date of operation somewhere. That is where it takes some long thinking and hard writing to secure only in software. Eventually you realize it is impossible to secure only in software and deal.
But the process is easy. from an external EXE you can scan the binary EXE of your code looking for the findstring value (any string you want to use, even random characters you pregenerated, but you have to know what to search for). By searching for and finding that start of buffer, you know where the rest of the values are. Set in your license times, CRC validations (optional) and the name of your licensee and their key. The key is based on the same information, name, product, date, length of license and any other related information. You then generated a validated buffer and write it into the file replacing the entire buffer within the already compiled EXE.
Inside your code you verify the information in the buffer matches. If it does not, you exit, or disable features, or turn on demo mode, etc. If the buffer all cross-verifies, then you proceed as a licensed product.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Or, use the FileSystemWatcher Class [^] in the Checker to receive notification that the module has changed.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
anyone expert in association rule mining?
and coding the algorithm to be use in classification and prediction in data mining application.
anybody know about where can i find the souce code?
Fear is not the FACTOR
|
|
|
|
|
i want to do a modulus of 12 digits..
for example:
123456789012%34
i'm unable to convert it because there are always balance althought it shouldnt be.
i find that integer can only use max10 digit.
my assignment is
from a set of 12 characters.
convert to ASCII decimal value representation of the characters. (example: A=65, 1=49)
then each decimal value have to substract 32 (numerical value, example: A=65-32=33, 1=49-32=17)
after converting has to do this formula:
8pow11.numericalvalue1 + 8pow10.numericalvalue2 + 8pow9.numericalvalue3 +....+ 8.numericalvalue11 + numericalvalue12
in shot: value = pow(8,index-1)*((int)tmpChar[i]-32);
after the multiplication and addition, modulus the total value over 59, means (%59);
display the value.
i hope anyone can help me solve this problem as i'm a begineer in visual c++.
thank you very much in advance.
|
|
|
|
|
nonadoes wrote: 123456789012%34
maxint:
long long 9223372036854775807 7fffffffffffffff
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
nonadoes wrote: ...there are always balance althought it shouldnt be.
Check again. 123456789012 is not evenly divisible by 34, so there will be a "balance."
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Consider a string of decimal digits of arbitrary length. These digits are some arbitrarily large number. To find num%m ...
Temp = high order digit % m
Then for each succeeding digit compute...
Temp = (Temp*10+next digit) % m
But you seem to have a more basic problem that has nothing to do with C++ or any specific language. You are letting ASCII representation get in the way of the simple algorithm to perform modulus operations on large numbers. It could be that this exercise was more to teach you about ASCII representation than modulus arithmetic. All you need to do is to subtract 0x30 (48 decimal) from each byte as you take each digit into the large number modulus algorithm I gave above.
This looks like it might be homework. If you still a problem with this after 2.5 months then find something else to study.
|
|
|
|
|
Hi guys
I have been working on a project for several months now and it is almost finished all i need is some kind of security so that only the people that buy my software will be able to run it although when they first run it, it will display a key(which is their hardware drive serials, encrypted though) and then they will need to send that code to me so that i decrypt the data and send them a key that will work(any kind of key, for ex. when they send their key to me then i will use another proggy that i make and use that proggy to maybe add something to their serial like a few digits or a code at the end of their serial then send it back to them) what i need to know though is how to encrypt their hardware drive serial then make an algorith that can recognize the modified serial(that i will send to them once they send their serial to me) and make the program start up. I also need some kind of limit maker so that someone can only use it for a limited amount of time(1 year lets say) then after the time has expired it will display a message box saying they have to renew their serial.
Soething of this kind would be really good.
So could someone please direct me to such a tut or maybe reply with some useful info?
Thanks in advance
Cyclone
|
|
|
|
|
Check about HASP technology using Google search engine
|
|
|
|
|
thanks but thats not exactly what i was looking for, i want to know how i can build one myself
|
|
|
|
|
Cyclone02 wrote: I have been working on a project for several months now and it is almost finished all i need is some kind of security so that only the people that buy my software will be able to run it although when they first run it, it will display a key
This is, over-all, a very difficult process. I have been through this several times from each end. Licensing software is a battle to make it difficult to bypass the "license" without being difficult on the end user. One method is to make an RSA key based on some hardware information, and the user's name and "brand" the software so that it works on that hardware for a specific time. The problem is, what happens when the user moves the software to another machine? Even an honest customer can have a hard-drive failure, motherboard failure, etc. that requires him to move all his work to another machine. Now he must return to you for more licensing.
Hardware keys (as mentioned above with the HASP) are handy in that you simply move the "dongle" over to the new machine and run with it. The customer is "usually" pretty happy. There are problems with the dongles, you can't install the dongle first, you have to install the software, then the dongle, etc. This is sometimes irritating.
I have written some self-encrypting licensing systems in my earlier years, not a story for the faint of heart. They were good, but they backfired. Eventually someone will crack a software-only licensing system. No matter how good, this is guarenteed. Look at the massive amounts of illegal software sometime using google (just don't go to the sites or download, use the google-cache-view).
What happens with your software, or in my case the encryption system, is left up to the fates. I paid my dues, I worked with anti-virus writers to fight my own encryption once it was stolen, disassembled and taken up by an Australia band of virus writers.... My software license key encryption, what I called a "living encryption" due to the fact that it was "always changing," became what we know today as a polymorphic virus.
I do not do software licensing now. Hardware keys are a bit safer, not perfect, but safer.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Thanks for the informative reply Jeffry. Well after i read ur reply i concuded that i will probably stick to the username and branding part as that s the one that sounds the easiest. Could you please point me to a good tut that explains encryption in general as i will start and put things together from there.
Thanks
|
|
|
|
|
Cyclone02 wrote: Could you please point me to a good tut that explains encryption in general as i will start and put things together from there.
Some good starting points:
Practical Cryptography[^]
Applied Cryptography[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Hey guys, please help?
I'm trying to count each character's occurance in a text. This is what I have but if I am working with 20,000 chars it takes forever. How can I make it faster? (Especially the nested for loop)
Thanks a lot!
<code>private void frequencyItem_Click(object sender, System.EventArgs e)
{
Form3 form3 = new Form3(); //creating new form that tells the user to please wait...
form3.Show(); //displays the form3
cipherTxt.Text = "";
float numTimes = 0; //declaring and initializing numTimes which stores the number of times a char is presented
//declaring and initializing my 72 char alphabet
String myAlphabet = new String(new char[] {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','\u0027','\u002E','\u002C','\u003A','\u003B','\u003F','\u0021','\u0023','\u0028','\u0029'});
//nested for loop comparing every char in the alphabet to every char in the plaintext textbox
for(int i=0;i<myAlphabet.Length;i++)
{
for(int j=0;j<plainTxt.Text.Length;j++)
{
if(plainTxt.Text[j] == myAlphabet[i]) //if a plaintext char matches an alphabet char
{
numTimes++; //increase count for numTimes
}
}
if(numTimes>0) //if number of times a char's ocurrence is presented
{
//print in ciphertext textbox the result of percentages
cipherTxt.Text += "Letter " + myAlphabet[i] + " is displayed "
+ numTimes + " times. It is " + (numTimes/plainTxt.Text.Length)*100 + "% of the whole text." + System.Environment.NewLine;
}
numTimes = 0; //return the current alphabet's char count to 0
}
string frequencyLetters = cipherTxt.Text; //pass results to a string
cipherTxt.Text = ""; //clear ciphertext textbox
form3.Close(); //closes the waiting form...
try //tries following block of code if user selects Cancel on save box
{
saveFileDialog.ShowDialog(); //show the save dialog
String saveFileName = saveFileDialog.FileName; //store output filename as string
TextWriter textOut = new StreamWriter(saveFileName); //new streamwriter to filename
textOut.WriteLine(frequencyLetters); //writing results to file
textOut.Close(); //closing streamwriter
}
catch(Exception arg) //catches exception
{
return; //exits void function
}
}</code>
Santinni
|
|
|
|
|
Why don't you try converting your char values to indexes ? ie:
int[] frequence = new int[ushort.MaxValue];
for (int i = 0; i < s.Length; i++)
{
frequence[(ushort)s[i]]++;
}
regards
|
|
|
|
|