Computing desk | ||
---|---|---|
< September 27 | << Aug | September | Oct >> | September 29 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Hi. I use dropbox on my two macs: one home, one work. I work at home and create files. When I get to work the next day, the files are not in the dropbox folder. They are in the dropbox website, so I know I have created them, but the files are not in the dropbox folder. Can anyone advise? Robinh (talk) 00:47, 28 September 2011 (UTC)
Hello everyone,
A while back I saw a really cool command. it used dd and /dev/random to print random strings to the terminal. I remember that the rate of output would slow down, but if I typed on the keyboard, it would speed up. When I do < dd if=/dev/random > any keys I type end up also being displayed on my terminal, and I'd like to avoid that... How would I accomplish this (and if you know how to format the stream to look like strings that'd be nice too. Thanks so much! 70.186.193.113 (talk) 06:14, 28 September 2011 (UTC)
/dev/random is a blocking device meaning it doesn't continue to give output when its entropy count runs low. /dev/urandom will use the same pseudo random number generator and yet not block. While in theory this is less secure, unless you're using it to generate key data, it's a very good source of randomness.
You'll probably want to convert the output to legitimate ascii, so things like dd if=/dev/urandom | base64 are probably the easiest. You can also use cat, so cat /dev/urandom | base64 works too. Alternatively you could use hexdump, or if you want it pure hex then cat /dev/random | xxd -ps should work too.
In either case the output is actually going to a separate stdout than your keystrokes are being displayed on. So if you wanted to pipe the output then your keystrokes won't be recorded. Read more about bash piping for more on that. Shadowjams (talk) 07:43, 29 September 2011 (UTC)
For quiet a long time I have been observing that in my hard disk partitions (Wnidows XP 2)the occupied space is being shown more than the actual space occupied by the files in it. I am selecting all the files in it and clicking on the properties to know the space occupied and it is showing 1gb or 2gb or 3 gb space less than what is being shown when i click on the partition and then on the properties...........
Is this normal or some malware problem? — Preceding unsigned comment added by 119.235.51.130 (talk) 08:54, 28 September 2011 (UTC)
Why are the letters O and S often not distinguished from the digits 0 and 5, respectively, on sixteen-segment displays? --84.62.204.7 (talk) 09:36, 28 September 2011 (UTC)
Following on from the successful resolution of the problem above, I have started working on an idea I had for my own program (mostly just stripping that earlier program down and rebuilding it), which I thought would be annoyingly long but yet quite simple and repetitive, it asks for a succession of numbers, and when one is entered as 0 it calculates the average those remaining would need to be to reach a particular total. However, having expanded it to now ask for four successive numbers, if I enter just one, it divides the remainder by two rather than three, giving the incorrect value.
#include<stdio.h> #include<conio.h> main() { int a,b,c,d; float avg; printf("1st:"); scanf("%d",&a); printf("2nd:"); scanf("%d",&b); if (b==0) { c=0, d=0; avg=(100-a)/3; } else { printf("3rd:"); scanf("%d",&c); } if (c==0) { d=0; avg=(100-(a+b))/2; } else { avg=(100-(a+b+c)) ; } printf("%f",avg); getch(); }
I am sure I am doing something obvious wrong, but still cannot see what, the sum is quite specific at (100-a)/3, so why does it give the answer to (100-a)/2?
148.197.81.179 (talk) 13:07, 28 September 2011 (UTC)
That works, so each option has to go inside the previous one rather than after it, that makes sense now. And all I have to do now is write it out over and over to incorporate 30 different input numbers. Unless I do something else silly like that wrong. 148.197.81.179 (talk) 13:30, 28 September 2011 (UTC)
for
loop for that, not copy and paste the same code 30 times. It's not only less bug prone, but also much easier. Incidentally, a decent compiler should have warned you about the bug in this program (using an uninitialized variable). -- BenRG (talk) 16:57, 28 September 2011 (UTC)
123 / 456 == 0
in C. Dividing integers truncates the result to an integer, even if you assign the result to a float
. You need to write something like avg = (100 - (a + b)) / 2.0;
or avg = (float) (100 - (a + b)) / 2;
. -- BenRG (talk) 17:28, 28 September 2011 (UTC)OK, now I prove that I have no idea what I am really doing. Is there any way I can change this program so it saves the input data somewhere, such that it can bring up the numbers entered so far again rather than them all having to be typed in one by one every time the program is run? And I don't suppose there is any way of having it run outside the IDE, same as all the proper programs on my computer? 148.197.80.214 (talk) 19:43, 30 September 2011 (UTC)
A while ago I asked a question on this, now archived so this is just a report, possibly of interest. Before, I was given a program to do the job, inelegantly GOTOed. I've now figured out a much neater, likewise non-recursive, version:
do '***** THIS IS THE INNERMOST LOOP ' MAIN CALCULATION IN HERE '***** CURRENT VALUES OF ALL s() ARE AVAILABLE i=1 while (i<=loops and s(i)=max(i)) s(i)=min(i) i=i+1 wend if i<=loops then s(i)=s(i)+1 loop while i<=loops
The variable "loops" is the number of loops, the value of each loop variable is in the array "s", with the lowest and highest values in the arrays "min" and "max". Initially, all values are set to their minimum.←86.155.185.195 (talk) 19:27, 28 September 2011 (UTC)
I have several fonts on my computer that I downloaded from other sources. Occasionally, when I am using one of them, the font suddenly becomes Arial for no apparent reason. The font bar of Word 2010 claims that it is still the font that I desired, and when I apply any formatting to the font (even growing or shrinking the size by half a point) it changes back to what it was before. Why is this? Interchangeable|talk to me 23:32, 28 September 2011 (UTC)