Wikipedia:Reference desk/Archives/Computing/2009 January 1

Computing desk
< December 31 << Dec | January | Feb >> January 2 >
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.


January 1

edit

Mouse issues

edit

Hello, i seem to be having some problems with my mouse. Here is some background information, the mouse is a logitech cordless trackball model number Y-UT76. The mouse bad is a 11.5 inch X 8inch World of Warcraft mouse pad, very flexible but not very stretchy. I am working on a Dell notebook running windows vista business, dual core 1.2GHZ with 2 gigs of ram (and a 4 gig flash drive acting as readybost). I have a 3Mb connection through Comcast. My office is 13 feet X 13 feet X 15 feet. I have a 22inch monitor. There is a ESI phone sitting next to my computer and it seems like it is plugged in to the network cable. My problem is this: My mouse courser is on the far left side of the screen, while my mouse has reached the right end of the mouse pad. I cant move my mouse any more to the right. I have no idea what to do. my secretary suggest that i need a mouse pad upgrade but i really dont want to spend the $800 for a new mouse pad. What can i do? —Preceding unsigned comment added by 64.172.159.131 (talk) 00:13, 1 January 2009 (UTC)[reply]

 
I've been having similar problems with my new Laptop SteveBaker (talk) 23:00, 1 January 2009 (UTC)[reply]
I'd suggest moving the mouse to the far left of the mousepad: the cursor on the screen can't move to the left so will stay where it is. But the trackball won't be on the far-right of the mouse pad any more, so you can now move to the right. If this happens a lot, you could adjust the sensitivity of the mouse so it covers more distance for the amount of roll (if this makes the trackball difficult to control, you could reduce the resolution of the screen to make the screen feel "smaller"). These options are somewhere in Start, Control Panel. --h2g2bob (talk) 00:45, 1 January 2009 (UTC)[reply]
I would suggest that you upgrade your hardrive, it sounds like you need more room on your harddrive since your trackball cant move to the right anymore. Or you may need a faster CPU... or perhaps a new ENDUSER. E smith2000 (talk) —Preceding undated comment was added at 00:51, 1 January 2009 (UTC). Remember WP:BITE, please. 86.133.55.169 (talk) 01:02, 3 January 2009 (UTC)[reply]
Do you really need an $800 trackball ? Why won't a $20 mouse serve your needs ? StuRat (talk) 06:59, 1 January 2009 (UTC)[reply]
Sounds to me like an :ID-10T error. Haha, somebody had to say it... DaRkAgE7[Talk] 08:51, 1 January 2009 (UTC) Remember WP:BITE, please. 86.133.55.169 (talk) 01:02, 3 January 2009 (UTC)[reply]
WP:BITE doesn't apply to trolls. And don't bother quoting WP:AGF at me Nil Einne (talk) 10:10, 3 January 2009 (UTC)[reply]
I definitely think we need to assume good faith here, as I've tried to do. An $800 foam mouse pad is, of course, quite absurd, but I don't think that's what the poster meant. I think they are talking about a digitizing pad (what, no article?), something like this one: [1]. Large, high-res digitizing pads can be pricey, although $800 still seems high to me. Yes, it shouldn't be properly called a "mouse pad", but I can understand why one might call it that. StuRat (talk) 15:35, 4 January 2009 (UTC)[reply]

Greek letter λ misspelled in Windows Vista

edit

Isn't the Greek small letter lambda (λ) misspelled in Windows Vista's charmap.exe application? The applications calls it "Greek Small Letter Lamda". Is this bug present in older versions of Windows (e.g. XP) as well? And where are the charater names stored? Are they stored in charmap.exe or is there a Win32 API function that is utilized by charmap.exe? If so, which function is it? If not, where can I obtain a list of Unicode character names for my application? --Andreas Rejbrand (talk) 01:55, 1 January 2009 (UTC)[reply]

Sadly (because it's great to beat up M$), they have it right. The Greek spelling of lamda is: ΛΑΜΔΑ - No 'beta' - hence, no 'B'. However, lots of people (including many dictionaries) put the 'b' in - so I guess either spelling is OK. SteveBaker (talk) 03:33, 1 January 2009 (UTC)[reply]
However, in English, it is spelled lambda. So people spell it that way because they speak English. --71.141.148.143 (talk) 05:41, 1 January 2009 (UTC)[reply]
Interesting. Another character, U+019B, ƛ, is called "Latin Small Letter Lambda With Stroke", though. But I see the logic: the true Greek characters are spelled with Greek rules. (Or, as SteveBaker wrote, either spelling is OK.) --Andreas Rejbrand (talk) 12:45, 1 January 2009 (UTC)[reply]
The spelling they have matches the spelling in the Unicode charts (see [2]). I think their character names are all just the Unicode names, and has nothing to do with them. --71.141.148.143 (talk) 05:32, 1 January 2009 (UTC)[reply]
But how to get character names as a software developer? I would like a function that accepts a unicode codepoint (e.g. 0x019b) and returns the character name (e.g. "Latin Small Letter Lambda With Stroke"). --Andreas Rejbrand (talk) 12:45, 1 January 2009 (UTC)[reply]
I just studied charmap.exe in a hexadecimal editor, and realized two things:
It appears as if GetUName.dll exports a single function GetUName. Can I use this function? I so, how do I know how to use it, e.g. which arguments will it require? --Andreas Rejbrand (talk) 15:41, 1 January 2009 (UTC)[reply]
Googling that function on MSDN turned up this blog post. Apparently, that function is not part of the public API, and therefore undocumented, no guarantees, etc. But some of the comments might give you some other ideas on how to get these names... - IMSoP (talk) 17:27, 1 January 2009 (UTC)[reply]
Thank you very much. That kind of discussion was exactly what I was looking for! Tanks again! --Andreas Rejbrand (talk) 18:22, 1 January 2009 (UTC)[reply]
  Resolved

x86 assembly

edit

I have 4 questions about x86 assembly:

  1. Is the inc X instruction faster than add X, 1, and is dec X faster than sub X, 1?
  2. Is lea X, [X+Y] faster than add X, Y where X and Y are registers?
  3. Is there any way to perform a divide in the lea instruction?
  4. Should I be able to use 64-bit assembly code when I'm using a CPU with EMT64 but an OS that's only 32-bit?

Thanks, --wj32 t/c 09:02, 1 January 2009 (UTC)[reply]

I haven't been programming assembly in a long time, so I can only answer #4: No. You need to be in long mode. -- Aeluwas (talk) 13:04, 1 January 2009 (UTC)[reply]
  1. inc and dec are indeed faster because the data for the value to be added/subtracted (ie '1') does not have to be fetched from memory.
  2. I doubt lea is faster.
  3. Don't know.
  4. No.
IMHO, there is almost zero reason to use x86 assembly these days. Use C or C++ and let the compiler make these decisions for you (it does a MUCH better job than you'll ever do!) SteveBaker (talk) 20:04, 1 January 2009 (UTC)[reply]
I'm just attempting to make an efficient implementation of CRC32. gcc (with -O3) seems to generate some inefficient code (putting local variables on the stack when it already has ebx, edi, and esi available, using jmps for simple logic). --wj32 t/c 23:15, 1 January 2009 (UTC)[reply]

Program in C++ to print number combinations

edit

The question is as follows:

A positive natural number, for example 3, can be represented as follows:

1+1+1

1+2

where each row represents a combination of positive natural numbers which add up to 3. The combinations 1+2 and 2+1 are same, so only one combination is taken. Write a program in C++ which inputs a positive natural number, n>=2, and n<=20 (the program should reject the input if n<2 or n>20 and ask to re-enter n) and print the possible number combinations (except n itself) which when added give n. The output should contain possible combinations without the '+' sign, but at least one blank space in between the number combinations.

For example: if n=3, Output: Combinations:

            1 1 1
            1 2

if n=4, Output: Combinations:

            1 1 1 1
            1 1 2  
            1 3
            2 2

I've managed to do the part with the 1s, but the other combinations have left me stumped. Even if it's only till 20, how long can the code possibly be? I'm at a loss. This is how much I've done:

//program to print all possible combinations

  1. include<iostream.h>
  2. include<conio.h>

void main()

{clrscr();

int n=0,num=0,a[25],i=0,j=0;

for(i=0;i<5;i++)

{cout<<"Enter a number between 1 and 21"<<endl;

cin>>n;

if(n>1&&n<21)

break;

else

continue;}

while(num<n)

{a[num]=num;

num++;}

cout<<"Combinations:"<<endl;

for(i=n-1;i>0;i--)

{for(j=1;j<=i;j++)

cout<<"1"<<" ";

cout<<(n-i)<<endl;}

{for(i=2;i<n;i++)

{cout<<i<<" "<<(n-i)<<endl;}}

}

Any help, as fast as possible (I've got exams coming up) shall be greatly appreciated. So, do try and help! PLEASE!!! Zebec 10:30, 1 January 2009 (UTC)[reply]

This is actually a little more tricky than it looks. The simplest way is to use a recursive function to allow you to search through all the possibilities for the first number, then for each first number search all the possibilities for the second number, etc. This has the problem that you probably have to pass lists of numbers into functions, or return lists of numbers, but it's the most logical way of doing it. --Maltelauridsbrigge (talk) 15:41, 1 January 2009 (UTC)[reply]
I have a feeling there is a smarter way of doing this, but this recursive function should do the job:
    void doit(int arr[], int len, int number)
    {
        int sum = sum_of_array(arr, len);
        int maxval = number - sum;

        if (maxval == 0 && descending_order(arr, len) && len > 1)
        {
            write_array(arr, len);
        }
        else if (maxval > 0)
        {
            for (int i = 0; i < maxval; ++i)
            {
                arr[len] = maxval - i;
                doit(arr, len+1, number);
            }
        }
    }
arr is an array declared in main, len is the current length of the array, and number is the number that the user entered. You call it from main, like this:
    doit(arr, 0, number).
You'll have to write the functions sum_of_array, write_array and descending_order. The first two do what their names say, the third returns true if the array is in descending order, false otherwise. This function is necessary to avoid printing duplicates. Also, note that main should return int, not void, and that the header's name is "iostream", not "iostream.h" in a standard implementation. I'd drop that conio.h and clrscr stuff too, it's not part of the C++ standard. And I would write a less ambiguous prompt (it is not clear if the intended range is 1..21 or 2..20). --NorwegianBlue talk 16:17, 1 January 2009 (UTC)[reply]

Thank you very much. I'll write the functions and rewrite the program and tell you the result. But, I have one question,why should main have return type void? Happy new year, and THANK YOU! Zebec 17:17, 1 January 2009 (UTC)[reply]

This is indeed very tricky. The technical name for what you are trying to do is list all the partitions of a number, and the study of integer partitions requires some deep mathematical hoodoo. Some googling turned up this paper (warning, pdf) describing a number of algorithms for figuring it out. I haven't read it (it's not my homework!), so I can't testify to the quality of the article. Belisarius (talk) 16:26, 1 January 2009 (UTC)[reply]
Fixed redlink in Belisarius' post. Good to hear it is tricky, I was unable to come up with anything smart. But the brute force approach that I suggested will do the job. --NorwegianBlue talk 16:43, 1 January 2009 (UTC)[reply]
You actually posted in between me clicking "edit", writing my answer, and clicking "save page", so I didn't see your excellent little piece of code, it just posted my answer after yours :). I didn't have the energy to work it out myself (I could have! I promise! I'm smart, dammit!) so I'm glad you did :) Belisarius (talk) 23:45, 1 January 2009 (UTC)[reply]
For n=4, didn't you miss the solution {1,1,2} ? StuRat (talk) 16:53, 1 January 2009 (UTC)[reply]

StuRat, you're right. Thanks for pointing out the glitch. I've made the change.Zebec 17:17, 1 January 2009 (UTC)[reply]

Zebec, main should return int, because the C++ standard says so. See Here, from Bjarne Stroustrup's FAQ. --NorwegianBlue talk 17:35, 1 January 2009 (UTC)[reply]

I see. And, by write_array you mean displaying all the elements of the array, right? Zebec 17:52, 1 January 2009 (UTC)[reply]

Yes. --NorwegianBlue talk 18:00, 1 January 2009 (UTC)[reply]

Which brand of BIOS is used by recent Toshiba, Dell, Hewlett-Packard laptops

edit

Which brand of BIOS is used by recent Toshiba, Dell, Hewlett-Packard laptops? Thanks! --Masatran (talk) 13:45, 1 January 2009 (UTC)[reply]

Dell generally user their own BIOS. 87.113.3.217 (talk) 14:03, 1 January 2009 (UTC)[reply]
You'd pretty much have to see the computer booting up to know, since major manufacturers get their parts in batches and the supplier of each batch can change. (i.e. a certain model of laptop might not have the same BIOS as a near identical laptop.) Despite what the member above states, Dell doesn't make their own BIOS. They simply license and brand it from one of the major vendors. Major BIOS vendors include American Megatrends (AMI), Insyde Software, and Phoenix Technologies. You'll probably see one of the vendors mentioned in the first screen when powering up, assuming the splash screen isn't enabled (the one that hides the POST checks). If you don't, but you do see a version number somewhere, grab it and check it our with google, along with "BIOS". (Use the pause button to give you time to write the number down, it'll probably be quite long (20-30 alphanumerics.) Hope this helps! --EvilEdDead (talk) 05:13, 3 January 2009 (UTC)[reply]
Dells have a modified Phoenix bios, except in the super-cheapo models which are essentially unmodified (except the boot logo). IIRC, HPs have Phoenix too. -- Fullstop (talk) 05:31, 3 January 2009 (UTC)[reply]

sprtcmd.exe and LIBEAY32.dll

edit

I have a Dell Inspiron 1520 laptop. For a few months now, everytime I turn on my computer, two error boxes pop up with a title of

sprtcmd.exe: LIBEAY32.dll not found. Please reinstall the program.

What program does this belong to? I think it is one of my Dell components, but how do I figure out which one to reinstall without trial and error? —Preceding unsigned comment added by 156.34.89.130 (talk) 14:52, 1 January 2009 (UTC)[reply]

It's the "Support and Command Center." Disable it: Start --> Run... --> msconfig --> Startup. One of my customers complained about it, too. It's safe to disable.--Djnghfg (talk) 16:00, 1 January 2009 (UTC)[reply]

Anitlog in C++

edit

How can I find the antilog of a number in c++? Pseudocode will also do. --Seraphiel (talk) 15:35, 1 January 2009 (UTC)[reply]

You mean the value of the power  ? Some languages have a specific function for that, e.g. in Delphi you could write math.power(a, x). If no such function exists, you can use the fact that
 
so that you can use exp(x * ln(a)), where exp and ln surely can be found in any language. --Andreas Rejbrand (talk) 15:45, 1 January 2009 (UTC)[reply]
In C/C++, the appropriate function is pow(x,y), which returns xy for input and output of type double. This is defined in <math.h>, or in C++ in <cmath>. If you don't want to do it like that, or don't have a math library, you could use the formula for ex, continuing until the xn/n! term is sufficiently small:
ex= 1+ x/1! + x2/2! + ... + xn/n! + ...
For alternative formulas, see Representations of e. If you want the antilog to a base of other than e, you can use the identity
(ab)c = abc
in the case where ab = your desired base and a=e.--Maltelauridsbrigge (talk) 16:01, 1 January 2009 (UTC)[reply]
If you are referring to the base-e exponential function, then simply exp(x) is what you are looking for. --Andreas Rejbrand (talk) 17:11, 1 January 2009 (UTC)[reply]

Thanks for pouring in with help, guys! I wanted a general purpose answer for any given base. Got it now. Thank you.--Seraphiel (talk) 20:39, 2 January 2009 (UTC)[reply]

Cheap Blu-Ray player for PC ?

edit

Does anyone have an inexpensive Blu-Ray player for PC they would recommend ? I'd use it in Windows XP or, if possible, under Puppy Linux. An internal drive is probably cheapest, but an external USB drive or a standalone unit for TV could also work. StuRat (talk) 17:09, 1 January 2009 (UTC)[reply]

You'll find playing Blu-Ray on Linux difficult and vexing. Here is how Ubuntu says to do it (puppy should be much the same); you have to rip the disk to your hard disk (using a key you get off the internet) before playing. The newer disks have updated DRM which means that you can't get the required keys (yet). THings on XP won't be much better - because XP (unlike Vista) doesn't implement the secure-data-path/secure-driver-model stuff, official software players will downgrade the quality of the video they output (so much so that you'd be wasting your time switching to blu-ray). 87.113.3.217 (talk) 21:38, 1 January 2009 (UTC)[reply]
Also, a continuing shortage of blue laser diodes is keeping the prices of all BluRay drives kinda high. Player-only drives are getting a bit cheaper - but BluRay writers are still costing an arm and a leg. SteveBaker (talk) 22:56, 1 January 2009 (UTC)[reply]
I wonder if the blue laser diode "shortage" is similar to the stockpiling of diamonds to keep the prices up. Buy stock now people. DaRkAgE7[Talk] 01:17, 4 January 2009 (UTC)[reply]

Trouble Installing MediaWiki

edit

i'm having trouble installing mediawiki on my webpage, which i'll call foo.org for anonymity

  • i'm following the instructions at [3] and [4] exactly. for my mysql databases, i'm using another website which uses phpmyadmin.
  • the folder which i uploaded has been unzipped and named "wiki" so that it is located at www.foo.org/wiki
  • within wiki, config has ben chmodded as 777.
  • within my browser, i navigate to http://www.foo.org/wiki/config/index.php
  • right after i fill out the form fields and click the "install mediawiki!" button, the browser takes a while, and then gives me a page whose contents i have pasted below

Thanks, --VectorField (talk) 17:22, 1 January 2009 (UTC)[reply]

 MediaWiki 1.13.3 Installation

    * Don't forget security updates! Keep an eye on the low-traffic release announcements mailing list.

 Checking environment...

 Please include all of the lines below when reporting installation problems.

    * PHP 5.2.6 installed
    * Found database drivers for: MySQL SQLite
    * PHP server API is cgi-fcgi; using ugly URLs (index.php?title=Page_Title)
    * Have XML / Latin1-UTF-8 conversion support.
    * Session save path (/tmp) appears to be valid.
    * PHP's memory_limit is 90M.
    * Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
    * Found GNU diff3: /usr/bin/diff3.
    * Found ImageMagick: /usr/bin/convert; image thumbnailing will be enabled if you enable uploads.
    * Found GD graphics library built-in.
    * Installation directory: /home/foo/foo.org/wiki
    * Script URI path: /wiki
    * Installing MediaWiki with php file extensions
    * Environment checked. You can install MediaWiki.
post re-formatted slightly - IMSoP (talk)
I'm not clear what you're saying the problem is - the text you pasted appears to be a success message from the first part of the web-based installer. Are you saying that this text appears a second time after you have filled out the form? Does the form also reappear, or is this the only text on the page? If the form is there, have you looked through to see if there are any messages telling you to correct missing or invalid entries? If it's not, is there any indication that there might have been a server error (e.g. in Apache error logs)? - IMSoP (talk) 17:36, 1 January 2009 (UTC)[reply]
Yes, it is as i wrote it - this success message appears (again) after i fill out the form and click the button, and it appears duplicated, with nothing else (such as an explanatory error message) on the page.
Regarding the error logs, I have quite a lot that are like the three here: [Thu Jan 01 09:13:29 2009] [error] [client xx.xxx.xx.xxx] File does not exist: /home/myname/foo.org/favicon.ico
[Thu Jan 01 09:13:29 2009] [error] [client xx.xxx.xx.xxx] File does not exist: /home/myname/foo.org/missing.html

[Wed Dec 31 15:50:18 2008] [crit] [client xx.xxx.xx.xxx] (13)Permission denied: /home/myname/foo.org/wiki/config/.htaccess pcfg_openfile: u$

--VectorField (talk) 18:01, 1 January 2009 (UTC)[reply]
Ah, figured it out. It was a problem with the mysql server. thanks, --VectorField (talk) 20:48, 1 January 2009 (UTC)[reply]
Your domain was showing in that MediaWiki message - I've edited it out for you. :) --saxsux (talk) 09:43, 7 January 2009 (UTC)[reply]

World of Warcraft question

edit

I would like to be able to play wow at the highest possible settings. what would be an ideal computer build to be able to run WoW at the highest settings while maintaining about 30 FPS. (like what kind of processor / video card / amount of ram and such) Thank you 69.62.151.224 (talk) 19:53, 1 January 2009 (UTC)[reply]

An expensive computer. I am not an expert, but if you buy a new Dell with a power supply of perhaps 1 kW, a quad-core processor, 4 GB of RAM and one, or perhaps two (via crossfire (?) or any similar method), expensive ATI or nVidia GPU:s, then you will get an astonishing performance. Don't forget to buy a > 21" widescreen LCD and at least a 2.1 sound system as well. --Andreas Rejbrand (talk) 21:49, 1 January 2009 (UTC)[reply]
Really? I'm not that familiar with how WoW actually performs these days (I haven't played the game in, what, two or three years now), so it's entirely possible that the latest updates really require a lot more oomph if you intend to run the game in all its glory, but still. I mean, does the high end really get that high? You're talking about a system that could run Crysis pretty well, and WoW certainly can't approach those visuals, no matter how high you crank those settings. Or, to put it differently, is WoW that much of a resource hog? (I'm not trying to be contrary, I'm honestly asking, 'cause I'd like to know.) -- Captain Disdain (talk) 00:09, 2 January 2009 (UTC)[reply]
Currently, I play WoW on a self-built system using an EVGA 680i motherboard, Intel Q6600 2.4GHz processor overclocked to 3.6GHz, EVGA GeForce GTX260 Core 216, 4GB of OCZ PC2-8500 RAM and a 650w Silverstone power supply. I get a constant 60 frames per second (VSync locked) throughout all parts of the game at a monitor resolution of 1600x1050. The system is complete overkill for WoW, you certainly don't need as fast a CPU or video card to play it with all the settings maxxed out using the settings interface. I do recommend that you have at least 2GB of RAM if you're playing it using Windows Vista, as I do. I've actually tweaked the WoW video settings higher than you can configure them from the settings interface, while still maintaining 60 frames per second. The settings I use are below, applied in-game. These make a major difference to the appearance of the game, but will cause frame rate issues with slower systems. Note that these settings are only applicable when you have the Wrath of the Lich King expansion installed.
/console overridefarclip 1
/console farclip 1600
/console horizonfarclip 6226
/console groundeffectdensity 256
/console groundeffectdist 140
/console smallcull 0
/console skycloudlod 3
/console characterAmbient
/console extshadowquality 4
/console environmentDetail 2
Hope this helps! --Chasingsol(talk) 03:15, 2 January 2009 (UTC)[reply]

Program to print number combinations: Suggestions incorporated, but, this time, no output!

edit

I made the changes NorwegianBlue asked me to, here's the code, but, there's no output. I'd love to know where I went wrong! (<include> didn't work on Turbo C++ 4.5, which is the version I use)

//program to print number combinations
#include<iostream.h>
void main()
{int i=0,n=0,arr[25];
void doit(int arr[], int len, int n);
int sum_of_array(int arr,int len);
void write_array(int arr,int len);
int descending_order(int arr[],int len);
for(i=0;i<5;i++)
{cout<<"Enter a number greater than 1 and less than 21"<<endl;
cin>>n;
if(n>1&&n<21)
break;
else
continue;}
doit(arr, 0, n);
}
int sum_of_array(int arr[],int len)
{int i=0,sum=0;
for(i=0;i<len;i++)
sum=sum+arr[i];
return sum;}
void write_array(int arr[],int len)
{int i=0;
for(i=0;i<len;i++)
cout<<arr[i]<<" ";}
int descending_order(int arr[],int len)
{int i=0,flag=0;
for(i=0;i<len;i++)
{if(arr[i]>arr[i+1])
continue;
else
{flag=1;
break;}}
if(flag==1)
return 2;
else
return 1;}
void doit(int arr[], int len, int number)
    {
        int sum = sum_of_array(arr, len);
        int maxval = number - sum;
 
		  if ((maxval == 0) && (descending_order(arr, len)==1) && (len > 1))
        {
            write_array(arr, len);
        }
        else if (maxval > 0)
        {
            for (int i = 0; i < maxval; ++i)
            {
                arr[len] = maxval - i;
                doit(arr, len+1, number);
            }
        }
	 }

And, I'm a bit confused about the function of the array arr[]. What does it store, exactly? Thanks for your help (though I still need more! ^_^) Zebec 18:32, 1 January 2009 (UTC)[reply]

And, even more importantly, if you format your code to make it readable, it is easier to spot errors. There are three things that need to be fixed.
  1. Your write_array function should write an end-line character before exiting.
  2. In your descending_order function, the index i goes one past the end of the array, when you access element arr[i+1]. The termination criterion in the loop should have been i<len-1, since you are accessing element i+1.
  3. In the body of your descending_order function, the test should be (arr[i]>=arr[i+1]), greater than or equal, otherwise partitions such as {2,2,1} will be skipped.
Apart from the errors, your descending_order function is quite awkward, with the flag, and the "magic" integer return values instead of booleans. Even if your compiler hasn't implemented booleans, I'm pretty sure it has macros for BOOL, TRUE and FALSE. My version looks like this:
    bool descending_order(int arr[], int len)
    {
        for (int i = 1; i < len; ++i)
        {
            if (arr[i-1] < arr[i])
            {
                return false;
            }
        }
        return true;
    }
As for the contents of the array, it'll be easier to understand when you've got the program working. Here's the output of my version of the program:
Enter a number in the range 2..20
5
Partitions:
4 1
3 2
3 1 1
2 2 1
2 1 1 1
1 1 1 1 1
The array contains the integers that you see printed, as well as many other combinations that are not printed, because they fail the test
if ((maxval == 0) && descending_order(arr, len) && (len > 1))
To understand the program better, you could try moving the write_array statement from inside the if-test, to above it, like so:
    void doit(int arr[], int len, int number)
    {
        int sum = sum_of_array(arr, len);
        int maxval = number - sum;

        write_array(arr, len); // ** JUST TESTING
        if (maxval == 0 && descending_order(arr, len) && len > 1)
        {
            //write_array(arr, len); ** MOVED **
        }
        else if (maxval > 0)
        {
            for (int i = 0; i < maxval; ++i)
            {
                arr[len] = maxval - i;
                doit(arr, len+1, number);
            }
        }
    }
Then you'll get a print-out of all combinations that have been generated. --NorwegianBlue talk 19:39, 1 January 2009 (UTC)[reply]

Zebec's real-life friend here. Our school hasn't taught us boolean functions in C++ which is why we aren't supposed to be using them in our programs. We have to use cumbersome alternatives instead.And in our version of Turbo C++ 4.5, the <iostream> header doesn't work if we don't specify the ".h" part. I tried out a code based on the one you've given, but different from Zebec's. It didn't work either. Can you help us out, please? That doesn't neccessarily mean giving us the completed code..... La Alquimista 10:40, 2 January 2009 (UTC)[reply]

If your teacher insists on your using "magic" return values, like 1 and 2 in the code above, instead of TRUE and FALSE, I'd say your teacher needs some re-education, and that might explain the rather odd coding style of the program posted. Most C++ programmers declare and initilalize a variable at the point where it's needed, and usually one variable at a time (one variable per line). Stuff like the
                  int i=0,n=0,arr[25];
in Zebec's code reads more like C than C++ to me. And putting the prototypes of the program's functions within main is also unusual (you would normally put these at the top of the file, right after the include statements, or in a separate header file).
You didn't specify how your program failed, but if it simply produced no output, focus on the if-statement:
if (maxval == 0 && descending_order(arr, len) && len > 1)
My guess is that the error is in the descending_order function.
Did you try fixing the three errors that I pointed out in Zebec's code, and compile the program? I did, and it worked. --NorwegianBlue talk 14:16, 2 January 2009 (UTC)[reply]

Yes,I made the changes you asked me to in my program, and it worked! Thank you SO much. I owe you one! Zebec 15:44, 2 January 2009 (UTC)[reply]

Yeah. I ran the corrected program just now. It's working fine, but there's just an extremely small glitch. The output is arranged in a manner that's just the opposite of the one given.... But I don't think that matters. Thank you so much NorwegianBlue.

P.S And as for the "re-education" part... Oh ha ha.....!

La Alquimista 16:31, 2 January 2009 (UTC)[reply]

You're very welcome, both of you!
If you want the printout to be in the format {1,2,2} instead of {2,2,1}, replace the function descending_order with an analogous function ascending_order.
If you want {1,1,1,1,1} to be listed before {1,1,1,2}, change the for-loop in doit to
for (int i = maxval-1; i >=0; --i)
Some final pieces of advice:
  • When you write a function, always write some temporary code to test that it works as expected, before proceeding. The descending_order function of Zebec never returned TRUE, because of an off-by-one error - it tested the final element of the array against whatever garbage was sitting in memory one past the end of the array.
  • When a program doesn't do what you expect it to, walk through it with a debugger if you have access to one, or add print statements at critical points in the program, so that you can figure out where the error is occurring.
  • Since this is homework: the important thing for you is not just to get the program working, but to understand WHY it works. Recursion is a tricky concept to grasp. Add some print statements (write_array) etc, and play with the program until you understand it.
  • Suggest to your teacher that you switch to a less ancient C++ compiler. There are several free ones, Microsoft Visual C++ 2008 Express, gcc, MingW and others. --NorwegianBlue talk 18:31, 2 January 2009 (UTC)[reply]

Are there any implementations of the Three pass protocol that offer authentication? --Melab±1 21:17, 1 January 2009 (UTC)[reply]

Facebook - is it down?

edit

Is it me or is Facebook down at the moment? I can access the page that asks for my login details but when I put them in and submit, I get an error page after a few seconds - on Firefox it says "The operation timed out when attempting to contact login.facebook.com." and in Internet Explorer I don't even get that far - it says:

The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

I can ping www.facebook.com but not login.facebook.com -


Pinging www.facebook.com [69.63.184.142] with 32 bytes of data:

Reply from 69.63.184.142: bytes=32 time=121ms TTL=245 Reply from 69.63.184.142: bytes=32 time=120ms TTL=245 Reply from 69.63.184.142: bytes=32 time=121ms TTL=245 Reply from 69.63.184.142: bytes=32 time=120ms TTL=245

Ping statistics for 69.63.184.142:

   Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

   Minimum = 120ms, Maximum = 121ms, Average = 120ms

Pinging login.facebook.com [69.63.178.23] with 32 bytes of data

Request timed out. Request timed out. Request timed out. Request timed out.

Ping statistics for 69.63.178.23:

   Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

TRACERT gives the following results but I don't know exactly what they mean. It looks to me like the request has not made it beyond the Entanet (my ISP) servers.


Tracing route to www.facebook.com [69.63.184.142] over a maximum of 30 hops:

 1     *        *        *     Request timed out.
 2    34 ms    32 ms    32 ms  lns02.inx.dsl.enta.net [78.33.38.134]
 3    32 ms    32 ms    32 ms  gi4-47.interxion.dsl.enta.net [78.33.38.133]
 4    32 ms    32 ms    32 ms  te2-3.interxion.core.enta.net [87.127.236.209]
 5    33 ms    32 ms    33 ms  te5-1.global-switch.core.enta.net [87.127.236.85

]

 6     *        *        *     Request timed out.
 7     *        *        *     Request timed out.
 8     *        *        *     Request timed out.
 9   121 ms   121 ms   121 ms  te-9-1.csw03b.ash1.tfbnw.net [204.15.23.87]
10   121 ms   121 ms   121 ms  www.05.03.ash1.facebook.com [69.63.184.142]

Trace complete.


Tracing route to login.facebook.com [69.63.178.23] over a maximum of 30 hops:

 1     *        *        *     Request timed out.
 2    32 ms    43 ms    33 ms  lns02.inx.dsl.enta.net [78.33.38.134]
 3    33 ms    32 ms    32 ms  gi4-47.interxion.dsl.enta.net [78.33.38.133]
 4    32 ms    32 ms    32 ms  te2-3.interxion.core.enta.net [87.127.236.209]
 5    34 ms    32 ms    32 ms  te5-1.global-switch.core.enta.net [87.127.236.85

]

 6     *        *        *     Request timed out.
 7     *        *        *     Request timed out.
 8     *        *        *     Request timed out.
 9     *        *        *     Request timed out.
10     *

Please note I can access all other websites (well those that I have tried today anyway) without a problem. I don't think it's my PC as I cannot access Facebook on my laptop either (which connects to the same internet router). My ISP's status page indicates that there are nmo problems. Any suggestions? —Preceding unsigned comment added by 62.249.220.179 (talk) 21:50, 1 January 2009 (UTC)[reply]

Fine here. Algebraist 21:52, 1 January 2009 (UTC)[reply]
Hmmn strange. It isn't just Facebook either as www.yoomedia.co.uk causes exactly the same error. Is there something these two websites have in common that could be causing me problems? If so, it must be a problem with Windows XP or my AVG antivirus software as I can't think of anything else that my PC and laptop have in common. —Preceding unsigned comment added by 62.249.220.179 (talk) 22:06, 1 January 2009 (UTC)[reply]
if they share the same internet connection it could be that. No problem with facebook for me but yoomedia.co.uk gives me a "You don't have permission to access / on this server" error. —Preceding unsigned comment added by 82.43.88.87 (talk) 23:58, 1 January 2009 (UTC)[reply]

Recycle bin

edit

I read somewhere a while ago that deleting something from the recycle bin does not truly delete it. If this is true, how do I truly delete something from my computer? I have Windows Vista if that matters. 75.169.208.225 (talk) 21:57, 1 January 2009 (UTC)[reply]

See data remanence. Algebraist 22:02, 1 January 2009 (UTC)[reply]

'Deleting' an item from your Recycle Bin doesn't actually delete it - it just marks the space that was taken up by that item as free for use for new files. You can get software that properly deletes files by overwriting the space on the disk with 1s and zeroes - if you Google for 'Freeware delete' you should get some good results. —Preceding unsigned comment added by 62.249.220.179 (talk) 22:04, 1 January 2009 (UTC)[reply]

Really, really, really deleting something is tricky.
  1. When you delete a file, it merely moves it into the wastebasket. Getting it back is easy.
  2. When you empty the wastebasket, it marks the space used by the file as 'free' and removes the directory entry for it. Getting it back is possible with an 'undelete' program so long as nothing re-used that empty space in the meantime. This might mean that the file can still be undeleted months or years later - or it might make it impossible to undelete 30 seconds later - it depends on how much you use your PC, where the file happened to be on disk, how full your drive is...who knows?
  3. Some files may have been temporarily stored in 'cache' files or may have been placed into 'swap space' on your hard drive. Getting rid of the data for email you've received (for example) may be tough for that reason. You think you've removed the file - but the data is still there in some other place on the drive.
  4. When the drive detects that a sector has 'gone bad' - it'll use another disk sector instead. The data on the 'dead sector' is still there and may be read by a sufficiently determined person!
  5. But even when the file has been completely overwritten in every possible place on the drive where it might ever have lived...a forensic analysis of the hard drive may be able to recover data from the file in one of two ways:
    • When you overwrite a file which has a binary data pattern that goes (say) 1,0,1,0,1,0 with a new pattern that's (say) 1,1,1,0,0,0 - what happens is that where a '1' is overwritten by another '1', you get a perfect '1' written into the magnetic media - and when a perfect 0 is overwritten with a 0 you get a perfect 0. But when a '0' is overwritten by a '1', the result may not be a perfect '1' - it might only be an '0.99' and when a '1' is overwritten with a '0' you might get an 0.01 on the disk. When the hard drive sees a value that's not quite a 1 or is a bit more than a 0, it just says "close enough!" and everything works OK. But a forensic lab can measure the actual voltages that come out of the drive head and compare that to the data that the drive reads (1,1,1,0,0,0 in this case) with the actual analog voltages (1,0.99,1,0,0.01,0 in this case) - and by subtracting one from the other, discover which bits were changed when the data was overwritten - and thereby recover the overwritten file.
    • Because the disk head doesn't follow the EXACT same path across the disk every time the disk rotates. So if the file was originally written when the head was moving a bit further out than usual - and was overwritten when the head was moving a bit further in than usual - then there could be a thin strip of your original file still there on the hard drive. There is no way to get that back without dismantling the drive in a clean-room and using special equipment to read the disk - but (for example) the government could do it if they had to.
Fixing the data so that even forensic labs can't read it is actually kinda tricky. There are some programs out there that will write 0's over the entire 'free' area of the drive. That prevents an 'undelete' program from getting the data back. Some of those programs write alternating '1's and '0's over the drive over and over again - which stops the first of the forensic tricks from working...but the 'mispositioned drive head' problem is harder to permenantly erase because you really can't tell whether the head has mispositioned by a small amount. In the end, using a bulk eraser (basically a big electromagnet) to wipe the entire drive - and then smashing the disk into teeny-tiny pieces is probably the only 100% certain way to get rid of data. —Preceding unsigned comment added by SteveBaker (talkcontribs)
If your only concerned with the wife finding the ebay receipt for her wedding ring, I'd suggest you try one of the programs suggested earlier. But, if your concerned with the FBI breaking down your door shortly after you hacked in to the CIA then i would suggest that you boot off of a live CD (perhaps a customized Linux distro) and have tons of ram (or a ram drive). That way simply turning off the computer will wipe everything. (at least this is what i understand) 69.62.151.224 (talk) 03:28, 2 January 2009 (UTC)[reply]
Note the FBI or another suitably financed adversary can recover data from ram even after you turn it off.121.72.202.66 (talk) 07:44, 5 January 2009 (UTC)[reply]
You can use the free program, CCleaner (http://www.ccleaner.com) available at http://www.ccleaner.com/download/builds, which provides the ability to do multi-pass deletion when you empty the recycle bin or clean up temporary files from your system. I recommend downloading the 'slim' build, which does not include the Yahoo! toolbar as part of the package, although there is an option to not install it if you download the regular version. The program also provides a registry cleaner to keep your system registry free of unneeded entries. I have used this software for years, and it has always proven to be safe. Hope this helps! --Chasingsol(talk) 03:35, 2 January 2009 (UTC)[reply]
I suspect anon is not asking how to wipe, but rather how to delete a file without it being moved to the recycle bin. The answer to that would be... "hold down the shift key when clicking/pressing 'delete'". -- Fullstop (talk) 22:45, 2 January 2009 (UTC)[reply]

Blackberry Storm videos to PC

edit

How do I upload videos I recorded on my Blackberry storm to my PC? I've connected the Blackberry to my PC via USB and cannot locate the videos anywhere. Also, the videos are too big to send to email. Thanks in advance.--Endlessdan and his problem 22:25, 1 January 2009 (UTC)[reply]

??? Worm on Wikipedia ???

edit

Okay, I know this is a false positive, but what the heck is triggering it???

Worm pic --71.117.47.248 (talk) 23:55, 1 January 2009 (UTC)[reply]

EDIT: Interestingly enough, it only appears to give the pop-up warning for the worm on the WP:RD/C page..--71.117.47.248 (talk) 00:16, 2 January 2009 (UTC)[reply]
What anti-virus is this on? There was a similar problem a few weeks ago with Norton anti-virus, see here and here. The solution was to run liveupdate once Norton had made a fix —Preceding unsigned comment added by 82.43.88.87 (talk) 00:22, 2 January 2009 (UTC)[reply]
Hmm that is rather odd. I'm running ESET's NOD32, as per the pop-up warning box. They are usually pretty good about not having false positives...wonder what's going on. I guess I'll just wait it out until it gets fixed. The weirdest part is that I can view EVERYWHERE and everything on Wikipedia except the /Computing reference desk. --71.117.47.248 (talk) 06:19, 2 January 2009 (UTC)[reply]

I use NOD32 too, and I've got the same problem..... Wonder what's going on. La Alquimista 06:24, 2 January 2009 (UTC)[reply]

Likely NOD32 is seeing some code on this page and regards it as suspicious. Most likely the code is Wikipedia:Reference desk/Computing#Virus question 2. Once the page has been archived (so it doesn't disappear and they can't find it) you may want to submit it to ESET so they can hopefully prevent this happening in the future Nil Einne (talk) 10:08, 3 January 2009 (UTC)[reply]