Jump to content

Wikipedia:Reference desk/Archives/Computing/2009 June 15

From Wikipedia, the free encyclopedia
Computing desk
< June 14 << May | June | Jul >> June 16 >
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.


June 15

[edit]

Track program in Linux?

[edit]

What is the easiest way to track what a program does in Linux? I want to analyze a program and see what it does to my system: modified files, etc... I wanted something like File Monitor (windows app) or a program that would track the linux app itself and check out what it does. (I don't mind command line tools and I don't mind compiling, but I wanted something as easy as possible...) SF007 (talk)

strace is the basic tool here, that'll tell you all the interactions between the process and the kernel. ltrace gives a higher-level view, but its information is less complete. 67.163.6.213 (talk) 06:39, 15 June 2009 (UTC)[reply]
You could also run the program in GDB, particularly if you can recompile it with the debugging symbols turned on. -- JSBillings 17:36, 15 June 2009 (UTC)[reply]

Time complexity of modified TSP

[edit]

What is the time complexity of an exact solution to the traveling salesman problem if it is modified so that each city must be visited at least once rather than exactly once? NeonMerlin 00:48, 15 June 2009 (UTC)[reply]

It's still NP-complete. Consider TSPs where the distances satisfy the triangle inequality. Given any solution that visits each city more than once, you can get a solution that visits each city exactly once, and which does at least as good. You do this by skipping visits of a city after the first time (since you are not required to visit it again). By the triangle inequality, the distance cannot increase by skipping a city. Therefore you can do no better than the regular optimal TSP solution that visits each city exactly once. So the optimal solution to your problem is the same as the optimal solution to the regular TSP, when the triangle inequality applies. The TSP under the triangle inequality is still NP-complete. --Spoon! (talk) 06:02, 15 June 2009 (UTC)[reply]
P.S. You ask for the time complexity. But the exact time complexity for the TSP is not known. (And in any case, for an abstract problem like this it doesn't make much sense to talk about complexities so much as complexity classes, because it will vary depending on what model of computation you are using.) Maybe you are asking about whether it is in P or NP-complete? --Spoon! (talk) 06:04, 15 June 2009 (UTC)[reply]

C command to read next line

[edit]

Is there a C command moves a file stream to the next new line? In other words, is there a command that does something like "while(fgetc(file) != '\n');"? — DanielLC 02:15, 15 June 2009 (UTC)[reply]

Yep 'fgets' or 'gets'. 'gets' is strongly deprecated though because there is no way to prevent someone causing a 'buffer overrun' and that's the cause of some serious security leaks. SteveBaker (talk) 04:59, 15 June 2009 (UTC)[reply]
fgets reads a string. I know it stops on a new line, so I could have it read into a string I don't use, but I don't want to make a string just for that, and there's no guarantee it will finish the line in one pass through the string (it has some very long lines). — DanielLC 05:09, 15 June 2009 (UTC)[reply]
As far as I can tell, there isn't anything like that in the standard library. If such a function did exist it would still have to go through the stream itself looking for a newline anyways. -- Consumed Crustacean (talk) 05:34, 15 June 2009 (UTC)[reply]

What is a 1:1 Frame Rate?

[edit]

Hi. I've seen this option in the rendering options for Sorenson Squeeze (along with 1:2, 1:3, etc,), but I'm not sure what it is. I'd like to match the frame rate of the original movie, but Premiere says it's 28.01 fps?? Thanks for any help.--WinRAR anodeeven (talk) 02:31, 15 June 2009 (UTC)[reply]

Something like 1:1 or 1:2 is called a ratio. If you are attempting to match 1:1 a movie with 28.01 fps, you would end up with 28.01 fps. By varying the ratio, the raw size of the movie can be reduced by half (1:2), by third (1:3), etc. At least, this is based on my understanding of your question. Hope this helps. ZabMilenkoHow am I driving? 10:37, 16 June 2009 (UTC)[reply]

docx file

[edit]

is there a way to open docx file if i dont have MS Word 2007?Shraktu (talk) 04:43, 15 June 2009 (UTC)[reply]

Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats if you have Office 2003 or 2000. Also, OpenOffice.org can open it. --76.173.203.58 (talk) 05:02, 15 June 2009 (UTC)[reply]
Even if you had Word 2007 it may not give you good results. If the file was created in an older version of MS Publisher, Word 2007 can open it, but things may be missing or the formatting may be wrong. MicroSuck did not make it so that newer versions of Publisher could open the old files. --69.254.66.245 (talk) 08:09, 15 June 2009 (UTC)[reply]
Personally, I've never gotten the Compatibility Pack mentioned above to work -- and I couldn't tell you why, it just doesn't seem to do anything (although I think that's a newer version of it than the one I tried to use, so who knows?). If you're in the same boat, there are a number of converters out there that can convert a docx file into an RTF file. I don't remember which one I tend to use myself (and I'm at work right now so I can't check what I have installed on my home computer), but a bit of googling can probably help you out there. -- Captain Disdain (talk) 08:36, 15 June 2009 (UTC)[reply]
Agree with Captain I have never got the compatibility pack to work either. BigDuncTalk 08:43, 15 June 2009 (UTC)[reply]
The other night, when trying to view a docx file with Office 2003, I installed the Word Viewer from the Microsoft site in the apparently vain hope that it would work. When I tried to open the docx file it realized that it was created with a newer version and pointed me to download the compatibility pack linked above. The file then opened in the viewer and, as I discovered, in Word 2003 itself. Angus Lepper(T, C) 18:14, 16 June 2009 (UTC)[reply]
I use OpenOffice. Initially, I had to use the converter, but it is built in now. Just click on the docx file and it will open. Formatting can be messed up sometimes - especially if your computer doesn't have the font used in the file. However, it works good enough for me. -- kainaw 12:23, 15 June 2009 (UTC)[reply]
(1) Google docs does docx, see [1], I've used it successfully (once).
(2) See some tips here. --NorwegianBlue talk 18:25, 16 June 2009 (UTC)[reply]
Resolved

Universal remotes

[edit]

While not strictly a computing question, I figured this would be the best place for this... I've never bought a universal remote, so I have no idea if I need to look for anything special to make sure that it will work with all my stuff (home theater, DVD player, TV). So, do I? I mostly want to replace the remote for the home theater system since my Great Pyr destroyed the original when he was a puppy and since then, I've grown tired of getting up to adjust the volume. Dismas|(talk) 10:53, 15 June 2009 (UTC)[reply]

I recently bought a cheap (£10) universal remote to replace broken DVD player remote. I found that as a bonus it could also be programmed to control TV, set-top digital converter and ancient VCR as well - all different makes - so excellent value for money ! I noticed that some more expensive universal remotes were specifially marketed as "home theatre"/"home cinema" remotes - maybe they have additional functions. Gandalf61 (talk) 11:10, 15 June 2009 (UTC)[reply]
When I got my last remote, I bought one and found that it didn't have the ability to control my DVR. So, I returned it and got another one. It couldn't control my TV. So, I returned it and got another. It was able to control everything. They were all well under $20, so it isn't a matter of considering investment. If the remote I'm now using breaks, I'll just get another one. It just took a few tries to get one that controlled everything without having to go through and program each and every button one at a time. -- kainaw 12:21, 15 June 2009 (UTC)[reply]
Make sure you get a Universal Remote and not a Learning Remote. Learning Remotes aren't very common anymore, but they need to be "trained" off the original remote, so that won't help you if the original is gone. APL (talk) 16:57, 15 June 2009 (UTC)[reply]
If your home theater is nice, most Universal Remotes will not give you every feature. That may not be that big of a deal for you, but things like changing the type of surround sound, or changing the input source. The one's mostly likely to give you the most features would probably be one of those programmed the PC like those by Logitech. Although, I can't afford one, I just want it. --Wonderley (talk) 04:02, 16 June 2009 (UTC)[reply]
Thanks, all! Dismas|(talk) 04:10, 16 June 2009 (UTC)[reply]
Some of the fancier universal remotes even include a display and perhaps a touch screen - some of these allow you to create your own touch-screen layout with custom text or even graphics labels. SteveBaker (talk) 04:33, 16 June 2009 (UTC)[reply]
At some point, you should just connect a controlling PC/web-server/digital video machine to the home theater. I use Media Player Classic, which has its own scriptable HTTP server built in. Then, stream all commands to it via web; and you can use any modern digital hand-held with wireless internet capabilities to access the system. This will allow you to write custom programs, cron jobs, and defrag your home theater system - from anywhere in the world!. It is very important to have a large screen if you intend to use it from great distances. Volume control is soooo last millenium. Nimur (talk) 15:10, 16 June 2009 (UTC)[reply]

Alternative to Movie Maker

[edit]

Is there an alternative to Windows Movie Maker (or Windows Live Movie Maker, or whatever you want to call it) that will work with .movs and .mp4s? I know I can convert them, but if there is a way to skip that step, it would be nice. Contributions/174.114.4.18 (talk) 12:12, 15 June 2009 (UTC)[reply]

iMovie?? --69.148.26.115 (talk) 02:36, 16 June 2009 (UTC)[reply]
Yup, there are a bunch of them out there. See Category:Video_editing_software for ones in which we have articles of. -- penubag  (talk) 08:01, 16 June 2009 (UTC)[reply]

JavaScript mouse cursor

[edit]

JavaScript code to change the mouse cursor on a certain page? —Preceding unsigned comment added by 218.186.10.243 (talk) 14:02, 15 June 2009 (UTC)[reply]

You can use the following code to change the mouse cursor for a page. The list of cursors can be found here. Keep in mind you may have to hook it so the page is loaded before it runs, or you may get a null error in some browsers.
document.body.style.cursor = 'crosshair';

Ale_Jrbtalk 17:09, 15 June 2009 (UTC)[reply]

iPhone, Podcasts and WiFi

[edit]

Is there an app or some method by which I can get my iPhone to automatically download all the podcasts I subscribe to via WiFi? Usually I have to sync on my pc or download updates one by one (which requires some backwards store navigation). Ideally, I'd like it to check for updates overnight while it's plugged in and download them automatically. TheFutureAwaits (talk) 14:27, 15 June 2009 (UTC)[reply]

I am not aware of such a piece of software - I don't suppose hooking the iPhone up to your PC running iTunes (which can be set to automatically download new podcasts at specific intervals, eg once an hour) is an option? — QuantumEleven 12:42, 16 June 2009 (UTC)[reply]

plot .dat files

[edit]

I have to work for my study with a code that saves the results in files with .dat extensions. Now must make a graph with these results but I can't find any programm which kann make a graph with such files.i would be gratefull if someones who knows told me how to do this —Preceding unsigned comment added by Zzzmith (talkcontribs) 14:38, 15 June 2009 (UTC)[reply]

(duplicate question removed. Please only post questions once.) Are you sure that it is important to this exercise to use the ".dat" filename extension? Probably the professor will not care if you use another file extension. If you are saving the data as a bunch of values separated by commas, the .csv extension is the best choice; it can be read by Microsoft Excel and OpenOffice and probably every other spreadsheet program used today (which I assume is what you'd use to graph the data). If the professor is hardcore about making sure you end the filename extension of your data file with ".dat", that's fine, just do so, then rename the file to end in .csv and load it up with a spreadsheet program. Tempshill (talk) 15:27, 15 June 2009 (UTC)[reply]
The .dat extension can refer to just about any kind of file, I suggest opening up the file with a text editor and see if it's in any kind of regular format. If so, OpenOffice, Microsoft Excel or even gnuplot will probably be able to use it. -- JSBillings 17:32, 15 June 2009 (UTC)[reply]
After reading JSBillings's response: I may have misunderstood; I had thought this was a programming assignment where you'd be writing code that was supposed to output a .dat file. If not, ignore me and do what JSBillings said. Tempshill (talk) 19:46, 15 June 2009 (UTC)[reply]

that was exactly the problem.after running the code theresults were given in such format.anyway i found finally a solution to seperate the columns and remove them to excell.my onnly problem now is to find and download a good grapher.thank you both for helping. —Preceding unsigned comment added by Zzzmith (talkcontribs) 20:07, 15 June 2009 (UTC)[reply]

Excel has very good graphing facilities built in, with a huge range of graph types, and every component editable for appearance. There is no need to get something separate. - KoolerStill (talk) 04:50, 16 June 2009 (UTC)[reply]

Scale pages in Scribus

[edit]

I am using Scribus to design my school magazine. I have finished the layout.

The librarian told me to make it A5 size, but has now revealed that she meant A4. Is there any way to scale all the pages (either in the software or when exporting to PDF) without moving and resizing everything?

I want to get this issue finished by the end of the month (or, even better, the week), so please help!

Thank you, Dendodge T\C 14:55, 15 June 2009 (UTC)[reply]

Wouldn't you just change the document size in file->document_setup ? Contributions/87.113.161.82 (talk) 18:16, 15 June 2009 (UTC)[reply]
No—that only resizes the page, not the content. Dendodge T\C 19:45, 15 June 2009 (UTC)[reply]
If you change the size of the page, then ctrl-a (select all), then rescale the group using the corner handles to fit the page, that should scale the entire set of stuff on the page, right? You can hold ctrl while rescaling if you want to keep the aspect ratio. I'm not sure if there's another good way to do what you want... when changing the page size also changes the aspect ratio of the page, there's not an easy way for the software to automatically know how to rescale the contents. You might just have to do it manually. Indeterminate (talk) 01:45, 16 June 2009 (UTC)[reply]
It should have that option when you export to PDF, though I guess that depends on the PDF driver. If the built-in PDF driver doesn't have this, you can download a "PDF printer" and see if is has that option. If not, you could consider just setting the page size when you print the school magazine, just set the page size to A4 and choose the appropriate option in the print dialog ("scale to fit" or something like that). I would also consider asking the librarian if she has a solution, after all, she told you to use A5 in the first place... Jørgen (talk) 00:29, 16 June 2009 (UTC)[reply]

installing problems

[edit]

when i want to install some particular programmes,nothing will happen .when i double click usb derive a message appear," Error loading .\RECYCLER\S-5-3-42- ----------------\ the specified module can not be found " It is not a problem of my usb ,but may be of some virus. which type of virus it may be . I have avast antivirus and update it daily,but it can not remove this problem . —Preceding unsigned comment added by 119.154.14.195 (talk) 18:28, 15 June 2009 (UTC)[reply]

When you double-click your USB drive, Windows attempts to run an "autorun" program, if there is one on the USB drive's root. I think this is probably what's happening. What happens if you instead right-click the USB drive and choose "Explore"? The \RECYCLER\ pathname means, I believe, that the autorun program is trying to access a file that used to be in your "Recycle Bin" and is no longer present. Tempshill (talk) 20:00, 15 June 2009 (UTC)[reply]
Always right-click and Explore. Letting USB drives auto-run is how USB viruses get spread around, latching on to the auto-run facility. Microsoft is removing this feature, for this reason. - KoolerStill (talk) 04:53, 16 June 2009 (UTC)[reply]
Enable "Show hidden files/folders" and disable "Hide system files". What do you see in the autorun.inf file on your USB drive? --wj32 t/c 11:48, 16 June 2009 (UTC)[reply]