Wikipedia:Reference desk/Archives/Computing/2009 August 30

Computing desk
< August 29 << Jul | August | Sep >> August 31 >
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.


August 30

edit

TI 89 random numbers

edit

What is the method used to generate random numbers on the TI-89 Titanium? --72.197.202.36 (talk) 00:38, 30 August 2009 (UTC)[reply]

See http://www.google.co.uk/search?hl=en&q=ti+89+random+number&meta=&aq=f&oq=
83.100.250.79 (talk) 11:30, 30 August 2009 (UTC)[reply]
sorry, my apology, I thought the request was a simple one83.100.250.79 (talk) 18:38, 30 August 2009 (UTC)[reply]
I think the OP wants to know which pseudorandom number generator algorithm is used. Nimur (talk) 15:03, 30 August 2009 (UTC)[reply]
This is a tough one. All I can find is information about PRNGs in other products using TI DSP chips (not the calculators). These guys say they use a IEEE P1363 Standard PRNG Function (which is very strong and suitable for cryptography), but that can be implemented in software or hardware (so I don't know if the same would be running on the TI-89). This introductory-level article, Generating random numbers, describes the basics for generating randoms on a small device (like a calculator). Nimur (talk) 15:09, 30 August 2009 (UTC)[reply]
If this http://www.ibiblio.org/technicalc/tiplist/en/files/pdf/tips/tip6_37.pdf is correct then I am the luckieest googler on the planet - there's a further paper to read
L'ecuyer, P. Efficient and Portable Combined Random Number Generators. Communications of the ACM, Vol. 31, Number 6 (June 1988), pp. 742-749, 774.
? 83.100.250.79 (talk) 18:42, 30 August 2009 (UTC)[reply]
Efficient and portable combined random number generators, available from the ACM website (linked for your convenience). The recommendation is that since the TI89 is a 16 bit computer, it should use one of the mixed/combined PRNGs as described in section 2 of that paper. Nimur (talk) 01:06, 31 August 2009 (UTC)[reply]
http://tibasicdev.wikidot.com/rand seems to confirm it, and gives a little more.83.100.250.79 (talk) 18:44, 30 August 2009 (UTC)[reply]

Thanks! --72.197.202.36 (talk) 20:35, 30 August 2009 (UTC)[reply]

Encoding non-standard resolution movie to MPEG-2

edit

I'm trying to encode a 1280x1024 animation to MPEG-2 and running into trouble. Almost all encoders have presets for TV/HD resolutions. So they crop or scale my movie to fit within one of those presets. I've tried using VLC, but it's limited to 3Mbit/sec... which is pretty low for this resolution (and looks pretty terrible).

So can I tell VLC to encode at higher bitrates or is there a free/low-cost MPEG-2 encoder for Mac OS X that will let me encode to this non-standard resolution? --70.167.58.6 (talk) 04:38, 30 August 2009 (UTC)[reply]

ffmpeg?. --91.145.89.58 (talk) 10:44, 30 August 2009 (UTC)[reply]
Handbrake would also work. Riffraffselbow (talk) 02:54, 1 September 2009 (UTC)[reply]
I believe you should be, if the GUI doesn't allow to do it, just specify command line options. I've never used VLC om a Mac but you may find part of the command line options are shown when you set it up with the GUI so you can copy that and add what you need. In fact on Windows you can usually just modify the command line options within the GUI. Having said that, I don't appear to have a 3mbit/s limit on Windows so I'm not sure how different the Mac version is Nil Einne (talk) 14:45, 4 September 2009 (UTC)[reply]

How to compress thousands of files individually

edit

I have thousands of files and want to compress each of them to zip format individually. For example, 123.txt → 123.zip, ABC.txt → ABC.zip, etc. The same filename is requested. Are there any softwares or methods which can help me finish this work efficiently? Supporting UNICODE is better. Thank you in advance. --百楽兎 (talk) 05:40, 30 August 2009 (UTC)[reply]

I'd use a command line zip program and write a batch file. Take a directory listing into a file and then use an emacs keyboard macro to massage that into commands. Hmm... how do non-emacs people do stuff like that? If you know some programming language you could write a small program that generates the batch file from the directory listing. E.g. on Windows using 7-Zip:
7z a fee.zip fee.txt
7z a fie.zip fie.txt
7z a foe.zip foe.txt
etc. 62.78.198.48 (talk) 08:40, 30 August 2009 (UTC)[reply]
If you have find installed on your system, you can compress every file in your-dir and subdirs that doesn't already end with .zip with
find your-dir -name '*.zip' -o -type f -exec zip '{}.zip' '{}' \;
but I think that might break if you have weird file names. Emacs is the real and final solution, of course. --91.145.89.58 (talk) 10:31, 30 August 2009 (UTC)[reply]
Thank you. I will make a batch file. --百楽兎 (talk) 22:20, 30 August 2009 (UTC)[reply]
I assume you're using Windows since you asked about Unicode support. In that case you can do what you want from cmd.exe with this command line:
for /r %i in (*) do 7z a "%~dpni.zip" "%i"
cmd.exe and 7z.exe are both Unicode applications. Windows builds of zip (Info-ZIP) and find usually don't support Unicode. If you want a full set of Unicode command-line tools then use UTF-8 Cygwin or use the Cygwin 1.7 beta and set a UTF-8 locale as described in the documentation (for example, I have LC_CTYPE=en_US.UTF-8). Then the solution with zip and find will work. -- BenRG (talk) 11:13, 31 August 2009 (UTC)[reply]
Handy trick when using command-line for-loops: insert echo after the do, until the resulting commands look like what you want; then back up one line and take the echo out for the "production run".
--DaHorsesMouth (talk) 22:53, 31 August 2009 (UTC)[reply]

TCMP

edit
  Resolved
 – Nonrequest. — neuro(talk) 17:57, 30 August 2009 (UTC)[reply]

I'd like to implement TCMP. Where can I get the specification, and what hardware will I need? NeonMerlin 06:29, 30 August 2009 (UTC)[reply]

I'm usually all for humour, but please don't do stuff like this at RD. This isn't the place. — neuro(talk) 17:57, 30 August 2009 (UTC)[reply]

Security of website

edit

Say the permissions of a directory on a website are set to 777, in order to facilitate uploads from a php-based application. There are no direct links to the directory from any pages of the website. If the maintainer of the website gives the directory a long name, generated randomly, is it there any way that an intruder can find the directory, except by brute force generation of names? --NorwegianBlue talk 06:44, 30 August 2009 (UTC)[reply]

http://xkcd.com/538/ F (talk) 12:03, 30 August 2009 (UTC)[reply]
LOL! Excluding physical access to the server, physical abuse of the maintainer of the website, and cracking of passwords to the server. --NorwegianBlue talk 12:32, 30 August 2009 (UTC)[reply]
If the attacker is intercepting messages (e.g. packet sniffing), and those HTTP requests are sent in plain text, (which they usually are, unless you are using HTTPS), the attacker will know that directory exists without brute-force attack. However, this assumes the attacker has such a surveillance capability - usually meaning he must be sharing a non-switched network with you. Nimur (talk) 16:10, 30 August 2009 (UTC)[reply]
Thanks! --NorwegianBlue talk 17:33, 30 August 2009 (UTC)[reply]
You can list directories if you're allowing ftp so it doesn't sound particularly hidden to me. If it can only be accessed by html then don't put the directory into a directory without an index.html file as your server may automatically construct a list of the contents to send back, so sticking the directory at the top level is probably best. Dmcq (talk) 17:39, 30 August 2009 (UTC)[reply]
I can access the server both through ssh and ftp, but password protected, of course. No anonymous ftp. And there is an index.html file in the parent directory. The php-based applications live in other subdirectories. Should that be ok, as long as the passwords are strong (except for the packet sniffing attack that Nimur referred to)? --NorwegianBlue talk 18:04, 30 August 2009 (UTC)[reply]

Napoleon: Total War

edit
  Resolved
 – The reference desk does not answer requests for predictions. — neuro(talk) 17:57, 30 August 2009 (UTC)[reply]

Will it be possible to play as Sweden in Napoleon: Total War? --81.227.67.5 (talk) 14:22, 30 August 2009 (UTC)[reply]

The reference desk does not speculate, please read the header. — neuro(talk) 17:55, 30 August 2009 (UTC)[reply]
Asking if the maker of the game has announced whether a feature will be supported is an entirely appropriate question. Also, the "resolved" tag is intended to be used to show that the original poster is fully satisfied with the answer, not that someone else thinks the question is unworthy for the Ref Desk. There are other tags for that purpose. StuRat (talk) 15:31, 1 September 2009 (UTC)[reply]

Sound on MSN

edit

Is it possible to turn the annoying 'duh-duh-duh' sound off MSN, yet still be able to watch movies and listen to music with normal sound? It drives me crazy. It sometimes happens when I am away from the computer doing something else and I get a quick burst of these incredibly loud noises from people who like to send messages with only one word and smileys and all sorts of crap, sometimes ten in the space of 30 seconds. Can I turn it off? --KageTora - (영호 (影虎)) (talk) 17:49, 30 August 2009 (UTC)[reply]

I no longer run MSN (I run Digsby), but you can turn it off in the settings. Look for a section called 'sounds' or 'alerts' or something, I remember it being there. — neuro(talk) 17:53, 30 August 2009 (UTC)[reply]
THANKS! You have saved me from a life of annoying sounds! --KageTora - (영호 (影虎)) (talk) 18:06, 30 August 2009 (UTC)[reply]
No problem at all. :) — neuro(talk) 18:08, 30 August 2009 (UTC)[reply]

Advanced Delphi (Debugging)

edit

I have written a rather complicated algorithm in Delphi. (In fact, it is so complicated that I cannot even describe it without stepping through the code.) It works perfectly in almost all cases, but it fails for some input parameters, resulting in an "access violation", "out of memory", or "invalid pointer operation" exception (different every time). The "out of memory" exception is not due to lack of RAM (not even close to it). However, in most cases the algorithm really does work with the problematic input parameters, when I input them a second time (that is, after the algorithm has already failed once). Is there a bell ringing in anyone reading this? Probably not.

What I would need is an android like Lt. Cmdr. Data, who can scan the entire code in a few seconds, and then tell what's wrong, and even fix it for me. If that is not possible, I wonder if there are any advanced books about Delphi development? I am a rather advanced Delphi developer, and most books I have looked in contains nothing that I already doesn't know. It would be great with a really advanced book that discusses all technical details regarding e.g. the use of pointers. --Andreas Rejbrand (talk) 19:00, 30 August 2009 (UTC)[reply]

What you describe sounds like a classic, large-scale, memory corruption problem. I'd guess either you're writing with an invalid pointer, writing vastly off the end of an allocated region, or copying memory or variables that haven't been initialised (and probably either using them as pointers or array indices). My experience of debugging such stuff is mostly in C (and, a long time ago, in Pascal), but I think I that practical pascal/delphi implementations have compile time options to enable and disable things like array-bounds-checking, which you might have disabled for performance reasons. I'd certainly enable these. I'd also make sure the code was 100% free of warnings, and run whatever additional static analysis tools are available on it (for C, things like lint - there seem to be several lint-like programs for Delphi). Static analysis certainly won't catch all errors, but it's silly to embark on debugging with a program you don't really know has even compiled properly. Next I'd want to run a memory bounds checker, like Rational Purify or Valgrind - the later is free, but is only for *nix systems; you might find your Delphi code will compile with Free Pascal which would allow you to use Valgrind. Beyond that, debugging memory corruption is a tedious process, that mostly involves drilling down when exactly the corruption occurs, and then drilling down to the responsible period. You're already off to a good start in that you can predictably induce the circumstance of failure. -- Finlay McWalterTalk 21:04, 30 August 2009 (UTC)[reply]
Thank you for your comments. Yes, it probably is something like that. Unfortunately, all known problematic input parameters are quite complex, and although I have stepped through the entire algorithm using these parameters (and using a lot of watches etc.), I have not found the problem (before the exception, the watches even contradict eachother, which also confirms the hypothesis of severe memory corruption). I will try to see if there are any debugging tools that I can use. Otherwise, it would seem that I have a lot of hard work in front of me... --Andreas Rejbrand (talk) 07:18, 31 August 2009 (UTC)[reply]
I'm also a Delphi developer amongst other things, and sometimes I also wish there were a Lt. Data around to fix annoying problems (I'm a Trekkie too)! Invalid pointer/access violation problems can be very difficult to debug. Recently I had those errors with the onclose event of modal forms and could NOT find the error; even the debugger would jump to a random line and throw out access violation. Eventually I gave up and rewrote that form with manual handling of onclose eg. what happens if each button is pressed. With pointers it can be a lot more difficult. Normally what I would do is match each pointer operation with its destroy method (or whatever it is, I can't remember as I've used pointers a long time ago). If you are using recursion make sure you have a well-defined exit method for all scenarios as recursion can cause memory leaks. If all else fails, sometimes it's best just to write that subroutine from scratch, without looking at the original source. It's amazing in how many ways you can write complicated code. Sandman30s (talk) 12:14, 1 September 2009 (UTC)[reply]
I'm not a Delphi programmer, but if nothing else works and you end up going to a tedious manual debugging method, this is how I would do it:
1) Make a copy of the source code so you can leave the original alone as you do debugging on the copy.
2) Locate the first line where the problem ever manifests itself. If your errors and debugger won't help in this regard, add print statements until you find the last line before the error. Run many times to be sure you find the last line that always prints correctly before the error.
3) Now you know that the memory problem occurs before this line in the code. Start commenting out earlier code (and the declaration of the variables needed in that code), and hard-coding the values, instead. So, if you pass in some variable to the program, which then does some complex calculation and passes on some values to the code that gets the error, just hard-code those values instead of calculating them. If this fixes the problem, you know it was somewhere in those variable declarations or calculations, so now start uncommenting parts until the problem recurs. You should eventually be able to find the line at fault in this manner.
4) Examine that bad line in fine detail. Are the parameters to all calls and functions of the proper type ? Is every variable used in that line properly initialized ?
5) One complication is if there are multiple mistakes. Then, after fixing one, you need to repeat the entire process to find the next.
6) After you've fixed all problems in the debugging copy of the code (and carefully marked each fix), then you can move those fixes to the original code. StuRat (talk) 14:57, 1 September 2009 (UTC)[reply]

Use the debugging tools stepping through procedures where the errors appear to originate.

One fairly obvious thing is to check that no array exceeds its scope. For example, if you have var Big[1..1000] of String and then refer to Big[J] where J has reached 1015 then the strings assigned to J[1001] onwards overwrite other variables causing endless damage to the contents of memory. Sussexonian (talk) 23:05, 1 September 2009 (UTC)[reply]

Thank you for all input. Unfortunately, however, I have already tried most of the tips. I will soon begin to scrutinize the algorithm (from the very first line) on paper, and try to identify all possible problems. Also, everytime I see a procedure that can be done in another, completely equivalent way, I will change to that way. Then, perhaps the problem will be removed even though I never identify it. --Andreas Rejbrand (talk) 11:58, 2 September 2009 (UTC)[reply]
  Resolved

(Well, as resolved it can get, I suppose. I simply have to go through the algorithm in more detail. --Andreas Rejbrand (talk) 11:58, 2 September 2009 (UTC))[reply]

Adding bluetooth services to phone

edit

I have a SE g502. I wish to direct my pc's audio to the phone via bluetooth. But my phone does not have an audio gateway service. Is it possible via flashing or seem editing or something like that to add that functionality ?

Question about research

edit

I wanted to ask a question about some research I want to do. I want to search approximately 20 different terms in google and find out where the Wikipedia page for each term ranks compared to other online resources. Specifically, I would be looking at terms for dermatologic conditions. So, for example, with the following search [1] on my results screen Wikipedia is the first entry, followed by medscape. Can I use google trends/"Google Insights for Search" to accomplish this? Or is there some other way I can compare google results? ---kilbad (talk) 21:07, 30 August 2009 (UTC)[reply]

If I were doing this project, I'd just type in the URLs manually into an Excel spreadsheet, since it's only 20 terms you are searching for. One thing to keep in mind is that there are many Wikipedia mirrors on the Web, some of which are up-front about this and others which are not, and these sites will also show up in your search results, so you will need to consider how to treat the situation where a mirror outranks the real Wikipedia page. Wikipedia:Mirrors and forks/Abc is the start of a really large list of these mirrors. Tempshill (talk) 02:36, 31 August 2009 (UTC)[reply]

C++ Builder Help

edit

Hi,

Whenever I click somewhere in the code editor in RAD Studio's C++ Builder, it automatically indents the cursor to that point. I don't like that. How can I disable this automatic indentation?

Thanks,

S1kjreng (talk) 23:15, 30 August 2009 (UTC)[reply]

You can disable the "cursor after end of line" feature in the code editor's preferences. However, I do not have the RAD studio installed on my laptop (which I currently use), so I cannot give you the exact location of the option, but it is probably not too hard to find in the settings dialog. Personally, I like this feature, and if I want to go to the end of the line, I simply press "End" on the keyboard after having set the cursor on the line. --Andreas Rejbrand (talk) 07:09, 31 August 2009 (UTC)[reply]
I found a picture of the Options dialog at EDN: [2]. (Stupid image file format...) The option you seek should be in "Editor Options". --Andreas Rejbrand (talk) 07:30, 31 August 2009 (UTC)[reply]
Thank you for your efforts. I unchecked every box in Editor Options and it still persists. I wonder if it's a bug? I tried messing with the insert mode, preserve line ends, auto-complete text to find, code folding, and overwrite blocks boxes, among others, to no avail. It's still better than Visual Studio, but such stray insertion points do not mix well with manic-obsessive people such as myself. I have an obsession with cleaning up white space.--S1kjreng (talk) 08:21, 31 August 2009 (UTC)[reply]

open office - data sources into calc

edit

I'm following instructions, and trying to get a field from a database into a cell in a spreadsheet...

I open the spreadsheet, open 'data sources' and select a database, then I select a field in a table in the database, and drag the field over to the spreadsheet (using left click and drag)... Everything works - the field goes accross and I can cycle through the table entrys as expected.

But the entry in the database doesn't look right, it looks more like an 'object' eg such as an inserted graphic image or something - ie it has resize, and drag buttons. More importantly it doesn't seem to actually be attatched to any cell.

How can I get the <field entry> attatched to a cell? and is this a bug or a feature?83.100.250.79 (talk) 23:57, 30 August 2009 (UTC)[reply]

I don't fully understand what you're doing, but for me there is no dragging involved. Sounds like that is where the issue is occuring, certainly sounds like something that could cause that sort of thing. — neuro(talk) 07:57, 31 August 2009 (UTC)[reply]
I click on the field and drag it to the spreadsheet. What do you do? (It's the same method as used when placing a field into a text document (writer) - eg as used for a mail merge.)83.100.250.79 (talk) 11:15, 31 August 2009 (UTC)[reply]
I might have misread the instructions - it doesn't actually say the data will go in a cell - but that's what I expected.83.100.250.79 (talk) 18:06, 31 August 2009 (UTC)[reply]