Send Bristol mailing list submissions to
bristol@mailman.lug.org.uk
To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.lug.org.uk/mailman/listinfo/bristol
or, via email, send a message with subject or body 'help' to
bristol-request@mailman.lug.org.uk
You can reach the person managing the list at
bristol-owner@mailman.lug.org.uk
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Bristol digest..."
Today's Topics:
1. Re: Simple script query (DHT11 Sensor) (Richard Stearn)
2. Re: Simple script query (DHT11 Sensor) (Peter Hemmings)
3. Re: LDAP (Steve King)
4. Re: LDAP (Gavin Henry)
----------------------------------------------------------------------
Message: 1
Date: Sun, 18 Jan 2015 13:47:07 +0000
From: Richard Stearn <richard@rns-stearn.demon.co.uk>
To: Bristol and Bath Linux User Group <bristol@mailman.lug.org.uk>
Subject: Re: [bristol] Simple script query (DHT11 Sensor)
Message-ID: <54BBB95B.6040702@rns-stearn.demon.co.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Peter Hemmings wrote:
> On 17/01/15 17:36, Richard Stearn wrote:
> Are the names limited by libraries etc, for example "deciC"
No. Completely arbitary. DeCiC, dEcIc, Temp_Offset tempoffset, ...
There are common conventions, e.g. anything "#define"d tends to be
in capitals, variables and function names lower or mixed case.
Some use camel case e.g. AFunctionToDoSomething, some use "_" to
punctuate the name e.g. a_function_to_do_something, some do not care
and just run it all together e.g. afunctiontodosomething.
You may also find names like fAFunction or iAnInteger where the type
of the name is indicated by the initial letter. Very common where
a coding standard (a document setting out _exactly_ how function/variable
names _will_ be constructed) has been defined.
>> #define TEMP_OFFSET -27
>> #define MULTIPLIER 10
define constants
>> int deciC;
define variables
>> deciC = (dht11_val[2] * MULTIPLIER) + dht11_val[3];
>
> calculate make the whole number byte into tenths and add the decimal
> byte to give the total temperature in tenths of degrees C.
Yes.
>> deciC = deciC + (TEMP_OFFSET);
>
> add tenths offset to deciC
Yes.
>> printf( "%d.%d\n", deciC / MULTIPLIER, deciC % MULTIPLIER );
>
> Print the 2 values "deciC divided by 10 to give whole degrees, plus
> "desic % MULTIPLIER".
The % sign means "return the remainder (modulus) of the division".
Thus for a temperature of 9.8C, deciC = 98,
printf( "%d\n", deciC / MULTIPLIER );
would print "9" and
printf( "%d\n", deciC % MULTIPLIER );
would print "8".
--
Regards
Richard
------------------------------
Message: 2
Date: Sun, 18 Jan 2015 14:21:50 +0000
From: Peter Hemmings <peter@hemmings.eclipse.co.uk>
To: Bristol and Bath Linux User Group <bristol@mailman.lug.org.uk>
Subject: Re: [bristol] Simple script query (DHT11 Sensor)
Message-ID: <54BBC17E.2020208@hemmings.eclipse.co.uk>
Content-Type: text/plain; charset=windows-1252; format=flowed
On 18/01/15 13:47, Richard Stearn wrote:
> Peter Hemmings wrote:
>> On 17/01/15 17:36, Richard Stearn wrote:
>> Are the names limited by libraries etc, for example "deciC"
>
> No. Completely arbitary. DeCiC, dEcIc, Temp_Offset tempoffset, ...
OK
>
> There are common conventions, e.g. anything "#define"d tends to be
> in capitals, variables and function names lower or mixed case.
>
> Some use camel case e.g. AFunctionToDoSomething, some use "_" to
> punctuate the name e.g. a_function_to_do_something, some do not care
> and just run it all together e.g. afunctiontodosomething.
>
> You may also find names like fAFunction or iAnInteger where the type
> of the name is indicated by the initial letter. Very common where
> a coding standard (a document setting out _exactly_ how function/variable
> names _will_ be constructed) has been defined.
>
>
>>> #define TEMP_OFFSET -27
>>> #define MULTIPLIER 10
> define constants
>
>
>>> int deciC;
> define variables
>
>
>>> deciC = (dht11_val[2] * MULTIPLIER) + dht11_val[3];
>>
>> calculate make the whole number byte into tenths and add the decimal
>> byte to give the total temperature in tenths of degrees C.
>
> Yes.
>
>>> deciC = deciC + (TEMP_OFFSET);
>>
>> add tenths offset to deciC
>
> Yes.
>
>>> printf( "%d.%d\n", deciC / MULTIPLIER, deciC % MULTIPLIER );
>>
>> Print the 2 values "deciC divided by 10 to give whole degrees, plus
>> "desic % MULTIPLIER".
>
> The % sign means "return the remainder (modulus) of the division".
OK thanks, that was my main problem.
>
> Thus for a temperature of 9.8C, deciC = 98,
> printf( "%d\n", deciC / MULTIPLIER );
> would print "9" and
> printf( "%d\n", deciC % MULTIPLIER );
> would print "8".
>
OK that's now "crystal".
BTW for any other lurkers new to all this, like me (and for
completeness), the "/n" is for a new line without flushing the output
buffer.
Regards
--
Peter H
------------------------------
Message: 3
Date: Sun, 18 Jan 2015 23:44:29 -0000
From: "Steve King" <debian@invux.com>
To: "Bristol and Bath Linux User Group" <bristol@mailman.lug.org.uk>
Subject: Re: [bristol] LDAP
Message-ID:
<9f5843b8e66a05272c6194f1aa4db2c6.squirrel@jarate.invux.com>
Content-Type: text/plain;charset=iso-8859-1
Keith said:
> LDAP isn't overly complex, but it does need some understanding before you
> try implementing it. I'd suggest you read up on it and set it up in a test
> environment first. Setting up replication and LDAPS access is a bit more
> complex.
>
> Useful tools:
>
> - phpLdapAdmin
> - ldapvi
>
SSL is a must if you don't want plain text passwords flying around your LAN
And I have found smbldap-tools helpful, although you have to configure
your LDAP in the way the authors expected (and just because you haven't
doesn't mean you did it wrong)
Is it still the case that the two separate password fields: POSIX password
and NT Password have to be synchronised at account creation or password
change? Or is best practice to use libpam-winbind?
--
Steve
------------------------------
Message: 4
Date: Mon, 19 Jan 2015 08:56:21 +0000
From: Gavin Henry <ghenry@suretecsystems.com>
To: Bristol and Bath Linux User Group <bristol@mailman.lug.org.uk>
Subject: Re: [bristol] LDAP
Message-ID:
<CAPcb_GJmqvMyCektc9kuH9Zcxdi47JeFfKbyt1hBmR3DvLUoRw@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
> Keith said:
>> LDAP isn't overly complex, but it does need some understanding before you
>> try implementing it. I'd suggest you read up on it and set it up in a test
>> environment first. Setting up replication and LDAPS access is a bit more
>> complex.
>>
>> Useful tools:
>>
>> - phpLdapAdmin
>> - ldapvi
>>
>
> SSL is a must if you don't want plain text passwords flying around your LAN
> And I have found smbldap-tools helpful, although you have to configure
> your LDAP in the way the authors expected (and just because you haven't
> doesn't mean you did it wrong)
Don't forget ldaps isn't a standard and is deprecated. StartTLS on
port 389 vs port 636 for ldaps is preferred. All decent software
should support StartTLS.
> Is it still the case that the two separate password fields: POSIX password
> and NT Password have to be synchronised at account creation or password
> change? Or is best practice to use libpam-winbind?
smbtools can do it or if you use the contrib module
http://labs.opinsys.com/blog/2010/05/05/smbkrb5pwd-password-syncing-for-openldap-mit-kerberos-and-samba/
--
Kind Regards,
Gavin Henry.
------------------------------
_______________________________________________
Bristol mailing list
Bristol@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/bristol
End of Bristol Digest, Vol 586, Issue 1
***************************************
Tidak ada komentar:
Posting Komentar