General discussion

Locked

Scott's Thoughts & Stuff

By n3bu1a ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

14 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Welcome!

by n3bu1a In reply to Scott's Thoughts & Stuff

Hi everyone!<br />
Thanks for taking the time out of your busy schedule to visit my corner of the web.? I'm going to use this blog as a sounding board for my thoughts on pretty much everything, so if you're interested in anything, check back often.? I'll be updating a lot and there will always be something different.<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/207702/">This post originally appeared on an external website</a></div>

Collapse -

Converting a DataSet to an ADODB.Recordset

by n3bu1a In reply to Scott's Thoughts & Stuff

Hey everybody.? Right now I'm working on a "on-the-fly" method of converting a .Net DataSet to an ADODB.Recordset.? After doing countless searches on google (and any site therein), I found that the majority of conversion methodologies required storing the file to hard disk (which can be pretty painful if you do web development), or did just a plain lousy job of explaining anything.<br />
<br />
Once I get the process flushed out and a little better commented, I'll post it.? Just to give some background, the conversion methods are encapsulated in its own class, so it should be fairly portable.? I'm hoping to have this up by either the end of this week, or beginning of next.? Enjoy!<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/209890/">This post originally appeared on an external website</a></div>

Collapse -

Drunken Musings I

by n3bu1a In reply to Scott's Thoughts & Stuff

<p>Hey!<br />
In my last post, I mentioned that I would have something set up for converting a .Net DataSet to an ADODB.Recordset.? I actually have this finished, but as I am a lazy *******, I don't have it set up yet.<br /></p>
<p>Actually, here's my blog/thought of the day.? Why do ex's make life difficult?? My ex-fiancee (never got married) is trying to make life difficult.? While we were dating/engaged, I backed her car in to a pole, and I told her I would fix it.? I have hit some extreme situations since then and have not been able to get it fixed - for those that know me, you'll know what I'm talking about, for those that don't and are curious, please drop me a line.? Anyway, I can only talk to my ex through e-mail, which is tough enough, and have managed to "misunderstand" a bunch of things.? Now she's threatening legal action after I have saved her from a lot of financial ruin.? Am I wrong for being slightly upset about this?? Why do lawyers need to be brought in?? Why can't things be easier?? Why does my ex hate me?? Oh well.? I will not let this situation beat me down.? Thanks for listening.? The conversiont thing is coming.<br /></p>
<p>Later!<br /></p><p><div class="blogdisclaim"><a href="http://srallender.blog.com/220551/">This post originally appeared on an external website</a></div>

Collapse -

Life Update

by n3bu1a In reply to Scott's Thoughts & Stuff

Ok, so I'm on this whole kick right now to better myself and create a better me.? Well, of course that includes changing my email on every frigging service I belong to, which is too many to count.? How in the **** did humanity ever live in this world without belonging to fifty different news service organizations, online stores and such?? It really makes me wonder who out there has my email address, and what could they be doing with it?? I'm sure there is a ninety year old Ukrainian women sitting in her hovel rubbing her hands together saying something along the lines like "He he he... now who can I email as Scott Allender?"? Probably would sound a lot better if you think with a ninety year old Ukranian woman accent.<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/223711/">This post originally appeared on an external website</a></div>

Collapse -

Cool New Tool

by n3bu1a In reply to Scott's Thoughts & Stuff

Well, special thanks to friends Han Gerwitz and Ryan Stephenson.? With their direction, I found this awesome new bookmark utility calle del.icio.us.? This thing is awesome; I can pretty much upload whatever the **** I want as a bookmark and boom, it stores and puts it into html (ideal for a home page) and rss feed (great for aggregators if you want to know about my tastes and stuff).? Anyway, this thing rocks!? So much so that I've devoted an entire blog to it.<br />
<br />
All right, I need to get out more.? I know.<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/225843/">This post originally appeared on an external website</a></div>

Collapse -

Convert a .Net DataSet to an ADODB.Recordset

by n3bu1a In reply to Scott's Thoughts & Stuff

All right, without further ado and sorry for the wait, here's the code for converting a DataSet to a Recordset without using a hard file, i.e. the Microsoft way.? I've got this thing embedded in a web service, but feel free to incorporate it into a standalone dll.? As my intention for this thing is to share it as much as possible (it was **** trying to figure out how to make this work without a hard file), feel free to copy and use however you want.<br />
<br />

Public Class VbConvert


'**************************************************************************


' Method Name : GetADORS


' Description : Takes a DataSet and converts into a Recordset. The converted


' ADODB recordset is saved as an XML file. The data is saved


' to the file path passed as parameter.


' Output : The output of this method is long. Returns 1 if successfull.


' If not throws an exception.


' Input parameters:


' 1. DataSet object


' 2. Database Name


' 3. Output file - where the converted should be written.


'**************************************************************************


Public Function GetADORS(ByVal ds As DataSet) As String


Dim strRsXml As String


'Create an xmlwriter object, to write the ADO Recordset Format XML


Try


Dim sw As New MemoryStream


Dim xwriter As New XmlTextWriter(sw, System.Text.Encoding.Default)


'call this Sub to write the ADONamespaces to the XMLTextWriter


WriteADONamespaces(xwriter)


'call this Sub to write the ADO Recordset Schema


WriteSchemaElement(ds, xwriter)


Dim TransformedDatastrm As New MemoryStream


'Call this Function to transform the Dataset xml to ADO Recordset XML


TransformedDatastrm = TransformData(ds)


'Pass the Transformed ADO REcordset XML to this Sub


'to write in correct format.


HackADOXML(xwriter, TransformedDatastrm)


xwriter.BaseStream.Position = 0


Dim sr As New StreamReader(xwriter.BaseStream)


strRsXml = sr.ReadToEnd


xwriter.Flush()


xwriter.Close()


sr.Close()


Return strRsXml.ToString


Catch ex As Exception


'Returns error message to the calling function.


Err.Raise(100, ex.Source, ex.ToString)


End Try


End Function


Private Sub WriteADONamespaces(ByRef writer As XmlTextWriter)


'The following is to specify the encoding of the xml file


'writer.WriteProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'")


'The following is the ado recordset format


'<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'


' xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'


' xmlns:rs='urn:schemas-microsoft-com:rowset'


' xmlns:z='#RowsetSchema'>


' </xml>


'Write the root element


writer.WriteStartElement("", "xml", "")


'Append the ADO Recordset namespaces


writer.WriteAttributeString("xmlns", "s", Nothing, "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")


writer.WriteAttributeString("xmlns", "dt", Nothing, "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882")


writer.WriteAttributeString("xmlns", "rs", Nothing, "urn:schemas-microsoft-com:rowset")


writer.WriteAttributeString("xmlns", "z", Nothing, "#RowsetSchema")


writer.Flush()


End Sub


Private Sub WriteSchemaElement(ByVal ds As DataSet, ByRef writer As XmlTextWriter)


'ADO Recordset format for defining the schema


' <s:Schema id='RowsetSchema'>


' <s:ElementType name='row' content='eltOnly' rs:updatable='true'>


' </s:ElementType>


' </s:Schema>


'write element schema


writer.WriteStartElement("s", "Schema", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")


writer.WriteAttributeString("id", "RowsetSchema")


'write element ElementTyoe


writer.WriteStartElement("s", "ElementType", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")


'write the attributes for ElementType


writer.WriteAttributeString("name", "", "row")


writer.WriteAttributeString("content", "", "eltOnly")


writer.WriteAttributeString("rs", "updatable", "urn:schemas-microsoft-com:rowset", "true")


WriteSchema(ds, writer)


'write the end element for ElementType


writer.WriteFullEndElement()


'write the end element for Schema


writer.WriteFullEndElement()


writer.Flush()


End Sub


Private Sub WriteSchema(ByVal ds As DataSet, ByRef writer As XmlTextWriter)


Dim i As Int32 = 1


Dim dc As DataColumn


For Each dc In ds.Tables(0).Columns


dc.ColumnMapping = MappingType.Attribute


writer.WriteStartElement("s", "AttributeType", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")


'write all the attributes


writer.WriteAttributeString("name", "", dc.ToString)


writer.WriteAttributeString("rs", "number", "urn:schemas-microsoft-com:rowset", i.ToString)


writer.WriteAttributeString("rs", "baseCatalog", "urn:schemas-microsoft-com:rowset", Me.DBNAME)


writer.WriteAttributeString("rs", "baseTable", "urn:schemas-microsoft-com:rowset", _


dc.Table.TableName.ToString)


writer.WriteAttributeString("rs", "keycolumn", "urn:schemas-microsoft-com:rowset", _


dc.Unique.ToString)


writer.WriteAttributeString("rs", "autoincrement", "urn:schemas-microsoft-com:rowset", _


dc.AutoIncrement.ToString)


'write child element


writer.WriteStartElement("s", "datatype", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")


'write attributes


writer.WriteAttributeString("dt", "type", "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882", _


GetDatatype(dc.DataType.ToString))


writer.WriteAttributeString("dt", "maxlength", "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882", _


dc.MaxLength.ToString)


writer.WriteAttributeString("rs", "maybenull", "urn:schemas-microsoft-com:rowset", _


dc.AllowDBNull.ToString)


'write end element for datatype


writer.WriteEndElement()


'end element for AttributeType


writer.WriteEndElement()


writer.Flush()


i = i + 1


Next


dc = Nothing


End Sub


'Function to get the ADO compatible datatype


' Feel free to add as many ADO compatible data types, I needed only two.


Private Function GetDatatype(ByVal dtype As String) As String


Select Case (dtype)


Case "System.Int32"


Return "int"


Case "System.Float"


Return "float"


Case Else


Return "string"


End Select


End Function


'Transform the data set format to ADO Recordset format


'This only transforms the data


Private Function TransformData(ByVal ds As DataSet) As MemoryStream


Dim config As New System.Configuration.AppSettingsReader


Dim xslFile As String = config.GetValue("rsXsl", Type.GetType("System.String"))


Dim instream As New MemoryStream


Dim outstream As New MemoryStream


'write the xml into a memorystream


ds.WriteXml(instream, XmlWriteMode.IgnoreSchema)


instream.Position = 0


'load the xsl document


Dim xslt As New XslTransform


xslt.Load(xslFile)


'create the xmltextreader using the memory stream


Dim xmltr As New XmlTextReader(instream)


'create the xpathdoc


Dim xpathdoc As XPathDocument = New XPathDocument(xmltr)


'create XpathNavigator


Dim nav As XPathNavigator


nav = xpathdoc.CreateNavigator


'Create the XsltArgumentList.


Dim xslArg As XsltArgumentList = New XsltArgumentList


'Create a parameter that represents the current date and time.


Dim tablename As String


xslArg.AddParam("tablename", "", ds.Tables(0).TableName)


'transform the xml to a memory stream


xslt.Transform(nav, xslArg, outstream)


instream = Nothing


xslt = Nothing


xmltr = Nothing


xpathdoc = Nothing


nav = Nothing


'outstream.Position = 0


Return outstream


End Function


'**************************************************************************


' Method Name : ConvertToRs


' Description : The XSLT does not tranform with fullendelements. For example,


' <root attr=""/> intead of <root attr=""><root/>. ADO Recordset


' cannot read this. This method is used to convert the


' elements to have fullendelements.


'**************************************************************************


Private Sub HackADOXML(ByRef wrt As XmlTextWriter, ByVal ADOXmlStream As System.IO.MemoryStream)


ADOXmlStream.Position = 0


Dim rdr As New XmlTextReader(ADOXmlStream)


Dim outStream As New MemoryStream


rdr.MoveToContent()


'if the ReadState is not EndofFile, read the XmlTextReader for nodes.


Do While rdr.ReadState <> ReadState.EndOfFile


If rdr.Name = "s:Schema" Then


wrt.WriteNode(rdr, False)


wrt.Flush()


ElseIf rdr.Name = "z:row" And rdr.NodeType = XmlNodeType.Element Then


wrt.WriteStartElement("z", "row", "#RowsetSchema")


rdr.MoveToFirstAttribute()


wrt.WriteAttributes(rdr, False)


wrt.Flush()


ElseIf rdr.Name = "z:row" And rdr.NodeType = XmlNodeType.EndElement Then


'The following is the key statement that closes the z:row


'element without generating a full end element


wrt.WriteEndElement()


wrt.Flush()


ElseIf rdr.Name = "rs:data" And rdr.NodeType = XmlNodeType.Element Then


wrt.WriteStartElement("rs", "data", "urn:schemas-microsoft-com:rowset")


ElseIf rdr.Name = "rs:data" And rdr.NodeType = XmlNodeType.EndElement Then


wrt.WriteEndElement()


wrt.Flush()


End If


rdr.Read()


Loop


wrt.WriteEndElement()


wrt.Flush()


End Sub


Private Const DBNAME As String = "******"


End Class

<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/225849/">This post originally appeared on an external website</a></div>

Collapse -

What's Going On?

by n3bu1a In reply to Scott's Thoughts & Stuff

Ok, it's about 1 am on Tuesday morning, and I'm sitting here after working 11 hours and cleaning my house for about 5 hours.? When did life get so mundane?? I mean seriously, I'm 24, and I spent a night cleaning my house.? Granted, I could use a mundane night, so I shouldn't really be complaining, but still... I remember thinking to myself that when I was grown up things would be so much easier and exciting than as a little kid.? Now, I would love the opportunity to spend a single afternoon being childlike.? I guess that's the cosmic joke, huh?? You always want to be in a state of mind than what you're currently in.? Kind of a take on the grass is always greener thing.<br />
<br />
Anyway, today should be much more interesting.? I start working with a new client, which is always exciting, I get to interview my first candidate for a roommate, and... I don't know.? I guess something will come up, and if it doesn't, great.? I can take the time to relax.<br />
<br />
Oh by the way, this past weekend was great.? I finished my second bike century, a hundred mile bike ride.? This ride was sponsored by the American Diabetes Association, and if you want to donate go to the <a href="http://www.diabetes.org/support-the-cause/make-a-donation.jsp">American Diabetes Association Donation</a> page.? Diabetes is a serious, treatable illness.<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/229801/">This post originally appeared on an external website</a></div>

Collapse -

Romance and Stuff

by n3bu1a In reply to Scott's Thoughts & Stuff

Ok, so I really like this girl.? She's extremely attractive, but there are several things impeding a potential relationship between her and myself.? To elaborate, she's drop dead gorgeous, but something that has been bothering me is that the more I find out about her, the more she reminds me of my ex-fiance.? it's kind fo tough to reconcile that.? I just can't seem to get past the things that I know about this new woman, because they are so close to what I have already experienced.??<br />
<br />
Should a learning experince (my time with my ex-fiance) cripple potential experiences with other women?<br /><p><div class="blogdisclaim"><a href="http://srallender.blog.com/230999/">This post originally appeared on an external website</a></div>

Collapse -

Romance and Stuff

by DC Guy In reply to Romance and Stuff

<p>Most of us tend to be attracted to the same kind of person over and over again. Those are the peole we like. Those are the people who like us. We have fun together. Our values are compatible. Emotionally, instinctively, intellectually, we have preferences in people just as we have them in food and art. And they feel the same way about us.</p>
<p>Duh!</p>
<p>You should turn this dilemma into an asset. How did you enjoy the relationship with your fiancee? (Two E's please, we live in a new era and you don't want to make a gender typo!) What was the cause of the failure? Did you have good times or did you fight a lot? Was it a blind date or an accident of hormones that turned into a train wreck? Or was it a good match that just turned bad because of fate and perhaps a bit of inexperience and immaturity?</p>
<p>If this woman doesn't turn out to be the one you keep for life, you'll probably notice that many or most of her successors also bear a lot of resemblance to one another.</p>
<p>If this similarity is so spooky that it just creeps you out, then go with your gut and bail. Or if you're doggedly looking for the adventure that comes with diversity and more of the same feels like a big disappointment, then keep looking. But if you're just wondering, I'd say stop wondering and go for it. This type of woman seems to be your type. Enjoy!</p>

Collapse -

Life Update II

by n3bu1a In reply to Scott's Thoughts & Stuff

So yeah, I just got back from Chicago where my youngest nephew, Austin Michael Bates, was christened.? I have such love for my sister's family; almost like it was my o own.? Anyway, anytime I go to Chicago I always return refreshed and ready for anything.? Which is good as I have my family's reunion this upcoming week, more fun with my new client, a roommate to prepare for, and as always, the other comings and goings in my life.? On the plus side, I feel pretty confident that my life will keep me very busy this week.<p><div class="blogdisclaim"><a href="http://srallender.blog.com/235957/">This post originally appeared on an external website</a></div>

Back to After Hours Forum
14 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums