Wikipedia:Reference desk/Archives/Computing/2008 June 4

From Wikipedia, the free encyclopedia

Computing desk
< June 3 << May | June | Jul >> June 5 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


Contents


[edit] June 4

[edit] MediaWiki Page Protection

Suppose that there are three users 'Alex', 'Bob' and 'Chad' whose user pages are 'User:Alex', 'User:Bob' and 'User:Chad' respectively. Is there any way to configure MediaWiki such that only Alex can edit the page User:Alex, only Bob can edit the page User:Bob and only Chad can edit the page User:Chad? That is, no one can edit a user page except the user who owns the user page. As I know, users in some group have rights to protect/unprotect arbitrary page but it doesn't work for the case I described. Does MediaWiki provide such advanced protection? Or any extension available? Thanks! - Justin545 (talk) 02:08, 4 June 2008 (UTC)

The extension UserPageEditProtection ([1]) does that —Dvyjones (tc) 20:16, 4 June 2008 (UTC)

[edit] opengl crash

Hey I started off opengl programming recently but I got a crash in my first program itself -

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Commenting this line makes another crash at glFlush(). I have already created a render context and activated it using wglMakeCurrent() which returns a TRUE. I have also set the clear color to black and clear depth 1.0. Please help. 59.93.175.90 (talk) 05:43, 4 June 2008 (UTC)

It would be nice to have the code you are trying to use. Leeboyge (talk) 08:03, 5 June 2008 (UTC)

[edit] I have a question in ADVANCED COMPUTER ARCHITECTURE.

MY QUESTION IS : (1) EXPLAIN DIFFERENT PAGE REPLACEMENT POLICIES WITH EXAMPLE. (2) WHAT IS BLACKPANE BUS SYSTEM? (3) WHAT IS THE DIFFERENCE BETWEEN A LINEAR PIPE LINE PROCESSOR & NON-LINEAR PIPE LINE PROCESSOR? —Preceding unsigned comment added by 59.98.57.143 (talk) 06:05, 4 June 2008 (UTC)

Sounds like homework. You will find some relevant information in the following articles: page replacement algorithm,backplane (note spelling !), pipeline (computing), instruction pipeline. And please do not type everything in capital letters. Gandalf61 (talk) 10:08, 4 June 2008 (UTC)

[edit] ScanDisk

In Windows XP, why doesn't ScanDisk pop up when you turn on your computer after improperly shutting it down? Interactive Fiction Expert/Talk to me 06:23, 4 June 2008 (UTC)

See journaling file system. NTFS is journaled. FAT isn't, and Scandisk probably will still pop up for FAT partitions. -- BenRG (talk) 09:19, 4 June 2008 (UTC)

[edit] Australia ripped off with internet.

I've heard from people visiting here in Australia that in their countries they pay a flat rental fee for broadband access, whereas we pay more money the more we download. I'm fairly new on the internet, but I remember using it a few years ago and it wasn't like that here. It seems to go against the whole idea of the web - it's as if you had to pay more to a public library the more you visited it, even if you didn't borrow a book! Not very progressive, especially for children of struggling families. My question is: Is it true that Australia is unusual in this way, and how did it happen? —Preceding unsigned comment added by Wikwot (talk • contribs) 07:45, 4 June 2008 (UTC)

Here in the UK Many people have a bandwidth limit on their broadband connection. I used to pay £18 a month for broadband and that got me 20gb of transfer activity. I could have paid £25 a month for 'unlimited' bandwidth, or £13 for 5gb. Obviously the package gives different users different price points. Almost all providers work on this same sort of system of either a set monthly bandwidth or unlimited amount. On old dial-up connections we used to pay a per minutes-online price (like a phonecall) but that's pretty much gone these days with broadband takeup in the UK being so high. Your way may be the same, or it may be that you pay $2 per GB or something - which would be similar and perhaps (for many consumers) actually a better deal. I'd be surprised if you can't get the same setup in Oz as you do in the UK (and vice-versa) - I guess there's a large number of providers to choose between? 194.221.133.226 (talk) 10:18, 4 June 2008 (UTC)
Nobody gets truly unlimited bandwidth. You pay for bandwidth. In an "unlimited" plan, you are actually limited by the maximum bandwidth of the connection. To get a higher bandwidth connection, you have to pay more. Using your library example, you pay more for more just the same. If you want a tiny truck with a handful of books that parks down by the grocery story to be your library, your taxes to support it will be minimal. If you demand a four-story marble building with every book, movie, and music album ever made and a coffee shop and a cafe and a large supply of high-bandwidth internet connections... you will pay a lot more in taxes to support it. -- kainaw 12:23, 4 June 2008 (UTC)
Then there is the advertisers concept of unlimited broadband with a "reasonable use policy", i.e. it is unlimited but you are not allowed to use more than a certain amount! -- Q Chris (talk) 07:25, 5 June 2008 (UTC)
This is normally related to how far you are away from a world tier 1 ISP and also how monopolistic your local tier 1 telecomms provider is. It is also normally related to the policies and ethics (yeah right) of your Government Department of Communications. Here in South Africa we get royally ripped off; we pay among the highest rates in the world. It is due to our government-owned "Telkom" owning the local infrastructure as well as the lease on the undersea cable running across the Atlantic to AT&T infrastructure in New York (I think). Sure, other providers own satellite portions but they still have to pay Telkom for something (like upload bandwidth) down the line. Our government has the moronic policy of not allowing foreign competition to Telkom. There has only been one competitive tender awarded in the last (forever) years, and they (Neotel) are at the mercy of Telkom too. Unbundling the local loop has been pushed forward to 2012. The minister owns shares in some comms companies. It goes on and on, and who suffers? We the consumer, while Telkom shareholders smile. Yet there could have been a simple policy to subsidize bandwidth in our developing country, where education for the masses is sorely needed. Not to mention business growth and innovation. Do the politicians care? Line their own pockets, and to hell with their comrades, where just over a decade ago they were all in the fight against apartheid. Sorry for the bleak comments but this is reality over here. And, you are not alone in your gripes against the high cost of bandwidth. Sandman30s (talk) 19:32, 4 June 2008 (UTC)
Australia's pipe out to the rest of the world is pretty damn narrow, which doesn't help prices, and much of the infrastructure is owned by one company. -- Consumed Crustacean (talk) 22:08, 4 June 2008 (UTC)
When I first started using the internet the pipe from Australia was 256K, and guess what, international access was sluggish. Nowdays one user would not be satisfied that that for themselves. A 9600bps permanent link cost several thousand dollars per year. It has improved. Graeme Bartlett (talk) 12:08, 5 June 2008 (UTC)

[edit] Mac G4 question

Will my Mac G4 be enough to run Sonar 4 or do I have to get more sonar applications? Will I need two computers or is one sufficient? —Preceding unsigned comment added by 208.57.94.131 (talk) 09:06, 4 June 2008 (UTC)

I don't see Sonar as being a Mac compatible program. --70.167.58.6 (talk) 20:46, 4 June 2008 (UTC)

[edit] Perl regexp

This is pretty close the first thing I have ever tried to do with Perl so it might be obvious, but with

 $str =~ /<li><a href="(.*)" class="option" title="([^"]*)"/;
 print "Option 1: $2\nAddress 1: $1\n";

what should I do if the $str can contain more than 1 match for the expression? --212.149.217.163 (talk) 11:02, 4 June 2008 (UTC)

As written it will just match the first one. You can also do:
while ($str =~ /<li><a href="([^"]*)" class="option" title="([^"]*)"/g)
{
    print "Option 1: $2\nAddress 1: $1\n";
}
to get them all (note the 'g' modifier at the end). Note that you want to do the '[^"]*' thing rather than '.*', or you could get a single match starting at the first 'href="' and ending at the last one. --Sean 13:01, 4 June 2008 (UTC)

[edit] PROJECT TOPICS

I NEED SOME INFO ON TOPICS FOR A FINAL YEAR PROJECT.ASAP!!!IM STUDYING COMPUTER SCIENCE —Preceding unsigned comment added by 83.229.90.43 (talk) 14:38, 4 June 2008 (UTC)

Hi. Please don't type in all capital letters, it is perceived as shouting. We'll be happy to pool ideas for you, but you have to give us a little more information about what you in particular are studying, what languages you know, what type of school this is, what the requirements for the project are. Realize that everyone on this desk comes from a wide variety of educational backgrounds, countries, etc., and your idea of what it means for a "final year project" might be something totally different than ours. --98.217.8.46 (talk) 15:22, 4 June 2008 (UTC)
Here is a list of enhancements people want to the software that runs this wonderful website. Choose one of a suitable scope for your time and abilities, do a great job implementing it, get an A, and be a Wiki Hero! --Sean 16:10, 4 June 2008 (UTC)
If you are looking for a programming project, how about developing an AI for strategy games. Start with 3x3 noughts and crosses - very simple case. Then generalise to 4x4, 5x5 noughts and crossses, 3-d noughts and crosses, Connect 4, draughts/checkers, Reversi/Othello or even, if you are really ambitious, Thud. Plenty of scope for many projects there, and lots of fun too. Gandalf61 (talk) 16:28, 4 June 2008 (UTC)

[edit] Looking for a special image applet

Hi, is there an applet that I can add to a website, that will let me add captions to the images, and show a new random image everytime the page is refreshed? Thanks in advance, Kreachure (talk) 15:05, 4 June 2008 (UTC)

You can do this very easily with Javascript (better than an applet).
Here's some sample HTML page that demonstrates an easy way to do this:
<html>
<script language="javascript">
<!--
var filenames = new Array (); //image filenames
var captions = new Array (); //captions

filenames[0] = "image1.png"; 
captions[0] = "This is image #1.";
filenames[1] = "image2.png"; 
captions[1] = "This is image #2.";
filenames[2] = "image3.png"; 
captions[2] = "This is image #3.";

function loadimage() {
        var new_index = Math.floor(Math.random() * filenames.length);
        document.getElementById("img_filename").src = filenames[new_index];
        document.getElementById("img_filename").title = captions[new_index];
        document.getElementById("img_filename").alt = captions[new_index];
        document.getElementById("img_caption").innerHTML = captions[new_index];
}

-->
</script>

<body onload="loadimage()">

<div style="float: right; text-align: center; border: 1px solid black; padding: 5px;">
<img id="img_filename" src="image1.png" border=1 alt="This is image #1." title="This is image #1.">
<br>
<span id="img_caption">
This is image #1.
</span>
</div>

</body>
</html>
So what are we doing here? First we have a javascript block that creates two arrays (collections of items), one full of image filepaths and the other full of captions. Make sure the array indices are numbered sequentially from 0 onward as I have done above (from 0 to 2 in this example). In the HTML, we have one of the images and captions displayed by default (it will be displayed even if Javascript is disabled). In the BODY tag of the HTML, in the ONLOAD attribute we have a reference to a function that will pick one of the images in that array of filenames at random and then replace the default image and caption on the page with the information from the array. (It finds the image and caption in the HTML based on their ID attributes, so make sure you take note of what those are). It also changes the ALT and TITLE tags of the IMG element to the caption.
I put the image and caption in a DIV element (with some CSS applied to it) just so you can see an easy way of adding captions using just HTML/CSS. The image and caption will be surrounded by a black line in this example and is made to "float" on the right side of the page but that is not mandatory.
Make sense? It should be pretty easy to modify as you might need it. Let me (or others here) know if you have any questions about it. --98.217.8.46 (talk) 19:30, 4 June 2008 (UTC)

Um, holy crap? :) Thanks, I'll see what happens with this. Kreachure (talk) 19:47, 4 June 2008 (UTC)

[edit] bash script

Is there a way to run a fragment of code for each line in a given file?

eg for i in $(each line of foo.txt) do ... done

Thanks —Preceding unsigned comment added by 65.110.174.74 (talk) 15:09, 4 June 2008 (UTC)

Try something like this:
while read i ; do
    ...
done < foo.txt
(untested, sorry) -- Coneslayer (talk) 15:18, 4 June 2008 (UTC)


This works:
$ cat /etc/passwd | while read; do echo "The line is ($REPLY)"; done
The line is (root:x:0:0:root:/root:/bin/bash)
The line is (daemon:x:1:1:daemon:/usr/sbin:/bin/sh)
The line is (bin:x:2:2:bin:/bin:/bin/sh)
The line is (sys:x:3:3:sys:/dev:/bin/sh)
...
--Sean 16:23, 4 June 2008 (UTC)

[edit] Some software needed

I'd like to ask for a few recommendations. I need a couple of software for 1) converting .wma, .m4a (and some other Apple formats) and mp3 (and some other formats) files, like Easy CD-DA extractor 2) shutting down my pc automatically (freeware would be ok), 3) something that can be substituted for Peer Guardian (I don't why, it often crashes!), and 4) something that can download everything of a web site, like Teleport Pro.

I hope I haven't exhausted the list yet. :)--61.92.239.42 (talk) 16:27, 4 June 2008 (UTC)

audacity, scheduled tasks and %windir%\system32\shutdown.exe, ProtoWall, DownThemAll! .froth. (talk) 17:18, 4 June 2008 (UTC)
Awesome. You surely deserve a barnstar for this one, Froth! Kushal (talk) 01:06, 5 June 2008 (UTC)

I also recommend MEncoder. It'll run on pretty much any OS, if you're not scared of a command line.

[edit] annoying high pitched sound

Please help. I have annoying high pitched sound coming from my computer speakers and headphones. It only there when I use hard drive with Serial ATA. When I use AT Attachment it not there. But I only now have Serial ATA hard drive with windows on so I get the noise all time. Nothing rids me of it, I tryed volume controller and it only go when I mute sound but then I no hear my music. How can I make it go away? Thank you. —Preceding unsigned comment added by 79.75.156.95 (talk) 19:45, 4 June 2008 (UTC)

I don't know if this will help, but usually when I have seen that problem, it is the "line in" channel that gives the problem. Muting that channel usually solves the problem. Leeboyge (talk) 07:59, 5 June 2008 (UTC)

[edit] Script for X-chat

Hi there. I use X-Chat Aqua 0.16.0 on Mac OS X running 10.5.3. I put the script in ~/.xchat2, quit and restarted X-Chat, but no love when people send a wikified link to the channel. Might anyone be able to assist? I also tried loading it as a plug in and got syntax error messages. Thanks. P.S. Might you be able to reply on my talk page as well as here? Sincerely, Bstone (talk) 20:51, 4 June 2008 (UTC)

[edit] replacing the MOD function

I am using the MOD function to decode each primary color value of pixels which are stored as base 256 bit integers by adding using the following formulas:

color_integer = blue_integer x 256^2 + green integer x 256^1 + red_integer * 256^0. 

The primary colors are decoded using the MOD function as follows:

First pixel:

r = pixel1  Mod tf6
g = (pixel1  \ tf6) Mod tf6
b = (pixel1  \ tf6d) Mod tf6

Second pixel:

R2 = pixel2  Mod tf6
G2 = (pixel2  \ tf6) Mod tf6
B2 = (pixel2  \ tf6d) Mod tf6


The difference in primary color values is then compared with a tolerance value for each primary color using the following formulas:

rc = Abs(r - R2) - Tolerance 
gc = Abs(g - G2) - Tolerance 
bc = Abs(b - B2) - Tolerance

A decision is then be made based on a positive or negative value resulting for each primary color.

My question is whether I can use logic functions instead of the MOD function to get the same results? -- Taxa (talk) 22:23, 4 June 2008 (UTC)

In C, you could do:
r =  pixel1 &     0xFF;
g = (pixel1 &   0xFF00) >>  8;
b = (pixel1 & 0xFF0000) >> 16;
(It took me a moment to realize you're using tf6 = 256 and tf6d = 65536.) --Bavi H (talk) 23:55, 4 June 2008 (UTC)
I added some parentheses above. And just to clarify, & is a bitwise and, >> is a logical right shift. --Bavi H (talk) 01:05, 5 June 2008 (UTC)

Seems like VB6 does allow something similar but its 3 times slower....

j = Hex(i)
b = Val("&h" & MidB(j, 1, 4))
c = Val("&h" & MidB(j, 5, 4))
d = Val("&h" & MidB(j, 9, 4))

-- Taxa (talk) 05:14, 5 June 2008 (UTC)

Another way may be to redefine the variable as an array of bytes and then access it as an array element. This is easy to do in C. I have no idea about VB6. Graeme Bartlett (talk) 05:21, 5 June 2008 (UTC)
VB6 only offers the HEX function to convert an integer to a byte string. -- Taxa (talk) 10:10, 5 June 2008 (UTC)


translation of the C code to VB would be
r = pixel1 and $FF
g = (pixel1 and $FF00) shr 8
b = (pixel1 and $FF0000) shr 16
Although the VB6 AND function will process and convert and integer value (pixel1) and a hexadecimal value (&hFF) the only way to do a bitwise shift is by using the leftb, rightb or midb functions. -- Taxa (talk) 17:22, 5 June 2008 (UTC)
Will work in VB-v2008 but is 1/3rd slower than using the MOD function. -- Taxa (talk) 23:29, 5 June 2008 (UTC)

[edit] software for speakers-to-mic

Does anyone know of a software that will take any incoming sound that is playing on my speakers and play it on my microphone? i.e., people that play music on Ventrilo music channels must have something like this software. Thanks, 75.66.58.122 (talk) 22:37, 4 June 2008 (UTC)

Audacity has a Preferences > Software Playthrough "(Play new track while recording it)", that's what I usually use, but there's certainly other ways. --Underpants (talk) 23:11, 4 June 2008 (UTC)
Thanks. 75.66.58.122 (talk) 20:38, 5 June 2008 (UTC)

[edit] Font containing Sogdian and Middle Persian glyphs

Does anyone know of a font that contains glyphs for the six characters in the Syriac Unicode block for Sogdian and Persian? Specifically, these are the characters U+072D, U+072E, U+072F, U+074D, U+074E and U+074F. -- Gareth Hughes (talk) 22:47, 4 June 2008 (UTC)