Computing desk | ||
---|---|---|
< October 26 | << Sep | October | Nov >> | October 28 > |
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. |
I used pymol to make a series of PNG files. The PNG files need to be put together to make a movie, using an external program. What free tools are available to do this? --Seans Potato Business 00:07, 27 October 2008 (UTC)
mencoder "mf://*.JPG" -vf scale=640:480 -o mjpeg2.avi -of lavf -ovc lavc -lavcopts vcodec=mjpeg -lavfopts format=avi -mf fps=15
Polvi (talk) 05:51, 27 October 2008 (UTC)
Approximately how long does it take a search engine to update its search results? For example, if I mark my userpage with __NOINDEX__, approximately how long does it take for this to take effect? -- penubag (talk) 01:50, 27 October 2008 (UTC)
2 4 5 1 7 6 3 8 THE QUESTION IS TO FIND THE NO. OF CYCLES IN IT. FOR EG: THE FIRST NO. IS 2 SO THE 2ND NO. IS VISITED AND AGAIN THE 4TH NO. IS VISITED WHICH IS 1.AGAIN THE 1ST NO. IS VISITED. SO THE 1ST CYCLE IS ::::2 4 5 1 ONE CONDITION:: ONCE A PLACE IS ALREADY VISITED IT CANNOT BE VISITED AGAIN LIKE 4 AND I CANNOT BE VISITED AGAIN
PROBLEM:: I HAVE DONE THE PROGRAM BUT THE OUTPUT IS NOT CORRECT
#include<iostream.h> #include<conio.h> void main() { int a[20],temp[10]; a[0]='\0',temp[0]='\0'; int cycle=0,pos=0,t=0,i=1,j=0,k=0,n,m; cout<<"Enter no. of array elements::::"; cin>>n; cout<<"Enter the array elements"<<endl; for(i=1;i<=n;i++) { cin>>a[i]; } while(i<=n) { if(a[i]==i) cout<<a[i]; cycle++; a[i]=pos; if(a[pos]>pos) { temp[t++]=a[pos]; pos=a[pos]; } else { temp[t++]=a[pos]; k=a[pos]; cout<<"cycle"<<endl; for(j=k;j<pos;j++) { cout<<a[j]<<" "; } cycle++; } a[pos]='\0'; pos=0; k=0; i++; for(m=0;m<t;m++) { if(a[i]==temp[m]) i++; } } temp[0]='\0'; cout<<"No. of cycles"<<cycle; }
Well...
#include<iostream.h> #include<conio.h> void main() { int a[20],temp[10];
It's a bad idea to use 'magic constants' like 20 and 10 - you need to give them names and declare them as 'const int'.
a[0]='\0',temp[0]='\0';
Why '\0' and not just 0 ? The notation '\0' means "a character whose ASCII code is zero" - why are you using a character to initialise an integer?
int cycle=0,pos=0,t=0,i=1,j=0,k=0,n,m; cout<<"Enter no. of array elements::::"; cin>>n;
What happens if the user doesn't type in a valid number? You need to test for illegal entries and re-ask.
cout<<"Enter the array elements"<<endl; for(i=1;i<=n;i++) { cin>>a[i]; }
while(i<=n) {
When the loop (above) finishes, 'i' will always be equal to 'n+1' - so this 'while' loop will never execute. I have no clue what you're trying to do here (because the question you started with is written so confusingly)...but whatever your goal, this will never achieve it. Probably you really need another for loop just like the one you used to read in the data.
if(a[i]==i) cout<<a[i]; cycle++; a[i]=pos; if(a[pos]>pos) { temp[t++]=a[pos]; pos=a[pos]; } else { temp[t++]=a[pos]; k=a[pos];
Because 'temp[t++]=a[pos]' happens whether or not 'a[pos]>pos' - you should move this statement up above the 'if' statement to save code.
Around about here - I pretty much gave up trying to help you. This code is almost impossible to follow because you have not given your variables meaningful names and there are no comments telling us what's going on. Because your statement of the problem is hard to understand, I can't tell whether what you need to do is what you are actually doing...so I can't tell whether this is right or wrong. However, the profusion of little adjustments of indices and the use of arrays that start at different indices speaks of poor grasp of the algorithm you're trying to implement. I think you should start off by writing down what the program is going to do in English before you write a single line of C code. Break it down into steps and use that English as comments when you actually start writing the code. Make your variable names meaningful - and don't re-use them for multiple jobs.
Also - this is clearly a homework problem - and we're not allowed to do your homework for you. SteveBaker (talk) 12:17, 27 October 2008 (UTC)
int read_integer_from_user() {
/* you could use sprintf for this */
}
int main(argc, argv) {
int values[max_size_of_array]; // a list of values we want to work with
int visited_how_many_times[max_size_of_array]; // how many times we've been to each index
for (each value in visited_how_many_times) { set value = 0 }
size_of_input = read_integer_from_user()
if (size_of_input < 1 || size_of_input >= max_size_of_array) { error }
for (i = 0; i < size_of_input; i++) {
values[i] = read_integer_from_user()
}
current_element_index = 0 // start at first element in the list
while (1) { // this is an infinite loop - leave it using "break"
if (current_element_index < 0 || current_element_index >= size_of_input) { error }
if (visited_how_many_times[current_element_index] > 0) {
// we've been here before, lets get out of the loop
break
} else {
visited_how_many_times[current_element_index] += 1
}
print "index=", current_element, "value=", values[current_element]
// the element value is the next index, starting at 1 (our arrays start at zero, so minus 1)
current_element = values[current_element] - 1
}
print "the end" // done!
}
#define max_size_of_array 20
--h2g2bob (talk) 15:55, 27 October 2008 (UTC)...
for (array_starting_index = 0; array_starting_index <max_size_of_array; array_starting_index++) {
current_element_index = array_starting_index // start at first element in the list
// after detecting presence of a cycle, iterate through all members of that cycle
...
// Record and sort those members in some convenient way
...
}
// We now have several lists of cycles and we must check which ones are unique
// If they are sorted, establishing uniqueness should be easy, so remove duplicate cycle records
// Count number of unique cycles
...
Now this code can check whether every index in the array is a member of a cycle; it also checks for disjoint cycles. I think that is what the program is expected to return or print at the end. Nimur (talk) 17:18, 3 November 2008 (UTC)
I am looking to have a website for people to sign in and out of study hours. It would have to log their IP address as well as the time in order to match it up to a place on campus. The user would be able to enter in the time to log out, but that time can be no later than the current time. Also, the user would be able to sign in at any time, to check their total time logged. A safety would probably need to be built in so that if they sign in from another location while they are "checked in" an alert pops up both to the user, as well as in the log.
The basic idea is to have a log sheet on the internet that matches times with locations that can be retrieved by the administrator. Is this possible? And, if so, would it be cheap? --omnipotence407 (talk) 15:53, 27 October 2008 (UTC)
It would be based on the honor system, but with a need to verify location. There isn't an online study application, it is merely a combined log sheet for multiple locations that can checked at whatever time the administrator sees fit. The time thing is so they can put down a time earlier than the present in case they need to sign out if they forgot to when they left, however, they cannot sign out in advance.--omnipotence407 (talk) 19:19, 27 October 2008 (UTC)
$_SERVER['REMOTE_ADDR'];
, see [1]. Nimur (talk) 17:25, 3 November 2008 (UTC)Sometimes when I'm using the computer, Norton Antivirus (ver 12.8.0.4) starts a disk scan.
I would like to be able to pause or stop the scan and have it restart later when the computer is not being used.
I realize this is something the software maker should answer but in my experience they make it difficult to ask a question, much less get an answer. That is why I'm asking here.
Thanks, CBHA (talk) 16:01, 27 October 2008 (UTC)
I'd like to ask a few questions (couldn't find the right software to start with... by searching and googling)
1) is there any specific software that helps with video editing - cutting, merging...etc?
2) is there any software that can convert video to audio (e.g. to extract what is being said in a film and save it as an .mp3 file)?
I'd prefer free software, but any suggestions are welcome.--123.203.44.97 (talk) 17:00, 27 October 2008 (UTC)
I made an email address of <user>@msn.com using the MSN explorer. Now i want to use this email address on Outlook or Thunderbird. I cannot find settings. Can anyone help? I've not paid for any MSN service. —Preceding unsigned comment added by Muhammad Hamza (talk • contribs) 17:57, 27 October 2008 (UTC)
I have a SWF that only contains video. Is there a way I can convert it into something my iPod or PS3 can handle? --70.167.58.6 (talk) 21:27, 27 October 2008 (UTC)
I have the feeling I'll be needing expert specialized knowledge soon... Does anyone have recommendations for a forum on Macs? I have an old Mac system (OS X 10.2) on an old Mac G4 (AGP graphics), so am looking for a board with lots of users with experience with different types of software and hardware. Also a high-traffic site so I would be more likely to get my question answered. Not that I won't ask the fine people here (see my next question), but I've been looking to join a good Mac forum anyway. TresÁrboles (talk) 22:29, 27 October 2008 (UTC)
Under windows 2000, I disabled and stopped services that I thought was extraneous but my computer is weird now, skype doesn't work, etc. so I want to start them again, but it's not possible...any hints? Thanks.
I think my disk drive may be failing. The background is: icons starting disappearing on one of my partitions. After some fiddling around with opening and closing the window, and trying to list them out in Terminal with ls, and trying to find them using the Search files, some of them reappeared, but I know a lot of files are still missing. The weird thing is the ls command in Terminal won't even show the files that have reappeared, at least not if you only do an "ls" or "ls -al" (I also tried with sudo so permissions are not the problem). Using wildcards also won't work, e.g. "ls myfile*". But you can find them if you specifically name the full filename, e.g. "ls myfile.txt". Crazy! Anyway, that has been the situation for some days while I just left the Mac on (which I normally do), afraid to restart it -- I half thought a restart would fix things, and half thought it would entrench the screwiness. Well, unfortunately things were taken out of my hands, when we had a power outage at the house. When I powered back up, the disk icon for that disk partition was missing. Using the Disk Tool showed it was not mounted. (All the four other partitions of the actual 120GB hard disk were mounted.) I went to the Disk First Aid tab and ran repair (which I have never done before but it looked like an appropriate thing to do). It gave some message about corrupted nodes I think and then redoing a tree, and then said it was repaired. I then tried to mount the partition, but it didn't work. I think I then tried to run a Verify and then another Repair, and then I restarted the Mac.
Eep. After a long time, it finally got to the gray Apple logo startup screen where it continued to spin its wheels, and then it stopped and gave up. Now there is text in the upper left hand corner: "sh-2.05a#"
HELP!
(I just googled this, and it looks like it's the prompt for the UNIX monitor. I have a bit of UNIX admin experience, but still don't know how best to proceed.)
The operating system is OS X 10.2 and the Mac is a G4 (AGP). Yes, it's very old in computer years (8+ in human years)!
Please help if you can! Or recommend a good place to ask (see my previous question)! Thanks in advance! TresÁrboles (talk) 22:57, 27 October 2008 (UTC)