Urban75 Home About Offline BrixtonBuzz Contact

The lonely tech post thread.

There isn't a Linux "language" as such. A lot of the scripts (take a look in /etc/init.d for example) are vanilla bash scripts; quite a lot of the Ubuntu subsystem is written in Python, and then of course there is the kernel itself, which I believe is now written in a sort of mongrel C/C++.

There is almost certainly some kind of configuration file reader library/utility which would encourage apps to use the same feature to manage their own configs, so in a sense the configuration file format is a "language" itself, but usually one that is read in by an application running as a bash script (or maybe even a python program, although the latter has its own internal capabilities for managing configuration files).

The technical difference is that those config files you are looking at are not executable; bash scripts are executable. There are good reasons why you might not want a configuration file to be capable of being executed (think system security).


OK you've convinced me. Python it is then :thumbs:
 
So done my first program (actually decided on python because it looks good for raspberry pi which I'd like to use), to calculate my balance for the weekly local shop :cool:

# Find latest balance

Balance = 12.37
thisbill = 16.73
paidin = 0
Balance = Balance - thisbill + paidin
print ("Hello both")
print (" ")
if paidin == 100:
print ("State of play after £100 transferred")
else:
print ("Balance:", Balance)

Actually prints out

Hello both

Balance: -4.360000000000001

but I don't care I can sort out the 10-16 of a penny with the bank :)
 
So done my first program (actually decided on python because it looks good for raspberry pi which I'd like to use), to calculate my balance for the weekly local shop :cool:



Actually prints out



but I don't care I can sort out the 10-16 of a penny with the bank :)
I know it's late and maths isn't my strongest subject but how is 7-3=6? :hmm:
 
I know it's late and maths isn't my strongest subject but how is 7-3=6? :hmm:
I was about to contact python but realized that 13-7 does equal 6

although it took me longer to work that out than it should

I'm still not sure how it equals 6.0000000000001 though :confused:

Reminds me of when I triumphantly first worked out how to do my accounts using Dbase3 in ooo late 1980s and it rounded pennies up and down randomly and the fucking accountant went all through the fucking accounts at his full fucking charge-out rate looking for the errant fucking pennies. :mad:
 
Last edited:
Interesting to know how it ended up with the ten quadrillionth of a penny though.
It's either fascinating, or stultifyingly tedious, depending on your level of neediness, but the way in which floating point numbers are stored and processed does lead to the introduction of tiny rounding errors. It's to do with the fact that you can't represent decimal (floating point) numbers in binary with complete accuracy, a bit like the binary equivalent of trying to represent 1/3 as a decimal number.

There are languages and number formats that store currency amounts exactly, usually by storing them as integer amounts of pennies, but that obviously falls down if you start using fractional amounts of money or other units.
 
(I think) you're subtracting the wrong one because it's a negative result.

-16.73
12.37
-4.36

12.37
-16.73
-5.64

which add up to 10 (I think) because we've had to borrow 10 from the -6 in the bottom one but it's the top subtraction is right.
 
(I think) you're subtracting the wrong one because it's a negative result.

-16.73
12.37
-4.36

12.37
-16.73
-5.64

which add up to 10 (I think) because we've had to borrow 10 from the -6 in the bottom one but it's the top subtraction is right.
Until the CPU has done the subtraction it doesn't know it's a negative result. You should start with the balance and subtract the bill amount. :hmm:

If your bill was for less than £12 would you still get the right answer by doing it your first way?
 
No, but you want the distance between the two figures which you only get by subtracting the smaller absolute value from the larger and then adding in the sign. Otherwise (I think) you're getting something like the distance going through zero.

This given in answer to a similar question somewhere:
you can easily do that like this and using the ABS function you don't need to test with IF to find the larger of the 2 numbers.

=ABS(A1-A2)
 
No, but you want the distance between the two figures which you only get by subtracting the smaller absolute value from the larger and then adding in the sign. Otherwise (I think) you're getting something like the distance going through zero.

This given in answer to a similar question somewhere:
Still works if you go through zero. 7-3=4 If it was 3-7 and you count backwards you get 2, 1, 0, -1, -2, -3, -4.

In your example 7-3 cannot =6. :eek: :hmm:
 
Long shot. Does anyone use ESET Protect and use the URL address management in Web access protection for filtering? I've been asked to block all web access for a few devices other then a few whitelisted sites. Thought I had it all working nicely, but it appears to stop Outlook connecting. Which seems odd for something that's filtering on URLs? My google fu is failing me on this one.
 
Long shot. Does anyone use ESET Protect and use the URL address management in Web access protection for filtering? I've been asked to block all web access for a few devices other then a few whitelisted sites. Thought I had it all working nicely, but it appears to stop Outlook connecting. Which seems odd for something that's filtering on URLs? My google fu is failing me on this one.

I dont use it but are you allowing access to the outlook URL?
 
Still works if you go through zero. 7-3=4 If it was 3-7 and you count backwards you get 2, 1, 0, -1, -2, -3, -4.

In your example 7-3 cannot =6. :eek: :hmm:
but 13-7 does and it's 13 not 3 because you're having to borrow from the tens because 7 is bigger than 3.

Could we invite an invigilator to this discussion? Surely this has to be right and if so is there a better way of explaining it? :)
 
but 13-7 does and it's 13 not 3 because you're having to borrow from the tens because 7 is bigger than 3.

Could we invite an invigilator to this discussion? Surely this has to be right and if so is there a better way of explaining it? :)
But the single pence column is 7-3. The 3-7 is the tens of pence column. 7-3 is 4 and always has been. :hmm:
 
So this probably sounds daft but does it need it for the desktop version?

I believe it needs to be able to contact the server, if for example certain web traffic is blocked then I know Outlook stops working.

Are you getting alerts saying that its trying to contact something and being blocked?

I would allow access to the outlook servers, it will block autodiscover as well so new accounts wont work if you want to test adding an account to outlook as well.
 
I believe it needs to be able to contact the server, if for example certain web traffic is blocked then I know Outlook stops working.

Are you getting alerts saying that its trying to contact something and being blocked?

I would allow access to the outlook servers, it will block autodiscover as well so new accounts wont work if you want to test adding an account to outlook as well.

See I'm just being a numpty and assumed if the right ports were open then it work, but I've blocked all web access. So it probably is a list of addresses I need to whitelist.

The error is the same as if the PC wasn't connected to the Internet.
 
Last edited:
See I'm just being a numpty and assumed if the right ports were open then it work, but I've blocked all web access. So it probably is a list of addresses I need to whitelist.

The error is the same as if the PC wasn't connected to the Internet.

Are these them?

.office365.com" and ".office.com

If that works still best also ask Microsoft what needs whitelisting.
 
Not until now and looks way beyond me. I'm more concerned about whether these new programming languages can do basic maths. :eek:
They can, but this is one of those comparatively rare occasions when an understanding of maths can be useful.

The bottom line is that computers store numbers as a series of bits. Traditionally, those numbers would have been integers, stored in various lengths - 8 bit gives you 0-255, 16 bits gives you 0-65535, and so on.

But that doesn't help with any calculation that involves a non-integer value.

If you have long enough integers, you can apply a "scaling factor" (in software), so that the value 10000 (decimal) stored in your integer is actually interpreted as 1.0000, giving you 4 decimal places.

But that's clunky, and might be good for accounting or other "counting" jobs, but falls down a bit when it comes to scientific calculations, where you might be dealing with a very wide range of numbers. And for that we need floating-point maths. On a computer, floating point maths is roughly equivalent to the way scientists express very big or small numbers as a power of 10: 6.02x10^-33, except they do it in binary. A lot of this is driven by the development of floating point co-processors, to which a CPU could offload the task of performing a cycle-hungry floating point calculation, and that got formalised into an IEEE standard for representation of floating point numbers. Essentially, you have an integer mantissa, which is the number itself, and an (also integer) exponent, which is the power of 2 that the number must be raised to in order to get the real value out.

The snag here is that, even though IEEE 754 (I looked it up) specifies some seriously big word lengths, some numbers in decimal just won't resolve exactly into the mantissa/exponent format. Notably 0.1 - the IEEE 754 equivalent of 1/3 - has the problem that no matter how many 3s you add after the decimal point, it never exactly expresses the value of that fraction.

And there's a lot more of those numbers in the binary system than there is in the decimal one.

I think one of those clunky old-skool programmer skills was in knowing how accurate your answer needed to be, letting the floating point thing do its magic, and then representing the number (ie printing it :hmm:) in a real-world format that ignores those weird digits down in the far end of the fractional bit, maybe doing a bit of judicious programmed tidying up at intermediate phases of the process...

So, if you store and retrieve 0.1 as a floating point number, what you get back is 0.100000001490116119384765625.

But you're never going to present it to your end user like that - you apply a format to the number to enable it to display in a meaningful way, and the size of the error is too tiny to be significant for most purposes. Depending on the practicalities, you might want to round the display of the number to 2 decimal places for, eg., currency, or perhaps 4 for some measurement thing. Either way, the error noise isn't showing up until the ninth digit of the fractional part, so it's lost in the weeds. Except for some very involved calculations with FP numbers, those errors will rarely approach a point where they fundamentally mess things up. Although there are various defensive programming approaches aimed at catching/checking things along the way.

Oops, that went on a bit - I got a bit misty-eyed about the Good Old Days, and long integers, floating point coprocessors, etc.
 
Back
Top Bottom