After a bit of math we come upon the equation 10e-3t(ej(4t-53.13degrees + e-j(4t-53.13degrees

Now recall that(eic + e-jc)/2 = cos c

What that means is we can finish this off by multiplying by two and just taking the contents of the () in the equation and make it cos(4t - 53.13degrees)

We learn that if we have an equation of the form:|K|e-jtheta/(s+alpha -jbeta) + |K|ejtheta/(s+alpha +jbeta)

We can directly convert that to the equation:2|k|e-alpha*tcos(beta*t + theta)Found in table 12.3 page 493

Looking at the equation 10(s+2)/(s2 + 2s + 10)you can use the repeated roots method above, one more thing to look at though is can you convert it into a form that can be solved by the tables?

Well if you complete the square you'll get the equation:10(s+2)/(s+1)2 + 32

That looks ALOT like the s domain equation for e-atcos(wt)

Well we can make it look even more like it by simple manipulation and we'll get the equation:10((s+1)/(s+1)2 + 32 + 1/3 * 3/(s+1)2 + 32)

This can then be easily be moved to the time domain where we get:10e-t(cos 3t + 1/3 sin3t)

Now recalling that cos (a+b) is equal to cos(a)cos(b) - sin(a)sin(b),we can assume that since we have the 3t we can call that a or b (doesn't matter)

Now separately we look at the co-efficients for the cos and sin and call them A and B where A (and A = cos a) is the co-efficient of cos and B (and B = sin b) is the co-efficient of sin and say that:(A2 + B2)1/2 (square root) cos(the remaining variable - tan-1|B/A|)

What that means is that we can take the above equation and apply to our time domain equation and get:10.5e-tcos(3t - 18.43degrees)

Which happens to be the exact same equation that they got in class and it's alot quicker.

Next we worked on Problem # 2 from the quiz.We solved it out for the repeated roots, and got the answer'sk1 = 4k2 = 200k3 = -4

*Interesting note, not ALWAYS but there are times where k3 = -k1.

Transfer FunctionRecall that H(s) = Y(s)/X(s)

With this equation there are always 4 possibilities1. X(s) can be either a voltage or a current source2. Y(s) can be either a voltage or a current source

If X(s) AND Y(s) are both voltage or current then they are dimensionless.if one or the other is voltage or current H(s) is basically either z (impedence) or 1/z

AP 13.10aWe want to do the "unit step" of the function, well since we solved the equation earlier, we need only multiply the equation by u(t) or in the S domain 1/s

AP 13.11We are looking for the unit impulse response, what that means is that since the unit impulse response in the s domain is 1 then the output is the h(t)so we would convert v0(t) = 10000e-70tcos(240t + theta)to the S domain to get H(s) (or the transfer function)to find the step response we would need to know that tan(theta) = 7/24,recalling the right triangle we can solve for cos and sin, and solve this equation as well for H(s).

What does this all mean?

Warning I don't know everything nor do I claim to, the below is not something that was taught to us and frankly its only my observations, correct or not that is all they are!

I'm not 100% but from what little I've been able to gather is that this is the "form" of the Ohms law for functions in the S domain, it's not 100% accurate, but in general if you have some equation and you know the 2 of the items H(s), X(s), or Y(s) then you can solve for the third one.

Since Y(s) = H(s) * X(s) that would most likely equate to the V = IR in the normal equation.

Since H(s) = Y(s)/X(s) that would be like R = I/V which sounds about right.Finally X(s) = Y(s)/H(s) which equates to I = V/R.

So obviously if we had some equation where X(s) is a Voltage, we would want to remember that if we swapped current and voltage in these equations, we would want to invert H(s).

Thats about all I can figure out from this at this point, I only know what I can extract from this information and it appears to me that this is essentially a more generalized version of the Ohms law, it seems to make sense to me!

Starting with Repeated roots.1. Make sure it's a proper fraction, if it's not long division is required.2. Write out the equation in k/x formI.E. k1/(s+1)3. The equations with nothing raised to a power can be written as a k/equation, and solved like normal.4. The equations with the power can have the first power written as k/equation...I.E. k2/(s+4)35. Any additional roots are to have the derivative taken then solveI. E. d/ds(k3/(s+4)2)Then d2/ds(k4/(s+4))

So lets try AP 12.6We get the equation in the form (4s2 + 7s + 1)/s(s+1)Written as k/s + k2/(s+1)2 + d/ds(k3/(s+1))

Now REMEMBER taking the derivative of k3 requires you to remember that you are solving for k3, but the equation you take the derivative of is (4s2 + 7s + 1)/(s)after taking the derivative you should end up with 4- 1/s2 evaluated at -1k3 = 4 - 1 = 3

So we solve it and get the equation:F(s) = 1/s + 2/(s+1)2 + 3/(s+1)Converting back to the time domain is as simple as looking at the tables and converting directly back.

1. fi(t) represents the input, or X(s) in the s domain2. h(t) represents the processing of the input (voltage or current), or H(s) in the s domain3. fo(t) represents the output, or Y(s) in the s domain

This process now only works in the S domain.

Now what we can gather from this is that if the input changes we can determine the output by finding the answer to the equationX(s) * H(s) = Y(s)

So what this means is that if we have H(s) solved we can change either the input or the output and determine the other.

Finally we went over the quiz and were recommended some problems to work on.

Monday, June 29, 2009

I was reading the book Mastering Regular Expressions by O'Reilly (BTW a great book and one I'd like to eventually do a review on), one of the initial topics the author spoke about was using regular expressions to check a file for errors. I liked the idea, but typically again we had to open the command prompt to run it and it was just not as "friendly" as I like things to be.

Onward we look to my context menu "hack". Basically what we'll do is write a perl script that will take whatever file was passed to it check it for errors and then when you want you can close it.

Lets look at our order of events here:

Discuss the script

Point you to the how to add to your context menu (we'll need to use the registry editor since windows doesn't seem to like perl scripts in the file types box)

What this line does, is checks to make sure you at least have one argument, if you don't then it waits for you to type a file in that you want to check (or as stated you can drag the file onto the window). If you use an argument we'll print the file (in case you didn't actually type the filename in)

This rolls through each line of the file (each line is a different item in the array), checks for words that are error OR errors OR error(, prints that line and then increments our error counter as well as we increment our linenumber variable everytime we move through the array.

Lets look at our Regular Expression:$inputLine =~ m/\berror[(s]?\b/i

Breaking it down it literally means
match the beginning of a word, if it matches error error( or errors and ends the word and any variation of capitalization we can find we will return a positive match.

This can be modified to work with any kind of error or even any kind of other word you might want to look for in a particular file.

The last 2 lines basically keep the window from closing immediately if you haven't setup your system to keep the window open after running.

Next comes updating our registry to handle this!!! Check out this page, it contains a detailed how to modify our registry to add a command to the context menu.
What we'll be looking for is the txtfile entry.
if there isn't a key for shell add one, then add Check_For_Errors (or insert whatever you want to call it), then add one more key for command. This is the command I stuck in for the REG_SZ:cmd.exe /k "C:\batch\checkErrors.pl %1"

So what that's going to do is open a command prompt and run the following which happens to be our perl script. just substitute the location where you saved your perl script at.

Lets check it out, I tried the above script on a text file containing this text:

This line contains an error.
if I knew any better there would be no errors in this file.
But unfortunately I will always make some kind of Error.
Now I know this line doesn't contain one.
But this one contains one with a ( like this error(
the only problem we'll run into is if we get errors(

1. We convert to s-domain2. We find a node voltage equation3. We solve for the node(there happens to be only one node so we only need to solve for the one node).

Then it's Solved!

Next we worked on problem 13.42

1. Convert to s-domain2. Get node voltage equations3. Make v2 in both equations the same(simply multiply both equations by the coefficient)4. Add the equations and get one equation.5. Multiply thorough all the parts, and then combine like items,

First we worked on problem 13.8cit turns out that there is only one node so the equation is:v1 - 20/s / 2 + v1 / 1.25s + v1 / 20 /s - 5/s = 0

Now we can simply solve for v1

Next we went over Thevinin starting on page 520, figure 13.17 - 19

First we migrate to the s-domain, so we end up with480/s for the source2*10-3sSince we are looking at the circuit and the 60ohm resistor is not connected so it has no current running through it, so we can get rid of that particular resistor.

We end up using voltage division because we want to know the voltage at the inductor in this particular example.

vth = (480/s / 20 + .002s * .002s)so pulling things out and canceling things out we getvth = 480 / s+104Next we want to convert it to look at it from the a and b terminals, so what we'll want to do is get rid of the source, remember:

voltage = shortcurrent = open

doing that we can get zth zth = (20s / s + 10000) + 60

Cleaning it up we get: zth = (60s + 6*105 + 20s/s + 4)

and finally we can get:80(s+7500)/(s+104)

Now we add a 5uF capacitor to the a and b terminals, so looking for the current we get:Ic = (480/s+104) / (80(s+7500)/(s+104))Basically what we're looking at isIc = vth / zth + zc

after solving it we get 65/(s+5000)2

We would be able to do partial fraction decomposition to continue but that is outside the scope of this class period, so we didn't continue.

Next we worked on problem 13.20 on page 5521. We want to move to the s-domain2. Next we find Reqnote: we use voltage division in this case.3) Using Partial fraction decomposition we want to get the k's4) Convert back to t-domain

Monday, June 22, 2009

This will be a multipart series to explain how to do some speed testing/throughput of a program.

So I was thinking about this the other day,I have a few programs that take a little bit to get setup and start running. I found that I would really like to know how long it takes for a particular function to run. In the past I usually just stick a timer of some sort at the beginning and end of a particular function.

This works great for a particular function, but lets say you have a fairly large program and would like a big picture of the times of the entire program?

I got to thinking about it, now the particular version of the code that I wanted to time was actually VB6 code, so I thought "hey I can write a perl program that will just open these files up and add 3 variables in the beginning get the clock count, then move to the end of the function and get the clock count and then print it out to an output file.

So I got going....Follow along if you dare....

So let's work out an algorithm or a set of steps that we are going to attempt to do!

Search for anything in the file that starts with Public/Private Sub/Function

Insert our initialization of our variables and code for getting initial clock time

Search for End/Exit Sub/Function

Insert code to get the last clock value.

Insert code to calculate the diff from the end time-start time

Insert code to print out the value last calculated.

* A catchya I found was that even though I was opening .cls files, there is text at the beginning of the file to I suppose initialize the class as VB is opening, what this amounts to is that you have now stuck a "declaration" before the page was setup, so you'll need to trigger on sticking the code in right after this chunk of "header" data.

So now what we will hopefully have (by this point), will be the times that each function is running, also how many time's it's ran (because EVERY TIME it is ran it will print out a time).

Let's start taking apart this file I wrote up...I'm sure it can be modified to work with most programming languages...but this one will specifically explain for VB6 (possibly working for VB.Net+)

@file_list = ; #match the normal cls file extensions

So here we want to get a list of all the .cls files in the folder (since most of my functions are here this is where we'll start anyways!

So what we've done is we read in each file check to see if there are functions and if there are we open the stream to output our updated file contents to.

The interesting thing to note is that we used a nice regular expression I managed to learn from the regular expression book published by O Reilly, I plan to do a book review on it in the near future,

m/^\s*(Public|Private) (Function|Sub)/

Now the interesting thing to see is that there is always more then one way to do things, and I feel like this looks way better then:m/^(\s+|)Public Function|^(\s+|)Public Sub|^(\s+|)Private Sub|^(\s+|)Private Function/

So what I am doing is searching for a string starting with none or more spaces containing either public or private, AND either function or sub, the top example shows it much more elegantly.

I've been looking around and have noticed that my posts have a habit of getting quite long, something I would like to try to limit.

I want my posts to follow 3 c's:

clear

concise

consistent

The whole point of me starting this blog was to improve my clarity in explanations. Hand in hand with clear writing is concise writing, get to the point, explain what we're working towards, and that's it. I feel like the consistent is lacking in that I don't post often enough, with quality content,I hope and plan to work on that, I will continue to post notes from my class, but I intend to post on other subjects I've been reviewing.

If you have any other suggestions or recommendations please let me know (if anyone out there happens to find this blog....)

Sunday, June 14, 2009

I have Google Analytics setup on my blog and I can see the keywords that have actually brought people to my site.... I find this interesting and this inspires me...If it's obscure, why not try to "guess" what the person was searching for and then do a post on that subject, if it's pretty straight forward,why not solve it..

Today's keyword subject is :perl script handbrake windows

This one doesn't look too bad.

Per Handbrake.fr's site:

HandBrake is an open-sourced, GPL-Licensed,multiplatform, multithreaded, video transcoder, available for Mac OS X, Linux, and Windows

Looking at the documentation on handbrake's site, there is a command line interface, so we can use that to make any calls to the handbrake program.

This will simply take whatever specified source file we have and output to the destination location.

But if that was all we wanted to do we wouldn't need a perl script would we?

How about if we have a list of files in a document (along with paths)?

We can open that document grab all the paths then simply do a mass conversion!

The final "guess" would simply grab all files of extension x and convert them and dump them in a folder. Again this isn't hard as well.

Lets start with this one, it shouldn't be too bad, of course we'll want to do some error checking, such as if we already have a converted filename of the same type then we definitely want to hold off on converting.Regardless let's see what we can come up with real quick!

@file_list = ;@converted_list = ;$extension = ".mp4";

Here we are grabbing a list of all the files we might want to convert, note that you can update that list to contain whatever extensions you might have/like to use. We also grab the list of converted files in there just to do some error checking (in case you leave all your files in the same folder), also the output type should match the type of files you are trying to convert to. We also should define our extension for later use!

Now it's a matter of rolling through each item in the filelist, so we'll start a for loop:

By factoring it out we can find the equation-20(s+15000)/(s+10000)(s+5000)

Our game plan will include fraction decomposition, then we just convert back to the time domain using the Tables in the book.

Decomposition: -20(s+15000)/(s+5000) (where s = -10000)k1= 20

and,-20(s+15000)/(s+10000) (where s = -5000)k2 = -40

This brings us to:20/(s+10000)-40/(s+5000)

Because this looks like e-ax we can convert it as such:f(t) = (20e-10000t - 40e-5000t)u(t)

Again we need to remember to use u(t) to keep it in the positive domain which is the only place Laplace Transforms work.

Next we work on the equation:9600s/s2 + 140s + 62500

We can find a perfect square and get9600s/(s+70)2 + 2402

if we take and replace s with (s+70-70) this then looks like something we can work withso we can break it up looking at it in the respect of what does our "k" have to be to make the number 240 (which is our w), it happens to be that it has to be 2800

so we end up with:9600e-70tcos(240t) - 2800e-70tsin240t

Problem 12.18c the book actually has the wrong answer in it so,remember that the second derivative of t2 is actually 2 and since we can get (2!/s3) * s3 will give us 2 then the previous information will cause it to be 2-2 which is 0

Problem 12.35, this problem requires us to know the equation that we get from section 12.28, and that is based on section 12.6So Section 6 primarily talks about RLC circuits which you have a basic equation for:Idcu(t) = v(t)/R + 1/L(integral)v(x)dx + Cdv(t)/dt

Here are some things we can note from this equation:

We can transform each part.

We can then solve in the S domain

This will come out as a rational expression and can be solved.

We can convert back to time domain

Some equations to note:

V(s)/R = v(t)/RV(s)/sL = (integral)v(x)dxC[sV(s) - v(0)] = Cdv(t)/dt

So the equivalent circuit in the S domain will now look like this:Idc/s = V(s)/R + V(s)/sL + C[sV(s) - v(0)]

Re-arranging to make it set to V we get the equation:V(s) = (Idc/C)/s2 + s/RC + 1/LC

Now the expression is in an algebraic form and can be manipulated!This solves Problem 12.28 and allows us to simply plug in the values from 12.35.

120000/s2 + 10000s + 16000000

This can be factored down to120,000/(s+8000)(s+2000)

Using partial fraction decomposition we can get the values 20 and -20which can be easily be converted using the Laplace tables.

We can have table 13.1, 12.2,12.1 copied for the test

Some things to make sure you know what to do for the test are:

RC, RLC, RL circuits with and without source as well as with or without an initial charge

This looks alot like the transform f(t-a)u(t-a) which = e-asF(s)so using that information we can gather thata = 2 for the e-asand for F(s) we would use f(t) so replacing t-2 with t we get -5t for the exponent,so we have for F(s) a=5

Converting to the S domain we get the equation:-20e-2s/s+5

Finally we tried(8t-8)u(t-1)

we simply pull the 8 out to get8(t-1)u(t-1)Using the same equation we did for the last problem. we'll get8e-s/s2

Thursday, June 11, 2009

Disclaimer: This series of posts is to serve as notes for myself as well as any others interested in the subject of Circuit Analysis II. This is the course ECE 213 at UNM.

The course will follow the book:Electric Circuits (8th Edition)The links on the right, will contain all the links to this course's lecture notes.Starting with the class with doing AP 12.2cLooking for the laplace of :t cos(wt)

This looks alot liketf(t)which is in the table and can then be converted fairly easily, so doing this you would do:-dF(s)/ds

Substituting our equation in we get-d(s/s2 + w2)/ds

Now we would have to take the derivative and then we'll get the same answer as in the book.

Next we worked on problem 12.17athe integral of e-axdx

This looks strikingly similar to F(s)/sso substituting it in for it we get(1/s+a)/s

and finally 1/s(s+a)

In this case x and t are interchangeable since they are describing the same thing (a variable), which is why we could use the form from the table.

Followed by Problem 12.23a

Figure out the Laplace of:f(t) = d/dt (e-atsin(wt))looking at that equation we can say that everything in the parantheses would be the equivalent to f(t)

Using that we can use:df(t)/dt = sF(s) - f(0)

Then we can convert it to sw/((s+a2) + w2)

Next we attemptedF(s) = 40/(s2 + 1.2s +1)

To do this problem we want to do completing the square, so we would end up with :40/((s+.6)2 + .82)we can get w in the top to match the formw/(s+a)2 + w2

so we just do 40/.8 which gives us 50 so we can put the equation in the correct form looking like this:50 * (.8/((s+.6)2 + w2))

now converting back into the time domain50e-.6tsin(.8t)

ContinuingA circuit with a voltage source (160v), a resistor(4.8), an inductor (4H) and, a capacitor(.25F) all in series, to be solved for.

*Remembering that V = IRI(s) = (160/s)/(4.8+4s + 4/s)

moving s down to the denominator and pulling a 4 out we get the equation as such:I(s) = 40/(s2+1.2s+1)

Since we have already done this equation just a few moments ago we can consider ourselves done.

Next we look at the equation F(s) = 10(s+6)/(s+1)(s+3)

Using Partial Fraction Decomposition we are able to getK1 = 25K2 = -15

From there we sub them back in and get25/(s+1) - 15/(s+3)

Using the Table to convert from Laplace to time domain we get:(25e-t - 15e-3t)u(t)

We add u(t) on there to force this equation to only be valid in the Positive time domain, this works because u(t) = 0 for all time less then 0 and u(t) = 1 for all time greater then 0.

Problem 13.9 on page 550

Breakdown of how we'll solve this circuit:

Get the Initial values for the circuit using t<0,>

Calculate the rest of the circuit using the initial values, again draw the circuit.

We are looking for the voltage across the capacitor so we can use the voltage division.

Use Partial fraction decomposition to finish the circuit off and solve the formula

Your t<0>0 circuit consists of the inductor (.8H) another resistor (2K), and a capacitor (1.25uF) all in series

to find V we use the equation(8*105*12mV/s)/2*103+.8s+(8*105/s)That eventually ends up in the form:12000/(s2 + 2500s + 106)

We continue and use partial fraction decomposition and leave 12000 in and we get 8 and -8 for our k'sfollowing that through we can use the equation-((1/8)/(s+500) - (1/8)/(s+2000))which again looks alot like a Laplace form answerk/s+aconvert it back and you're golden!

Also if you notice the links on the right, there is a list of links that will contain all the links to this course and you can move around freely, this will become nicer as there are more Lectures posted.

The main topic of this class period was converting actual circuits to the s domain, then using algebra to re-arrange the equations to a format of a function that the table has for you.

Key points:

Time domain is represented by small letters

S domain is represented by Capital Letters

di/dt = sI(s) - i(0)

I0 = i(0)

ZL = sL and since s = jw then ZL = jwL

I0 indicates Initial charge

If your target is Voltage convert the circuit to use Current

If your target is Current convert the circuit to use Voltage

First problem was to convert a inductor in series with a resistor

Our target was Current so we converted it using Table 13.1 to a series circuit.Inductor = sLSource = LI0Resistor = R

Now we are able to treat this as a circuit using Ohms law (Remember V/IR)So, I = (LI0)/(R + sL)

Now it's time to move back to the time domain,Since this circuit looks most like k/(s+a) we can massage it into a form similarpulling L from the bottom we get the equation:I = L(Io)/L(s + R/L)

The L's cancel so you are left with:I0/(s+(R/L))

Which if you say:K = I0a = R/Lyou have the form k/s+a

Simply Converting back you haveI0e-(R/L)t

Next we tried the same process with a circuit containing a CapacitorAgain the target is Voltage so we use Current.

so using the formula v = irandV = CV0Zeq

Zeq = R1R2 / R1 + R2

Inserting the "newly determined" values for the capacitor and Resistor.We have ((1/cs)*R)/(R + (1/cs)) which is equal to:R/(Rcs + 1)

Putting that back in our equation gives usV = CV0 * R/(Rcs + 1)

extracting C and R from the equation gives us:CRV0/CR(s+1/RC)

That is then transformed toV0 / s+ (1/RC)

Now we do the same as with the Inductor circuit we try to find a similar Laplace Transform we can invert!Again it looks like k/s+ak = V0a = 1/RC

So we get the answerV0e-t/RC

The Final Problem we did was try to use the RL circuit from 7.3 which is a RL circuit with a source:

Tuesday, June 9, 2009

Disclaimer: This series of posts is to serve as notes for myself as well as any others interested in the subject of Circuit Analysis II. This is the course ECE 213 at UNM.

The course will follow the book:

First we received the Syllabus.

Next, we discussed the concept of voltage in ECE 203 (Circuit Analysis I)v(t) = v0 where t>= 0later in that semester in Chapter 9 we considered where v(t) = Acos(wt + phi)

Now, in ECE 213, we are to consider "all" cases of voltage for examplev0u(t) or ku(t)

when u(t) = 1 t>0when u(t) = 0 t<0

This is a stepwise function

Important Note: u(t) = 1

In the previous section of this course we learned about moving from the time domain to the phasor domain.

The direction of this course will be learning to move to the s domain.

One Aspect of the S domain is the use of Laplace Transforms to be able to move more difficult equations to a easier to solve format, then the ability to move that back using an Inverse Laplace Transform.

Important Note: s = jw (j omega that is)

When moving from the time domain to the s domain we will be referring to our equations as such:

Time Domain f(t)S Domain F(s)

Therefore whenever we are looking at f(t) we are looking at the function in the time domain and with F(s) we are looking in the S domain.

Looking at tables 475 and 480 there is a list of Laplace Transforms a quick google search nets this site which looks to have a good chunk of the Laplace Transforms

Something to remember is that f1(t) * f2(t) != F1(s) * F2(s)(That is they are NOT equal)

We proceeded to take a look at problem 12.13the first 2 (a,b) are pretty simple because we look at the table and there is a direct correlation.

Part C uses an equation of the form sin(ab + c) which remembering our trig identites such that sin(ab)cos(c) + sin(c)cos(ab) once we have that information we are able to break the problem up pretty quickly.

Next we looked at the Laplace of the equation df(t)/dt = sF(s) - f(0)

What that equation means is that we are including an "initial condition" which is f(0).

Next we looked at the VI relationship in this new section and compared them to the time domain.

For a resistor we use the relationship v=ir in the time domainin the s domain we would use V(s) = RI(s)

For an Inductor we use v(t) = Ldi/dt in time domainin s domain we use V(s) = L(sI(s) - i(0))If you note that last equation we used the equation mentioned above that follows the form df(t)/dt = sF(s) - f(0)

For a Capacitor it's the same processi(t) = c(dv/dt) in time domainI(s) = C(sV(s) - v(0)) in s domain

It's interesting to note that the formula for impedance is ZL = jwLif you remove the initial condition of the equation for the inductor it's the equation sLI(s) since s = jw then it's jWLI(s) which then is essentially V = ZI

by re-arranging the equation of an inductor you have I(s) = V/sL + I0/s

Homework/Review material:Review Chapters 3, 7, 9Problems 12.17,18,19

All links to future and past posts regarding this topic will be found on the right column, so you can jump from lecture to lecture!

Lets get on with it, This "version" of the selected filenames will use the same steps to get it up and running, (right click menu), but the only difference is that now when we have our script setup we'll copy the files to the clipboard, then deslect the files and right click on a single filename and select your copy filenames script, Lets get into the meat of this script,

First we declare:use WIN32::CLIPBOARD;This is so we can use Windows Clipboard functions

Next is$text = "";We want a clean text string.

Then,$CLIP = Win32::Clipboard();Here we setup the $clip as a clipboard object.

Next,if ($CLIP->IsFiles())What this is doing is checking that there are "files" in the clipboard, we want this because otherwise we'll try to write "nothing" to the clipboard and I'm sure that's not a problem, but if for some reason you really didn't mean to do this and you already had text in the clipboard then it won't overwrite your text clipboard contents, either way it won't write to the clipboard if you don't have any files in the clipboard, you can remove this if you want but I haven't tested it out, it may work just fine.

Then,@files = $CLIP->GetFiles();This chunk of code goes out and gets the files in the clipboard, and stores them in an array.

Next,foreach $file (@files)So what we're going to do is run the next couple of lines for each file (or in this case we'll be grabbing the filename)

Then,@sp = split(/\\/, $file);This line splits the "filename" up into segments if you were interested in the whole pathname you could omit this step and just assign the $text variable to whatever $text contained and the $file variable plus "\n", so you get each filename on a new line.

Next,$text = $text .$sp[@sp-1] . "\n";This takes the split up line above and grabs the last bit of it, which happens to be the actual filename. Remember if you wanted the entire pathname you could use the $file variable like so,$text = $text . $file . "\n";

Finally,$CLIP->Set($text);This line sets your newly created text to the clipboard!

Give it a try and let me know how it works out for you!

I'm sure this isn't the last post about this subject, as always things are always improving, I am constantly thinking of a way to cut back on the amount of steps to run this little "tool" my plan is to eventually "simulate" the keystroke to "copy" the files then copy the filenames, not sure how to go about it, without running multiple instances, I'm sure hotkeys will be a big help on this, either way I'll be improving this script again in the future...Stay tuned I'm certain there will be more posts on getting this working better.

2. I was having some problems installing so I decided that rather then chance losing data, I unplugged all the hard drives on my server leaving ONLY the HDD that I intend to install the software on.

3. Boot to the ISO burned in step 1.

4. Follow the prompts, I was fine with letting the disk setup the entire thing, just select the defaults (If you have different preferences make the changes as needed).5. When you reach the point where you choose what kind of server you want I selected Samba Server.

6. Once it's done try rebooting (without the Server Install disk in the cdrom drive) and see if it comes up, if it does, great, continue on then.

7. Shutdown your system.

8. Plug your hard drives in and try booting, if it comes up you've just had an even Greater Success, you don't have to do anything with your bios (from my perspective), and you can just wait until the next post in the series. Otherwise if you get a Grub error 21 like mine continue to the next step

9. If you have problems like I did, you need to get into bios and rearrange the boot order of the drives, what you'll find is that the boot loader (Grub), will be loaded on the drive (In my case it was /dev/sdc), but when the computer trys to boot it trys to boot to /dev/sda which doesn't have a bootloader, so by moving the disk boot order it can find it and you'll get a successful boot.

10. Next up we'll be installing all the software that we need to setup a LAMPserver as well as our Samba Server, and some things that you need in order to update your server from your laptop in the living room....SSH!!!

Good luck and let me know how it works out. If you have any problems go ahead and post and I'll try to see if I can help!