This week has been a work week on doubly linked lists. Working on a menu driven program that do the same thing as a singly but instead of only moving forward, it can transverse both forward and backwards. I am going to try this project differently by instead of following the nodes, it will follow the content inside. The only obstacle i will have to face is getting over duplication of numbers so we shall see. In my data comm class we are still working on asterisk, finding new implementations everyday! and for HPC, well.. i should do more work with that
This week we have actually learned some new things! We learned stacks, which are like containers that hold data and spit back out. But it acts differently, like it takes in the data but the last piece to go in is what comes out first. So it reverses the data that is entered and this can be used in certain instances. Another thing we learned is recursion, where a function calls itself so it will loop within itself until it hits a stopping point! This is very useful and i actually will be using it in my list because i believe it will come in handy printing out a list backwards, so will a stack but i dont completely understand it yet with the push and pop functions. Data comm and HPC are still the same where they are, working on asterisk and not working on my drum machine.. i need to step it up or else its going to be a bad time. I just cant get arduino to work!
This is week is another work week but our doubly linked menu were due. And mine was pretty boss, i am now called the recursion king! Just to let you all know. But seriously i got recursion to work in my program and it was a very different implementation then the other programs and i was quite proud of it. Now i just need to work on my stack program, which now i do understand more and i will have to start working on it very soon. We havent really learned anything else, just a test and working on programs. Nothing else. Still trying to get arduino to work on linux and i am having no luck, it wont execute files for some reason for to run the program. Like it wont download the software i need, i have to look deeper in i guess. And i kind of miss data comm this week and came back to working on something new with sound files and images. We will see where this goes lol
This week has been an interesting week, with hurricane sandy coming through. So most of our projects were pushed ahead a week so thats good because i procrastinate a lot :D but other then that, we learned about a binary tree sort, which doesnt seem to hard conceptually but implementing it might be difficult. We can either use recursion, iteration or stacks and you better believe im using recursion, i want to get better with them. So after this stacks program is done i will be doing research on the binary tree and start headway onto the project that will be put out in the future. For HPC i am still stuck on making any headway into this project, i just dont understand why i cant access the software or my sound driver, im in a rut. And for data comm i am not totally sure whats going on because i missed class because of the hurricane so i dont know what we are doing yet!
A stack is a very important part in computer science, especially in the programming field. This could be helpful in many functions even like a simple yet probably not widely used function, reversing a string. Its simple but if we didn't use a stack, it would seem mildly difficult. A stack is like a deck of playing cards, you place one card down and continue stacking cards on top. Then when you are ready, you take the top card off and continue on down. Thats how a stack works, push stuff in and pop stuff off, LIFO (Last in, First out).
queue overrun condition
Queue Overrun/Overflow Condition happens when a program attempts to add an element onto an already filled queue.
When you have a overflow, you attempting to add more to something you can not simply add more too. Okay lets say you have a queue of size 5. So you throw in five numbers such as: 27, 6, 45, 87, and 92. The numbers dont really matter, you can throw in 1-5 for all i care lol. The point is, this will run just fine but once you try to push on another such as 23, it will produce an error or a seg fault if you have prepared for this error, that error will be a overflow. You have put too much on hat the size of the queue just can not handle.
IVR system
IVR system is the automated voice that you hear when you call some company! This automated voice helps direct the user through a series of steps that the user has to go through to complete a task. They can either use touch tones, dial tones from the keypad or even use their own voice. Basically it eliminates the need for an actual person to do the work when the computer can do it all! It can do simple tasks to very advanced ones, either way its a very useful to be using.
Freeswitch
Freeswitch is an open source communications piece of software that can be used for the creation of voice/messaging tools. It can be used as a standalone application, or embedded and ran with other programs.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
This link above is showing real world applications of the freeswitch and how well it worked in real life. Freeswitch is like a phone that will use voip, and if you implement it right with say, oh i dont know asterisk, you can eventually get a free phone service going in your LAN. Now people have made it able to be used with WAn, like where they can call other people not in your network or in your config files and that link above will show that. other than that, i dont really know how else to demonstrate but to show where it can be used in real life.
Data buffer is a place in physical memory that holds data temporarily while it is being moved from one place to another. So say you have music from one place you want to move to another, well when you make this transfer that sound will be held in a buffer during the process of moving. A buffer will be very useful in the project of creating my drum machine. When i get access to the sound drivers and transfer the sound over that i want, im going to need many buffers to hold all this data while it is being moved from input, to process, to output. here is some example code:
typedef struct { void *buffer; int32_t length; int32_t tail; int32_t head; volatile int32_t fillCount; } TPCircularBuffer; bool TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length); void TPCircularBufferCleanup(TPCircularBuffer *buffer); void TPCircularBufferClear(TPCircularBuffer *buffer); // Reading (consuming) void* TPCircularBufferTail(TPCircularBuffer *buffer, int32_t* availableBytes); void TPCircularBufferConsume(TPCircularBuffer *buffer, int32_t amount); // Writing (producing) void* TPCircularBufferHead(TPCircularBuffer *buffer, int32_t* availableBytes); void TPCircularBufferProduce(TPCircularBuffer *buffer, int32_t amount); int TPCircularBufferProduceBytes(TPCircularBuffer *buffer, const void* src, int32_t len);
Data buffer is a place in physical memory that holds data temporarily while it is being moved from one place to another. So say you have music from one place you want to move to another, well when you make this transfer that sound will be held in a buffer during the process of moving. A buffer will be very useful in the project of creating my drum machine. When i get access to the sound drivers and transfer the sound over that i want, im going to need many buffers to hold all this data while it is being moved from input, to process, to output. here is some example code:
typedef struct { void *buffer; int32_t length; int32_t tail; int32_t head; volatile int32_t fillCount; } TPCircularBuffer; bool TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length); void TPCircularBufferCleanup(TPCircularBuffer *buffer); void TPCircularBufferClear(TPCircularBuffer *buffer); // Reading (consuming) void* TPCircularBufferTail(TPCircularBuffer *buffer, int32_t* availableBytes); void TPCircularBufferConsume(TPCircularBuffer *buffer, int32_t amount); // Writing (producing) void* TPCircularBufferHead(TPCircularBuffer *buffer, int32_t* availableBytes); void TPCircularBufferProduce(TPCircularBuffer *buffer, int32_t amount); int TPCircularBufferProduceBytes(TPCircularBuffer *buffer, const void* src, int32_t len);
here is an example of a simple buffer:
typedef struct BufferBlockHeader_st BufferBlockHeader; struct BufferBlockHeader_st { BufferBlockHeader * pNextBlock; }; struct Buffer_st { long int totalLength; BufferBlockHeader * pFirstBlock; short int startPoint; BufferBlockHeader * pLastBlock; short int endPoint; }; typedef struct Buffer_st Buffer;
Its only the buffer so this is not a full program or anything, its just showing how it would be created and used. Its being thrown in with a linked list while the buffer are holding data that will eventually be placed within the list itself. That is what a buffer will do!
Is it possible to convert decimal to binary using recursion instead of loops?
As the recursion king i am using my knowledge to put forth new experiments into my kingdom. Recursion is where a fucntion will call itself and loop till it reaches a sentinel value and will print out your data, recursively! Now i will be doing a decimal to binary conversion, which is simple to do by hand and or even write out an algorithm on a computer. Here is a bash script that was written that converts decimal to binary:
1 #!/bin/bash 2 a=0 3 echo -n "please enter a number: " 4 read number 5 until [ $number -eq 0 ];do 6 n=0 7 until [ `echo "$number-2^$n"|bc` -lt 0 ];do 8 let n=$n+1 9 done 10 let n=$n-1 11 let number=$number-`echo "2^$n"|bc` 12 places="" 13 for((i=0;i<$n;i++));do 14 places="${places}0" 15 done 16 places="1${places}" 17 let a=$a+$places 18 done 19 echo "the binary is: $a " 20 exit 0
This is a example of the algorithm that is used in converting these numbers and it will be used in this experiment just taken a different way, without loops! :D
I believe it can easily be done, with the algorithm i know that can solve this problem, i believe with the implementation that i will be using will make this easy, in fact even easier then loops and if statements!
Im going to write the program, compile it, and run it and see if it works!
1> Write the code:
1 #include <stdlib.h> 2 #include <stdio.h> 3 4 5 int binary(int); 6 7 int main() 8 { 9 10 int nb; /*This is number binary, its just a variable the name doesnt really matter*/ 11 int nd; /*this is number decimal and same here lol*/ 12 13 printf("Please enter any decimal number: "); 14 scanf("%d", &nd); 15 16 nb = binary(nd); 17 printf("Binary value is: %d\n", nb); 18 19 return 0; 20 } 21 22 int binary(int nd) 23 { 24 25 static int nb,remainder,factor = 1; 26 27 if(nd != 0) 28 { 29 remainder = nd % 2; 30 nb = nb + remainder * factor; 31 factor = factor * 10; 32 binary(nd / 2); 33 } 34 return nb; 35 36 }
2. Execute code:
lab46:~/src/datastruc$ ./binaryrecursion Please enter any decimal number: 10 Binary value is: 1010 lab46:~/src/datastruc$
Side note to you and mainly myself lol: The static was used because when the fucntion calls itself it actually loses the data that was held with the remainder, factor and nb. So i looked up what to do about that and static was one, which keeps the data held there long after the scope of the fucntion is over so when it is called again we can still have that data and it will be good to go! Or also, i could have passed them all through the fucntion and made it a void so i wouldnt run into that issue, but both ways will work just fine.
Based on the data collected:
What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.