static XslCompiledTransform LoadXslt(string source) { XslCompiledTransform XmlOutputTransform = null; if (source.StartsWith("@")) { // @ indicates file input if (source.Substring(1).EndsWith(".dll")) { // precompiled transform, first type Assembly a = Assembly.LoadFile( source.Substring(1) ); XmlOutputTransform = new XslCompiledTransform(); XmlOutputTransform.Load(a.GetTypes()[0]); } else if (source.Contains(".dll@")) { // precompiled transform, specified type string[] split = source.Substring(1).Split( "@".ToCharArray() ); Assembly a = Assembly.LoadFile(split[0]); XmlOutputTransform = new XslCompiledTransform(); XmlOutputTransform.Load(a.GetType(split[1])); } else { XmlOutputTransform = new XslCompiledTransform(); XmlOutputTransform.Load(source.Substring(1)); } } else { // presume source contains raw Xml; XmlOutputTransform = new XslCompiledTransform(); XmlOutputTransform.Load(XmlReader.Create( new MemoryStream( ASCIIEncoding.Default.GetBytes(source) ) ); } return XmlOutputTransform; }
Wednesday, November 7, 2012
Load XslCompiledTransform different ways
Friday, October 19, 2012
Make Your Vote Count
Guess what, Washingtonians...
No matter who YOU vote for, all 12 of Washington's electoral votes will go to Obama, as they have every time since Reagan left office.
So as long as your vote won't change the outcome of THIS election, why not vote for MORE CHOICE in future elections? It doesn't even matter if you like Gary Johnson, or the Libertarian party. If any third party makes a significant showing in the election, it's going to make an impact on future elections.
So you dispute the inevitability of the outcome. Certainly that is the weakest point in my argument. But look at it this way. In the 20th and 21st century (at least; that's as far as I checked) Washington's electoral votes have never mattered. In other words, the overall outcome has never been so close that Washington's votes, having gone the other way, would have changed the outcome of the election. That means that no Washingtonian vote for president has ever counted for anything. In 2000 (Bush vs Gore) it almost counted. If Gore had won another small swing state (most notably New Hampshire where Bush won by 1.27% but also Missouri, Nevada, Ohio, and Tennessee where Bush won by 3-4%) but not a large one like Florida (because their 25 electoral votes would have created a majority that our 11 could not have overcome) you could say our electoral votes had counted because it would have made a difference. But alas, Bush won and our votes for Gore didn't make a difference. Bottom line if YOUR vote changes the outcome in Washington (i.e. your candidate wins by 1 vote) AND our electoral votes change the outcome overall (i.e. yo0r candidate wins by fewer than 24 electoral votes) then I'm wrong and your vote counts. The odds against that happening are extremely high though.
Thursday, September 27, 2012
Discussion with a Dear Lady
-
Dear Lady of Discussion
-
I will get you what I have. But I say parent intervention and discipline work best. Your not her counselor your her dad.
-
-
-
I think I understand what you're saying, and by discipline I imagine you mean punishment, though the two concepts are not related. I hesitate to get in a discussion with you about parenting but I do have some opinions on the matter. Punishment is known to be a poor deterrent, and it is very clear that children mimic adult behavior. Therefore angry parents create angry kids. I have learned this the hard way. I want her to understand that there are natural consequences for her actions. Anger is its own punishment. It may be in Julia's best interest to perhaps take away her computer for a period of time or whatever the case may be. I have not decided that. But I feel confident that Julia will learn from the mistakes she has made in this matter and make better decisions in the future, not because she is afraid, but because she's more aware of of how important it is to have compassion and integrity.
-
-
TuesdayDear Lady of Discussion
-
Well, I agree to disagree. I personally raise my children by a Biblical standard. Proverbs 13:24 ESV / 16 helpful votes
Whoever spares the rod hates his son, but he who loves him is diligent to discipline him.
Proverbs 29:15 ESV / 12 helpful votes
The rod and reproof give wisdom, but a child left to himself brings shame to his mother.
Proverbs 23:13-14 ESV / 12 helpful votes
Do not withhold discipline from a child; if you strike him with a rod, he will not die. If you strike him with the rod, you will save his soul from Sheol.
Ephesians 6:4 ESV / 10 helpful votes
Fathers, do not provoke your children to anger, but bring them up in the discipline and instruction of the Lord.
Proverbs 22:15 ESV / 10 helpful votes
Folly is bound up in the heart of a child, but the rod of discipline drives it far from him.
Ephesians 6:1 ESV / 7 helpful votes
Children, obey your parents in the Lord, for this is right.
Proverbs 29:17 ESV / 7 helpful votes
Discipline your son, and he will give you rest; he will give delight to your heart.
Proverbs 19:18 ESV / 6 helpful votes
Discipline your son, for there is hope; do not set your heart on putting him to death.
Galatians 5:1-26 ESV / 5 helpful votes
For freedom Christ has set us free; stand firm therefore, and do not submit again to a yoke of slavery. Look: I, Paul, say to you that if you accept circumcision, Christ will be of no advantage to you. I testify again to every man who accepts circumcision that he is obligated to keep the whole law. You are severed from Christ, you who would be justified by the law; you have fallen away from grace. For through the Spirit, by faith, we ourselves eagerly wait for the hope of righteousness. ...
Proverbs 23:14 ESV / 5 helpful votes
If you strike him with the rod, you will save his soul from Sheol.
Proverbs 23:13 ESV / 5 helpful votes
Do not withhold discipline from a child; if you strike him with a rod, he will not die.
Proverbs 22:6 ESV / 5 helpful votes
Train up a child in the way he should go; even when he is old he will not depart from it.
Hebrews 12:11 ESV / 4 helpful votes
For the moment all discipline seems painful rather than pleasant, but later it yields the peaceful fruit of righteousness to those who have been trained by it.
Colossians 3:20 ESV / 4 helpful votes
Children, obey your parents in everything, for this pleases the Lord.
Proverbs 22:1-29 ESV / 4 helpful votes
A good name is to be chosen rather than great riches, and favor is better than silver or gold. The rich and the poor meet together; the Lord is the maker of them all. The prudent sees danger and hides himself, but the simple go on and suffer for it. The reward for humility and fear of the Lord is riches and honor and life. Thorns and snares are in the way of the crooked; whoever guards his soul will keep far from them. ...
Proverbs 13:1 ESV / 4 helpful votes
A wise son hears his father's instruction, but a scoffer does not listen to rebuke.
Deuteronomy 6:4-9 ESV / 4 helpful votes
“Hear, O Israel: The Lord our God, the Lord is one. You shall love the Lord your God with all your heart and with all your soul and with all your might. And these words that I command you today shall be on your heart. You shall teach them diligently to your children, and shall talk of them when you sit in your house, and when you walk by the way, and when you lie down, and when you rise. You shall bind them as a sign on your hand, and they shall be as frontlets between your eyes. ...
Clearly, the Bible is speaking about more then life lessons learned from mistakes. We as parents play an active role in dicipline and parenting. The world teaches it is wrong to dicipline your children, but God says otherwise. I fear your past experiences and mistakes have convinced you that you are trapped in a corner. I personally... am not. Like I said.... good luck.
-
-
-
Like I said. Discipline and punishment are not the same thing. If discipline meant beating your kids with a stick, how would that not be driving your children to anger?
If you take the Bible to say that you should beat your children with a stick, you might want to reread everything you referenced and don't just believe that "the rod" means what somebody told you it means. Let the Bible interpret the Bible.
I am not sparing the rod. I am guiding Julia to value discipline and to respect the authority of God. That does not come from physical punishment. Rather physical punishment promotes anger and undermines authority.
"In your anger do not sin: Do not let the sun go down while you are still angry, and do not give the devil a foothold" (Ephesians 4:26-27).
Look at Mark 8 31-33 and Luke 9 54-56. There was a lot of rebuking going on there and nobody got hurt. In fact Jesus' rejected the suggestion of violence.
Psalm 23 says the Lord's rod is a comfort. My rod of correction is also a comfort. A rod used to beat a child into submission offers no comfort. God mostly stands back and lets us learn from the natural consequences of our actions. But if we respect His authority he will let us know what we need to work on. I take my queues from Him.
Food for thought.
-
-
Dear Lady of Discussion
-
I disagree as well do my pastors. My bible has footnotes contrary to your thoughts. I agree to disagree. Spanking is biblical and you should try it. End of discussion
-
I can see your method works.
-
-
-
Oh I've tried it. It never did a bit of good.
-
It appears to be working from my end.
-
-
Dear Lady of Discussion
-
Well spanking works. Abuse does not
-
We'll just have to disagree there as well. Lol
-
-
-
Unfortunately the line blurs all too easily. I respect your right to have your point of view. I would encourage you to take Jesus's words over that of your pastors. But I understand that even doing that, there are many interpretations. I can see you are an earnest and well intentioned person. I don't want to add to any animosity.
-
-
-
Fair enough
-
-
7 hours agoDear Lady of Discussion
-
Just sending this from profile so, that you know, it was me on my son's profile. I have deleted and blocked you both from his profile. I'm done. Stick a fork in me I'm done. I asked that the communication cease and it did not. I don't have room in my life for people who's only goal in life is to create strife. Julia is now working on Erin and I feel really sad that she does not have a parent who plays a more active role in her childhood. She needs help. Some experiences in life need to be directed by the parent and not learned on their own. Integrity is learned there it's taught not gained through experience. I'm sorry you leave everything up to her. Sad, sad, sad!!
I'm taking you off my profile as well. No need to argue over what we already know we don't see eye to eye on, but if you feel you need the last word.... feel free. I just won't respond.
Dear Lady
-
-
-
I do find it amusing how you keep engaging on the same topic after I have dropped it at your request. I will reiterate to Julia to not engage with your son. However I will not expect her to ignore him or otherwise be rude if he engages her. I wish nothing but the best for you and your family. Peace.
-
-
3 hours agoDear Lady of Discussion
-
I find nothing amusing at this point. To tell you the truth. I'm not egaging the same "issue". This is a completely new issue. That is Julia contacting my son after she was told not to and my son has not contacted her. She is also including others in her bullying behavior. The only issue that remains the same is that you feel as a parent you have no responsibility to correct the issue. I'm just letting you know... it may have consequences that could be of a legal matter. Julia contacted my son 12 hours ago.
I will contact you every single time your daughter contacts my son. As of now she is blocked, passwords are reset, but furthure attempts will only compel me to seek legal counsel.
-
-
2 hours agoSonny Christian Patterson
-
You feel free to make it a legal matter. I would not seek to interfere with your right to do so.
But you are bringing up the "correction" and "discipline" issue up again, aren't you? It's okay, I don't mind.
I actually do feel as a parent that I have a responsibility to correct any issues that come up with Julia. I feel that responsibility very deeply, particularly because my own father shirked that responsibility. I just don't agree with your idea of what is an appropriate means of correction. When is the last time God physically beat you with his rod of discipline? Never. It is so much powerful a motivator to have to live with the knowledge and consequences of your own sin.
I know you will get a great laugh here: I feel sorry for you Dear Lady. I have felt your spirit and I know you love your kids very deeply and want what's best for them, and honestly I think that your love and Louie's is much a more powerful influence for good than the detriment of any physical violence you inflict upon them. That is not to say that I don't think the ramifications of that violence in their lives will not be profound, and that they won't be struggling with those ramifications for the rest of their lives. But as far as I know none of us are blessed with perfect parents, and we all have our crosses to bear. I just think you're missing what is truly integral to discipline (as I defined in an earlier discussion), namely virtue: patience, acceptance, forgiveness, love, grace, kindness.
I am not judging you and I would have no leg to stand on if I did. I know that parenting is the hardest job in the world, and I have been at my wits' end as a parent. In desperation I have intentionally used physical force, threatened and actual, against my children, that either resulted in physical, but more importantly emotional and psychological injury. I know you are going to say, "that's abuse" and "that's not what I'm advocating". But I said that too. I knew they were wrong. I knew I was within my legal rights. But it wasn't right, and it wasn't what Jesus would do.
-
-
about an hour agoDear Lady of Discussion
-
Yes, it is what Jesus would do. Sorry. You are wrong. God and are but one collective thought. They believe in discipline even physical discipline. You can feel sorry for me, but it's uncessesary. I was beat as a child. Not spanked, but beat and I have a very clear understanding of the difference both as a parent and a child. I'm not telling you to fetch a stick and beat Julia, but clearly your passive behavior is not working. Your daughter is telling everyone that you are depressed and that you "hole up" in your room. That you have asked her to move out so you could save money and that you really don't care about her goings-on.
Lisa Flory has heard the same story. Point is; obviously Julia is suffering with something. She is rebelling and she needs someone to care enough about her to help her correct her behavior. I feel you are poo-pooing everything off and working overtime to sound like Dr. Phill. It's not working for you. I believe spanking is Biblical and my Daddy Jesus has done whooped me quite a few times. In fact, I welcome it. For the wages of sin is death. I would rather take a spiritual ass whoopin then hell or death any day. I suggest you read the Bible and pray that the Holy Spirit reveals the truth to you. It's not about being ones right.... it's about doing what IS right. Step up to the plate Daddy.
Don't say nobody tried to tell you. I have a feeling Lisa will be contacting you next. As for me reporting my issues with your daughter to you.... it's pointless. I'll move up the latter now if I feel need be. I've tried to be patient, but I think we are walking a thin line so, let's just leave it at that. Julia needs help. My heart breaks for her on so many levels, but I can't sacrafice my son for her. I just can't.
Wisdom
Dear Lady
-
-
about an hour agoDear Lady of Discussion
-
*Jesus
-
-
28 minutes agoSonny Christian Patterson
-
I've heard about Julia saying those things. Though I think they are convenient for garnering support they are not completely untrue. I've struggled with depression through my teens and all of my adult life. I do tend to be withdrawn. I do make an effort to keep my relationship with Julia real and meaningful. She's a teenager and she is not all that receptive to it, so I have to be annoying at times. Passive is the opposite of active, so yes, I have consciously make an effort to be an active part of Julia's life. I have brought up having her live with her mom but when she made it clear that she did not want that I abandoned the idea. Of course I care about here goings on, and she definitely knows I care and want to know, but I am not a mind reader. The truth is I'm not a great father, and I'm not a saint, but on both fronts I put my heart into what I do.
As I said, yes, Julia is suffering with something, and she has someone to care and help her correct her behavior. I don't know what poo-pooing means. I'm not allowed to work overtime; I work 40 hours per week. My mom is a big fan but I don't care for Dr. Phil because I think he is melodramatic and opportunistic. "It's not working for you." Good one!
What I sound like is me, because when I am holed up in my room I'm usually thinking about and reading about and studying philosophy and theology and nature, so I speak from my mind and my heart and from my experience.
I know you believe spanking is Biblical, and you are not alone. You really might want to investigate that with an open mind. It talks about rods and staffs and it talks about discipline and instruction, but never spanking. If you want to take the Bible literally you need to stop falling short of the Biblical standard, go get out your rod of discipline, and start "correcting" your children with it (don't worry, they shall not die), because if you don't do so, you obviously hate them because you are condemning them to a life of sin and an eternity of suffering inflicted by a just God for a flash-in-the-pan life of sin. Wait, what did Jesus die for? Of course I don't believe that at all, since it makes no sense. I'm pretty sure Jesus has never beaten you with a stick. When you say he has "whooped" you, I assume you mean that figuratively. So although you take the rod of discipline figuratively with respect to Jesus's correction of your sins, you feel that I take it TOO figuratively when it comes to correction of children.
Honestly while I would love for you to see that the Bible's position on violent punishment is anything but clear cut, I hardly expect to convince you. Rather, I would hope you could understand that there might be more there than the Catholic theological tradition (from which the Biblical canon and protestant theology descend) would have you believe. In my opinion, the church is so splintered today because the Catholic church's agenda was so greed and control and wealth for so many generations that widespread revolt was and is absolutely necessary (as it was in Jesus's day), and we are still trying to "rightly divide the word of truth" to this day. As such, open-mindedness and disagreement are good and Godly, and I for one am pleased at the opportunity to explore even conflicting ideas.
"For the wages of sin is death" but even without sin we will physically die. In Genesis God tells Adam that on the day that he eats the fruit of the tree of knowledge of good and evil, he will surely die. Yet he lived on for quite a few years. Hmm. God lied? Or maybe the death that God was talking about was something else? (Uh oh, going figurative again!) Maybe as sinners separated from God we are dead in some sense. It certainly seems likely to me that although we seem alive in a worldly sense, that there is a much deeper and larger and more real state analogous to what we think of as "alive", which we might come to appreciate more fully as we grow closer to God.
Yeah, you can be within your rights, but still not be doing what is right. That's what I said. We agree!
Move on up that ladder, Dear Lady. My heart also breaks for Julia, every day, as I see her struggle to discover who she is, and find the right balance between engaging with the world...hurting, judging, loving, accepting, protecting oneself and being vulnerable. I feel the same way about your son.
Don't think I am unaffected here. I know Julia's behavior was not beyond reproach. I am not going to stand by and do nothing, but my deeds will be subtle and thoughtful and will be an earnest attempt at instruction while being mindful of the need to avoid provoking anger. And that is Biblical.
Peace.
-
-
16 minutes agoDear Lady of Discussion
-
You just can't stop can you?? I see where the lack of self control comes from. If the last word is what your are looking for I gladly give it to you. In hope that it brings you some peace of mind. Stop studying theology and start living Bible based principles. It's sad that you live for momments such as this.... and that it's so obvious. I'm not sure what more you want from me. You do realize, that God destroyed entire cities as punishment for sin?! That he wiped out the entire earth for lack of 'one good person' right???! (Noah) You also realize that Jesus attacked merchants in his Father's house.... did he not???! READ YOUR BIBLE!! What do you think hell is??? A sauna? No. It's punishment. Jesus came to save, but not all are going to accept. Some won't even try. I'm going to block you know... so that we may find other constructive things to do. I think you many need to put down the 'Art of Zen' and pick up who is Jehovah and what are his many facetts?! LOL Good luck Sonny.I bid you adieu and I hope that someone at some point gets through to you, before you find yourself in a muck.
Step up brother! Batter up
-
-
Thursday, August 9, 2012
The World's Awesomest Most Insane Batch File?
@REM Is awesomest a word? I don' know, but here is the batch file
@REM Can you figure out what this does? If so you are pretty cool, like me :)
@echo off
rem by v-sopatt
setlocal ENABLEDELAYEDEXPANSION
set batchFile=%~n0
set tempspec=%batchFile%
if not defined loop_i set loop_i=0
if "%1"=="" goto :external_listen
if "%1"=="/?" goto :usage_
if "%1"=="-?" goto :usage_
if "%2"=="/?" (
call :usage_%~1 1>&2 2>nul
) else if "%2"=="-?" (
call :usage_%~1 1>&2 2>nul
) else (
call :external_%* 2>nul
)
rem if errorlevel 1 call :usage_ 1>&2
goto :out_usage
rem ****************** RENAME_WAIT *************************
:rename_wait
rem * returns when the file is successfully renamed (hence it is unlocked)
ren "%~1" "%~nx2" 2> nul
IF %ERRORLEVEL%==0 goto :eof
sleep -m 50
if not exist "%~1" echo. > "%~1"
goto :rename_wait
rem ****************** CONTROLLER **********************
:usage_controller
goto :out_usage
:external_controller
set result=""
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller all show" | find "%~2" > %tempspec%%loop_i%.tmp
for /f "tokens=6" %%f in (%tempspec%%loop_i%.tmp) do (
set result=%%f
)
echo %loop_i% %result%
del %tempspec%%loop_i%.tmp
goto :eof
rem ****************** FINDDRIVE **********************
:usage_finddrive
goto :out_usage
:external_finddrive
set result=""
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 physicaldrive all show" | find "bay %3," > %tempspec%%loop_i%.tmp
for /f "tokens=2" %%f in (%tempspec%%loop_i%.tmp) do (
set result=%%f
)
echo %loop_i% %result%
del %tempspec%%loop_i%.tmp
goto :eof
rem ****************** DRIVEINFO **********************
:usage_driveinfo
goto :out_usage
:external_driveinfo
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 physicaldrive %3 show" > %tempspec%%loop_i%.tmp
set result=
for /f "tokens=*" %%f in (%tempspec%%loop_i%.tmp) do (
call :driveinfo_parse_%%f %*
)
del %tempspec%%loop_i%.tmp
echo %loop_i% %result%
goto :eof
:driveinfo_parse_array
set result=%1
goto :eof
:driveinfo_parse_physicaldrive
set result=%result%:%1
goto :eof
:driveinfo_parse_Status
if "%1"=="Predictive" (
set result=%result%:%1%2
if not "%6"=="" call :driveinfo_led %3 %4 "physicaldrive %5" %6
) else (
set result=%result%:%1
if not "%5"=="" call :driveinfo_led %2 %3 "" %5
)
goto :eof
:driveinfo_led
start cmd /c %batchFile% led %1 %2 "%~3" %4
goto :eof
:driveinfo_parse_Drive
set result=%result%:%2%3
goto :eof
:driveinfo_parse_Interface
set result=%result%:%2
goto :eof
:driveinfo_parse_Size
set result=%result%:%1%2
goto :eof
:driveinfo_parse_Firmware
set result=%result%:%2
goto :eof
:driveinfo_parse_Serial
set result=%result%:%2
goto :eof
:driveinfo_parse_Model
set result=%result%:%1.%2
goto :eof
:driveinfo_parse_SATA
set result=%result%:%3
goto :eof
:driveinfo_parse_PHY
if "%1"=="Count:" set result=%result%:%2
if "%1"=="Transfer" set result=%result%:%3
goto :eof
:driveinfo_parse_Active
:driveinfo_parse_Port
:driveinfo_parse_Smart
:driveinfo_parse_Box
:driveinfo_parse_Bay
goto :eof
rem ****************** LED **********************
:usage_led
goto :out_usage
:external_led
set result=
if "%4"=="on" (
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 %~3 modify led=on"
) else (
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 modify led=off"
)
echo %loop_i% %4
goto :eof
rem ****************** SERVERINFO **********************
:usage_serverinfo
echo Usage:
echo %batchFile% serverinfo {server name}
echo.
echo Parameter is required
echo Output:
echo {line number} {serial number}:{asset tag}
echo.
echo Line number will be zero (0) if called directly from command line. See listen command.
echo Drive information consists of the following items, delimited by colons:
echo Array Letter
echo Port Number
echo Box Identifier, e.g. 2E
echo Bay Number
echo Status, e.g. PredectiveFailure, Failed, Rebuilding, OK
echo Drive Type, e.g. DataDrive
echo Interface Type, e.g. SATA
echo Size, e.g. 750GB
echo Firmware Revision, e.g. HPGB
echo Serial Number
echo Model, e.g. ATA.GB0750C8047
echo SATA NCQ Capable, True or False
echo SATA NCQ Enabled, True or False
echo PHY Count, usually 1
echo PHY Transfer Rate, e.g. 1.5GBPS
goto :out_usage
:external_serverinfo
set result=""
wmic /node:"%1" systemenclosure get serialnumber,SMBIOSAssetTag /value | find "=" > %tempspec%%loop_i%.tmp
set result=
for /f "tokens=1,2 delims==" %%f in (%tempspec%%loop_i%.tmp) do (
call :serverinfo_parse_%%f %%g
)
del %tempspec%%loop_i%.tmp
echo %loop_i% %result%
goto :eof
:serverinfo_parse_serialnumber
if "%1"=="" (set result={blank}) else set result=%1
goto :eof
:serverinfo_parse_SMBIOSAssetTag
if "%1"=="" (set result=%result%:{blank}) else set result=%result%:%1
goto :eof
rem ********************* shortcut **********************
:usage_shortcut
echo Usage:
echo %batchFile% shortcut {server name} {bay number}
echo.
echo Both parameters are required
echo Output:
echo {line number} {serial number}:{asset tag} {slot} {drive information}
echo.
echo Line number will be zero (0) if called directly from command line. See listen command.
echo Drive information consists of the following items, delimited by colons:
echo Array Letter
echo Port Number
echo Box Identifier, e.g. 2E
echo Bay Number
echo Status, e.g. PredectiveFailure, Failed, Rebuilding, OK
echo Drive Type, e.g. DataDrive
echo Interface Type, e.g. SATA
echo Size, e.g. 750GB
echo Firmware Revision, e.g. HPGB
echo Serial Number
echo Model, e.g. ATA.GB0750C8047
echo SATA NCQ Capable, True or False
echo SATA NCQ Enabled, True or False
echo PHY Count, usually 1
echo PHY Transfer Rate, e.g. 1.5GBPS
goto :out_usage
:external_shortcut
if "%~1"=="" goto :usage_shortcut
if "%~2"=="" goto :usage_shortcut
call :external_serverinfo %1 >nul
set shortcut_serverinfo=%result%
call :external_controller %1 "P700m" >nul
set shortcut_slot=%result%
call :external_finddrive %1 %shortcut_slot% %2 >nul
set shortcut_drivespec=%result%
call :external_driveinfo %1 %shortcut_slot% %shortcut_drivespec% %3 >nul
set result=%shortcut_serverinfo% %shortcut_slot% %result%
echo %loop_i% %result%
goto :eof
rem **************** LISTEN *******************************
rem ~~~~ Listen Usage ~~~~~
:usage_listen
echo %batchFile% listen [request file mask] [results file extension] [temp file spec]
echo "request file mask" is a path+filespec that determines the location and filename to be processed.
echo This defaults to \\transfer\transfer\^%username^%\hddhelper\*.req <&2
echo "results file extension" is an additional extension that will be added to the request filename
echo when returning results. ".results" is the default. For example, if "123.req" was the request
echo file, 123.req.results would be the results file.
echo "temp file spec" is a base filename for the temp files generated. This is mainly for internal use.
echo The default is %batchFile%. If this argument has spaces results may be unpredictable
goto :out_usage
rem ~~~~ Listen Parameters ~~~~~
:external_listen
if "%~1"=="/?" goto :usage_listen
if "%~1"=="-?" goto :usage_listen
if "%~1"=="" (
if "%ComputerName%"=="DB3TSCORP" (
set listenMask=\\phx\services\transfer\europe\%username%\hddhelper\*.req
) else (
set listenMask=\\transfer\transfer\%username%\hddhelper\*.req
)
) else (
set listenMask=%~1
)
if "%~2"=="" (
set resultExt=results
) else (
set resultExt=%~2
)
if "%~3"=="" (
set tempSpec=%batchFile%
) else (
set tempSpec=%~3
)
rem ~~~~ Listen Main ~~~~
set sleeplevel=100
set misscounter=0
echo Checking every 100ms for "%listenMask%"
rem ==infinite loop start
:check
if EXIST "%listenMask%" (
set misscounter=0
set sleeplevel=100
for %%e in ("%listenMask%") do (
set currentFile=%%~e
echo Processing "!currentFile!" 1>&2
del "!currentFile!.processing" 2>nul
call :rename_wait "!currentFile!" "!currentFile!.processing" > nul
start cmd /c %batchFile% processfile "!currentFile!.processing" ^> "!currentFile!.%resultExt%.processing"
del "!currentFile!.%resultExt%" 2> nul
call :rename_wait "!currentFile!.%resultExt%.processing" "!currentFile!.%resultExt%" > nul
del "!currentFile!.complete" 2>nul
call :rename_wait "!currentFile!.processing" "!currentFile!.complete" > nul
echo Completed. See "!currentFile!.%resultExt%" 1>&2
)
) else if %misscounter%==1000 (
if %sleeplevel% LSS 10000 (
set /a sleeplevel=%sleeplevel% * 10
echo Ratcheting down. Now checking every %sleeplevel%ms for "%listenmask%
set misscounter=0
)
) else (
set /a misscounter=%misscounter%+1
)
sleep -m %sleeplevel%
goto :check
rem ==loop end
REM ******************* PROCESSFILE **************************
:usage_processfile
echo Usage:
goto :usage_out
:external_processfile
if "%~1"=="/?" goto :usage_processfile
if "%~1"=="-?" goto :usage_processfile
if "%~1"=="" goto :usage_processfile
if not defined resultExt set resultExt=results
if not defined tempspec set tempspec=%batchfile%
set loop_i=0
for /f "usebackq tokens=*" %%f in ("%~1") do (
set /a loop_i=!loop_i!+1
if "%%f"=="" (
echo !loop_i! > %tempspec%!loop_i!.waiting
) else (
rem ~ kick off a separate process for each line in the file ~
start cmd /c "%batchFile%" %%f ^> %tempspec%!loop_i!.waiting
)
)
rem ~~~~ compile the results ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo %loop_i% Processes started for "%~1". Waiting for results 1>&2
set result_count=%loop_i%
set loop_i=0
for /f "usebackq tokens=*" %%f in ("%~1") do (
set /a loop_i=!loop_i!+1
call :rename_wait %tempspec%!loop_i!.waiting %tempspec%!loop_i!.done
type %tempspec%!loop_i!.done
del %tempspec%!loop_i!.done
)
sleep -m 100
set resultExt=results
set tempSpec=temp
goto :eof
rem ************************* USAGE ***********************************************
:usage_
echo Usage:
echo %batchFile% [parameters]: same as %batchFile% listen [parameters]"
echo %batchFile% [command] [parameters]
echo %batchFile% /? : this help message
echo %batchFile% [command] /? : help message for a particular command
echo for "listen" command usage, try "%batchFile% listen /?"
echo commands:
echo listen
echo serverinfo
echo controller
echo driveinfo
echo led
echo shortcut
goto :out_usage
:out_usage
popd
@REM Can you figure out what this does? If so you are pretty cool, like me :)
@echo off
rem by v-sopatt
setlocal ENABLEDELAYEDEXPANSION
set batchFile=%~n0
set tempspec=%batchFile%
if not defined loop_i set loop_i=0
if "%1"=="" goto :external_listen
if "%1"=="/?" goto :usage_
if "%1"=="-?" goto :usage_
if "%2"=="/?" (
call :usage_%~1 1>&2 2>nul
) else if "%2"=="-?" (
call :usage_%~1 1>&2 2>nul
) else (
call :external_%* 2>nul
)
rem if errorlevel 1 call :usage_ 1>&2
goto :out_usage
rem ****************** RENAME_WAIT *************************
:rename_wait
rem * returns when the file is successfully renamed (hence it is unlocked)
ren "%~1" "%~nx2" 2> nul
IF %ERRORLEVEL%==0 goto :eof
sleep -m 50
if not exist "%~1" echo. > "%~1"
goto :rename_wait
rem ****************** CONTROLLER **********************
:usage_controller
goto :out_usage
:external_controller
set result=""
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller all show" | find "%~2" > %tempspec%%loop_i%.tmp
for /f "tokens=6" %%f in (%tempspec%%loop_i%.tmp) do (
set result=%%f
)
echo %loop_i% %result%
del %tempspec%%loop_i%.tmp
goto :eof
rem ****************** FINDDRIVE **********************
:usage_finddrive
goto :out_usage
:external_finddrive
set result=""
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 physicaldrive all show" | find "bay %3," > %tempspec%%loop_i%.tmp
for /f "tokens=2" %%f in (%tempspec%%loop_i%.tmp) do (
set result=%%f
)
echo %loop_i% %result%
del %tempspec%%loop_i%.tmp
goto :eof
rem ****************** DRIVEINFO **********************
:usage_driveinfo
goto :out_usage
:external_driveinfo
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 physicaldrive %3 show" > %tempspec%%loop_i%.tmp
set result=
for /f "tokens=*" %%f in (%tempspec%%loop_i%.tmp) do (
call :driveinfo_parse_%%f %*
)
del %tempspec%%loop_i%.tmp
echo %loop_i% %result%
goto :eof
:driveinfo_parse_array
set result=%1
goto :eof
:driveinfo_parse_physicaldrive
set result=%result%:%1
goto :eof
:driveinfo_parse_Status
if "%1"=="Predictive" (
set result=%result%:%1%2
if not "%6"=="" call :driveinfo_led %3 %4 "physicaldrive %5" %6
) else (
set result=%result%:%1
if not "%5"=="" call :driveinfo_led %2 %3 "" %5
)
goto :eof
:driveinfo_led
start cmd /c %batchFile% led %1 %2 "%~3" %4
goto :eof
:driveinfo_parse_Drive
set result=%result%:%2%3
goto :eof
:driveinfo_parse_Interface
set result=%result%:%2
goto :eof
:driveinfo_parse_Size
set result=%result%:%1%2
goto :eof
:driveinfo_parse_Firmware
set result=%result%:%2
goto :eof
:driveinfo_parse_Serial
set result=%result%:%2
goto :eof
:driveinfo_parse_Model
set result=%result%:%1.%2
goto :eof
:driveinfo_parse_SATA
set result=%result%:%3
goto :eof
:driveinfo_parse_PHY
if "%1"=="Count:" set result=%result%:%2
if "%1"=="Transfer" set result=%result%:%3
goto :eof
:driveinfo_parse_Active
:driveinfo_parse_Port
:driveinfo_parse_Smart
:driveinfo_parse_Box
:driveinfo_parse_Bay
goto :eof
rem ****************** LED **********************
:usage_led
goto :out_usage
:external_led
set result=
if "%4"=="on" (
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 %~3 modify led=on"
) else (
psexec \\%1 "C:\Program Files\Compaq\Hpacucli\Bin\hpacucli.exe" "controller slot=%2 modify led=off"
)
echo %loop_i% %4
goto :eof
rem ****************** SERVERINFO **********************
:usage_serverinfo
echo Usage:
echo %batchFile% serverinfo {server name}
echo.
echo Parameter is required
echo Output:
echo {line number} {serial number}:{asset tag}
echo.
echo Line number will be zero (0) if called directly from command line. See listen command.
echo Drive information consists of the following items, delimited by colons:
echo Array Letter
echo Port Number
echo Box Identifier, e.g. 2E
echo Bay Number
echo Status, e.g. PredectiveFailure, Failed, Rebuilding, OK
echo Drive Type, e.g. DataDrive
echo Interface Type, e.g. SATA
echo Size, e.g. 750GB
echo Firmware Revision, e.g. HPGB
echo Serial Number
echo Model, e.g. ATA.GB0750C8047
echo SATA NCQ Capable, True or False
echo SATA NCQ Enabled, True or False
echo PHY Count, usually 1
echo PHY Transfer Rate, e.g. 1.5GBPS
goto :out_usage
:external_serverinfo
set result=""
wmic /node:"%1" systemenclosure get serialnumber,SMBIOSAssetTag /value | find "=" > %tempspec%%loop_i%.tmp
set result=
for /f "tokens=1,2 delims==" %%f in (%tempspec%%loop_i%.tmp) do (
call :serverinfo_parse_%%f %%g
)
del %tempspec%%loop_i%.tmp
echo %loop_i% %result%
goto :eof
:serverinfo_parse_serialnumber
if "%1"=="" (set result={blank}) else set result=%1
goto :eof
:serverinfo_parse_SMBIOSAssetTag
if "%1"=="" (set result=%result%:{blank}) else set result=%result%:%1
goto :eof
rem ********************* shortcut **********************
:usage_shortcut
echo Usage:
echo %batchFile% shortcut {server name} {bay number}
echo.
echo Both parameters are required
echo Output:
echo {line number} {serial number}:{asset tag} {slot} {drive information}
echo.
echo Line number will be zero (0) if called directly from command line. See listen command.
echo Drive information consists of the following items, delimited by colons:
echo Array Letter
echo Port Number
echo Box Identifier, e.g. 2E
echo Bay Number
echo Status, e.g. PredectiveFailure, Failed, Rebuilding, OK
echo Drive Type, e.g. DataDrive
echo Interface Type, e.g. SATA
echo Size, e.g. 750GB
echo Firmware Revision, e.g. HPGB
echo Serial Number
echo Model, e.g. ATA.GB0750C8047
echo SATA NCQ Capable, True or False
echo SATA NCQ Enabled, True or False
echo PHY Count, usually 1
echo PHY Transfer Rate, e.g. 1.5GBPS
goto :out_usage
:external_shortcut
if "%~1"=="" goto :usage_shortcut
if "%~2"=="" goto :usage_shortcut
call :external_serverinfo %1 >nul
set shortcut_serverinfo=%result%
call :external_controller %1 "P700m" >nul
set shortcut_slot=%result%
call :external_finddrive %1 %shortcut_slot% %2 >nul
set shortcut_drivespec=%result%
call :external_driveinfo %1 %shortcut_slot% %shortcut_drivespec% %3 >nul
set result=%shortcut_serverinfo% %shortcut_slot% %result%
echo %loop_i% %result%
goto :eof
rem **************** LISTEN *******************************
rem ~~~~ Listen Usage ~~~~~
:usage_listen
echo %batchFile% listen [request file mask] [results file extension] [temp file spec]
echo "request file mask" is a path+filespec that determines the location and filename to be processed.
echo This defaults to \\transfer\transfer\^%username^%\hddhelper\*.req <&2
echo "results file extension" is an additional extension that will be added to the request filename
echo when returning results. ".results" is the default. For example, if "123.req" was the request
echo file, 123.req.results would be the results file.
echo "temp file spec" is a base filename for the temp files generated. This is mainly for internal use.
echo The default is %batchFile%. If this argument has spaces results may be unpredictable
goto :out_usage
rem ~~~~ Listen Parameters ~~~~~
:external_listen
if "%~1"=="/?" goto :usage_listen
if "%~1"=="-?" goto :usage_listen
if "%~1"=="" (
if "%ComputerName%"=="DB3TSCORP" (
set listenMask=\\phx\services\transfer\europe\%username%\hddhelper\*.req
) else (
set listenMask=\\transfer\transfer\%username%\hddhelper\*.req
)
) else (
set listenMask=%~1
)
if "%~2"=="" (
set resultExt=results
) else (
set resultExt=%~2
)
if "%~3"=="" (
set tempSpec=%batchFile%
) else (
set tempSpec=%~3
)
rem ~~~~ Listen Main ~~~~
set sleeplevel=100
set misscounter=0
echo Checking every 100ms for "%listenMask%"
rem ==infinite loop start
:check
if EXIST "%listenMask%" (
set misscounter=0
set sleeplevel=100
for %%e in ("%listenMask%") do (
set currentFile=%%~e
echo Processing "!currentFile!" 1>&2
del "!currentFile!.processing" 2>nul
call :rename_wait "!currentFile!" "!currentFile!.processing" > nul
start cmd /c %batchFile% processfile "!currentFile!.processing" ^> "!currentFile!.%resultExt%.processing"
del "!currentFile!.%resultExt%" 2> nul
call :rename_wait "!currentFile!.%resultExt%.processing" "!currentFile!.%resultExt%" > nul
del "!currentFile!.complete" 2>nul
call :rename_wait "!currentFile!.processing" "!currentFile!.complete" > nul
echo Completed. See "!currentFile!.%resultExt%" 1>&2
)
) else if %misscounter%==1000 (
if %sleeplevel% LSS 10000 (
set /a sleeplevel=%sleeplevel% * 10
echo Ratcheting down. Now checking every %sleeplevel%ms for "%listenmask%
set misscounter=0
)
) else (
set /a misscounter=%misscounter%+1
)
sleep -m %sleeplevel%
goto :check
rem ==loop end
REM ******************* PROCESSFILE **************************
:usage_processfile
echo Usage:
goto :usage_out
:external_processfile
if "%~1"=="/?" goto :usage_processfile
if "%~1"=="-?" goto :usage_processfile
if "%~1"=="" goto :usage_processfile
if not defined resultExt set resultExt=results
if not defined tempspec set tempspec=%batchfile%
set loop_i=0
for /f "usebackq tokens=*" %%f in ("%~1") do (
set /a loop_i=!loop_i!+1
if "%%f"=="" (
echo !loop_i! > %tempspec%!loop_i!.waiting
) else (
rem ~ kick off a separate process for each line in the file ~
start cmd /c "%batchFile%" %%f ^> %tempspec%!loop_i!.waiting
)
)
rem ~~~~ compile the results ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo %loop_i% Processes started for "%~1". Waiting for results 1>&2
set result_count=%loop_i%
set loop_i=0
for /f "usebackq tokens=*" %%f in ("%~1") do (
set /a loop_i=!loop_i!+1
call :rename_wait %tempspec%!loop_i!.waiting %tempspec%!loop_i!.done
type %tempspec%!loop_i!.done
del %tempspec%!loop_i!.done
)
sleep -m 100
set resultExt=results
set tempSpec=temp
goto :eof
rem ************************* USAGE ***********************************************
:usage_
echo Usage:
echo %batchFile% [parameters]: same as %batchFile% listen [parameters]"
echo %batchFile% [command] [parameters]
echo %batchFile% /? : this help message
echo %batchFile% [command] /? : help message for a particular command
echo for "listen" command usage, try "%batchFile% listen /?"
echo commands:
echo listen
echo serverinfo
echo controller
echo driveinfo
echo led
echo shortcut
goto :out_usage
:out_usage
popd
Subscribe to:
Posts (Atom)