Wikipedia:Reference desk/Archives/Computing/2010 October 21

= October 21 =

How to remove the HD?
From one of these...  ...before disposal. Thanks, hydnjo (talk) 00:25, 21 October 2010 (UTC)
 * I know this is not the point, but are you sure you don't want to try selling one of those? They're quite sought after. Chevy  monte  carlo  06:24, 21 October 2010 (UTC)


 * Have you tried Googling "replace hard drive iMac G4"? There are quite a few tutorials. You need Torx #10 and #8 screwdrivers (which are non-standard unless you take Macs apart often, which I imagine you don't based on the question), but otherwise it looks pretty straightforward. --Mr.98 (talk) 13:50, 21 October 2010 (UTC)


 * It's possible to securely delete all the information off a hard drive before sale (or disposal or recycling). I looked at the Google cache of this (temporarily down?) page, and it has some options.  It's also possible to use dd to copy /dev/random over the entire disk a couple times, which should be more than sufficient.  You'd need a Linux live CD for PowerPC to do that, which shouldn't be hard to make.  Paul (Stansifer) 18:21, 21 October 2010 (UTC)


 * Thanks to all for your suggestions. hydnjo (talk) 22:36, 22 October 2010 (UTC)

C: Pointers to Pointers and other Pointer Issues
I'm really kind of confused with pointers in C. Let's say you malloc a blob of memory:

void * blob = malloc(sizeof(char *) + sizeof(int));

and you use the blob to hold two things like this:
 * a char * | integer value |

so blob would point to the memory adress of the beginning of the blob of malloc'd memory.

If you made a pointer to point to it:

void * pointToBob = bob;

Could you use bob and pointToBob interchangeably?

Or what if you had

void ** pointToBob = bob;

How could you used that?

I'm confused how you could possibly use a pointer to a pointer to change a value in the originally malloc'd blob. I'd appreciate any help with this problem and any sort of general explanations on the questions of pointers. I feel like I don't understand much more than "a pointer holds an adress to a place in memory". Thank you very much :) —Preceding unsigned comment added by Legolas52 (talk • contribs) 00:58, 21 October 2010 (UTC)


 * Am I safe in assuming that bob/Bob is everywhere a typo for blob/Blob? Assuming yes, the answer is that   makes pointToBlob have the same type and value as blob.  However,   will give you a compile warning, because a pointer to a pointer is not the same type as a pointer.  But a more basic problem is that your malloc line is a thing that ought not to be done.  In some systems, the "int" type must be aligned in a specific way in memory space, so it may not be possible to store an int at the place you think you are going to store it.  This is simply bad code.  Even if it works, referring to things in memory that has been allocated in this way is so ugly that I'm not even going to try to write it.  If you want to store multiple different things in a single block of memory, create a struct to hold them. Looie496 (talk) 01:23, 21 October 2010 (UTC)


 * As Looie said, your malloc statement is not a permissible way to allocate a pointer and an int, because of alignment restrictions; trying to access the int might crash your program.


 * However,  is legal C and won't produce a warning, because C allows   to be implicitly converted to any other pointer type (though C++ doesn't). There's no deep logic to this; it's just a special exception intended to make   easier to use. The result of this definition will be that   will point to the same memory block as   does, except that it will "think it's pointing to" a  . You could then store a   into the memory block through that pointer, even though you allocated space for a , because those pointer types happen to be guaranteed to have the same size. But that's probably not what you intended. If you wanted a pointer to the   variable itself (which is a different thing from the memory you allocated), then you should have written   instead of.


 * Basically, the rules for pointers are straightforward: if you say  then you get a value that points to , if you say   in an expression then you get the value of whatever   points to, and if you say   then you change the value of whatever   points to. For example, if you wrote  , then   would be the same as   (they both write the result to the   variable). But if you wrote   and then  , you would be assigning to the variable  , which is a different variable from  , so   would remain unchanged. Although those rules are simple, they're hard to think about. The reason seems to be that human beings are not good at separating the name of something from the thing itself. For example, what does   mean? Do you intend it to point to the variable named "blob", or are you thinking of the memory you allocated as the "blob" that it points to? This kind of ambiguity is what makes pointers difficult. The good news is that it gets easier with practice. -- BenRG (talk) 02:16, 21 October 2010 (UTC)


 * As has been said, you can't use a pointer to point to both a  and an   like that. You can, however, do it like this:

struct mystruct {  char *p; int i; }; struct mystruct *blob = malloc(sizeof(struct mystruct));
 * You can then use  and   to refer to the   and   values, assuming the   succeeded. You can easily check this, because if   fails, the resulting value will be a null pointer.  J I P  &#124; Talk 12:09, 21 October 2010 (UTC)


 * Pointers really come into their own when you use them to point to arrays of dynamic size (although other structures and uses are also important). Consider this (not production-quality) code:


 * Fundamentally, pointers let you access something that you get to choose (at runtime if you like). There are several reasons to choose things at runtime:


 * Except for #3 (which is just the opposite of #4), we used all of these in the examples I gave. Another way of looking at it is that there are only three things that can go on the left side of an assignment:
 * A (non-array) variable name:
 * A part of a struct:
 * A dereferenced pointer:
 * Without the third choice, the struct would itself have to be a variable name or a member of another struct, so all you would get would be, which is not very interesting.  The third choice gives all kinds of possibilities because dereferencing a pointer can give you another pointer or a struct as well as a normal variable:   (because that's  ),   (because that's  ),  , etc.
 * I hope this long ramble ("general explanation") helps; I find that the usual introductions to pointers (like ) are so anemic that they prevent seeing the true utility of the subject.  --Tardis (talk) 15:09, 21 October 2010 (UTC)

Thanks for all of your replies! The one thing I kept seeing over and over was that I must use a struct to access this info, can't I do this instead?:

void * blob = malloc(sizeof(char *) + sizeof(int));

char * blobChar = blob;

int * blob = blob + sizeof(char *); //since the integer is 4 bytes after the char *

—Preceding unsigned comment added by Legolas52 (talk • contribs) 21:40, 22 October 2010 (UTC)
 * I think you meant


 * It might work, but it might also crash, or summon the nasal demons (and the answer will depend on the machine you try it on). (Also, who said that   everywhere?)  The struct, as a language construct, exists so that this can be handled properly by the compiler.  It also requires less typing and is more readable:   &hellip;and that's it!  We now already have s->str and s->len with no further work.  --Tardis (talk) 23:32, 22 October 2010 (UTC)
 * One reason why that might not work is that some systems require pointers of a certain type to be aligned at specific intervals in memory, such as addresses divisible by 2 or by 4. In your case above, you might end up with a misaligned pointers. By using a struct, the compiler guarantees that the addresses of the members are aligned, by inserting padding bytes between them if it has to. J I P  &#124; Talk 07:42, 23 October 2010 (UTC)

compiling emacs
Hello. I am trying to compile emacs 23.2. After a successful ./configure, make gives me the following:

PS223:~/Downloads/emacs-23.2% make cd lib-src; make all                           \ CC='gcc' CFLAGS='-g -O2 -Wdeclaration-after-statement -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE  ' \ LDFLAGS='-Wl,-znocombreloc ' MAKE='make' make[1]: Entering directory `/home/rksh/Downloads/emacs-23.2/lib-src' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/rksh/Downloads/emacs-23.2/lib-src' boot=bootstrap-emacs;                        \ if [ ! -x "src/$boot" ]; then                                    \ cd src; make all                                   \ CC='gcc' CFLAGS='-g -O2 -Wdeclaration-after-statement -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE  '         \ LDFLAGS='-Wl,-znocombreloc ' MAKE='make' BOOTSTRAPEMACS="$boot"; \ fi; cd src; make all                           \ CC='gcc' CFLAGS='-g -O2 -Wdeclaration-after-statement -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE  ' \ LDFLAGS='-Wl,-znocombreloc ' MAKE='make' BOOTSTRAPEMACS="" make[1]: Entering directory `/home/rksh/Downloads/emacs-23.2/src' make[1]: *** No rule to make target `/usr/local/include/gtk-2.0/gtk/gtk.h', needed by `dispnew.o'. Stop. make[1]: Leaving directory `/home/rksh/Downloads/emacs-23.2/src' make: *** [src] Error 2 HPS223:~/Downloads/emacs-23.2%

What is going on here? It looks like there needs to be a rule to make gtk.h, but this can't be right? Anyone got any idea how to get round this? Thanks, Robinh (talk) 08:58, 21 October 2010 (UTC)


 * have you installed the gtk development headers? (Or configure without gtk). The package is normally called gtk-dev (debian/ubuntu etc) or gtk-devel (redhat/mandrake etc). CS Miller (talk) 10:47, 21 October 2010 (UTC)
 * Thanks for this. I am on SuSe 11.3, and YAST isn't particularly clear (there are lots of gtk-type options, but checking them results in an incompatibility warning.  How do I tell whether gtk-dev is installed?  Thanks, Robinh (talk) 11:03, 21 October 2010 (UTC)
 * I've never used YaST, so I'm not sure how to check what packages are installed with it. However, this seems to be a useful guide. The package you want is probably called libgtk-dev / libgtk-devel, now that I think about it. CS Miller (talk) 11:42, 21 October 2010 (UTC)
 * Got it! .  Cheers, Robinh (talk) 11:54, 21 October 2010 (UTC)


 * Hmm, this really shouldn't have happened. The autoconf script that wrote configure should check for gtk headers (and version), and indeed when I configure emacs on Ubuntu I see it checking gtk headers, libraries, and associated things like Pango, Cairo, and Freetype. If these aren't found, or are of the wrong versions, it should be be configure that fails, not the make. If you can reproduce this on a fresh install of SuSe, that's a notifiable bug in the configure.in script. -- Finlay McWalter ☻ Talk 13:18, 21 October 2010 (UTC)
 * Hello Finlay. I too thought that configure would find any problems.   The behaviour is not reproducible, following a 'make clean' which may have cleared out some problem file somewhere.  Best wishes, Robinh (talk) 13:36, 21 October 2010 (UTC)

Minor problem with my LG Flatron
OK, so I've been having some non-critical yet annoying problems with my LCD display (a Flatron W1934S, to be specific). The overall image appears fine, but there are some wavy patterns jizzing up on my screen, which can be seen especially on a dark background. Is it because of an unstable AC connection or something? Blake Gripling (talk) 10:35, 21 October 2010 (UTC)


 * Noisy AC connection (perhaps from an electric motor on the same ring), loose AC connection, loose or damaged video cable, or source of RF interference near the display or the video cable. -- Finlay McWalter ☻ Talk 11:34, 21 October 2010 (UTC)
 * Apart from the above, and don't ask me how it works... but try adjusting your contrast. I had the same problem with a Dell monitor. Sandman30s (talk) 14:31, 21 October 2010 (UTC)
 * So to avoid interference, place any wireless emitting devices away from the monitor, and make sure that there are not that mucgh intercerence from devices from the cables to and from your computer and monitor. See if that helps. Sir Stupidity (talk) 21:37, 21 October 2010 (UTC)

Blackberry 9500 Storm
Hi, I have my phone blacberry 9500 storm, was using zero line of france, turkey, I'm staying on the contract has expired, other operators çalıştıramadığımdan, mep2 code entered incorrectly 10 times, mep2 does not turn on, I can not enter the MEP code. please help. Thank you.

my adres= [email removed] —Preceding unsigned comment added by 88.224.127.41 (talk) 13:23, 21 October 2010 (UTC)


 * I've removed your email address, to prevent you getting spam on it. People will answer here, not by email. -- Finlay McWalter ☻ Talk 13:32, 21 October 2010 (UTC)


 * I expect it's not likely to be easy . It's usually a rather bad idea to hit the limit with phone unlock codes. If you haven't actually entered the MEP2 code incorrectly 10 times then I'm not sure what's wrong. It may be worth calling your operator. As your contract has expired, they may be willing to provide any unlock codes for free perhaps even with instructions. BTW just to emphasise you should stop typing anything in until you know what to do Nil Einne (talk) 05:52, 22 October 2010 (UTC)

tsql
Hi! Why doesn't exist the 'end tran' keywords? the rollback statement must always immediatly follow the trasnsaction to rollback? t.i.a. --217.194.34.103 (talk) 14:47, 21 October 2010 (UTC)
 * The database would have to store the state it was in before the transaction, and it gets too hard with several transactions that may be modifying the same data. So it just sticks to the latest one. Graeme Bartlett (talk) 21:11, 25 October 2010 (UTC)

motherboard
where is the rt clock and how the quartz is deformed in order to produce the regular square wave? t.i.a. --217.194.34.103 (talk) 14:50, 21 October 2010 (UTC)
 * The real time clock can be positioned anywhere on the board, and may be integrated to some other ASIC on the board. Our article lists some examples; you can check your motherboard for one of those chips.  You might want to read crystal oscillator; the quartz is an electromechanical resonator in the form of a piezoelectric crystal.  Nimur (talk) 15:22, 21 October 2010 (UTC)
 * thank you, I read "When the field is removed, the quartz will generate an electric field as it returns to its previous shape, and this can generate a voltage. " But thus voltage is sinusoidal or square? --217.194.34.103 (talk) 15:51, 21 October 2010 (UTC)
 * It is a complicated waveform; it is not perfectly sinusoidal because in real life, crystals are not simple harmonic oscillators; but it is really close to sinusoidal. The exact waveform shape depends on the perfection of the manufacturing process and physical properties of the crystal.  Digital systems usually need a square-wave.  For this reason, a crystal oscillator will usually be connected to an active circuit with a power source.  This circuit includes a transistor amplifier (or a more sophisticated IC) to "clip" the sine-wave into a square-wave, and often one or two external tuning capacitors.  A simple clip circuit with two diodes is shown in our article.  More complex circuits exist to shape the waveform, but for most purposes, an "approximately" square-wave signal is good enough.  The particular parameters to worry about would be the rise time and the jitter - a well-designed circuit will have a "fast" rise-time and a "small" jitter (by using a good tuning circuit and a very high gain).  Exactly how fast rise-time and how tiny the jitter will be determined by cost and requirements.  Many RTC clock ASICs will contain all/most of these analog circuit elements, plus some digital logic, internally.  Nimur (talk) 16:23, 21 October 2010 (UTC)

Internet Usage
I've just downloaded a program called NetMeter to keep an eye on my internet usage. I'm in a hotel and have a daily limit of 1&thinsp;GiB. I'm looking at the program now and my upload and download figures are increasing. Even though, to my knowledge, nothing is uploading or downloading. It says that I'm downloading 36&thinsp;KiB/sec at the moment, and that I've downloaded 21&thinsp;MiB in the last 30 minutes. Some internet sites say that 5&thinsp;GiB per month is enough to use Skype and YouTube. But according to NetMeter, I'd use 10&thinsp;GiB a month just by leaving the machine connected to the internet for six hours a day; without even watching a single video or making a single call. What's going on?! — Fly by Night  ( talk )  15:19, 21 October 2010 (UTC)
 * Why are the upload and download figures increasing when this is the only web browser I have open?
 * Does that amount of use sound plausible?
 * It's WiFi, so could that figure be the whole router's traffic and not just my laptop?


 * Consider using a system program like netstat to see what programs have open socket connections. Lots of programs use a network connection - this is very irritating if your network usage is being monitored.  netstat -b will tell you the program name for each process that has an open connection.  It's also possible that your NetMeter program has an internet connection open, and relays monitoring data to some server  Nimur (talk) 15:24, 21 October 2010 (UTC)


 * My laptop runs on Windows Vista. I've just typed netstat -b and it says that "The requested operation required elevation." What does that mean? I typed netstat -no and it returned a table whose column titles were Proto, Local Addresses, Foreign Address, State and PID. There are currently three different local addresses connected to different foreign addresses.
 * What does all of that mean?
 * Are the other local address other people using the same router?
 * Does that mean that the Netmeter stats were for the router and not just my laptop?
 * — Fly by Night  ( talk )  15:45, 21 October 2010 (UTC)
 * If you're getting 'The requested operation required elevation', try opening netstat or the cmd window if you're using that as administrator. Either right click on the program in start menu and choose 'run as administrator' or rather then pushing enter use ctrl+shift+enter. Nil Einne (talk) 15:57, 21 October 2010 (UTC)
 * Here is the Windows netstat documentation. Local address is your computer's address - specifically, which address the network socket is connecting into.  It can help you diagnose the purpose of the connection.  Foreign address is the IP of the server on the other end.  State is the socket status - which is explained here - but basically tells you if the connection is "active."  PID is the process ID for the responsible program that owns that socket; using "-b" tells you the program name so the PID is redundant (unless you are running multiple copies of the same program).  Nimur (talk) 16:40, 21 October 2010 (UTC)

Windows Update maybe? I disabled it on my computer, but I think if you have it enabled it will automatically download new updates. Also, check which network interface the program is monitoring; if it's set to "all interfaces" it could be seeing network activity which isn't related to the internet, or could be seeing double the amounts depending on your setup. 82.44.55.25 (talk) 15:55, 21 October 2010 (UTC)


 * NetMeter's network inteface is set to All interfaces (no loopback, no duplicate). I've used the netstat -b</tt> command. I had to run it as an administrator as Nil suggested. I closed down all of my windows and ran <tt>netstat -b</tt>, the only thing running in the background was justched.exe which is a Java update checker. I stopped that. Then I ran <tt>netstat -b</tt> again and nothing was accessing the internet. But NetMeter still said that I was downloading 9 KiB/sec! — Fly by Night  ( talk )  16:22, 21 October 2010 (UTC)

Sigh, for "computer experts" you're pretty incompetent. @OP; netmeter is not designed to work with wireless, so it's picking up on every network packet between your wireless adapter and the router. The excess bandwidth you're seeing is just the two devices communicating with each other. A program designed to work with wireless would filter this out. 72.95.222.173 (talk) 16:30, 21 October 2010 (UTC)
 * 72, perhaps you would like to explain what communication the device is sending to the router? If there are no open sockets, there is no IP traffic.  Are you suggesting that netmeter is capable of monitoring lower-level packets than IP (link or phy data)?  Do you have a source for that?   Nimur (talk) 16:34, 21 October 2010 (UTC)


 * That's a very good point, 72.95.222.173. It did seem far too high. — Fly by Night  ( talk )  17:28, 21 October 2010 (UTC)
 * I'm pretty sure that 72.95.222.173 is wrong. -- BenRG (talk) 05:42, 22 October 2010 (UTC)


 * While not necessarily agreeing with the OP 72, I wonder if this is being approached from the wrong way. It's been a while since I've used bandwidth monitoring programs on Windows but can't you find some which will tell you more details about what connections the bandwidth is being used on rather then the complexity of trying to working out from netstat? may work although may also be unnecessary complex for the OP Nil Einne (talk) 17:19, 21 October 2010 (UTC)
 * What have I said that you don't agree with? — Fly by Night  ( talk )  17:28, 21 October 2010 (UTC)
 * Sorry for the confusion as I was thinking about this discussion rather then the thread so by OP I meant 72. Nil Einne (talk) 19:34, 21 October 2010 (UTC)
 * P.S. Other then per IP, from memory some programs may also tell you per program which may be more useful Nil Einne (talk) 05:54, 22 October 2010 (UTC)
 * P.P.S. Just realised I used OP to refer to two different people in that comment. Oops! (Basically I was thinking of 72's comment and said OP to refer to them as I was replying to Nimur then started thinking of the general thread and said OP to refer to the real OP. Nil Einne (talk) 01:54, 24 October 2010 (UTC)

The usage graph in NetMeter has changed now that I'm using Skype. It was all red. Now there is a yellow sub-graph. It looks like the yellow is my usage and the red is something else. Maybe other people's usage or traffic between my computer and the router. I've just ended the call and the yellow part has vanished. Does anyone have any idea how to change the settings? — Fly by Night  ( talk )  19:56, 21 October 2010 (UTC)
 * Red is download, green (and yellow) is upload. 82.44.55.25 (talk) 20:05, 21 October 2010 (UTC)
 * According to the key, red is download and green is upload. There is no green representation in the graph. — Fly by Night  ( talk )  21:45, 21 October 2010 (UTC)
 * Yellow and green are the same. The green turns yellow when it's in front of red. 82.44.55.25 (talk) 21:59, 21 October 2010 (UTC)

php
Say in php there was echo "There are $number pages"; how could you get the script to put that into a .html file? 82.44.55.25 (talk) 18:38, 21 October 2010 (UTC)


 * If that is in a php script, accessing it through a web server will produce HTML. If you mean "I want to save this to a file", you need to open a file pointer and write it like:
 * <tt>$fp = fopen("your_file.html","w");
 * fputs($fp, "There are $number pages");
 * fclose($fp);</tt>
 * Then, you will have a file with that text inside of it. -- k a i n a w &trade; 18:40, 21 October 2010 (UTC)


 * Or, if you meant you wish to run from the command-line, you may want to use PHP Command Line Interface. Nimur (talk) 18:44, 21 October 2010 (UTC)


 * Or, perhaps, the questioner has a command-line script and wants to put it in a web page. Assuming the web server can parse PHP, you add to your HTML document the text: <tt>&lt;?php echo "there are $number pages"; ?&gt;</tt> --  k a i n a w &trade; 18:54, 21 October 2010 (UTC)

Spreadsheet of irregular payments
I have a long list of rent money paid, and the dates they were paid on. i.e. the spreadsheet has two columns. The tenant was supposed to pay a fixed amount on the 1st of every month, but actually paid the rent very irregularly. Some months were missed completely, some were paid late, a few may have been paid early. The tenant has to pay x percent compound interest on late payments, if they are paid more than fourteen days late.

The question is: how do I work out on a spreadsheet what the tenant owes, including interest? The problem is that the data has irregular and missing dates, so it will be much harder to calculate than if the dates were just regular dates one month apart. Not a homework question. Thanks. 92.15.29.194 (talk) 20:11, 21 October 2010 (UTC)


 * charge them simple interest, not compound. Sorry, it's not right of you to charge them the 15% you feel confident you could have made on the stock market either.  Charge them 8% simple interest. 85.181.49.255 (talk) 21:02, 21 October 2010 (UTC)


 * I think you might have to put in a third column with the dates that each rent payment should have been paid on - ie the first of each month. You may have to add rows in for the months that the rent was not paid - for these months, you should manually insert the amount of rent into the the rent column and put  in the date column. Then, assuming that we're starting on row 2 and that column A has the date the rent was paid and column B has the rent amounts and column C is the one you added in, put the following in cell D2:  . This deals with the months when the rent was paid. For the months when the rent was not paid, put the following into E2:.


 * The sheet Data has the annual interest rate in cell A1 and today's date (or the "as-of" date) in cell A2. I can't check if this works since I don't have access to Excel on this computer. You'll get errors in column D for the months where no rent was paid (you can get rid of them automatically by selecting column D and pressing ctrl+G) - then add up columns D and E. Zain Ebrahim (talk) 21:37, 21 October 2010 (UTC)
 * When the rent was paid for a particular month, was it always paid in full? If so, that makes the calculation much easier.  Work out a daily interest rate.  When you simply subtract 2 dates in Excel, it calculates the number of days.  So, suppose the due date is in column A, the paid date is in column B, and the amount due is in column C, then column D could contain the number of days paid late as B2-A2, and column E could contain the interest due as '=IF(D2>14,(D2-14)*C2*daily_interest,"")'. Calculate a sum at the bottom of column E and request they pay that.  However, if they are already struggling to pay the rent do you really think asking for the interest is actually going to make them pay more quickly in the future?  You might just be dumping further despair on your tenant. You also need to consider what to do if they refuse to pay the interest, do you persue them through the small claims court?  And if they are a benefit claimant you might eventully get the money at the rate of £1 per week. Your local Citizens Advice Bureau will almost certainly be able to provide you better advice, for free. Astronaut (talk) 21:54, 21 October 2010 (UTC)
 * The former tenant is quite well off and rented the place as part of a business. 92.29.125.8 (talk) 11:05, 22 October 2010 (UTC)

I'm wondering how to deal with a missed payments. Supposing the tenant missed one payment in January but paid all other payments that year in full and on time. Should I calculate the interest due from the January until the present time; or should I regard the February and subsequent payments as late payments for the previous month? 92.29.125.8 (talk) 11:05, 22 October 2010 (UTC)
 * The 14 day interest-free period causes both methods to give different answers. Note that if you go with the second approach (which seems like the likelier option), then my answer above would not be right. Zain Ebrahim (talk) 11:20, 22 October 2010 (UTC)
 * The 14 days is not interest free. If the rent was paid on day 13, no interest added. If it was paid on day 15, then 15 days of interest are added. I'm wondering if this would make the two modes of calculation equivalent, if all the late rents were more than 14 days overdue. 92.15.28.203 (talk) 19:39, 22 October 2010 (UTC)

As the comments above note, there are multiple ways of calculating compound interest when the debt is being sporadically incurred and repaid. If this is just an academic question, then the answer depends on the method described in the hypothetical credit agreement that both parties entered into at the beginning of the contract and (depending on whether the debtor is a consumer or a limited company, several acts of parliament). But your post (as ip 92.29.125.8) strongly suggests this is a real scenario, which means this question is veering off into the territory of legal and professional advice, which the reference desk absolutely does not provide. You should speak to a qualified accountant. I'm reluctant even to tell you which laws you might be breaking (lest I help you self-help yourself to Pentonville) but I definitely would not go sending an invoice or a demand until you've spoken to a qualified professional. -- Finlay McWalter ☻ Talk 17:15, 22 October 2010 (UTC)

This is about manipulating data with a spreadsheet and maths, no legal stuff involved. I could re-write it if you wish as a scenario in Cuckooland, where the teddy bears trade Smarties. 92.15.28.203 (talk) 19:39, 22 October 2010 (UTC)