And now we will get into input output, file systems. So I won't talk about directories much, I will be mostly talking about files. We have already looked at file input and output through fstream. Today I want to trace in complete detail what exactly happens when you use an fstream to dump data and read data. So there should be absolutely no confusion left at the end of it. So what is a file? A file is an 1D array of bytes on disk. Just like memory is a 1D array or vector. A file is also a 1D array of bytes with the difference that it exists on disk and so it's lower to access. There's no other difference. It can grow and shrink at the end just like a vector. Interpreting the bytes is the business of the program that uses the file. The operating system doesn't care what you store in a file. I'll talk about the hex dump utility, which lets you see what's in a file byte by byte, printed in hex. It's a very simple utility that Linux provides to you. Now if the file is a text file or maybe a .cpp file, then those bytes are assumed to be ASCII codes. But bytes in a.out are not supposed to be ASCII codes. They're assumed to be compiled executable code that are directly loaded into a CPU and run. So same byte, different purpose. Now we all know how to use an .ofstream, but let's just go ahead and see what the code looks like.  If your path doesn't start with a slash, then it's offset with respect to the current directory where the program is running. Otherwise, it starts from the root of the file system. In this case, I'm printing out 2 and 3, which are interpreted as integers. And then I'm printing out 2 minus 3 as an integer, and then I'm printing a new line. So what happens in all of this? If the file does not exist, it is created empty. If it exists, it is truncated to 0 bytes. A write cursor is initialized to 0. When you open the file like that, that's what happens. After that point, if I'm printing that 3, what happens? The 3 is an integer. And it occupies 4 bytes in RAM or in a register. The first thing that happens is that that integer 3 is translated to a string 3. They are different things. The ASCII code byte for character 3, which happens to be 0x33, x33, that is appended to the file. And the write cursor is incremented by 1 byte because they've written out x33 to the output 3. Similarly, when I look at 2 minus 3, the result is minus 1. In this case, two characters will be written out. One is the ASCII code for minus. The other is the ASCII code for 1. So in all, 2, 3, minus 1, 4, ASCII code bytes will be written out. And finally, there will be the NL. Now just for our convenience, people can't agree on things. So Unix and Linux systems indicate end-of-line with one character. Whereas Windows and DOS, they indicate end-of-line with two characters just to make life more interesting. So on Linux, the hex code 0a or decimal 10, which means line feed, that is written out to the output string. And the write cursor increased by 1. In Windows, 0d, which is called carriage return, followed by 0a, which is line feed, are written. Now the write cursor will be increased by 2. So you have the exact same C++ code. The files they will create on disk will be 1 byte different in size. We can avoid this mess by suitable flags to the stream class. We'll see that a little later. But let's write this code.  Let's just go ahead and write it. And of course, om.close makes sure that the file is not cast in RAM. All bytes have been actually flushed to disk. And very simple. And just closes the resources. So I create the code. I think it's coming from this character. Codes are not the same. There we go. So now if I run hex.dump, it just runs dumping this file called dump.txt. What do I find in dump.txt? 2, 3 minus 1. Where my didn't put any spaces anywhere. So 2, 3 minus 1. And a new line, which is why I'm on this line. Otherwise, this C would immediately follow the 1. Now let's run this hex.dump utility to see what's in there in the file. So I say hex.dump, dump.txt. So what's in that file? Bite by byte in hexadecimal code. So this first column shows you the byte number inside the file. So you can see a whole bunch of weird stuff. Let me, I need some flags. I think it has some canonical hex plus ascii. So if I hex.tump.c the file, this is what I see. So to the right, it shows whatever it can print. Any unprintable character like new line is showed with a dot. And here it says that at byte offset 0 in the file, the first byte is ascii code 3, 2, which corresponds to the digit 2, not the integer 2, but the written digit 2. The next byte is the ascii code for the written digit 3, which is 3, 3. Then I have the ascii code for the minus sign, which is 2D. Then I have the ascii code for 1, which is 3, 1. As you can see, 1, 2, and 3 are 3, 1, 3, 2, 3, 3, hex. And finally, there's the new line, which is 0A, as I promised. So in other words, this file has 5 bytes. And those byte values are those. So that's what happens when you write to a f stream or to see out using the less, less construct. Now, let me change this slightly and say that I want to save the hex number, say 2, 3, 4, 5, a, b, c, d. That's a valid integer. Now if I run hex dump, the stuff in dump is this large integer, which corresponds to this hex number. Now again, if I hex dump this guy, you can see that how many bytes have been written? 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. And the actual thing that's in the file is 1, 2, 3, 4, 5, 6, 7, 8, 9 on the new line. So 10 characters have been written. That costs you 10 bytes on the file. So if I say ls-dashl-dump.txt, you can see that the size is 10. So I use 10 bytes to write down an integer to file where the original integer fit inside 4 bytes. So clearly this is not such a nice idea. Can we do better? And the answer is that we don't want this translation into ASCII and back. We want to store it on the disk exactly like the 4 bytes that are stored in RAM. And we'll do that as follows. Now there's also this thing called iOS, which is a class coming alongside fstream, which lets you do a few things while opening files. For example, you can open a file in binary mode, which doesn't do this CRLF patch up. So it doesn't distinguish between any Windows files, Unix files. If you're using binary files to dump integers and doubles and so on in low-level format, then you should use binary format so that an accidental occurrence of 0D and 0A doesn't appear like a new line. Otherwise, this system will translate it for you, thinking it's the end of line. So it's safest to always open binary files in binary mode. You should. If you open with a file, I'll show how to apply the flag soon. There's a flag called ATE, I have no idea why. Then you position a write cursor to the end of the file. So if the file already exists, you'll leave the content unchanged, and you'll put the write cursor at the end rather than at the beginning of the file. And you can also truncate an existing file by force by saying iOS trunk. It's similar to vector.resize0. So fstreams can read and write a file at the same time. And we'll use this to dump our data in low-level binary format. So fstreams are opened as follows. fstreamfs pass to file like before. You pass it these flags. You say open it in binary mode. And let me do both in and out on that file. So I should be able to both read and write. So what are these vertical bars? Those are the bitwise or operators. So in fact, all these flags, iOS, binary, iOS, in iOS, out, these are just integers. But they're all powers of two inside the system. When you order them, various bits are set. And fstream class reads that integer and finds out what bits are set to decide how to start up the fstream class, whether I should change the right cursor and so on correctly. And then the fstream class provides these all-important methods. So look at these three or four methods very carefully. Generally speaking, you should never do less than, less than, or greater than, greater than on fstreams, because you're using it for low-level binary data. You don't want formatting into ASCII at all. So the only thing you're allowed to do on an fstream is read and write character buffers. So suppose I have a character buffer with 100 bytes, you could try to do read into the buffer 100 bytes from fstream. So wherever the read or get cursor is placed, from that point onwards, read ahead 100 bytes and load that into buffer. Suppose the file is over before that, then the file will set a fail or end of file flag. And you can check for that. We'll come back to that later on. On the other side, you can tell FS to write to disk the contents of buffer for 100 characters starting at the current position of the write cursor, whatever the write cursor is currently. That may end up in extending the file if there's not enough space, just like vectors can get extended by pushback. So this basically says pushback 100 bytes from the content of the buffer to the file, whatever the end cursor is. But unlike pushback, the write cursor can also be repositioned to an interior of the file. So you can overwrite if you want. You can actually ask for where the cursor positions are. You can say, tell me where the get cursor is, the read cursor. Tell me where the put cursor is. That's the write position. And what you get back is not an integer, but it's a pause type. Why is that? Because if it were an integer, we could only support files which are up to about 2 billion bytes, which is not large by today's standard. You could definitely have multi-gigabyte files and would run out of offset. That's why the offset in a file is defined in a generic way called pause type. Pause type is either 64 bits or it's 32 bits. You don't have to know. It's an offset of a byte in a file. Just like ints are used to index into vectors, pause type is used to index into files to get a byte. And finally, you can also set the cursor positions by saying seek g, seek to the following position. Go to gx or seek p, position the put cursor to px, where gx and px have to be paused type. Push, tell g and tell p. Tell g and tell p are method defined inside fg. That tells you where the read and write cursor are currently located. Any act of reading and writing will move around the read and write cursor. g is get and p is put. Put is write. So this is how it works. In a particular file, so think of the file as a contiguous chunk of bytes. Every read will advance gx. Every write will advance px. But there is no necessary ordering between gx and px in general because you are allowed to move them around. We can also set this up, set up gx and px using seek g and seek p. And the current positions can be known by calling tell g and tell p. Writing may extend the file. Reading will never extend the file. Reading may run out of bytes and signal an end of file. So this is the current situation. Now armed with that, we'll write this interesting class. So so far, we have been looking at the boost vectors which know how to dump themselves to a file and read themselves from a file. But those have been in the non-compact ASCII format, complete with brackets and commas and all kinds of stuff. And clearly if there are large elements, you'll take many more bytes to write them than just a double or a float. Just like we saw, to save one integer, you might take 10 bytes. So we don't want that. We want to write a new vector class, say. We'll not use boost. We'll just start from the standard vector class. We want to write a vector class which is capable of dumping itself to disk in compact format in exactly the amount of space required by its components, elements. And it can also load itself up from a disk file. So let's write that. The way to do that is to inherit from the vector class. Before we get to general inheritance, let's look at simple inheritance from our point class. Remember, our point class had or struct had a double x and double y coordinate. If I now want colored points, I can extend the point class by saying struct colored point colon public point. It means anything that was in point will remain public in the new class. But I'll add a public field called color. Now you could also say I want a mass with the point because I'm simulating planets. Then you can say colored point mass extends colored point with a mass. So your extensions of classes or inheritance can go multiple levels. So similarly, when we write a vector that reads and writes itself, we'll use inheritance. So boost lets you read and write matrices, but these are in textual format. So we'd like to store an integer in exactly 4 bytes on the disk file as well. But we cannot directly view this file because it does not have ASCII character codes in it. If we try to do that, you'll get some garbage. Now to store a vector int to disk, we will first store the size in 4 bytes. And then we'll store each element in 4 bytes. That will also let us read it from start to finish easily. So here is the code. Here is my read write vector class. I use f steam and I use vector. And I have rw vector, which inherits from public vector int. So all methods in vector int will still be available to any user of rw vector. How do I load it from the file system? If I'm loading it, the assumption is I'm deleting the current state of the vector entirely. So I resize to 0. The original elements of the vector all go away. Nn is the number of elements I have to read from the file. And of course, load takes an argument which is the name of the file, which is given as a car star. Now I open an if stream because I'm only going to read it, ifs with file name, and I want to read it in binary mode so that I don't do any mess with new line stuff. Now the important thing is this read statement. Remember, the read can only read character buffers. But what I want to read is an integer, nn. nn takes four bytes. So what I do is I take an address to nn, and I pretend to the system that it's a character point. I also tell the read to read a number of bytes, which is the size of nn. So there's a size of operator in cnc++, which tells you how many bytes of RAM this item needs to store. So size of nn will evaluate to four internally. You shouldn't use four because someday someone may change this type to long, long, or something, and then four will be incorrect. So what this does is it reads four bytes from disk in order. And it lays it out exactly in the four bytes of RAM, which you are supposed to be storing nn. So the picture, let's say here is my RAM, and here are the four bytes. nn is basically at this address, which is say 10,000. Meanwhile on the file, there are these four bytes. byte v0, v1, v2, v3. And my get cursor is here. At this point, if I take ampersand nn, that literally translates to byte address 10,000. I make it a character pointer. And then I say read four bytes from the file. So these four bytes are read. And because I passed address 10,000 to the read command, or read method, those bytes are literally pasted into those four positions. But now I'm free to go back and interpret that as an integer. Let's say I will store the vector to a disk file. So I open an OF stream with the file name and iOS binary, no new line conversion. And now the first thing I have to dump is the size of that.  Since I'm inheriting from that object, all fields and methods of the object are still available to me. So I can just call size. And now I say OF stream dot write. Again, I have to pass it a fake character pointer, but which is actually pointing to the starting byte of the integer called nn. And I also have to give it how many bytes to write, which will be four bytes. This will do the reverse process. It will look at four bytes in RAM which represent the number nn and transfer those four bytes exactly in that order to disk. See, I'm not using less than, less than, or greater than nothing like that. After this, what do I do? For int ix equal to 0, ix less than nn plus plus ix. And I have to now write out all the members in this vector. So here there may be a bit of a mess because what do I write? This box, that doesn't quite work. Is there a get in the vector method? I don't exactly know. So suppose I say int element equals what, this. So you might say it should look like this expression, but that will not work. Everyone knows how to do this? I think that works. Let's try it out. I'll explain if it works. It's only complaining about main. Therefore, it's pretty much done. Let me provide a main, and then I'll come back to explaining what's going on. Empty for now. So what's happening here is, remember I refer to size because there is a size of the current object. The current object basically is an extension of a vector int. And so I can always access size of that vector. Similarly, remember vector also provides an indexed element access operator. Unfortunately, that has no other name. And so those operators that are overridden like plus or multiply or boxes, you actually have to say invoke operator box on this object with argument ix. That gets you the next, the element at ix. That's the syntax. It's just Mamoyambo. In this case, we don't, let me try this. I've never tried this actually, bingo. So you can just say operator box with ix. Now after that, of course, we have the job of writing it out to the file. So I say element and size of element. So I, yeah, so I'm going to do that. So let's leave our implementation of load unspecified. Let's not bother. Let's just say that, whatever the class is, rw vector in all lower case. So we'll say rw vector, rw v. Then we'll say rw vector.pushback say 5, rw vector pushback 656. And then I'll do rw vector.store. And then I'll do dump.binary. This is no longer a text file. So observe that the method called pushback is coming from the original implementation of vector int. But the method stored is not defined in vector int. That is defined here. So think of it as overlaying your new definitions of methods on top of the earlier ones. If you define something here which is already defined in vector, your definition will have precedence. Because you're layering on your implementation on top of the lower implementation. But we're not doing that. Store wasn't defined. And therefore there's only one store. And I have to give it a filename. So I've given a filename, dump.bin. So let's try to compile this and see what happens. From string constant to car star. Oh, 35. Let's not bother with that. It's just being pedantic. So now suppose we run rw vector.exe, it runs. And it leaves behind a file called dump.bin. Why is it 12 bytes? I wrote the size. Then I wrote two integers. So it's three integers or 12 bytes. No new line, nothing. What is the contents of it? Let's see. So I'll do a, if I try to cat, dump.bin, strange foreign characters weird stuff. Maybe my screen is messed up trying to print weird, not yet. So the safe thing is to do a hex dump. So if you do hex dump-c, dump.bin, let's see what the characters are there. Let's see. First of all, the very first byte I write. The very first integer I write is four bytes. What are the contents? 0, 2, 0, 0, 0, 0, 0, 0, 0. So it writes from the least significant byte onwards. The actual number I wrote first is the number of elements which is 2. 2 written in hex is 0, 0, 0, 0, 0, 0, 0, 2. So read it like Urdu, from right to left. So the first four bytes record the size, the number of elements. Then there is 5. And then there is 656, which happens to be 0 to 90 hex, which is now to full integer specification is 0, 0, 0, 0, 0, 0, 0, 0, 9, 0. Total bytes is 12 bytes, because there are three integers being written here. Isn't there maybe a starting code? Nothing. It's bare. Yeah. What does the system do that the file has ended and put back in the beginning? Just because you read the two blindly first, you realize how many more things to read. Because the first number is 2. So the convention is the number of elements is always written as the first integer in four bytes. So it's always safe to read four bytes, because even the empty vector will have four bytes saying 0. And then you read as many more four bytes as you require. So the assumption is that you are creating these files purely with stored and then reading them with load. If for some reason the file is corrupted here, there will be a problem. If there's a bug in the stored code, there will be a problem. If there is no metadata, that's the point. So there is no what's called metadata. There is no description of the data anywhere.  And if you have created 500 data files on disk and the source code changes, it's up to you to coordinate the change between the data file and the source code. So Java does that by the Java serialization standard. So you can store various hash codes of the object and various things to make sure that you don't try to illegally read stuff which this class didn't create. There's no safeguard here. In C++, there's absolutely no safeguard. There are other bigger packages and libraries written for that purpose. There is the Google Protobov package which you can use for that. If you want to find out about that, you can go and research it. So now let's look at the load routine. So the load routine empties out the current vector state to have zero length. Then the first thing it does is, as I said, read four bytes to find out how many more elements it has to read. And then inside, as long as nn minus minus is more than zero, as long as there's more stuff to read, it initializes an lm, which is an int in this case. It's an int vector. And then it reads, what does it read? An address to lm factor, the character pointer, and four bytes. And then once it has lm, it pushes it back to the current vector. Pushback is a method in this vector. I can always use it from any other method in an extended class. And finally, in all cases, I have to close. I didn't close the OFS. It's a little funny that it still worked out fine. It might not have. And then ifs.close. So now, suppose I have rw vector, say rw v2. I can now say rw v2.load dump.bin. And that will load up the same elements. For example, I can at least, as an indicator, write out its size. Let's see if that comes out correctly. 9.15, there's some colon problems. So forget about those. C out was not declared because I didn't have IEO stream in it. So deprecation is fine. This is just a warning. So now, if I do that, the file will be written afresh. And then the vector will be loaded up with the proper size of 2. You can even print out the elements, it'll be fine. So questions on this. So the main things to learn here are that by taking an address of any primitive object, and then also knowing its size, using a size of operator, I can use that variable and its size in calls to read and write inside fstream. And this will transfer the bytes used directly to the other guy, to the file, or back, between file and ram. The important thing to note is you can't do that with composite objects like vectors. You have to write your code to do this. Only primitive objects which are packed densely in ram can do this. Structs can do this, generally speaking. Structs with primitive things in it can be written out. But structs with a vector in it can't be. It has to be a contiguous byte sequence for you to transfer it as a contiguous byte sequence to disk. Yeah. What is that operator I have switched the text for? Yeah. So suppose in here, RWV is our read write vector which extends vector. So I can always have an expression of the form RWV2, right? This box bracket open and close is actually not supported primitively in the language. When you say RWV box2, this box bracket is translated into a method call. So you declare that method by saying it's an operator with an argument which is an int. Somewhere inside vector, there was a declaration of the following form, public. Public is already there. So int operator box int ix return stop. That's how the implemented of vector told the C++ system that hereafter, on a vector, you can call an operator with box brackets with an argument which is an integer for the index. The return is like from that native buffer, you might want to return whatever PA, Ix, that sort of thing. Because we are not implementing it, I can't use PA. If you remember, in the other this class, when you are implementing vectors, see in this get class, I was giving an offset and I was returning a float. Now that means that inside main, you cannot really use, you cannot say so far, vec1 of vx. This is not allowed. If you wanted to do that, to make it even closer to the system's vector implementation, then you would have to declare an operator. So instead of having a get like this, you'd have to say float operator int p const, where inside you would have the same code. Or you can say return get p, that would also work. Const is because I am only accessing the pth element. I am not changing it. That's why. Just like get was not changing it. So if you define it like this and then at the end you say, try to say something like vec vx equal to something, that will flag an error. But the point is that these things are declared like operators, so that you get the comfort of using native array like construct. Now the problem with operators is that later on, if you have to use them, you have to invoke them like this. You have to say operator box. See, otherwise you might have thought that I should be able to write int lm equal to ix, like this, this is ix. So you should be able to say this addo ix. But somehow they have a problem with this syntax. So that's why they make sure that you have to explicitly write down the word operator. That's all. No, this is not allowed. So the standard C plus the syntax is that you have to say operator, followed by exactly how it was declared with the argument list in standard rounded brackets. It's just a convention. Nothing profound. Side of the predefined language construct, which tells you the number of bytes it takes to represent a primitive object. It's defined already in C and C plus. Any other question? So the summary is that by casting it, by taking an address to any primitive object, primitive type, and then casting it into card stardom, giving it the number of bytes to read and write, you can transfer the memory of that primitive variable directly to and from disk. That's the bottom line. And we have here used it to extend the class vector of ints to be able to dump it to file and load it from file very efficiently. You use exactly the same number of bytes as in RAM. Now for the last exercise here, suppose things get pretty extreme. Suppose I want to represent a vector which is like 50 gigabytes large. And you don't have enough RAM for that.  But you just want to run code with a 50 gigabytes large array. How do you do that? So we want to write a new class called file vector, which doesn't even have any existence on the stack or heap. It's entirely implemented on disk. We already have the pieces we need to the puzzle. We know how to seek, reposition the read and write cursor. That's equivalent to indexing. You should be able to do this. It can be deathly slow, but let's do it and see. So class file vector as a public interface provides a constructor. This time even in the constructor I need a file name because it's a file which is storing the data. It's not in memory. And I'll have to give it a size, which is the number of items you want to put in that array. Then we have the put get and size method. It's very simple. So I'll say put float value val into logical index number ix or retrieve the element at the ix index. So start declaring some stuff. What else do I need? So private, what do I have to store in private? The file stream itself that the end user should not see. And the size. So for simplicity, the size will not change. Once the array is created, the size will be fixed. The public stuff will be that I give you a file name and a size. And let's see. So I set size to the underscore size. And then I open. So the other thing is if you don't want to open the file right there, that's just a declaration of a private member. You can open it in the constructor. So here's an example where the constructor does allocate resource, but it's not heap resource. And then inside it gives the file name. And then I say I want to open it in binary mode. I want to both read and write it. In the destructor, I close the file. Now you might argue that in some applications you also want to delete the file at that point from disk. You can do that if you want. Size is just return size, nothing else to do. So what does put do? So now because files are indexed exclusively in byte units, you have to do your translation between byte offsets and float offsets. If I say that I want to write the float val at index ix, in the file I need to seek to byte number ix time size of float just like our cell number to byte offset kind of thing. And then I use exactly the same logic as before. FS dot write car star val size of val. That's it. How would get? The seek remains exactly the same. I need to seek to the same point given ix. And then I just read. So I read those four bytes corresponding now to a float into answer and I return answer. Now this is a relatively sloppy implementation. Well, if you give me a size beyond end of file, you'll get a error and so on. Now, so an interesting thing is this, that when I create the file, observe that the file may not have existed. In which case, when I open it, the file has size 0. And the write cursor and read cursor are both positioned at 0. What happens if the first method call I make says, put an element at position 1 million? Let's do it and see. First, let's try to compile this. So weird stuff going on. 9, 12. Anyone knows what's going on here? Maybe it's just some other symbols. But I thought I'd check this. In f stream, in and out. In and out, not read and write. So now it's just missing a main. So it's otherwise happy. So let's put in a main. Now we'll declare file vector fb. And I need to give it some names. So I say dump.bin, same old file. And let's say my size is, I don't know, let's say 1 million. So I want 1 million elements in the vector. And now what do I do? So fb.put, say 500,000, 3.4. So let's see this at all compiles. So first I'll remove that dump.bin file. Now I'll run file vector.exe finishes. There is no dump.bin. What happened there? Is there a problem? There must be a runtime exception because of some reason. Let me drop this one and see if just the declaration goes through fine. There is still no dump.bin. So clearly the creation itself is messing up. Let's try the following. So if we touch a file, then a zero length file is created. It has no bytes. It's just on the entry in the directory. Does that solve the problem? Let me take away this line. It actually puts something. So just to explain, the bug in my code is that you need to have more flags, saying if the file doesn't exist, you should create it. So let's say it runs. See if that works. I'm going to remove dump.bin again. And I'm going to compile and run this. See if the file is created this time. Yes, so that's what you need. Saying if the file doesn't exist, create it with zero length in binary mode to do both input and output. And now what happened here? The file has length to million and four bytes. Why is that? Well, I declared the vector to be stored as having one million floating point numbers. That's actually four million bytes. But I only wrote the 500,000th number, which will happen at the 2 millionth byte offset, half way across. So it will opportunistically only allocate up to that point where it has to write, not beyond that, if you don't tell it to. Can we hex-dump it? If we hex-dump it, you see something that it's full of zero bytes, null bytes, up to this offset, where suddenly there are four bytes, 9A, 9, 9, 5, 9, 4, 0, which is internal floating point representation for 3.4. So hex-dump is very smart in not repeating garbage bytes. If it's all zeros, it will give a discontinuity. If you want to be pedantic and print all of them, let's find the flag to do that. Verbose is cause hex-dump to display all input data. Any number of groups of output lines which will be identical to the immediately preceding group of output lines are replaced with a line comprising of a single asterisk. So if you don't want that, then so this is what happens. The asterisk means that the line of null bytes or zero bytes repeats many times. If you don't want that, you also pass a verbose flag. And now you see that there are lots of lines with zeros in them. So lots and lots of lines with zero bytes until you reach the 2 millionth byte, where 2 million through 2 millionth 4 bytes are those four precious bytes that we wrote, 3.4. Now this looks terrible. I just wrote 4 bytes and 2 million bytes were allocated. But the funny part is that in Unix, Unix is smart enough to create what are called files with holes in them. So this shows up as taking 2 million and 4 bytes, but actually it doesn't cost the file system that. To find out, you can actually ask how many kilobytes of storage does, I think so, let's see. So how many blocks of storage does dump.bin actually cost the file system, just four blocks? So du says disk usage. The disk usage by dump.bin file is actually very small. Once you start writing into the earlier location, then we'll start taking space. Yeah? Yeah. That will be much lower. The file will be like 24 or something. Then it will be always 5. It depends. It allocates a small prefix of the file. It's unclear how much. I don't really know. So suppose this was replaced by 5. Let me delete the file again. Compile this guy. 24 bytes. With the payload being in bytes 20 through 23. This is byte 16, 17, 19, 20. 21 over 20, 23, 24. 16, 17, 18, 19, 20, 21, 20, 23. So 24 bytes in all. So what's the summary here? The summary is that we could grow this indefinitely. You could pass a size which is gigabytes. The file system, even my tiny laptop has gigabytes of space left. You can easily store it. And this is not as absurd as it sounds, because now with large flash disks, which are somewhere between the speed of RAM and hard disk, you can easily keep very, very large data structures like this in flash disk. But it's a file on flash disk, but it's much faster than actual moving head hard disks. So there are many applications, including modern distributed file systems, which keep a lot of their directory structure on flash for very fast access. There are companies which specialize in multi-level storage strategies for distributed file system, which use tricks like this to store their data and metadata, like directory data, file data. They're partly cached in flash. When the thing is idle, they push it back into hard disk, that sort of thing. So that's pretty much that. So the summary is we were only able to scratch the surface of computing, as the intention was. If I intend anything more, I would have been mad. So we started with basic syntax, how to declare variables, constants, then statements, if then else loops, followed by basic aggregate data types like 1D arrays and 2D matrices, looping through them, solving interesting sorting, searching new molecular algebra type problems. Then we went into functions, how to break up your code into different modules so that things are maintainable and readable more easily by yourself as others. Then we looked at recursion. We looked at techniques like dynamic programming, which can cache partial results of recursion and make things fast, and take less storage. Then we went into objects, structs, objects, classes, members, methods. Then we looked at memory management. How do you take memory from the heap and return it when you choose to, except instead of having to give it up when the scope closes? You can pass it around. One more comment I'll have to make from the pointer slide right at the end. This is important. So of course, since you created a pointer to a record, you want to pass the pointer around in your application between very different data structures. In general, you want multiple pointers to the same record in application. Otherwise, why are you doing it anyway? For example, you could have a bank program where fixed deposit accounts and checking accounts point to the same shared customer record. But you need care in destructors. Deleting a checking account should not destroy a customer record because the customer will still be holding a fixed deposit account. But should deleting the last account of a customer delete the customer record? Who knows? Probably not, because you might have tax reporting obligations until the end of the next financial year. So these are partly policy, but partly also program design. There are packages by which you can do memory allocation not directly from C++, but through someone else's package who will keep track of the number of references to a pointer and delete the storage when the reference count goes down to zero. Now, this is not a panacea for memory management because the following story. So there's this famous professor at Stanford, John Bakas, I think, who used to code in Lisp because they used to do AI. And in Lisp long before Java, there's this problem of garbage collection. If the user doesn't need some memory anymore, how do you free it back to the system without an explicit delete? See, Java doesn't require an explicit delete. It will take back memory when it can. So how to identify memory that the user cannot access anymore and therefore that can be reclaimed has always been an intriguing problem. So one day, a graduate student ran into John Bakas's office and said, I found a way for perfect free memory reclamation from the system. John Bakas patiently sat the student down and said, let me tell you a story. One day, a graduate student ran into John Bakas's office shouting, I found a perfect way of memory reclamation. So you see where this is going. So we've already seen that we can do linear link lists. And suppose instead of the tail going to null, I chain it back to the head. That's a circular data structure where every node has reference one. But there may be no external pointer into this list. So clearly, reference counting is not enough. You have to trace all possible parts from variables in your code into the heap and see how much can be accessed. Now that is called a mark and sweep garbage collection strategy. You mark anything in the heap that you can access, and you sweep away the rest. That's one part of what Java uses for memory reclamation. So anyway, so coming back to C++ where you have to be in charge of memory releasing, you need clean policies which are well documented in large codes so that, even when you're sharing pointers between multiple collection objects, you have a very clean, reliable way of releasing the memory at just once.  That's well defined. Or you might say that there is a home collection which is the primary determinant of the memory allocation policy. And no matter which other data structure you're copying pointers to, those are not in charge of freeing up the memory. So far we have used vector of ints, vector of floats. What if I have a vector of int star or vector of customer star? When the vector is destroyed, C++ will not call delete on each of the customers by default. If you want to do that, you have to overwrite the vector's default destructor. So you should write your program such that all but one data structure does not delete the elements on destruction of the collective. Whereas that last home collection, when that is destroyed, that should go through every item and destroy the pointers. So if you keep the memory allocation cleanly separate in destructors and constructors, and you have clean policies for who is in charge, who owns the memory logically, then you'll avoid a lot of needless bugs and frustrations. So now coming back to after pointers, we ended up the course with a small treatment of file IO. Without being at the mercy of less than, less than, and greater than, greater than to do ASCII-oriented IO, we found a way to dump primitive variables into disk and out of disk directly, exactly like the memory image. And now if you have composite object, for everyone, you have to write some routines method which will decompose the composite into primitives, maybe recursively. So maybe this load store of a container object should call load store in the content object. If I have a vector of ints, I know how to store ints. If I have a vector of customers, I don't know how to store the load customer. Therefore, the store method in the vector of customers has to call a store method in each customer in turn. And they just keep on appending bytes to this random access file. And then the store of the outer guy finishes, similarly for loads. So load stores are also recursively cascaded into collection object. That's how Java works. That's how Java serialization works, by which you can pass objects not only onto disk and back, but even onto network and back. When you do a Google query, there's a lot of quantitative data that passes back and forth between your browser and the Google server. Much of it is actually structured data, including did your mouse dwell on a particular link for more than a certain number of seconds? That triggers an event, and that is communicated to Google. So all this communication is done on a network. And in fact, the network looks surprising like a disk which has a sequence of bytes. You open a socket, you pump in a sequence of bytes. You open a socket, you read a sequence of bytes. So whatever applies with fstreams with very minor modification also applies to sockets over the network. So anyway, that's the end of the course. The course is not over by any means. So there's a lot of activity left. On Sunday, there will be the lab quiz. I think on Sunday, we'll be able to fit four lab quiz slots, and then there'll be a makeup separate from that some other day. It's all in the calendar. I don't have it in my mind right now. Suitable crib slots have been set up for all pending exams. Finals are on 30th. And thereafter, we have the correction and crib sessions all planned out. So the important thing is, please watch the calendar carefully, because unlike earlier on in the course, if you slip up now and then everyone will leave for vacation, it's very hard to make up. So try to be there for everything that's important. There should be also another session of special tutorials to make up for all the damage. So please try to attend that if you can. So this is being videotaped up to last lecture of all the videos now. So make sure you watch those. For the final exam, make sure you compile, run, and understand all sample codes. They're quite a lot of them. They together covered a lot of ground. So that's probably the most important thing to do for preparation. Read the sample codes and understand them.


Hello everyone. It's really great to see all of you. So definitely some names I recognize, but also a fair number of people that I haven't met yet. So it's really nice to see all of you. Yeah, as Natalie said, we are here to talk about the mainland restoration project, what the project is, how we're engaging like associations and community groups and local volunteers in this work and how you can get involved. And then also a little bit more about how this project came to be. We are going to start with a little introduction to loons because while so we all here we all love loons so so I will be turning it over in just a second. I did want to introduce the co-presenters for today and some of our project partners. This is a, the mainland restoration project is a five year collaboration that started in 2021. And it's a partnership between main auto auto coordinates the project and then we have main lakes and Lakes Environmental Association, the promised got nation. And with close collaboration with the main department inland fisheries and wildlife. So in addition to me at main Audubon, I'm also going to be co-presenting with Ethan daily and autumn door and Oscar Mattis. And James Reddick from main lakes will be popping in at some point. And we also have Maggie Welch on here. And is Rachel on as well. Okay, Rachel Harper is also here from main lakes. So, oh, I'm sorry, from Lakes Environmental Association. Excuse me. Okay, great. So, yeah, so with that, so that this is our team and who you'll be working with if you decide to join this project in some way. Right. And I'll go ahead and turn it over to autumn now to start the presentation about wounds. Thank you. Um, did you share the presentation. Oh, you can see. Oh, yeah, it is supposed to be shared. Sorry. Okay. Okay. Yeah. Here you go. And go to the next slide. Thank you. That's better. Yes, perfect. Yeah, so I am autumn and I'll start off with a brief natural history about wounds. First, I'll start off what wounds are up to right about now. So right about now, wounds are male wounds are coming back to main lakes. Our main lakes are melting out and icing out. So once the ice is off the lake, the male loons will return and begin setting up their territories. So a territory is just a spot of on the lake that ranges from 20 to 200 acres. So the average loon territory is about 100 acres. And this territory will have hopefully a good amount of fish and habitat for them to nest in. And some things that can happen during this time, loons will be very aggressive over their territories. And as a result, there will be conflict and fights. So for example, this picture right here is of two male loons fighting and these fights can result in injury and even death. So it's not very good for them to happen when we consider maybe putting a raft on a lake is very important to consider territories to make sure that we don't put a raft on the edge of a loons territory that could cause conflicts like these. So during this time they'll do territorial displays, like here this is a penguin dance, which is kind of like a display of toughness and fitness to other loons on the lake. And then once they have set up the territories the female loons will come. Okay, next slide. Okay, so here is a picture of a loon that is doven under the water. And as you can tell loons are very well adapted for hunting and swimming underwater loons, their primary source of food is fish so they have to hunt underwater using their eyesight to catch their food. But clear water is very important for loons. You can tell that loons are a super unique bird, just by their ability and body shape for how well adapted they are for diving. You can see that they have a beautiful teardrop body shape that really helps them swim smoothly through the water. They have very dense and heavy bodies compared to most birds, which then causes them to have some troubles flying compared to other birds. Some things that make them very dense is that their skulls are very heavy, and they have very thick bills and skulls. And this helps them to have kind of a for a weight in the front of their bodies to help them dive underwater. They also have a lot of solid bones when other birds tend to have hollow bones to keep them to make them lighter. And then of course loons feet are positioned way on the back of their bodies as you can see in this picture that really helps them to be excellent swimmers. But unfortunately, these features do have some troubles on land. So we can go to the next slide. So when loons nest, loons prefer to nest right on the edge of a lake or an island on a lake. And this is mostly because they have difficulty walking on land.  They're kind of not so graceful on land. And because of that, loons when they are in face a threat of some kind, their instinct is to dive underwater to escape that threat. So when a loon built its nest, it tries to build it right on the edge of the water, like in this picture so that if there is a threat of any kind it can dive into the water to escape the predator. And then loons when they're looking to choose a nest site, they're looking for a nice sheltered area that is kind of out of the eyes of predators. And they're looking for an area that is kind of out of the way of wind, and they generally prefer to nest on islands so that mammals can't walk to their nests. Okay, next slide. Some threats for problems loons run into with their nests. So with their nests being right on the edge of a lake, they can have, if their lake fluctuates in any kind of if it goes up and the water level rises, this can cause some problems such as nest flooding. So this picture here is from the Adirondacks of a loon nest that flooded and the eggs will wash out of the nest. And then another example is maybe the water level goes down. And so then the loons, which have trouble walking on land, have to kind of scoot to the nest for and make these little drag marks. And that means that they have to spend a lot more energy getting to and from the nest, and it's more difficult for them to run away from predators. So fluctuations in the water level could be caused from maybe a dam management, or a drought, or kind of a flood. But another fluctuation in water levels is also caused from boat wakes or waves from wind. And these waves can wash nests. So we use generally a raft to if there's like an asset have been struggling for a while. But rafts can only address most of the problems with water level fluctuations. But this picture down below is of a very large boat right wake. And you can see here, this metal cage is part of one of our rafts and you can tell that unfortunately this week is too much for this raft. And the nest didn't do very well. Okay, next slide. Thank you. And then so some disturbance problems with nest. So loons nesting on our lakes and main lakes tend to be kind of a busy spot. It's where everybody wants to be in the summer. And unfortunately this can cause some disturbance problems in these pictures are showing a very stressed and scared loon. So either knowingly will go too close to a loon to get a better look in their boats, or not knowingly because loons tend to hide their nests. And they don't even know that they're close to a loon. But it's good to give loons a good distance. These pictures so a loon and like a stressed position, they tend to get very low to the ground hoping that you won't see them. And they're kind of on the edge ready to hop off their nest at any moment. And with the disturbances it causes loons to hop off their nest more frequently and leave those eggs exposed to predators. Okay, next slide. Another disturbance that we might not all think about is kayaking and canoeing. I think that a kayaker canoe is a little quieter, a little more peaceful, and you can get around more silently with it, but kind of the opposite is true though. You can get in kayaks. Kayakers tend to be able to go in that shallower water and areas where loons nest, and they can get a lot closer than they should, which can cause a lot of disturbances to the loons and make them very stressed. So this here is a picture in the Adirondacks of some kayakers getting way too close to a loon and probably causing it a lot to stress. Okay. Next slide. And then some other threats that loons face while they're nesting is different types of predators. So a natural and unnatural. So an unnatural predator, but maybe be your dog, just getting curious, wanting to see the loon scaring it off the nest, maybe accidentally stepping on his eggs. So as somebody on a lake, it's always good to keep in mind where your dog is and make sure that it doesn't get too friendly or scare away any loons of my kind. And then there's also other predators. So eagles as loon and eagle populations go up. There has been a lot more threats from eagles. Eagles will try and land on loons to eat either the adults or chicks. And when loons nest on islands to avoid most predators, eagles still can get to them. So predators that are mostly on land are minks, skunks, raccoons, possums, and a bear. Bears, we haven't had any recorded incidences of them in Maine, but this is a picture of them in the Adirondacks. So it is a possibility. But pretty much these mammals will try and get up to the nest and eat the loon eggs and maybe a chick. Next. And then so another threat to loons is habitat loss. So for example, a pair of loons might return back to their place in Maine on the lake and then they might find that there's no longer a spot for them to nest there because some people have built a home. Our lakes in Maine are getting more and more popular because they are a beautiful place to be. But that means unfortunately that there's less and less natural habitat along these shores for the loons to use to nest in. And with that there's less vegetation and trees for cover for these loons. So here are some pictures of loons using people's front yards and beaches and docks to sit and nest in. Okay, and then next, okay, and next I will hand it over to Oscar. All right. Thank you, Adam, for that. There are actually even more threats that loon can face loons can face. It's important to look at loons parenting strategies and how some of those strategies can kind of make them vulnerable. Loons in general are really all in on parenting. They usually just have one chick per broods, one chick per season. Sometimes two, very, very rarely three. So the majority of the time the parents are putting all of their energy, all of their time into just one chick, about three months of very constant care. And in the first few weeks of them caring for them, you can see sometimes they'll carry this chick on their back to protect them from predators. It's very cute, honestly. Next slide. And those chicks do start off small, but they do grow pretty big. Like Adam said, loons are heavy birds. And that takes a lot of fish. And that means that not long after the loon has hatched, the parents have to spend almost all of their time out on the water fishing. And that means that they can't really afford to stop looking for fish and hunting just because a boat or a weight border or a jet ski goes by. And that can make them pretty vulnerable and susceptible to boat strikes. The number of boat strikes that we're seeing is actually going up next slide. Yeah, so Autumn did touch on some of the disturbance issues that loons can face when they're on their nests on the shoreline. But like I said, while they're out on the open water, they're at a serious risk too. We do think that boat strikes are passing lead poisoning as the leading cause of adult loon mortality. There are some laws in place to help mitigate this. There's no wake law within 200 feet of shore or an island on all lakes. And there's a law in the works to change that to 300 feet, but we can get into where that is later. And it's not just giant speed boats that cause an issue. Small personal water crafts like jet skis can also harm loons both through these direct collisions, boat strikes, but also because they're able to get into smaller coves and harass the loons even unintentionally and really disturb them. It is illegal to harass the loons. It's not always intentional, but when it does become intentional is if a loon starts to swim away from you on your boat, just don't follow it and then you should be okay. Another thing that boats can do is even if they don't hit or even really disturb the loon parent themselves, they can cut right between a loon chick and their parent and separate them. And those chicks are fully reliant on their parents at the start. And that leaves the chicks unable to eat and also very vulnerable to predators because they don't have mom or dad there to bite them off. Next slide. Yeah. And like I said, boat strikes are surpassing lead poisoning potentially, but we do still know that for many, many years, lead poisoning was the number one cause of adult mortality. When we do find a dead loon, or another organization finds a dead loon, they're able to do an acropsy to figure out what it was. And oftentimes we do find lead fishing tackle in either their stomachs or their gizzards. And part of this is because loons need to swallow stones to aid in digestion. So if they're looking at a muddy lake bottom and they see a lead sinker, they'll hunt that out and swallow it and then it'll sit in an organ designed for digestion instead of passing through and the lead toxins can just build and build. In addition to lead, there are also issues with monofilament entanglement. Yeah, we're working to help mitigate this and yeah, he's in can get into that in just a bit. Next slide. So that was a pretty quick overview of a lot of the threats that loons face on their breeding habitat. But that is only a small amount of their life history. They spend a lot of their time out on the open ocean. In our part of the world in the Northeast specifically, our loons are really short distance migrants. So a lot of the loons that breed in Maine, also winter off the main coast. And we can see there's a graphic here from BRI. So that's the Biodiversity Research Institute based out of Maine, where all of these circles on here are loons that they banded and all the triangles are where they recovered those loons. And you can see it's really not all that far. Most of the loons that breed here stay in New England. Some of the ones in MDI only travel a mile or two to get back into the ocean in the winter time. So when talking about how to mitigate threats, we need to also be thinking about the amount of time that loons spend out on the ocean. So they're susceptible to boat strikes like they are in lakes, but there are some unique threats to being out on the ocean. One of which, a pretty big one is oil spills. And one oil spill in particular is why we're all here today. On April 27, 2003, there was a barge called the B120 barge from the company Bouchard. It hit a rock that tore a 12-foot hole in the hull, and that spilled out about 98,000 gallons of oil into Bouchard's Bay, so in Maryland and Rhode Island. This affected hundreds of miles of shoreline, so that was beaches, rocky coast, shellfish beds, salt marshes, all just completely covered. Next slide. And this had a pretty enormous impact on loons and water birds in general. There were 479 dead birds collected and representing over 30 different species of water birds. There are 76 loons that were found dead and 128 live oiled loons collected, but unfortunately only nine of these survived. The estimates are around 531 loons that died from this, and we know that we only collected a small amount of the total birds killed and that a lot of them could have been washed out to sea. So this had a huge impact on the population, not just from the loons that died, but also, if you think about it, those loons can never go on to have more chicks. So it has multiple generations of effect from this one oil spill, and like I said, these are short distance migrants, so we know that the loons that were here in Buzzards Bay are largely loons that breed on lakes in New Hampshire, Vermont, and here in Maine. Next slide. So the one good thing to come out of this is that then 18 years later, there was finally a settlement between the responsible party and the US Fish and Wildlife Service. And that settlement money was then distributed by the Fish and Wildlife Service in the form of grants to try and rebuild loon lives lost so to make up for that loss of population. And most of those grants are going to conservation organizations like us. There's also the Adirondack Center for Loon Conservation based out of New York, the Vermont Center for Eco Studies, the Loon Preservation Committee in New Hampshire, and then BRI, the Biodiversity Research Institute. Most of these organizations are doing loon rafts primarily, BRI is also doing some interesting stuff with translocating loon chicks to Massachusetts to try and rebuild the historic range. But yeah, it's this oil spill that funded this project, and then I can pass it over to Tracy to tell us a little bit more about it. Yeah. Wonderful. Well, thank you, Oscar. I'll switch the slide here. Okay, yeah, so thanks to Autumn and Oscar for going over some of the unique features of loons and how some of those features make them vulnerable to various threats. I get to talk a little bit about how we're working to try to address those threats. And also, as Oscar said, restore some of the loon lives that were lost to the oil spill. So, I'm going to introduce the mainland restoration project. And we were funded in 2021, and we're now in our fourth year of the project. And what we're trying to accomplish in these five years is increasing productivity of loons and decreasing the number of loon deaths on main lakes and ponds. And we're breaking that up and approaching that by engaging local participants, lake associations, volunteers, you know, people like you who are on this, on this webinar in a few different efforts. So one to increase nesting success. We are placing loon nesting rafts. I think you saw one that Autumn had shown a picture of. But for pairs that are struggling to hatch chicks, we are placing some of these nesting rafts to try to give them opportunities to nest more, more productively. We are also expanding our fish lead free efforts. So we've been trying to reduce lead tackle use and loon ingestion of tackle for quite some time. But this, this grant is allowing us to expand that opportunity. And we've also launched a look out for loons program. So James Redock is on this call. And he is coordinating the look out for loons program, which is an out in an effort to provide outreach that will reduce nest disturbance. Reduce both strikes with loons and also to reduce the nest flooding from boatwakes. So there are very, very opportunities to try to raise awareness and help us better coexist with loons. So, yeah, and here is the, our partners are at the bottom here. When I mentioned at the beginning, but with main lakes, lakes, environmental association, main lakes, and also got nation and with a close association with main department inland fisheries and wildlife. Okay, so I'm here to talk about one part of the program that we call the loon nesting raft program or the raft program. And the nesting platforms like this that you see in this picture. This is one of the rafts from our project. These are one of the primary ways we're working to increase nesting success. So here you can see this is one of our raft designs. It was actually designed by a Portland family to try to create a lighter raft than the cedar ones we use traditionally. And you can tell it's working here. We've got one chick here and there's another parent really close by, and there's one egg still on the nest. So you can see that, you know, rafts can be a really useful tool in helping loons hatch chicks. So with this being the, well, that we're planning to place about 100 rafts over over these five years and this is our fourth year of the program. So at this point, what we're looking to do is to place rafts on lakes and ponds where there are lake associations or individuals who are able to maintain and monitor the raft themselves in future years. So in this year next year, we can provide training and support. But I want to try to engage people who are able to continue this on for the long term. So some of the other projects that I mentioned under this, under this program are statewide, but this particular one the loon nesting raft program is focusing on working with volunteers in 11 different counties. We do occasionally work in some other areas. The main reason for that is there are some other people in Maine who are well just in Maine who are working to place rafts in other areas. So the biodiversity research institute got a grant as well under the same oil spill funding to work with tribes in down east and northern Maine. We work in the Mount Desert Island area. We work. There's a Somes-Mainel sanctuary, Somes-Mainel sanctuary, and they have a great raft program, very productive. And then over in more western Maine, a little bit into central, there's something called loon conservation associates led by le addicts and he's helping citizens put out nesting rafts. So let's see. Just to give you some examples of what our nesting rafts look like, rafts can be made out of a bunch of different things and they can look a lot of different ways. We have chosen two different designs. So the classic cedar log design that's been used for 50 odd years, even more than that. And then this newer design designed by Reed Robinson and Laura Robinson to create a more modular design that can be disassembled to make it lighter to take in and out. Yeah, other, let's see. They have various features in addition to what they're actually made that the bases are made out of. Some will have avian guards like this, like here. Or others will be open, but all of them will have some way to produce some kind of shade or visual barrier. So in this case, the tall plants are providing some shade and some visual barriers. In this case, we put some bows over an avian guard and avian guard is for use in a place where there are a lot of eagle or gull pressure to take eggs. And we can put these on to just to deter those predators from the air. We don't put them on usually on the first year or until the loons take to the raft, just because there's some speculation that it might make them less likely to nest on the raft if it has an avian guard. But once they're established, they're fine to use it. Also, some rafts will have these wave guards. So if there is, we usually put them in a protected non-wavy spot, but if there is some threat of wake or waves, we can put guards like this up to block some of the waves. Okay, and then, yeah, we usually float them so that they're pretty low to the water. So here you can see that it's only about an inch to four inches from the water level. Okay, so those are some good examples of what a raft looks like. What we're really trying to achieve with a nesting raft is to make it as much as possible like a natural nest. So you can compare with these two pictures, the two different nests, the natural one versus versus the other and there's some similar features. So a nest bowl, they have some vegetation surrounding them, and a pretty easy on or off. So a raft in this case, though, is that it can rise and fall with some of the threats that Autumn was talking about with wakes or with dam management and other and when it rains and they're like level rises, or when there's drought. So if as long as your anchor lines are slack enough, rafts can really take some of that rise and fall that would normally flood a natural nest. And then you can get, they can get the loon pair away from predators and onshore recreational activity. And so it can reduce disturbance and predation. They're not flawless with predation because there are things like raccoons can swim pretty well. And so we'll try to get them further offshore if there are raccoons nearby. So really try to achieve placing them well within the loons territory. You saw some of the disputes and territorial disputes that can happen when, when there's a raft or a nest when they're, when they're really trying to fight for a territory. So if you put the raft well within a loons territory you're less likely to attract another pair and invite competition. I already mentioned the easy on easy off so we kind of make it so it's not too high for them to get on and off and in a pretty low disturbance area so that's what we're looking for in a raft. We've done with our program so far in 2023 we put out 30 new rafts in addition to relaunching 27 that we put out the prior year, and we accomplished hatching 17 chicks from those rafts, and 10 of those survived. It's a little bit lower survival than the year before, tough year for various reasons. But yeah quite a, it helped a lot with hatching chicks and keep in mind these are pairs that haven't hatched chicks sometimes for decades. And we put a raft out there and now they've been hatching chicks, where they have not been able to in the past. So, you know, so why don't we put these out everywhere I mentioned that we're putting these out in about in 99 territories, over five years. So, why aren't we putting them everywhere, how do we decide which pairs get a raft. You know, rafts have been helping to hatch chicks for a long time can be a really useful tool, especially for pairs that have difficulty producing chicks. And they can be a really good way to address some of the threats that we went over earlier. And that's only the case. It only holds true if they're used in the right situations the right locations, and with the right pairs. So rafts come with risks and they can actually hurt a lens pairs chances of hatching chicks successfully. So it's a very bad idea to just throw a raft out there without understanding more about the pairs history and the dynamics of that of the lake. And here's why. So rafts do come with significant risks, you know that coincides with their, their benefits. So if you choose well they can be beneficial if you don't, you can have some of the things that you're seeing here that rafts can make the nest more visible to avian predators. So if eagles and gulls are really a strong presence on your, and they affect hatching, you probably a raft isn't your best solution, we can use them on lakes that have eagles, because they can address other threats. But if that's your only problem if eagle predation or gold predation is your only problem, you probably don't want to raft for that. And then I mentioned that if raster place too close to another loon loon pairs territory, it can attract attention from a neighboring loon and can end up in these fights and can't even lead to death so that yeah that reduces the chances for over the long haul for that pair to produce. And rafts can sink and flood and they can break loose, they can float into another pairs territory. So they really do take some, some careful maintenance and careful design. Other animals can use them, especially we think about geese because they nest just a little bit earlier than loons, and they can take over rafts. So, so we can, you know, lose the opportunity for the loons to use them. And let's see it. And while we, yeah this last photo here you've seen already. This is a raft that was put out, not by us but by a group on Kees or Lake. And while they help a lot, rest up a lot with wave waves and wakes, there are limits. And so on this, this particular raft the eggs did wash out in this case when there was a wake boat that went by. And the take home message is that things can and do go wrong with rafts, and they shouldn't be just put out anywhere without a lot of consideration. And so we're here to help with that for anyone who is interested in a raft and think you have a good candidate. There's definitely a way, a way around some of those issues that can arise. So, so you can think about putting in a raft, especially if it meets these four criteria that I'm going to go over so one if there's continual nest failure so if the pair tries to nest every year, and if they fail to hatch chicks, then that's probably, especially if it's at least three years that they failed to hatch chicks in a row, then that may be an opportunity to put out a raft to help them. But keep in mind that loons don't nest successfully every year, and that's okay. So it's really when we get to multiple years where you want to start thinking a raft could help. I'll go over this a little bit more but you know, rafts can really only address certain problems. And the other thing is there needs to be a suitable location. And so we what we look for is a place that's in a protected area away from predominant winds and waves, not in a place where there's a lot of boatwaker or disturbance, and also some physical conditions, like there has to be enough water so that the raft can float and they don't have to go across land to get to the raft. And then there has to, we usually try to put it about 10 to 50 feet offshore. 10 feet if you have some people in there who are angling or we don't want people going in between the raft and the shoreline that can disturb nesting. But if, if you have predators that you're worried about you might want to go closer to the 50 foot distance. Okay, and then the last part that we look for and determine if it's suitable for raft is really the dedication of people who are willing to help with this. And as I mentioned, we only have this year and next year left of this project. So we want to be able to work with you to be able to train you and give you materials and get you all equipped so that you're ready to carry this on on your own, and that the commitments there. Okay, so if all those apply, if you can say yes to each and every one of those, then you're probably a good candidate for a nesting raft. And I just wanted to quickly just show some pictures of the, of the types of threats that rafts are really good at addressing to emphasize those so they are really good at addressing land based predators and water level changes. And they also are helpful in addressing shoreline disturbance so if you just got that raft a little ways offshore here, it could really help nesting, even if it's a fairly busy area. It's a lot less intense than all of this beach traffic and habitat loss. So, there, there can just be some optimal habitat if there's development or if there are changes along the lake shore and rafts provide that habitat. The last thing to consider before you jump into a raft is consider if there are other actions that could accomplish some of the same ends, and by addressing some of these threats that women's face. So, could you do outreach to lake users and maybe that would reduce enough of the disturbance so that they could nest successfully, or is mortality from lead tackle is that more of a problem. A raft couldn't really help with that. So what's next if you're interested, I'd say first, you would soon get in touch with either us at loon restoration at main Audubon.org, or if you are in the Bridgeton area in the service area for the lakes environmental association. You can email Maggie at main lakes.org.  So in addition to putting a raft out. It's important to monitor it to see if there's nesting success to see if the raft is being used to see if there are any problems with the raft. So we do have webinars on April 2 at noon and at five. And we'll be also posting a recording of that one on our website on the project website so that if you miss it, you could still get some of that training. And then we would love to schedule a call between you and your group so that we can see about getting a raft in and to see if you're a good candidate for the raft. Then from mid April to mid May, you could work with us to deploy a raft. And we would bring all of the raft materials with us. We asked for a very little contribution from you and which includes two cinder blocks for anchors and then some cedar or pine boughs so not much that we ask from you. And then monitoring throughout April to July weekly monitoring submitting data, and we'll also be doing check ins with staff. And then we ask in August through fall that you continue monitoring, as long as you can, and at least until the chicks leave the lake or are at least six weeks old. That's when we consider them probably likely to survive. In the fall zone will also work to retrieve the raft and store it over the winter. Okay. So, I mentioned that monitoring is a really important piece. So, though, there are those online trainings.  And here is a paper form that we have so that as you're out there on the lake, you can be looking at that the sheet and making your observations of loons and documenting what you see. We also have resources like this is the laminated sheet that will help you to answer the questions that are on the survey form. And in addition to the paper form we also have an online data entry option. And here, and we'll be putting some of these links in the chat, but, and you can also find them on our website. But you can go to this and also enter online and Maggie had a Maggie Welch had a big part in creating this online data form so big thank you. And then just some resources that we have so there's a raft guide. And there's a video that you can get to so here's the video, and it goes through the different types of rafts and what when they're appropriate to use and how you can choose an appropriate location. And then some other resources in general are just on the project website that I've been mentioning, and this is the URL for the project website. So with that, I'm going to turn it over to to Ethan, and I think James will probably James radical probably also chime in at some point. So, thanks so much. Yeah. Thank you Tracy so yeah, all the organizations involved in the main lunar restoration project are involved to some degree in advocacy and outreach on behalf of loons and one program that we're very proud of is the look out for Loons which is our nest protection and outreach program. And the main point of this program is to engage community members in loon protection with the main two goals being to decrease nest disturbance and reduce loon deaths from both strikes and lead tackle. And the way they do this is by providing training and support for local participants to distribute outreach materials conduct presentations. To help lake users reduce disturbance on nesting loons sites, whether that be in a kayak and a wake boat, whatever that may be. And main lakes heads up to look out for Loons project and at this point I'd like to invite James right icon to introduce myself if you'd like to just say what he does with the project. Hi Nathan. Hello everybody I see a couple of names of people that I've worked with in past years. Last year was our first year of officially launching the look out for Loons program. And we have a growing group of what I like to call ambassadors that are out on mains lakes and ponds, helping really spread the word about what can be done to help decrease disturbance and increase the likelihood of a successful nesting season. I don't know about you guys but sometimes it seems like there's just a lot of bad news about what's going on in the natural world. And if you've ever asked yourself, what can I do? Is it hopeless? Is there something I can do to help? Well guess what? This is a project which might be for you. There are lots of ways that we can educate you on how you can help get the word out to fellow lake users. So if you're interested, please get in touch with us. I think Ethan you're going to put up a post an email that people can reach out to me or you'll hear about some webinars that we have coming up in early April that you can participate in. Hope to see you then. Yeah, thank you James. That was a great message and yeah we'll be putting up the way to get in contact with the look out for Loons program. But yeah, next slide. Yeah, and just to go over some of the outreach materials that look out for Loons does distribute. The first pamphlet that they distribute is how close is too close. And this is really emphasizing nest disturbance. So autumn talked a lot about the behaviors that stressed or concerned Loons show. And this pamphlet talks a lot about that, you know, that position where they're hunched over their nests, freaking out. It educates you on how to tell when a loon is concerned or stress. And by knowing how a loon is behaving, it helps you change your behaviors so that you're not causing any more aggravation on Loons. So that pamphlets really about how to not disturb Loons and how to not contribute to any failed nest attempts. And the next pamphlet is called Living in Loon Territory and this pamphlet provides info about activities that can be taken to reduce impacts to Loons. It talks about Loons safety laws and a calendar of what Loons are up to at different times of the year. And just to talk about some of those laws, one of the biggest impacts on Loons at this point that Oscar talked about is wakeboats. It talks about, this pamphlet talks about the different wakebo laws. Currently, the rules are to go no more than headway speed within 200 feet of shore or islands. And that's a big thing to emphasize islands because Loons love nesting on islands too. We're finding that it's more safe for wakeboats to be 500 feet off of shore, but we're still trying. There are other people in Maine Audubon working on advocating for that law. But at this point, that's the law. And so it talks a lot about the different laws that boat users, specifically wakeboat users have to follow. And that's because wakeboats are heavy boughs that create a large surfable wake and they really churn up the bottom of the lake, creating turbidity and just disturbing the wildlife in the area. And so that pamphlet talks a lot about how to live in Loon Territory and how to keep a safe environment for Loons. So yeah, next slide. And going off of that, Lookout for Loons is hosting a couple of programs soon on Wednesday, April 10th. They'll be hosting two programs, 12 to 1 and 5 to 6 p.m. And these can be found at the Maine Audubon Loon Restoration Project link that I sent in the chat. But this is a free online event that's just an introduction to the Lookout for Loons program. And yeah, it can, it's the gateway to getting involved with the program. And the second program will be offered on Thursday, or the third program, sorry, will be offered on Thursday, April 11th from 5 to 6. And this is a refresher training for past participants. So James said, you recognize some of your names. That's great. That would be a great program for you to attend. So yeah. Ethan, if I can just add if for some reason those dates don't work, don't hesitate to reach out to me. We can find alternate ways to get you up to speed.  So you'll see my email address later in this presentation. You can always feel free to reach out to me. Yeah, great. Yeah, next slide. And this side's all about signs. So, look out for Loon. The Lookout for Loons program will help place nesting signs where appropriate. Our current thoughts and thinking on nesting signs is that sometimes they make Loon nest more visible and actually attract more attention. And so we have very specific criteria for where we want a nesting sign to be placed. And those are listed on this slide right here. So is the nest highly visible or in a heavily trafficked area where, regardless of the sign being there, people are going to see the nest. If that's the case, then it might be good to have a sign there. If the nest is being disturbed constantly would be good to have a sign there. If the sign is not in the way, or if the, sorry, if the nest is, if the, if the sign won't be in the way, that's another criteria is to have. Then it would be a good spot for a sign to be. And if we have the landowner's permission, because sometimes we're not allowed to put these signs here. But yeah, this is the policy on nesting signs and this is actually a really effective means of protecting Loon populations and at the Northeast Loon Study working group conference that just took place a couple weeks ago, states like Vermont and New Hampshire reported a lot of success and positive correlation between growing Loon populations and having nesting signs available. So this is a really great program as well and feel free to reach out to the Lookout for Loons program on how to get involved here too. Next slide. Yeah, another program that we're really proud of here at Maintain Audubon is the fish lead free program. So this is all about making sure that when we're fishing on our main lakes and ponds that we're not using lead to bait and tackle an update but lead tackle anymore. And yeah, this program's been around for a bit and the goal project is to of the project is to reduce Loon deaths from lead tackle. And the way we do that is through tackle exchange so exchanging lead tackle for non lead tackle lead free tackle and then another way is collection bins at the top right of this slide you'll see some PVC piping. And we can set you up with some PVC piping and these collection bins can be just posted at docs or entry points for boaters and anglers and it's just a means of dropping lead tackle in those PVC pipes getting rid of it. And then the third way we do this through tackle buyback which I'm going to talk about later in this presentation. Excellent. And but before I do that I just want to talk about why fishing lead free is important. In a presentation done by an intern with the RI in 2020, they found that lead poisoning in loons was actually the leading cause of death for 26 years between 1990 and 2016, which is a big stat, I mean, a lot. Every time the loon was dying, not every time but lead was a leading cause of death in loons. Over time that's decreased. As Oscar mentioned, the balance is sort of shifting lead with our advocacy for fishing lead free lead related deaths are going down, but other things that are going up or trauma from a bunch of different things one of which being boaters. But lead is still right up there as a leasing as a leading cause of death so we have a long way to go. Another reason why we should officially lead free another reason is that loons are a bio indicator of the environmental health of our lake and pond environments so they're really indicating the health of all the species around them whether that be fish other types of birds plants. And so the more deaths we see in loons whether that be from lead or other causes. And the less healthy the environment around them is it's an indicator of that so it's important that we keep trying to reduce deaths, especially from lead and then the third reason why to fish lead freeze that wounds experience really terrible symptoms. Tracy if you could press play on this video. This is a video that would, this is a video of a loon that was poisoned by lead. And yeah, it's alright if it doesn't play. Yeah, I'm sorry it's not playing. Yeah, it's okay. Basically, in this video the loon really the fact that this video is even taken is crazy because loons would be far away at this point if you were this close but the loon dips its beak into the water doesn't really know what's going on. And this is, this is a symptom of disorientation. It has heavy breathing other symptoms they experience are weakness or paralysis blindness vocal changes wing droop all sorts of things that loons should never experience because there are sacred birds. This is a good video if you could see it very sad. And it's also worth noting that the Sportsman Alliance of Maine used to have a leader in their organization George Smith who was against lead tackle legislation he thought fishing lead free. Why do we do this. But then he actually saw this video and was involved with it and saw the loon in distress, and it completely changed his attitude is this direct experience. It completely changed how he perceived the issue of fishing lead free, and he actually became a stalwart advocate for lead tackle legislation so that's pretty cool story. So yeah. Excellent. So how do we get rid of lead tackle as I mentioned there's a bunch of different ways. One of the ways is tackle exchange. So in 2023 main Audubon hosted 12 exchange events, or attended 12 events in which we held tackle exchanges. And these were anything from ice derbies to sportsman shows to local tackle exchanges. And these are some pictures right here and it basically it was just an opportunity for fishermen to come in return and let tackle and pick up some lead free tackle and return it's a really cool opportunity. And it's really great. So yeah. Another way we do fish lead free is outreach. As I mentioned previously outreach is the name of the game with educating people about these issues and we did that with stickers led lock cards fact sheets event posters and presentations. And we have all those resources and we're just looking for people to give them out to so if you're interested at all and advocating on behalf of this please let us know get in contact with us and in 2023. We distributed nearly 2000 lead lock cards as well as 1500 fish lead free informational fact sheets and 16 posters so we're just trying to get the information out there. Anyway, we can. So, yeah. And finally, our tackle buyback program and so other states have this and it's been pretty successful. And the idea of it is if you go to retailer you can turn in one ounce or more of lead tackle at participating retailers and receive a $10 voucher in return to seemingly buy lead free tackle. It's a good program it's really incentivize incentivizes anglers to turn in there to lead tackle and last year in 2023 74 and a half pounds or an estimated 2600 pieces of lead tackle were collected. And these are just overall statistics 2300 pieces of lead free tackle were distributed through exchange events and buyback programs and a total of $8310 vouchers were distributed to retailers this year so $830 worth of money going into people's pockets just for bringing in lead tackle. So it's a good program. Excellent. And beyond that, our advocacy teams working real hard to make sure that lead tackle never sees the light of day again. And one example of that is bill LD 958 which was enacted on June 20 2023 by the governor, and it will go into effect. In September of 2024 and this law will make the sale of painted jigs within the currently banned size and weight classes illegal for sale. So it will help close a loophole in mains lead tackle laws which allowed for lead paint to still be on jigs. But the jigs themselves not be led. So it's removing that loophole and just getting more lead out of the water which is really great. Our team worked hard from that on that and so sale will be illegal in September of 2024 this year and in a painted lead jigs will be completely legal for use by 2026. So yeah, working on expanding protection. And I think that's all I have so I'll pass it back to you Tracy. Great. Okay. Well, thanks so much everyone. I've been answering some questions, as we've been presenting, but love if anyone wants to raise their hand. Natalie can unmute you and we can also continue to type answers if you would like. I do see one here from you Cindy that I can go ahead and answer now. Well, others are thinking of questions. So, yeah, the wake zone is a huge crowd on our small lake. No restrictions on the size or speed of boats. These folks. Yeah. Okay. So I would be interested to find out how to get at least one buoy. Yeah. Okay. So I can send out there is a number to call at the Bureau of Parks and lands and also a website that I can send you to and it usually has to come from a lake association and you can the association can request additional wake buoys. Or if you don't have any now, then you can request your first one. And I didn't want to mention that while it hasn't gone completely there has been passed in committee. Right now, but there is an addition to the no wake law that it may soon be 300 feet from shore and islands and a depth of 15 feet. So, okay. All right, I see another one. Yeah, Cindy, feel free to raise your hand if you want more information there or if that answers it. Okay, and share more about loon social groups. Yeah, so loons are actually quite social in the non breeding time so the only time that their territorial like that and have those those fights is, is during the breeding period if they're part of a pair. Otherwise, or if they're competing for a territory. Otherwise, they do spend a lot of time socializing and they reinvent some studies of in wintering areas where they forge large social groups and we'll even do some cooperative feeding. So, yeah, it's most of their time is not spent in territorial type behaviors because they're out on the ocean, a long time. And often you'll see groups of it can be in the fall, especially when they're starting to move towards migration can have to 40 loons in a big group. During the breeding season will often be more like, you know, six to 10 or something like that. But yeah, and then they'll just spend their time together often those are ones that are looking for territories to establish a territory. They're also watching other pairs and watching how successful they are at nesting, and then the next year we found that they will be competing for those those territories that were successful the previous year. Yeah, so we often yeah we often think of them as just territorial but there is a fair amount of social behavior. Let's see who makes the decisions about where to place a nesting loon sign on a big like a lake like range lead. Yeah, so we used to not the state used to not support putting out nesting signs, but through this project. They, they've seen some other states where they've had a lot of success with loon nesting signs and so this project they're willing to give it a shot and have us if we decide that there's a pair that meets the criteria for being disturbed or by human intrusion or if they're likely to fail at nesting because of human intrusion then we can think about placing a nesting sign. Let's see, I lost the other part of that. Yeah, and so we would come and help you determine a spot and then the only thing we ask is that you build the base for the floating base. So yeah, it basically I guess the short answer is give either main likes to call or us and we can, we can get a sign for you if it's there's a good location. That would help us with getting some land some permission for putting that sign out. Okay, and then how can we get copies of brochures showing you know the what we call the how closest to close brochure. Give us a call or an email and we can get those out to you, we don't have enough to send out large quantities but up to about 50 per lake we can we could send you. Any other questions or anyone else who wanted to pipe in on any of these that, if you would answer differently or had other information and be. Tracy, you might just remind folks that those brochures, you can get digital versions of those. On site as well. That's great. As we always have limited supplies. Yes, that's great. Thank you, James. Perfect. Yeah, and so all of these are on that. The website here I can, I can go off of my share for a second here. And let's see. And if I can find. If I can get us onto a website and I'll share my screen again so you can see it. See. Yeah, others. Yeah, feel free to fill the space while I'm doing this or how about with someone else bring up the mainland restoration project website and just share your screen. So I'm not floundering around too much. See, do we have any other questions. And then we've got a little bit over. We have a question about the no lead laws and loon in New Hampshire, Massachusetts and Rhode Island. I just did some quick research can confirm that each of those states have similar really strict laws to main in terms of lead sinkers and jigs. All three of them prohibit the use of lead sinkers and jigs with a total weight of one ounce or less. So, pretty good for those states as well. Thanks Ethan. Okay. Oh yeah so there's the website there. Yeah. And so there are different sections to it where you can scroll down a little and just see that yes so you can find different resources that we've mentioned under all of these tabs. There's a raft guide and video in that raft program one in monitoring you can find your monitoring form and you can also there's a link to the online data form. Yeah the background on the project, some of our webinars that are coming up I mentioned the monitoring webinar that would be in that upcoming program section. So you can register. For those webinars. And then that there's also a link to the lookout for loons program so main lakes maintains the majority of that but we have put a link on to our website is what the project website. Yeah and there's the brochure that James was mentioning with cool animation. Am I missing any other questions. No question are there speed limits for boats or jet skis. Just the. I think there are individual speed limits, but overall it's just the no wake zone laws that within. Now it's 200 feet of shore or islands that you have to go headway speed. So not fast enough to create a wake. Yeah, so otherwise I believe it's only you know marked areas and then and then individual speeds. Anyone know it differently on. And yeah, who regulates the speeds. So when you get permission to get a swim buoy that also has some restrictions on people using the area but yeah in general it's that no wake law. And then can someone watch this zoom. So within a few days we should be able to get a YouTube link up on the website and we'll try to email those out to anyone who's on the on these webinars. There was a question about the impact of fireworks on lose Tracy do you have any insight into that. Yeah, so that's been, we did have a bill in not us but the main groups in general had a bill in. A few years ago now maybe four years ago. And the main issue is that it's, there hasn't been much documentation of problems that fireworks have caused like we do we do know that loud noises and disturbance can affect nesting productivity but because this is that this is a great, not often a time when people are taking photos. There's just so little documentation of how fireworks are affecting Lou and so I would say, yeah, if you can get game cameras out. We'd love to know more, but you know everyone suspects that there are some and there is some anecdotal information about wounds that were on the nest and then the day after the fourth of July, no longer on the nest and the nest was abandoned. But yeah, as for evidence that would actually pass any kind of bill around fireworks we just don't have it or relying on you out there to help us know what the impact is. Yeah, super hard to see I see that to see here, but he had a group of over 100 loon stop by on a, wow on a snowy day that's amazing. Oh, so you have a link there. All right, let's see if we can. Can we get to that. I don't know if we can get to that with that URL. I don't think so, but I think that'd be awesome if you could email that to us. Yeah, but the email. Thanks Sarah that's amazing to see that many. Yeah. Well, thank you more shoreline distance for wake boats. Yeah generated enhanced waves, even if wakes, the boats are passing 200 feet. They produce a 13 inch high wake sometimes even more than that, that can in and data loon nest. Yeah, so the most of the research is showing that when a boat is using wake enhancing equipment that 500 feet is about the minimum to to not affect shoreline property and the nesting. So yeah so you're right we do need to keep advocating for more. Thank you so much everyone if you have more questions you please get in touch with with us with with James Reddock and with Maggie. And we really appreciate all of your support and looking forward to hearing from you. Thanks so much. Take care everyone.


Brown leaf tips can be caused by under watering, so check the soil and if it feels dry, water! With tropical plants, it can also be because of lack of humidity. So put them on top of a humidity tray or close to a humidifier. It can also be the cause of too much fertilizer or tap water. Some plants are too sensitive for chemicals and tap water, so make sure to use filter, rainwater or put it aside in a bucket for 48 hours to get rid of most of the chemicals.