Home  5  Books  5  GBEzine  5  News  5  HelpDesk  5  Register  5  GreenBuilding.co.uk
Not signed in (Sign In)

Categories



Green Building Bible, Fourth Edition
Green Building Bible, fourth edition (both books)
These two books are the perfect starting place to help you get to grips with one of the most vitally important aspects of our society - our homes and living environment.

PLEASE NOTE: A download link for Volume 1 will be sent to you by email and Volume 2 will be sent to you by post as a book.

Buy individually or both books together. Delivery is free!


powered by Surfing Waves




Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome to new Forum Visitors
Join the forum now and benefit from discussions with thousands of other green building fans and discounts on Green Building Press publications: Apply now.




    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 18th 2012
     
    I got it doing what want it to do. There seems to be a fundamental difference in the way that VBA and LibreOffice Basic in the way that they handle routines within routines. Not that I know what I am talking about. :bigsmile:
    • CommentAuthorwookey
    • CommentTimeDec 19th 2012
     
    Sorry - late to this thread. I'm no fan of PIs or Broadcom, but they are cheap and do run Debian (well Rasbian strictly) so do have their uses.

    Bot - if you wanted some nice arm hardware (with keyboard and case and display) the the new Chromebook is very fine. fastest arm hardware anywhere currently, and better than many people's older x86 laptops. Easy to remove the silly chromeOS and put Debian or Ubuntu on - exceedingly nice piece of kit, and not expensive.

    Various things:

    iplayer: install get-iplayer and download things to play later. Now includes a web-interface. Flash is the work of the devil and best ignored. HTML5 and assorted players are coming to save us: http://html5video.org/wiki/HTML5_Video_Player_Comparison

    labjack:
    sadly it seem no-one has packaged the labjack or exodriver software yet. If they had it'd just be 'apt-get install labjack'.
    this page says it was dead easy: http://labjack.com/blog/running-labjackpython-and-exodriver-ubuntu-1004
    I hope you didn't try to build libusb. apt-get install libusb-1.0-0 installs it.

    'Build tools' refers to anything you need to install in order to build some other bit of software. If it is packaged then you get the build tools for it with:
    'apt-get install build-dep <package>'
    and you get the source to build (into the current directory) with:
    'apt-get source <package>'

    You install the core (assumed by everything and thus not actually listed explicitly) tools by installing 'build-essential' but it is by no means everything you might need.

    'Porting to the Pi' means making changes so that the software builds/runs/works on the PI, which generally means making sure it works on ARM in general. A lot of software has only ever been run on x86 hardware and thus makes unwarranted assumptions about tings like data layouts and endianness. This is much less of a problem than it was 12 years ago, but it still happens. Almost all the packaged software in Debian (and thus Rasbian) has already been ported.

    Well done for getting things going - lots of sensible advice from Seret.

    I can't believe that a macro run every 5 mins in libreoffice is really the right answer to any sensible question. What on earth are you trying to do? There are indeed some major conceptual difference in the Excel and Libreoffice macro models, but really spreadsheets are bad for anything except write-only quick hacks. Use a proper language and proper display mechanism if you want to process data and display it.

    That seems to cover the questions so far.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 19th 2012
     
    Welcome back Wookey, seems ages since you have been about.

    The 5 minute macro is to grab some updated data from a webpage. I agree that using a spreadsheet is not the way to do it, but as I have no idea how to do it any other way I am stuck. Libreoffice has the tools I need built in, so I have less to learn.
    I really do not have the time or the will to learn how to program in Python, though have asked at the University if there are any courses that I can do, seems not.

    Thank to all that have helped so far, I am sure I will be back when I get stuck again.
    • CommentAuthorEd Davies
    • CommentTimeDec 19th 2012 edited
     
    Posted By: wookey'apt-get install build-dep <package>'

    Isn't that just 'apt-get build-dep <package>' (i.e., no 'install')?

    I can't believe that a macro run every 5 mins in libreoffice is really the right answer to any sensible question.

    Yep, if all you know how to use is a hammer...

    Posted By: SteamyTeaThe 5 minute macro is to grab some updated data from a webpage. I agree that using a spreadsheet is not the way to do it, but as I have no idea how to do it any other way I am stuck.

    For future reference, cron, crontab and wget (or curl) are likely useful commands - use man (e.g., 'man crontab') to investigate further.

    I really do not have the time or the will to learn how to program in Python

    Now may, indeed, not be the right time but Python really would be a good thing for pretty much anybody who works with any sort of data to know. I'd recommend JavaScript as a close second choice - no other language comes close for practical use in a wide range of circumstances.
    • CommentAuthorSeret
    • CommentTimeDec 19th 2012 edited
     
    Cron and something like wget are most likely the tools you want ST. The ability to do really complex things fairly easily through simple scripts is one of the things Linux users LOVE about running Linux. Basically you've got a vast tool box off little utilities that you can daisy chain together to achieve amazing things. The syntax isn't daunting places like Stack Overflow contains tons of sample code and helpful people.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 19th 2012
     
    Is there a good book or online tutorial that is helpful for beginners.
    I have been using computers for near enough 30 years now, but I really struggle with any sort of programming/scripting. I I also struggle with foreign languages (though speak BSL). Concepts I get, detail relies on memory, all the little details on putting in spaces in some places, not in others, curly brackets here, but normal ones there, same thing meaning different things in different places.
    To be honest, I do not even know how to start a simple program on a PC unless it has .exe after it.

    But I agree, using a spreadsheet to get what I want is cracking a nut with a sledgehammer. But when that is all you can do you have to use what is available to you :shamed:
    • CommentAuthorEd Davies
    • CommentTimeDec 19th 2012
     
    Posted By: SteamyTea: “Is there a good book or online tutorial that is helpful for beginners.”

    Don't know - it tends to be the sort of thing you pick up slowly from lots of different sources.

    However, I did find a much earlier edition of _Linux in a Nutshell_ very helpful to just browse through when something was confusing me.

    http://shop.oreilly.com/product/9780596154493.do

    From the content they mention it's been expanded a lot so I can't really say much useful. Still, worth a look next time you're in a big bookshop to see if you think it might help.

    Another read you might find helpful is _The Art of Unix Programming_ by Eric Raymond which is a commercial book but also available online:

    http://www.catb.org/esr/writings/taoup/html/
    • CommentAuthorSeret
    • CommentTimeDec 19th 2012 edited
     
    Stack Overflow is awesome:

    http://stackoverflow.com/search?q=cron+wget

    Just take the lazy route: grab someone else's script that does as close as possible to what you want and modify it a bit.

    Individual commands all have a manual page which lays out the various options and switches they accept. On the Pi's command line use:

    man commandname

    Or just Google the same. Man pages are useful for detail, but pretty horrifically badly written, so I wouldn't bother wading through them as a learning tool.

    Scripting in Bash isn't as involved as learning a proper language, you can generally cobble something together that will work ok, even if it's not particularly elegant code.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 19th 2012 edited
     
    For some reason everything has collapsed today. I can even restore from my image files. All very frustrating :cry:
    • CommentAuthorwookey
    • CommentTimeDec 19th 2012
     
    Welcome back Wookey, seems ages since you have been about.


    I've been busy: http://wiki.debian.org/Arm64Port and back-to-back conferences. Wittering on forums has taken a back seat for a while.

    Ed is right of course, it's: apt-get build-dep
    or apt-get build-dep -a if you want to cross-build for architecture

    It never ceases to amaze me the degree to which non-programmers somehow grasp spreadsheets and then use them for _everything_.

    Steamy: I know what you mean about all those annoying semicolons and brackets. A lot of people like python because it minimises that stuff. There are some great tutorials online including some nice interactive ones

    But really - if you learn a scripting language (python, perl, ruby, php, javascript), you will (eventually) enjoy it a lot more than trying to get spreadsheets to do useful things. Versatility, maintainability, readability, available libraries, efficiency etc. Free software spreadsheets like libreoffice/openoffice and gnumeric let you write macros in normal scripting languages (such as python) too, which is handy.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 20th 2012
     
    Well have managed to copy the RPi disks again, but somehow I managed to delete a partition on my PC, not the end of the end of the world as near enough all of it is backed up, but does anyone know of any free software that can recover from trying to write a linux partition to a PC one :cry:
    • CommentAuthorSeret
    • CommentTimeDec 20th 2012
     
    Did you write any data to the partition, or was it just formatted? If the latter your data is still there, it's just the partition table that got over written. Don't use the partition, boot up into a live CD or USB and run photorec to recover any files your backup doesn't cover. Then you cab either try and restore the partition table or just reformat and restore your data.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 20th 2012
     
    Not exactly sure what I did. Was using ODIN to make and restore the Linux image. Somehow I 'got rid of' my D drive on my PC. Not touched it yet, just letting it sit there and seeing if I really need the 185GB of data that is on it.
    Will need to go out and get an external drive (need to get one anyway as the 500 GB is almost full)

    Thanks though, I looked at Photorec and assumed it was just for pictures. Shall have a play with it on my old desktop, that has nothing of importance on it at all. Think I shall 'do the linux' stuff on it as well until I know what I am doing.
    • CommentAuthorEd Davies
    • CommentTimeDec 20th 2012
     
    Posted By: SeretDid you write any data to the partition, or was it just formatted? If the latter your data is still there, it's just the partition table that got over written.

    This is confusing two separate things:

    1) setting the partition type in the partition table and

    2) “formatting” - i.e., creating the file system in the partition.

    The partition table is, loosely speaking, at the beginning of the disk. Give or take some funniness with extended partitions and things there's only one. It has the positions of the starts and ends, etc, of each partition and also a number which is the partition type. The partition table is the first thing operating systems look at when trying to mount the file system in a partition - if an OS doesn't recognize the partition type it will not go any further.

    The basic utility to edit the partition table is similar in both DOS and Linux and in both it's called fdisk. The Linux one will tend to know about more partition types, though. Other programs, including ones with graphical user interfaces, can also edit the partition table but if things are getting confusing or dangerous it's best to boot a Linux (or other Unix-like) live CD or USB and use its fdisk to see what's really happening.

    Formatting a partition sets up the basic file system on it. For DOS and Windows partitions it creates the root directory and the file allocation table (the FAT). For Linux partitions it creates the root directory and the inode table. It definitely does write to the disk though it may not write an awful lot of sectors so there might well be a lot of recoverable data left.

    As Seret was getting at: if all that's been set is the partition type then the partition will disappear from the view of Windows but all the data is, so far, untouched. Setting the partition type back should recover everything. That's easier said than done as Windows' file system format has been extended in a piecemeal and shortsighted way so there are lots of different versions of the FAT file system with different partition types. Maybe looking at another similar sized partition created by the same operating system would give a good clue.

    Taking a byte-for-byte image of the damaged partition onto an external disk would be a sensible first move. The Linux dd utility is good at that. It can be used to copy the existing partition into a new partition of the same size or into a single great big file on a somewhat larger partition.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 20th 2012
     
    At the moment my disk has a drive letter, D, but wants to be formatted (not doing that). It is 'the other half' of my laptop hard drive.
    I may try and recreate the conditions that deleted it on my old desktop (I think I tried to install the RPi image to the D drive rather than the F drive (the SD card) when I was using ODIN). ODIN has a small screen and I have wobbly eyesight (actually called binocular instability and causes vertigo and makes reading very hard and nauseous).

    So would it be best to take an image of the partition using dd, I am sure I can find a live linux disk to try it out on, may have enough old hard drives around to do that. Or should I use the utility Photrec that Seret suggested?
    • CommentAuthorEd Davies
    • CommentTimeDec 20th 2012 edited
     
    Posted By: SteamyTeaAt the moment my disk has a drive letter, D, but wants to be formatted (not doing that). It is 'the other half' of my laptop hard drive.


    Ok, sounds like you wrote at least a few bytes of Linux file system over at least the beginning of the Windows file system without touching the partition table.

    Posted By: SteamyTeaSo would it be best to take an image of the partition using dd, I am sure I can find a live linux disk to try it out on, may have enough old hard drives around to do that. Or should I use the utility Photrec that Seret suggested?

    They do different jobs - use both.

    Photorec supposedly doesn't mess with the disk it's reading from but I'd still take a copy as soon as possible in case anything tries to mount partition which would likely make things worse. Use dd or any other such utility you feel comfortable with to make a byte-for-byte copy of the damaged partition. Then use photorec on it (can be either the original or the copy - but not both!) to recover any files which can usefully be recovered. Then format the original partition back to a Windows file system for further use.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 20th 2012
     
    Thanks
    Maybe Sunday before I can spend a few hours playing with it.
    • CommentAuthorSeret
    • CommentTimeDec 21st 2012 edited
     
    Just a little caveat about dd. It's a great tool, but if you've not used it before I would strongly advise against using it for the first time in a real data recovery situation. There is a potential there to irretrievably wipe your data if you get it wrong.

    I'd suggest creating a little test environment and having a play to familiarise yourself. Create two partitions on a USB stick, place some test data in one partition and use dd to copy it to the other. Verify that it went ok then delete the original and dd it back. It's not a difficult tool to use, but it's one of those ones where a simple syntax error can have terrible results.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 21st 2012
     
    Seret
    What I was thinking of doing with my old desktop. What they are for isn't it :wink:
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 30th 2012
     
    Anyone know how to make TightVNCServer start at boot up?
    Is there a file that I can add a line to?
    • CommentAuthorEd Davies
    • CommentTimeDec 30th 2012 edited
     
    Sorry, not really familiar with the details but you want to look into the /etc/init.conf file and the /etc/init/ directory which are read by the init process.

    In Ubuntu you'd create a file called something like /etc/init/tightvnc.conf. I think Debian is the same but maybe you just add an entry to the end of the /etc/init.conf file.

    Wookey will know better but I suspect he has a few other things on his mind at the moment: http://www.navitron.org.uk/forum/index.php?topic=19039.msg218418
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 30th 2012
     
    Thanks Ed, shall have a look for them. Did look on the RPi forum but could not get it to work as they said.
    Am I right in thinking that I have to make a file that sets the VNC server parameters i.e. the screen resolution and then edit a different files to get the details from the one I created to set the parameters. And would that be the init.conf file?
    Bit like writing a function and then calling for that function when needed. I can do that in OO VBA now, and it works very reliably. :bigsmile:

    Wookey
    Ditch the soggy insulation, or hang it somewhere it can dry properly. I had a flood once, was very messy and took a while for everything to dry out. Wish I had replaced ceiling as it would have been easier and quicker as even though it looked right at first, it slowly sagged over the years.
    • CommentAuthorEd Davies
    • CommentTimeDec 30th 2012 edited
     
    Also look at /etc/rc*. E.g., /etc/rc.local and /etc/rc.1/, /etc/rc.2 and so on.

    In those directories and the ones I mentioned before Ubuntu has some README files which will take you further if they're on your system. My only Debian system (on a Pogoplug) is in storage so I can't play easily.

    As to the files: I think you'll need to set up TightVNC so a single command (perhaps with a bunch of parameters) can be used to start and stop it. Maybe it needs a configuration file of some sort to do that - I used VNC ages ago when I had mixed Windows and Linux but now I'm purely Linux I just use SSH between machines so I don't remember.

    Once you can start and stop VNC with individual commands then you can set up the init process files to do that as the system changes “runlevels”.

    I think this is all in practice a lot more simple than I'm making it sound by my vagueness - sorry, but it's something I've not really looked at, an area where distributions tend to do things differently and also where Ubuntu and, I think, Debian have been evolving a bit relatively recently.

    Edited to add:

    Have a look at the man entry for runlevel. There are two: the default “man runlevel” tells you about the command which won't make much sense on its own. The other, runlevel(7), is more introductory text. Read it by using the “man 7 runlevel” command.

    That also references this page: http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit which is worth a read.
    •  
      CommentAuthorSteamyTea
    • CommentTimeDec 31st 2012
     
    Thanks Ed.
    There does seem to be some confusion about autostarting TightVNCServer on a RPi. It works well when it is running. Thankfully Putty works very well.
    Shall look at those files later.
    • CommentAuthorwookey
    • CommentTimeJan 1st 2013 edited
     
    Drying out seems to be going OK. Soggy ceiling advice noted (but I'm still going to leave it a couple of weeks and only take down if it's not dryish by then).

    Services are started in ubuntu with upstart rather than sysvinit used in Debian. So some differences here. Other servcies are started when the desktop statrs, not when the machine starts. This latter makes sense for vnc servers as they need a GUI to serve. (just use ssh/putty for console access).

    Note that if you've installed the gnome desktop then I believe vino/vinagre is installed by default and that should be started automatically when the desktop does. If you are not using the gnome desktop then extra poking will be needed to make it work.

    vino puts a file in /usr/share/gnome/autostart/vino-server.desktop which has
    X-GNOME-AutoRestart=true
    X-GNOME-Autostart-Phase=Applications
    which sounds like it the config for making it start automagically.

    tightvnc does not have such a file, but /usr/share/doc/tightvncserver/README.inetd tell you what to configure to get inetd set up to start tightvnc automatically when a connection is made. inetd is the standard daemon for this job (starting a daemon when something thies to make a connection to it). xinetd does the same job but handles multiple daemons of the same type better (or did ~6 years ago last time I set such a thing up)

    Unless you find tightvncserver particularly suits your needs I'd be inclined to use vino (with vinagre client) as it's integrated into the desktop config better, which should save some faffing about.

    (find the files a package installs with dpkg -L <packagename>)

    Does that help at all?
    •  
      CommentAuthorSteamyTea
    • CommentTimeJan 2nd 2013
     
    Wookey
    Not sure if it has helped, but will find out when I start to play with it all. One nice thing about the RPi is that I can quickly make another image on the SD card when it goes all wrong. Shall have a play later today after I have written a tedious report about grid balancing/stability.
    Thanks
    •  
      CommentAuthorSteamyTea
    • CommentTimeJan 6th 2013
     
    Right, got OWFS and DigiTemp installed and can see the adapter and iButton when I #digitemp_2490 -w
    How do I get it to write to a file every 10 minutes (or whatever I want to set it at)?
    • CommentAuthorwookey
    • CommentTimeJan 7th 2013 edited
     
    I have a shell script which reads every 30 seconds and writes to a log file each time. It simply uses 'sleep 30' for the pause. 'sleep 600' would give you a 10 minute pause. I did post it somewhere but can;t find it right now and as the ethernet cable to upstairs is bust I can't just copy it off for you (it's horrid anyway).

    Better is to use either 'at' to schedule a new run every 10 mins. Or put in a cron entry to run every 10 mins:

    Which to run a script called 'logtemps' stored in /home/steamy/bin every 10 mins means putting a line like this into a system cron list /etc/cron.d/steamyjobs (at least on a debian-derived box):
    */10 * * * * logtemps if [ -x /usr/local/bin/logtemps ]; then /usr/local/bin/logtemps; fi

    or into a personal cron list using crontab (which I always try to avoid as current config isn't very discoverable IMHO).

    Your logtemps scripts would be something like:
    #!/bin/sh
    LOGFILE=/var/log/temp.log
    digitemp_2490 -w >> $LOGFILE

    Don't forget to do chmod -x /usr/local/bin/logtemps to make it executable.

    Pretty low tech, but that'll work. Adding your logfile to the logrotate config would be cleaver so it starts a new one every so often.

    Numpty guide to cron jobs: http://www.unixgeeks.org/security/newbie/unix/cron-1.html
    •  
      CommentAuthorSteamyTea
    • CommentTimeJan 7th 2013
     
    Thanks Wookey, I shall try and make some sense of that later. I have no idea what cron (is that shot for chronograph) and chmod do, but shall look them up.

    How is the ceiling doing, is it ready for lashings of PVA yet?
    •  
      CommentAuthorSteamyTea
    • CommentTimeJan 24th 2013
     
    Right
    Been play on the RPI and after buying some DS18B20's from the lovely Ellie at Homechip and spending a good 10 hours modifying a a very simple bit of scrip to read them I have eventually got something very basic into a text file.

    What I do not understand is as follows:

    To start the DS18B20 I have to open a terminal window and type:
    modprode w1-gpio
    modprobe w1-therm
    cd /sys/bus/w1/devices/
    ls

    This gives me the 1wire sensor serial number to put into Python script. It also does not work until I haver typed this in and now that I have rebooted it does no allow me to write the the file (called tempdata.txt in the /home/pi/desktop directory.

    Is it possible to put the modprode w1-gpio and modprobe w1-therm commands into the Python script at the very begining?

    The other thing is that when it writes to the tempdata.txt file a terminal window telling me that it all went alright opens up which has to be closed before I can read the file (or reload it). What is that about?

    Now the next thing I do not understand is how to put a timestamp in before the temperature value. In VBA it is just a case of using NOW(), is there a Python equivalent (spend a good two hours looking though the Python docs and got nowhere).

    And the final thing for now is how do I force a new line in my tempdata.txt file so that I do not overwrite the data I have in there.

    Here is my embarrassing first attempt at writing a script (really just modified from someone else at Cambridge University.
    The print temperature at the very end I usual # out, I just use it to check that it really has changed the data.

    #!/usr/bin/python

    #Reads the 1wire sensor and writes to a files called tempdata.txt
    #opens the 1wire sensor file
    tfile = open("/sys/bus/w1/devices/28-000003f8336c/w1_slave")
    #reads the 1wire sensor file
    text = tfile.read()
    #closes the 1wire sensor file
    tfile.close()
    #isolates the second line using a new line break
    secondline = text.split("\n")[1]
    #isolates just the temperatue data using spaces
    temperaturedata = secondline.split(" ")[9]
    #puts a decimal point in
    temperature = float(temperaturedata[2:])
    #converts the digit to read derees C (the 1wire sensor is a 5 digit number with no decinal place and needs to be divided by 1000)
    temperature = temperature / 1000
    #opens the tempdata/txt files so that the temperature data can be written to it
    tfile = open("/home/pi/Desktop/tempdata.txt","w")
    #writes the temperature data to the tempdata/txt file
    tfile.write("Temp C,%s"%temperature +'\n')
    #closes the tempdata.txt file
    tfile.close()
    #prints the temperature to a terminal window
    print (temperature)
   
The Ecobuilding Buzz
Site Map    |   Home    |   View Cart    |   Pressroom   |   Business   |   Links   
Logout    

© Green Building Press