8.29.2009

XML Web Part

It’s not superior in any way to the SharePoint web part, but I don’t have the source for the SharePoint web part just laying around either.  The code uses the XslCompiledTransform class to transform the xml provided.

 

 

using System.Web.UI.WebControls.WebParts;

using System.Xml.Xsl;

using System.Xml;

using System.IO;

using System;

using System.ComponentModel;

using System.Diagnostics;

 

namespace IdahoWebParts

{

    public class XMLWebPart : WebPart

    {

 

 

        [Personalizable, Browsable(true),WebBrowsable(true),Description("Url of Source XML Document")]

        public string SourceURL

        {

            get

            {

                return (string)ViewState["XmlURL"];

            }

 

            set

            {

                ViewState["XmlURL"] = value;

            }

        }

 

        [Personalizable, Browsable(true),WebBrowsable(true),Description("XML to transform")]

        public string Document

        {

            get

            {

                return (string)ViewState["XmlDocument"];

            }

 

            set

            {

                ViewState["XmlDocument"] = value;

            }

        }

 

        [Personalizable, Browsable(true),WebBrowsable(true),Description("URL of StyleSheet")]

        public string StyleSheetURL

        {

            get

            {

                return (string)ViewState["XsltURL"];

            }

 

            set

            {

                ViewState["XsltURL"] = value;

            }

        }

 

        [Personalizable, Browsable(true),WebBrowsable(true),Description("XSLT used to transform XML")]

        public string StyleSheet

        {

            get

            {

                return (string)ViewState["XsltDocument"];

            }

 

            set

            {

                ViewState["XsltDocument"] = value;

            }

        }

 

        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)

        {

            try

            {

                // get the style sheet

                string transformDocument = (!string.IsNullOrEmpty(StyleSheetURL)) ? Utility.GetWebTextFile(Page.ResolveUrl(StyleSheetURL)) : StyleSheet;

 

                // get the xml

                string xmlDoc = (!string.IsNullOrEmpty(SourceURL)) ? Utility.GetWebTextFile(Page.ResolveUrl(SourceURL)) : Document;

 

 

                writer.Write(string.Format("<div id={0}>", UniqueID));

                // if we have a style sheet use it to transform the xml

                if (!string.IsNullOrEmpty(transformDocument) && !string.IsNullOrEmpty(xmlDoc))

                {

                    XslCompiledTransform transform = new XslCompiledTransform();

                    transform.Load(XmlReader.Create(new StringReader(transformDocument)));

                    transform.Transform(XmlReader.Create(new StringReader(xmlDoc)), XmlWriter.Create(writer));

                }

 

                else if (!string.IsNullOrEmpty(xmlDoc))

                {

                    writer.Write(xmlDoc);

                }

 

                writer.Write("</div>");

            }

 

            catch (System.Xml.XmlException)

            {

 

                writer.Write("XML error");

            }

 

            catch (Exception exception)

            {

                writer.Write("Error");

                Debug.WriteLine(exception.ToString());

            }

        }

    }

}

8.21.2009

Test...

Is this thing on? I am a developer working for General Dynamics IT as a contractor for the US Army in Iraq. When I come up with something useful that I need to record, I will post it here. This blog has had other subject matter in the past, but now it is about asp.net development.

9.08.2006

White Party and Flaunt

Anyone who has the opportunity should walk in a fashion show. Flaunt was a great experience. Al Wilson's Birthday party during Club Vinyl's White Party in Denver was pretty cool too.

8.28.2006

Fabric

Look for my upcoming role in the independent movie "Fabric", a docu-drama about gay and lesbian issues. It will be showing in film festivals around the country.

Flaunt!

I am going to be walking in the Flaunt Fashion show in Colorado Springs presented by Veda Salsons and Idoru Clothing on September 7th. Come Check it out! The proceeds go to benefit Futureself.

Fabric

Look for my role in Fabric, and independent film directed by John Marquez and produced by Marcorp Productions, at select film festivals around the country.

6.16.2006

My Echo Chamber

By neglecting my blog for so much time I have effectively created an echo chamber. No matter. Everybody (I suppose I should say "nobody") wish me luck on the written suitability exam for the Denver Fire Department.

3.15.2006

The Evil Empire Lives

On numerous occasions America's supposed ally, Russia, has taken stances that would seem odd for an ally of the United States or any free Western country.
For instance, Russia sells arms to Iran, Venezuela (ruled by a notorious enemy of American interests, Hugo Chavez), and China, whose totalitarian communist regime oppresses more people than the rest of the enslaved world combined. See these links: Sales to Iran, Russian arms sale to Chavez irks..., and Secretary Rice Concerned about arms sales to China. Russia continues to sell weapons to people that we consider to be our enemies. I don't know about you but if someone publicly threatened me or one of my friends, I would consider someone who armed him to be my enemy. Russia has done just that.
Russia goes further. They give comfort to our enemies. When Israel and the US threatened to cut off funding to Palestine if the Hamas-ruled government continued its belligerence, who invited Hamas to their capital? The Russians did, of course. Who always sides with our worst enemies in the UN? Russia does, of course. Who is sheltering the wife of a Serbian war criminal who is herself a criminal? Who is rushed to investigate the same war criminal's untimely if deserved death? (In the last linked article note the comment from one of the four Russian doctors who examined the results of the autopsy of Slobodan Milosevic's death.)
What I want to know, is why do we consider Russia an ally? Can you name one positive thing Russia has done to help the United States?

3.10.2006

Sergeant Edokpayi

After two months of relentless paper-pushing I was promoted from the rank of Specialist to the rank of Sergeant. I've been anticipating this promotion my entire military career due to the fact that I have always been a Specialist. I won't go into the details of how I've suffered because PSB (Personnel Services Battalion I believe it stands for) lost my promotion paperwork. I won't even mention that PSB loses everybody's' promotion paperwork - which begs the question whose paperwork do they not lose? The obvious answer is their own. I will talk about the actual promotion ceremony.
The Army has a long standing tradition that when an enlisted soldier is promoted his superiors "pin" the rank on him in turns. (The "him" is doubly appropriate since I am willing to be that female soldiers don't undergo similar treatment for fear of discrimination or abuse charges) By "pin" I mean "pound" or "grind". What normally transpires is that the commander and the first sergeant remove the old rank and pin on the new as the XO reads the promotion orders. The command group will congratulate you and allow you to say a few words (or in my case, recite the NCO creed) and turn you over to the tender mercies of your colleagues. What happens next can be excruciating. Everyone who knows you and outranks you may then walk by and pin your rank on again. Pin-on rank has two sharp prongs that are meant to pierce the fabric of your uniform and are normally encased in "dammits". During promotion ceremonies NCO's use these prongs to pierce the flesh of younger NCO's. I have seen people leave with blood trailing down their uniforms.
I was planning to subvert the tradition by taping padding to my shoulders and collar bones where the damage is normally worst. I had made it through 95% of the ceremony with a few faux grimaces for the benefit of my audience when one of my fellow medics discovered my ruse. Gnashing of teeth followed immediately after. Those who had been cheated of their bloodletting returned for their rightful due. I stood and writhed with an occasional groan.
The best part is that I get to do it all again tomorrow morning.

3.09.2006

Excuse me?

Most unlikely words to hear coming from the mouth of a NOW representative:
The president of the National Organization for Women, Kim Gandy, acknowledged that disputes over unintended pregnancies can be complex and bitter. "None of these are easy questions," said Gandy, a former prosecutor. "But most courts say it's not about what he did or didn't do or what she did or didn't do. It's about the rights of the child."

Since when has the National Organization of Women cared more about the rights of an unborn baby than an adult's rights?
I think everyone in the abortion debate is pursuing one person's interest exclusively at the expense of everyone else's. All NOW apparently cares about is that the woman gets to do whatever she wants. All the men in the story care about is avoiding responsibility. Then Ms Gandy wants to buttress her position from attacks by the men's group by developing a sudden interest in the rights of an unborn child who if you listen to NOW every time before this had no rights! I don't think NOW wants equality, they want to dominate culture - to feminize modern culture. Men are getting fed up and want to get back at women by giving them equality only with consequences women did not intend or foresee. Women may win eventually but their won't be any worthwhile spoils for the victor to collect.

3.05.2006

Looking Back

I just returned from a brief field problem with the line company I am assigned to as a medic. Going to the field while not my favorite thing to do reminded me that there are aspects of the job that I enjoy. I like being a medic. I like people depending on me. I like performing under pressure, racing the clock to save precious blood - to save life. It's a rush.
It's coming to a end though. I joined the Army to hit the "reset button". I wanted to do something fun, challenging, and meaningful. It wasn't always fun, but it was always challenging, and I think my overall contribution was meaningful. Two out of three isn't bad.
I won't go so far as to say I would never serve again. I think every American would benefit if everyone served, although I am against mandatory service. I think everyone should volunteer. I do know that I need to try to get out and accomplish other things. There are so many opportunities outside of military service.
I'm proud of what I did and am doing. I just want to do other things.
Internet Explorer sucks.

2.23.2006

Ten Miles in the snow

When some people tell their children they walked ten miles to school in the snow over hills in the darkness, they will be lying. If I tell the story about walking to school I will be lying also. If I say I walked ten miles (or more, I wasn't counting and sometimes you get lost in the dark) in training for the Manchu Mile I will be telling the truth.
Walking in the dark with 50+ pounds of military gear on one's back is punishing work. It something we do routinely in the First Battalion, Ninth Infantry Regiment of the Second Infantry Division. We're tough (and or crazy) like that.
Uncle Sam seems determined to get his money's worth out of me before I get out of the Army.

2.15.2006

Iraqi Dinars

I just saw a Google AdSense ad for Iraqi dinars on my page. Don't buy them! I won't say it's a scam and that Iraqi dinars will never increase in value. I will say that military personnel are disallowed from speculating in Iraqi currency and even those who are allowed would find it difficult to collect even if the Dinar gained value.

The world is coming to an end

I spend a lot of time reading about negative trends in society - dystopia amuses me. I believe that mankind is going to hell an in a hand basket because:
  • Natural resources will soon be depleted. Industry is dependent on cheap oil and mineral resources. Oil production has peaked and no new energy sources are forthcoming. Scientists are also beginning to sound alarms about running out of commonly used metals like copper and aluminum. People should realize that nearly everything is made of plastic, copper, or aluminum now. No oil and we have no plastic. No plastic and we have no electronics, or consumer goods. No copper and we have no electricity. No aluminum and we have to stop manufacturing cars and airplanes. We might find ourselves in deep dodo sooner than we realize.
  • The world is awash in unrest fomented by religious fanatics that hate freedom. Islamic religious fundamentalists do not desire religious freedom. They want to kill all the infidels - hint: if you are not Muslim that means you - wipe Israel off the face of the Earth; and establish a world wide caliphate - a backward world where women are viewed as chattel, religious freedom is banished, and scientific education takes a back seat to memorizing the Koran. What is amazing, is that the world still refuses to take the threat seriously. Russia just invited Hamas, a terrorist organization, to Moscow for talks.
  • The World's economies are doomed to failure. Every major economy in the world is based on a fiat money system which inherently has a finite lifespan. Under a fiat money system, the central bank holds an essentially unlimited store of money - governments can print the money as they please. Fiat money loses its value over time since it becomes necessary for governments to print more and more money. Economic distress creeps up social brackets starting with the poor who can least afford for their money to lose its value, than the middle class who usually have the ability to borrow large amounts of worthless money, than finally ends with the rich who profit the most because they control the flow of money. See this post for a better explanation of why I think the global economy will be in trouble.
  • Hunger will spread from Third World countries to developed nations. One word: overpopulation. Developed nations have recklessly destroyed farmland and grown unsupportable population centers (shopping malls!) where farms once stood. Urban sprawl will starve us all. Also, corrupt governments in Third World countries prevent the populace from ever developing the ability to feed themselves - which will increase the strain on the soon-to-be hungry Western nations.
  • Disease and pestilence will kill those whom terrorism and hunger spared. Doctors are warning the public that overuse and abuse of antibiotics has developed drug resistant strains of bacteria. Soon we will have a "super" bacteria with no treatment that will sweep the nations' hospitals leaving doctors helpless in its wake. Also, the world is even more vulnerable to a pandemic virus due to advanced transportation networks and inadequate public health safeguards. The current bird flu scare being a prime example of the horror to come.
  • If Iran or North Korea is allowed to acquire nuclear weapons, we shall all die. Do I need to explain why it is bad for crazy people the most powereful weapons on the planet?
I would say that we are all going to die, (facetiously of course) but I think the lucky people will die. I think we are all going to suffer instead.
Isn't the future bright?

2.10.2006

Out of the Army in 80 Days

Barring further catastrophic occurrences in the Middle East, war with China, war with Russia, war with both China and Russia, or Armageddon (although war with China and Russia would most likely be Armageddon) I am not going to be subject to a stop-loss order. I will be separating from the Army in less than 80 days. 68 days actually, I just happen to be a bit of a Jules Verne fan. Also, I was busy when the 80 day mark passed.
The Army makes an effort to prepare soldiers for civilian life. To that end I spent the majority of this week in ACAP meetings. ACAP is an acronym describing the organization that guides the soldier in his transition. What ACAP stands for would be easy to look up if I actually cared to expend the effort. The meetings were informative, if a little dull at times. I confess to repeatedly succumbing to the siren song of the Sandman.
The people I met at the meeting were interesting - one was a high ranking officer who dealt with secret research projects, a couple were retiring Command Sergeant Majors (the highest enlisted rank in the Army excluding the Sergeant Major of the Army. I wonder what his ACAP meetings would be like!), but most were young soldiers like me. What we all had in common was our eagerness to be free. We were instructed to use first names and wear civilian clothes. Most were only to happy to comply.
Instruction was aimed at re-integrating us into the job force. We learned how to dress, how to speak, how to compose a resume, how to look for a job, and how to network among other things. We also learned about the benefits we were entitled to because of our military service and how best to take advantage of them.
I learned several things:
  1. My resume is a haphazard, slovenly mess.
  2. Employers will probably hire me anyway, eventually.
  3. Certain women think I am Drop Dead Gorgeous. (DDG TM)
The last realization came during casual conversation with some buddies from my Battalion who were also in the class. What led to the stunning relevation (stunning for me anyway) was a casual discussion about wayward wives and how best to deal with them. In one case in particular, I recommended that a fellow soldier "Check that **". Somehow I reached a level of candor and openness with the soldier I was talking to that he felt comfortable saying, "My wife wants to **** you."
I stammered the wittiest reply I could, and then immediately demanded an explanation. Knowing a coworker's wife desired carnal knowledge (while flattering) was unsettling. He explained that her stated desire to perform the horizontal wild animal tango stemmed from an incident at a local nightclub last Fall. A local radio station was holding a sexy pajama contest for tickets to a Ying Yang twins concert. Believing the prize to be one hundred dollars I entered out of a naked desire for cold hard cash. Dressed in a black tank top, Old Navy pajama bottoms adorned with American flags, and Homer Simpson slippers borrowed from a helpful cook, I stole the collective heart of the female attendees at the club. It probably helped that I somehow lost the tank top in the course of the contest. (The stupid thing wouldn't stay on!)
So my buddy's wife saw me there and told her husband. He told me.
Oh and the Ying Yang twins never showed up at the concert. DOH!

2.01.2006

OOGA CHAKA

Is this why David Hasselhoff is famous in Germany? Because he stars in ridiculous, amateurishly shot, although wildly entertaining music videos? I could do that.

1.31.2006

This blog as a thermometer

I thought that when I returned to the United States that I would be free to talk about everything I did and everything going on around me in the Army. I am not. I can't tell you what is happening in the battalion formerly known as the proud 1-503D INF. REGT. I can tell you I am sad.
My battalion has always had a reputation for wildness but certain things that have occurred since we returned have crossed the line. Behavior that was acceptable or even expected in Korea just doesn't fly in the United States. I've always said that people in the battalion where going to have trouble adjusting to be in a regular unit after being in Korea and Iraq, and I was right.
I can't talk about what is happening, but not because of OPSEC. I can tell you that this blog is most useful to the military families at home as a thermometer - as an indirect measure of unit morale. When posts are few and far between, and generally negative in character, overall morale is probably low. When I can write freely and openly about events in the unit, business is good. When post are few and far between and maybe a little confused, morale is very good - I've been out partying too much to post to the blog.
On a happier note, I have a tidbit of information to dribble out to certain interested parties. Stop-loss orders, unless I am grossly mistaken (which has happened more than once), only come down ninety days before a deployment or deployment availability. Regular readers of military newspapers have a good idea of when 2BCT, 2ID is available for deployment. If your soldier is hoping to separate from the Army or move to another unit it should be a simple matter to count back the days and decide whether stop-loss orders are likely to interfere. I, for one, have nothing to worry about (I get out of the Army May 6th). My life became much easier when I realized that I could stop listening to the rumors about stop-loss and plan for the future.