Wikipedia:Reference desk/Archives/Computing/2007 August 7
Computing desk | ||
---|---|---|
< August 6 | << Jul | August | Sep >> | August 8 > |
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 7
editPassword protected sites
editsome sites are password protected espcially the site of cambridge www.cie.org.uk, the teachers section . this web contains past papers for IGCSE which is important to students .......watever... how can i hack into this site just for good reasons please ......
- If there really is something that students are supposed to see, ask someone part of the faculty. Otherwise, this would be a criminal act, and we're not going to help you with that. --Oskar 06:21, 7 August 2007 (UTC)
- That said, the easiest way to "hack" any password protection would be to try some common passwords (including any obvious site-specific ones, such as maybe "cambridge" or "teacher" in this case). Presumably, if you did manage to guess the password that way, you'd do the responsible thing and report it so that the password can be changed to something stronger; if you can guess it, so can others. Still, it's better — much better — to get permission before conducting such intrusion testing; a lot of institutions can be touchy about unauthorized access even if you did nothing to abuse it, and the fact that a lock could be picked by a three-year-old child doesn't necessarily make picking it any more legal. —Ilmari Karonen (talk) 07:04, 7 August 2007 (UTC)
- Not to mention that it would be illegal: you would fall foul of the Computer Misuse Act, since you are presumably in the UK. Many other countries have equivalent laws, however. Angus Lepper(T, C, D) 17:00, 7 August 2007 (UTC)
Greasemonkey script
editHow would a Greasemonkey script that just searches a document and replaces all instances of some phrase with another look like? --Oskar 06:18, 7 August 2007 (UTC)
- Off the top of my head, untested:
var node = document.firstChild;
while (node) {
if (node.nodeType == 3) {
node.nodeValue = node.nodeValue.replace(/phrase/g, "something else");
}
// Walk the DOM tree:
if (node.firstChild) {
node = node.firstChild;
} else {
while (!node.nextSibling && node.parentNode)
node = node.parentNode;
node = node.nextSibling;
}
}
- Of course, there are probably other ways of doing it. Note that this approach has a major shortcoming: if the phrase is split between multiple text nodes (like if only part of it is in italic or bold) then it won't get replaced. —Ilmari Karonen (talk) 06:48, 7 August 2007 (UTC)
Software for simple animated game
editI want to create a simple game from the scratch, with a bit of animation, some game logic, some audio effects and some kind of scoring. The player should be able to select some characters froma pool of characters depending on some situations. Then these characters will complete some tasks (the computer should do this). For each task completed, there should be some score. If the player selects a wrong character to for a task, there should be some penalty points. Each of the tasks should have some animation, with some audio effects etc etc. Is there any free software that I can use for this? I have no experience in animation. -- WikiCheng | Talk 08:01, 7 August 2007 (UTC)
- If you have no experience in programming, then you may want to check out programs such as Game Maker which require minimal technical knowledge whilst still producing reasonable results. The tradeoff between the two options are that whilst Game Maker-esque options have a relatively small learning curve, you lose a little control over the project. Actually learning a programming language and appropriate APIs will permit you much greater control, but will take many months (at least) before you are at a level where you can begin to start thinking about going ahead with your original project. On the other hand, learning a programming language and how to program (which aren't necessarily the same thing: the former is relatively much easier) can be very rewarding and also permits you to write other programs for your computer. Further advice might be obtained from Internet forums such as gamedev.net (mentioned directly simply because it is the largest one that I am aware of). Angus Lepper(T, C, D) 17:11, 7 August 2007 (UTC)
- Contrary to what people think you can code in gamemaker also. There is no loss of power or control. I have coded (yes coded) games as complicated as Advance Wars in gamemaker using entirely its code scripting and no the drag and drop interface.--Dacium 05:53, 9 August 2007 (UTC)
Thanks to both of you. I'll give gamemaker a try. Just a last question: Is it free? -- WikiCheng | Talk 13:59, 9 August 2007 (UTC)
How to insert combo box/combo list box in a cell in MS Excel Sheet
editHow can I insert combo box/combo list box in a cell in MS Excel Sheet?
- Depends what you want to do. You can use a form combo-box object, but that doesn't strictly sit in the cell, it sits on top of it. Or you could use Data Validation on the cell to restrict the values to a list - this makes drop-down list of the values. I usually do this by creating a named range of the list values. Like I say - it depends on what you want the combo box to achieve. --Worm 11:54, 7 August 2007 (UTC)
Internet Explorer 7 Search Bar
editHello. Does Internet Explorer 7's search bar use website prefixes? For example, if I search something on Wikipedia using the search bar, does it use Wikipedia's website prefix en.wiki.x.io/wiki/...? Alternatively, when I search something on Google using the search bar not Google Toolbar, does the search bar use Google's website prefix www.google.ca/search?hl=en&q=…&meta=? Thanks in advance. --Mayfare 15:05, 7 August 2007 (UTC)
- The search bars on major browsers (assuming you are indeed referring to the search bar and not the address bar) do more-or-less what you are describing. They perform a text substitution into a URL which runs the query (i.e. for Google, it might store
www.google.com/search?q=%query
and then replace%query
with your actual search string, appropriately escaped such that it would actually work — e.g. if you enter "café noir" as your search string then it will use "caf%C3%A9%20noir" to actually search.). Angus Lepper(T, C, D) 17:05, 7 August 2007 (UTC)
Bookmark manager recommendation
editAnyone know a good bookmark manager/social bookmarking site that would let me do fulltext searches of every pages I've bookmarked and by default set it up so that others can't see what sites i've bookmarked? Bookmark managers don't seem to have full text search. Social bookmarking don't seem to allow "Private bookmarks" by default. Furl and Delicious, for example, can let you check a box to specify a bookmark as private, but you have to do the tedious step of clicking "private" every single time to bookmark a site, I think. --Alecmconroy 15:40, 7 August 2007 (UTC)
PHP Download
editHow do you allow webpage viewers to download files such as .mp3's using php? (basically, what php code do I type to allow users to download content from my website to their computer?) 69.205.180.123 17:14, 7 August 2007 (UTC)
- Well, you can just link to the filename (using standard HTML <a href=...>) or stream it to the user (they click something, your script grabs the content and sends it to the browser using readfile()). If you are doing the latter, it is best to use headers with the appropriate MIME file types so the browser doesn't just display it as jibberish. If you want to force the file to download, rather than open in a player, you use a specific MIME header. The code below should do it (borrowed from an old project of mine):
header("Content-type: application/x-download");
header("Content-Length: ".filesize($filepath));
header("Content-Disposition: attachment; filename=\"$filepath\"");
header("Content-Transfer-Encoding: binary");
readfile($filepath);
- Where $filepath is the path to the file you want them to download. Note that there are some pretty strict requirements to how header() is used; no content may be sent by that particular script before or after it by the same script. --140.247.248.212 18:35, 7 August 2007 (UTC)
- Thanks. That looks like what I needed.69.205.180.123 20:02, 7 August 2007 (UTC)
- Actually, its not so much that you cant send anything after these headers, its just everything you send after these headers will be treated as the part of the file. I would also recommend that you change the content-type to the appropriate MIME type for what you are sending. For mp3 thats "audio/mpeg". PHP.net page on header function has more information and examples, including some that support resume. — Shinhan < talk > 14:06, 10 August 2007 (UTC)
MS Word
editIs there a way to have Word Document A linked to documents B, C, and D, so that A is just the sum of BCD? And you can change the individual BC&D and that will change A? Thanks, XM 18:28, 7 August 2007 (UTC)
- That A is a "master document". -- Finlay McWalter | Talk 19:13, 7 August 2007 (UTC)
- Your mileage may vary, but I've found Word to be pretty incompetent when managing really large documents. I made an attempt once to break my large (>300 page) document into a master document and subsidiary documents and abandoned the effort. I've always assumed that the folks at Microsoft produce their own documentation in Word, but they must have a lot more patience than I do for Word's foibles.
- I agree. You can try this sort of thing in Word, but you will be fighting with it the entire time. It is not easier to do it this way (because as Louis Menand so eloquently said, "Microsoft Word is a terrible program."). --140.247.238.85 18:02, 8 August 2007 (UTC)
Mac: fullscreen apps
editOn a Mac (10.4.10, Tiger), is there a way to let apps that automatically run in fullscreen run in a window instead? I'm thinking of games here, so that I can play them while still seeing my Gmail notifier and Adium buddy lists. Thanks! McMillin24 contribstalk 20:24, 7 August 2007 (UTC)
- I'm not sure but does F9 not let you view all open windows? Not quite the same but allows quick switching. ny156uk 21:40, 7 August 2007 (UTC)
Mobile phone internal batteries
editDoes a mobile phones internal battery (the one that is tiny and soldered to the circuit board)just control the 24hr clock/memory or the whole processor clock? It seems to be that when that battery dies many mobiles phones start malfunctioning. Or is that coincidence? or built in obsolescence?
- Is there a specific phone you have in mind? None of my CDMA phones have a backup battery. They store their data in flash memory and set their clock from the network. That is, they have no need of an internal battery. --Mdwyer 05:34, 8 August 2007 (UTC)
- GSM phones can have internal battery (Nokia 5110, there were mentioned some sort of polyacetylene (or something similar) type of backup battery in service manual) or can have not (Nokia 3410 lost clock, when main battery were removed). -Yyy 16:43, 9 August 2007 (UTC)
C programming questions
editCan someone please explain to me (or point me to an explanation):
1: Exec functions and their proper use (I've read my system's man page and it just made me more confused).
2: Pointers to functions: how they work, how to use and create them, etc. (Again, I've read the best resource I have available (K&R's The C Programming Language) without any enlightenment)
Thanks in advance! 69.123.113.89 21:45, 7 August 2007 (UTC)
Pointers to functions are just a variable (like any pointer). It's easiest to explain with code samples:
// pointer to function, initially set to NULL int (* pointer_to_function)( int arg1, int arg2 ) = NULL; // define some function as normal (note: same argument and return types as above) int addition ( int arg1, int arg2 ) { return arg1 + arg2; } // set pointer to a value pointer_to_function = addition; // call the function (returns 3) pointer_to_function(1, 2);
[edit] can be used for callbacks, eg: qsort. --h2g2bob (talk) 23:45, 7 August 2007 (UTC)
- [edit conflict]
exec()
(and its variants —execvp()
, etc. — which differ in what extra information you pass and how you pass it) cause the process that executes them to be replaced with another process, started from an executable file on disk and initialized with your choice of arguments and/or environment variables. In Unix, there is no (standard, portable) way to create a new process exceptfork()
, which creates another copy of the process that calls it. As such, there has to be a way to make one of the two copies (usually the child) into a different program if any choice is to be had about what programs are executed.
- Your phrasing is a bit odd. fork creates a new process just fine -- Unix has no concept of a "blank" process . Every process in Unix is rooted under the init process -- every process has a parent process, and when you fork, you make a child.
- I assume you know what a pointer is; just as you can do
int x=/*...*/,y=/*...*/,*p; if(/*...*/) p=&x; else p=&y; /*...*/ *p=4; /* assigns to whichever of x and y was chosen earlier */ ++x; ++y; printf("%i\n",*p); /* uses whichever was chosen, so prints 5 */
- with normal pointers, so can you do
double (*p)(double); if(/*...*/) p=sin; else p=cos; /*...*/ printf("%g\n",p(3.1415926536)); /* uses whichever was chosen, so prints 0 or -1 */
- with function pointers. Note that the
&
and*
are optional with function pointers, because you can do fewer things with functions and so there is no ambiguity. Of course, normal pointers are more common, partly because they are simpler, partly because they (unlike function pointers) can be used to build data structures (like linked lists), and partly because function pointers tend to impose significant performance penalties on modern hardware (if used frequently and where speed matters). Both kinds of pointer have the important ability to be stored and passed among functions so that the choice of target for the pointer and the use of the pointer can be quite far apart in terms of code, time of execution, and conceptual design. --Tardis 23:50, 7 August 2007 (UTC)
Now just because "pointer_to_function = addition;" is legal C because there's no real ambiguity doesn't mean you should use it- I had to puzzle over it for a few seconds to realize that what you really meant was "pointer_to_function = &addition;" though as tardis pointed out it's the same thing really --frotht 03:21, 8 August 2007 (UTC)
On the exec question...
Exec is used when you want to replace one running program with another. By itself, this isn't a very useful thing to do. But combined with fork, it becomes a very powerful thing to do because it allows one program to "spawn off" a series of other programs. exec is almost always used with fork and, in fact, most programmers tend to think of them as one word: "fork-n-exec".
fork-n-exec can be used, for example, when a software system is starting up. Perhaps there is some sort of master program and a series of subsidiary programs that intercommunicate with the master. Those subsidiary programs are each started by forking off from the master program and then exec'ing the subsidiary program.
The shell does the same thing when you execute a pipeline. The shell fork-n-execs each of the elements that you specify in the pipeline, arranging them to intercommunicate via pipes.
Does this explanation help you?
Atlant 12:20, 8 August 2007 (UTC)
- This is basically how pointers to functions work.
Lets say you have two functions with prototypes: int func1 (int blah); int func2 (int blah); These functions are of the same type. They are both int NAME (int); You can declare a pointer to this type of function as: int (*functionpointer)(int); You can then set this pointer to point two either func1 or func2: functionpointer = func1; You can then make a function call, through the pointer: (*functionpointer)(0); Which in this case would be eqvialanet to doing: func1(0); An interest quirk of C is that whenever you reference a function you ALWAYS gets its address. So that these 3 lines all do the same thing: functionpointer = func1; functionpointer = &func1; functionpointer = *func1; They all set function pointer to point to func1.