Wikipedia:Reference desk/Archives/Computing/2009 May 16

Computing desk
< May 15 << Apr | May | Jun >> May 17 >
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.



May 16

edit

HTML/iPod Notes queries

edit

For an assignment for university I am required to use the notes function on an iPod Classic, which utilises HTML language. We've been given a few pointers, but I'd like to use some other HTML or iPod language, whatever meta it uses. Is there a function for exceptions to 'now playing=false', and are videos affected by it? Secondly, is there a way to have a song start playing upon entering a note, or somehow make a song play at the same time as linking to a note? Avnas Ishtaroth drop me a line 10:45, 16 May 2009 (UTC)[reply]

How about the official iPod Notes Feature Guide? --grawity 11:33, 21 May 2009 (UTC)[reply]

Finding progress of for loop in Delphi application

edit

I am using a Delphi application (written by me) to create a big fractal. The application has no GUI but runs in the background, and can run for weeks (paused only when the computer is hibernating). Now, because there is no GUI, I do not know how far the work has progressed, but because almost all the code is inside a for loop (for i := 0 to N do) I could easily create a breakpoint somewhere in the loop, inspect the variables and then use the value i/N as the current progress. The only problem is that I cannot access the for loop variable i, because it is "inaccessible here due to optimization". Before I use the applicatin next time, I will create a GUI so that I can read the progress, but is there any way I can read the progress of the current instance of the application, without terminating it and thus losing all data? --Andreas Rejbrand (talk) 18:20, 16 May 2009 (UTC)[reply]

You seem to already have it in some sort of debugger. If your Delphi has been compiled and your debugger can show you the processor registers, you can look for one that increases by one every time you hit a breakpoint at the top level of the loop. If it's being interpreted (but still is optimized somehow), you might be able to apply the same trick, but it could depend on where you put the breakpoint, so it could take a few tries (if it even worked). Other than that, unless it's writing an output file whose size you can look at or is accessing memory in some i-dependent fashion (in which case you could use a watchpoint), I think you'll just have to wait and see. You might be able to time a few iterations of the loop and see how fast it's running, and then look at its total CPU usage, but without the ability to determine i in the first place you'd probably have to be stepping it under the debugger (or at least strace or so, if such even exists for your platform), which would slow it down. You'd still get a lower bound for how far it's gotten, though. --Tardis (talk) 22:30, 19 May 2009 (UTC)[reply]

Online Voting Script

edit

How would I write a script to vote in the MLB All-Star Game Ballot online? I would want to go to http://www.guerrillamail.com/, get an email address (I could do that manually if it would be a lot easier), and then vote for all of the Toronto players here. RefDeskAnon (talk) 18:27, 16 May 2009 (UTC)[reply]

Note: I just realized that it saves my votes from before, which makes it a lot easier. Plus there is a CAPCHTA. RefDeskAnon (talk) 18:29, 16 May 2009 (UTC)[reply]
I can think of a few ways for autoclick voting, but entering info into boxes, CAPCHTA and other stuff that will change on each vote would require mega programming, I mean an entire program dedicated to the task —Preceding unsigned comment added by 82.44.54.169 (talk) 19:09, 16 May 2009 (UTC)[reply]
Would Autoit be any use? 78.146.103.200 (talk) 15:42, 17 May 2009 (UTC)[reply]

Partially prime factorising very large numbers

edit

I am looking for a way to find prime factors of a 1 million digit (random) number. I know getting a complete factorisation of such a large number is impractical, but I'm actually just trying to find one prime factor that is repeated (and isn't too small, say 5-10 digits minimum, I haven't really worked out how big it needs to be). Is there an efficient way of doing this on my PC? While I would like something rather more efficient than just dividing it by lots of primes and seeing what works, my first problem is that I simply don't know a programming language that can handle such a large number - can anyone recommend one? --Tango (talk) 18:30, 16 May 2009 (UTC)[reply]

Any programming language that has a Bignum library (either built in or added) can do this - see Bignum#Libraries and Bignum#Languages (although at a million digits performance will probably suck for most or all). You might be better off using an existing integer factorization library rather than rolling your own (what you describe is essentially Sieve of Eratosthenes). 87.115.168.96 (talk) 18:54, 16 May 2009 (UTC)[reply]
Thanks for the advice regarding bignum. I am looking for something better than a simple sieve if possible, and recommendations for algorithms optimised for small factors of large numbers? --Tango (talk) 19:33, 16 May 2009 (UTC)[reply]
I don't know what you want it for but there are existing complete programs for this. PrimeForm can trial factor (and make a probable prime test if you want that). Note that the 20041023 development version of PrimeForm in the files area of [1] is far faster for trial factoring numbers of this size (based on TreeSieve trial factoring code by me). GMP-ECM has fast implementations of 3 other factorization algorithms for smallish factors of large numbers. I don't know the memory requirements at a million digits. You can also see our articles on Integer factorization but implementing something with an acceptable performance at this size can be challenging. If you tell us your end goal then we may be able to give better advice. PrimeHunter (talk) 22:28, 16 May 2009 (UTC)[reply]
My goal is to find a repeated prime factor (ie. a prime such that the number is divisible by the prime squared), although I'm not interested in very small ones (I can easy tell if it is divisible by 4, for example, but that isn't useful to me). Well, strictly speaking, I don't need it to be prime, but any square factor will involve repeated primes, so it is probably easiest to just look for primes. I'm hoping to use it as a way to compress a random number (which should be impossible, but I'm wondering if there might be a flaw in the RNG that can be exploited - it is very close to random in terms of digit sequences, but I'm not sure that guarantees randomness in terms of prime factors). --Tango (talk) 00:30, 17 May 2009 (UTC)[reply]
I don't know whether you have special rules for which operations are allowed in the compressed version and how the size is defined, but it sounds like a computationally expensive way to try something unlikely to compress on average for an RNG. If you have a single specific number and don't care about average compression then you might get lucky on that number, but you could also get lucky with many other potential compression algorithms that are easier to try. PrimeHunter (talk) 01:09, 17 May 2009 (UTC)[reply]
My idea is that you can write the number as  , which will have size proportional to   plus a little overhead, which (if X is large enough) will be less than the size of the original number (which is about  ). When I originally asked the question I was under the impression that it was very likely that there would be a repeated prime in there somewhere, but I have since looked that up and the odds are only about 40%, and there is a good chance that, even if it does exist, it is too large to be practical to find it. So, this isn't a particularly good method after all, but if it can be done efficiently it is worth a shot to see if I get lucky with the number in question. If it is going to take days or longer to compute, though, it's probably not worth the bother. --Tango (talk) 01:22, 17 May 2009 (UTC)[reply]
Your about 40% is right. The exact value is 1 - 6/π2 = 0.392... If you want a prime with at least 4 digits then that drops to around 0.00013, and to 0.0000098 for 5 digits, and 0.00000080 for 6. I justed tested PrimeForm and factoring only worked to around 828000 digits on my PC with the tested version. But if you get trial factoring working at your size then you can easily factor to a size where the chance of missing a square is extremely small. PrimeHunter (talk) 10:08, 17 May 2009 (UTC)[reply]
It drops to that low if you exclude really small primes? I didn't realise the drop was so dramatic. I think I'll give up now, then! Thanks for your help. --Tango (talk) 14:34, 17 May 2009 (UTC)[reply]

Want to display an image somewhere on the web

edit

I have a photo that I want to put on the internet for a few weeks so that other people can see it, and that I can provide a link to. Where would be the best place to do this with the least hassle please? 78.146.17.231 (talk) 22:57, 16 May 2009 (UTC)[reply]

Imageshack.us is the first to come to mind. Seriously, Google is always your friend: G free picture host Washii (talk) 23:56, 16 May 2009 (UTC)[reply]
Photobucket is another. Tempshill (talk) 03:20, 17 May 2009 (UTC)[reply]

What are most suitable languages to learn for website development?

edit

The only language I am fluent in is gwbasic. Suppose I wanted to make a website about for example collective intelligence, where people made predictions about eg the future values of various stocks and shares, these predictions were averaged, and then later in time compared to the reality. Rather complicated to do, I know. But what would be the languages I should learn if I wanted to create something like this? Or could I get some webpage creation software to do a lot of the work for me? 78.146.17.231 (talk) 23:05, 16 May 2009 (UTC)[reply]

If all you're interested in is the display of static content, HTML will likely suffice, although these days also knowing CSS is a benefit. There are a number of specialized HTML editors available - heck, even office programs like Microsoft Word can save files as HTML these days. If you want to have interactivity, though, (like doing a computation based on user-provided input) you probably want to learn Javascript. If you want to get really fancy (like browser games), you'll probably want to look into Java (which is completely different from Javascript) or platforms like Adobe Flash or Microsoft Silverlight. -- 76.201.155.7 (talk) 00:12, 17 May 2009 (UTC)[reply]
I'd say that learning CSS is a must. Without it, your sites will either be hideous as normally viewed or else agonizing to update. Oh, and office programs like MS Word can indeed save files as a kind of sick parody of HTML, but I wouldn't bother. -- Hoary (talk) 08:39, 17 May 2009 (UTC)[reply]
Start with HTML and then learn PHP. Tempshill (talk) 03:21, 17 May 2009 (UTC)[reply]
You'll need to learn PHP. Webpage creation software wouldn't help you here. F (talk) 04:28, 17 May 2009 (UTC)[reply]
Yes, start with HTML, but before you get too far, take a look at XHTML, which imposes some different formatting rules. CSS and JavaScript are essentials that you will also need to become familiar with. Next you come to a fork in the road. You can take either the Microsoft path and learn ASP.NET, C# and Microsoft SQL Server, or you can take the open source path and learn Apache, PHP, and MySQL. The choice depends on the market. Many modest web sites as well as many of the most visited sites on the web (such as Wikipedia) use Apache/PHP/MySQL architecture, often running on a GNU/Linux machine. Many businesses across the spectrum operate essentially as Microsoft-only shops with the ASP.NET/C#/SQL-Server architecture. Oracle is also a major player for the database component. Good luck. -- Tcncv (talk) 04:54, 17 May 2009 (UTC)[reply]
Thanks. If I spent say three hours a day five days a week learning HTML, XHTML, CSS, Javascript, Apache, PHP, and MySQL, how long would it take until I was good enough to crerate a decent website, even though I had to keep looking things up? 78.146.103.200 (talk) 17:40, 17 May 2009 (UTC)[reply]
That depends on how quick a learner you are! You have some programming experience, so I would expect you can you learn basic (X)HTML and CSS within a few hours. There isn't a great deal to learn with Apache, you just have to get it installed and set up, that might take a couple of hours if it decides to misbehave, but shouldn't take longer (that includes installing PhP and MySQL, they need to be set up together). You can learn basic SQL within a couple of hours, I expect, if you don't mind having to look up syntax and keywords quite often. Learning PHP is the probably the hardest part. Learning your second programming language is generally easier than learning your first, but still takes some time. It's difficult to say how long - it depends on you and on what you want to be able to do with it. --Tango (talk) 23:10, 17 May 2009 (UTC)[reply]
Step One: Learn HTML - it's easy - you can get basic, static web pages up and running.
Step Two: Learn CSS - it's a simple extension to HTML - but you'll need it later.
Step Three: Learn PHP - in essence, PHP is a programming language that runs on the web server that can alter the HTML/CSS that's output to your users.
Step Four: Learn JavaScript - it also allows the kinds of things that PHP does - but it runs in the client's web browser.
SteveBaker (talk) 21:16, 17 May 2009 (UTC)[reply]

Maybe you already know this, but what you want goes beyond what you can do with the typical free account that comes with the broadband internet service intended for home use. Although you can include Java or Javascript in web pages for such accounts, it executes on the client, not the server. Thus, there is no way to collect and organize information from visitors. (Some home-oriented ISPs let you include a guest book, but that is very restricted.) --Jc3s5h (talk) 03:27, 18 May 2009 (UTC)[reply]