|
the main important thing how to prove the correctness of ur function
researche in mobile databases
|
|
|
|
|
just supply some valid values to it and see.
|
|
|
|
|
I also recomend testing invalid values and testing for proper failures as well.
Quite often we just test for success and don't test for failure. Failing in a predictable manner of often times more important than being correct. Correct is always predictable. Failing often times is not.
|
|
|
|
|
this validation logic is implemented before the algorithm in my application.
|
|
|
|
|
chandu004 wrote: just supply some valid values to it and see.
Don't let Prof. Knuth know your secret.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The Gregorian calender doesn't have any leapyear exception rules for above 400. IF they did, IIRC the next toggle points would have been 2000 and 10,000. Instead we're adding single leap seconds as needed at new years to keep everything in sync.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: IIRC the next toggle points would have been 2000 and 10,000
I doubt that; Wikipedia[^] gives some arguments for a leapyear correction every 4000
or 8000 years.
dan neely wrote: Instead we're adding single leap seconds as needed at new years to keep everything in sync
That can not be correct: with a one second correction every year
you would need 60 * 60 * 24 = 86400 years to shift time by one day, not quite sufficient.
[added] Again Wikipedia[^] explains
the purpose of leap seconds.[/added]
-- modified at 18:06 Thursday 1st November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hai friends,
Here is my logic to find the day code.
if any body can please suggest a better logic, or if any body can validate the logic and find any bugs there, i would apprieciate it.
int offset[12]={0,31,59,90,120,151,181,212,243,273,304,334},l=0;<br />
if((((curyear%4==0) && (curyear%100!=0)) || (curyear%400==0)) && (curmonth>1))<br />
l=1;<br />
daycode=offset[curmonth]+curdate+l;
opinions please.
|
|
|
|
|
Why not just use DateTime.DayOfYear?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
of course,
but the user will supply date month and year separately.
if i had to use CTime class, then, i had to copy these values to that CTime right?
but i think even that can be possible.
thanks for your suggestion.
|
|
|
|
|
int d=new DateTime(2007, 10, 26).DayOfYear;
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thats simply wonderful,
thank you.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Here are the x and y values:
y = 25, x = 0
y = 100, x = 50
y = 400, x = 100
What I want is a direct formula that gives continuous values
x = f(y)
that satisfies the condition.
I tried everything including logarithms but could not get a formula yet.
Here is what I am trying to achieve:
If you look at the slider control in Microsoft Office 2007 the slider ranges from 25% to 400% with 100% being in the middle. You can smoothly zoom the UI by moving the slider.
|
|
|
|
|
There are an infinite number of answers to your question, here is one:
x=50(y-25)(y-400)/(-75*300)+100(y-25)(y-100)/(375*300)
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Yes, I realize that so I added more information to my original post. It has been a while soince I did maths so I have forgot all the terminology and I am not able to express my problem properly.
|
|
|
|
|
From reading your modified posting, it appears that what you want to preserve is equal ratios for equal distance from the centre (the limits are 1/4 x and 4x relative to the centre), so probably 1/2 x and 2x (i.e. 50 and 200) should also be equal distances from the centre. In this case exponentials are your friend and you should use Luc's solution.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Hi,
one exponential relation that satisfies your numbers is:
y = 25 * 2 ^ (x/25)
so the inverse formula would be:
x=25*log(y/25)/log(2)
BTW: it does not matter what the base of the log function is (2, e, 10, whatever).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Awesome, that does the job. Thank you!
|
|
|
|
|
Hi,
for this solultion you could check the very good book numerical recipies in c. You can use the fitting algorithm decribed inside.
http://www.nr.com/
Also you can check Math.Net (for .Net)
|
|
|
|
|
If it is only given a small input (one byte) for encryption, and to have to encrypt the input and send it to the receiver through the wireless network then the brute force attack can find my input easily without my encryption. That time what should i do is better for me? Is these any method to decide this problem? I need to keep security for my input and send it to receiver in wireless network. Please help and leave me mail? byambaak@yahoo.com Thank you.
-- modified at 16:03 Wednesday 24th October, 2007
|
|
|
|
|
Bimbaa wrote: If it is only given a small input (one byte) for encryption
Then you should pack it into a full block output, regardless. Most algorithms will output based on block size, not bytes. So a one byte file might still come back as a 16 byte output simply because of the block size.
If you have a single byte and try to output as a single byte, you are already in trouble. If your keys are small such that brute force is fast, you still have a problem. You want long keys and a method of creating a block size output and still restore to original size after decryption.
If it is easy with one byte, chances are your algorithm is also too easy.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Yes output is also too small. I did it and in trouble now. It is coming soon my project time but i did my encryption algorithm input one byte and output two bytes. I saw and read the block algorithm as DES triple DES and AES 128, 192 and 256 bits. I would not like my algorithm to follow the standards as their algorithms do. If i would use block size to the input then my algorithm would be similar with these algorithms. because after choosing block input, it would be request to do rounds, shift and substitute the bytes in the block.If their operations wouldn't in the algorithm means not so good encryption. I have used standard substitution table and a few more characters from standards to my encryption and decryption ready. I know this substitution table supports bytes in block not for one byte. But is it possible to use for only one or two byte? and Is that wrong and it brings me again trouble? I read about that byte substitution table is not easy to created and designed therefore i though about can't create new table one myself and use the standard substitution table to my algorithm that is better for me. If i have a chance to decide without using standard table and creating new one then what chance do i have? I really want to create new crypto for small input number. maybe i have something wrong idea, please tell me correct yours one. I'm happy with a professional is talking with me. Thank you.
|
|
|
|
|
Bimbaa wrote: but i did my encryption algorithm input one byte and output two bytes.
regardless of algorithm, that is too limited on output. I understand the reasoning, it was the same as mine back in the day when I wrote my "living encryption." The idea is good, and you can do a lot, but you can never hope for something that does not leak bits because the output sample is just too small.
I would recommend using a standard if you want to be secure, use someone else's work, not your own. If security doesn't matter and you want to fool around on this, then by all means go for it.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I can expand my input as 16 bytes or more than 16 and encrypt it to output as one block or more than one but after expanding byte, last output of the encryption without substitution, column mix, shift row and Inverse operations is not satisfied for me. Their operations are included in the algorithm that means the algorithm seems to be having similar thing with other standards and maybe it has a lot critiques on the using standards in the encryption from other people. I'm a research student that is why the my project should be in new creation or explorer and it would not be applied for standard. I hope it has a way to decide it, and i can do something new one for encryption and decryption. If you have idea, please share me.
Question1: I hope you have read about substitution table in the AES. If i use it to my encryption algorithm then does it rise any weakness with the encryption after using it.
Question2: what is new protocol is it lately for key exchange protocol? I have the algorithm used Diffie Hellman's key exchanging protocol, which is most known.
Thank you.
|
|
|
|
|
sorry, I won't help with encryption scenarios directly.
Sounds like you know general concepts. But if, as you said, you can break it easily, it is already broken. You should not be able to break your own code by any means other than brute force, and brute force should be measured in as long a time as possible for the significance of the data. After that you can start analyzing the output directly for signs of a good/bad algorithm. After that you always want someone else to look over the idea if it needs to be secure, you are too close to the issue.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|